The Data Vault model and the loader
Hubs, satellites, links; how a resource is loaded.
Each FHIR® resource type has a hub (one row per business key: server, type, id; the hash key is md5 of those), a satellite (one row per version, with the resource JSON, a hashdiff, load start and end dates) and, for references, link tables with their own satellites. The current version is the satellite row with an empty end date.
Loading
- The incoming resource JSON is hashed (hashdiff). If the hashdiff equals the open satellite row, nothing is written (delta detection).
- Otherwise the open row gets an end date and a new row is inserted.
- References inside the resource are extracted and written as link rows (one per reference element), with stubs created in the target hub for targets not yet loaded – these are the "hub without current version" figures in the Profiler.
Updates never overwrite; history stays available, which is why the Viewer can show versions.
The golden vault is loaded with a batch loader (load_fhir_resources taking a JSON array): one round trip and one transaction per 400 resources, temp tables instead of row-by-row procedure calls, references parsed by the application, asynchronous commit. It writes the same rows as the single-resource loader at ten to twenty-five times the speed.