在 Azure API for FHIR 中儲存設定檔

HL7 快速醫療保健互通性資源 (FHIR®) 定義儲存和交換醫療保健資料的標準和互通方式。 即使在基底 FHIR 規格內,根據使用 FHIR 的內容來定義其他規則或延伸模組會很有説明。 針對 FHIR 的這類內容特定用途, FHIR 設定檔 會用於額外的規格層。 FHIR 設定檔 可讓您使用條件約束和延伸模組來縮小和自訂資源定義的範圍。

Azure API for FHIR 允許對設定檔驗證資源,以查看資源是否符合設定檔。 本文會引導您瞭解 FHIR 設定檔的基本概念,以及如何儲存這些設定檔。 如需本文外部 FHIR 設定檔的詳細資訊,請造訪 HL7.org

FHIR 設定檔:基本概念

設定檔會在以資源表示 StructureDefinition 的資源上設定其他內容。 定義 StructureDefinition 資源內容或資料類型的一組規則,例如資源擁有的專案,以及這些元素可以採用哪些值。

以下是設定檔如何修改基底資源的一些範例:

  • 限制基數:例如,您可以將元素上的基數上限設定為 0,這表示專案在特定內容中已排除。
  • 將專案的內容限制為單一固定值。
  • 定義資源的必要延伸模組。

StructureDefinition由其標準 URL 識別:http://hl7.org/fhir/StructureDefinition/{profile}

例如:

  • http://hl7.org/fhir/StructureDefinition/patient-birthPlace 是一種基底設定檔,需要病患註冊的生日資訊。
  • http://hl7.org/fhir/StructureDefinition/bmi 是另一個基底設定檔,定義如何代表 BMI) 觀察 (主體品質索引。
  • http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance 是一個 US Core 設定檔,可設定與病患相關聯的資源最低期望 AllergyIntolerance ,並識別延伸模組和值集等必要欄位。

當資源符合設定檔時,設定檔會在資源的 元素內 profile 指定。 您可以在下方看到「病患」資源開頭的範例,其中包含 http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient 設定檔。

{
  "resourceType" : "Patient",
  "id" : "ExamplePatient1",
  "meta" : {
    "lastUpdated" : "2020-10-30T09:48:01.8512764-04:00",
    "source" : "Organization/PayerOrganizationExample1",
    "profile" : [
      "http://hl7.org/fhir/us/carin-bb/StructureDefinition/C4BB-Patient"
    ]
  },

注意

設定檔必須建置在基底資源之上,且無法與基底資源衝突。 例如,如果元素的基數為 1..1,設定檔就無法讓它成為選擇性。

設定檔也會由各種實作指南 (IG) 指定。 以下列出一些常見的 IG。 如需詳細資訊,請造訪特定的 IG 網站,以深入瞭解 IG 及其內定義的設定檔:

注意

Azure API for FHIR 預設不會從實作指南儲存任何設定檔。 您必須將它們載入 Azure API for FHIR。

存取設定檔和儲存設定檔

儲存設定檔

若要將設定檔儲存在 Azure API for FHIR 中,您可以在 PUTStructureDefinition 要求的本文中使用設定檔內容。 更新或條件式更新都是將設定檔儲存在 FHIR 服務上的好方法。 如果您不確定要使用哪一項,請使用條件式更新。

標準 PUTPUT http://<your Azure API for FHIR base URL>/StructureDefinition/profile-id

or

條件式更新: PUT http://<your Azure API for FHIR base URL>/StructureDefinition?url=http://sample-profile-url

{ 
"resourceType" : "StructureDefinition",
"id" : "profile-id",
"url": "http://sample-profile-url"
	…
}

例如,如果您想要儲存 us-core-allergyintolerance 設定檔,您會在本文中使用下列 rest 命令搭配 US Core 檔案中的設定檔。 我們已針對此設定檔包含此設定檔的程式碼片段。

PUT https://myAzureAPIforFHIR.azurehealthcareapis.com/StructureDefinition?url=http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance
{
    "resourceType" : "StructureDefinition",
    "id" : "us-core-allergyintolerance",
    "text" : {
        "status" : "extensions"
    },
    "url" : "http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance",
    "version" : "3.1.1",
    "name" : "USCoreAllergyIntolerance",
    "title" : "US  Core AllergyIntolerance Profile",
    "status" : "active",
    "experimental" : false,
    "date" : "2020-06-29",
        "publisher" : "HL7 US Realm Steering Committee",
    "contact" : [
    {
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://www.healthit.gov"
        }
      ]
    }
  ],
    "description" : "Defines constraints and extensions on the AllergyIntolerance resource for the minimal set of data to query and retrieve allergy information.",

