Closed mgraber closed 2 years ago
SELECT * FROM (
select
a.census_geoid,
a.pff_variable,
a.e, b.e as e_sample,
(CASE WHEN b.e != 0 THEN abs((a.e-b.e)/b.e) END) as e_diff_pct,
a.m, b.m as m_sample,
(CASE WHEN b.m != 0 THEN abs((a.m-b.m)/b.m) END)as m_diff_pct,
a.p, b.p as p_sample,
(CASE WHEN b.p != 0 THEN abs((a.p-b.p)/b.p) END) as p_diff_pct,
a.z, b.z as z_sample,
(CASE WHEN b.z != 0 THEN abs((a.z-b.z)/b.z) END) as z_diff_pct
from pff_acs."staging-Y2019-G2010_to_2020" a
LEFT JOIN pff_acs."sample-Y2019-G2010_to_2020" b
ON a.pff_variable = b.pff_variable
AND a.census_geoid = b.census_geoid
) a WHERE e_diff_pct > 0.1 or m_diff_pct > 0.1 or p_diff_pct > 0.1 or z_diff_pct > 0.1
and a.pff_variable not like 'avg%';
this one is for detecting places where we are missing values in e,m,p,z
SELECT * FROM ( select a.census_geoid, a.pff_variable, a.e, b.e as e_sample, a.m, b.m as m_sample, a.p, b.p as p_sample, a.z, b.z as z_sample from pff_acs."staging-Y2010-G2010_to_2020" a LEFT JOIN pff_acs."sample-Y2010-G2010_to_2020" b ON a.pff_variable = b.pff_variable AND a.census_geoid = b.census_geoid ) a WHERE (e IS NULL and e_sample is not NULL) OR (m IS NULL and m_sample is not NULL) OR (p IS NULL and p_sample is not NULL) OR (z IS NULL and z_sample is not NULL) ;
Variables that aren't flagged as not in profile in 2018 meta, but where we're getting non-NULL p and z & sample has NULL p & z for 2019:
Variables that aren in profile in 2010 meta, but where we're getting non-NULL p and z & sample has NULL p & z for 2010:
Queries for QAQC