Skip to content
Recipes

FHIR bulk export to a data warehouse

Export FHIR data in bulk on a schedule and load it into BigQuery, Redshift or Synapse for analytics. In progress.

In progressThis page describes what's coming, not working steps.

On this page

Analytics and population health teams want clinical data in their warehouse, not behind a FHIR API. The FHIR Bulk Data $export operation produces NDJSON files of whole resource types. This recipe will run that export on a schedule, land the files in cloud storage and load them into BigQuery, Amazon Redshift or Azure Synapse, so the warehouse stays current without custom scripts.

Source and destination

The intended flow exports from a FHIR server, stages NDJSON in the cloud's object storage and loads it into the warehouse.

flowchart LR
    A[FHIR server] -->|bulk export NDJSON| B[MedHook engine]
    B -->|files| C[GCS, S3 or Azure Blob]
    C -->|load| D[BigQuery, Redshift or Synapse]
  • Source: any FHIR server that supports Bulk Data $export (system, patient or group level), including EHRs.
  • Destination: a warehouse table per resource type, incremental with _since.

What exists today

  • The fhir-bulk adapter runs system, patient and group $export with _type, _since and _typeFilter, with Backend Services authentication.
  • The built-in template FHIR Bulk Data Export (fhir-bulk-export) exports patients and flattens them. See the Workflow catalog.
  • The s3 and gcs adapters write objects. There is no Azure Blob Storage adapter.
  • A schedule trigger can run a workflow on a cron.
  • The SQL database adapter writes rows to PostgreSQL, SQL Server, MySQL and Oracle.
  • MedHook loads rows into BigQuery with the bigquery adapter; nothing loads Redshift or Synapse yet.

What's coming

  • Redshift and Synapse destinations, with a table per resource type.
  • BigQuery load jobs from Cloud Storage, for whole bulk export files instead of streamed rows.
  • An Azure Blob Storage adapter, for staging on Azure.
  • Incremental runs that remember the last _since time.
  • A built-in template and a guide, tested with synthetic data.

Status

In progress. The engine streams rows into BigQuery today, so a workflow can split an export and insert the rows. Load jobs for whole files, the Redshift and Synapse writers and an Azure Blob Storage adapter are not in the engine yet.

Reference