Data engineering, led by change data capture
CDC is the approach I use most. Healthcare sources hold millions of records, and a daily load only needs what changed. The method is simple to state; the hard parts are deletes, late changes and proving the target still matches the source.
Log-based capture
Use when
The source exposes a transaction log or replication stream and you need low latency, deletes and every intermediate change.
Watch for
Needs database access and agreement from the source owner; schema changes and log retention must be monitored.
Timestamp or ID watermarks
Use when
Rows carry a reliable last-updated time or an increasing key, and a scheduled pull is fresh enough.
Watch for
Misses hard deletes and any change that does not update the column; late commits can slip behind the watermark without an overlap window.
Row fingerprints (hashes)
Use when
There is no log access and no trustworthy timestamp, but you can read the full table or a bounded slice.
Watch for
Each comparison reads the whole slice, so cost grows with volume; it shows what changed, not the order of changes.
- Deletes
- Watermarks cannot see a row that is gone. Use log deletes, soft-delete flags, or a periodic key comparison against the source.
- Late or replayed changes
- Re-read an overlap window behind the watermark and order changes by source sequence, so an old event cannot overwrite a newer one.
- Reconciliation
- Compare counts, key sets and column checksums between source and target by time window, and record every result.
- Idempotent merges
- Merge on a stable business key with a version or sequence check, so running the same batch twice gives the same result.
- Idempotency
- A re-run loads nothing twice. Loaded files are skipped and merges are keyed.
- Schema drift
- Compare source columns, types and null rates with what is expected, and decide whether to adapt, alert or stop.
- Lineage
- Every number can be traced back to the files, runs and rules that produced it.
- Quarantine
- Bad records are set aside with a visible reason instead of disappearing or breaking the load.
- Medallion layers
- Bronze keeps raw source data, Silver holds cleaned data, and Gold holds data prepared for products.
- Backfills
- Historical reloads run through the same idempotent path as daily loads, bounded by date and reconciled afterwards.
- Data contracts
- The source and its consumers agree on fields, meanings, freshness and ownership, and changes are announced before they ship.