Advanced FHIR search features

This page explains how to search for FHIR resources using more advanced query functionality available through the projects.locations.datasets.fhirStores.fhir.search method. This guide assumes that you are already familiar with the contents of Searching for FHIR resources.

Sample FHIR bundle

The samples on this page use the following JSON FHIR bundle to show the results of advanced FHIR search features. Save the JSON file to your machine to use it in the samples. You can download the file or copy and paste it from the following section:

Sample JSON FHIR bundle

{
  "entry": [
    {
      "fullUrl": "test-patient1",
      "request": {
        "method": "PUT",
        "url": "Patient/patient1"
      },
      "resource": {
        "resourceType": "Patient",
        "id": "patient1",
        "meta": {
          "versionId": "1",
          "lastUpdated": "2017-11-28T03:15:15.497+00:00",
          "tag": [
            {
              "system": "tag-system",
              "code": "tag1",
              "display": "Tag One"
            },
            {
              "system": "other-system",
              "code": "tag2",
              "display": "Tag Two"
            }
          ]
        },
        "active": false,
        "name": [
          {
            "use": "usual",
            "text": "Alex Lee",
            "family": "Lee",
            "given": [
              "Alex",
              "Cleve"
            ]
          },
          {
            "use": "nickname",
            "given": [
              "Joe"
            ]
          }
        ],
        "telecom": [
          {
            "system": "phone",
            "value": "0982344522",
            "use": "home",
            "rank": 1
          },
          {
            "system": "email",
            "value": "alex@example.com",
            "use": "home",
            "rank": 2
          }
        ],
        "gender": "male",
        "birthDate": "1974-12-25",
        "deceasedBoolean": false,
        "address": [
          {
            "use": "home",
            "type": "both",
            "text": "1800 Amphibious Blvd",
            "line": [
              "1800 Amphibious Blvd"
            ],
            "city": "Mountain View",
            "district": "KW",
            "period": {
              "start": "1974-12-25"
            }
          }
        ],
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "system": "123",
                  "code": "ENG",
                  "display": "def"
                },
                {
                  "system": "456",
                  "code": "english",
                  "display": "ghi"
                }
              ],
              "text": "abc"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "test-patient2",
      "request": {
        "method": "PUT",
        "url": "Patient/patient2"
      },
      "resource": {
        "resourceType": "Patient",
        "id": "patient2",
        "meta": {
          "versionId": "1",
          "lastUpdated": "2018-01-01T03:15:15.497+00:00",
          "tag": [
            {
              "system": "tag-system",
              "code": "tag2",
              "display": "Tag Two"
            },
            {
              "system": "other",
              "code": "tag|tag3",
              "display": "Tag Three"
            }
          ]
        },
        "active": false,
        "name": [
          {
            "use": "usual",
            "family": "Lee",
            "given": [
              "Jane",
              "Evelyne"
            ]
          }
        ],
        "telecom": [
          {
            "system": "phone",
            "value": "0982344522",
            "use": "home",
            "rank": 1
          },
          {
            "system": "email",
            "value": "jane@example.com",
            "use": "home",
            "rank": 2
          }
        ],
        "gender": "female",
        "birthDate": "1989-03-11",
        "deceasedBoolean": false,
        "address": [
          {
            "use": "home",
            "type": "both",
            "text": "1800 Amphibious Blvd",
            "line": [
              "1800 Amphibious Blvd"
            ],
            "city": "Mountain View",
            "district": "KW",
            "period": {
              "start": "2000-01-01"
            }
          }
        ],
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "system": "123",
                  "code": "FR",
                  "display": "jkl"
                },
                {
                  "system": "456",
                  "code": "french",
                  "display": "mno"
                }
              ],
              "text": "pqr"
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:9fb51c89-1453-406c-8357-578311b43a91",
      "request": {
        "method": "PUT",
        "url": "Organization/9fb51c89-1453-406c-8357-578311b43a91"
      },
      "resource": {
        "id": "9fb51c89-1453-406c-8357-578311b43a91",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-actor-Organization"
          ]
        },
        "name": "MASS EYE \u0026 EAR INFIRMARY",
        "resourceType": "Organization",
        "type": [
          {
            "coding": [
              {
                "code": "prov",
                "display": "Healthcare Provider",
                "system": "http://hl7.org/fhir/organization-type"
              }
            ],
            "text": "Healthcare Provider"
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
      "request": {
        "method": "PUT",
        "url": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
      },
      "resource": {
        "address": [
          {
            "country": "US",
            "line": [
              "907 Arlo Cliffs",
              "Suite 984"
            ],
            "postalCode": "XXXXX"
          }
        ],
        "birthDate": "1940-12-01",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "en-US",
                  "display": "English (United States)",
                  "system": "urn:ietf:bcp:47"
                }
              ]
            }
          }
        ],
        "deceasedDateTime": "2009-07-26T12:01:23-05:00",
        "extension": [
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "2106-3",
                  "display": "White",
                  "system": "http://hl7.org/fhir/v3/Race"
                }
              ],
              "text": "race"
            }
          },
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "2186-5",
                  "display": "Nonhispanic",
                  "system": "http://hl7.org/fhir/v3/Ethnicity"
                }
              ],
              "text": "ethnicity"
            }
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/birthPlace",
            "valueAddress": {
              "city": "Tama",
              "country": "US",
              "postalCode": "52339",
              "state": "Iowa"
            }
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
            "valueString": "Farrah Feeney"
          },
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
            "valueCode": "M"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/patient-interpreterRequired",
            "valueBoolean": false
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-actor-FictionalPerson-extension",
            "valueBoolean": true
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-FathersName-extension",
            "valueHumanName": {
              "text": "Christopher Diaz"
            }
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-SocialSecurityNumber-extension",
            "valueString": "999-16-9041"
          }
        ],
        "gender": "male",
        "generalPractitioner": [
          {
            "reference": "Organization/9fb51c89-1453-406c-8357-578311b43a91"
          }
        ],
        "id": "8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
        "identifier": [
          {
            "system": "https://github.com/synthetichealth/synthea",
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          },
          {
            "system": "http://hl7.org/fhir/sid/us-ssn",
            "type": {
              "coding": [
                {
                  "code": "SB",
                  "system": "http://hl7.org/fhir/identifier-type"
                }
              ]
            },
            "value": "999169041"
          },
          {
            "system": "urn:oid:2.16.840.1.113883.4.3.25",
            "type": {
              "coding": [
                {
                  "code": "DL",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "S99992205"
          },
          {
            "system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
            "type": {
              "coding": [
                {
                  "code": "PPN",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "X12551631X"
          },
          {
            "system": "http://hospital.smarthealthit.org",
            "type": {
              "coding": [
                {
                  "code": "MR",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          }
        ],
        "maritalStatus": {
          "coding": [
            {
              "code": "S",
              "system": "http://hl7.org/fhir/v3/MaritalStatus"
            }
          ],
          "text": "S"
        },
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-PersonOfRecord"
          ]
        },
        "multipleBirthBoolean": false,
        "name": [
          {
            "family": "Diaz",
            "given": [
              "Christopher"
            ],
            "prefix": [
              "Mr."
            ],
            "use": "official"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "system": "phone",
            "use": "home",
            "value": "434-100-2918 x800"
          }
        ],
        "text": {
          "div": "\u003cdiv xmlns=\"http://www.w3.org/1999/xhtml\"\u003eGenerated by \u003ca href=\"https://github.com/synthetichealth/synthea\"\u003eSynthea\u003c/a\u003e. Version identifier: 2dd4c1c37e2743d14e5073c7b5e42899a3e51531\u003c/div\u003e",
          "status": "generated"
        }
      }
    },
    {
      "fullUrl": "urn:uuid:0e9d631c-4407-45e5-bfbe-689806caaf7b",
      "request": {
        "method": "PUT",
        "url": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
      },
      "resource": {
        "class": {
          "code": "outpatient"
        },
        "id": "0e9d631c-4407-45e5-bfbe-689806caaf7b",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-encounter-Encounter"
          ]
        },
        "period": {
          "end": "2008-03-07T18:47:02-05:00",
          "start": "2008-03-07T17:47:02-05:00"
        },
        "resourceType": "Encounter",
        "serviceProvider": {
          "reference": "Organization/9fb51c89-1453-406c-8357-578311b43a91"
        },
        "status": "finished",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "type": [
          {
            "coding": [
              {
                "code": "185349003",
                "system": "http://snomed.info/sct"
              }
            ],
            "text": "Outpatient Encounter"
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a",
      "request": {
        "method": "PUT",
        "url": "Coverage/61ebe359-bfdc-4613-8bf2-c5e300945f0a"
      },
      "resource": {
        "resourceType": "Coverage",
        "id": "61ebe359-bfdc-4613-8bf2-c5e300945f0a",
        "status": "active",
        "type": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/coverage-selfpay",
              "code": "pay",
              "display": "PAY"
            }
          ]
        },
        "beneficiary": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "payor": [
          {
            "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:9effd2a1-08ba-48e8-ad3c-0c77215db59e",
      "request": {
        "method": "PUT",
        "url": "Claim/9effd2a1-08ba-48e8-ad3c-0c77215db59e"
      },
      "resource": {
        "billablePeriod": {
          "end": "2008-03-07T18:47:02-05:00",
          "start": "2008-03-07T17:47:02-05:00"
        },
        "id": "9effd2a1-08ba-48e8-ad3c-0c77215db59e",
        "item": [
          {
            "encounter": [
              {
                "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
              }
            ],
            "net": {
              "currency": "USD",
              "value": 125
            },
            "sequence": 1
          },
          {
            "net": {
              "currency": "USD",
              "value": 500
            },
            "procedureSequence": [
              2
            ],
            "sequence": 2
          },
          {
            "category": {
              "coding": [
                {
                  "code": "140",
                  "display": "Influenza, seasonal, injectable, preservative free",
                  "system": "http://hl7.org/fhir/sid/cvx"
                }
              ],
              "text": "Influenza, seasonal, injectable, preservative free"
            },
            "net": {
              "currency": "USD",
              "value": 136
            },
            "sequence": 3
          }
        ],
        "provider": {
          "reference": "Organization/9fb51c89-1453-406c-8357-578311b43a91"
        },
        "patient": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "procedure": [
          {
            "procedureReference": {
              "reference": "Procedure/3024146d-e661-4dab-9f7d-604f68fe414a"
            },
            "sequence": 1
          }
        ],
        "item": [
          {
            "sequence": 1,
            "careTeamSequence": [
            1
            ],
            "productOrService": {
              "coding": [
                {
                  "code": "1200"
              }
            ]
            },
            "servicedDate": "2014-08-16",
            "unitPrice": {
              "value": 135.57,
              "currency": "USD"
            },
            "net": {
              "value": 135.57,
              "currency": "USD"
            }
          }
        ],
        "type": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/claim-type",
              "code": "oral"
            }
          ]
        },
        "created": "2014-08-16",
        "priority": {
          "coding": [
            {
              "code": "normal"
            }
          ]
        },
        "resourceType": "Claim",
        "status": "active",
        "insurance": [
          {
            "sequence": 1,
            "focal": true,
            "coverage": {
              "reference": "Coverage/61ebe359-bfdc-4613-8bf2-c5e300945f0a"
            }
          }
        ],
        "total": {
          "currency": "USD",
          "value": 761
        },
        "use": "claim"
      }
    },
    {
      "fullUrl": "urn:uuid:14df9701-2dd4-4538-8fac-776c40dec22d",
      "request": {
        "method": "PUT",
        "url": "Observation/14df9701-2dd4-4538-8fac-776c40dec22d"
      },
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "8302-2",
              "display": "Body Height",
              "system": "http://loinc.org"
            }
          ],
          "text": "Body Height"
        },
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "14df9701-2dd4-4538-8fac-776c40dec22d",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-VitalSign",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BodyHeight"
          ]
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "cm",
          "system": "http://unitsofmeasure.org",
          "unit": "centimeters",
          "value": 177.72961711703704
        }
      }
    },
    {
      "fullUrl": "urn:uuid:ac57b908-2804-4d67-a7ad-1e4a4c3225a1",
      "request": {
        "method": "PUT",
        "url": "Observation/ac57b908-2804-4d67-a7ad-1e4a4c3225a1"
      },
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "29463-7",
              "display": "Body Weight",
              "system": "http://loinc.org"
            }
          ],
          "text": "Body Weight"
        },
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "ac57b908-2804-4d67-a7ad-1e4a4c3225a1",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-VitalSign",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BodyWeight"
          ]
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "kg",
          "system": "http://unitsofmeasure.org",
          "unit": "kg",
          "value": 121.12557348891558
        }
      }
    },
    {
      "fullUrl": "urn:uuid:1e2fdce6-4c79-4ef8-a5a9-2326cddbc8b3",
      "request": {
        "method": "PUT",
        "url": "Observation/1e2fdce6-4c79-4ef8-a5a9-2326cddbc8b3"
      },
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "39156-5",
              "display": "Body Mass Index",
              "system": "http://loinc.org"
            }
          ],
          "text": "Body Mass Index"
        },
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "1e2fdce6-4c79-4ef8-a5a9-2326cddbc8b3",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-VitalSign",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BodyMassIndex"
          ]
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "kg/m2",
          "system": "http://unitsofmeasure.org",
          "unit": "kg/m2",
          "value": 38.34566163709526
        }
      }
    },
    {
      "fullUrl": "urn:uuid:a35bf421-1f00-4897-a94d-4d47c3bb306b",
      "request": {
        "method": "PUT",
        "url": "Observation/a35bf421-1f00-4897-a94d-4d47c3bb306b"
      },
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "55284-4",
              "display": "Blood Pressure",
              "system": "http://loinc.org"
            }
          ]
        },
        "component": [
          {
            "code": {
              "coding": [
                {
                  "code": "8480-6",
                  "display": "Systolic Blood Pressure",
                  "system": "http://loinc.org"
                }
              ],
              "text": "Systolic Blood Pressure"
            },
            "valueQuantity": {
              "code": "mmHg",
              "system": "http://unitsofmeasure.org",
              "unit": "mmHg",
              "value": 133
            }
          },
          {
            "code": {
              "coding": [
                {
                  "code": "8462-4",
                  "display": "Diastolic Blood Pressure",
                  "system": "http://loinc.org"
                }
              ],
              "text": "Diastolic Blood Pressure"
            },
            "valueQuantity": {
              "code": "mmHg",
              "system": "http://unitsofmeasure.org",
              "unit": "mmHg",
              "value": 84
            }
          }
        ],
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "a35bf421-1f00-4897-a94d-4d47c3bb306b",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BloodPressure"
          ]
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        }
      }
    },
    {
      "fullUrl": "urn:uuid:85652a63-09ba-4a5b-ac5b-b690c6972eb5",
      "request": {
        "method": "PUT",
        "url": "Observation/85652a63-09ba-4a5b-ac5b-b690c6972eb5"
      },
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "laboratory",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "2093-3",
              "display": "Total Cholesterol",
              "system": "http://loinc.org"
            }
          ],
          "text": "Total Cholesterol"
        },
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "85652a63-09ba-4a5b-ac5b-b690c6972eb5",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation"
          ]
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "mg/dL",
          "system": "http://unitsofmeasure.org",
          "unit": "mg/dL",
          "value": 191
        }
      }
    },
    {
      "fullUrl": "urn:uuid:e7aea507-61af-4290-9323-0b3daed0b7a9",
      "request": {
        "method": "PUT",
        "url": "Observation/e7aea507-61af-4290-9323-0b3daed0b7a9"
      },
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "laboratory",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "2571-8",
              "display": "Triglycerides",
              "system": "http://loinc.org"
            }
          ],
          "text": "Triglycerides"
        },
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "e7aea507-61af-4290-9323-0b3daed0b7a9",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation"
          ]
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "mg/dL",
          "system": "http://unitsofmeasure.org",
          "unit": "mg/dL",
          "value": 143
        }
      }
    },
    {
      "fullUrl": "urn:uuid:58357362-6f18-438a-8479-3289ebab1617",
      "request": {
        "method": "PUT",
        "url": "Observation/58357362-6f18-438a-8479-3289ebab1617"
      },
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "laboratory",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "18262-6",
              "display": "Low Density Lipoprotein Cholesterol",
              "system": "http://loinc.org"
            }
          ],
          "text": "Low Density Lipoprotein Cholesterol"
        },
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "58357362-6f18-438a-8479-3289ebab1617",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation"
          ]
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "mg/dL",
          "system": "http://unitsofmeasure.org",
          "unit": "mg/dL",
          "value": 102
        }
      }
    },
    {
      "fullUrl": "urn:uuid:c6f1b042-a0fc-4bbc-9cd5-7a8a924c00e7",
      "request": {
        "method": "PUT",
        "url": "Observation/c6f1b042-a0fc-4bbc-9cd5-7a8a924c00e7"
      },
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "laboratory",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "2085-9",
              "display": "High Density Lipoprotein Cholesterol",
              "system": "http://loinc.org"
            }
          ],
          "text": "High Density Lipoprotein Cholesterol"
        },
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "c6f1b042-a0fc-4bbc-9cd5-7a8a924c00e7",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation"
          ]
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "mg/dL",
          "system": "http://unitsofmeasure.org",
          "unit": "mg/dL",
          "value": 60
        }
      }
    },
    {
      "fullUrl": "urn:uuid:19a6fa01-6882-430e-8dad-4d35df993cfc",
      "request": {
        "method": "PUT",
        "url": "DiagnosticReport/19a6fa01-6882-430e-8dad-4d35df993cfc"
      },
      "resource": {
        "category": [{
          "coding": [
            {
              "code": "LAB",
              "system": "http://hl7.org/fhir/v2/0074"
            }
          ]
        }],
        "code": {
          "coding": [
            {
              "code": "57698-3",
              "display": "Lipid Panel",
              "system": "http://loinc.org"
            }
          ]
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "id": "19a6fa01-6882-430e-8dad-4d35df993cfc",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Panel"
          ]
        },
        "performer": [
          {
            "reference": "Organization/9fb51c89-1453-406c-8357-578311b43a91"
          }
        ],
        "resourceType": "DiagnosticReport",
        "result": [
          {
            "display": "Total Cholesterol",
            "reference": "Observation/85652a63-09ba-4a5b-ac5b-b690c6972eb5"
          },
          {
            "display": "Triglycerides",
            "reference": "Observation/e7aea507-61af-4290-9323-0b3daed0b7a9"
          },
          {
            "display": "Low Density Lipoprotein Cholesterol",
            "reference": "Observation/58357362-6f18-438a-8479-3289ebab1617"
          },
          {
            "display": "High Density Lipoprotein Cholesterol",
            "reference": "Observation/c6f1b042-a0fc-4bbc-9cd5-7a8a924c00e7"
          }
        ],
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        }
      }
    },
    {
      "fullUrl": "urn:uuid:3024146d-e661-4dab-9f7d-604f68fe414a",
      "request": {
        "method": "PUT",
        "url": "Procedure/3024146d-e661-4dab-9f7d-604f68fe414a"
      },
      "resource": {
        "code": {
          "coding": [
            {
              "code": "428191000124101",
              "display": "Documentation of current medications",
              "system": "http://snomed.info/sct"
            }
          ],
          "text": "Documentation of current medications"
        },
        "extension": [
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-core-CodeableConcept-extension",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "428191000124101",
                  "display": "Documentation of current medications",
                  "system": "http://snomed.info/sct"
                }
              ],
              "text": "Documentation of current medications"
            }
          }
        ],
        "id": "3024146d-e661-4dab-9f7d-604f68fe414a",
        "meta": {
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-procedure-Procedure"
          ]
        },
        "performedDateTime": "2008-03-07T17:47:02-05:00",
        "resourceType": "Procedure",
        "status": "completed",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        }
      }
    },
    {
      "fullUrl": "test-structuredefinition",
      "request": {
        "method": "PUT",
        "url": "StructureDefinition/test-structuredefinition"
      },
      "resource": {
        "resourceType": "StructureDefinition",
        "id": "test-structuredefinition",
        "url": "http://example.com",
        "name": "MyStructureDefinition",
        "status": "draft",
        "kind": "logical",
        "abstract": false,
        "type": "Patient",
        "baseDefinition": "http://standardhealthrecord.org/fhir/StructureDefinition/Patient",
        "snapshot": {
          "element": [
            {
              "id": "snapshot1",
              "path": "Patient",
              "definition": "Placeholder definition",
              "min": 0,
              "max": "*",
              "base": {
                "path": "mybasepath",
                "min": 0,
                "max": "*"
              }
            }
          ]
        }
      }
    },
    {
      "fullUrl": "test-measure1",
      "request": {
        "method": "PUT",
        "url": "Measure/measure1"
      },
      "resource": {
        "resourceType": "Measure",
        "id": "measure1",
        "name": "Measure1",
        "status": "draft",
        "relatedArtifact": [
          {
            "type": "predecessor",
            "resource": "Patient/patient1"
          },
          {
            "type": "successor",
            "resource": "Patient/patient2"
          }
        ]
      }
    },
    {
      "fullUrl": "test-measure2",
      "request": {
        "method": "PUT",
        "url": "Measure/measure2"
      },
      "resource": {
        "resourceType": "Measure",
        "id": "measure2",
        "name": "Measure2",
        "status": "draft",
        "relatedArtifact": [
          {
            "type": "predecessor",
            "resource": "Patient/patient2"
          },
          {
            "type": "successor",
            "resource": "Patient/patient1"
          }
        ]
      }
    },
    {
      "fullUrl": "test-patient3",
      "request": {
        "method": "PUT",
        "url": "Patient/patient3"
      },
      "resource": {
        "resourceType": "Patient",
        "id": "patient3",
        "meta": {
          "versionId": "1",
          "lastUpdated": "2019-02-22T03:15:15.000+00:00",
          "tag": [
            {
              "system": "other|tag",
              "code": "tag3",
              "display": "Tag $3"
            },
            {
              "system": "system",
              "code": "code,4",
              "display": "Tag 4"
            }
          ]
        },
        "active": false,
        "name": [
          {
            "use": "usual",
            "text": "Smith, Mary",
            "family": "Smith",
            "given": [
              "Mary"
            ]
          }
        ],
        "telecom": [
          {
            "system": "phone",
            "value": "1110891111",
            "use": "home",
            "rank": 1
          },
          {
            "system": "email",
            "value": "mary@example.com",
            "use": "home",
            "rank": 2
          }
        ],
        "birthDate": "1980-01-01",
        "deceasedBoolean": false,
        "address": [
         {
            "use": "home",
            "type": "both",
            "text": "Avenida da Pastelaria, 1903",
            "line": [
              "Avenida da Pastelaria, 1903"
            ],
            "city": "Lisbon",
            "district": "KW",
            "period": {
              "start": "1980-01-01"
            }
          }
        ]
      }
    }
  ],
  "resourceType": "Bundle",
  "type": "transaction"
}

