All use casesUse case · Healthcare

From Hospital Silos to Daily Insights

A hospital's operations team needs the same three answers every morning: how full the wards are, how many patients missed their appointments and how long lab results take. The data is spread across four systems that write the same patient in four ways. This use case shows three visual DataFloem pipelines that standardise, validate and mask the records and publish daily KPIs to Apache Iceberg.

Industry
Healthcare
Sources
PostgreSQL, Elasticsearch, object storage (CSV, JSON)
Output
Daily KPI tables and a data quality table, in Iceberg
Each run
Three batch jobs on Spark, one per KPI
Northbridge Health writes the same patient four ways in its EHR, ward, appointment and lab systems. One DataFloem flow standardises the ID, rejects stays that end before they begin, masks names and national IDs with a one-way hash and writes the stays and bed occupancy to Iceberg, where a department board shows occupancy, no-shows and lab turnaround

At a glance

  • Challenge: bed, appointment and lab data live in four systems that write the same patient, department and status in their own way, so the morning report takes hours of spreadsheet work and still can't be fully trusted.
  • Solution: three visual DataFloem pipelines read each system where it is, standardise IDs and codes, reject invalid records, mask patient identities and write daily KPIs to Apache Iceberg.
  • Value: one department board with bed occupancy, no-show rate and lab turnaround, rebuilt by every run, with every rejected record kept and explained.

The scenario

Synthetic data. Northbridge Health is a fictional hospital network, and no real patient data was used.

Every morning, a hospital's operations team needs the same three answers. How full are our wards? How many patients missed their appointments? How long do lab results take?

The data to answer them exists at Northbridge Health. It is just spread across systems that were never designed to talk to each other: the electronic health record, the lab information system, the appointment scheduler and the ward system. Each one keeps its own records, and each one writes the same patient's ID in its own way.

Four systems, four versions of the truth

  • One patient, four IDs. The same patient shows up as MRN-000123 in the EHR, mrn123 in the scheduler, patient 123 in the lab and MRN 000123 in the ward system.
  • One department, three spellings. Departments appear as CARD, Cardiology and card. A missed visit is written as NS, no-show or No Show.
  • Two time zones, double results. Lab orders are stamped in UTC while results come back in local time, and some lab results are simply sent twice.
  • Patient privacy. Names and national IDs must not reach the people who analyse the data.

None of this is unusual. It is what real hospital data looks like, and it is exactly why operational reporting is so hard.

The data sources

System Where it lives What it holds
Patient records (EHR) PostgreSQL Patients, admissions, departments and bed capacity
Wards Elasticsearch Bed events: a bed becomes occupied or free
Appointments Object storage, daily CSV export Scheduled outpatient visits and their status
Laboratory (LIS) Object storage, JSON files Lab orders and results with their time stamps

DataFloem connects to each system where it already is. No exports to a staging database, no custom scripts.

Three pipelines, one lakehouse

Three visual pipelines, one per KPI, turn the raw records into clean, analysis-ready Iceberg tables. The first does the most work, because it handles the patient-level data:

Read
AdmissionsPostgreSQL
Bed eventsElasticsearch
Bed Occupancy pipeline
Standardise: mrn, dept_codeValidateFilter: valid / rejectedMask: patient_keyLast event per bedOccupancy per department
Write
patient_staysMasked, valid stays
data_quality_issuesRejected, with a reason
bed_occupancy_dailyApache Iceberg

1. Bed Occupancy: standardise, validate, mask

  1. Standardise. Admissions are read from the hospital database. One SQL step turns every patient reference into a single standard ID and every department name into one code:
    concat('MRN-', lpad(regexp_extract(patient_ref, '([0-9]+)', 1), 6, '0')) AS mrn,
    CASE WHEN upper(dept) LIKE 'CARD%' THEN 'CARD'
         WHEN upper(dept) LIKE 'ORTH%' THEN 'ORTH'
         -- one line per department
    END AS dept_code
  2. Validate. Every stay gets a validity check: a stay that ends before it begins is a data error. A Filter lets only valid stays through, and a second filter sends the rejected ones, with their reason, to a data_quality_issues table. Bad records never reach the report, and they are not lost either: the team can fix them at the source.
  3. Mask. Names and national IDs never leave the masking step. A one-way hash turns them into a patient key, and only the attributes needed for analysis remain:
    SELECT mrn,
           sha2(concat(mrn, ':', national_id), 256) AS patient_key,
           year(birth_date) AS birth_year,
           gender
    FROM patients_raw
    The validated, masked stays land in a patient_stays table. Analysts can work with them without ever seeing who the patient is.
  4. Count beds. From the ward system's events in Elasticsearch, the pipeline takes each bed's last event up to the report day. If it says occupied, the bed is in use. Divided by each department's bed capacity, that gives the occupancy rate, written to bed_occupancy_daily.
  5. Test, then run. Before the full run, a Partial Run tests every step on the cluster, and Data Preview shows validated stays with a patient key, and no names or national IDs in sight. Then the full run writes the tables, and its log confirms every step.