如需更多範例,請參閱開放原始碼網站上的 US Core 範例 REST 檔案 ,逐步解說儲存 US Core 設定檔。 若要取得最新的設定檔,您應該直接從 HL7 取得設定檔,以及定義這些設定檔的實作指南。

檢視設定檔

您可以使用要求存取現有的自訂設定檔 GETGET http://<your Azure API for FHIR base URL>/StructureDefinition?url={canonicalUrl} 其中 {canonicalUrl} 是設定檔的正式 URL。

例如,如果您想要檢視美國核心目標資源設定檔:

GET https://myworkspace-myfhirserver.fhir.azurehealthcareapis.com/StructureDefinition?url=http://hl7.org/fhir/us/core/StructureDefinition/us-core-goal

這會傳回 StructureDefinition 美國核心目標設定檔的資源,這會像這樣開始:

{
  "resourceType" : "StructureDefinition",
  "id" : "us-core-goal",
  "url" : "http://hl7.org/fhir/us/core/StructureDefinition/us-core-goal",
  "version" : "3.1.1",
  "name" : "USCoreGoalProfile",
  "title" : "US Core Goal Profile",
  "status" : "active",
  "experimental" : false,
  "date" : "2020-07-21",
  "publisher" : "HL7 US Realm Steering Committee",
  "contact" : [
    {
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://www.healthit.gov"
        }
      ]
    }
  ],
  "description" : "Defines constraints and extensions on the Goal resource for the minimal set of data to query and retrieve a patient's goal(s).",

}

注意

您只會看到您已載入 Azure API for FHIR 的設定檔。

Azure API for FHIR 不會傳回 StructureDefinition 基底設定檔的實例,但可以在 HL7 網站中找到這些實例,例如:

  • http://hl7.org/fhir/Observation.profile.json.html
  • http://hl7.org/fhir/Patient.profile.json.html

功能語句中的設定檔

列出 Capability Statement Azure API for FHIR 的所有可能行為。 Azure API for FHIR 會以下列形式更新功能語句,其中包含預存設定檔的詳細資料:

  • CapabilityStatement.rest.resource.profile
  • CapabilityStatement.rest.resource.supportedProfile

例如,如果您儲存了美國核心病患設定檔,就會像這樣開始:

{
  "resourceType": "StructureDefinition",
  "id": "us-core-patient",
  "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient",
  "version": "3.1.1",
  "name": "USCorePatientProfile",
  "title": "US Core Patient Profile",
  "status": "active",
  "experimental": false,
  "date": "2020-06-27",
  "publisher": "HL7 US Realm Steering Committee",

並傳送 GET 您的 metadata 要求:

GET http://<your Azure API for FHIR base URL>/metadata

您將使用 傳回 CapabilityStatement ,其中包含您上傳至 Azure API for FHIR 之 US Core 病患設定檔的下列資訊:

...
{
    "type": "Patient",
    "profile": "http://hl7.org/fhir/StructureDefinition/Patient",
    "supportedProfile":[
        "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
    ],

設定檔中的系結

術語服務是一組函式,可在醫療「術語」上執行作業,例如驗證程式代碼、翻譯程式碼、擴充值集等。Azure API for FHIR 服務不支援術語服務。 您可以在服務的 CapabilityStatement 中找到支援作業的資訊 ($) 、資源類型和互動。 基本 CRUD 作業和 Search (支援 Resource Types ValueSet、StructureDefinition 和 CodeSystem,如 CapabilityStatement) 中所定義,以及系統用於$validate。

ValueSets 可以包含一組複雜的規則和外部參考。 目前,服務只會考慮預先展開的內嵌程式碼。 客戶必須先將支援的 ValueSet 上傳至 FHIR 伺服器,才能使用$validate作業。 ValueSet 資源必須上傳至 FHIR 伺服器,使用 PUT 或條件式更新,如上面儲存設定檔一節所述。

下一步

在本文中,您已瞭解 FHIR 設定檔。 接下來,您將瞭解如何使用$validate來確保資源符合這些設定檔。

FHIR® 是 HL7 的注冊商標,並搭配 HL7 的許可權使用。