Giter Site home page Giter Site logo

pyrex's Introduction

Pyrex

Phone Your Rep rewrite in Pheonix with a LiveView UI.

See it in production at https://phoneyourrep.org

Stack

  • Elixir 1.13.4
  • Erlang/OTP 25.0.2
  • Phoenix 1.6.10
  • Phoenix LiveView 0.17.10
  • Tailwind CSS 3.1.4
  • Alpine.js 3.10.2
  • GraphQL/Absinthe
  • Postgres 14
  • PostGIS 3
  • fly.io

Roadmap

  • Setup PostGIS database
  • Load jurisdiction shapefiles
  • Enable location-based lookups of jurisdictions
  • Model reps and offices in database schema
  • Fetch reps and offices by jurisdiction
  • Geocode office locations
  • Sort offices by proximity to address
  • Modules/workers to fetch, load, and periodically update data from external source
  • Phoenix LiveView UI
  • VCard (.vcf) downloads for legislator office contacts
  • QR Codes for VCard download URLs, or directly encoding .vcf file contents
  • Add state and local legislators
  • GraphQL API using Absinthe

Development

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Add a valid Google Places API key to your environment as the environment variable GOOGLE_PLACES_API_KEY. I recommend using a special key just for development that is restricted to the HTTP referrer localhost:4000/* and is never checked into version control. If you do not want to use an API key in development then you can set a dummy value (e.g. export GOOGLE_PLACES_API_KEY="no_key"), and rely on manually entering valid U.S. addresses.
  • Setup your database with mix ecto.setup. This will attempt to enable a PostGIS geometric database, download Census Bureau shapefiles for U.S. States, Congressional districts, and State Legislatures, and load them into your database. If this fails it may be because you do not have PostGIS installed. I recommend Postgres >14.4, PostGIS >3.2. If you're on macOS, the easiest way to install this correctly so it Just Works is with Postgres.app. The database setup will also fetch and load legislator data (currently only U.S. Senators and Representatives). The total data size is about 500 MB.
  • Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server

Now you can visit localhost:4000 from your browser.

If you'd like to view the Pheonix LiveDashboard in development it can be found at the relative path /dashboard i.e. localhost:4000/dashboard with the username "username" and password "password". These credentials will not work in production deployments.

Support

This is a free, open-source project made by one creator, hopefully with help from volunteer contributors. The cost of running the servers is directly related to how many people use this app. There is also a cost incurred for every usage of the Google Places Autocomplete widget that helps you look up your address. If you enjoy using this tool and want to see it succeed, your support helps fund those costs.

https://www.patreon.com/msimonborg

Copyright 2022 Matthew Simon Borg

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

pyrex's People

Contributors

msimonborg avatar

Stargazers

Matt Lambie avatar  avatar Nduati Kuria avatar Paulo Daniel Gonzalez avatar

Watchers

 avatar

Forkers

pdgonzalez872

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.