Skip to content

sfbrigade/datasci-bay-area-relief

Repository files navigation

bay-area-relief

Running Project

  1. Install python3
  2. Install a virtualenv
    1. pip3 install -U setuptools
    2. pip3 install virtualenv
    2. python3 -m venv env
    3a. source env/bin/activate 
    3b. .\env\Scripts\activate (Windows Only)
    4. pip3 install --compile .[test]
    
    • To stop virtualenv then run this command deactivate
  3. Run backend application and database docker-compose up
  4. Use database with two ways:
    • Login psql -d <database_name> -U <postgres username> e.g. ` psql -d bar -U postgres
    • Using the postgreSQL client is easier and prefer
      • Credentials for your local postgres, should be in database.env
  5. Stop application and database docker-compose down

Running Migrations on your DB

  1. Migrate and create tables make upgrade-db
  2. If changes were made to model then follow these changes
    • Migrate first make migrate-db
    • Verify model changes in migrations/versions
    • Upgrade db make upgrade-db

Run webserver with Docker

  1. docker build -t bay-area-relief .
  2. docker run bay-area-relief
  3. docker rmi bay-area-relief (Optional)

Install Postgres Client

Populate database

  • pip install psycopg2-binary sqlalchemy pandas
  • python python bayarea_relief/ingest_raw_data.py -c data/raw_data.csv

Initial Continuous Integration

  1. Run unittests make unittest

Repo resources