Clinical Operations Analytics Path · Mission 6 of 25Medium

Translate every diagnosis on the chart

First two-table INNER JOIN. Connect fact_diagnoses to dim_icd on icd_code and produce a readable chart-view of every documented diagnosis. Builds the foundational terminology join with no aggregation in the way.

The Brief

Devin ChoClinical Informatics Leadslack-dm

Quick ad-hoc — the EHR vendor's pulling a sample export for the new analytics platform PoC and they want the diagnosis log in human-readable form, not raw codes. Pull every row from fact_diagnoses and join dim_icd so each diagnosis shows the encounter_id, the icd_code, the description, the CCSR category, and the dx_type. Sort by encounter_id and then dx_rank so the chart for each encounter reads top-to-bottom (Principal first, then secondaries).

You'll practice

INNER JOIN2-table SELECTORDER BY

Tables & columns available

fact_diagnosesfact6 columns
ColumnTypeKey
diagnosis_idINTPK
encounter_idINTFK → fact_encounters
icd_codeTEXTFK → dim_icd
dx_typeTEXT
poa_indicatorTEXT
dx_rankINT
dim_icddim7 columns
ColumnTypeKey
icd_codeTEXTPK
icd_descriptionTEXT
ccsr_categoryTEXT
ccsr_descriptionTEXT
body_systemTEXT
is_chronicINT
hcc_flagINT

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

INNER JOIN fact_diagnoses to dim_icd on icd_code. The match column has the same name in both tables — use a table alias and `ON fd.icd_code = d.icd_code`.

Hint 2

Five columns out: encounter_id, icd_code, icd_description, ccsr_description, dx_type. No filters; the export wants every row.

Hint 3

ORDER BY encounter_id, dx_rank. Within each encounter, dx_rank=1 (Principal) leads, then secondaries 2, 3, etc.