Execute the sample FHIR bundle

To execute the sample FHIR bundle in a FHIR store, see Executing a bundle. The FHIR store must have the following settings:

String search modifiers

A string search defaults to a prefix match that is case and accent insensitive through folding to the standard Unicode NFC form. Punctuation and extra whitespace is ignored.

The following modifiers are available:

  • :contains matches resources with the specified value anywhere in the string, for example name:contains=eve matches Evelyn and Severine.
  • :exact matches the entire string including case and accents, for example name:exact=Eve doesn't match eve or Evelyn.

Expand the following section to see an example of using search string modifiers:

String search modifiers samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the Patient?name:contains=eve query.

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?name:contains=eve"

PowerShell


The following sample uses the Patient?name:contains=eve query.

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?name:contains=eve" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient2",
      "resource": {
        "active": false,
        "address": [
          {
            "city": "Mountain View",
            "district": "KW",
            "line": [
              "1800 Amphibious Blvd"
            ],
            "period": {
              "start": "2000-01-01"
            },
            "text": "1800 Amphibious Blvd",
            "type": "both",
            "use": "home"
          }
        ],
        "birthDate": "1989-03-11",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "FR",
                  "display": "jkl",
                  "system": "123"
                },
                {
                  "code": "french",
                  "display": "mno",
                  "system": "456"
                }
              ],
              "text": "pqr"
            }
          }
        ],
        "deceasedBoolean": false,
        "gender": "female",
        "id": "patient2",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "tag2",
              "display": "Tag Two",
              "system": "tag-system"
            },
            {
              "code": "tag|tag3",
              "display": "Tag Three",
              "system": "other"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "name": [
          {
            "family": "Lee",
            "given": [
              "Jane",
              "Evelyne"
            ],
            "use": "usual"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "rank": 1,
            "system": "phone",
            "use": "home",
            "value": "0982344522"
          },
          {
            "rank": 2,
            "system": "email",
            "use": "home",
            "value": "jane@example.com"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient1",
      "resource": {
        "active": false,
        "address": [
          {
            "city": "Mountain View",
            "district": "KW",
            "line": [
              "1800 Amphibious Blvd"
            ],
            "period": {
              "start": "1974-12-25"
            },
            "text": "1800 Amphibious Blvd",
            "type": "both",
            "use": "home"
          }
        ],
        "birthDate": "1974-12-25",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "ENG",
                  "display": "def",
                  "system": "123"
                },
                {
                  "code": "english",
                  "display": "ghi",
                  "system": "456"
                }
              ],
              "text": "abc"
            }
          }
        ],
        "deceasedBoolean": false,
        "gender": "male",
        "id": "patient1",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "tag1",
              "display": "Tag One",
              "system": "tag-system"
            },
            {
              "code": "tag2",
              "display": "Tag Two",
              "system": "other-system"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "name": [
          {
            "family": "Lee",
            "given": [
              "Alex",
              "Cleve"
            ],
            "text": "Alex Lee",
            "use": "usual"
          },
          {
            "given": [
              "Joe"
            ],
            "use": "nickname"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "rank": 1,
            "system": "phone",
            "use": "home",
            "value": "0982344522"
          },
          {
            "rank": 2,
            "system": "email",
            "use": "home",
            "value": "alex@example.com"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    }
  ],
  "link": [
    {
      "relation": "search",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?name%3Acontains=eve"
    },
    {
      "relation": "first",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?name%3Acontains=eve"
    },
    {
      "relation": "self",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?name%3Acontains=eve"
    }
  ],
  "resourceType": "Bundle",
  "total": 2,
  "type": "searchset"
}

