Skip to content
Healthcare SoftwareEngineering

Guide · Data Engineering

Healthcare Data Engineering Guide: Pipelines, Models, Identity, and Trust

Healthcare data arrives in a dozen formats from systems that disagree about who the patient is. This guide covers how to ingest it, model it, link it, protect it, and prove that the numbers downstream can be trusted.

12 min read Updated

What makes healthcare data engineering hard

Generic data engineering assumes sources with stable schemas and a reliable primary key. Healthcare offers neither. An HL7 v2 feed from one hospital uses PID-3 for the MRN while another puts it in a repeating identifier list with an assigning authority you have to parse. Claims arrive as X12 837 and 835 transactions with loops and segments that encode meaning by position. A partner lab sends a CSV with a header row that changes every quarter.

On top of format diversity sit semantic problems. The same hemoglobin A1c test may carry three different local codes, one LOINC code, and no units. A diagnosis may be recorded on a claim, a problem list, and an encounter note with different dates. Corrections arrive as new messages that supersede old ones. A data platform that ignores these details produces dashboards that look authoritative and are quietly wrong.

The goal is not just moving bytes. It is producing data whose provenance, meaning, and quality are known well enough that a quality measure, a risk model, or a payer submission can rely on it.

Ingesting HL7 v2, FHIR, X12, and flat files

Land every source in its raw form first, unchanged and immutable, with metadata about when and how it arrived. Parsing and normalization come after. This lets you reprocess history when a mapping bug is found, which will happen.

Source formats and ingestion considerations
SourceTypical transportParsing concernsPractical tip
HL7 v2 (ADT, ORU, ORM, SIU)MLLP via interface engine, often relayed to a queueSite-specific Z-segments, escape sequences, repeating fields, message orderingStore the raw message plus a parsed JSON form; key on message control ID for deduplication
FHIR (REST, Subscriptions, Bulk $export)HTTPS, NDJSON files from bulk exportProfiles and extensions vary; references must be resolved; resource versionsValidate against US Core profiles and keep meta.versionId and lastUpdated
X12 (837, 835, 270/271, 834)SFTP or clearinghouse APILoop and segment hierarchy, envelope control numbers, companion guide variationsUse a proven X12 parser and reconcile control totals per file
CSV and spreadsheetsSFTP, cloud storage drops, email (discourage this)Schema drift, encoding, date formats, embedded PHI in free textEnforce a data contract and quarantine files that fail it
CCD/C-CDA documentsHIE query, Direct messaging, EHR exportDeeply nested XML, narrative versus structured sectionsExtract structured entries and keep the source document for reference

Lakehouse architecture for clinical and claims data

A lakehouse pattern with open table formats such as Delta Lake, Apache Iceberg, or Apache Hudi fits healthcare well: it keeps raw history cheaply, supports ACID updates for corrections and merges, and serves both SQL analytics and machine learning. The common layering is bronze (raw), silver (parsed, conformed, deduplicated), and gold (modeled for specific uses).

Keep PHI boundaries explicit in the design. Many teams maintain an identified zone for operations and linkage, and a separate de-identified zone for research and broad analytics, with different access policies and audit requirements. Only HIPAA-eligible cloud services covered by your BAA with the cloud provider should hold PHI.

  • Bronze: raw HL7, FHIR NDJSON, X12, CSV, and documents, immutable, with arrival metadata
  • Silver: parsed and typed records, terminology-mapped codes, deduplicated, with source lineage columns
  • Gold: analytic models such as OMOP CDM tables, quality measure marts, feature stores, and operational extracts
  • Cross-cutting: catalog, access policies, column-level masking, audit logging, data quality results

OMOP CDM vs FHIR for analytics

Teams often ask whether to standardize on FHIR or the OMOP Common Data Model. They solve different problems. FHIR is an exchange and API standard designed around clinical resources and RESTful access. OMOP is an analytic data model designed for observational research, with a standardized vocabulary that maps source codes to standard concepts.

A common architecture uses FHIR at the edges for ingestion and exchange, and OMOP or a purpose-built dimensional model in the gold layer for analytics. Converting FHIR to OMOP is well-trodden, but the vocabulary mapping step is where most of the effort and most of the errors live.

Choosing an analytic model
DimensionFHIR as analytic storeOMOP CDMCustom dimensional model
Primary purposeExchange and API accessObservational research and cohort analyticsOperational reporting for specific questions
VocabularyAllows many code systems per elementMaps to standard concepts via OHDSI vocabulariesWhatever you define
Query ergonomicsNested JSON; needs flattening (e.g. SQL-on-FHIR views)Relational, SQL-friendly, mature toolingOptimized for your BI tool
Portability of analysesLimitedHigh across OMOP sitesLow
Typical useServing APIs, patient access, payer exchangeResearch networks, population studies, model developmentDashboards, finance, operations

