Closed SPTKL closed 3 years ago
select
*
from (
select
a.census_geoid,
a.geoid,
a.pff_variable,
a.c, a.e, a.m, a.p, a.z,
b.c as _c, b.e as _e, b.m as _m, b.p as _p, b.z as _z
from (
select *, (CASE WHEN LEFT(a.census_geoid, 5) = '36005' THEN 2
WHEN LEFT(a.census_geoid, 5) = '36047' THEN 3
WHEN LEFT(a.census_geoid, 5) = '36061' THEN 1
WHEN LEFT(a.census_geoid, 5) = '36081' THEN 4
WHEN LEFT(a.census_geoid, 5) = '36085' THEN 5
END)||RIGHT(a.census_geoid, 6) as geoid
from pff_acs."2018-test" a
where a.geotype = 'tract'
) a
join pff_acs."2018" b
on a.pff_variable = lower(b.variable)
and a.geoid = b.geoid
and b.geotype = 'CT2010'
) a
where e <> _e or m <> _m;
need to fix at one point
https://github.com/NYCPlanning/db-factfinder/blob/21738bd3adea05185b6c478aec502e466fa9df89/factfinder/main.py#L380-L383 we would need to add a logic to direct ('wrkrnothm', 'tract') to calculate_special_e_m
if not (
( v.pff_variable in self.special_variables
and geotype in self.aggregated_geography )
or (v.pff_variable == 'wrkrnothm')
)
@SPTKL Why do the other special calculations only apply to aggregated geographies?
resolved
instead of addition, this specific variable uses subtraction NYCPlanning/db-acs/issues/11