Comparators and precision for numbers, dates, and quantities

Values used in a numeric or date search depend on the precision of the parameter value. For example, the number 7.00 has an implicit range of 6.995 inclusive to 7.005 exclusive. The date 2015-08-12 has a range of 2015-08-12T00:00:00 inclusive to 2015-08-13T00:00:00 exclusive.

Precision affects what results are returned for equality comparisons. For example, a value of 7.03 in a resource would match a search for value=7.0 but would not match a search for value=7.00.

All clinically significant floating point values in FHIR are represented by types such as Decimal and Quantity that record the precision of the stored value. As an exception there are a few fields that use simple integers, for example to represent a position in a sequence, and searches on those fields are exact numerical matches.

The following prefixes apply to numeric comparisons against a singleton value. If no prefixes are specified, the default is eq.

  • eq: equals, the exact stored value is inside the range defined by the precision of the parameter value
  • ne: not equals, the opposite of eq
  • gt: the exact stored value is greater than the exact parameter value
  • lt: the exact stored value is less than the exact parameter value
  • ge: the exact stored value is greater than or equal to the exact parameter value
  • le: the exact stored value is less than or equal to the exact parameter value

Date values have an implicit range based on the level of specificity of the value (one year, one month, one day). Other data types such as Range and Period contain explicit upper and lower bounds. The following prefixes apply to range comparisons. If no prefixes are specified, the default is eq.

  • eq: equals, the range of the parameter value fully contains the range of the target
  • ne: not equals, the opposite of eq
  • gt: greater than, the range above the parameter value overlaps with the range of the target
  • lt: less than, the range below the parameter value overlaps with the range of the target
  • ge: greater than or equal to
  • le: less than or equal to
  • sa: the range of the parameter value starts after the target range
  • eb: the range of the parameter value ends before the target range

