Giter Site home page Giter Site logo

weeksie / agitate Goto Github PK

View Code? Open in Web Editor NEW
2.0 8.0 0.0 5.25 MB

Our aim here is not to solve partisan redistricting on our own. Rather, it is to give people the tools they need to do it themselves.

JavaScript 1.28% Elixir 2.87% CSS 0.33% HTML 0.03% Ruby 0.26% Shell 0.03% PLpgSQL 95.20%

agitate's Introduction

Agitate

First set up your development config files. For the default case this is:

cp config/dev.example.exs config/dev.exs
cp config/test.example.exs config/test.exs

Edit as necessary to fit your local environment.

# Configure your database
config :agitate, Agitate.Repo,
  adapter: Ecto.Adapters.Postgres,
  types: Agitate.PostgresTypes,
  username: "weeksie",
  database: "agitate_test",
  hostname: "localhost",
  pool: Ecto.Adapters.SQL.Sandbox

Now make sure your database is up to date

mix ecto.create
mix ecto.migrate

Make sure PostGIS is installed (http://postgis.net/install/) but really, you'll probably just do a brew install postgis. Then run the migrations mix ecto.migrate

Import Zipcode Shapefiles

Download zip shapes from www2.census.gov

Sure would like to get zip codes in 20m format but the only thing they seem to have is 500k.

curl -O http://www2.census.gov/geo/tiger/GENZ2015/shp/cb_2015_us_zcta510_500k.zip
mv cb_2015_us_zcta510_500k.zip priv/data
cd priv/data
unzip cb_2015_us_zcta510_500k.zip

Now (from project root) run the sql scripts to seed your data:

./priv/data/seeds.sh agitate_dev

For non dev environments sub out the database name, e.g. ./priv/data/seeds.sh agitate_prod

et viola!

To do a quick reset of your db

dropdb agitate_dev && mix ecto.create && mix ecto.migrate && ./priv/data/seeds.sh agitate_dev

Acknowledgements

I've been scraping data from anywhere and everywhere.

Most of these have been munged and transformed through a series of very ad hoc ruby scripts peppered throughout the priv/data directory, outputting big sql scripts.

Real fancy.

agitate's People

Contributors

toshism avatar weeksie avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agitate's Issues

Need party icons

Have the repub elephant but need icons for Dems and Independents.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.