This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stats and scraper for Macon Code Enforcement Housing Data | |
import datetime | |
prop = open('PROP1.csv', 'r') | |
thisyr = open('cases-2012.csv', 'w') | |
startdate = None | |
enddate = None | |
casespan = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Predict Cases | |
# Prepare housing cases CSV for Google Prediction API | |
# Now associates a case with where it is in three more years, not the ultimate result | |
# for example | |
# "Some", 19960909, Cut and Cleared | |
# "None", 19980101, Cut and Cleared | |
# "None", 19980202, No Violations (not predicted by previous because there were no violations) | |
# "Demolished", 20020808, Repaired (prediction should be demolished because demo comes in < 3 years) | |
# "Demolished", 20030101, Demolished |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'Soothsayer' | |
Soothsayer.config do |c| | |
# get keys from http://rubydoc.info/gems/soothsayer/0.0.3/frames | |
c.client_id = "" | |
c.client_secret = "" | |
c.access_token = "" | |
c.refresh_token = "" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Go through a CSV file of addresses | |
# Find each address in a KML file | |
# Add the coordinates to the CSV file if a match is found | |
# Add Geostuff to addresses | |
cases = open('PROP1Cleanest.csv', 'r') | |
geocases = open('allcasesplusgeo.csv', 'w') | |
lastgeo = [ ] | |
geobyaddress = { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bus TimeTabler from My Tracks GPS App | |
# Imports CSV of Bus GPS points and KML of Bus Stops along a route. | |
# Helps create a complete timetable by recording when selected vehicles on this route approach the stop | |
import datetime | |
# import a day's worth of bus tracks | |
bustrackfile = open('Bus13.csv', 'r') | |
bustrack = [ ] | |
for line in bustrackfile: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOTE: This how-to was written for the Census API at http://thedataweb.rm.census.gov/ -- it has since been moved to http://api.census.gov/ | |
Mike Stucka, our contact at the Macon Telegraph, sent us a link to the Census's official API which is launching next month. You can skip ahead to the site - http://www.census.gov/developers/ - and get an API key, but also read my notes after using this yesterday: | |
1) The datasets | |
--- The 2010 Census Summary comes from everyone filling out census forms, and you can get stats at state level down to a super-detailed block level. Info from this includes population, age, gender, race, home ownership, members of a household, and various combinations of that. Full list: http://www.census.gov/developers/data/sf1.xml | |
--- The 2006-2010 American Community Survey is a longer form given to fewer households over 5 years (so its numbers are incompatible with the 2010 Census). You can get stats down only to the block group level. In addition to the standard census stats, you get: educa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reader.py | |
# RFID / NFC Card Reader | |
# For adding names to each card and reading them out loud | |
import sys, os | |
# test if pyserial library is installed | |
try: | |
import serial | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CfA Liberty Bell Project | |
var http = require('http'); | |
var five = require("johnny-five"); | |
var board = new five.Board(); | |
board.on("ready", function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Column Populator Script for QGIS | |
# We have a lot of RouteNames in one column, and we want that to translate into other columns | |
# For example, RouteName=Ocmulgee should set Route5=1 and leave all others NULL | |
from PyQt4 import QtCore | |
activeLayer = qgis.utils.iface.activeLayer() | |
layerData = activeLayer.dataProvider() | |
columns = layerData.fields() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Multi-Column Populator for QGIS | |
# Go through a huge String of bus stops and the buses which stop there | |
# Set Route1 = 1 wherever that route stops | |
# Set Route2 = 1 wherever that route stops | |
# and so on | |
from PyQt4 import QtCore | |
# populate dictionary of points based on the OBJECTID attribute used to identify the bus stop | |
pts_by_id = { } |