Open michellemho opened 7 years ago
Update: Matt was able to find the correct variable for Brazil total population. That variable is br.data.Responsavel02_V001
"Responsible People".
The code we used to bring in that variable (and other variables for literate people of certain age groups):
WITH meta AS (SELECT OBS_GetMeta(
st_makeenvelope(-47.28,-23.87,-45.97,-23.28, 4326),
'[{"geom_id": "br.geo.setores_censitarios"},
{"numer_id": "br.data.Responsavel02_V096", "normalization": "prenormalized", "numer_timespan": "2010"},
{"numer_id": "br.data.ResponsavelRenda_V022", "normalization": "prenormalized", "numer_timespan": "2010"},
{"numer_id": "br.data.Responsavel02_V001", "normalization": "prenormalized", "numer_timespan": "2010"}]'
) meta)
INSERT INTO brazil_data (the_geom, name, responsavel02_v096, ResponsavelRenda_V022, Responsavel02_V001)
SELECT (data->0->>'value')::Geometry the_geom,
(data->0->>'geomref') geomref,
(data->1->>'value')::Numeric,
(data->2->>'value')::Numeric,
(data->3->>'value')::Numeric
FROM OBS_GetData(
Array[(ST_makeenvelope(-47.28,-23.87,-45.97,-23.28, 4326), 1)::geomval],
(SELECT meta FROM meta), false)
@mbforr had a request for Total Population in Brazil. Basic variables like "Total population" appear to be missing.
Solution: 1) Find whether the variable for total population (and other basic variables like total households) exists in the Brazil census and were somehow missed in the ETL process; or 2) Aggregate subgroups to calculate totals. For example, sum all the population by age groups to obtain total population.