argo-marketplace / Constituent-Data-Collaborative

Imagining an evolution of data.gov that revolves around a Data Collaborative approach to link open data generated at the local level to better empower constituents to lobby their electeds.
https://twitter.com/vr00n/status/1070009392823582727
1 stars 0 forks source link

Leveraging US Census API via Narrative Profiles #3

Open vr00n opened 5 years ago

vr00n commented 5 years ago

https://www.census.gov/acs/www/data/data-tables-and-tools/narrative-profiles/2017/ is a Beta feature that converts census data to readable narratives about a specific census geography.

Currently it supports only these census geos image

BUT I was able to take a look under the hood and generate the API calls to return data by Congressional Districts!!!

Example: to the site uses this api call to retrieve data about Occupied Housing Characteristics for a census tract and populate that section on the page for that census tract.

This is the URL of that API call

https://api.census.gov/data/2017/acs/acs5/profile?key=fd901c69fb4729a262b7e163c1db69737513827d&get=DP02_0001E%2CDP02_0015E%2CDP02_0002PE%2CDP02_0004PE%2CDP02_0009PE%2CDP02_0010PE%2CDP02_0013PE%2CDP02_0014PE%2CDP02_0026PE%2CDP02_0032PE%2CDP02_0043E%2CDP02_0044PE%2CDP02_0025PE%2CDP02_0026PE%2CDP02_0027PE%2CDP02_0028PE%2CDP02_0029PE%2CDP02_0031PE%2CDP02_0032PE%2CDP02_0033PE%2CDP02_0034PE%2CDP02_0035PE%2CDP02_0002PE%2CDP02_0004PE%2CDP02_0010PE%2CDP02_0011PE%2CDP02_0087PE%2CDP02_0089PE%2CDP02_0092PE%2CDP02_0094PE%2CDP02_0102PE%2CDP02_0104PE%2CDP02_0105PE%2CDP02_0106PE%2CDP02_0107PE%2CDP02_0108PE%2CDP02_0109PE%2CDP02_0112PE%2CDP02_0114PE%2CDP02_0113PE%2CDP02_0114PE%2CDP02_0116PE%2CDP02_0118PE%2CDP02_0120PE%2CDP02_0079PE%2CDP02_0079PE%2CDP02_0081PE%2CDP02_0083PE%2CDP02_0084PE%2CDP02_0085PE&for=tract%3A011900&in=state%3A36+county%3A081

However, changing the last few URL params to: &for=congressional%20district%3A14&in=state%3A36 gives us values for congressional districts for the 14th district in state=36 (NY)

So we can now create narrative profiles for Congressional Districts!!!

christophertull commented 5 years ago

Interesting... so that gives us the raw data, and then we would need to copy the front-end code to replicate the report? Or just mess with the page source to plug in the appropriate query?

vr00n commented 5 years ago

Exactly. Im not enough of a front end programmer to reverse engineer that bit but it seems standardized text - so just need to plug in the numbers.

vr00n commented 5 years ago

...and here's the master list of variables!

https://api.census.gov/data/2017/acs/acs5/profile/variables/

I just tried for single variable "DP02_0065PE", "Percent!!EDUCATIONAL ATTAINMENT!!Graduate or professional degree" and received a result.

So we can create customized reports!

https://api.census.gov/data/2017/acs/acs5/profile?key=fd901c69fb4729a262b7e163c1db69737513827d&get=DP02_0065PE&for=congressional%20district%3A14&in=state%3A36

patwater commented 5 years ago

Any noteworthy takeaways so far?

vr00n commented 5 years ago

Here is a look at NY 14 where it features in top-3 and bottom-3 compared to all other NY CDs https://docs.google.com/spreadsheets/d/e/2PACX-1vS-aiZVt79sEY_9EECR2RTEm79hL0fJ9u5v-KhCoSoBOWBi_EAQZUL5yqprq4LN2mmK2PFv637s0Kir/pubhtml?gid=1453527182&single=true