Comparators and precision for numbers, dates, and quantities samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the _lastUpdated=gt2018-01-01 query to search for Patient resources with a _lastUpdated value greater than (gt) 2018-01-01.

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_lastUpdated=gt2018-01-01"

PowerShell


The following sample uses the _lastUpdated=gt2018-01-01 query to search for Patient resources with a _lastUpdated value greater than (gt) 2018-01-01.

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_lastUpdated=gt2018-01-01" | Select-Object -Expand Content

The query _lastUpdated=gt2018-01-01 returns Patient resources updated since 2018-01-01. If you created all of the resources in your FHIR store after that date, then the server returns all of the resources. To see a subset of resources, change the date to a time after some resources were last updated.

{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient3",
      "resource": {
        "active": false,
        "address": [
          {
            "city": "Lisbon",
            "district": "KW",
            "line": [
              "Avenida da Pastelaria, 1903"
            ],
            "period": {
              "start": "1980-01-01"
            },
            "text": "Avenida da Pastelaria, 1903",
            "type": "both",
            "use": "home"
          }
        ],
        "birthDate": "1980-01-01",
        "deceasedBoolean": false,
        "id": "patient3",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "tag3",
              "display": "Tag $3",
              "system": "other|tag"
            },
            {
              "code": "code,4",
              "display": "Tag 4",
              "system": "system"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "name": [
          {
            "family": "Smith",
            "given": [
              "Mary"
            ],
            "text": "Smith, Mary",
            "use": "usual"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "rank": 1,
            "system": "phone",
            "use": "home",
            "value": "1110891111"
          },
          {
            "rank": 2,
            "system": "email",
            "use": "home",
            "value": "mary@example.com"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient2",
      "resource": {
        "active": false,
        "address": [
          {
            "city": "Mountain View",
            "district": "KW",
            "line": [
              "1800 Amphibious Blvd"
            ],
            "period": {
              "start": "2000-01-01"
            },
            "text": "1800 Amphibious Blvd",
            "type": "both",
            "use": "home"
          }
        ],
        "birthDate": "1989-03-11",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "FR",
                  "display": "jkl",
                  "system": "123"
                },
                {
                  "code": "french",
                  "display": "mno",
                  "system": "456"
                }
              ],
              "text": "pqr"
            }
          }
        ],
        "deceasedBoolean": false,
        "gender": "female",
        "id": "patient2",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "tag2",
              "display": "Tag Two",
              "system": "tag-system"
            },
            {
              "code": "tag|tag3",
              "display": "Tag Three",
              "system": "other"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "name": [
          {
            "family": "Lee",
            "given": [
              "Jane",
              "Evelyne"
            ],
            "use": "usual"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "rank": 1,
            "system": "phone",
            "use": "home",
            "value": "0982344522"
          },
          {
            "rank": 2,
            "system": "email",
            "use": "home",
            "value": "jane@example.com"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
      "resource": {
        "address": [
          {
            "country": "US",
            "line": [
              "907 Arlo Cliffs",
              "Suite 984"
            ],
            "postalCode": "XXXXX"
          }
        ],
        "birthDate": "1940-12-01",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "en-US",
                  "display": "English (United States)",
                  "system": "urn:ietf:bcp:47"
                }
              ]
            }
          }
        ],
        "deceasedDateTime": "2009-07-26T12:01:23-05:00",
        "extension": [
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "2106-3",
                  "display": "White",
                  "system": "http://hl7.org/fhir/v3/Race"
                }
              ],
              "text": "race"
            }
          },
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "2186-5",
                  "display": "Nonhispanic",
                  "system": "http://hl7.org/fhir/v3/Ethnicity"
                }
              ],
              "text": "ethnicity"
            }
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/birthPlace",
            "valueAddress": {
              "city": "Tama",
              "country": "US",
              "postalCode": "52339",
              "state": "Iowa"
            }
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
            "valueString": "Farrah Feeney"
          },
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
            "valueCode": "M"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/patient-interpreterRequired",
            "valueBoolean": false
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-actor-FictionalPerson-extension",
            "valueBoolean": true
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-FathersName-extension",
            "valueHumanName": {
              "text": "Christopher Diaz"
            }
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-SocialSecurityNumber-extension",
            "valueString": "999-16-9041"
          }
        ],
        "gender": "male",
        "generalPractitioner": [
          {
            "reference": "Organization/9fb51c89-1453-406c-8357-578311b43a91"
          }
        ],
        "id": "8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
        "identifier": [
          {
            "system": "https://github.com/synthetichealth/synthea",
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          },
          {
            "system": "http://hl7.org/fhir/sid/us-ssn",
            "type": {
              "coding": [
                {
                  "code": "SB",
                  "system": "http://hl7.org/fhir/identifier-type"
                }
              ]
            },
            "value": "999169041"
          },
          {
            "system": "urn:oid:2.16.840.1.113883.4.3.25",
            "type": {
              "coding": [
                {
                  "code": "DL",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "S99992205"
          },
          {
            "system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
            "type": {
              "coding": [
                {
                  "code": "PPN",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "X12551631X"
          },
          {
            "system": "http://hospital.smarthealthit.org",
            "type": {
              "coding": [
                {
                  "code": "MR",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          }
        ],
        "maritalStatus": {
          "coding": [
            {
              "code": "S",
              "system": "http://hl7.org/fhir/v3/MaritalStatus"
            }
          ],
          "text": "S"
        },
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-PersonOfRecord"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "multipleBirthBoolean": false,
        "name": [
          {
            "family": "Diaz",
            "given": [
              "Christopher"
            ],
            "prefix": [
              "Mr."
            ],
            "use": "official"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "system": "phone",
            "use": "home",
            "value": "434-100-2918 x800"
          }
        ],
        "text": {
          "div": "
Generated by Synthea. Version identifier: 2dd4c1c37e2743d14e5073c7b5e42899a3e51531
", "status": "generated" } }, "search": { "mode": "match" } }, { "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient1", "resource": { "active": false, "address": [ { "city": "Mountain View", "district": "KW", "line": [ "1800 Amphibious Blvd" ], "period": { "start": "1974-12-25" }, "text": "1800 Amphibious Blvd", "type": "both", "use": "home" } ], "birthDate": "1974-12-25", "communication": [ { "language": { "coding": [ { "code": "ENG", "display": "def", "system": "123" }, { "code": "english", "display": "ghi", "system": "456" } ], "text": "abc" } } ], "deceasedBoolean": false, "gender": "male", "id": "patient1", "meta": { "lastUpdated": "LAST_UPDATED", "tag": [ { "code": "tag1", "display": "Tag One", "system": "tag-system" }, { "code": "tag2", "display": "Tag Two", "system": "other-system" } ], "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA" }, "name": [ { "family": "Lee", "given": [ "Alex", "Cleve" ], "text": "Alex Lee", "use": "usual" }, { "given": [ "Joe" ], "use": "nickname" } ], "resourceType": "Patient", "telecom": [ { "rank": 1, "system": "phone", "use": "home", "value": "0982344522" }, { "rank": 2, "system": "email", "use": "home", "value": "alex@example.com" } ] }, "search": { "mode": "match" } } ], "link": [ { "relation": "search", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_lastUpdated=gt2018-01-01" }, { "relation": "first", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_lastUpdated=gt2018-01-01" }, { "relation": "self", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_lastUpdated=gt2018-01-01" } ], "resourceType": "Bundle", "total": 4, "type": "searchset" }

Token search parameters apply to cases where a value is not an arbitrary string, but rather an entity in a naming system. String matching on a token parameter is exact.

Most token searches apply to complex data types that contain a system that is a URI indicating the naming system that the code value is taken from. These searches support the following value syntaxes:

  • [parameter]=[code] matches the code value regardless of the system
  • [parameter]=[system]|[code] must match both the system and code specified
  • [parameter]=|[code] matches code when the system value is empty
  • [parameter]=[system]| matches any code with the given system value

There are several modifiers that trigger alternate token search functionality:

  • :not negates the matching conditions of a token search
  • :text does a string search (not exact match) on the text or display field associated with the code, instead of the code value itself
  • :above takes a parameter only of the form [system]|[code] and matches resources where the code in the resource subsumes the query parameter. To use this modifier the specified system must exist in the FHIR store as a CodeSystem resource.
  • :below is like :above but matches if the code in the resource is subsumed by the query parameter.
  • :in takes a single parameter using the reference parameter syntax, for example code:in=ValueSet/1234. The reference must refer to a ValueSet resource within the same FHIR store. The modifier matches any code that is in the referenced ValueSet.
  • :not-in negates the conditions of :in

Token searches also apply to boolean and URI fields and certain string fields where only exact match is allowed. In these cases, the only parameter format is [parameter]=[value].

Token search samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the Patient?_tag=tag-system|tag2 query to search for Patient resources with a specified system and code.

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_tag=tag-system|tag2"

PowerShell


The following sample uses the Patient?_tag=tag-system|tag2 query to search for Patient resources with a specified system and code.

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_tag=tag-system|tag2" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient2",
      "resource": {
        "active": false,
        "address": [
          {
            "city": "Mountain View",
            "district": "KW",
            "line": [
              "1800 Amphibious Blvd"
            ],
            "period": {
              "start": "2000-01-01"
            },
            "text": "1800 Amphibious Blvd",
            "type": "both",
            "use": "home"
          }
        ],
        "birthDate": "1989-03-11",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "FR",
                  "display": "jkl",
                  "system": "123"
                },
                {
                  "code": "french",
                  "display": "mno",
                  "system": "456"
                }
              ],
              "text": "pqr"
            }
          }
        ],
        "deceasedBoolean": false,
        "gender": "female",
        "id": "patient2",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "tag2",
              "display": "Tag Two",
              "system": "tag-system"
            },
            {
              "code": "tag|tag3",
              "display": "Tag Three",
              "system": "other"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "name": [
          {
            "family": "Lee",
            "given": [
              "Jane",
              "Evelyne"
            ],
            "use": "usual"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "rank": 1,
            "system": "phone",
            "use": "home",
            "value": "0982344522"
          },
          {
            "rank": 2,
            "system": "email",
            "use": "home",
            "value": "jane@example.com"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    }
  ],
  "link": [
    {
      "relation": "search",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_tag=tag-system%7Ctag2"
    },
    {
      "relation": "first",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_tag=tag-system%7Ctag2"
    },
    {
      "relation": "self",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_tag=tag-system%7Ctag2"
    }
  ],
  "resourceType": "Bundle",
  "total": 1,
  "type": "searchset"
}

Searching for missing values

The search modifier :missing can be used on any search parameter to match based on the presence or absence of any value in the specified field. For example, Patient?gender=unknown matches resources that explicitly contain the unknown enum value for gender, but as this field is not required there may be other resources that do not populate the field at all. Such resources can be matched by Patient?gender:missing=true. The converse, Patient?gender:missing=false matches any resource that explicitly populates this field.

Missing values samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the gender:missing=false query:

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?gender:missing=false"

PowerShell


The following sample uses the gender:missing=false query:

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?gender:missing=false" | Select-Object -Expand Content
One Patient resource with the ID patient3 is missing a gender value:
{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/mydataset/fhirStores/FHIR_STORE_ID/fhir/Patient/patient3",
      "resource": {
        "active": false,
        "address": [
          {
            "city": "Lisbon",
            "district": "KW",
            "line": [
              "Avenida da Pastelaria, 1903"
            ],
            "period": {
              "start": "1980-01-01"
            },
            "text": "Avenida da Pastelaria, 1903",
            "type": "both",
            "use": "home"
          }
        ],
        "birthDate": "1980-01-01",
        "deceasedBoolean": false,
        "id": "patient3",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "tag3",
              "display": "Tag $3",
              "system": "other|tag"
            },
            {
              "code": "code,4",
              "display": "Tag 4",
              "system": "system"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "name": [
          {
            "family": "Smith",
            "given": [
              "Mary"
            ],
            "text": "Smith, Mary",
            "use": "usual"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "rank": 1,
            "system": "phone",
            "use": "home",
            "value": "1110891111"
          },
          {
            "rank": 2,
            "system": "email",
            "use": "home",
            "value": "mary@example.com"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    }
  ],
  "link": [
    {
      "relation": "search",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/mydataset/fhirStores/FHIR_STORE_ID/fhir/Patient/?gender%3Amissing=true"
    },
    {
      "relation": "first",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/mydataset/fhirStores/FHIR_STORE_ID/fhir/Patient/?gender%3Amissing=true"
    },
    {
      "relation": "self",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/mydataset/fhirStores/FHIR_STORE_ID/fhir/Patient/?gender%3Amissing=true"
    }
  ],
  "resourceType": "Bundle",
  "total": 1,
  "type": "searchset"
}

The special search parameter _content performs a text match on string-based fields (excluding number, date, or enum fields) if the field is the target of any search parameter on the resource. By default it matches resources that contain all of the words in the query, with support for additional operators:

  • | is the OR operator, for example abc | def | ghi xyz will match a resource that contains xyz and one or more of abc def ghi.
  • - is the NOT operator, for example abc -def will match a resource that contains abc but does not contain def.

The matching is based on complete words and does not match substrings or non-alphanumeric characters. The order of the words does not matter. Matching words can be spread across multiple fields in the resource.

The parameter _text performs the same type of match only on the Narrative field that is intended to contain a human-readable summary of the resource contents. The Cloud Healthcare API does not automatically generate this summary but supports the _text search parameter if this data was populated by the client when creating or updating the resource.

Text search samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the _content=Smith%20|%20Mountain%20View query:

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_content=Smith%20|%20Mountain%20View"

PowerShell


The following sample uses the _content=Smith%20|%20Mountain%20View query:

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_content=Smith%20|%20Mountain%20View" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient1",
      "resource": {
        "active": false,
        "address": [
          {
            "city": "Mountain View",
            "district": "KW",
            "line": [
              "1800 Amphibious Blvd"
            ],
            "period": {
              "start": "1974-12-25"
            },
            "text": "1800 Amphibious Blvd",
            "type": "both",
            "use": "home"
          }
        ],
        "birthDate": "1974-12-25",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "ENG",
                  "display": "def",
                  "system": "123"
                },
                {
                  "code": "english",
                  "display": "ghi",
                  "system": "456"
                }
              ],
              "text": "abc"
            }
          }
        ],
        "deceasedBoolean": false,
        "gender": "male",
        "id": "patient1",
        "meta": {
          "lastUpdated": "2021-10-21T16:41:47.211939+00:00",
          "tag": [
            {
              "code": "tag1",
              "display": "Tag One",
              "system": "tag-system"
            },
            {
              "code": "tag2",
              "display": "Tag Two",
              "system": "other-system"
            }
          ],
          "versionId": "MTYzNDgzNDUwNzIxMTkzOTAwMA"
        },
        "name": [
          {
            "family": "Lee",
            "given": [
              "Alex",
              "Cleve"
            ],
            "text": "Alex Lee",
            "use": "usual"
          },
          {
            "given": [
              "Joe"
            ],
            "use": "nickname"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "rank": 1,
            "system": "phone",
            "use": "home",
            "value": "0982344522"
          },
          {
            "rank": 2,
            "system": "email",
            "use": "home",
            "value": "alex@example.com"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient2",
      "resource": {
        "active": false,
        "address": [
          {
            "city": "Mountain View",
            "district": "KW",
            "line": [
              "1800 Amphibious Blvd"
            ],
            "period": {
              "start": "2000-01-01"
            },
            "text": "1800 Amphibious Blvd",
            "type": "both",
            "use": "home"
          }
        ],
        "birthDate": "1989-03-11",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "FR",
                  "display": "jkl",
                  "system": "123"
                },
                {
                  "code": "french",
                  "display": "mno",
                  "system": "456"
                }
              ],
              "text": "pqr"
            }
          }
        ],
        "deceasedBoolean": false,
        "gender": "female",
        "id": "patient2",
        "meta": {
          "lastUpdated": "2021-10-21T16:41:47.211939+00:00",
          "tag": [
            {
              "code": "tag2",
              "display": "Tag Two",
              "system": "tag-system"
            },
            {
              "code": "tag|tag3",
              "display": "Tag Three",
              "system": "other"
            }
          ],
          "versionId": "MTYzNDgzNDUwNzIxMTkzOTAwMA"
        },
        "name": [
          {
            "family": "Lee",
            "given": [
              "Jane",
              "Evelyne"
            ],
            "use": "usual"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "rank": 1,
            "system": "phone",
            "use": "home",
            "value": "0982344522"
          },
          {
            "rank": 2,
            "system": "email",
            "use": "home",
            "value": "jane@example.com"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    }
  ],
  "link": [
    {
      "relation": "search",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_content=Smith%7CMountain+View"
    },
    {
      "relation": "first",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_content=Smith%7CMountain+View"
    },
    {
      "relation": "self",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_content=Smith%7CMountain+View"
    }
  ],
  "resourceType": "Bundle",
  "total": 2,
  "type": "searchset"
}

