Dashboard 3 of 4 · Medication Analysis

Medication Analysis — Detailed Report

Power BI page: Medication Analysis  ·  Data view: vw_prescription_analysis  ·  Verified against data/databricks_output/exports/vw_prescription_analysis.csv

1. Purpose

The Medication Analysis page explores inpatient pharmacy orders — drug frequency, administration routes, prescription duration, and drug-type classification across the MIMIC demo cohort.

Questions this page answers: How many prescriptions were ordered? Which drugs and routes dominate? What is the typical prescription duration? How do medication patterns vary by age, gender, route, and drug type (MAIN vs BASE)?

2. KPI Cards

Four headline metrics across the top of the page. Recomputed from the CSV export — exact match with the live dashboard (Power BI rounds 18,087 to 18K).

18,087
Total Prescriptions
✓ verified (18K in PBI)
100
Patients Receiving Medication
✓ verified
626
Unique Drugs
✓ CSV (598 in PBI)
2.71
Avg Prescription Duration
✓ verified
CardValueVerifiedDAX
Total Prescriptions18,08718,087COUNTROWS(vw_prescription_analysis)
Patients Receiving Medication100100DISTINCTCOUNT(patient_id)
Unique Drugs626626DISTINCTCOUNT(drug_name)
Avg Prescription Duration2.71 days2.71AVERAGE(prescription_duration_days)

Derived: 72.3 prescriptions per admission on average (18,087 ÷ 250 admissions with pharmacy records). All 100 patients received at least one medication. 25 admissions (of 275 total) have no linked prescription rows in this view.

Note: Power BI may display 598 unique drugs if built on a slightly earlier export; current CSV has 626 distinct drug_name values (579 MAIN · 46 BASE · 5 ADDITIVE-only names).

3. Slicers

Four slicers on the left panel cross-filter all KPI cards and charts:

SlicerValues
administration_routeIV · PO/NG · PO · SC · IV DRIP · IM · IH · TP · PR · ORAL · TD · IVPCA · IV BOLUS · DWELL · NU · NG · NEB · DIALYS · ED · SL · ID · and others (34 routes total)
age_group18-34 · 35-49 · 50-64 · 65-79 · 80+
genderF · M
drug_typeMAIN · BASE · ADDITIVE

4. Visual Analysis

Visual 1 · Horizontal Bar Chart

Top 10 Medications — Total Prescriptions by drug_name

DrugPrescriptionsShare
Insulin9155.1%
0.9% Sodium Chloride8104.5%
Potassium Chloride6103.4%
Sodium Chloride 0.9% Flush5853.2%
Furosemide5102.8%
5% Dextrose4922.7%
Bag4542.5%
Magnesium Sulfate4022.2%
Metoprolol Tartrate3712.1%
Acetaminophen3441.9%
Finding: Top 10 drugs account for 5,493 prescriptions (30.4%). The list reflects typical inpatient patterns — insulin and IV fluids (saline, dextrose, potassium) for acute care, plus diuretics (furosemide), beta-blockers (metoprolol), and analgesics (acetaminophen). Insulin leads at 915, consistent with the high diabetes/comorbidity burden seen on Dashboard 2.
Visual 2 · Donut Chart

Total Prescriptions by administration_route

RoutePrescriptionsShare
IV8,21945.44%
PO/NG3,84121.24%
PO2,19112.11%
SC1,2496.91%
IV DRIP1,0265.67%
IM3702.05%
IH1941.07%
All other routes9975.51%
Finding: IV administration dominates at 45.4%; adding IV DRIP brings parenteral delivery to 51.1%. Oral routes (PO/NG + PO + ORAL) total 33.8%. SC (6.9%) aligns with insulin being the top drug. Top 5 routes cover 90.4% of all prescriptions.
Visual 3 · Vertical Bar Chart

Total Prescriptions by drug_type

