Clinical Operations Analytics Path · Mission 9 of 25Medium

Top 10 chronic conditions

JOIN + WHERE on a flag column from the joined dim table + GROUP BY + LIMIT. Prepares the cohort-on-flag pattern that the Master M22 (HF-as-principal) and M25 (chronic burden capstone) build on.

The Brief

Priya KumarCare Management Leadslack-dm

Chronic-disease registry roster prep. Pull our top 10 most-documented chronic conditions — code, description, and the count of times we've documented each. Filter on the is_chronic flag in dim_icd, not on a list of codes (that flag is the source of truth; hand-rolled lists drift). Order by count descending. The roster lead I get from this drives the proactive-outreach call list for the next quarter.

You'll practice

JOINWHERE flag = 1GROUP BYLIMIT

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

JOIN fact_diagnoses to dim_icd as before. WHERE d.is_chronic = 1 — that's the filter on the joined table.

Hint 2

GROUP BY d.icd_code, d.icd_description. COUNT(*) AS dx_count.

Hint 3

ORDER BY dx_count DESC, LIMIT 10. Three columns: icd_code, icd_description, dx_count. Same skeleton as M7 with one added WHERE clause.