Other languages: Français
Consolidates files contracts and grants from the City of Montreal hosted on the open data portal to produce:
- A programmable interface (API) according to the Contracting Open Data Standard format and to sort the data according to different parameters
- Data visualization for listing and exporting contracts and grants. The web interface obtains the data by connecting to the API.
The API requires the following:
- Python 2.7 or greater
- Postgresql 9.3 or greater
The code was developed using the [Flask] (http://flask.pocoo.org/) Python microframework. Flask and all other necessary libraries are contained in the file requirements.txt
.
The project follows standards for hosting on Heroku. That said, it is possible to execute the code on any configuration meeting the above prerequisites; it will be necessary to add a WSGI as [uwsgi] (http://flask.pocoo.org/docs/0.10/deploying/uwsgi/) to link the python code to a web server such as Apache or Nginx.
You can clone the code using Git:
git clone https://github.com/opennorth/ovc-vdm.git
cd ovc-vdm
Or download a zip.
It is recommended that you setup a virtual environment for installing Python dependencies, so as to avoid effecting your wider system.
Once you've done that, install dependencies as follows.
pip install -r requirements.txt
You need to set the following environment variables prior to running the application:
export APP_SETTINGS="config.DevelopmentConfig"
export DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DBNAME"
export EMAIL_CREDENTIALS="user@password"
APP_SETTING
sets the configuration mode for running the application. The different modes are configured in theconfig.py
file.DATABASE_URL
tells SQLAlchemy how to connect to the database.EMAIL_CREDENTIAL
is used to generate alert emails via the platform SendGrid.
Before running the application, you must setup the initial database schema as follows:
python manage.py db init
python manage.py db upgrade
There are two steps to importing the intial data into the database:
python manage.py update_sources # Import data sources
python manage.py update_releases # Impore contracts and releases - takes a very long time
python app.py # Run the development server
To use the application in production mode, it is necessary to start using WSGI Python. To run on the Heroku platform, procfile
file is already in place.
./run_test.sh
This uses the node testing library.