Skip to content

radekaadek/my_aed

Repository files navigation

Respository for storing the OSM OHCA location prediction model and deployment pipeline

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.

Warsaw photo

Prerequisites for running the deployment pipeline

For building neighbourer, the program that adds neighbour data to hexagons, you will also need:

  • H3 version 4.10 (C library)
  • CMake

Running the deployment pipeline

Install python dependencies:

pip install -r requirements.txt

Compile neighbourer:

cd neighbourer
cmake CMakeLists.txt
make

The deployment goes through the following steps:

  1. aquire_data.py - Downloads and saves case data as two files - osm_data.csv with data about the terrain features and warszawa_osm.csv into the data directory from:
  1. 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.csv and target.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.

  2. train_model.py - Trains the model and saves it into the models directory

  3. predict.py - Uses the target.csv file to predict the count of OHCA incidents in each hexagon and saves the result into the data directory as predictions.csv

  4. visual.py - Creates a map of the predictions and saves it into the data directory as map.html

Performance

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.

Special thanks

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!

Virginia Beach logoCincinnati logoMontgomery County logoBerks County logo

Authors

About

Repository for storing my AED model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •