{"id":25659512,"url":"https://github.com/hsma-programme/teaching_des_concepts_streamlit","last_synced_at":"2025-06-22T23:07:03.164Z","repository":{"id":203750506,"uuid":"710241969","full_name":"hsma-programme/Teaching_DES_Concepts_Streamlit","owner":"hsma-programme","description":"A streamlit app (running from github pages using the stlite package) for teaching concepts of discrete event simulation, including animated entity flow plots created in Plotly","archived":false,"fork":false,"pushed_at":"2025-01-30T12:40:34.000Z","size":6462,"stargazers_count":11,"open_issues_count":16,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T19:24:42.939Z","etag":null,"topics":["discrete-event-simulation","emergency-department","healthcare","plotly","simpy","stlite","streamlit"],"latest_commit_sha":null,"homepage":"https://playground.hsma.co.uk","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/hsma-programme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-26T09:57:52.000Z","updated_at":"2025-02-07T20:42:48.000Z","dependencies_parsed_at":"2025-01-29T19:24:24.234Z","dependency_job_id":"d6ddef09-5584-45e6-9d9a-b4bc6baec5ed","html_url":"https://github.com/hsma-programme/Teaching_DES_Concepts_Streamlit","commit_stats":{"total_commits":248,"total_committers":2,"mean_commits":124.0,"dds":"0.028225806451612878","last_synced_commit":"48788033a038ed827c42cffe0986b06017964473"},"previous_names":["bergam0t/teaching_des_concepts_streamlit","hsma-programme/teaching_des_concepts_streamlit"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hsma-programme/Teaching_DES_Concepts_Streamlit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsma-programme%2FTeaching_DES_Concepts_Streamlit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsma-programme%2FTeaching_DES_Concepts_Streamlit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsma-programme%2FTeaching_DES_Concepts_Streamlit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsma-programme%2FTeaching_DES_Concepts_Streamlit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsma-programme","download_url":"https://codeload.github.com/hsma-programme/Teaching_DES_Concepts_Streamlit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsma-programme%2FTeaching_DES_Concepts_Streamlit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261380905,"owners_count":23149966,"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":["discrete-event-simulation","emergency-department","healthcare","plotly","simpy","stlite","streamlit"],"created_at":"2025-02-24T01:17:36.561Z","updated_at":"2025-06-22T23:06:58.146Z","avatar_url":"https://github.com/hsma-programme.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a Streamlit application designed to walk people new to discrete event simulation through the key concepts.\nIt will be used at the open day for the HSMA 6 programme. \n\nIt will allow them to get comfortable with the idea of\n- sampling from distributions\n- simulation replications\n- arrival generation\n- generating and using resources\n- branching paths\n- optimising systems\n\nThe slides accompanying this session can be viewed [here](https://docs.google.com/presentation/d/16-p7fdw59Q4ewXPv1sLrEajmQIZu6rgMvZQqIRJGjkw/edit?usp=sharing)\n\nA version of the final model can also be loaded in Google Colab.\n\u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/hsma-programme/Teaching_DES_Concepts_Streamlit/blob/main/nb_4_full_model.ipynb\"\u003e\n  \u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/\u003e\n\n![image](https://github.com/hsma-programme/Teaching_DES_Concepts_Streamlit/assets/29951987/c55e132d-77b6-43f6-bc98-09434b87709b)\n\nAn animated visual representation of the event log has also been generated using Plotly, allowing users to follow individuals through a simulation and quickly see where queues are building up in the system.\n\nhttps://github.com/hsma-programme/Teaching_DES_Concepts_Streamlit/assets/29951987/1adc36a0-7bc0-4808-8d71-2d253a855b31\n\nOutputs can be compared across multiple scenarios within a single user session. \n\n![image](https://github.com/hsma-programme/Teaching_DES_Concepts_Streamlit/assets/29951987/891e02bd-5b0e-4906-af81-c413f26182c3)\n\n# What is HSMA?\n\nHSMA is a course for people in England working in the health, social care and policing organisations. Over 15 months it trains participants in operational research and data science techniques to aid with service development and decision making. \n\nMore information about the course can be found [here](https://sites.google.com/nihr.ac.uk/hsma)\n\nAll of the course materials are open source - check out [our repositories](https://github.com/hsma-programme)  \n\n# Instructions to run\nThe app has can be accessed via the [Github Pages site](https://hsma-programme.github.io/Teaching_DES_Concepts_Streamlit/) \nNote that the page has been tested and confirmed working in Chrome, Edge and Safari. It does NOT work in Firefox due to issues with initiating the loading of the stlite dependencies.\n\nDue to changes that have been made to ensure that the app works well when deployed via stlite, it is not possible to clone the repository and run it locally without first removing all instances where the `await` command has been used. \n\nHowever, it is possible to clone the repository and instead run it using the stlite preview extension for VSCode, which can be downloaded [here](https://marketplace.visualstudio.com/items?itemName=whitphx.vscode-stlite)\nNote that you will need to restart VSCode after installing this extension.\nUse CTRL+SHIFT+P in VSCode to launch the command pallete, then choose \"Launch stlite preview\". \nYou then need to select Introduction.py from the drop-down that appears. \nThe app should then launch in a preview pane within vscode, allowing you to make changes without deploying to github.\n\n# Model info\n\nThis model uses a modified version of the open treatment centre simulation model from Monks.T, Harper.A, Anagnoustou. A, Allen.M, Taylor.S. (2022)\n\n[Link to treatment centre simulation repository](https://github.com/TomMonks/treatment-centre-sim/tree/main)\n\nAll simulation logic uses the Simpy package.\n\n# Developer info - app design\n\nThis is a multipage streamlit app. The landing page (Introduction.py) is in the root folder, but all subsequent pages are in the 'pages' subfolder.\nHOWEVER - Introduction.py is not referenced directly in the stlite implementation when deployed on Github pages. Instead, code in Introduction.py needs to be manually synced to index.html.\nAll other pages will reflect exactly what is in the .py files within the pages subfolder - Introduction.py is the only exception to this rule.\n\nThe index.html controls the navigation of the pages within stlite, making the required pages, scripts and other resources available to pyodide by temporarily mounting them on a virtual filesystem on page load.\n\nKey model functions are in\n- distribution_classes.py\n- model_classes.py\n\nAdditional functions are in\n- helper_functions.py\n\nAnimation functions are in\n- output_animation_functions.py\n\n\n## Why stlite?\n\nThis app has been designed for use in workshops, meaning that high concurrent load is expected. Due to the relatively high computational load and large datasets expected, this would be likely to quickly overwhelm the free tier available via Streamlit Community. \n[Stlite](https://github.com/whitphx/stlite) is a port of Streamlit to WebAssembly, and uses [pyodide](https://pyodide.org/en/stable/), an implementation of python in the browser, meaning all computation is transferred over to the users computers without requiring them to install Python or any packages. To the end user, it will be indistinguishable from a normal web application - apart from the longer initial loading time. \n\nIt should be noted that the performance of the app is highly dependent on the device the user is running it on, and the default model run length and number of runs has been deliberately set quite low to allow for maximum compatability, though load times on less powerful devices will be significantly longer and it may struggle to store multiple simulation replications. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsma-programme%2Fteaching_des_concepts_streamlit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsma-programme%2Fteaching_des_concepts_streamlit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsma-programme%2Fteaching_des_concepts_streamlit/lists"}