将去标识化操作元数据写入 FHIR 存储区

本页面介绍了如何对 DICOM 数据进行去标识化处理,并写入有关去标识化操作和已去标识化内容的 FHIR 存储区的元数据。元数据存储在 FHIR 存储区的 FHIR 来源资源中。然后,您可以使用 FHIR 自定义搜索查询数据,回答如下问题:

  • 去标识化的内容
  • 系统如何以及为什么要对数据进行去标识化处理?
  • 去标识化操作何时发生?需要多长时间?

须知事项

使用 FHIR 代替注解

Cloud Healthcare API 提供了一个 Annotations API,可用于为去标识化的数据添加注释

将去标识化操作元数据写入 FHIR 存储区的工作原理类似,具有以下优势:

  • 您不需要使用 Annotation API,它是一个独立的 API。
  • 您无需创建和管理注解存储区和注解记录。
  • 您可以继续使用 FHIR 标准和 Cloud Healthcare API FaHIR API。
  • 您可以将 FHIR 资源导出到 BigQuery 以用于探索和分析。生成的数据仅与 LOSSLESSANALYTICS_V2 SchemaType 兼容。
  • 并提供了有关去标识化操作元数据的更多信息。

使用要求

包含去标识化操作元数据的 FHIR 存储区必须满足以下要求:

  • 必须已存在。
  • 必须是版本 R4 FHIR 存储区。
  • 必须将 enableUpdateCreate 设置为 true

操作元数据 FHIR 存储区中的来源资源

运行 DICOM 去标识化操作时,以下出处资源会写入操作元数据 FHIR 存储区:

  • 汇总去标识化操作的来源资源,例如长时间运行的操作的名称、操作发生的时间以及使用的配置。如需查看此出处资源中的字段列表,请参阅对出处资源中的操作元数据进行去标识化处理

  • 每个已去标识化的 DICOM 实例的出处资源。如需查看此出处资源中的字段列表,请参阅出处资源中的 DICOM 去标识化元数据

    • 该资源包含去标识化内容(例如 DICOM 标记或 DICOM 图片部分)的相关信息以及已执行的操作(例如信息是否被隐去、转换或忽略)。
    • 资源可能包含由光学字符识别 (OCR) 处理的去标识化数据,这些数据在受保护健康信息 (PHI) 的范围内。

      去标识化文本(即 quote)附带其信息类型(即 infoType)以及找到该信息的可能性(即 confidence)。例如,如果包含内置文本 John Doe 的 DICOM 图片经过去标识化处理,则来源资源将包含设置为 John Doequote、设置为 PERSON_NAMEinfoType 和介于 0 到 1 之间的 confidence 值。

      只有在调用 dicomStores.deidentify 方法并将 ImageConfig.textRedactionMode 设置为 REDACT_SENSITIVE_TEXTREDACT_SENSITIVE_TEXT_CLEAN_DESCRIPTORS 时,系统才会生成 DICOM 去标识化元数据。

对来源资源中的操作元数据进行去标识化处理

下表显示了去标识化操作中的元数据以及可以在出处资源中找到的元数据中的相应字段。“出处资源字段”单元格包含用于演示的示例值。

元数据说明 出处资源字段
来源资源 ID Provenance.id
去标识化操作的开始时间 Provenance.occurredDateTime
来源资源创建时间戳 Provenance.recorded
去标识化长时间运行的操作的名称

    Provenance.agent.who: {
      "identifier": {
        "system": "https://g.co/healthcare/operation"
        "value": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID"
      }
    }
    
源 DICOM 存储区

    Provenance.entity.role: "SOURCE"
    Provenance.entity.what.identifier.value: "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/SOURCE_DICOM_STORE_ID"
    
目标 DICOM 存储区 Provenance.target.type.value
已使用 DeidentifyConfig

    Provenance.entity.extension: [{
      url: 'https://g.co/deidentify-config',
      valueString: 'DEIDENTIFY_CONFIG' // Can be either a JSON configuration or a path to a Cloud Storage URI and timestamp if the configuration was provided using Cloud Storage
    }]
    

出处资源中的 DICOM 去标识化元数据

下表显示了已去标识化的 DICOM 实例中元数据的说明,以及出处资源中元数据的相应字段。“出处资源字段”单元格包含用于演示的示例值。

元数据说明 出处资源字段
指向去标识化操作资源的链接 Provenance.agent.who: {reference: "Provenance/PROVENANCE_RESOURCE_ID"}
来源资源创建时间戳 Provenance.recorded
源 DICOM 实例 REST 路径

    Provenance.entity.role: SOURCE
    Provenance.entity.what.identifier.value
    
目标 DICOM 实例 REST 路径 Provenance.target.type.value
DICOM 图片大小

    Provenance.entity.extension: [
      {
        url: 'https://g.co/WIDTH',
        valueDecimal: WIDTH
      },
        url: 'https://g.co/HEIGHT',
        valueDecimal: HEIGHT
      }
    ]
    
结构化大小

    Provenance.entity.extension: [{
      url: 'https://g.co/DICOM_STRUCTURED_SIZE',
      valueDecimal: VALUE,
    }]
    
DICOM 图片注解

    Provenance.entity.extension: [{
      url: 'https://g.co/DICOM_IMAGES',
      extension: [
        { FRAME_0
        },
        { FRAME_1
        },
        ...
      ]
    }]
    
