This is a simple Flask app with a HTML/JS/CSS + Leaflet.js frontend. The app displays the number of traffic accidents per district in Berlin in 2019 relative to area. Users can sample n % of districts and let a pretrained Regression-Kriging model predict the values for the missing districts based on daily traffic volume. The demo can be accessed here.
The folder backend
contains all python scripts, including the notebooks cleaning1
and cleaning2
that contain all the data preparation work. Data sources are listed in the readme file in the data
directory. train_model
contains the actual model. app
sets up the API and runs a local development server (the demo is deployed on a linux server using nginx/gunicorn/pm2).
frontend
contains the app frontend. All geodata is dynamically requested from the backend (API specified in backend/app.py
) and then rendered on the client side using Leaflet.js.
- Clone the repo.
cd
into the backend subdirectory.- Create and activate a virtual environment.
- Run
pip install -r requirements.txt
to install the dependencies. - Run the app with
python app.py
.