Write de-identify operation metadata to a FHIR store

This page explains how to de-identify DICOM data and write metadata about the de-identify operation and what was de-identified to a FHIR store. The metadata is stored in FHIR Provenance resources in the FHIR store. You can then query the data using FHIR custom searches to answer questions like the following:

  • What was de-identified?
  • How and why was the data de-identified?
  • When did the de-identify operation occur, and how long did it take?

Before you begin

Using FHIR instead of annotations

The Cloud Healthcare API offers an annotations API which you can use to annotate de-identified data.

Writing de-identify operation metadata to a FHIR store works similarly, and has the following advantages:

  • You don't need to use the annotations API, which is a separate API.
  • You don't need to create and manage annotation stores and annotation records.
  • You can continue to work with the FHIR standard and the Cloud Healthcare API FHIR API.
  • You can export the FHIR resources to BigQuery for exploration and analysis. The generated data is only compatible with the LOSSLESS or ANALYTICS_V2 SchemaType.
  • More information is provided about the de-identify operation metadata.

Requirements

The FHIR store that holds the de-identify operation metadata must meet the following requirements:

Provenance resources in the operation metadata FHIR store

When you run a DICOM de-identify operation, the following Provenance resources are written to the operation metadata FHIR store:

  • A Provenance resource that summarizes the de-identify operation, such as the name of the long-running operation, when the operation occurred, and what configuration was used. For a list of fields in this Provenance resource, see De-identify operation metadata in a Provenance resource.

  • A Provenance resource for each DICOM instance that was de-identified. For a list of fields in this Provenance resource, see DICOM de-identification metadata in a Provenance resource.

    • The resource contains information about what was de-identified, such as a DICOM tag or the portion of a DICOM image, and the actions that were taken, such as whether the information was redacted, transformed, or ignored.
    • The resource might contain de-identified data processed by optical character recognition (OCR) that falls within the scope of protected health information (PHI).

      The de-identified text, or quote, is accompanied with its information type, or infoType and the likelihood of finding the information, or confidence. For example, if a DICOM image containing the burnt-in text John Doe is de-identified, the Provenance resource will contain quote set to John Doe, infoType set to PERSON_NAME, and a confidence value between 0 and 1.

      The DICOM de-identification metadata is only generated if the dicomStores.deidentify method is called with ImageConfig.textRedactionMode set to REDACT_SENSITIVE_TEXT or REDACT_SENSITIVE_TEXT_CLEAN_DESCRIPTORS.

De-identify operation metadata in a Provenance resource

The following table shows a description of the metadata in the de-identify operation and the corresponding field in the metadata where it can be found in the Provenance resource. The "Provenance resource field" cells contain sample values which are for demonstration purposes.

Metadata description Provenance resource field
Provenance resource ID Provenance.id
When the de-identify operation began Provenance.occurredDateTime
Provenance resource creation timestamp Provenance.recorded
Name of de-identification long-running operation
    Provenance.agent.who: {
      "identifier": {
        "system": "https://g.co/healthcare/operation"
        "value": "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID"
      }
    }
    
Source DICOM store
    Provenance.entity.role: "SOURCE"
    Provenance.entity.what.identifier.value: "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/SOURCE_DICOM_STORE_ID"
    
Destination DICOM store Provenance.target.type.value
DeidentifyConfig value used
    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 de-identification metadata in a Provenance resource

The following table shows a description of the metadata in the DICOM instance that was de-identified and the metadata's corresponding field in a Provenance resource. The "Provenance resource field" cells contain sample values which are for demonstration purposes.

Metadata description Provenance resource field
Link to the de-identify operation resource Provenance.agent.who: {reference: "Provenance/PROVENANCE_RESOURCE_ID"}
Provenance resource creation timestamp Provenance.recorded
Source DICOM instance REST path
    Provenance.entity.role: SOURCE
    Provenance.entity.what.identifier.value
    
Destination DICOM instance REST path Provenance.target.type.value
DICOM image size
    Provenance.entity.extension: [
      {
        url: 'https://g.co/WIDTH',
        valueDecimal: WIDTH
      },
        url: 'https://g.co/HEIGHT',
        valueDecimal: HEIGHT
      }
    ]
    
Structured size
    Provenance.entity.extension: [{
      url: 'https://g.co/DICOM_STRUCTURED_SIZE',
      valueDecimal: VALUE,
    }]
    
DICOM image annotation
    Provenance.entity.extension: [{
      url: 'https://g.co/DICOM_IMAGES',
      extension: [
        { FRAME_0
        },
        { FRAME_1
        },
        ...
      ]
    }]
    
DICOM frame annotation
    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 frame annotation
    // 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
       }
    ]
    
All DICOM tags annotation
    Provenance.entity.extension: [{
      url: 'https://g.co/dicom-tags',
      extension: [
        { // tag (0002,0000)
        },
        { // tag (0002,0001)
        },
        ...
      ]
    }]
    