DICOM 帧注解

    Provenance.entity.extension['https://g.co/dicom-images'].extension: [
      {
        url: 'frame-index',
        valueDecimal: 0,
        extension: [
          {
            url: 'left',
            valueDecimal: LEFT_VALUE
          },
          {
            url: 'right',
            valueDecimal: RIGHT_VALUE
          },
          {
            url: 'top',
            valueDecimal: TOP_VALUE
          },
          {
            url: 'bottom',
            valueDecimal: BOTTOM_VALUE
          },
          {
            url: 'relative-left',
            valueDecimal: RELATIVE_LEFT_VALUE / WIDTH
          },
          {
            url: 'relative-right',
            valueDecimal: RELATIVE_RIGHT_VALUE / HEIGHT
          },
          {
            url: 'relative-top',
            valueDecimal: RELATIVE_TOP_VALUE / WIDTH
          },
          {
            url: 'relative-bottom',
            valueDecimal: RELATIVE_BOTTOM / HEIGHT
          }
        ]
      }
    ]
    
DICOM 帧注解

    // Only available if the text redaction mode is REDACT_SENSITIVE_TEXT or
    // REDACT_SENSITIVE_TEXT_CLEAN_DESCRIPTORS
    Provenance.entity.extension: [
       {
        "url": "quote", // The PHI text de-identified
        "valueString": "John Doe"
       },
      {
        "url": "infoType", // The type of the de-identified text
        "valueString": "PERSON_NAME"
       },
      {
        "url": "confidence", // The likelihood of finding this quote and its infoType
        "valueDecimal": 0.7
       }
    ]
    
所有 DICOM 标记注解

    Provenance.entity.extension: [{
      url: 'https://g.co/dicom-tags',
      extension: [
        { // tag (0002,0000)
        },
        { // tag (0002,0001)
        },
        ...
      ]
    }]
    
DICOM 单个标记表示法

    Provenance.entity.extension['https://g.co/dicom-tags'].extension: [
      {
        url: 'tag-id',
        valueString: '00080012',
        extension: [
          {
            url: 'byte-start',
            valueDecimal: 10
          },
          {
            url: 'byte-end',
            valueDecimal: 18
          },
          {
            url: 'finding-infotype',
            valueString: 'PERSON_NAME'
          },
          {
            url: 'text-original',
            valueString: 'John Doe'
          },
          {
            url: 'text-replaced',
            valueString: 'PERSON_NAME'
          },
          {
            url: 'deidentify-action',
            valueString: 'REMOVED'
            // Possible values are "REMOVED", "DELETED", "REGENERATED UID",
            // "RESET", "CLEANED", and "RECURSED"
          },
          {
            url: 'deidentify-reason',
            valueString: 'Matched VALUE'
            // Possible values include "ID", "VR", or "Expression",
            // for example "Matched ID: DICOM_TAG_ID"
          }
        ]
      }
    ]
    

示例

须知事项

在运行以下任何示例之前,请确保您对操作元数据 FHIR 存储区具有 roles/healthcare.fhirResourceEditor 角色。您需要此角色才能向操作元数据 FHIR 存储区写入数据。

对 DICOM 数据进行去标识化处理、写入 FHIR 存储区,以及搜索出处资源

在运行此示例之前,请完成以下步骤:

  1. 创建一个源数据集,其中包含 DICOM 存储区以及至少一个要去标识化的 DICOM 实例。
  2. 创建一个包含空 DICOM 存储区和空 FHIR 存储区的目标数据集。FHIR 存储区必须满足要求

以下示例对结合使用代码去标识化和内置文本隐去进行了扩展。在此示例中,去标识化发生在单个 DICOM 存储区中,去标识化数据写入新的 DICOM 存储区。 操作元数据 FHIR 存储区与新的 DICOM 存储区位于同一数据集中。

