This repository contains the code for the OSM OHCA location prediction model. The model uses H3 to create a hexagonal grid over training data and uses a H2O AutoML regressor to predict the count of OHCA incidents in provided hexagons.
Preview 😊
- Green hexagons - hexagons with an AED or a hospital inside
- Blue hexagons - top 10 hexagons with the highest predicted number of OHCA incidents withouth an AED
- Red hexagons - other hexagons without an AED
All hexagons have an opacity set to the predicted number of OHCA incidents in the hexagon.
- Python 3.11
- Java 8 or higher
For building neighbourer, the program that adds neighbour data to hexagons, you will also need:
Install python dependencies:
pip install -r requirements.txtCompile neighbourer:
cd neighbourer
cmake CMakeLists.txt
makeThe deployment goes through the following steps:
- aquire_data.py - Downloads and saves case data as two files -
osm_data.csvwith data about the terrain features andwarszawa_osm.csvinto the data directory from:
- The Overpass API for Data about terrain features
- VBOHCA - Spatiotemporal Data Set for Out-of-Hospital Cardiac Arrests in Virginia Beach
- Cincinnati Fire Incidents (CAD) (including EMS: ALS/BLS)
- Police Dispatched Incidents, Montgomery County, MD
-
create_main_df.py - Creates two dataframes, one for training and one for testing, and saves them into the data directory, their names are
main_hexagon_df.csvandtarget.csv. It also uses the neighbourer - a program that sums values of neighbours for every hexagon and adds appropriate columns. The program is written in C++ and uses the H3 library. -
train_model.py - Trains the model and saves it into the models directory
-
predict.py - Uses the
target.csvfile to predict the count of OHCA incidents in each hexagon and saves the result into the data directory aspredictions.csv -
visual.py - Creates a map of the predictions and saves it into the data directory as
map.html
The best model currently achieves a root mean squared error of 0.91 on predicting the number of ohca cases in a hexagon across 3 years on the whole dataset.
We would like to send special thanks to people and organizations that have shared data that powers our model 🤗. We also encourage other local goverments to share their data in accessible ways for research and open source projects!
- The city of Virginia Beach and the creators of VBOHCA
- The city of Cincinnati
- Montgomery County
- The County of Berks
- Radosław Dąbkowski
- Michał Ambroży
- Igor Witczak
- Koło Naukowe Geoinformatyki