Composite search parameters

When searching using multiple query parameters, there are cases where individual search parameters combined with AND would match unintended results. Composite search parameters are a special type of search parameter that address this issue.

For example, the Observation resource may contain multiple values in the component field, each of which contains a pair of code and value. A search for Observation?component-code=8867-4&component-value-quantity=lt50 would match a resource that had one component containing a code of 8867-4 and a different component containing a value less than 50. This search cannot be used to restrict to a match of these two values within the same component.

Composite search parameters define a new parameter that combines two other search parameters and defines a level of nesting within which they must both match. In the query, the two values are joined by $. For example, Observation has a composite parameter component-code-value-quantity that can restrict the previous example to a single component by searching for Observation?component-code-value-quantity=8867-4$lt50. These parameters are defined by the FHIR specification and do not exist for all combinations of search parameters.

Composite search parameters do not allow modifiers.

As with all search parameters, information on which composite parameters are supported by the Cloud Healthcare API can be found in the capability statement or FHIR Conformance Statement.

Composite search samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the Observation?component-code-value-quantity=8480-6$lt150 query.

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation?component-code-value-quantity=8480-6\$lt150"

PowerShell


The following sample uses the Observation?component-code-value-quantity=8480-6$lt150 query.

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation?component-code-value-quantity=8480-6\$lt150" | Select-Object -Expand Content
The response contains the Observation with a component-code=8480-6 and a component-value-quantity of 133, which meets the criteria for lt150.
{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/a35bf421-1f00-4897-a94d-4d47c3bb306b",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "55284-4",
              "display": "Blood Pressure",
              "system": "http://loinc.org"
            }
          ]
        },
        "component": [
          {
            "code": {
              "coding": [
                {
                  "code": "8480-6",
                  "display": "Systolic Blood Pressure",
                  "system": "http://loinc.org"
                }
              ],
              "text": "Systolic Blood Pressure"
            },
            "valueQuantity": {
              "code": "mmHg",
              "system": "http://unitsofmeasure.org",
              "unit": "mmHg",
              "value": 133
            }
          },
          {
            "code": {
              "coding": [
                {
                  "code": "8462-4",
                  "display": "Diastolic Blood Pressure",
                  "system": "http://loinc.org"
                }
              ],
              "text": "Diastolic Blood Pressure"
            },
            "valueQuantity": {
              "code": "mmHg",
              "system": "http://unitsofmeasure.org",
              "unit": "mmHg",
              "value": 84
            }
          }
        ],
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "a35bf421-1f00-4897-a94d-4d47c3bb306b",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BloodPressure"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        }
      },
      "search": {
        "mode": "match"
      }
    }
  ],
  "link": [
    {
      "relation": "search",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/?component-code-value-quantity=8480-6%24lt150"
    },
    {
      "relation": "first",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/?component-code-value-quantity=8480-6%24lt150"
    },
    {
      "relation": "self",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/?component-code-value-quantity=8480-6%24lt150"
    }
  ],
  "resourceType": "Bundle",
  "total": 1,
  "type": "searchset"
}

