Big Data
healthcare data warehouse
A data warehouse for a fictional hospital group, fed from a care database and public files. Its storage is designed around the questions it has to answer.
- 25
million death records integrated
A file of nearly two gigabytes, read by an automated job: no surname or first name comes out of it.
- 9
sources brought together
Three tables from the care database and six files, written to HDFS by a single Talend job.
- 7
analysis needs tied to a job
Out of the 8 needs set by the brief, according to the second deliverable.
ChapterProblemContents
Problem
Monitoring care activity
The group wants to track its consultations, its hospital stays, patient satisfaction and mortality. All it has are separate sources: a care database, national registries, surveys, a death registry.
The brief sets eight analysis needs, from the consultation rate per facility to satisfaction by region. None of them can be met without combining several sources: it takes a warehouse that brings them together.
Constraints
Sources that look nothing alike
- Different formats and identifiers. A PostgreSQL database of 13 tables for care; the national registries of facilities and practitioners; the death registry; satisfaction surveys from 2014 to 2020, as CSV files and spreadsheets.
- A volume no spreadsheet can take. 28.4M rows of source data, 2.12 GB in all.
- Personal data. The death registry holds surname, first name, date and place of birth, and the module requires processing that takes GDPR into account.
- An imposed environment. One Cloudera virtual machine per student.
Architecture
The path of a record
Talend jobs write the sources to HDFS, and Hive exposes them as a star around the consultations. Follow one record.
A consultation from the care database.
Stored in its diagnosis partition, ready for the query.
Care dataPostgreSQL
A thirteen-table PostgreSQL database for care: consultations, patients, facilities.
FilesCSV
National registries, the death registry and satisfaction surveys, as CSV files and spreadsheets.
SelectTalend, tMap
The main job reads each source and keeps only the columns that serve a need: no first or last name comes out.
Example written for the illustration.
LinkTalend, PostgreSQL
A dedicated job joins the deaths to the registry of municipalities; four-digit codes get a leading zero so they match.
Example written for the illustration.
StorageHDFS
Each source becomes a file in the distributed file system.
WarehouseHive, HiveQL
Ten managed Hive tables, the consultation fact table and its dimensions, in a star schema.
Example written for the illustration.
PartitionHive
The fact table is rebuilt partitioned by diagnosis, with its patients spread across five buckets.
Example written for the illustration.
QueryHue
The rebuilt table is queried in Hue and monitored in Cloudera Manager.
From needs to jobs
The eight needs are those of the brief; the link to the jobs is the one in the second deliverable.
- Consultation rate per facility, over a period: consultations, patients, facilities.
- Consultation rate per diagnosis, over a period: consultations, diagnoses, patients; fact table partition.
- Overall hospitalization rate, over a period: patients.
- Hospitalization rate per diagnosis: diagnoses, patients.
- Hospitalization rate by sex and age: no job tied to it explicitly in the deliverable.
- Consultation rate per practitioner: consultations.
- Number of deaths by region, in 2019: deaths, then the join to municipalities.
- Overall satisfaction by region, in 2020: satisfaction.
Decisions
Storage designed around the questions
| Decision | Option ruled out | What settled it |
|---|---|---|
| A data warehouse | A data lake | The sources are already structured. Compared on performance, security and cost, the warehouse serves analytical queries better. |
| A star schema | Snowflake; constellation | A query goes through fewer joins, and the model stays easy to maintain. The storage redundancy is accepted. |
| Partition by diagnosis, bucket by patient | A flat fact table | The layout follows a named need: consultations by diagnosis, over a period. |
| Processing inside the Talend jobs | Processing inside the visualization tool | A change of course between the two deliverables: each job is tied to the needs it serves. |
| Managed Hive tables | External tables | Hive then controls the data lifecycle. |
Deliverables
What was delivered, from modeling to tables
The project has no measurement that proves a gain: what is established is what was delivered.
- Reference model Data dictionary, conceptual model following Merise, then a logical star schema.
- Jobs A main job that writes the sources to HDFS, and a job that joins deaths to municipalities.
- Physical model A Hive database loaded from HDFS and checked with a query on the diagnosis table.
- Optimization The fact table rebuilt with partitions and buckets, then queried in Hue and monitored in Cloudera Manager.
Limitations and lessons learned
Change one thing at a time when measuring
The deliverable's measurement, and why it proves nothing
Times read off Cloudera Manager graphs, one run per query, loaded volume not documented.
- Full read, same query on both sides, over 3.5 s flat and over 3 s partitioned. These are two lower bounds, and no gap is shown.
- Filtered read, two different queries: over 1.8 s flat, filtered on patient and practitioner; 0.4 s partitioned, filtered on patient only. Not comparable.
Those two times do not measure the effect of partitioning: I publish no gain from them. It would have taken the same query on both sides, filtered on diagnosis (the partition key), with the number of rows loaded recorded alongside each measurement.
The main jobs select columns, with no cleaning or deduplication. The practitioners file stops at 1,048,576 rows, the limit of an Excel sheet: it was most likely truncated on its way through a spreadsheet, and nobody noticed. A row count at every step would have shown it.