Skip to content

googleHealthcareFhirStore

A FhirStore is a datastore inside a Healthcare dataset that conforms to the FHIR (https://www.hl7.org/fhir/STU3/) standard for Healthcare information exchange

To get more information about FhirStore, see:

Example Usage - Healthcare Fhir Store Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleHealthcareDatasetDataset =
  new google.healthcareDataset.HealthcareDataset(this, "dataset", {
    location: "us-central1",
    name: "example-dataset",
  });
const googlePubsubTopicTopic = new google.pubsubTopic.PubsubTopic(
  this,
  "topic",
  {
    name: "fhir-notifications",
  }
);
new google.healthcareFhirStore.HealthcareFhirStore(this, "default", {
  dataset: googleHealthcareDatasetDataset.id,
  disable_referential_integrity: false,
  disable_resource_versioning: false,
  enable_history_import: false,
  enable_update_create: false,
  labels: [
    {
      label1: "labelvalue1",
    },
  ],
  name: "example-fhir-store",
  notification_config: [
    {
      pubsub_topic: googlePubsubTopicTopic.id,
    },
  ],
  version: "R4",
});

Example Usage - Healthcare Fhir Store Streaming Config

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleBigqueryDatasetBqDataset =
  new google.bigqueryDataset.BigqueryDataset(this, "bq_dataset", {
    dataset_id: "bq_example_dataset",
    delete_contents_on_destroy: true,
    description: "This is a test description",
    friendly_name: "test",
    location: "US",
  });
const googleHealthcareDatasetDataset =
  new google.healthcareDataset.HealthcareDataset(this, "dataset", {
    location: "us-central1",
    name: "example-dataset",
  });
new google.healthcareFhirStore.HealthcareFhirStore(this, "default", {
  dataset: googleHealthcareDatasetDataset.id,
  disable_referential_integrity: false,
  disable_resource_versioning: false,
  enable_history_import: false,
  enable_update_create: false,
  labels: [
    {
      label1: "labelvalue1",
    },
  ],
  name: "example-fhir-store",
  stream_configs: [
    {
      bigquery_destination: [
        {
          dataset_uri: `bq://\${${googleBigqueryDatasetBqDataset.project}}.\${${googleBigqueryDatasetBqDataset.datasetId}}`,
          schema_config: [
            {
              recursive_structure_depth: 3,
            },
          ],
        },
      ],
      resource_types: ["Observation"],
    },
  ],
  version: "R4",
});
new google.pubsubTopic.PubsubTopic(this, "topic", {
  name: "fhir-notifications",
});

Example Usage - Healthcare Fhir Store Notification Config

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleHealthcareDatasetDataset =
  new google.healthcareDataset.HealthcareDataset(this, "dataset", {
    location: "us-central1",
    name: "example-dataset",
  });
const googlePubsubTopicTopic = new google.pubsubTopic.PubsubTopic(
  this,
  "topic",
  {
    name: "fhir-notifications",
  }
);
new google.healthcareFhirStore.HealthcareFhirStore(this, "default", {
  dataset: googleHealthcareDatasetDataset.id,
  disable_referential_integrity: false,
  disable_resource_versioning: false,
  enable_history_import: false,
  enable_update_create: false,
  labels: [
    {
      label1: "labelvalue1",
    },
  ],
  name: "example-fhir-store",
  notification_config: [
    {
      pubsub_topic: googlePubsubTopicTopic.id,
    },
  ],
  version: "R4",
});

Example Usage - Healthcare Fhir Store Notification Configs

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleHealthcareDatasetDataset =
  new google.healthcareDataset.HealthcareDataset(this, "dataset", {
    location: "us-central1",
    name: "example-dataset",
    provider: "${google-beta}",
  });
const googlePubsubTopicTopic = new google.pubsubTopic.PubsubTopic(
  this,
  "topic",
  {
    name: "fhir-notifications",
    provider: "${google-beta}",
  }
);
new google.healthcareFhirStore.HealthcareFhirStore(this, "default", {
  dataset: googleHealthcareDatasetDataset.id,
  disable_referential_integrity: false,
  disable_resource_versioning: false,
  enable_history_import: false,
  enable_update_create: false,
  labels: [
    {
      label1: "labelvalue1",
    },
  ],
  name: "example-fhir-store",
  notification_configs: [
    {
      pubsub_topic: googlePubsubTopicTopic.id,
      send_full_resource: true,
    },
  ],
  provider: "${google-beta}",
  version: "R4",
});

Argument Reference

The following arguments are supported:

  • name - (Required) The resource name for the FhirStore. ** Changing this property may recreate the FHIR store (removing all data) **

  • dataset - (Required) Identifies the dataset addressed by this request. Must be in the format 'projects/{project}/locations/{location}/datasets/{dataset}'


  • version - (Optional) The FHIR specification version. Default value is stu3. Possible values are dstu2, stu3, and r4.

  • enableUpdateCreate - (Optional) Whether this FHIR store has the updateCreate capability. This determines if the client can use an Update operation to create a new resource with a client-specified ID. If false, all IDs are server-assigned through the Create operation and attempts to Update a non-existent resource will return errors. Please treat the audit logs with appropriate levels of care if client-specified resource IDs contain sensitive data such as patient identifiers, those IDs will be part of the FHIR resource path recorded in Cloud audit logs and Cloud Pub/Sub notifications.

  • disableReferentialIntegrity - (Optional) Whether to disable referential integrity in this FHIR store. This field is immutable after FHIR store creation. The default value is false, meaning that the API will enforce referential integrity and fail the requests that will result in inconsistent state in the FHIR store. When this field is set to true, the API will skip referential integrity check. Consequently, operations that rely on references, such as Patient.get$everything, will not return all the results if broken references exist. ** Changing this property may recreate the FHIR store (removing all data) **

  • disableResourceVersioning - (Optional) Whether to disable resource versioning for this FHIR store. This field can not be changed after the creation of FHIR store. If set to false, which is the default behavior, all write operations will cause historical versions to be recorded automatically. The historical versions can be fetched through the history APIs, but cannot be updated. If set to true, no historical versions will be kept. The server will send back errors for attempts to read the historical versions. ** Changing this property may recreate the FHIR store (removing all data) **

  • enableHistoryImport - (Optional) Whether to allow the bulk import API to accept history bundles and directly insert historical resource versions into the FHIR store. Importing resource histories creates resource interactions that appear to have occurred in the past, which clients may not want to allow. If set to false, history bundles within an import will fail with an error. ** Changing this property may recreate the FHIR store (removing all data) ** ** This property can be changed manually in the Google Cloud Healthcare admin console without recreating the FHIR store **

  • labels - (Optional) User-supplied key-value pairs used to organize FHIR stores. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values are optional, must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be associated with a given store. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

  • notificationConfig - (Optional) A nested object resource Structure is documented below.

  • streamConfigs - (Optional) A list of streaming configs that configure the destinations of streaming export for every resource mutation in this FHIR store. Each store is allowed to have up to 10 streaming configs. After a new config is added, the next resource mutation is streamed to the new location in addition to the existing ones. When a location is removed from the list, the server stops streaming to that location. Before adding a new config, you must add the required bigquery.dataEditor role to your project's Cloud Healthcare Service Agent service account. Some lag (typically on the order of dozens of seconds) is expected before the results show up in the streaming destination. Structure is documented below.

  • notificationConfigs - (Optional, Beta) A list of notifcation configs that configure the notification for every resource mutation in this FHIR store. Structure is documented below.

The notificationConfig block supports:

  • pubsubTopic - (Required) The Cloud Pub/Sub topic that notifications of changes are published on. Supplied by the client. PubsubMessage.Data will contain the resource name. PubsubMessage.MessageId is the ID of this message. It is guaranteed to be unique within the topic. PubsubMessage.PublishTime is the time at which the message was published. Notifications are only sent if the topic is non-empty. Topic names must be scoped to a project. service-PROJECT_NUMBER@gcp-sa-healthcare.iam.gserviceaccount.com must have publisher permissions on the given Cloud Pub/Sub topic. Not having adequate permissions will cause the calls that send notifications to fail.

The streamConfigs block supports:

  • resourceTypes - (Optional) Supply a FHIR resource type (such as "Patient" or "Observation"). See https://www.hl7.org/fhir/valueset-resource-types.html for a list of all FHIR resource types. The server treats an empty list as an intent to stream all the supported resource types in this FHIR store.

  • bigqueryDestination - (Required) The destination BigQuery structure that contains both the dataset location and corresponding schema config. The output is organized in one table per resource type. The server reuses the existing tables (if any) that are named after the resource types, e.g. "Patient", "Observation". When there is no existing table for a given resource type, the server attempts to create one. See the streaming config reference for more details. Structure is documented below.

The bigqueryDestination block supports:

  • datasetUri - (Required) BigQuery URI to a dataset, up to 2000 characters long, in the format bq://projectId.bqDatasetId

  • schemaConfig - (Required) The configuration for the exported BigQuery schema. Structure is documented below.

The schemaConfig block supports:

  • schemaType - (Optional) Specifies the output schema type.

    • ANALYTICS: Analytics schema defined by the FHIR community. See https://github.com/FHIR/sql-on-fhir/blob/master/sql-on-fhir.md.
    • ANALYTICS_V2: Analytics V2, similar to schema defined by the FHIR community, with added support for extensions with one or more occurrences and contained resources in stringified JSON.
    • LOSSLESS: A data-driven schema generated from the fields present in the FHIR data being exported, with no additional simplification. Default value is analytics. Possible values are analytics, analyticsV2, and lossless.
  • recursiveStructureDepth - (Required) The depth for all recursive structures in the output analytics schema. For example, concept in the CodeSystem resource is a recursive structure; when the depth is 2, the CodeSystem table will have a column called concept.concept but not concept.concept.concept. If not specified or set to 0, the server will use the default value 2. The maximum depth allowed is 5.

The notificationConfigs block supports:

  • pubsubTopic - (Required) The Cloud Pub/Sub topic that notifications of changes are published on. Supplied by the client. PubsubMessage.Data will contain the resource name. PubsubMessage.MessageId is the ID of this message. It is guaranteed to be unique within the topic. PubsubMessage.PublishTime is the time at which the message was published. Notifications are only sent if the topic is non-empty. Topic names must be scoped to a project. service-PROJECT_NUMBER@gcp-sa-healthcare.iam.gserviceaccount.com must have publisher permissions on the given Cloud Pub/Sub topic. Not having adequate permissions will cause the calls that send notifications to fail.

  • sendFullResource - (Optional) Whether to send full FHIR resource to this Pub/Sub topic for Create and Update operation. Note that setting this to true does not guarantee that all resources will be sent in the format of full FHIR resource. When a resource change is too large or during heavy traffic, only the resource name will be sent. Clients should always check the "payloadType" label from a Pub/Sub message to determine whether it needs to fetch the full resource as a separate operation.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format {{dataset}}/fhirStores/{{name}}

  • selfLink - The fully qualified name of this dataset

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

FhirStore can be imported using any of these accepted formats:

$ terraform import google_healthcare_fhir_store.default {{dataset}}/fhirStores/{{name}}
$ terraform import google_healthcare_fhir_store.default {{dataset}}/{{name}}