A chained search allows a search to traverse references within the context of a query. The basic syntax for a chained search is:

[reference parameter]:[resource type].[inner search parameter]=[inner value]

If the reference parameter only refers to one resource type, the :[resource type] may be omitted, resulting in:

[reference parameter].[inner search parameter]=[inner value]

For example, Observation has a reference search parameter subject that may point to a Group, Device, Patient, or Location. To find Observations that have a subject which is a Patient having a name beginning with "Joe", you can search Observation?subject:Patient.name=Joe.

If the query has multiple chained parameters, each chain is evaluated separately. For example, Patient?general-practitioner.name=Joe&general-practitioner.address-country=Canada would match a Patient that had two general-practitioner references, one named "Joe" and the other having an address in Canada. There is no syntax to group these clauses together to match only Joe from Canada.

The Cloud Healthcare API supports single-level chained searches. You can't do a chained search using more than one level of chaining.

Chained search samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the Observation?subject:Patient.name=Christopher query to return all Observations that have a subject which is a Patient that has a name beginning with Christopher.

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation?subject:Patient.name=Christopher"

PowerShell


The following sample uses the Observation?subject:Patient.name=Christopher query to return all Observations that have a subject which is a Patient that has a name beginning with Christopher.

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation?subject:Patient.name=Christopher" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/85652a63-09ba-4a5b-ac5b-b690c6972eb5",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "laboratory",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "2093-3",
              "display": "Total Cholesterol",
              "system": "http://loinc.org"
            }
          ],
          "text": "Total Cholesterol"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "85652a63-09ba-4a5b-ac5b-b690c6972eb5",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "mg/dL",
          "system": "http://unitsofmeasure.org",
          "unit": "mg/dL",
          "value": 191
        }
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/e7aea507-61af-4290-9323-0b3daed0b7a9",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "laboratory",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "2571-8",
              "display": "Triglycerides",
              "system": "http://loinc.org"
            }
          ],
          "text": "Triglycerides"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "e7aea507-61af-4290-9323-0b3daed0b7a9",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "mg/dL",
          "system": "http://unitsofmeasure.org",
          "unit": "mg/dL",
          "value": 143
        }
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/a35bf421-1f00-4897-a94d-4d47c3bb306b",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "55284-4",
              "display": "Blood Pressure",
              "system": "http://loinc.org"
            }
          ]
        },
        "component": [
          {
            "code": {
              "coding": [
                {
                  "code": "8480-6",
                  "display": "Systolic Blood Pressure",
                  "system": "http://loinc.org"
                }
              ],
              "text": "Systolic Blood Pressure"
            },
            "valueQuantity": {
              "code": "mmHg",
              "system": "http://unitsofmeasure.org",
              "unit": "mmHg",
              "value": 133
            }
          },
          {
            "code": {
              "coding": [
                {
                  "code": "8462-4",
                  "display": "Diastolic Blood Pressure",
                  "system": "http://loinc.org"
                }
              ],
              "text": "Diastolic Blood Pressure"
            },
            "valueQuantity": {
              "code": "mmHg",
              "system": "http://unitsofmeasure.org",
              "unit": "mmHg",
              "value": 84
            }
          }
        ],
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "a35bf421-1f00-4897-a94d-4d47c3bb306b",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BloodPressure"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        }
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/14df9701-2dd4-4538-8fac-776c40dec22d",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "8302-2",
              "display": "Body Height",
              "system": "http://loinc.org"
            }
          ],
          "text": "Body Height"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "14df9701-2dd4-4538-8fac-776c40dec22d",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-VitalSign",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BodyHeight"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "cm",
          "system": "http://unitsofmeasure.org",
          "unit": "centimeters",
          "value": 177.72961711703704
        }
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/1e2fdce6-4c79-4ef8-a5a9-2326cddbc8b3",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "39156-5",
              "display": "Body Mass Index",
              "system": "http://loinc.org"
            }
          ],
          "text": "Body Mass Index"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "1e2fdce6-4c79-4ef8-a5a9-2326cddbc8b3",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-VitalSign",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BodyMassIndex"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "kg/m2",
          "system": "http://unitsofmeasure.org",
          "unit": "kg/m2",
          "value": 38.34566163709526
        }
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/58357362-6f18-438a-8479-3289ebab1617",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "laboratory",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "18262-6",
              "display": "Low Density Lipoprotein Cholesterol",
              "system": "http://loinc.org"
            }
          ],
          "text": "Low Density Lipoprotein Cholesterol"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "58357362-6f18-438a-8479-3289ebab1617",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "mg/dL",
          "system": "http://unitsofmeasure.org",
          "unit": "mg/dL",
          "value": 102
        }
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/c6f1b042-a0fc-4bbc-9cd5-7a8a924c00e7",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "laboratory",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "2085-9",
              "display": "High Density Lipoprotein Cholesterol",
              "system": "http://loinc.org"
            }
          ],
          "text": "High Density Lipoprotein Cholesterol"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "c6f1b042-a0fc-4bbc-9cd5-7a8a924c00e7",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "mg/dL",
          "system": "http://unitsofmeasure.org",
          "unit": "mg/dL",
          "value": 60
        }
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/ac57b908-2804-4d67-a7ad-1e4a4c3225a1",
      "resource": {
        "category": [
          {
            "coding": [
              {
                "code": "vital-signs",
                "system": "http://hl7.org/fhir/observation-category"
              }
            ]
          }
        ],
        "code": {
          "coding": [
            {
              "code": "29463-7",
              "display": "Body Weight",
              "system": "http://loinc.org"
            }
          ],
          "text": "Body Weight"
        },
        "effectiveDateTime": "2008-03-07T17:47:02-05:00",
        "encounter": {
          "reference": "Encounter/0e9d631c-4407-45e5-bfbe-689806caaf7b"
        },
        "id": "ac57b908-2804-4d67-a7ad-1e4a4c3225a1",
        "issued": "2008-03-07T17:47:02-05:00",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-observation-Observation",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-VitalSign",
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-vital-BodyWeight"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Observation",
        "status": "final",
        "subject": {
          "reference": "Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a"
        },
        "valueQuantity": {
          "code": "kg",
          "system": "http://unitsofmeasure.org",
          "unit": "kg",
          "value": 121.12557348891558
        }
      },
      "search": {
        "mode": "match"
      }
    }
  ],
  "link": [
    {
      "relation": "search",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/?subject%3APatient.name=Christopher"
    },
    {
      "relation": "first",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/?subject%3APatient.name=Christopher"
    },
    {
      "relation": "self",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation/?subject%3APatient.name=Christopher"
    }
  ],
  "resourceType": "Bundle",
  "total": 8,
  "type": "searchset"
}

