Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
195 lines (158 loc) · 6.71 KB
/
Copy pathindex.html
File metadata and controls
195 lines (158 loc) · 6.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title>DES Playground</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@stlite/browser@0.77.0/build/style.css"
/>
</head>
<body>
<div id="root"></div>
<script type="module">
import * as stlite from "https://cdn.jsdelivr.net/npm/@stlite/browser@0.76.0/build/stlite.js";
stlite.mount(
{
requirements: ["pandas", "simpy", "plotly", "numpy", "asyncio"],
entrypoint: "Introduction.py",
files: {
"Introduction.py": `
import gc
import streamlit as st
from helper_functions import add_logo, mermaid
st.set_page_config(
page_title="Introduction",
page_icon="👋",
layout="wide",
initial_sidebar_state="expanded",
)
add_logo()
with open("style.css") as css:
st.markdown( f'<style>{css.read()}</style>' , unsafe_allow_html= True)
st.title("Welcome to the Discrete Event Simulation Playground! 👋")
gc.collect()
st.markdown(
"""
This is a discrete event simulation playground based on the Monks et al (2022), which is itself an implementation of the Treatment Centre Model from Nelson (2013).
By working through the pages on the left in order, you will
- see how a discrete event simulation builds from simple beginnings up to the point of being able to model a complex system
- understand the impact of variability and randomness on systems
- have a go at changing parameters to find the best configuration that balances the average use of resources (like treatment bays or nurses) and the average time a patient will wait at each step of the process.
The treatment centre we want to build a model of looks like this:
"""
)
mermaid(height=450, code=
"""
%%{ init: { 'flowchart': { 'curve': 'step'} } }%%
%%{ init: { 'theme': 'base', 'themeVariables': {'lineColor': '#b4b4b4'} } }%%
flowchart LR
A[Arrival] --> BX[Triage]
BX -.-> T([Triage Cubicle\n<b>RESOURCE</b>])
T -.-> BX
BX --> BY{Trauma or non-trauma}
BY ----> B1{Trauma Pathway}
BY ----> B2{Non-Trauma Pathway}
B1 --> C[Stabilisation]
C --> E[Treatment]
B2 --> D[Registration]
D --> G[Examination]
G --> H[Treat?]
H ----> F
H --> I[Non-Trauma Treatment]
I --> F
C -.-> Z([Trauma Bay\n<b>RESOURCE</b>])
Z -.-> C
E -.-> Y([Trauma Treatment Cubicle\n<b>RESOURCE</b>])
Y -.-> E
D -.-> X([Registration Cubicle\n<b>RESOURCE</b>])
X -.-> D
G -.-> W([Examination Room\n<b>RESOURCE</b>])
W -.-> G
I -.-> V([Non-Trauma Treatment Cubicle\n<b>RESOURCE</b>])
V -.-> I
E ----> F[Discharge]
classDef ZZ1 fill:#47D7FF,font-family:lexend
classDef ZZ2 fill:#5DFDA0,font-family:lexend
classDef ZZ2a fill:#02CD55,font-family:lexend, color:#FFF
classDef ZZ3 fill: #D45E5E,font-family:lexend
classDef ZZ3a fill: #932727,font-family:lexend, color:#FFF
classDef ZZ4 fill: #611D67,font-family:lexend, color:#FFF
classDef ZZ5 fill:#47D7FF,font-family:lexend
classDef ZZ5a fill:#00AADA,font-family:lexend
class A,B ZZ1
class C,E ZZ2
class D,G ZZ3
class X,W ZZ3a
class Z,Y ZZ2a
class I,V ZZ4
class BX ZZ5
class T ZZ5a;
"""
)
st.markdown(
"""
## References
1. *Monks.T, Harper.A, Anagnoustou. A, Allen.M, Taylor.S. (2022) Open Science for Computer Simulation*; [Repository Link](https://github.com/TomMonks/treatment-centre-sim/tree/main)
2. *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&keywords=foundations+and+methods+of+stochastic+simulation&qid=1617050801&sr=8-1). Springer.*
3. https://health-data-science-or.github.io/simpy-streamlit-tutorial/
"""
)
`,
"pages/1_🚶♂️_Simulating_Arrivals.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/pages/1_%F0%9F%9A%B6%E2%80%8D%E2%99%82%EF%B8%8F_Simulating_Arrivals.py"
},
"pages/2_🛏️_Using_A_Simple_Resource.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/pages/2_%F0%9F%9B%8F%EF%B8%8F_Using_A_Simple_Resource.py"
},
"pages/3_🩹_Adding_an_Optional_Step.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/pages/3_%F0%9F%A9%B9_Adding_an_Optional_Step.py"
},
"pages/4_🏥_The_Full_Model.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/pages/4_%F0%9F%8F%A5_The_Full_Model.py"
},
"pages/6_👩💻_The_Code.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/pages/6_%F0%9F%91%A9%E2%80%8D%F0%9F%92%BB_The_Code.py"
},
"pages/7_💡_Find_Out_More.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/pages/7_%F0%9F%92%A1_Find_Out_More.py"
},
"helper_functions.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/helper_functions.py"
},
"distribution_classes.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/distribution_classes.py"
},
"model_classes.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/model_classes.py"
},
"style.css": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/style.css"
},
"output_animation_functions.py": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/output_animation_functions.py"
},
"resources/ed_arrivals.csv": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/resources/ed_arrivals.csv"
},
".streamlit/config.toml": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/.streamlit/config.toml"
},
".streamlit/secrets.toml": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/.streamlit/secrets.toml"
},
"home/.streamlit/secrets.toml": {
url: "https://raw.githubusercontent.com/hsma-programme/Teaching_DES_Concepts_Streamlit/main/.streamlit/secrets.toml"
}
},
},
document.getElementById("root")
);
</script>
</body>
</html>