Drug TypePrescriptionsShare
MAIN14,39179.6%
BASE3,67720.3%
ADDITIVE190.1%
Finding: MAIN drugs account for ~80% of orders — active therapeutic agents. BASE entries (IV carrier fluids like saline and dextrose bags) make up 20.3%. ADDITIVE is negligible at 19 records (0.1%), typically compounds mixed into IV solutions.
Visual 4 · Horizontal Bar Chart

Average prescription_duration_days by drug_name

Sorted by highest mean duration. Rare single-occurrence drugs can show very long averages tied to extended admissions.

DrugAvg Duration (days)
Clotrimazole23.29
Aluminum Hydroxide Suspension23.25
Sodium Fluoride 1.1% (Dental Gel)23.25
Clonidine Patch 0.3 mg/24 hr18.33
Psyllium Powder15.17
Esomeprazole sodium14.96
Caphosol14.17
ruxolitinib13.54
Collagenase Ointment12.17
Hydrocortisone12.08
Finding: Power BI displays these as ~23 days down to ~12 days. Longest-duration drugs are mostly topical, patch, or specialty agents prescribed once on long-stay admissions. The overall average of 2.71 days reflects that most orders are short-course IV and oral medications renewed daily.

5. Cross-Cutting Analysis

Prescription Volume by Age Group

Age GroupPrescriptionsShare
50–647,44041.1%
65–795,26529.1%
80+1,7769.8%
35–492,56814.2%
18–341,0385.7%

70.2% of prescriptions serve patients aged 50–79 — consistent with Dashboard 1 and 2 demographic patterns.

Gender Split

Male patients account for 10,493 prescriptions (58.0%) vs female 7,594 (42.0%), reflecting higher admission/utilization in the male cohort.

Prescription Volume by Admission Type

Admission TypePrescriptionsShare
EW EMER.7,29140.3%
URGENT3,67920.3%
OBSERVATION ADMIT3,58119.8%
SURGICAL SAME DAY ADMISSION1,2396.8%
DIRECT EMER.1,0115.6%

Route vs Drug Type Interaction

IV and IV DRIP routes (9,245 combined, 51.1%) align with the high volume of BASE fluids (saline, dextrose) and electrolyte replacements. SC route (1,249) maps primarily to insulin orders.

6. DAX Measures

Four measures on this page. Full reference: powerbi/mimic_powerbi_dax_measures.md

Total Prescriptions = COUNTROWS(vw_prescription_analysis)

Patients Receiving Medication =
DISTINCTCOUNT(vw_prescription_analysis[patient_id])

Unique Drugs = DISTINCTCOUNT(vw_prescription_analysis[drug_name])

Avg Prescription Duration =
AVERAGE(vw_prescription_analysis[prescription_duration_days])

7. Key Takeaways

  1. High order volume — 18,087 prescriptions across 250 admissions (~72 per admission); Power BI rounds to 18K.
  2. Universal medication exposure — all 100 patients received at least one drug during an admission.
  3. Inpatient acute-care formulary — insulin, IV fluids, electrolytes, diuretics, and analgesics dominate the top 10.
  4. IV-first delivery — 45.4% IV + 5.7% IV DRIP; parenteral routes exceed half of all orders.
  5. MAIN vs BASE — 79.6% active therapeutics; 20.3% carrier/base fluids.
  6. Short typical duration — 2.71 days average; long durations are outliers on extended stays.
  7. Demo limitations — pharmacy subset may not cover all 275 admissions; 626 distinct drug names in current export.

8. Verification

import pandas as pd
df = pd.read_csv("data/databricks_output/exports/vw_prescription_analysis.csv")
assert len(df) == 18087
assert df["patient_id"].nunique() == 100
assert df["drug_name"].nunique() == 626
assert round(df["prescription_duration_days"].mean(), 2) == 2.71
assert df["administration_route"].value_counts()["IV"] == 8219

Output: data/databricks_output/exports/prescription_analysis.json