{"id":23586699,"url":"https://github.com/pythonhealthdatascience/stars-treat-sim","last_synced_at":"2026-02-11T17:07:17.607Z","repository":{"id":187277208,"uuid":"676621738","full_name":"pythonhealthdatascience/stars-treat-sim","owner":"pythonhealthdatascience","description":"Implementation of python package for Nelson's (2013) treatment centre model","archived":false,"fork":false,"pushed_at":"2026-02-10T16:24:02.000Z","size":136,"stargazers_count":1,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-10T19:56:25.640Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pythonhealthdatascience.github.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythonhealthdatascience.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-09T16:09:41.000Z","updated_at":"2025-07-31T12:36:11.000Z","dependencies_parsed_at":"2023-08-09T18:13:03.891Z","dependency_job_id":"77207586-dda9-4801-a950-1771e84b0d7d","html_url":"https://github.com/pythonhealthdatascience/stars-treat-sim","commit_stats":null,"previous_names":["pythonhealthdatascience/stars-treat-sim"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/pythonhealthdatascience/stars-treat-sim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-treat-sim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-treat-sim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-treat-sim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-treat-sim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythonhealthdatascience","download_url":"https://codeload.github.com/pythonhealthdatascience/stars-treat-sim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-treat-sim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29338743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T16:14:43.024Z","status":"ssl_error","status_checked_at":"2026-02-11T16:14:15.258Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-27T04:13:44.134Z","updated_at":"2026-02-11T17:07:17.595Z","avatar_url":"https://github.com/pythonhealthdatascience.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 💫 Towards Sharing Tools, and Artefacts, for Reusable Simulation (STARS): a minimal model example\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pythonhealthdatascience/stars-treat-sim/HEAD)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python](https://img.shields.io/pypi/pyversions/treat_sim)](https://pypi.org/project/treat_sim/)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10026326.svg)](https://doi.org/10.5281/zenodo.10026326)\n[![PyPI version fury.io](https://badge.fury.io/py/treat-sim.svg)](https://pypi.org/project/treat-sim/)\n[\u003cimg src=\"https://img.shields.io/static/v1?label=dockerhub\u0026message=images\u0026color=important?style=for-the-badge\u0026logo=docker\"\u003e](https://hub.docker.com/r/tommonks01/treat_sim)\n\n## Overview\n\nThe materials and methods in this repository support work towards developing the STARShealthcare framework (**S**haring **T**ools and **A**rtifacts for **R**eusable **S**imulations in healthcare).  The code and written materials here demonstrate the application of STARS to sharing a `SimPy` discrete-event simulation model and associated research artifacts.  \n\n* All artifacts in this repository are linked to study researchers via ORCIDs;\n* Model code is made available under an MIT license;\n* Python dependencies are managed through `mamba`;\n* Documentation of the model is enhanced using a simple Jupyter notebook.\n* The python model itself can be viewed and executed in Jupyter notebooks via [Binder](https://mybinder.org); \n* The materials are deposited and made citable using Zenodo;\n* The model is sharable with other researchers and the NHS without the need to install software.\n* A full suite of automated tests are provided with the model. \n\n## Author ORCIDs\n\n[![ORCID: Harper](https://img.shields.io/badge/Alison_Harper_ORCID-0000--0001--5274--5037-brightgreen)](https://orcid.org/0000-0001-5274-5037)\n[![ORCID: Monks](https://img.shields.io/badge/Tom_Monks_ORCID-0000--0003--2631--4481-brightgreen)](https://orcid.org/0000-0003-2631-4481)\n[![ORCID: Heather](https://img.shields.io/badge/Amy_Heather_ORCID-0000--0002--6596--3479-brightgreen)](https://orcid.org/0000-0002-6596-3479)\n\n## Funding\n\nThis code is part of independent research supported by the National Institute for Health Research Applied Research Collaboration South West Peninsula. The views expressed in this publication are those of the author(s) and not necessarily those of the National Institute for Health Research or the Department of Health and Social Care.\n\n\u003e Between May 2024 and October 2026 this work has was supported by the MRC.\n\n## Instructions to run the model\n\n### Install from PyPI\n\nIf you do not wish to view the code or would like to use the model as part of your own work you can install the model as a python package.\n\n```bash\npip install treat-sim\n```\n\n### Online Notebooks via Binder\n\nThe python code for the model has been setup to run online in Jupyter notebooks via binder [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pythonhealthdatascience/stars-treat-sim/HEAD)\n\n\u003e mybinder.org is a free tier service.  If it has not been used in a while Binder will need to re-containerise the code repository, and push to BinderHub. This will take several minutes. After that the online environment will be quick to load.\n\n### To download code and run locally\n\n#### Downloading the code\n\nEither clone the repository using git or click on the green \"code\" button and select \"Download Zip\".\n\n```bash\ngit clone https://github.com/pythonhealthdatascience/stars-treat-sim\n```\n\n#### Installing dependencies\n\n[![Python](https://img.shields.io/pypi/pyversions/treat_sim)](https://pypi.org/project/treat_sim/)\n\nAll dependencies can be found in [`binder/environment.yml`]() and are pulled from conda-forge.  To run the code locally, we recommend installing [miniforge](https://github.com/conda-forge/miniforge);\n\n\u003e miniforge is FOSS alternative to Anaconda and miniconda that uses conda-forge as the default channel for packages. It installs both conda and mamba (a drop in replacement for conda) package managers.  We recommend mamba for faster resolving of dependencies and installation of packages. \n\nnavigating your terminal (or cmd prompt) to the directory containing the repo and issuing the following command:\n\n```\nmamba env create -f binder/environment.yml\n```\n\nActivate the mamba environment using the following command:\n\n```\nmamba activate stars_treat_sim\n```\n\n#### Running the model\n\nTo run 50 multiple replications across a number of example experiments, use the following code:\n\n```python\nfrom treat_sim.model import (get_scenarios, run_scenario_analysis,\n                             scenario_summary_frame, \n                             DEFAULT_RESULTS_COLLECTION_PERIOD)\n\nif __name__ == '__main__':\n\n    results = run_scenario_analysis(get_scenarios(), \n                                    DEFAULT_RESULTS_COLLECTION_PERIOD,\n                                    n_reps=50)\n\n    results_summary = scenario_summary_frame(results)\n    print(results_summary)\n\n```\n\nAlternative you can design and execute individual experiments by creating a `Scenario` object:\n\n```python\nfrom treat_sim.model import Scenario, multiple_replications\n\nif __name__ == '__main__':\n\n    # use all default parameter values\n    base_case = Scenario()\n\n    results = multiple_replications(base_case).describe().round(2).T\n    print(results)\n\n```\n\nThe model can be run with different time dependent arrival profiles. By default the model runs with the arrival profile taken from Nelson (2013). The `datasets` module provides access to an alternative example dataset where arrivals are slightly skewed towards the end of the working day.  \n\n```python\n\nfrom treat_sim.model import Scenario, multiple_replications\nfrom treat_sim.datasets import load_alternative_arrivals\n\nif __name__ == '__main__':\n\n    # set the arrival profile to later in the day\n    scenario1 = Scenario(arrival_profile=load_alternative_arrivals())\n\n    alternative_results = multiple_replications(scenario1).describe().round(2).T\n    print(alternative_results)\n```\n\n#### Testing the model\n\n\u003e See our [online documentation](https://pythonhealthdatascience.github.io/stars-simpy-example-docs/content/02_model_code/05_testing.html) for an overview of testing\n\nTo run tests activate the virtual environment and entre the following command:\n\n```bash\npytest\n```\n\nAlternatively to recieve a test coverage estimate issue the following command\n\n```bash\npytest --cov=treat_sim tests/\n```\n\nTo run the tests in multiple python environments i.e. Python 3.10 to 3.13 use:\n\n```bash\nhatch test --all\n```\n\n\n## Repo overview\n\n```\n.\n├── binder\n│   └── environment.yml\n├── CHANGES.md\n├── CITATION.cff\n├── LICENSE\n├── notebooks\n│   └── test_package.ipynb\n├── pyproject.toml\n├── README.md\n├── tests\n│   └── test_datasets.ipynb\n│   └── test_model.ipynb\n└── treat_sim\n    ├── data\n    │   └── ed_arrivals.csv\n    │   └── ed_arrivals_scenario1.csv\n    ├── __init__.py\n    ├── datasets.py\n    └── model.py\n```\n\n* `binder/` - contains the environment.yml file (sim) and all dependencies managed via conda, used to set-up the notebooks on Binder.\n* `CHANGES.md` - changelog with record of notable changes to project between versions.\n* `CITATION.cff` - citation information for the package.\n* `LICENSE` - details of the MIT permissive license of this work.\n* `notebooks/` - contains a notebook to run the model and provides basic enhanced model documentation.\n* `pyproject.toml` - used to build and distribute python package inc. managing a list of package dependencies.\n* `README.md` - what you are reading now!\n* `tests/` - contains automated testing code\n* `treat_sim/` - contains packaged version of the model.\n    * `data/` - directory containing data file used by package.\n    * `__init__.py` - required as part of package - contains author and version.\n    * `datasets.py` - functions to load example dataset for parameterising the model.\n    * `model.py` - example SimPy model.\n\n\n## Citation\n\nIf you use the materials within this repository we would appreciate a citation.\n\n```\nMonks, T., Harper, A., \u0026 Heather, A. (2024). Towards Sharing Tools, and Artifacts, for Reusable Simulation: a minimal model example (v2.1.0). Zenodo. https://doi.org/10.5281//zenodo.10026326\n```\n\n```bibtex\n@software{stars_treat_sim,\n  author       = {Thomas Monks, Alison Harper and Amy Heather},\n  title        = {{Towards Sharing Tools, and Artifacts, for Reusable \n                   Simulation: a minimal model example}},\n  month        = May,\n  year         = 2024,\n  publisher    = {Zenodo},\n  version      = {v2.2.0},\n  doi          = {10.5281//zenodo.10026326.},\n  url          = {https://doi.org/10.5281//zenodo.10026326}\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonhealthdatascience%2Fstars-treat-sim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythonhealthdatascience%2Fstars-treat-sim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonhealthdatascience%2Fstars-treat-sim/lists"}