Skip to content

raymondxu/density

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Density

Build Status

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).

Contributing

Local Development

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

Vagrant

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.

Environment variables

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.

Running the Server

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

Testing

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.

Deployment

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

Project Layout

.
β”œβ”€β”€ 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

About

Density estimates how full spaces at Columbia are using WiFi data πŸ“Ά

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 55.0%
  • HTML 20.4%
  • JavaScript 11.3%
  • CSS 10.7%
  • Shell 2.6%