Measure % value NY 14's RANK
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!Civilian noninstitutionalized population 19 to 64 years!!In labor force!!Employed!!No health insurance coverage 22 1
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!Civilian noninstitutionalized population 19 to 64 years!!Not in labor force!!No health insurance coverage 19.9 1
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!No health insurance coverage 15.2 1
Percent Estimate!!HISPANIC OR LATINO AND RACE!!Total population!!Hispanic or Latino (of any race)!!Mexican 9.1 1
Percent Estimate!!HOUSEHOLDS BY TYPE!!Total households!!Family households (families)!!Male householder no wife present family 8.2 1
Percent Estimate!!HOUSEHOLDS BY TYPE!!Total households!!Family households (families)!!Male householder no wife present family!!With own children of the householder under 18 years 3.1 1
Percent Estimate!!INDUSTRY!!Civilian employed population 16 years and over!!Arts entertainment and recreation and accommodation and food services 15.7 1
Percent Estimate!!LANGUAGE SPOKEN AT HOME!!Population 5 years and over!!Language other than English 68.3 1
Percent Estimate!!RACE!!Total population!!One race!!Native Hawaiian and Other Pacific Islander 0.1 1
Percent Estimate!!SEX AND AGE!!Total population!!35 to 44 years 15.3 1
Percent Estimate!!UNITS IN STRUCTURE!!Total housing units!!Boat RV van etc. 0.1 1
Percent Estimate!!ANCESTRY!!Total population!!Greek 1.6 2
Percent Estimate!!HISPANIC OR LATINO AND RACE!!Total population!!Hispanic or Latino (of any race)!!Cuban 0.7 2
Percent Estimate!!INDUSTRY!!Civilian employed population 16 years and over!!Construction 7.9 2
Percent Estimate!!INDUSTRY!!Civilian employed population 16 years and over!!Other services except public administration 6.6 2
Percent Estimate!!LANGUAGE SPOKEN AT HOME!!Population 5 years and over!!Language other than English!!Speak English less than very well 35.7 2
Percent Estimate!!OCCUPANTS PER ROOM!!Occupied housing units!!1.51 or more 5.1 2
Percent Estimate!!PLACE OF BIRTH!!Total population!!Foreign born 46.2 2
Percent Estimate!!Race alone or in combination with one or more other races!!Total population!!Native Hawaiian and Other Pacific Islander 0.3 2
Percent Estimate!!RACE!!Total population!!One race!!Asian!!Filipino 1.7 2
Percent Estimate!!RACE!!Total population!!One race!!Asian!!Other Asian 4.4 2
Percent Estimate!!RELATIONSHIP!!Population in households!!Other relatives 13.5 2
Percent Estimate!!SELECTED MONTHLY OWNER COSTS (SMOC)!!Housing units without a mortgage!!$800 to $999 22.9 2
Percent Estimate!!SEX AND AGE!!Total population!!18 years and over!!Male 50 2
Percent Estimate!!SEX AND AGE!!Total population!!Male 50.4 2
Percent Estimate!!EDUCATIONAL ATTAINMENT!!Population 25 years and over!!Less than 9th grade 14.2 3
Percent Estimate!!GROSS RENT!!Occupied units paying rent!!$1 000 to $1 499 41 3
Percent Estimate!!GROSS RENT!!Occupied units paying rent!!$1 500 to $1 999 30.8 3
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!Civilian noninstitutionalized population 19 to 64 years!!In labor force!!Unemployed!!No health insurance coverage 25.1 3
Percent Estimate!!HISPANIC OR LATINO AND RACE!!Total population!!Hispanic or Latino (of any race) 49 3
Percent Estimate!!HISPANIC OR LATINO AND RACE!!Total population!!Hispanic or Latino (of any race)!!Other Hispanic or Latino 29.5 3
Percent Estimate!!INCOME AND BENEFITS (IN 2017 INFLATION-ADJUSTED DOLLARS)!!Families!!$25 000 to $34 999 10.6 3
Percent Estimate!!INCOME AND BENEFITS (IN 2017 INFLATION-ADJUSTED DOLLARS)!!Families!!$35 000 to $49 999 13.8 3
Percent Estimate!!INCOME AND BENEFITS (IN 2017 INFLATION-ADJUSTED DOLLARS)!!Total households!!$50 000 to $74 999 19.1 3
Percent Estimate!!LANGUAGE SPOKEN AT HOME!!Population 5 years and over!!Spanish 42.8 3
Percent Estimate!!LANGUAGE SPOKEN AT HOME!!Population 5 years and over!!Spanish!!Speak English less than very well 22.7 3
Percent Estimate!!OCCUPANTS PER ROOM!!Occupied housing units!!1.01 to 1.50 7.6 3
Percent Estimate!!OCCUPATION!!Civilian employed population 16 years and over!!Service occupations 27.4 3
Percent Estimate!!Race alone or in combination with one or more other races!!Total population!!Some other race 23.9 3
Percent Estimate!!RACE!!Total population!!One race!!Asian!!Asian Indian 4 3
Percent Estimate!!RACE!!Total population!!One race!!Asian!!Vietnamese 0.3 3
Percent Estimate!!RACE!!Total population!!One race!!Some other race 22.6 3
Percent Estimate!!ROOMS!!Total housing units!!3 rooms 28.1 3
Percent Estimate!!SELECTED MONTHLY OWNER COSTS AS A PERCENTAGE OF HOUSEHOLD INCOME (SMOCAPI)!!Housing units with a mortgage (excluding units where SMOCAPI cannot be computed)!!35.0 percent or more 44 3
Percent Estimate!!U.S. CITIZENSHIP STATUS!!Foreign-born population!!Not a U.S. citizen 54.4 3
Percent Estimate!!UNITS IN STRUCTURE!!Total housing units!!3 or 4 units 15.7 3
Percent Estimate!!ANCESTRY!!Total population!!French (except Basque) 0.4 25
Percent Estimate!!EDUCATIONAL ATTAINMENT!!Population 25 years and over!!Graduate or professional degree 9.1 25
Percent Estimate!!GROSS RENT!!Occupied units paying rent!!Less than $500 4.8 25
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!Civilian noninstitutionalized population 19 to 64 years!!In labor force!!Unemployed!!With health insurance coverage 74.9 25
Percent Estimate!!INDUSTRY!!Civilian employed population 16 years and over!!Educational services and health care and social assistance 21.8 25
Percent Estimate!!PLACE OF BIRTH!!Total population!!Native!!Born in United States!!State of residence 44 25
Percent Estimate!!U.S. CITIZENSHIP STATUS!!Foreign-born population!!Naturalized U.S. citizen 45.6 25
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!Civilian noninstitutionalized population 19 to 64 years!!In labor force!!Employed!!With health insurance coverage 78 26
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!Civilian noninstitutionalized population 19 to 64 years!!In labor force!!Employed!!With health insurance coverage!!With private health insurance 61.9 26
Percent Estimate!!OCCUPANTS PER ROOM!!Occupied housing units!!1.00 or less 87.2 26
Percent Estimate!!OCCUPATION!!Civilian employed population 16 years and over!!Management business science and arts occupations 29.1 26
Percent Estimate!!PLACE OF BIRTH!!Total population!!Native 53.8 26
Percent Estimate!!PLACE OF BIRTH!!Total population!!Native!!Born in United States 49.4 26
Percent Estimate!!SEX AND AGE!!Total population!!18 years and over!!Female 50 26
Percent Estimate!!SEX AND AGE!!Total population!!Female 49.6 26
Percent Estimate!!EMPLOYMENT STATUS!!Females 16 years and over!!In labor force!!Civilian labor force!!Employed 0 27
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!Civilian noninstitutionalized population 19 to 64 years!!Not in labor force!!With health insurance coverage 80.1 27
Percent Estimate!!HEALTH INSURANCE COVERAGE!!Civilian noninstitutionalized population!!With health insurance coverage 84.8 27
Percent Estimate!!LANGUAGE SPOKEN AT HOME!!Population 5 years and over!!English only 31.7 27
Percent Estimate!!Race alone or in combination with one or more other races!!Total population!!Black or African American 0 27
christophertull commented 5 years ago

Awesome... seems like there are lots of non-obvious findings in that list besides just "asian and lower income"

vr00n commented 5 years ago

Hey @christophertull i just found out that the vars i used were from 2011 and not 2017 census. I just updated my comment above

@patwater, I had to delete the tweet :/