Project Overview & Inspiration

Giving the ongoing Covid-19 pandemic, we decided to build an epidemic model to investigate the impact of epidemic prevention measures, such as social distancing, can have during a local outbreak depending on the nature of the disease.

How we built it

We modelled a local outbreak in Python using NumPy to improve computational performance and bokeh to render and stream snapshots of the outbreak over time in the browser. We used our free MLH domain voucher to register our own domain where you can try it out! Feel free to visit this link to experiment with the simulation.

What it does

It allows you to modify parameters related to the nature of the virus, the population of the local area and the epidemic-prevention measures taken in response, and then see the effects in real time and the impact on the disease spread graph.

Challenges we ran into

It was a challenge to improve model performance to the extent that the visualisations would feel fluid given the number of calculations required to model physical distancing and disease spread via proximity. We took advantage of NumPy arrays in computation to drastically speed up our model, so that we could run our visualisations with a higher refresh rate.

Accomplishments that we're proud of

We're proud that we successfully created a simple model of an epidemic grounded in reality over the course of the weekend, which allowed us to deepen our understanding of numerical methods and visualisation techniques.

We're also proud to be able to stream fluid and interesting visualisations over the web using Bokeh to display them in browser, so that anyone can play around with our simulation and discover insights for themselves by tweaking the parameters exposed by the model.

Finally, we are proud that our algorithmic optimisations allow us to model a situation with 500 independently moving agents with different frailties, comorbities and ages without significant lag.

What we learned

During the hackathon, we learn a lot about numerical modelling and methods to analyse and model epidemics. This helped us greatly to implement our own Python-based model that takes into allows for physical distancing, varying agent frailties and a self-isolation 'hotel'.

We also learnt how to more effectively and efficiently use NumPy, a popular scientific computing library, and Bokeh, an interactive visualisation library for web browsers. This enabled us to stream the visualisations over the web to a browser whilst performing the crux of the calculations on the backend. Neither of us had used Bokeh before, so we are proud of being able to adopt it so quickly!

Furthermore, we learnt more about DevOps and using Google Cloud to host our Python web server and relay it to users using Caddy as a reverse proxy.

What's next for Epidemic Simulator

We're looking to expand the epidemic simulator to allow you to model multiple communities and investigate the role of long-distance travel during an epidemic in spreading the disease. We'd also like to add features such as time delays to the appearance of symptoms and potentially agent behaviour changes in reaction to getting symptoms.

Share this project: