高度な FHIR 検索機能

このページでは、projects.locations.datasets.fhirStores.fhir.search メソッドで利用できる高度なクエリ機能を使用して FHIR リソースを検索する方法について説明します。このガイドは、FHIR リソースの検索の内容をすでに理解していることを前提としています。

サンプル FHIR バンドル

このページのサンプルでは、指定された JSON FHIR バンドルを使用して、高度な FHIR 検索機能の結果を表示します。r4_bundle.json ファイルをマシンに保存してサンプルで使用します。

サンプル FHIR バンドルを実行する

FHIR ストアでサンプル FHIR バンドルを実行するには、バンドルの実行をご覧ください。FHIR ストアには次の設定が必要です。

文字列検索修飾子

文字列検索は、標準の Unicode NFC 形式への畳み込みによって大文字と小文字およびアクセントを区別しない接頭辞一致にデフォルトで設定されます。句読点と余分な空白は無視されます。

次の修飾子を使用できます。

  • :contains は、文字列内に指定された値を持つリソースに一致します。たとえば、name:contains=eveEvelynSeverine に一致します。
  • :exact は、大文字と小文字、アクセントを含む文字列全体と一致します。たとえば、name:exact=EveeveEvelyn とは一致しません。

検索文字列修飾子の使用例を表示するには、次のセクションを開いてください。

文字列検索修飾子のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは Patient?name:contains=eve クエリを使用しています。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは Patient?name:contains=eve クエリを使用しています。

次のコマンドを実行します。

$cred = gcloud auth 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

次のような JSON レスポンスが返されます。

{
  "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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"
}

数値、日付、数量の比較演算子と精度

数値検索や日付検索で使用される値は、パラメータ値の精度によって異なります。たとえば、数値 7.00 には、6.995(含まれる)から 7.005(含まれない)までの暗黙的な範囲があります。日付 2015-08-12 には、2015-08-12T00:00:00(含まれる)から 2015-08-13T00:00:00(含まれない)までの範囲があります。

精度は、等価比較で返される結果に影響します。たとえば、リソース内の値 7.03value=7.0 の検索で一致しますが、value=7.00 の検索では一致しません。

FHIR の医療的に重要な浮動小数点値はすべて、格納された値の精度を記録する DecimalQuantity などの型で表されます。例外として、単純な整数を使用するフィールド(シーケンス内の位置を表すためなど)がいくつかあり、これらのフィールドでの検索は完全数値一致です。

次の接頭辞は、シングルトン値に対する数値比較に適用されます。接頭辞が指定されていない場合、デフォルトは eq です。

  • eq: 等しい。保存された正確な値は、パラメータ値の精度で定義された範囲内にある
  • ne: 等しくない、eq の逆
  • gt: 保存された正確な値が正確なパラメータ値よりも大きい
  • lt: 保存された正確な値が正確なパラメータ値よりも小さい
  • ge: 保存された正確な値が正確なパラメータ値と同じかそれよりも大きい
  • le: 保存された正確な値が正確なパラメータ値と同じかそれよりも小さい

日付値には、値の具体性レベル(1 年、1 か月、1 日)に基づく暗黙的な範囲があります。RangePeriod などの他のデータ型には、明示的な上限と下限があります。範囲の比較には次の接頭辞が適用されます。接頭辞が指定されていない場合、デフォルトは eq です。

  • eq: 等しい、パラメータ値の範囲にターゲットの範囲全体が含まれる
  • ne: 等しくない、eq の逆
  • gt: 大きい、パラメータ値の上の範囲がターゲットの範囲と重なっている
  • lt: 小さい、パラメータ値の下の範囲がターゲットの範囲と重なっている
  • ge: 大きいまたは同じ
  • le: 小さいまたは同じ
  • sa: パラメータ値の範囲がターゲット範囲の後で始まる
  • eb: パラメータ値の範囲がターゲット範囲の前で終了する

