Some queries for reference.
select count(pid) from lists where diagnosis="ICD10:I10";
// How many patients have a diagnosis of Hypertension result: 1882
select count(distinct form_vitals.pid) from form_vitals JOIN lists on lists.pid = form_vitals.pid WHERE diagnosis="ICD10:I10" and (bps>140 or bpd>90);
// How many of those patients had BP readings "worse than 140/90"
Result: 671
select patient_data.ss as seqn,bps,bpd,form_vitals.date from form_vitals JOIN lists on lists.pid = form_vitals.pid JOIN patient_data ON patient_data.pid=form_vitals.pid WHERE diagnosis="ICD10:I10" and (bps>140 or bpd>90);
// Who were those patients who missed the goal and what were their BP readings
So for our population, on NQF 0018, Controlling Hypertension, we have a numerator of 1211 and a denominator of 1882 for which patients with hypertension have their BP controlled.
Then, looking at who didn’t have a diagnosis of hypertension but did have bp readings worse than 140/90.
select patient_data.ss as seqn ,fname, lname, bps,bpd,form_vitals.date from form_vitals, patient_data WHERE patient_data.pid = form_vitals.pid AND (bps>140 or bpd>90) and form_vitals.pid NOT in (select pid from lists where diagnosis="ICD10:I10")
and how many
select count(distinct pid) from form_vitals WHERE (bps>140 or bpd>90) and form_vitals.pid NOT in (select pid from lists where diagnosis="ICD10:I10");
// 430 Patients had readings of worse than 140/90 but answered "no" for both "Told had high blood pressure - 2+ times" or "Being Precribed meds for HTN"
The first patient in this list is Timothy Burke SEQN 62177. I cross referenced the answers in the original NHANES data (bpq_g) and he indeed answered no for all the questions.