0. References
HL7 UK | Care Connect Profile: Patient |
HL7 FHIR Resource: Patient |
User Stories: User Stories |
1. Read
Return a single Patient
for the specified id.
All requests MUST contain a valid ‘Authorization’ header and SHOULD contain an ‘Accept’ header. The `Accept` header indicates the format of the response the client is able to understand, this will be one of the following application/fhir+json
or application/fhir+xml
.
1.1. Response
A full set of response codes can be found here API Response Codes. FHIR Servers MUST support the following response codes:
200 | successful operation |
400 | invalid parameter |
401/4xx | unauthorized request |
403 | insufficient scope |
404 | resource not found |
410 | resource deleted |
2. Search Parameters
Fetches a bundle of all Patient
resources for the specified patient or search criteria.
All requests MUST contain a valid ‘Authorization’ header and SHOULD contain an ‘Accept’ header. The `Accept` header indicates the format of the response the client is able to understand, this will be one of the following application/fhir+xml
or application/fhir+json
.
2.1. Search Parameters
The search parameters and combinations that are mandated as a minimum in the API for the Patient resource are detailed below.
Query parameters conformance will be categorised as:
MUST - these search parameters MUST be implemented for the specified resource type.
SHOULD - these search parameters are expected to be implemented, if the data to support the query is present in the host system.
Additional search parameters MAY be added to reflect local requirements.
To be conformant, provider systems are required to implement all of the MUST parameters.
The parameters can be used independently or in combination to help refine the search results returned.
Name | Type | Description | Conformance | Path |
---|---|---|---|---|
birthdate |
date |
The patient's date of birth | MUST | Patient.birthDate |
family |
string |
A portion of the family name of the patient | MUST | Patient.name.family |
gender |
token |
Gender of the patient | MUST | Patient.gender |
given |
string |
A portion of the given name of the patient | MUST | Patient.name.given |
identifier |
token |
A patient identifier (NHS Number, Hospital Number, etc) | MUST | Patient.identifier |
name |
string |
A portion of either family or given name of the patient | MUST | Patient.name |
Search parameter combinations for the Patient resource are as follows:
Parameter Combinations | Type | Conformance |
---|---|---|
name + gender |
string + token |
MUST |
name + birthdate |
string + date |
MUST |
family + gender |
string + token |
MUST |
given + gender |
string + token |
MUST |
This section outlines the search parameter syntax used, with some examples provided.
2.1.1. identifier (NHS Number, Hospital Number, etc)
GET [baseUrl]/Patient?identifier=[code]
See token for details on this parameter.
GET [baseUrl]/Patient?identifier=https://fhir.nhs.uk/Id/nhs-number|9876543210
Return all Patient resources with NHS Number of 9876543210.
2.1.2. name + gender
GET [baseUrl]/Patient?name=[name]&gender=[code]
See string and token for details on these parameters.
GET [baseUrl]/Patient?name=bernie%20kanfeld&gender=female
Return all Patient resources with name of Bernie Kanfeld and Administrative Sex of female.
2.1.3. name + birthdate
See string and date for details on these parameters. ‘birthdate’ can be used multiple times as a search parameter
GET [baseUrl]/Patient?name=bernie%20kanfeld&birthdate=ge2010-01-01&birthdate=le2011-12-31
Return all Patient resources with name of Bernie Kanfeld and that have a birthdate greater than or equal to 1st Jan 2010 and birthdate less than or equal to 31st Dec 2011.
2.1.4. family + gender
GET [baseUrl]/Patient?family=[family]&gender=[code]
See string and token for details on these parameters.
GET [baseUrl]/Patient?family=kanfeld&gender=female
Return all Patient resources with surname of Kanfeld and Administrative Sex of female.
2.1.5. given + gender
GET [baseUrl]/Patient?given=[given]&gender=[code]
See string and token for details on these parameters.
GET [baseUrl]/Patient?given=bernie&gender=female
Return all Patient resources with forename of Bernie and Administrative Sex of female.
2.2. Search Response
If the search fails (cannot be executed, not that there is no matches), the return value is a status code 4xx or 5xx with an OperationOutcome.
If the search succeeds, the return content is a Bundle with type = searchset containing the results of the search as a list of resources in a defined order. The result list can be long, so servers MAY use paging. If they do, they MUST use this Paging method for breaking the list into pages if appropriate. The server MAY also return an OperationOutcome resource with additional information about the search.
A full set of response codes can be found here API Response Codes. FHIR Servers MUST support the following response codes:
200 | successful operation |
400 | invalid parameter |
401/4xx | unauthorized request |
403 | insufficient scope |
404 | resource not found |
410 | resource deleted |
3.1 cURL
Return all Patient resources with a NHS Number 9876543210, the format of the response body will be xml. The Reference Implementation is hosted at 'https://data.developer.nhs.uk/ccri/'.curl -X GET -H 'Accept: application/fhir+xml' -H 'Authorisation: BEARER [token]' -v 'https://data.developer.nhs.uk/ccri-fhir/STU3/Patient?identifier=https://fhir.nhs.uk/Id/nhs-number%7C9876543210'
3.2 Explore the Response
Explore the response in XML & JSON on the Reference Implementation below
Reference Implementation
XML Patient NHS number search RI viewer
JSON Patient NHS number search RI viewer