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
- 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).
- 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.
- 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.
- The files are remembered: the next run takes only new files.
| Setting | Choose |
|---|---|
| Folder with the files | As the cluster sees it, for example s3a://landing/fhir/hospital-a or /data/fhir-in. The cluster needs read access. |
| Files | NDJSON: one resource or Bundle per line (.ndjson, .jsonl, and .gz of those). JSON: one resource or Bundle per .json file. |
| Files per run | More new files than this wait for the next run, in name order. |
| FHIR server id, Record source | Stored with every resource, as in the NiFi™ flows. |
| Run | Every 15 minutes, every hour, every day, or only by hand. |
| Speed | Parallel 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.