你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

在 Azure API for FHIR 中存储配置文件

HL7 Fast Healthcare 互操作性资源 (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 指定。 下面可以看到具有配置文件的“Patient”资源 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。

例如,如果要查看 US Core 目标资源配置文件:

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

这会返回 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

例如,如果保存 US Core Patient 配置文件,其开头如下所示:

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

metadata 发送 GET 请求:

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

将返回一个 CapabilityStatement ,其中包含已上传到 Azure API for FHIR 的美国核心患者配置文件的以下信息:

...
{
    "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 操作和搜索 (支持资源类型 ValueSet、StructureDefinition 和 CodeSystem(如 CapabilityStatement) 中定义),并且由系统利用以用于 $validate。

ValueSet 可以包含一组复杂的规则和外部引用。 目前,该服务将仅考虑预先扩展的内联代码。 客户在使用 $validate 操作之前,需要将受支持的 ValueSet 上传到 FHIR 服务器。 必须使用 PUT 或条件更新将 ValueSet 资源上传到 FHIR 服务器,如上面存储配置文件部分所述。

后续步骤

本文介绍了 FHIR 配置文件。 接下来,你将了解如何使用$validate来确保资源符合这些配置文件。

FHIR® 是 HL7 的注册商标,经 HL7 许可使用。