nprapps/elex-ftp-loader

Name: elex-ftp-loader

Owner: NPR visuals team

Description: A simple loader for AP FTP elections results.

Forked from: newsdev/elex-ftp-loader

Created: 2017-12-07 22:10:28.0

Updated: 2017-12-07 22:10:30.0

Pushed: 2017-11-15 19:36:37.0

Homepage: null

Size: 64

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ELEX-FTP-LOADER

A simple script for loading AP elections results only into a Postgres database using the COPY function and CSV.

Prerequisites
Installation

Clone the repository, create a virtualenvironment and install requirements.

clone git@github.com:newsdev/elex-ftp-loader.git
rtualenv elex-ftp-loader
lex-ftp-loader
install -r requirements.txt

Export environment variables you need.

rt RACEDATE=<YYYY-MM-DD>
rt AP_FTP_USER=<YOUR AP FTP USERNAME>
rt AP_FTP_PASS=<YOUR AP FTP PASSWORD>
Usage

If you're using something like The New York Times's AP election loader, elex-ftp-loader is a drop-in replacement.

To initialize your database with races, reporting units and candidates:

it.sh

To get results one time:

date.sh

To run a daemon which inserts results into the database every 60 seconds:

emon.sh

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.