0. References
HL7 UK | Care Connect Profile: Encounter |
HL7 FHIR Resource: Encounter |
User Stories: User Stories |
1. Read
Return a single Encounter
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
Fetches a bundle of all Encounter
resources for the specified patient.
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 Encounter 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 |
---|---|---|---|---|
date |
date |
A date within the period the Encounter lasted | SHOULD | Encounter.period |
patient |
reference |
The identity of a patient to list encounters for | MUST | Encounter.patient (Patient) |
status |
token |
planned | arrived | triaged | in-progress | onleave | finished | cancelled | entered-in-error | unknown | MUST | Encounter.status |
type |
token |
Specific type of encounter | SHOULD | Encounter.type |
Search parameter combinations and modifiers for the Encounter resource are as follows:
Parameter Combinations | Type | Conformance | Modifiers |
---|---|---|---|
patient + status |
reference + token |
MUST | |
patient + date |
reference + date |
SHOULD | date modifiers ‘ge’,‘le’,’gt’,’lt’ |
patient + type |
reference + token |
SHOULD | |
patient + type + date |
reference + token + date |
SHOULD | date modifiers ‘ge’,‘le’,’gt’,’lt’ |
This section outlines the search parameter syntax used, with some examples provided.
2.1.1. date
See date for details on this parameter. ‘date’ can be used multiple times as a search parameter
GET [baseUrl]/Encounter?patient=1&date=ge2010-01-01&date=le2011-12-31
Return all Encounter resources that have a date greater than or equal to 1st Jan 2010, a date less than or equal to 31st Dec 2011 and Patient with a logical id of 1.
2.1.2. patient
See reference for details on this parameter. The patient parameter can be used two ways:
This MUST be supported for all endpoint provider systems.
id
is the logical id of the patient on the server which can be obtained by a Patient resource query.
GET [baseUrl]/Encounter?patient=42
Return all Encounter resources for Patient with a logical id of 42
This SHOULD be supported for all endpoint provider systems.
system
is a uniform resource identifier which defines which CodeSystem the identifer belongs to. For NHS Number this would be https://fhir.nhs.uk/Id/nhs-number
and code
would be the NHS Number.
GET [baseUrl]/Encounter?patient.identifier=https://fhir.nhs.uk/Id/nhs-number|9876543210
Return all Encounter resources for Patients with a NHS Number of 9876543210
2.1.3. status
See token for details on this parameter.
To filter on status ( planned | arrived | triaged | in-progress | onleave | finished | cancelled | entered-in-error | unknown
)
GET [baseUrl]/Encounter?patient=1&status=planned
Return all Encounter resources with a status of planned and Patient with a logical id of 1.
2.1.4. type
See token for details on this parameter.
To search for Encounters with typeConsultation
using SNOMED CT
GET [baseUrl]/Encounter?patient=[id]&code=http://snomed.info/sct|11429006
Return all Encounter resources with SNOMED CT encounter code of 11429006 and Patient with a logical id of 1.
GET [baseUrl]/Encounter?patient=1&code=11429006
Return all Encounter resources with an encounter code of 11429006 from any CodeSystem and Patient with a logical id of 1.
2.1.5. patient + type + date
To search for Encounters with typeConsulation
and date range
GET [baseUrl]/Encounter?patient=[id]&code=http://snomed.info/sct|11429006&date=ge2010-01-01&date=le2011-12-31
Return all Encounter resources with SNOMED CT encounter code of 11429006, with a date range greater than or equal to 1st Jan 2010 -> less than or equal to 31st Dec 2011 and Patient with a logical id of 1.
GET [baseUrl]/Encounter?patient=1&code=11429006&date=ge2010-01-01&date=le2011-12-31
Return all Encounter resources with encounter code of 11429006 from any CodeSystem, with a date range greater than or equal to 1st Jan 2010 -> less than or equal to 31st Dec 2011 and Patient with a logical id of 1.
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 Encounter resources with an id of 4, 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/Encounter?patient=4'
3.2 Explore the Response
Explore the response in XML & JSON on the Reference Implementation below
Reference Implementation
XML Patient id search RI viewer
JSON Patient id search RI viewer