Density estimates how full different parts of Columbia are, based on the number of devices connected to the WiFi (data graciously provided by CUIT in coordination with ESC).
Density currently runs on Python 3.6.3 and PostgreSQL 9.6. Our Python dependencies are managed via Pipenv. If you have Python 3.6 already installed, just run:
pip install -U pipenv
pipenv install --dev
./scripts/bootstrap.sh
If you don't know how to install Python 3.6.3 and PostgreSQL 9.6 yourself, we also have a Vagrant setup. Go to Vagrant Downloads to download Vagrant, and then in the terminal run:
vagrant up
vagrant ssh
This should ssh
you into vagrant@vagrant
virtualmachine. Go to
/vagrant
and then run pipenv install --dev
.
We use .env
file (automatically loaded by pipenv
) to handle
configuration. This should automatically be created for you when you run
./scripts/bootstrap.sh
(or when Vagrant provisions itself).
In production, we use a different set of environment variables.
pipenv run flask run
to start the server. If you're using Vagrant, you'll have to run:
pipenv run flask run --host=0.0.0.0
We use py.test
for testing and flake8
for linting. All tests are defined
in density/tests
. To run tests locally, in the app root directory you should
run:
pipenv run flake8
pipenv run py.test
We have Travis CI set-up to enforce passing tests.
Density is currently deployed on ADI's server via Docker (defined in the
Dockerfile
). To build the Docker image locally, install Docker and run:
docker build -t density .
docker run --net=host -d density
.
βββ API.md -- API documentation
βββ density
βΒ Β βββ config.py -- Load configuration from `.env` file
βΒ Β βββ data.py -- Raw data for rooms
βΒ Β βββ db.py -- Handle all database access
βΒ Β βββ __init__.py -- Bulk of the app logic
βΒ Β βββ predict.py -- WIP (unused) file for predictions
βΒ Β βββ static/ -- static assets for Flask
βΒ Β βββ templates -- Jinja2 templates for Flask
βΒ Β βββ tests/ -- various tests
βββ Dockerfile
βββ Pipfile -- List of Python dependencies
βββ Pipfile.lock
βββ README.md
βββ scripts
βΒ Β βββ bootstrap.sh -- Set-up PostgreSQL logic and `.env`
βΒ Β βββ dump.sql -- dump of database for development
βΒ Β βββ schema.sql -- database schema (for reference)
βΒ Β βββ vagrant.sh -- script to setup Vagrant
βββ setup.cfg -- Setup for CI
βββ Vagrantfile