Identity resolution and the master patient index

The US has no national patient identifier, so linking records across sources depends on matching demographic attributes. A master patient index (MPI) or enterprise MPI assigns a persistent internal identifier and maintains links to every source identifier. Matching approaches range from deterministic rules (exact match on MRN and assigning authority) to probabilistic scoring on name, date of birth, sex, address, and phone, often with referential matching against third-party identity data.

Both errors are costly. A false merge combines two people's records and can put one patient's allergies on another's chart. A false split fragments a history and undercounts risk. Set thresholds with a manual review band, keep every link decision auditable and reversible, and process unmerge events from source systems such as HL7 A37 or A40 corrections.

Checklist

  • Normalize names, addresses, and phone numbers before matching
  • Record the assigning authority with every source identifier
  • Define auto-link, review, and no-link score bands
  • Staff a review queue with documented decision rules
  • Support merge and unmerge with full history
  • Measure match quality on a labeled sample periodically

De-identification and privacy-preserving analytics

HIPAA provides two de-identification methods. Safe Harbor requires removing 18 categories of identifiers and having no actual knowledge that the remaining information could identify the individual. Expert Determination requires a qualified expert to determine and document that the risk of re-identification is very small. A limited data set, which may retain dates and some geographic data, can be shared only under a data use agreement.

Engineering choices matter here. Free-text notes and images can carry identifiers in places structured pipelines miss. Date shifting must be consistent per patient to preserve intervals. Tokenization lets you link de-identified records across datasets without exposing identifiers, but the token keys become sensitive assets themselves.

Data quality and lineage

Data quality checks should run in the pipeline, not in a quarterly audit. Test for completeness (are expected daily volumes arriving per source), validity (codes in allowed value sets, units present), consistency (discharge after admit), uniqueness (no duplicate encounters), and timeliness (lag from event to availability). Fail loudly when a contract is broken, and quarantine rather than silently drop bad records.

Lineage answers the question every analyst eventually asks: where did this number come from? Capture column-level lineage from source message to gold table, including the mapping and code versions applied. When a payer questions a quality submission, or a model behaves oddly, lineage turns days of forensic work into a query.

Example data quality rules
DimensionExample ruleAction on failure
CompletenessADT volume per facility within expected range for the hourAlert interface owner
ValidityLab results carry a LOINC code and UCUM unitRoute to terminology mapping queue
ConsistencyDischarge datetime is after admit datetimeQuarantine record, flag source
UniquenessOne active encounter per visit number and facilityDeduplicate, log decision
TimelinessClaims loaded within agreed window of file receiptEscalate per runbook

Operating the platform

Data platforms accumulate consumers faster than owners. Assign a named owner to each source feed and each gold data product, publish data contracts, and version breaking changes. Audit access to PHI in line with HIPAA audit control requirements and review it periodically.

Plan capacity and cost explicitly. Reprocessing years of raw HL7 after a mapping fix is a large compute job; design pipelines so a backfill can run without disrupting daily loads. Build platforms in phases: a single domain such as encounters and labs can reach production in a quarter or two, while an enterprise platform spanning clinical, claims, and operational data typically grows over several quarters.

References

This guide is educational and is not legal or regulatory advice.

Frequently asked questions

Should we use FHIR or OMOP for our analytics platform?

Often both, in different layers. FHIR is well suited to ingestion, exchange, and serving APIs. OMOP CDM is designed for observational analytics, with standardized vocabularies that make cohort definitions portable. Many teams ingest FHIR and HL7, conform data in a silver layer, and publish OMOP or dimensional models in the gold layer for analysts and data scientists.

What is a master patient index and do we need one?

An MPI assigns a persistent identifier to each person and links it to identifiers from every source system, using deterministic or probabilistic matching on demographics. If you combine data from more than one source, such as two hospitals, a claims feed, and a lab, you need some form of identity resolution, because the US has no national patient identifier and source MRNs do not line up.

Is de-identified data still covered by HIPAA?

Data that meets the HIPAA de-identification standard under 45 CFR 164.514(b), via Safe Harbor or Expert Determination, is not PHI. A limited data set is still PHI and requires a data use agreement. Re-identification codes and token keys need protection, and contracts with data sources may impose restrictions beyond HIPAA, so review those too.

How do we handle corrected and out-of-order HL7 messages?

Store every raw message immutably, use source timestamps and sequence information to determine the current state, and treat corrections such as ORU results with a corrected status as superseding earlier versions. Build idempotent upserts keyed on stable identifiers, and design pipelines so you can replay history when ordering bugs are found.

Discuss your healthcare engineering project

Tell us about the system, the integrations it depends on, and the constraints you are working within. A senior engineer will review it and reply with questions, not a sales script.