-
Notifications
You must be signed in to change notification settings - Fork 118
Create a Google Cloud FHIR Store and BigQuery Dataset
One of the supported FHIR sinks is Google Cloud FHIR store and BigQuery. These instructions will guide you in creating a FHIR store and BigQuery dataset.
To set up GCP project that you can use as a sink FHIR store:
-
Create a new project in GCP. For an overview of projects, datasets and data stores check this document.
-
Enable Google Cloud Healthcare API in the project and create a Google Cloud Healthcare dataset
-
Create a FHIR data store in the dataset with the R4 FHIR version
-
Enable the BigQuery API in the project and dataset with the same name in the project
-
Download, install, and initialize the
gcloudcli: https://cloud.google.com/sdk/docs/quickstart -
Make sure you can authenticate with the project using the CLI: https://developers.google.com/identity/sign-in/web/sign-in
$ gcloud init$ gcloud auth application-default login- Create a service account for the project, generate a key, and save it securely locally
- Add the
bigquery.dataEditorandbigquery.jobUserroles to the project in theIAM & Admin/Rolessettings or using the cli:$ gcloud projects add-iam-policy-binding openmrs-260803 --role roles/bigquery.admin --member serviceAccount:[email protected]$ gcloud projects add-iam-policy-binding openmrs-260803 --role roles/healthcare.datasetAdmin --member serviceAccount:[email protected]
- Activate the service account for your project using
gcloud auth activate-service-account <your-service-account> --key-file=<your-key-file> --project=<your project> - Set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable: https://cloud.google.com/docs/authentication/getting-started#setting_the_environment_variable
-
Use the script
utils/create_fhir_store.shto create a FHIR store in this dataset which stream the changes to the BigQuery dataset as well:./utils/create_fhir_store.sh PROJECT LOCATION DATASET FHIR-STORE-NAME-
PROJECTis your GCP project. -
LOCATIONis GCP location where your dataset resides, e.g.,us-central1. -
DATASETis the name of the dataset you created. -
FHIR-STORE-NAMEis what it says.
Note: If you get
PERMISSION_DENIEDerrors, make sure toIAM & ADMIN/IAM/Membersand add thebigquery.dataEditorandbigquery.jobUserroles to theCloud Healthcare Service Agentservice account that shows up. -
You can run the script with no arguments to see a sample usage. After you create the FHIR store, its full URL would be:
https://healthcare.googleapis.com/v1/projects/PROJECT/locations/LOCATION/datasets/DATASET/fhirStores/FHIR-STORE-NAME