Provider Analytics Path · Mission 20 of 25Hard

Provider complication rates

Calculate rates with HAVING filter and handle sensitive data awareness

Back to Provider Analytics

The Brief

Dr. Linda NguyenChief Medical Officerslack-dm

Before you share this with ANYONE — this is sensitive. For each active provider, show their complication rate per 100 encounters. Only include providers with at least 20 encounters so we're not flagging someone over 2 cases. Show name, specialty, encounter count, complications, and rate. Exclude inactive providers — some still have encounters in the system.

You'll practice

Correlated subqueryHAVINGRate calc

Tables & columns available

dim_providersdim7 columns
ColumnTypeKey
provider_idINTPK
first_nameTEXT
last_nameTEXT
specialtyTEXT
department_idINTFK → dim_departments
hire_dateTEXT
is_activeINT
fact_encountersfact10 columns
ColumnTypeKey
encounter_idINTPK
patient_idINTFK → dim_patients
provider_idINTFK → dim_providers
department_idINTFK → dim_departments
admit_dateTEXT
discharge_dateTEXT
diagnosis_codeTEXT
diagnosis_descriptionTEXT
encounter_typeTEXT
discharge_dispositionTEXT
fact_quality_metricsfact7 columns
ColumnTypeKey
metric_idINTPK
encounter_idINTFK → fact_encounters
patient_idINTFK → dim_patients
metric_typeTEXT
metric_valueREAL
measurement_dateTEXT
reported_byTEXT

Hints (3)

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

Hint 1

Three tables: provider → encounter → quality metric. Filter to active providers and the complication metric type before aggregating

Hint 2

Rate per 100 = complications ÷ encounters × 100. Post-aggregation volume filter belongs in HAVING, not WHERE

Hint 3

`ROUND(100.0 * SUM(CASE WHEN qm.metric_value = 1 THEN 1 ELSE 0 END) / COUNT(DISTINCT e.encounter_id), 1)` — add `HAVING COUNT(DISTINCT e.encounter_id) ___ 20`