此示例使用两个 DICOM 实例。这些实例并未为您提供,因此示例响应不会与您的去标识化数据完全一致。

  1. 对 DICOM 数据进行去标识化处理。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:包含源 DICOM 存储区的数据集的位置
    • SOURCE_DATASET_ID:源 DICOM 存储区的父数据集
    • SOURCE_DICOM_STORE_ID:包含要去标识化的数据的 DICOM 存储区的 ID
    • DESTINATION_DATASET_ID:包含元数据操作 FHIR 存储区的现有数据集,并且将在其中创建去标识化 DICOM 存储区
    • DESTINATION_DICOM_STORE_ID: DICOM 存储区,其中将写入源 DICOM 存储区中的去标识化数据
    • OPERATION_METADATA_FHIR_STORE_ID:将写入去标识化操作元数据的 FHIR 存储区

    请求 JSON 正文:

    {
      "destinationStore": "projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/dicomStores/DESTINATION_DICOM_STORE_ID",
      "config": {
        "dicom": {
          "filterProfile": "DEIDENTIFY_TAG_CONTENTS"
        },
        "image": {
          "textRedactionMode": "REDACT_ALL_TEXT"
        },
        "operationMetadata": {
          "fhirOutput": {
            "fhirStore": "projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE"
          }
        }
      }
    }
    

    如需发送请求,请选择以下方式之一:

    curl

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    cat > request.json << 'EOF'
    {
      "destinationStore": "projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/dicomStores/DESTINATION_DICOM_STORE_ID",
      "config": {
        "dicom": {
          "filterProfile": "DEIDENTIFY_TAG_CONTENTS"
        },
        "image": {
          "textRedactionMode": "REDACT_ALL_TEXT"
        },
        "operationMetadata": {
          "fhirOutput": {
            "fhirStore": "projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE"
          }
        }
      }
    }
    EOF

    然后,执行以下命令以发送 REST 请求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/dicomStores/SOURCE_DICOM_STORE_ID:deidentify"

    PowerShell

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    @'
    {
      "destinationStore": "projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/dicomStores/DESTINATION_DICOM_STORE_ID",
      "config": {
        "dicom": {
          "filterProfile": "DEIDENTIFY_TAG_CONTENTS"
        },
        "image": {
          "textRedactionMode": "REDACT_ALL_TEXT"
        },
        "operationMetadata": {
          "fhirOutput": {
            "fhirStore": "projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE"
          }
        }
      }
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    然后,执行以下命令以发送 REST 请求:

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

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/SOURCE_DATASET_ID/dicomStores/SOURCE_DICOM_STORE_ID:deidentify" | Select-Object -Expand Content
    响应如下所示。响应中包含长时间运行的操作的标识符。如果方法调用可能需要大量时间才能完成,系统就会返回长时间运行的操作。请注意 OPERATION_ID 的值。下一步中需要用到此值。

  2. 获取操作的状态。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:数据集的位置
    • SOURCE_DATASET_ID:正在执行去标识化操作的数据集
    • OPERATION_ID:去标识化操作的 ID

    如需发送请求,请选择以下方式之一:

    curl

    执行以下命令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID"

    PowerShell

    执行以下命令:

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

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content

    API Explorer

    打开方法参考页面。API Explorer 面板会在页面右侧打开。您可以与此工具进行交互以发送请求。填写所有必填字段,然后点击执行

    您应该收到类似以下内容的 JSON 响应:

  3. 成功对 DICOM 数据进行去标识化处理并将操作元数据写入 FHIR 存储区后,您可以查看 FHIR 存储区中的出处资源。

    如需查看出处资源,请使用 fhir.search 方法。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    如需发送请求,请选择以下方式之一:

    curl

    执行以下命令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance"

    PowerShell

    执行以下命令:

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

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DESTINATION_DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance" | Select-Object -Expand Content
    以下响应是对两个 DICOM 实例进行去标识化处理的结果。去标识化操作导致创建了以下三个来源资源:
    • 两个 DICOM 实例分别对应一个来源资源
    • 用于去标识化操作的一个出处资源

存储样本数据,创建相对 x 坐标自定义 FHIR 搜索,并查询

在运行此示例之前,请创建一个包含空 DICOM 存储区和空 FHIR 存储区的目标数据集。FHIR 存储区必须满足要求

以下示例展示了如何存储对 DICOM 数据进行去标识化处理、写入 FHIR 存储区和搜索出处资源中创建的三个出处资源,然后创建自定义搜索。自定义搜索查询会在其中一个去标识化的 DICOM 实例中查询 relative-x-coordinate-bottom-left

  1. 存储来源资源。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    请求 JSON 正文:

    {
      "resourceType": "Bundle",
      "type": "transaction",
      "entry": [
        {
          "request": {"method": "PUT", "url": "Provenance/operation-123"},
          "resource": {
            "resourceType": "Provenance",
            "id": "operation-123",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store"
                }
              }
            ],
            "occurredDateTime": "2010-11-08T08:30:00-04:00",
            "recorded": "2010-11-08T08:30:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "system": "https://g.co/healthcare/operation",
                    "value": "projects/my-project/locations/us-central1/datasets/my-dataset/operations/123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store"
                  }
                }
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0,
                        "extension": [
                          {
                            "url": "bottom",
                            "valueDecimal": 100
                          },
                          {
                            "url": "left",
                            "valueDecimal": 100
                          },
                          {
                            "url": "right",
                            "valueDecimal": 200
                          },
                          {
                            "url": "top",
                            "valueDecimal": 200
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "bottom",
                            "valueDecimal": 900
                          },
                          {
                            "url": "left",
                            "valueDecimal": 900
                          },
                          {
                            "url": "right",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "top",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.5
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.5
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00100021",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 10
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 18
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "text-original",
                            "valueString": "John Doe"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "byte-start",
                            "valueDecimal": 25
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 35
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "DATE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1900-12-31"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "DATE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00102150",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "LOCATION"
                          },
                          {
                            "url": "text-original",
                            "valueString": "US"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "LOCATION"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:25-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0
                      },
                      {
                        "url": "frame-index",
                        "valueDecimal": 1,
                        "extension": [
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00101010",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "AGE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "30"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "AGE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00100020",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 4
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "GENERIC_ID"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1234"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "GENERIC_ID"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        }
      ]
    }
    

    如需发送请求,请选择以下方式之一:

    curl

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    cat > request.json << 'EOF'
    {
      "resourceType": "Bundle",
      "type": "transaction",
      "entry": [
        {
          "request": {"method": "PUT", "url": "Provenance/operation-123"},
          "resource": {
            "resourceType": "Provenance",
            "id": "operation-123",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store"
                }
              }
            ],
            "occurredDateTime": "2010-11-08T08:30:00-04:00",
            "recorded": "2010-11-08T08:30:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "system": "https://g.co/healthcare/operation",
                    "value": "projects/my-project/locations/us-central1/datasets/my-dataset/operations/123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store"
                  }
                }
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0,
                        "extension": [
                          {
                            "url": "bottom",
                            "valueDecimal": 100
                          },
                          {
                            "url": "left",
                            "valueDecimal": 100
                          },
                          {
                            "url": "right",
                            "valueDecimal": 200
                          },
                          {
                            "url": "top",
                            "valueDecimal": 200
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "bottom",
                            "valueDecimal": 900
                          },
                          {
                            "url": "left",
                            "valueDecimal": 900
                          },
                          {
                            "url": "right",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "top",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.5
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.5
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00100021",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 10
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 18
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "text-original",
                            "valueString": "John Doe"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "byte-start",
                            "valueDecimal": 25
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 35
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "DATE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1900-12-31"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "DATE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00102150",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "LOCATION"
                          },
                          {
                            "url": "text-original",
                            "valueString": "US"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "LOCATION"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:25-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0
                      },
                      {
                        "url": "frame-index",
                        "valueDecimal": 1,
                        "extension": [
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00101010",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "AGE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "30"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "AGE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00100020",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 4
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "GENERIC_ID"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1234"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "GENERIC_ID"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        }
      ]
    }
    EOF

    然后,执行以下命令以发送 REST 请求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/fhir+json" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir"

    PowerShell

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    @'
    {
      "resourceType": "Bundle",
      "type": "transaction",
      "entry": [
        {
          "request": {"method": "PUT", "url": "Provenance/operation-123"},
          "resource": {
            "resourceType": "Provenance",
            "id": "operation-123",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store"
                }
              }
            ],
            "occurredDateTime": "2010-11-08T08:30:00-04:00",
            "recorded": "2010-11-08T08:30:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "system": "https://g.co/healthcare/operation",
                    "value": "projects/my-project/locations/us-central1/datasets/my-dataset/operations/123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store"
                  }
                }
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0,
                        "extension": [
                          {
                            "url": "bottom",
                            "valueDecimal": 100
                          },
                          {
                            "url": "left",
                            "valueDecimal": 100
                          },
                          {
                            "url": "right",
                            "valueDecimal": 200
                          },
                          {
                            "url": "top",
                            "valueDecimal": 200
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "bottom",
                            "valueDecimal": 900
                          },
                          {
                            "url": "left",
                            "valueDecimal": 900
                          },
                          {
                            "url": "right",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "top",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.5
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.5
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00100021",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 10
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 18
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "text-original",
                            "valueString": "John Doe"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "byte-start",
                            "valueDecimal": 25
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 35
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "DATE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1900-12-31"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "DATE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00102150",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "LOCATION"
                          },
                          {
                            "url": "text-original",
                            "valueString": "US"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "LOCATION"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:25-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0
                      },
                      {
                        "url": "frame-index",
                        "valueDecimal": 1,
                        "extension": [
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00101010",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "AGE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "30"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "AGE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00100020",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 4
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "GENERIC_ID"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1234"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "GENERIC_ID"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        }
      ]
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    然后,执行以下命令以发送 REST 请求:

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

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/fhir+json" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir" | Select-Object -Expand Content

    您应该收到类似以下内容的 JSON 响应:

  2. 基于 DICOM 图片的相对 x 坐标创建 SearchParameter 资源。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    请求 JSON 正文:

    {
      "resourceType": "SearchParameter",
      "url": "relative-x-coordinate-bottom-left",
      "base": ["Provenance"],
      "code": "relative-x-coordinate-bottom-left",
      "name": "relative x-coordinate of the bottom left corner of the bounding box",
      "type": "number",
      "expression": "Provenance.entity.extension('https://g.co/dicom-images').extension('frame-index').extension('relative-bottom').value.as(Decimal)",
      "status": "active",
      "description": "A search on bottom left relative x-coordinate of annotations generated from de-identification of a DICOM file"
    }
    

    如需发送请求,请选择以下方式之一:

    curl

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    cat > request.json << 'EOF'
    {
      "resourceType": "SearchParameter",
      "url": "relative-x-coordinate-bottom-left",
      "base": ["Provenance"],
      "code": "relative-x-coordinate-bottom-left",
      "name": "relative x-coordinate of the bottom left corner of the bounding box",
      "type": "number",
      "expression": "Provenance.entity.extension('https://g.co/dicom-images').extension('frame-index').extension('relative-bottom').value.as(Decimal)",
      "status": "active",
      "description": "A search on bottom left relative x-coordinate of annotations generated from de-identification of a DICOM file"
    }
    EOF

    然后,执行以下命令以发送 REST 请求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/fhir+json" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/SearchParameter"

    PowerShell

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    @'
    {
      "resourceType": "SearchParameter",
      "url": "relative-x-coordinate-bottom-left",
      "base": ["Provenance"],
      "code": "relative-x-coordinate-bottom-left",
      "name": "relative x-coordinate of the bottom left corner of the bounding box",
      "type": "number",
      "expression": "Provenance.entity.extension('https://g.co/dicom-images').extension('frame-index').extension('relative-bottom').value.as(Decimal)",
      "status": "active",
      "description": "A search on bottom left relative x-coordinate of annotations generated from de-identification of a DICOM file"
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    然后,执行以下命令以发送 REST 请求:

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

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/fhir+json" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/SearchParameter" | Select-Object -Expand Content

    您应该收到类似以下内容的 JSON 响应:

  3. 在 FHIR 存储区上启用自定义 SearchParameter 资源。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    请求 JSON 正文:

    {
      "canonicalUrls": [
        "relative-x-coordinate-bottom-left"
      ]
    }
    

    如需发送请求,请选择以下方式之一:

    curl

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    cat > request.json << 'EOF'
    {
      "canonicalUrls": [
        "relative-x-coordinate-bottom-left"
      ]
    }
    EOF

    然后,执行以下命令以发送 REST 请求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/fhir+json" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID:configureSearch"

    PowerShell

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    @'
    {
      "canonicalUrls": [
        "relative-x-coordinate-bottom-left"
      ]
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    然后,执行以下命令以发送 REST 请求:

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

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/fhir+json" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID:configureSearch" | Select-Object -Expand Content
    响应如下所示。响应中包含长时间运行的操作的标识符。如果方法调用可能需要大量时间才能完成,系统就会返回长时间运行的操作。请注意 OPERATION_ID 的值。下一步中需要用到此值。

  4. 获取操作的状态。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:数据集的位置
    • DATASET_ID:正在运行自定义搜索操作的数据集
    • OPERATION_ID:自定义搜索操作的 ID

    如需发送请求,请选择以下方式之一:

    curl

    执行以下命令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID"

    PowerShell

    执行以下命令:

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

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content

    API Explorer

    打开方法参考页面。API Explorer 面板会在页面右侧打开。您可以与此工具进行交互以发送请求。填写所有必填字段,然后点击执行

    您应该收到类似以下内容的 JSON 响应:

  5. 使用相对的 x 坐标搜索参数查询出处资源:

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    如需发送请求,请选择以下方式之一:

    curl


    以下示例使用了 relative-x-coordinate-bottom-left=le0.05 查询,该查询搜索距离图片边缘 5% 范围内的 x 坐标。

    执行以下命令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance?relative-x-coordinate-bottom-left=le0.05"

    PowerShell


    以下示例使用了 relative-x-coordinate-bottom-left=le0.05 查询,该查询搜索距离图片边缘 5% 范围内的 x 坐标。

    执行以下命令:

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

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance?relative-x-coordinate-bottom-left=le0.05" | Select-Object -Expand Content
    响应显示会返回一个符合搜索查询条件的 DICOM 实例:
    {
      "entry": [
        {
          "fullUrl": "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance/90062087-8ac2-499c-b952-a04999578bd0",
          "resource": {
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "extension": [
                  {
                    "extension": [
                      {
                        "extension": [
                          {
                            "url": "bottom",
                            "valueDecimal": 100
                          },
                          {
                            "url": "left",
                            "valueDecimal": 100
                          },
                          {
                            "url": "right",
                            "valueDecimal": 200
                          },
                          {
                            "url": "top",
                            "valueDecimal": 200
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "bottom",
                            "valueDecimal": 900
                          },
                          {
                            "url": "left",
                            "valueDecimal": 900
                          },
                          {
                            "url": "right",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "top",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.5
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.5
                          }
                        ],
                        "url": "frame-index",
                        "valueDecimal": 0
                      }
                    ],
                    "url": "https://g.co/dicom-images"
                  },
                  {
                    "extension": [
                      {
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 10
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 18
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "text-original",
                            "valueString": "John Doe"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "byte-start",
                            "valueDecimal": 25
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 35
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "DATE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1900-12-31"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "DATE"
                          }
                        ],
                        "url": "tag-id",
                        "valueString": "00100021"
                      },
                      {
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "LOCATION"
                          },
                          {
                            "url": "text-original",
                            "valueString": "US"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "LOCATION"
                          }
                        ],
                        "url": "tag-id",
                        "valueString": "00102150"
                      }
                    ],
                    "url": "https://g.co/dicom-tags"
                  }
                ],
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                  }
                }
              }
            ],
            "id": "90062087-8ac2-499c-b952-a04999578bd0",
            "meta": {
              "lastUpdated": "LAST_UPDATED",
              "versionId": "MTY0NjY4NDg4Nzk3MDM2MTAwMA"
            },
            "recorded": "2010-11-08T08:39:24-04:00",
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                }
              }
            ]
          },
          "search": {
            "mode": "match"
          }
        }
      ],
      "link": [
        {
          "relation": "search",
          "url": "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance/?relative-x-coordinate-bottom-left=le0.05"
        },
        {
          "relation": "first",
          "url": "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance/?relative-x-coordinate-bottom-left=le0.05"
        },
        {
          "relation": "self",
          "url": "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance/?relative-x-coordinate-bottom-left=le0.05"
        }
      ],
      "resourceType": "Bundle",
      "total": 1,
      "type": "searchset"
    }
    