数値、日付、数量の比較演算子と精度のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは、_lastUpdated=gt2018-01-01 クエリを使用して、_lastUpdated の値が(gt2018-01-01 より大きい患者リソースを検索します。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは、_lastUpdated=gt2018-01-01 クエリを使用して、_lastUpdated の値が(gt2018-01-01 より大きい患者リソースを検索します。

次のコマンドを実行します。

$cred = gcloud auth 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

クエリ _lastUpdated=gt2018-01-01 により、2018 年 1 月 1 日以降に更新された患者リソースが返されます。その日付以降に FHIR ストア内のすべてのリソースを作成した場合、サーバーはすべてのリソースを返します。リソースのサブセットを表示するには、その日付を一部のリソースが最後に更新された後の時間に変更します。

{
  "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ", "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" }

トークン検索パラメータは、値が任意の文字列ではなく、命名システムのエンティティである場合に適用されます。トークン パラメータの文字列一致は完全一致です。

ほとんどのトークン検索は、code 値の取得元の命名システムを示す URI である system を含む複雑なデータ型に適用されます。これらの検索では、次の値の構文がサポートされます。

  • [parameter]=[code] は、system に関係なく code 値と一致します。
  • [parameter]=[system]|[code] は、指定された systemcode の両方に一致する必要があります。
  • system の値が空の場合、[parameter]=|[code]code と一致します。
  • [parameter]=[system]| は、指定された system 値を持つ任意の code と一致します。

代替トークン検索機能をトリガーするいくつかの修飾子があります。

  • :not はトークン検索の一致条件を否定します。
  • :text は、コード値自体ではなく、コードに関連付けられた text フィールドまたは display フィールドで文字列検索を行います(完全一致ではありません)。
  • :above[system]|[code] という形式のパラメータのみを受け取り、リソース内のコードがクエリ パラメータを含むリソースと一致します。この修飾子を使用するには、指定された systemCodeSystem リソースとして FHIR ストアに存在する必要があります。
  • :below:above に似ていますが、リソース内のコードがクエリ パラメータに含まれる場合に一致します。
  • :in は、参照パラメータ構文を使用して単一のパラメータを取ります(code:in=ValueSet/1234 など)。同じ FHIR ストア内の ValueSet リソースを参照する必要があります。修飾子は、参照される ValueSet 内の任意のコードと一致します。
  • :not-in:in の条件を否定します

トークン検索は、ブール値フィールドと URI フィールド、および完全一致のみが許可される特定の文字列フィールドにも適用されます。この場合、パラメータの形式は [parameter]=[value] のみです。

トークン検索のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルは、Patient?_tag=tag-system|tag2 クエリを使用して、指定された systemcode の患者リソースを検索します。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルは、Patient?_tag=tag-system|tag2 クエリを使用して、指定された systemcode の患者リソースを検索します。

次のコマンドを実行します。

$cred = gcloud auth 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

次のような JSON レスポンスが返されます。

{
  "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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"
}

欠損値の検索

検索修飾子 :missing を任意の検索パラメータで使用すると、指定したフィールドの値の有無に基づいて照合できます。たとえば、Patient?gender=unknown は性別の unknown 列挙値を明示的に含むリソースと一致します。しかし、このフィールドは必須ではないため、フィールドに値がないリソースが他にあることも考えられます。このようなリソースは Patient?gender:missing=true で照合できます。反対に、Patient?gender:missing=false は、このフィールドに明示的に入力されているすべてのリソースと一致します。

欠損値のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは gender:missing=false クエリを使用しています。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは gender:missing=false クエリを使用しています。

次のコマンドを実行します。

$cred = gcloud auth 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
ID が patient3 の患者リソースの 1 つに gender 値がありません。
{
  "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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"
}

特殊な検索パラメータの _content は、文字列ベースのフィールド(数値、日付、列挙型フィールドを除く)がリソースの検索パラメータのターゲットである場合、テキスト マッチングを実行します。デフォルトでは、_content は、次に挙げる他の演算子も加味し、クエリ内のすべての単語を含むリソースに一致します。

  • | は OR 演算子です。たとえば、abc | def | ghi xyzxyz と 1 つ以上の abc def ghi を含むリソースに一致します。
  • - は NOT 演算子です。たとえば、abc -defabc を含むが def を含まないリソースと一致します。

照合は単語全体に基づいており、部分文字列または英数字以外の一致は含まれません。単語の順序は関係ありません。一致する単語は、リソース内の複数のフィールドに分散している可能性があります。

パラメータ _text は、人が読める形式のリソース コンテンツの概要を含めることを目的とした Narrative フィールドに対してのみ同じタイプの一致を実行します。Cloud Healthcare API はこの概要を自動的に生成しませんが、リソースの作成または更新時にこのデータがクライアントによって入力された場合、_text 検索パラメータをサポートします。

テキスト検索のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは _content=Smith%20|%20Mountain%20View クエリを使用しています。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは _content=Smith%20|%20Mountain%20View クエリを使用しています。

次のコマンドを実行します。

$cred = gcloud auth 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

次のような JSON レスポンスが返されます。

{
  "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"
}

複合検索パラメータ

複数のクエリ パラメータを使用して検索する場合、個々の検索パラメータを AND で結合すると意図しない結果と一致することがあります。複合検索パラメータは、この問題に対処するための特殊なタイプの検索パラメータです。

たとえば、Observation リソースの component フィールドには複数の値を含めることができ、各値には codevalue のペアが含まれます。Observation?component-code=8867-4&component-value-quantity=lt50 の検索は、code が 8867-4 のコンポーネントを 1 つ含み、value が 50 未満の異なるコンポーネントを含むリソースに一致します。この検索を使用して、同じコンポーネント内でこれら 2 つの値に一致するように制限することはできません。

複合検索パラメータは、他の 2 つの検索パラメータを組み合わせ、両方のパラメータが一致する必要があるネストレベルを定義する新しいパラメータを定義します。クエリでは、2 つの値は $ によって結合されます。たとえば、Observation には複合パラメータ component-code-value-quantity があり、これにより前の例を Observation?component-code-value-quantity=8867-4$lt50 で検索して 1 つのコンポーネントに制限できます。これらのパラメータは FHIR 仕様で定義されており、検索パラメータのすべての組み合わせに対応しているわけではありません。

複合検索パラメータでは修飾子を使用できません。

すべての検索パラメータと同様に、Cloud Healthcare API でサポートされる複合パラメータに関する情報は、機能ステートメントまたは FHIR 適合性宣言で確認できます。

複合検索のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは Observation?component-code-value-quantity=8480-6$lt150 クエリを使用しています。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは Observation?component-code-value-quantity=8480-6$lt150 クエリを使用しています。

次のコマンドを実行します。

$cred = gcloud auth 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
レスポンスには、component-code=8480-6component-value-quantity が 133 の観察が含まれます。これは 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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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"
}

チェーン検索を使用すると、クエリのコンテキスト内で参照を走査できます。チェーン検索の基本的な構文は次のとおりです。

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

参照パラメータが 1 つのリソースタイプのみを参照する場合は、:[resource type] を省略できます。

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

たとえば、Observation には GroupDevicePatient、または Location を参照する参照検索パラメータ subject があります。名前が「Joe」で始まる Patientsubject を持つ Observations を検索するには、Observation?subject:Patient.name=Joe を検索します。

クエリに複数のチェーン パラメータがある場合、各チェーンは個別に評価されます。たとえば、Patient?general-practitioner.name=Joe&general-practitioner.address-country=Canada は、「Joe」という名前とカナダの住所という 2 つの general-practitioner 参照を持つ Patient と一致します。これらの句をグループ化してカナダの Joe のみに一致させる構文はありません。

チェーン検索は、他のチェーンまたはリバース チェーンとともに再帰的に使用できます。たとえば、Observation?subject:Patient.organization.name=Acme は、Acme という nameorganization を参照する subject を参照する Observation と一致します。

チェーン検索のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは、Observation?subject:Patient.name=Christopher クエリを使用して、名前が Christopher で始まる Patientsubject を持つすべての観察が返されます。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは、Observation?subject:Patient.name=Christopher クエリを使用して、名前が Christopher で始まる Patientsubject を持つすべての観察が返されます。

次のコマンドを実行します。

$cred = gcloud auth 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

次のような JSON レスポンスが返されます。

{
  "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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"
}

リバース チェーン検索は、そのリソースを参照する他のリソースの条件に基づいてリソースを照合します。リバース チェーン検索の構文は次のとおりです。

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

たとえば、Appointment リソースには Patient リソースを参照する検索パラメータ patient があります。日付が 2020-04-01Appointment リソースに参照されるすべての Patient リソースを検索するには、Patient?_has:Appointment:patient:date=eq2020-04-01 を使用します。

リバース チェーンは他のチェーンまたはリバース チェーンで再帰的に使用できます。たとえば、Encounter E と Claim C があり、C の作成日が 2020-04-01 で、C は encounter 参照を介して E を参照し、E は practitioner 参照を介して P を参照する場合、Practitioner?_has:Encounter:practitioner:_has:Claim:encounter:created=eq2020-04-01Practitioner P に一致します。

リバース チェーン検索のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは Patient?_has:Procedure:patient:date=eq2008-03-07 クエリを使用しています。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは Patient?_has:Procedure:patient:date=eq2008-03-07 クエリを使用しています。

次のコマンドを実行します。

$cred = gcloud auth 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

次のような JSON レスポンスが返されます。

{
  "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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" }

検索結果に追加リソースを含める

_include パラメータと _revinclude パラメータは、クエリに直接一致するリソース(「プライマリ結果」)に関連する追加リソース(「包含リソース」)を検索結果に含むようリクエストします。これらのパラメータを使用すると、これらの追加リソースを繰り返し個別に取得するよりも効率的です。検索から返された searchset バンドルでは、これらのパラメータによって追加されたリソースに entry.search.mode = include のフラグが付けられ、entry.search.mode = match を持つプライマリ結果と区別されます。

_include による順方向の包含では、メインの結果により参照されるリソースとリソース バージョンが追加され、_revinclude による逆方向の包含ではメインの結果を参照するリソースが追加されます。後に続く参照は検索パラメータの名前で指定され、検索パラメータとして使用できる参照フィールドのみがこの方法で使用できます。

_include_revinclude のパラメータ形式は同じで、2 つまたは 3 つの値を : で区切ります。最初の値は参照元のリソースタイプ、2 番目の値は検索パラメータ名、3 番目の値は省略可能で、参照が複数のタイプを指す可能性がある場合にリソースタイプを 1 種類に制限します。

次に例を示します。

  • MedicationRequest?_include=MedicationRequest:subjectMedicationRequest リソースを検索し、返される各リソースについて、FHIR 仕様で定義されている Group または Patient の可能性がある subject 参照のターゲットも返します。
  • MedicationRequest?_include=MedicationRequest:subject:Patient も同様ですが、Patient リソースへの subject 参照のみを返します。
  • MedicationRequest?_revinclude=Provenance:targetMedicationRequest リソースを検索し、返された各リソースについて、Provenancetarget 参照が一致するリソースを参照する Provenance リソースも返します。

_include 検索のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは、Observation?code=http://loinc.org|2571-8&_include=* クエリを使用しています。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは、Observation?code=http://loinc.org|2571-8&_include=* クエリを使用しています。

次のコマンドを実行します。

$cred = gcloud auth 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

次のような JSON レスポンスが返されます。

{
  "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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" }

修飾子 :iterate を指定すると、_include が反復的に評価されます。この修飾子は、追加された結果から参照の追加レイヤをたどるか、Observation:derived-from が別の Observation を参照するなどの再帰構造に従う場合があります。再帰の深さには制限があります。

次に例を示します。

  • Observation?_include:iterate=Observation:derived-from:ObservationObservation のリソースを検索し、一致する Observation リソースからの派生参照、続いて包含リソースからの派生参照などを再帰的にたどります。
  • MedicationRequest?_revinclude=Provenance:target&_include:iterate=Provenance:agentMedicationRequest を検索し、この結果セットに target を持つ Provenance リソースを含め、さらにこれらの Provenance リソースの agent パラメータで参照されるリソースも含めます。

ワイルドカード * は、検索パラメータとして使用可能なすべてのリファレンスを含める必要があることを示します。* ワイルドカードは、_include 内の最初で唯一の引数、あるいは標準の _include の検索パラメータ名の代わりに使用できます。オプションの 3 つ目の値は、元の動作と同様に、リソースタイプを 1 つのタイプに制限します。

次に例を示します。

  • Observation?_include=*Observation リソースを検索し、各リソースが参照するすべてのリソースも含めて返します。
  • Observation?_include=Observation:* は、上記と同等です。
  • MedicationRequest?_include=MedicationRequest:*:Patient は、各 MedicationRequest リソースが参照するすべての Patient リソースを返します。

サーバーは、重複を排除して、結果が複数の参照に表示されている場合でも、結果の各ページにそのリソースのコピーが 1 つのみ含まれるようにします。プライマリ結果が関連する場合は、結果の各ページに同じ包含リソースが表示されます。

_include パラメータと _revinclude パラメータを使用すると、その他のリソースを追加できます。

  • 包含リソースはページサイズにカウントされません。Bundle.total ではカウントされず、返されるリソースの数が指定された _count パラメータよりも大きくなる場合があります。

  • 含まれているリソースはページサイズにカウントされないため、多くの結果を生成する可能性がある _include パラメータと _revinclude パラメータは慎重に使用してください。結果のサイズが大きいと、タイムアウトまたはエラーが発生する可能性があります。含まれる結果の数が多いと予想される場合は、小さい _count 値を使用してプライマリ結果の数を制限することを検討してください。関係の多くが制限なしである 1 対多の関係にならないようにしてください。

  • 個別の _revinclude パラメータによって、最大 100 個のリソースが追加されます。プライマリ結果を参照するリソースが 100 を超える場合は、ページサイズとページ設定パラメータを使用して個別の検索クエリ リクエストを行うことで、100 を超える結果を取得します。

検索結果に返されるフィールドの制限

_elements パラメータを使用すると、クライアントは検索結果ごとにフィールドのサブセットのみが返されるようリクエストできるため、不要なデータを省略してレスポンスのサイズを小さくできます。パラメータには、リソース内のベース要素名のカンマ区切りのリスト(Patient?_elements=identifier,contact,link など)を指定できます。これらのフィールドとその子のみが、返されるリソースに含まれます。このパラメータによって変更されたレスポンス内のリソースには、SUBSETTEDmeta.tag 値が含まれ、不完全であることを示します。

_elements 検索のサンプル

REST

リクエストのデータを使用する前に、次のように置き換えます。

  • PROJECT_ID: 実際の Google Cloud プロジェクト ID
  • LOCATION: 親データセットの場所
  • DATASET_ID: FHIR ストアの親データセット
  • FHIR_STORE_ID: FHIR ストア ID

リクエストを送信するには、次のいずれかのオプションを選択します。

curl


次のサンプルでは、Patient?_elements=identifier,contact,link クエリを使用しています。

次のコマンドを実行します。

curl -X GET \
-H "Authorization: Bearer $(gcloud auth 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


次のサンプルでは、Patient?_elements=identifier,contact,link クエリを使用しています。

次のコマンドを実行します。

$cred = gcloud auth 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

次のような JSON レスポンスが返されます。

{
  "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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": "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ",
          "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"
}

Cloud Healthcare API でサポートされている _summary パラメータは制限されており、_elements と同様のリソース フィールドの事前定義されたサブセットが提供されます。

  • _summary=text は、textid、および meta のトップレベル フィールドのみを返します。
  • _summary=datatext フィールドを削除し、他のすべてのフィールドを返します。