Power BI page: Diagnosis Analysis ·
Data view: vw_diagnosis_analysis ·
Verified against data/databricks_output/exports/vw_diagnosis_analysis.csv
The Diagnosis Analysis page explores ICD-coded clinical conditions across admissions — distinguishing primary admitting diagnoses from secondary comorbidities, and linking diagnosis patterns to patient demographics and length of stay.
Three headline metrics across the top of the page. All values recomputed from the CSV export — exact match with the live dashboard (Power BI rounds 4,506 records to 5K).
| Card | Value | Verified | DAX |
|---|---|---|---|
| Diagnosed Patients | 100 | 100 | DISTINCTCOUNT(patient_id) |
| Diagnosis Records | 4,506 | 4,506 | COUNTROWS(vw_diagnosis_analysis) |
| Primary Diagnoses | 275 | 275 | CALCULATE(COUNTROWS(...), is_primary_diagnosis = TRUE()) |
Derived: 16.4 diagnosis records per admission on average (4,506 ÷ 275 admissions). Exactly one primary diagnosis per admission (275 primary = 275 admissions). Secondary/comorbidity records account for 93.9% of all diagnosis rows.
Three slicers on the left panel cross-filter all KPI cards and charts:
| Slicer | Values |
|---|---|
age_group | 18-34 · 35-49 · 50-64 · 65-79 · 80+ |
gender | F · M |
admission_type | AMBULATORY OBSERVATION · DIRECT EMER. · DIRECT OBSERVATION · ELECTIVE · EU OBSERVATION · EW EMER. · OBSERVATION ADMIT · SURGICAL SAME DAY ADMISSION · URGENT |
Count of rows where is_primary_diagnosis = TRUE, grouped by diagnosis_title.
| Diagnosis | Count |
|---|---|
| Coronary atherosclerosis of native coronary artery | 7 |
| Acute kidney failure, unspecified | 7 |
| Cerebral aneurysm, nonruptured | 4 |
| Non-ST elevation (NSTEMI) myocardial infarction | 4 |
| Aortic valve disorders | 4 |
| Other postoperative infection | 4 |
| Abscess of liver | 3 |
| Acute on chronic systolic heart failure | 3 |
| Encounter for antineoplastic chemotherapy | 3 |
| Acute respiratory failure with hypoxia | 3 |
Total diagnosis record count by diagnosis_title — includes primary and secondary ICD codes.
| Diagnosis | Records | Share |
|---|---|---|
| Unspecified essential hypertension | 68 | 1.5% |
| Hyperlipidemia, unspecified | 57 | 1.3% |
| Acute kidney failure, unspecified | 56 | 1.2% |
| Other and unspecified hyperlipidemia | 55 | 1.2% |
| Hypothyroidism, unspecified | 47 | 1.0% |
| Obesity, unspecified | 43 | 1.0% |
| Anemia, unspecified | 41 | 0.9% |
| Long term (current) use of insulin | 37 | 0.8% |
| Urinary tract infection, site not specified | 36 | 0.8% |
| Personal history of nicotine dependence | 35 | 0.8% |
| Age Group | Female | Male | Total | Share |
|---|---|---|---|---|
| 50–64 | 627 | 1,286 | 1,913 | 42.5% |
| 65–79 | 658 | 615 | 1,273 | 28.3% |
| 80+ | 357 | 214 | 571 | 12.7% |
| 35–49 | 425 | 185 | 610 | 13.5% |
| 18–34 | 115 | 24 | 139 | 3.1% |
Mean LOS at the diagnosis-record level (admission LOS repeated per ICD row). Sorted by highest average stay.
| Diagnosis | Avg LOS (days) |
|---|---|
| Catatonic type schizophrenia, unspecified | 44.93 |
| Foreign body in larynx | 44.93 |
| Inhalation and ingestion of other object causing obstruction… | 44.93 |
| Other alteration of consciousness | 44.93 |
| Acute systolic (congestive) heart failure | 34.08 |
| Diverticulosis of large intestine without perforation… | 34.08 |
| Acute embolism and thrombosis of unspecified deep veins… | 34.08 |
| Takotsubo syndrome | 34.08 |
| Benign neoplasm of descending colon | 34.08 |
| Hypothermia, not associated with low environmental temperature | 34.08 |
| ICD Version | Records | Share |
|---|---|---|
| ICD-10 | 2,313 | 51.3% |
| ICD-9 | 2,193 | 48.7% |
MIMIC-IV spans the ICD-9 to ICD-10 transition; both code sets appear in the demo subset.
| Admission Type | Diagnosis Records | Share |
|---|---|---|
| EW EMER. | 1,853 | 41.1% |
| OBSERVATION ADMIT | 926 | 20.6% |
| URGENT | 708 | 15.7% |
| EU OBSERVATION | 313 | 7.0% |
| DIRECT EMER. | 227 | 5.0% |
Distribution mirrors admission volume from Dashboard 1 — EW EMER. drives the largest share of coded diagnoses.
Each admission carries exactly one primary diagnosis (sequence 1) plus an average of 15.4 secondary codes. This reflects MIMIC's rich ICD coding practice where comorbidities, history codes, and status codes are recorded alongside the admitting condition.
Three measures on this page. Full reference: powerbi/mimic_powerbi_dax_measures.md
Diagnosis Records = COUNTROWS(vw_diagnosis_analysis)
Diagnosed Patients = DISTINCTCOUNT(vw_diagnosis_analysis[patient_id])
Primary Diagnoses =
CALCULATE(
COUNTROWS(vw_diagnosis_analysis),
vw_diagnosis_analysis[is_primary_diagnosis] = TRUE()
)
import pandas as pd
df = pd.read_csv("data/databricks_output/exports/vw_diagnosis_analysis.csv")
assert df["patient_id"].nunique() == 100
assert len(df) == 4506
assert (df["is_primary_diagnosis"].astype(str).str.lower() == "true").sum() == 275
assert df["admission_id"].nunique() == 275
Output: data/databricks_output/exports/diagnosis_analysis.json