A reverse chained search matches resources based on criteria on other resources that refer to them. The syntax for a reverse chained search is:

_has:[resource type]:[reference parameter]:[search parameter]=[value]

For example, the Appointment resource has a search parameter patient referring to a Patient resource. To find all Patient resources that are referenced by an Appointment resource with a date of 2020-04-01, use Patient?_has:Appointment:patient:date=eq2020-04-01.

Reverse chains can be recursive, for example Practitioner?_has:Encounter:practitioner:_has:Claim:encounter:created=eq2020-04-01 would match a Practitioner P if there is an Encounter E and a Claim C such that C has a created date of 2020-04-01, C refers to E through its encounter reference, and E refers to P through its practitioner reference.

Reverse chained search samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the Patient?_has:Procedure:patient:date=eq2008-03-07 query.

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_has:Procedure:patient:date=eq2008-03-07"

PowerShell


The following sample uses the Patient?_has:Procedure:patient:date=eq2008-03-07 query.

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_has:Procedure:patient:date=eq2008-03-07" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
      "resource": {
        "address": [
          {
            "country": "US",
            "line": [
              "907 Arlo Cliffs",
              "Suite 984"
            ],
            "postalCode": "XXXXX"
          }
        ],
        "birthDate": "1940-12-01",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "en-US",
                  "display": "English (United States)",
                  "system": "urn:ietf:bcp:47"
                }
              ]
            }
          }
        ],
        "deceasedDateTime": "2009-07-26T12:01:23-05:00",
        "extension": [
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "2106-3",
                  "display": "White",
                  "system": "http://hl7.org/fhir/v3/Race"
                }
              ],
              "text": "race"
            }
          },
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "2186-5",
                  "display": "Nonhispanic",
                  "system": "http://hl7.org/fhir/v3/Ethnicity"
                }
              ],
              "text": "ethnicity"
            }
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/birthPlace",
            "valueAddress": {
              "city": "Tama",
              "country": "US",
              "postalCode": "52339",
              "state": "Iowa"
            }
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
            "valueString": "Farrah Feeney"
          },
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
            "valueCode": "M"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/patient-interpreterRequired",
            "valueBoolean": false
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-actor-FictionalPerson-extension",
            "valueBoolean": true
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-FathersName-extension",
            "valueHumanName": {
              "text": "Christopher Diaz"
            }
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-SocialSecurityNumber-extension",
            "valueString": "999-16-9041"
          }
        ],
        "gender": "male",
        "generalPractitioner": [
          {
            "reference": "Organization/9fb51c89-1453-406c-8357-578311b43a91"
          }
        ],
        "id": "8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
        "identifier": [
          {
            "system": "https://github.com/synthetichealth/synthea",
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          },
          {
            "system": "http://hl7.org/fhir/sid/us-ssn",
            "type": {
              "coding": [
                {
                  "code": "SB",
                  "system": "http://hl7.org/fhir/identifier-type"
                }
              ]
            },
            "value": "999169041"
          },
          {
            "system": "urn:oid:2.16.840.1.113883.4.3.25",
            "type": {
              "coding": [
                {
                  "code": "DL",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "S99992205"
          },
          {
            "system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
            "type": {
              "coding": [
                {
                  "code": "PPN",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "X12551631X"
          },
          {
            "system": "http://hospital.smarthealthit.org",
            "type": {
              "coding": [
                {
                  "code": "MR",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          }
        ],
        "maritalStatus": {
          "coding": [
            {
              "code": "S",
              "system": "http://hl7.org/fhir/v3/MaritalStatus"
            }
          ],
          "text": "S"
        },
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-PersonOfRecord"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "multipleBirthBoolean": false,
        "name": [
          {
            "family": "Diaz",
            "given": [
              "Christopher"
            ],
            "prefix": [
              "Mr."
            ],
            "use": "official"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "system": "phone",
            "use": "home",
            "value": "434-100-2918 x800"
          }
        ],
        "text": {
          "div": "
Generated by Synthea. Version identifier: 2dd4c1c37e2743d14e5073c7b5e42899a3e51531
", "status": "generated" } }, "search": { "mode": "match" } } ], "link": [ { "relation": "search", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_has%3AProcedure%3Apatient%3Adate=eq2008-03-07" }, { "relation": "first", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_has%3AProcedure%3Apatient%3Adate=eq2008-03-07" }, { "relation": "self", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_has%3AProcedure%3Apatient%3Adate=eq2008-03-07" } ], "resourceType": "Bundle", "total": 1, "type": "searchset" }

Including additional resources in search results

The _include and _revinclude parameters request that the search results include additional resources ("included resources") related to the resources directly matching the query ("primary results"). Using these parameters is more efficient than making a series of requests to retrieve these additional resources separately. In the searchset bundle returned from the search, resources added by these parameters will be flagged with entry.search.mode = include to distinguish them from primary results which will have entry.search.mode = match.

Forward inclusion with _include adds resources and resource versions referenced by the primary results, and reverse inclusion with _revinclude adds resources that reference the primary results. The reference to follow is specified by the name of a search parameter, and only reference fields that are available as search parameters can be used in this way.

The parameter formats to _include and _revinclude are the same, taking two or three values delimited by :. The first value is the resource type that the reference is coming from, the second value is the search parameter name, and the optional third value limits the resource type to a single type in cases where the reference can point to more than one type.

For example:

  • MedicationRequest?_include=MedicationRequest:subject searches over MedicationRequest resources, and for each resource returned also returns the target of the subject reference which might be a Group or Patient as defined in the FHIR specification.
  • MedicationRequest?_include=MedicationRequest:subject:Patient is similar but only returns subject references to Patient resources.
  • MedicationRequest?_revinclude=Provenance:target searches over MedicationRequest resources, and for each resource returned also returns any Provenance resources where the target reference on Provenance refers to the matching resource.

_include search samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the Observation?code=http://loinc.org|2571-8&_include=* query.

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation?code=http://loinc.org|2571-8&_include=*"

PowerShell


The following sample uses the Observation?code=http://loinc.org|2571-8&_include=* query.

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Observation?code=http://loinc.org|2571-8&_include=*" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
      "resource": {
        "address": [
          {
            "country": "US",
            "line": [
              "907 Arlo Cliffs",
              "Suite 984"
            ],
            "postalCode": "XXXXX"
          }
        ],
        "birthDate": "1940-12-01",
        "communication": [
          {
            "language": {
              "coding": [
                {
                  "code": "en-US",
                  "display": "English (United States)",
                  "system": "urn:ietf:bcp:47"
                }
              ]
            }
          }
        ],
        "deceasedDateTime": "2009-07-26T12:01:23-05:00",
        "extension": [
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "2106-3",
                  "display": "White",
                  "system": "http://hl7.org/fhir/v3/Race"
                }
              ],
              "text": "race"
            }
          },
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "2186-5",
                  "display": "Nonhispanic",
                  "system": "http://hl7.org/fhir/v3/Ethnicity"
                }
              ],
              "text": "ethnicity"
            }
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/birthPlace",
            "valueAddress": {
              "city": "Tama",
              "country": "US",
              "postalCode": "52339",
              "state": "Iowa"
            }
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
            "valueString": "Farrah Feeney"
          },
          {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
            "valueCode": "M"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/patient-interpreterRequired",
            "valueBoolean": false
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-actor-FictionalPerson-extension",
            "valueBoolean": true
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-FathersName-extension",
            "valueHumanName": {
              "text": "Christopher Diaz"
            }
          },
          {
            "url": "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-SocialSecurityNumber-extension",
            "valueString": "999-16-9041"
          }
        ],
        "gender": "male",
        "generalPractitioner": [
          {
            "reference": "Organization/9fb51c89-1453-406c-8357-578311b43a91"
          }
        ],
        "id": "8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
        "identifier": [
          {
            "system": "https://github.com/synthetichealth/synthea",
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          },
          {
            "system": "http://hl7.org/fhir/sid/us-ssn",
            "type": {
              "coding": [
                {
                  "code": "SB",
                  "system": "http://hl7.org/fhir/identifier-type"
                }
              ]
            },
            "value": "999169041"
          },
          {
            "system": "urn:oid:2.16.840.1.113883.4.3.25",
            "type": {
              "coding": [
                {
                  "code": "DL",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "S99992205"
          },
          {
            "system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
            "type": {
              "coding": [
                {
                  "code": "PPN",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "X12551631X"
          },
          {
            "system": "http://hospital.smarthealthit.org",
            "type": {
              "coding": [
                {
                  "code": "MR",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          }
        ],
        "maritalStatus": {
          "coding": [
            {
              "code": "S",
              "system": "http://hl7.org/fhir/v3/MaritalStatus"
            }
          ],
          "text": "S"
        },
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "profile": [
            "http://standardhealthrecord.org/fhir/StructureDefinition/shr-demographics-PersonOfRecord"
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "multipleBirthBoolean": false,
        "name": [
          {
            "family": "Diaz",
            "given": [
              "Christopher"
            ],
            "prefix": [
              "Mr."
            ],
            "use": "official"
          }
        ],
        "resourceType": "Patient",
        "telecom": [
          {
            "system": "phone",
            "use": "home",
            "value": "434-100-2918 x800"
          }
        ],
        "text": {
          "div": "
Generated by Synthea. Version identifier: 2dd4c1c37e2743d14e5073c7b5e42899a3e51531
", "status": "generated" } }, "search": { "mode": "match" } } ], "link": [ { "relation": "search", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_has%3AProcedure%3Apatient%3Adate=eq2008-03-07" }, { "relation": "first", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_has%3AProcedure%3Apatient%3Adate=eq2008-03-07" }, { "relation": "self", "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_has%3AProcedure%3Apatient%3Adate=eq2008-03-07" } ], "resourceType": "Bundle", "total": 1, "type": "searchset" }

The modifier :iterate causes an _include to be evaluated iteratively. This modifier can follow an extra layer of references from included results, or follow recursive structures such as Observation:derived-from referring to another Observation. The depth of recursion is limited.

For example:

  • Observation?_include:iterate=Observation:derived-from:Observation searches over Observation resources and recursively follows the derived-from reference from matching Observation resources, and then from included resources, and so on.
  • MedicationRequest?_revinclude=Provenance:target&_include:iterate=Provenance:agent will search over MedicationRequest, include Provenance resources with a target that is in this result set, and then also include resources referenced through the agent parameter of those Provenance resources.

A wild card, *, indicates that all references available as search parameters should be included. You can use the * wild card as the first and only argument in the_include, or in place of the search parameter name from the standard _include, where the optional third value limits the resource type to a single type as in the original behavior.

For example:

  • Observation?_include=* searches over Observation resources, and for each resource also returns all referenced resources.
  • Observation?_include=Observation:* is equivalent to the preceding.
  • MedicationRequest?_include=MedicationRequest:*:Patient returns all references to Patient resources for each MedicationRequest resource.

Included resources will be deduplicated so only one copy of a resource will be returned within a page of results even if it is found through multiple references. The same included resource will be returned on each page of results where a primary result relates to it.

Limiting fields returned in search results

The _elements parameter allows the client to request that only a subset of fields is returned for each search result to reduce the size of the response by omitting unnecessary data. The parameter accepts a comma-separated list of base element names in the resource, for example Patient?_elements=identifier,contact,link. Only these fields and their children will be included in the returned resources. Resources in the response that have been altered by this parameter will contain a meta.tag value of SUBSETTED to indicate that they are incomplete.

_elements search samples

REST & CMD LINE

Before using any of the request data, make the following replacements:

  • PROJECT_ID: your Google Cloud project ID
  • LOCATION: the location of the parent dataset
  • DATASET_ID: the FHIR store's parent dataset
  • FHIR_STORE_ID: the FHIR store ID

To send your request, choose one of these options:

curl


The following sample uses the Patient?_elements=identifier,contact,link query.

Execute the following command:

curl -X GET \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_elements=identifier,contact,link"

PowerShell


The following sample uses the Patient?_elements=identifier,contact,link query.

Execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient?_elements=identifier,contact,link" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "entry": [
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient3",
      "resource": {
        "id": "patient3",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "SUBSETTED",
              "system": "http://hl7.org/fhir/v3/ObservationValue"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Patient"
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient2",
      "resource": {
        "id": "patient2",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "SUBSETTED",
              "system": "http://hl7.org/fhir/v3/ObservationValue"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Patient"
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
      "resource": {
        "id": "8ac08aa9-63d2-4e81-8647-3a138d7f9f5a",
        "identifier": [
          {
            "system": "https://github.com/synthetichealth/synthea",
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          },
          {
            "system": "http://hl7.org/fhir/sid/us-ssn",
            "type": {
              "coding": [
                {
                  "code": "SB",
                  "system": "http://hl7.org/fhir/identifier-type"
                }
              ]
            },
            "value": "999169041"
          },
          {
            "system": "urn:oid:2.16.840.1.113883.4.3.25",
            "type": {
              "coding": [
                {
                  "code": "DL",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "S99992205"
          },
          {
            "system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
            "type": {
              "coding": [
                {
                  "code": "PPN",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "X12551631X"
          },
          {
            "system": "http://hospital.smarthealthit.org",
            "type": {
              "coding": [
                {
                  "code": "MR",
                  "system": "http://hl7.org/fhir/v2/0203"
                }
              ]
            },
            "value": "c1ee4b49-3194-4b39-91ed-4d1393a780c6"
          }
        ],
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "SUBSETTED",
              "system": "http://hl7.org/fhir/v3/ObservationValue"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Patient"
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "fullUrl": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/patient1",
      "resource": {
        "id": "patient1",
        "meta": {
          "lastUpdated": "LAST_UPDATED",
          "tag": [
            {
              "code": "SUBSETTED",
              "system": "http://hl7.org/fhir/v3/ObservationValue"
            }
          ],
          "versionId": "MTYzMTgyMTExMDIyMDk5ODAwMA"
        },
        "resourceType": "Patient"
      },
      "search": {
        "mode": "match"
      }
    }
  ],
  "link": [
    {
      "relation": "search",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_elements=identifier%2Ccontact%2Clink"
    },
    {
      "relation": "first",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_elements=identifier%2Ccontact%2Clink"
    },
    {
      "relation": "self",
      "url": "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/?_elements=identifier%2Ccontact%2Clink"
    }
  ],
  "resourceType": "Bundle",
  "total": 4,
  "type": "searchset"
}

The Cloud Healthcare API has limited support for the _summary parameter, which provides pre-defined subsets of resource fields similar to _elements:

  • _summary=text returns only the text, id, and meta top-level fields
  • _summary=data removes the text field and returns all other fields