Skip to content

Documentation supporting template reproducible analytical pipelines (RAP) for simple python and R discrete-event simulation (DES) models.

License

Notifications You must be signed in to change notification settings

pythonhealthdatascience/rap_des

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reproducible Discrete-Event Simulation (DES)

licence

Simple templates and example of implementations of DES models in Python and R, within a reproducible analytical pipeline (RAP)


⚠️ Work in progress


📌  Introduction

TBC. Notes:

  • Link to template repositoryes
  • Link to STARS.
  • Link to relevant publication.

🧐 What are we modelling?

A simulation is a computer model that mimics a real-world system. It allows us to test different scenarios and see how the system behaves. One of the most common simulation types in healthcare is discrete-event simulation (DES).

In DES models, time progresses only when specific events happen (e.g., a patient arriving or finishing treatment). Unlike a continuous system where time flows smoothly, DES jumps forward in steps between events. For example, when people (or tasks) arrive, wait for service, get served, and then leave.

Simple DES Animation Simple model animation created using web app developed by Sammi Rosser (2024) available at https://github.com/hsma-programme/Teaching_DES_Concepts_Streamlit and shared under an MIT Licence.

One simple example of a DES model is the M/M/s queueing model, which is implemented in this template. In a DES model, we use well-known statistical distributions to describe the behaviour of real-world processes. In an M/M/s model we use:

  • Poisson distribution to model patient arrivals - and so, equivalently, use an exponential distribution to model the inter-arrival times (time from one arrival to the next)
  • Exponential distribution to model server times.

These can be referred to as Markovian assumptions (hence "M/M"), and "s" refers to the number of parallel servers available.

For this M/M/s model, you only need three inputs:

  1. Average arrival rate: How often people typically arrive (e.g. patient arriving to clinic).
  2. Average service duration: How long it takes to serve one person (e.g. doctor consultation time).
  3. Number of servers: How many service points are available (e.g. number of doctors).

This model could be applied to a range of contexts, including:

Queue Server/Resource
Patients in a waiting room Doctor's consultation
Patients waiting for an ICU bed Available ICU beds
Prescriptions waiting to be processed Pharmacists preparing and dispensing medications

For further information on M/M/s models, see:


📖 Viewing this book

TBC. Notes on:

  • View it online
  • View it locally
# Clone project
git clone https://github.com/pythonhealthdatascience/rap_des
cd rap_des

# Create conda environment
conda env create --file environment.yaml

📝 Citation

Contributor ORCID GitHub
Amy Heather ORCID: Heather https://github.com/amyheather

📜 Licence

This template is licensed under the MIT License.

MIT License

Copyright (c) 2024 STARS Project Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

💰 Funding

This project was developed as part of the project STARS: Sharing Tools and Artefacts for Reproducible Simulations. It is supported by the Medical Research Council [grant number MR/Z503915/1].