Skip to content

Instantly share code, notes, and snippets.

View lukemckinstry's full-sized avatar

Luke McKinstry lukemckinstry

  • Philadelphia, PA
View GitHub Profile
@lukemckinstry
lukemckinstry / jitter-demo.py
Created July 17, 2019 18:00
Jitter overlapping points, plot in an evenly spaced circle around the original center
#jitter overlapping points, plot in an evenly spaced circle around the original center
import math
def geo_jitter(points_to_jitter):
for i in range(len(points_to_jitter)):
r = .01
angle = 0 + ((360/len(points_to_jitter)) * i)
@lukemckinstry
lukemckinstry / gather-ocdid-entities.py
Last active June 3, 2021 14:07
gathers a hierarchical tree of entities in a list of open civic data identifiers
import csv
import json
import pprint
pp = pprint.PrettyPrinter(indent=4)
# setup:
# download the identifiers file for target country directly from the
# open civic identifiers public data repo:
# https://github.com/opencivicdata/ocd-division-ids/tree/master/identifiers
COUNTRY_SOURCE_FILE = 'country-us.csv'
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
election country state original date status rescheduled date
Clearwater City Council US FL 2020-03-17 held-as-planned
Gainesville City Commission US FL 2020-03-17 held-as-planned
Naples Mayor and City Council US FL 2020-03-17 held-as-planned
Pembroke Pines City Commission US FL 2020-03-17 held-as-planned
Pennsylvania House Special Election (D-8, 18 & 58) US PA 2020-03-17 held-as-planned
Cambridge City Council (D-7) Special Election CA ON 2020-03-23 postponed TBD
Massachusetts House Special Election US MA 2020-03-31 changed 2020-06-02
Massachusetts Senate Special Election US MA 2020-03-31 changed 2020-05-19
Columbia City Council US MO 2020-04-07 changed 2020-06-02
City Pop. Status
Los Angeles, CA 3,976,322 Already Districted
San Diego, CA 1,394,928 Already Districted
San Jose, CA 1,026,908 Already Districted
San Francisco, CA 864,816 Already Districted
Fresno, CA 520,052 Already Districted
Sacramento, CA 490,712 Already Districted
Long Beach, CA 474,140 Already Districted
Oakland, CA 419,267 Already Districted
Bakersfield, CA 373,640 Already Districted
AK,2,ALASKA
AL,1,ALABAMA
AR,5,ARKANSAS
AS,60,AMERICAN SAMOA
AZ,4,ARIZONA
CA,6,CALIFORNIA
CO,8,COLORADO
CT,9,CONNECTICUT
DC,11,DISTRICT OF COLUMBIA
DE,10,DELAWARE
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path {
stroke-width: 1px;
stroke: #444;
}
text {