Skip to content

Instantly share code, notes, and snippets.


Julie Goldberg JulieGoldberg

View GitHub Profile
JulieGoldberg / censusreporter_acs_tables_to_user_friendly_tables.sql
Created May 27, 2020
Approach for pulling ACS data from CensusReporter database into user-friendly tables in our own schema. By using the ACS documentation, this approach can be used to pull a lot of other sorts of data in useful ways.
View censusreporter_acs_tables_to_user_friendly_tables.sql
--DROP SCHEMA IF EXISTS acs2018_5yr_extraction CASCADE;
CREATE SCHEMA acs2018_5yr_extraction;
CREATE TABLE acs2018_5yr_extraction.population__bg_tract_county AS (
SELECT gh.sumlevel, CONCAT(state, county, tract, blkgrp) AS geoid, b01003001 AS population, stusab
FROM acs2018_5yr.geoheader gh
JOIN acs2018_5yr.b01003 b
ON gh.geoid = b.geoid
WHERE gh.sumlevel = 150
JulieGoldberg / GroupedModelChoiceField
Created Apr 9, 2015
Display OptGroup options from a Django ModelChoiceField
View GroupedModelChoiceField
from django import forms
class GroupedModelChoiceField(forms.ModelChoiceField):
def optgroup_from_instance(self, obj):
return ""
def __choice_from_instance__(self, obj):
return (, self.label_from_instance(obj))
JulieGoldberg / DynamicLayersTileServer
Last active Dec 25, 2015
A decorator around the WSGITileServer that allows for custom tilestache configuration.
View DynamicLayersTileServer
from TileStache import WSGITileServer, splitPathInfo
import re
# Decorator for the WSGITileServer that allows for custom tilestache configuration.
# Takes in a tilestache config file and a series of parameter names. Any that are present will be sent to the
# provider and the cache classes on each call.