DICOM individual tag notation
    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"
          }
        ]
      }
    ]
    

Examples

Before you begin

Ensure that you have the roles/healthcare.fhirResourceEditor role on the operation metadata FHIR store before running any of the following examples. You need this role to write to the operation metadata FHIR store.

De-identify DICOM data, write to a FHIR store, and search Provenance resources

Before running this example, complete the following steps:

  1. Create a source dataset containing a DICOM store with at least one DICOM instance to be de-identified.
  2. Create a destination dataset containing an empty DICOM store and an empty FHIR store. The FHIR store must meet the requirements.

This example expands on Combining tag de-identification and burnt-in text redaction. In this example, the de-identification occurs on a single DICOM store and the de-identified data is written to a new DICOM store. The operation metadata FHIR store is in the same dataset as the new DICOM store.

This example uses two DICOM instances. The instances are not provided for you, so the sample responses will not align exactly with your de-identified data.

  1. De-identify the DICOM data.

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

    • PROJECT_ID: your Google Cloud project ID
    • LOCATION: the location of the dataset containing the source DICOM store
    • SOURCE_DATASET_ID: the source DICOM store's parent dataset
    • SOURCE_DICOM_STORE_ID: the ID of the DICOM store containing data that you are de-identifying
    • DESTINATION_DATASET_ID: an existing dataset that contains the metadata operation FHIR store, and where the de-identified DICOM store will be created
    • DESTINATION_DICOM_STORE_ID: the DICOM store where de-identified data from the source DICOM store will be written
    • OPERATION_METADATA_FHIR_STORE_ID: the FHIR store where de-identification operation metadata will be written

    Request JSON body:

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

    To send your request, choose one of these options:

    curl

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    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

    Then execute the following command to send your REST request:

    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

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    @'
    {
      "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

    Then execute the following command to send your REST request:

    $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
    The response is the following. The response contains an identifier for a long-running operation. Long-running operations are returned when method calls might take a substantial amount of time to complete. Note the value of OPERATION_ID. You need this value in the next step.

  2. Get the status of the operation.

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

    • PROJECT_ID: your Google Cloud project ID
    • LOCATION: the location of the dataset
    • SOURCE_DATASET_ID: the dataset where the de-identify operation is running
    • OPERATION_ID: the ID of the de-identify operation

    To send your request, choose one of these options:

    curl

    Execute the following command:

    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

    Execute the following command:

    $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

    APIs Explorer

    Open the method reference page. The APIs Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Complete any required fields and click Execute.

    You should receive a JSON response similar to the following:

  3. After successfully de-identifying DICOM data and writing the operation metadata to a FHIR store, you can view the Provenance resources in the FHIR store.

    To view the Provenance resources, use the fhir.search method.

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

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

    To send your request, choose one of these options:

    curl

    Execute the following command:

    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

    Execute the following command:

    $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
    The following response was a result of de-identifying two DICOM instances. The de-identify operation resulted in the following three Provenance resources being created:
    • One Provenance resource for each of the two DICOM instances
    • One Provenance resource for the de-identify operation

Store sample data, create a relative x coordinate custom FHIR search, and query

Before running this example, create a destination dataset containing an empty DICOM store and an empty FHIR store. The FHIR store must meet the requirements.

The following example shows how you can store the three Provenance resources created in De-identify DICOM data, write to a FHIR store, and search Provenance resources and then create a custom search. The custom search queries the relative-x-coordinate-bottom-left in one of the de-identified DICOM instances.

  1. Store the Provenance resources.

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

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

    Request JSON body:

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

    To send your request, choose one of these options:

    curl

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    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

    Then execute the following command to send your REST request:

    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

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    @'
    {
      "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

    Then execute the following command to send your REST request:

    $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

    You should receive a JSON response similar to the following:

  2. Create a SearchParameter resource on the DICOM image's relative x coordinate.

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

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

    Request JSON body:

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

    To send your request, choose one of these options:

    curl

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    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

    Then execute the following command to send your REST request:

    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

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    @'
    {
      "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

    Then execute the following command to send your REST request:

    $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

    You should receive a JSON response similar to the following:

  3. Enable the custom SearchParameter resource on the FHIR store.

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

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

    Request JSON body:

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

    To send your request, choose one of these options:

    curl

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

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

    Then execute the following command to send your REST request:

    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

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

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

    Then execute the following command to send your REST request:

    $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
    The response is the following. The response contains an identifier for a long-running operation. Long-running operations are returned when method calls might take a substantial amount of time to complete. Note the value of OPERATION_ID. You need this value in the next step.

  4. Get the status of the operation.

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

    • PROJECT_ID: your Google Cloud project ID
    • LOCATION: the location of the dataset
    • DATASET_ID: the dataset where the custom search operation is running
    • OPERATION_ID: the ID of the custom search operation

    To send your request, choose one of these options:

    curl

    Execute the following command:

    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

    Execute the following command:

    $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

    APIs Explorer

    Open the method reference page. The APIs Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Complete any required fields and click Execute.

    You should receive a JSON response similar to the following:

  5. Query the Provenance resource using the relative x coordinate search parameter:

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

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

    To send your request, choose one of these options:

    curl


    The following sample uses the relative-x-coordinate-bottom-left=le0.05 query, which searches for an x coordinate within 5% of the edge of the image.

    Execute the following command:

    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


    The following sample uses the relative-x-coordinate-bottom-left=le0.05 query, which searches for an x coordinate within 5% of the edge of the image.

    Execute the following command:

    $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
    The response shows that one DICOM instance that satisfies the search query is returned:
    {
      "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"
    }
    

Store sample data, create a source DICOM custom FHIR search, and query

Before running this example, create a destination dataset containing an empty DICOM store and an empty FHIR store. The FHIR store must meet the requirements.

The following example shows how you can store the three Provenance resources created in De-identify DICOM data, write to a FHIR store, and search Provenance resources and then create a custom search. The custom search queries for information about one of the two source DICOM images.

  1. Store the Provenance resources.

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

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

    Request JSON body:

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

    To send your request, choose one of these options:

    curl

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    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

    Then execute the following command to send your REST request:

    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

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    @'
    {
      "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

    Then execute the following command to send your REST request:

    $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

    You should receive a JSON response similar to the following:

  2. Create a SearchParameter resource on the source DICOM image.

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

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

    Request JSON body:

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

    To send your request, choose one of these options:

    curl

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    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

    Then execute the following command to send your REST request:

    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

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

    @'
    {
      "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

    Then execute the following command to send your REST request:

    $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

    You should receive a JSON response similar to the following:

  3. Enable the custom SearchParameter resource on the FHIR store.

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

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

    Request JSON body:

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

    To send your request, choose one of these options:

    curl

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

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

    Then execute the following command to send your REST request:

    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

    Save the request body in a file named request.json. Run the following command in the terminal to create or overwrite this file in the current directory:

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

    Then execute the following command to send your REST request:

    $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
    The response is the following. The response contains an identifier for a long-running operation. Long-running operations are returned when method calls might take a substantial amount of time to complete. Note the value of OPERATION_ID. You need this value in the next step.

  4. Get the status of the operation.

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

    • PROJECT_ID: your Google Cloud project ID
    • LOCATION: the location of the dataset
    • DATASET_ID: the dataset where the custom search operation is running
    • OPERATION_ID: the ID of the custom search operation

    To send your request, choose one of these options:

    curl

    Execute the following command:

    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

    Execute the following command:

    $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

    APIs Explorer

    Open the method reference page. The APIs Explorer panel opens on the right side of the page. You can interact with this tool to send requests. Complete any required fields and click Execute.

    You should receive a JSON response similar to the following:

  5. Query the Provenance resource using the source DICOM image search parameter.

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

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

    To send your request, choose one of these options:

    curl


    The following sample uses the lookup-source-instance:contains=studies/1/series/2/instances/4 query, which returns information about the instance that contains studies/1/series/2/instances/4 in its identifier.

    Execute the following command:

    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


    The following sample uses the lookup-source-instance:contains=studies/1/series/2/instances/4 query, which returns information about the instance that contains studies/1/series/2/instances/4 in its identifier.

    Execute the following command:

    $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
    The response shows that one DICOM instance that satisfies the search query is returned:
    {
      "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"
    }
    

Export and query the operation metadata FHIR store

The following example shows how you can export the de-identify operation metadata in the FHIR store to BigQuery and query the exported data for PHI data processed by OCR. The generated data is only compatible with the LOSSLESS or ANALYTICS_V2 SchemaType.

  1. Export the metadata in the FHIR store to a BigQuery dataset.

    The metadata is exported to a table named Provenance in the selected BigQuery dataset.

  2. Go to the BigQuery page.

    Go to BigQuery

  3. In the Explorer pane, complete these steps:

    1. Select your Google Cloud project.
    2. Select the BigQuery dataset where you exported the DICOM metadata.
    3. Select the Provenance table.
  4. Click Compose new query.

  5. Run the following query:

    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
    

    Replace the following:

    • PROJECT_ID: the ID of your Google Cloud project
    • BIGQUERY_DATASET: the BigQuery dataset where you exported the metadata from the FHIR store
  6. Click Run.

    The query results show the metadata for the de-identified PHI data in a tabular format. If you don't specify a destination table, the query job writes the output to a temporary (cache) table.

Quota

Writing de-identify operation metadata to a FHIR store consumes fhir_ops quota in the project where the operation metadata is written. One FHIR resource is created for each DICOM instance, so the throughput of the de-identify operation cannot be greater than what your FHIR quota allows.

Billing

Each Provenance resource created in the operation metadata FHIR store incurs a charge for calling fhir.update. The number of API calls to fhir.update can be calculated as: Total number of DICOM instances de-identified + 1.

What's next