Documentation / Pipelines

Bulk load files (Apache® Spark)

Load large amounts of FHIR® files into the raw vault with a Spark cluster.

Bulk load files (Apache Spark) is an ingress pipeline for large volumes, such as the output of a FHIR bulk export. Choose Add Ingress, then the tile Bulk load files, and an Apache Spark server.

What a run does

  1. The Spark cluster lists the files in the folder, leaves out the ones the pipeline loaded before and reads the new ones in parallel. It splits Bundles into their entries and checks every resource (JSON, with a resourceType and an id).
  2. It writes the resources into a stage table in the raw vault, over several database connections. Lines that fail the check are kept with the reason.
  3. The suite loads the stage into the vault with the vault's own loader, type by type, one chunk at a time. A resource the database refuses (a malformed date, for example) is kept with the reason; the rest is loaded.
  4. The files are remembered: the next run takes only new files.
SettingChoose
Folder with the filesAs the cluster sees it, for example s3a://landing/fhir/hospital-a or /data/fhir-in. The cluster needs read access.
FilesNDJSON: one resource or Bundle per line (.ndjson, .jsonl, and .gz of those). JSON: one resource or Bundle per .json file.
Files per runMore new files than this wait for the next run, in name order.
FHIR server id, Record sourceStored with every resource, as in the NiFi™ flows.
RunEvery 15 minutes, every hour, every day, or only by hand.
SpeedParallel writes from the cluster, rows per insert, and resources per load transaction. The stage is loaded into the vault one chunk at a time: loads side by side could wait for each other.
Note

A failed run keeps nothing half-done: the next run reads the same files again, and resources that were loaded already are skipped by the vault. Rejected lines are kept for 30 days in the table fvs_ingest_reject of the raw schema; the run summary names the run.

Careful

Deploying creates the stage tables in the raw schema: the database user needs the right to create tables there once. A file is loaded once; to load it again, give it a new name.