{"id":23586730,"url":"https://github.com/pythonhealthdatascience/stars-simpy-jupterlite","last_synced_at":"2025-11-03T11:30:26.794Z","repository":{"id":233509001,"uuid":"786862452","full_name":"pythonhealthdatascience/stars-simpy-jupterlite","owner":"pythonhealthdatascience","description":"A template for Discrete-Event Simulation (DES) repositories that use JupyerLite and xeus-python to enable reproducible environments and models","archived":false,"fork":false,"pushed_at":"2024-10-02T15:20:42.000Z","size":3623,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T04:13:48.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pythonhealthdatascience.github.io/stars-simpy-jupterlite/","language":"Jupyter Notebook","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":null,"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}},"created_at":"2024-04-15T12:54:18.000Z","updated_at":"2024-10-02T15:20:46.000Z","dependencies_parsed_at":"2024-04-16T14:04:41.080Z","dependency_job_id":"e3b3bbcb-544d-438e-a30b-131f12dfe9b1","html_url":"https://github.com/pythonhealthdatascience/stars-simpy-jupterlite","commit_stats":null,"previous_names":["pythonhealthdatascience/stars-simpy-jupterlite"],"tags_count":2,"template":true,"template_full_name":"jupyterlite/xeus-python-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-simpy-jupterlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-simpy-jupterlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-simpy-jupterlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonhealthdatascience%2Fstars-simpy-jupterlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythonhealthdatascience","download_url":"https://codeload.github.com/pythonhealthdatascience/stars-simpy-jupterlite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239412445,"owners_count":19634016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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:50.161Z","updated_at":"2025-11-03T11:30:26.700Z","avatar_url":"https://github.com/pythonhealthdatascience.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://pythonhealthdatascience.github.io/stars-simpy-jupterlite/notebooks/?path=01_urgent_care_model.ipynb)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10987817.svg)](https://doi.org/10.5281/zenodo.10987817)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/release/python-3100/)\n[![License: MIT](https://img.shields.io/badge/ORCID-0000--0001--5274--5037-brightgreen)](https://orcid.org/0000-0001-5274-5037)\n[![License: MIT](https://img.shields.io/badge/ORCID-0000--0003--2631--4481-brightgreen)](https://orcid.org/0000-0003-2631-4481)\n\n#  Towards Sharing Tools and Artifacts for **Reproducible** Simulation **(v1.5)**: a JuypterLite template for `simpy` models\n\n## 1. Overview\n\nThe materials and methods in this repository support work towards developing the S.T.A.R.S healthcare framework version 1.5 (**S**haring **T**ools and **A**rtifacts for **R**eproducible **S**imulations in healthcare).  The code and written materials here are a work in progress to demonstrate the application of S.T.A.R.S' version to sharing a `simpy` discrete-event simuilation model and associated research artifacts. \n\nThe model will run on a users browser without the need to install any components.  This is achieved using Web Assembly technology i.e. [JupterLite](https://github.com/jupyterlite/jupyterlite) and [xeus-python](https://github.com/jupyter-xeus/xeus-python).  A model notebook is downloaded to the users local machine and all dependencies are pre-installed via conda-forge. The model then lives in the browsers cache. The user can make changes to the model or create new files and these are persisted (until the browser cache is cleared).  \n\n\u003e Try it in your browser now: https://pythonhealthdatascience.github.io/stars-simpy-jupterlite\n\n### 1.1. Use case\n\n* A researcher wishes to share a runnable version of a simulation model with their publication (e.g. written in `simpy`).  The code allows others to replicate the simulation results, tables and charts in a paper and allows others to reuse the model.\n* The researcher wants the model to be immediately usable. Users should not need to install python, `simpy` or any dependencies.\n* The researcher either wants to reduce load on online open science compute infrastructure (e.g. mybinder.org) or does not want to rely on it. \n* Users may want to use a version of their own data due to governance, ethics or other reasons **cannot upload the data to a remote instance of the model.**\n* Loading the model is as simple as clicking a URL.\n\n### 1.2. Credits ✨\n\n\u003e We would like to thank the [JupterLite](https://github.com/jupyterlite/jupyterlite) and [xeus-python](https://github.com/jupyter-xeus/xeus-python) developers for making this work possible. This discrete-event simulation focussed repository was based on the learning materials and template provided by [Jupyterlite xeus-python demo](https://github.com/jupyterlite/xeus-python-demo) and [tutorial given at PyData 2023](https://www.youtube.com/watch?v=WXRslU9D3bo) by Jeremy Tuloup.\n\n### 1.3. Citation\n\nIf you use the template in your work we would greatly appreciate a citation when you publish your work. \n\n\u003e Monks, T., \u0026 Harper, A. (2024). Simpy JupyterLite Template (v0.1.0). Zenodo. https://doi.org/10.5281/zenodo.10987817\n\n```\n@software{monks_harper_jupyterlite_template,\n  author       = {Monks, Thomas and\n                  Harper, Alison},\n  title        = {Simpy JupyterLite Template},\n  month        = apr,\n  year         = 2024,\n  publisher    = {Zenodo},\n  version      = {v0.1.0},\n  doi          = {10.5281/zenodo.10987817},\n  url          = {https://doi.org/10.5281/zenodo.10987817}\n}\n```\n\n\n## 2. The example model included\n\nThe `simpy` model is adapted from [Monks and Harper (2023)](https://github.com/pythonhealthdatascience/stars-simpy-example-docs)\n\n\u003e Monks, T., \u0026 Harper, A. (2023). Towards Sharing Tools and Artifacts for Reusable Simulation: example enhanced documentation for a simpy model. (v1.1.0). Zenodo. https://doi.org/10.5281/zenodo.10054063\n\nFull documentation of this model is available in our [JupyterBook](https://pythonhealthdatascience.github.io/stars-simpy-example-docs)\n\nIn summary, we adapt a textbook example from Nelson (2013): a terminating discrete-event simulation model of a U.S based treatment centren summary the model. The example is based on exercise 13 from Nelson (2013) page 170.\n\n\u003e *Nelson. B.L. (2013). [Foundations and methods of stochastic simulation](https://www.amazon.co.uk/Foundations-Methods-Stochastic-Simulation-International/dp/1461461596/ref=sr_1_1?dchild=1\u0026keywords=foundations+and+methods+of+stochastic+simulation\u0026qid=1617050801\u0026sr=8-1). Springer.*\n\n## 3. Try the example DES in your browser\n\n* Jupyterlab: https://pythonhealthdatascience.github.io/stars-simpy-jupterlite\n* Classic notebook: https://pythonhealthdatascience.github.io/stars-simpy-jupterlite/notebooks/?path=01_urgent_care_model.ipynb\n\n## 4. Using the template to create a new repo.\n\n\u003e There are three steps: i.) create a new repo form the template; ii.) modify you repo settings so that GitHub pages are built from Actions.  iii.) Commit changes and trigger the GitHub Action and deployment. We recommend reading all instructions first.\n\nLet's assume you wanted to create a new discrete-event simulation model of cancer services.  \n\n1. The first step is to copy the template. Click on the green \"use this template\" button in the top right and select \"create a new repository\"\n2. You will be prompted to enter a name of the repository - e.g. `cancer_model` - and a short description\n3. Click on \"Create Repository\"\n\n![Deploy your own](img/use_template_1.gif)\n\nThe JuypterLite interactive website is built from GitHub actions.  **In the newly created repo for your model** do the following\n\n4. Navigate to \"Settings-\u003ePages\"\n5. Under \"Build and Deployment\" set the \"Source\" to \"GitHub actions\".\n\n![Deploy your own](img/actions.gif)\n\nBy default the build is trigged on any commit to the `main` branch.  Push a small commit and it will trigger the build.  This will take a few minutes.  Your site will be published under https://{USERNAME}.github.io/{DEMO_REPO_NAME}\n\n## 5. How to install extra packages supporting your DES model. 📦\n\nThe repo contains two environment files. To install more dependencies for your DES model and analysis you need to edit the ``environment.yml`` file.\n\nThe template ``environment.yml`` is as follows:\n\n\n```yml\nname: xeus-python-kernel\nchannels:\n  - https://repo.mamba.pm/emscripten-forge\n  - conda-forge\ndependencies:\n  - xeus-python\n  - ipycanvas\n  - simpy=4.1.1\n  - numpy\n  - pandas\n  - matplotlib\n```\n\n**Key points:**\n\n* There are two channels in use. \n  * `encription-forge` contains specific versions of the packages for web assembly These include `numpy` `pandas`, and `matplotlib`. Other popular packages include `scipy`, `scikit-learn` and `pytest`.\n  * `conda-forge` for other installs you can use conda-forge.  Only ``no-arch`` packages from ``conda-forge`` can be installed (simpy qualifies)\n* Note that `numpy`, `pandas` and `matplotlib` have specific versions available on `enscription-forge`. For this reason we recommend not including the package version number.\n* `simpy` is installed from `conda-forge` we were therefore able to freeze the version to 4.1.1 to aid reproducibility.\n* At the time of writing the xeus-python kernal will use python 3.11.3\n\nAs an example modification assume that you wanted to add two new packages: `plotly` and `scipy`.  The first `plotly` is available ``no-arch`` from conda-forge so it is safe to include and if you wanted to you could try to include a version number. There is a specific version of `scipy` is available on `encription-forge`\n\nOur modified environment looks like:\n\n```yml\nname: xeus-python-kernel\nchannels:\n  - https://repo.mamba.pm/emscripten-forge\n  - conda-forge\ndependencies:\n  - xeus-python\n  - ipycanvas\n  - simpy=4.1.1\n  - numpy\n  - pandas\n  - matplotlib\n  - plotly\n  - scipy\n```\n\nIf you wanted to use an alternative simulation package to `simpy` this would need to be available on `conda-forge` and be ``no-arch``.  An example package is `salabim`.  A modification of the enviroment is:\n\n\n```yml\nname: xeus-python-kernel\nchannels:\n  - https://repo.mamba.pm/emscripten-forge\n  - conda-forge\ndependencies:\n  - xeus-python\n  - ipycanvas\n  - salabim\n  - numpy\n  - pandas\n  - matplotlib\n  - plotly\n  - scipy\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonhealthdatascience%2Fstars-simpy-jupterlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythonhealthdatascience%2Fstars-simpy-jupterlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonhealthdatascience%2Fstars-simpy-jupterlite/lists"}