Skip to content

Instantly share code, notes, and snippets.

View ryanpitts's full-sized avatar

Ryan Pitts ryanpitts

View GitHub Profile
from __future__ import division
from math import ceil
from importd import d
d(INSTALLED_APPS=["django.contrib.humanize"])
AGE_GENDER_GROUPS = [
{'0-10': {
'M': 244,
'F': 256,
}},
{
"0-9 percentage":{
"53007":12.4,
"53063":13.0,
"53057":12.5,
"53061":13.4,
"53073":10.9,
"53041":12.0,
"53053":13.5,
"53009":10.1,
GEOGRAPHIES_MAP = {
'nation': {
'parent': None,
'children': 'regions, zctas, urban areas, cbsas',
'descendants': 'regions, zctas, urban areas, cbsas, divisions, states, school districts, congressional districts, urban growth areas, state legislative districts, public use microdata areas, places, counties, voting districts, traffic analysis zones, county subdivisions, subminor civil divisions, census tracts, block groups, census blocks'
},
'regions': {
'parent': 'nation',
'children': 'divisions',
'descendants': 'divisions, states, school districts, congressional districts, urban growth areas, state legislative districts, public use microdata areas, places, counties, voting districts, traffic analysis zones, county subdivisions, subminor civil divisions, census tracts, block groups, census blocks'
@ryanpitts
ryanpitts / geography_profile.json
Last active December 17, 2015 21:29
revised template for geography_profile.json
{
"geography": {
"sumlev": null, // summary level of this geography
"census_name": null, // official name from census data
"pretty_name": null, // our version of name, e.g. 'Cook County, Illinois'
"stusab": null, // state code
"total_population": null, // total population here, standard place to fetch for calculations
"land_area": null, // from TIGER data
"census_release": null // release from which this data is drawn, e.g. 'ACS 2011 5-year'
},
@ryanpitts
ryanpitts / sumlevs.json
Last active December 17, 2015 22:09
Summary Levels
[
{
"pk": 1,
"model": "census.summarylevel",
"fields": {
"parent": null,
"plural_name": "",
"description": "",
"short_name": "",
"census_code_description": "",
@ryanpitts
ryanpitts / table-search.json
Last active December 19, 2015 20:49
example json for table-search api endpoint
{
# TABLE MATCH
{
"table_id": "B01001",
"text": "Table: SEX BY AGE",
"table_name": "SEX BY AGE",
"topics": "age, gender",
"type": "table",
"id": "B01001"
},
@ryanpitts
ryanpitts / podcast subscriptions
Created August 26, 2013 17:00
Podcasts I listen to. Send me your recommendations!
99% Invisible
A Life Well Wasted
Benjamen Walker's Theory of Everything
The Memory Palace
Night Vale Radio
NPR: All Songs Considered
NPR: How To Do Everything
NPR: Planet Money
NPR: Story of the Day
Radiolab
@ryanpitts
ryanpitts / The Five Cognitive Distortions of People Who Get Stuff Done
Created September 12, 2013 17:32
Notes from Michael Dearing's "The Five Cognitive Distortions of People Who Get Stuff Done," so I don't need to look through slides every time. Source: http://quarry.stanford.edu/xapm1111126lse/docs/02_LSE_Cognitive.pdf
Five recurring, automatic patterns of thought (aka cognitive distortions) among people who get extraordinary stuff done in Silicon Valley.
1. Personal Exceptionalism: "I am special."
Definition: a macro sense that you are in the top of your cohort, your work is snowflake special, or that you are destined to have experiences well outside the bounds of "normal;" not to be confused with arrogance or high self-esteem
Benefit: resilience, stamina, charisma
Deadly risk: assuming macro exceptionalism means micro exceptionalism, brittleness
@ryanpitts
ryanpitts / data_journalism_rules_ire
Created October 30, 2013 19:46
IRE: Ten irrefutable and nonnegotiable rules of responsible data journalism
Ten irrefutable and nonnegotiable rules of responsible data journalism
http://ire.org/blog/ire-news/2013/10/25/ten-irrefutable-and-nonnegotiable-rules-responsibl/
1. Remember to refer to data as plural, unless you find it annoying (and I do).
2. Always save a copy of the original data. Keep it somewhere safe. Never mess with it.
3. Understand the data before you touch it. Read any available documentation, go through the record layout, talk to the agency that keeps and/or created the data.
4. Assume nothing about your data: what’s in it, what’s not in it, what that ambiguous “date” field refers to; nothing.
{
"geography": {
"total_population": 209504,
"census_release": "ACS 2011 5-year",
"short_name": "Spokane",
"land_area": 178021482,
"sumlevel": "160",
"full_name": "Spokane, WA"
},
"demographics": {