Skip to content

Operation $everything on patient

In healthcare, there’s often a need to find all patient data for various uses, be it getting a full view of the patient’s medical history or using the data for analytics and app integrations. As such, the FHIR specification has the option to query a set of resources associated with a particular patient(s). The response is a bundle of type "searchset". At a minimum, the patient resource(s) itself is returned, along with any other resources in the Patient's compartment and that are available for the given user.

Endpoints

There are two endpoints that can be used to perform this operation, depending on the use case. The endpoint to obtain all patients and resources related to them:

[fhir_base]/Patient/$everything

The endpoint to obtain a particular patient and the set of resources associated with it:

[fhir_base]/Patient/[id]/$everything

Query parameters

The Kodjin FHIR service supports the following query parameters. All of these parameters are optional:

Name Type Description
_count integer The amount of resources in the response
_since instant Records that were created or updated after this moment in time
_type code Resource type
end date Clinical end date. If no end date is provided, all records after the start date are in scope.
start date Clinical start date. If no start date is provided, all records prior to the end date are in scope.

Additional resources

Patient resource can be added to the response, even if it doesn't match search criterias, to support a fuller view on the patient compartment. In this case, it will have search mode “include”. Each page of the searchset contains all the patients, referenced by the resources on the page. If a response page does not contain an included patient, it simply means that patient matches specified search criterias and therefore has search mode “match”.

Examples

The example below shows how to retrieve data for a patient with an ID in the URL. This could be useful for the Blue Button app, for example. The user receives all Patient compartment information by Patient.id posted any time before the query.

Example – Get Patient everything by Patient ID

GET https://kodjin-example.edenlab.dev/fhir/Patient/aa74fca2-2c68-47a8-98b6-3857d3df75c4/$everything

In case you don’t need all of the EHR information but only the data posted since a specific time or date, you can run the $everything command with a _since filter. In the example below, we retrieved information posted from a specific date (2022-08-18 12:43:19) up to the present time.

Example – Get Patient everything since [time/date]

GET https://kodjin-example.edenlab.dev/fhir/Patient/aa74fca2-2c68-47a8-98b6-3857d3df75c4/$everything?_since=2022-08-18T12:43:19.156Z

We can have Patient/$everything filtered by one or more resources. For example, we need only Observation for the current Patient, and we are not interested in other resources, like MedicationRequests, etc. In this case, we could use the _type filter and ask only for the resources we are interested in.

Example – Get Observations for my Patient

GET https://kodjin-example.edenlab.dev/fhir/Patient/aa74fca2-2c68-47a8-98b6-3857d3df75c4/$everything?_type=Observation

All filters could be combined in the request, so we can ask for an exact resource made in an exact period of time (2022-08-18 12:43:19).

Example – Get Observations for my Patient posted since [time/date]

GET https://kodjin-example.edenlab.dev/fhir/Patient/aa74fca2-2c68-47a8-98b6-3857d3df75c4/$everything?_type=Observation&_since=2022-08-18T12:43:19.156Z

This example is for receiving all patients with all EHR information for them.

Example – Get Patient everything

GET https://kodjin-example.edenlab.dev/fhir/Patient/$everything