Searching


Searching for resources is fundamental to the mechanics of FHIR. The following sections describe how the Allscripts FHIR API support specific search functions.

For information on searching, see Search - FHIR v4.0.1 (hl7.org).

Date Comparators

  • When searching by dates, the following comparators are used instead of symbols:
    • Eq: equal. For example:
    • /medicationrequest?date=eq2022-01-01 (Means: “Get me the medication requests for the date January 1, 2022.”)
    • Gt: greater than. For example:
    • /medicationrequest?date=gt2022-01-01 (Means: “Get me the medication requests for dates after January 1, 2022.”)
    • Ge: greater than or equal.
    • Lt: less than.
    • Le: less than or equal.

These comparators can be used to search by a date range. For example:

/medicationrequest?date=ge2022-01-01&date=le2022-1-31 (Means: “Get me the medication requests for the month of January 2022.”)

Common Search Parameters

  • The Allscripts FHIR API currently supports the following common search parameters:
    • _id: Search by the resource ID. For example:
    • GET [FHIR path]/Patient?_id=INF-101 (Means: “Get the patient resource with the _ID equal to INF-101.”)
    • _lastUpdated: Search by the resource’s last updated date.
    • GET [FHIR path]/Observation?_lastUpdated=ge2022-3-1 (Means: “the observations that have changed since March 1, 2022.”)
    • _count: Do not return more than this number of resources in each response. For example:
    • GET [FHIR path]/Observation?_lastUpdated=ge2022-3-1&_count=1 (Means: “Get the observations that have changed since March 1, 2022, but include only one resource in each response.”)
    • _include: Include the subject resources in the results. This parameter works only in conjunction with the Provenance resource at this time. See the section below.
    • _revinclude: Include any resources that refer to the primary resource in the result. This parameter works only in conjunction with the Provenance resource at this time. See the section below.

For more information on how to work with these parameters, go to: Search - FHIR v4.0.1 (hl7.org).

Provenance

The Provenance resource tracks information about the activity that created, revised, deleted, or signed a version of a resource. This information can be used to form assessments about its quality, reliability, trustworthiness, or to provide pointers for where to go to further investigate the origins of the resource and the information in it. The Allscripts FHIR API does not currently support searching on the Provenance resource. If you have the resource _ID value, you can perform a GET, but you cannot search.

Searching with provenance

The Allscripts FHIR API supports searching by provenance with the _include and _revinclude parameters. Use the _include parameter to get resources that are referenced by the primary resource. For example:

[FHIR path]/allergyintolerance?_id=INF-101&_revinclude=Provenance:target (Means: “Get me the AllergyIntolerance resource with the _ID INF-101 and include all provenance records that this AllergyIntolerance targets”)

For more information on the Provenance resource, see Provenance - FHIR v4.0.1 (hl7.org).