2. Appointment No-Shows: one status for a missed visit

The scheduling system's daily CSV export is read straight from object storage. One step turns the three spellings of a missed visit into a single status, drops cancelled visits and works out the weekday. The next step calculates attended visits, no-shows and the no-show rate per department and weekday.

3. Lab Turnaround: no duplicates, exact times

Lab results arrive as JSON files. A Distinct step keeps exactly one of every result that the interface sent twice. Read as real time stamps, UTC orders and local-time results compare correctly, so the order-to-result time is exact. The pipeline averages it per department and counts the tests.

The result: one board, every morning

With all three tables in the lakehouse, one SQL query joins them into a department board:

Department Bed occupancy No-show rate Lab turnaround
Cardiology 94% 9% 3h 10m
Oncology 88% 7% 2h 50m
Orthopedics 81% 14% 2h 20m
Pediatrics 76% 11% 1h 55m

Hospital-wide, that is 87% bed occupancy, a 12% no-show rate and 2 hours 45 minutes from lab order to result.

The board already tells a story. Cardiology is close to full and also has the slowest lab results. Orthopedics loses the most appointments. And a second query shows what validation caught: forty stays, ten in every department, that were discharged before they were admitted. Those are now a to-do list for the source systems, not a silent error in a report.

Architecture

Sources
PostgreSQLEHR: patients and admissions
ElasticsearchWard bed events
Object storageAppointments CSV, lab JSON
Three DataFloem visual jobs
On a Spark cluster
Bed OccupancyAppointment No-ShowsLab Turnaround
Apache Iceberg
Daily KPI tablesOne per job
patient_staysMasked
data_quality_issuesRejected records
SQL Queries
One department board, every morning
Department boardOccupancy, no-shows, lab time
Validation checkWhat was rejected, and why

What this demo does not claim

  • No HL7 or FHIR interface. The data is read from databases, a search index and file exports.
  • No real-time bed tracking. The pipelines run as daily batches.
  • No clinical decision support. The board shows operational KPIs, not care recommendations.
  • All data is synthetic. No real patient data was used.

What it means for a hospital

Before With DataFloem
Hours of manual merging every morning A board rebuilt by every run
Occupancy, no-shows and lab delays in separate tools All three side by side, per department
Four patient IDs, three department spellings One patient ID, one department code, one status
Names and national IDs in analysts' extracts Identities masked inside the pipeline, before analysis
Invalid records quietly skewing the KPIs Invalid records caught, kept and explained

The same pattern works for any hospital KPI: 30-day readmissions, emergency waiting times, operating room utilisation. Connect the systems you already have, standardise and validate in one place, mask what must stay private, and publish clean tables your teams can query.

The DataFloem capabilities it uses

Capability Role in this use case
Data integration PostgreSQL, Elasticsearch and object storage (CSV, JSON) sources
Data processing SQL, Filter, Distinct, aggregation and catalog target nodes on a visual canvas
Data quality Invalid stays rejected into a data_quality_issues table, with their reason
Data masking Names and national IDs replaced by a one-way hash
Partial Run and Data Preview Masked stays checked before anything is written
Apache Iceberg catalog The KPI, patient stay and data quality tables
SQL Queries The department board and the validation check

See it in action

The video below follows the three pipelines on the DataFloem canvas, from the four systems to the department board and the records that validation caught.

TimeWhat you see
Northbridge Health: four systems, one hospital
DataFloem brings them together: validation and masking
Three daily KPIs
Bed Occupancy: a new job and its pipeline
Admissions from the hospital database
Standardising patient IDs and department codes
Catching invalid stays
Rejected records go to a data quality table
Masking names and national IDs
Bed events from Elasticsearch
Occupancy per department
Writing to the lakehouse (Iceberg)
Partial run and masked patient stays in Data Preview
Full run and log
Appointment No-Shows: reading the CSV export
One status for missed visits
Lab Turnaround: reading the JSON results
Duplicates dropped, order-to-result time per department
SQL: the department board
SQL: what validation caught

Bring your hospital's systems onto one board.

If your morning report still starts with merging exports by hand, get in touch with the DataFloem team to see how validated, privacy-safe KPIs fit your EHR, lab and scheduling systems.

ESC

Start typing to search across the documentation.