存储示例数据、创建源 DICOM 自定义 FHIR 搜索并查询

在运行此示例之前,请创建一个包含空 DICOM 存储区和空 FHIR 存储区的目标数据集。FHIR 存储区必须满足要求

以下示例展示了如何存储对 DICOM 数据进行去标识化处理、写入 FHIR 存储区和搜索出处资源中创建的三个出处资源,然后创建自定义搜索。自定义搜索查询用于查询两个源 DICOM 图片中其中一个的相关信息。

  1. 存储来源资源。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    请求 JSON 正文:

    {
      "resourceType": "Bundle",
      "type": "transaction",
      "entry": [
        {
          "request": {"method": "PUT", "url": "Provenance/operation-123"},
          "resource": {
            "resourceType": "Provenance",
            "id": "operation-123",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store"
                }
              }
            ],
            "occurredDateTime": "2010-11-08T08:30:00-04:00",
            "recorded": "2010-11-08T08:30:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "system": "https://g.co/healthcare/operation",
                    "value": "projects/my-project/locations/us-central1/datasets/my-dataset/operations/123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store"
                  }
                }
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0,
                        "extension": [
                          {
                            "url": "bottom",
                            "valueDecimal": 100
                          },
                          {
                            "url": "left",
                            "valueDecimal": 100
                          },
                          {
                            "url": "right",
                            "valueDecimal": 200
                          },
                          {
                            "url": "top",
                            "valueDecimal": 200
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "bottom",
                            "valueDecimal": 900
                          },
                          {
                            "url": "left",
                            "valueDecimal": 900
                          },
                          {
                            "url": "right",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "top",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.5
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.5
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00100021",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 10
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 18
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "text-original",
                            "valueString": "John Doe"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "byte-start",
                            "valueDecimal": 25
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 35
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "DATE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1900-12-31"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "DATE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00102150",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "LOCATION"
                          },
                          {
                            "url": "text-original",
                            "valueString": "US"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "LOCATION"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:25-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0
                      },
                      {
                        "url": "frame-index",
                        "valueDecimal": 1,
                        "extension": [
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00101010",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "AGE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "30"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "AGE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00100020",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 4
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "GENERIC_ID"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1234"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "GENERIC_ID"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        }
      ]
    }
    

    如需发送请求,请选择以下方式之一:

    curl

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    cat > request.json << 'EOF'
    {
      "resourceType": "Bundle",
      "type": "transaction",
      "entry": [
        {
          "request": {"method": "PUT", "url": "Provenance/operation-123"},
          "resource": {
            "resourceType": "Provenance",
            "id": "operation-123",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store"
                }
              }
            ],
            "occurredDateTime": "2010-11-08T08:30:00-04:00",
            "recorded": "2010-11-08T08:30:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "system": "https://g.co/healthcare/operation",
                    "value": "projects/my-project/locations/us-central1/datasets/my-dataset/operations/123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store"
                  }
                }
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0,
                        "extension": [
                          {
                            "url": "bottom",
                            "valueDecimal": 100
                          },
                          {
                            "url": "left",
                            "valueDecimal": 100
                          },
                          {
                            "url": "right",
                            "valueDecimal": 200
                          },
                          {
                            "url": "top",
                            "valueDecimal": 200
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "bottom",
                            "valueDecimal": 900
                          },
                          {
                            "url": "left",
                            "valueDecimal": 900
                          },
                          {
                            "url": "right",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "top",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.5
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.5
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00100021",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 10
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 18
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "text-original",
                            "valueString": "John Doe"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "byte-start",
                            "valueDecimal": 25
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 35
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "DATE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1900-12-31"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "DATE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00102150",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "LOCATION"
                          },
                          {
                            "url": "text-original",
                            "valueString": "US"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "LOCATION"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:25-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0
                      },
                      {
                        "url": "frame-index",
                        "valueDecimal": 1,
                        "extension": [
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00101010",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "AGE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "30"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "AGE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00100020",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 4
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "GENERIC_ID"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1234"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "GENERIC_ID"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        }
      ]
    }
    EOF

    然后,执行以下命令以发送 REST 请求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/fhir+json" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir"

    PowerShell

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    @'
    {
      "resourceType": "Bundle",
      "type": "transaction",
      "entry": [
        {
          "request": {"method": "PUT", "url": "Provenance/operation-123"},
          "resource": {
            "resourceType": "Provenance",
            "id": "operation-123",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store"
                }
              }
            ],
            "occurredDateTime": "2010-11-08T08:30:00-04:00",
            "recorded": "2010-11-08T08:30:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "system": "https://g.co/healthcare/operation",
                    "value": "projects/my-project/locations/us-central1/datasets/my-dataset/operations/123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store"
                  }
                }
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:24-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/3"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0,
                        "extension": [
                          {
                            "url": "bottom",
                            "valueDecimal": 100
                          },
                          {
                            "url": "left",
                            "valueDecimal": 100
                          },
                          {
                            "url": "right",
                            "valueDecimal": 200
                          },
                          {
                            "url": "top",
                            "valueDecimal": 200
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.05
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.1
                          },
                          {
                            "url": "bottom",
                            "valueDecimal": 900
                          },
                          {
                            "url": "left",
                            "valueDecimal": 900
                          },
                          {
                            "url": "right",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "top",
                            "valueDecimal": 1000
                          },
                          {
                            "url": "relative-bottom",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-left",
                            "valueDecimal": 0.45
                          },
                          {
                            "url": "relative-right",
                            "valueDecimal": 0.5
                          },
                          {
                            "url": "relative-top",
                            "valueDecimal": 0.5
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00100021",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 10
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 18
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "text-original",
                            "valueString": "John Doe"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "PERSON_NAME"
                          },
                          {
                            "url": "byte-start",
                            "valueDecimal": 25
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 35
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "DATE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1900-12-31"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "DATE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00102150",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "LOCATION"
                          },
                          {
                            "url": "text-original",
                            "valueString": "US"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "LOCATION"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        },
        {
          "request": {"method": "POST", "url": "Provenance"},
          "resource": {
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                }
              }
            ],
            "recorded": "2010-11-08T08:39:25-04:00",
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                  }
                },
                "extension": [
                  {
                    "url": "https://g.co/dicom-images",
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0
                      },
                      {
                        "url": "frame-index",
                        "valueDecimal": 1,
                        "extension": [
                        ]
                      }
                    ]
                  },
                  {
                    "url": "https://g.co/dicom-tags",
                    "extension": [
                      {
                        "url": "tag-id",
                        "valueString": "00101010",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "AGE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "30"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "AGE"
                          }
                        ]
                      },
                      {
                        "url": "tag-id",
                        "valueString": "00100020",
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 4
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "GENERIC_ID"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1234"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "GENERIC_ID"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        }
      ]
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    然后,执行以下命令以发送 REST 请求:

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

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/fhir+json" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir" | Select-Object -Expand Content

    您应该收到类似以下内容的 JSON 响应:

  2. 在源 DICOM 图片上创建 SearchParameter 资源。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    请求 JSON 正文:

    {
      "resourceType": "SearchParameter",
      "url": "lookup-source-instance",
      "base": ["Provenance"],
      "code": "lookup-source-instance",
      "name": "look up the source DICOM instance",
      "type": "string",
      "expression": "Provenance.entity.what.identifier.value",
      "status": "active",
      "description": "A search on the source DICOM instance"
    }
    

    如需发送请求,请选择以下方式之一:

    curl

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    cat > request.json << 'EOF'
    {
      "resourceType": "SearchParameter",
      "url": "lookup-source-instance",
      "base": ["Provenance"],
      "code": "lookup-source-instance",
      "name": "look up the source DICOM instance",
      "type": "string",
      "expression": "Provenance.entity.what.identifier.value",
      "status": "active",
      "description": "A search on the source DICOM instance"
    }
    EOF

    然后,执行以下命令以发送 REST 请求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/fhir+json" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/SearchParameter"

    PowerShell

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    @'
    {
      "resourceType": "SearchParameter",
      "url": "lookup-source-instance",
      "base": ["Provenance"],
      "code": "lookup-source-instance",
      "name": "look up the source DICOM instance",
      "type": "string",
      "expression": "Provenance.entity.what.identifier.value",
      "status": "active",
      "description": "A search on the source DICOM instance"
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    然后,执行以下命令以发送 REST 请求:

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

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/fhir+json" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/SearchParameter" | Select-Object -Expand Content

    您应该收到类似以下内容的 JSON 响应:

  3. 在 FHIR 存储区上启用自定义 SearchParameter 资源。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    请求 JSON 正文:

    {
      "canonicalUrls": [
        "lookup-source-instance"
      ]
    }
    

    如需发送请求,请选择以下方式之一:

    curl

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    cat > request.json << 'EOF'
    {
      "canonicalUrls": [
        "lookup-source-instance"
      ]
    }
    EOF

    然后,执行以下命令以发送 REST 请求:

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/fhir+json" \
    -d @request.json \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID:configureSearch"

    PowerShell

    将请求正文保存在名为 request.json 的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:

    @'
    {
      "canonicalUrls": [
        "lookup-source-instance"
      ]
    }
    '@  | Out-File -FilePath request.json -Encoding utf8

    然后,执行以下命令以发送 REST 请求:

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

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/fhir+json" `
    -InFile request.json `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID:configureSearch" | Select-Object -Expand Content
    响应如下所示。响应中包含长时间运行的操作的标识符。如果方法调用可能需要大量时间才能完成,系统就会返回长时间运行的操作。请注意 OPERATION_ID 的值。下一步中需要用到此值。

  4. 获取操作的状态。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:数据集的位置
    • DATASET_ID:正在运行自定义搜索操作的数据集
    • OPERATION_ID:自定义搜索操作的 ID

    如需发送请求,请选择以下方式之一:

    curl

    执行以下命令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID"

    PowerShell

    执行以下命令:

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

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID" | Select-Object -Expand Content

    API Explorer

    打开方法参考页面。API Explorer 面板会在页面右侧打开。您可以与此工具进行交互以发送请求。填写所有必填字段,然后点击执行

    您应该收到类似以下内容的 JSON 响应:

  5. 使用源 DICOM 图片搜索参数查询出处资源。

    在使用任何请求数据之前,请先进行以下替换:

    • PROJECT_ID:您的 Google Cloud 项目 ID
    • LOCATION:父级数据集的位置
    • DATASET_ID:FHIR 存储区的父数据集
    • OPERATION_METADATA_FHIR_STORE_ID:包含元数据的 FHIR 存储区的 ID

    如需发送请求,请选择以下方式之一:

    curl


    以下示例使用了 lookup-source-instance:contains=studies/1/series/2/instances/4 查询,该查询会返回标识符中包含 studies/1/series/2/instances/4 的实例的相关信息。

    执行以下命令:

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance?lookup-source-instance:contains=studies/1/series/2/instances/4"

    PowerShell


    以下示例使用了 lookup-source-instance:contains=studies/1/series/2/instances/4 查询,该查询会返回标识符中包含 studies/1/series/2/instances/4 的实例的相关信息。

    执行以下命令:

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

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance?lookup-source-instance:contains=studies/1/series/2/instances/4" | Select-Object -Expand Content
    响应显示会返回一个符合搜索查询条件的 DICOM 实例:
    {
      "entry": [
        {
          "fullUrl": "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance/d82007a1-6481-4793-b17c-ae152051ee9f",
          "resource": {
            "agent": [
              {
                "who": {
                  "identifier": {
                    "value": "projects/test-project/locations/us-central1/datasets/test-dataset/fhirStores/test-fhir-store/fhir/Provenance/operation-123"
                  }
                }
              }
            ],
            "entity": [
              {
                "extension": [
                  {
                    "extension": [
                      {
                        "url": "frame-index",
                        "valueDecimal": 0
                      },
                      {
                        "url": "frame-index",
                        "valueDecimal": 1
                      }
                    ],
                    "url": "https://g.co/dicom-images"
                  },
                  {
                    "extension": [
                      {
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 2
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "AGE"
                          },
                          {
                            "url": "text-original",
                            "valueString": "30"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "AGE"
                          }
                        ],
                        "url": "tag-id",
                        "valueString": "00101010"
                      },
                      {
                        "extension": [
                          {
                            "url": "byte-start",
                            "valueDecimal": 0
                          },
                          {
                            "url": "byte-end",
                            "valueDecimal": 4
                          },
                          {
                            "url": "finding-infotype",
                            "valueString": "GENERIC_ID"
                          },
                          {
                            "url": "text-original",
                            "valueString": "1234"
                          },
                          {
                            "url": "text-replaced",
                            "valueString": "GENERIC_ID"
                          }
                        ],
                        "url": "tag-id",
                        "valueString": "00100020"
                      }
                    ],
                    "url": "https://g.co/dicom-tags"
                  }
                ],
                "role": "source",
                "what": {
                  "identifier": {
                    "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/test-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                  }
                }
              }
            ],
            "id": "d82007a1-6481-4793-b17c-ae152051ee9f",
            "meta": {
              "lastUpdated": "2022-03-07T20:28:07.970361+00:00",
              "versionId": "MTY0NjY4NDg4Nzk3MDM2MTAwMA"
            },
            "recorded": "2010-11-08T08:39:25-04:00",
            "resourceType": "Provenance",
            "target": [
              {
                "identifier": {
                  "value": "https://healthcare.googleapis.com/projects/test-project/locations/us-central1/datasets/test-dataset/dicomStores/deid-dicom-store/dicomWeb/studies/1/series/2/instances/4"
                }
              }
            ]
          },
          "search": {
            "mode": "match"
          }
        }
      ],
      "link": [
        {
          "relation": "search",
          "url": "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance/?lookup-source-instance%3Acontains=studies%2F1%2Fseries%2F2%2Finstances%2F4"
        },
        {
          "relation": "first",
          "url": "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance/?lookup-source-instance%3Acontains=studies%2F1%2Fseries%2F2%2Finstances%2F4"
        },
        {
          "relation": "self",
          "url": "https://healthcare.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/OPERATION_METADATA_FHIR_STORE_ID/fhir/Provenance/?lookup-source-instance%3Acontains=studies%2F1%2Fseries%2F2%2Finstances%2F4"
        }
      ],
      "resourceType": "Bundle",
      "total": 1,
      "type": "searchset"
    }
    

导出和查询操作元数据 FHIR 存储区

以下示例展示了如何将 FHIR 存储区中的去标识化操作元数据导出到 BigQuery,并查询导出的数据以查找由 OCR 处理的 PHI 数据。生成的数据仅与 LOSSLESSANALYTICS_V2 SchemaType 兼容。

  1. 将 FHIR 存储区中的元数据导出到 BigQuery 数据集

    元数据会导出到所选 BigQuery 数据集中名为 Provenance 的表。

  2. 转到 BigQuery 页面。

    转到 BigQuery

  3. 探索器窗格中,完成以下步骤:

    1. 选择您的 Google Cloud 项目。
    2. 选择您导出 DICOM 元数据的 BigQuery 数据集。
    3. 选择出处表。
  4. 点击 编写新查询

  5. 请运行以下查询:

    SELECT
      what.identifier.value AS Source,
      target[OFFSET(0)].identifier.value AS Destination,
      `left` AS `Left`,
      `right` AS `Right`,
      top AS Top,
      bottom AS Bottom,
      quote AS Quote,
      infoType AS InfoType,
      confidence AS Confidence
    FROM
      `PROJECT_ID.BIGQUERY_DATASET.Provenance`, UNNEST(entity), UNNEST(dicom_images), UNNEST(frame_index)
    LIMIT
      10
    

    请替换以下内容:

    • PROJECT_ID:您的 Google Cloud 项目的 ID
    • BIGQUERY_DATASET:您从 FHIR 存储区导出元数据的 BigQuery 数据集
  6. 点击 运行

    查询结果以表格格式显示去标识化 PHI 数据的元数据。如果您未指定目标表,查询作业会将输出写入临时(缓存)表。

配额

将去标识化操作元数据写入 FHIR 存储区会占用写入操作元数据的项目中的 fhir_ops 配额。 系统会为每个 DICOM 实例创建一个 FHIR 资源,因此去标识化操作的吞吐量不能高于 FHIR 配额允许的上限。

结算

在操作元数据 FHIR 存储区中创建的每个来源资源都会因调用 fhir.update 而产生费用。对 fhir.update 的 API 调用次数可以按以下公式计算:Total number of DICOM instances de-identified + 1

后续步骤