Skip to main content

Search

The Search operation is used to retrieve a resources from the server using search parameters. This will be an overview of what we support from the FHIR search specification. The server will return the resources that match the search parameters.

Resource Parameters supported

TypeSupportedDescription
NumberYesSearching on a simple numerical value in a resource
Date/DateTimeYesA date parameter searches on a date/time or period
StringYesSearching on simple string values in a resource
TokenYesA token type is a parameter that provides a close to exact match search on a string of characters.
ReferenceYesA reference parameter refers to references between resources.
CompositeNoComposite search parameters support joining single values with a $
QuantityYesA quantity parameter searches on the Quantity data type.
URIYesThe uri parameter refers to an element that contains a URI

Special Parameters

NameSupportedDescription
_idYesLogical id of a resource
_lastUpdatedYesInstant the resource was last updated
_tagYesMeta.tag of the resource
_profileYesMeta.profile of the resource
_securityYesMeta.security of the resource
_textYesSearch on the narrative of the resource
_contentYesSearch on the content of the resource
_listNo
_hasNoFor reverse chaining
_typeYesFilter system search on a specific set of resource types.
_sortYesSet the parameter to use for sorting. We also support sorting priority based on comma seperation of parameters.
_countYesMax it can be set to is 50.
_includeyesInclude related resources in bundle. Include resources referenced by current resource.
_revincludeyesInclude related resources in Bundle. Include resources that reference current resource.
_summaryNoReturn a portion of the resource
_totalYesReturn the total count of parameters matching query (including resources not returned by _count limitation).
_elementNoReturn summary based on parameters
_countainedNoWhether to return resources contained in other resources.
_containedTypeNoDetermine whether to return container or contained.

Chaining

When searching for data you may want to find resources based on data linked to a resource. For example finding an Observation by a patients MRN identifier. To perform these kinds of searches you use chaining. Our api supports chained parameters so in the example above you can perform the following query:

curl --request GET --url https://{my-api}/Observation?patient.identifier={mrn-system}|12345

To retrieve all observations for a patient with an mrn identifier of 12345. The way this is accomplised is that Observation stores a reference parameter for patient and the Patient resource has a token parameter for identifier so in above example we chain both of these parameters together. You can have chaining to any depth.

Modifiers

Modifiers are colon seperated values that alter the behavior of search. For example the following query:

curl --request GET --url https://{my-api}/Patient?name=bob

Will perform a default string search which is a case insensitive search for all patients whose name starts with bob.

To make this more specific we can use the exact modifier as follows:

curl --request GET --url https://{my-api}/Patient?name:exact=Bob

This will perform a case sensitive search to find all Patients whose name exactly matches Bob.

Supported Modifiers

NameSupportedTypesDescription
missingYestokenSearch for values that don't have a value for given parameter.
exactYesstringSearch for an exact match of the given value.
containsYesstringSearch for a value that contains given value.

Prefixes

Prefix which specifies the type of matching that occurs. This is used for odered parameter types number, date and quantity.
Currently we only have support for number based prefixes but plan on adding date and quantity support in the near future.
For example the following query:

curl --request GET --url https://{my-api}/RiskAssessment?probability=0.5

Will query for all RiskAssessments who a probability of 0.5 with range given by decimal precision of query.

If instead you want to query for RiskAssessments with probability less than equal to 0.5 you would use the le prefix as follows:

curl --request GET --url https://{my-api}/RiskAssessment?probability=le0.5

Supported Prefixes

NameSupportedTypeDescription
eqYesnumberexact match of a value. By default matching is done by range of decimal precision this forces an exact match.
neYesnumberSearch for value of parameter that is not the value provided.
gtYesnumberSearch for values greater than value provided.
ltYesnumberSearch for values less than value provided.
geYesnumberSearch for values greater than or equal to the value provided.
leYesnumberSearch for values less than or equal to the value provided.
saNothe value for the parameter in the resource starts after the provided value
ebNothe value for the parameter in the resource ends before the provided value
apNoThe value for the parameter in the resource is approximately the same to the provided value.