Practice the cohort-then-comorbidity pattern: first identify a patient population by their principal diagnosis, then aggregate the secondary diagnoses on those same encounters. This is the core HCC-recapture / risk-adjustment query run quarterly at every ACO and Medicare Advantage plan.