Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,51 +1,100 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
st.
|
6 |
-
|
7 |
-
st.
|
8 |
-
|
9 |
-
# Scene 1:
|
10 |
-
st.
|
11 |
-
|
12 |
-
"
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
st.image("2.jpg", caption="Examination Findings", use_container_width=True)
|
19 |
-
st.write("Findings: Swollen, tense leg with pain on passive stretching and decreased sensation.")
|
20 |
-
st.subheader("What is your next step?")
|
21 |
-
choice_2 = st.radio(
|
22 |
-
"Choose an action:",
|
23 |
-
["Select an option", "Measure compartment pressure", "Monitor and wait", "Repeat physical exam after medication"]
|
24 |
)
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
st.success("Pressure >30 mmHg. Confirmed Compartment Syndrome.")
|
28 |
-
st.
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
st.
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
elif
|
47 |
-
|
48 |
-
|
49 |
-
st.write("**Action:** Reassess and proceed to examination or measure compartment pressure.")
|
50 |
-
else:
|
51 |
-
st.write("Please select an option to proceed.")
|
|
|
1 |
import streamlit as st
|
2 |
+
import time
|
3 |
|
4 |
+
# Track the current scene
|
5 |
+
if "scene" not in st.session_state:
|
6 |
+
st.session_state["scene"] = 1 # Start with Scene 1
|
7 |
+
if "pain_increase" not in st.session_state:
|
8 |
+
st.session_state["pain_increase"] = False # Track pain progression
|
9 |
+
|
10 |
+
# Scene 1: Patient arrives at ER
|
11 |
+
if st.session_state["scene"] == 1:
|
12 |
+
st.title("Scene 1: Patient Arrives at ER")
|
13 |
+
st.image("1.jpg", caption="Patient presenting with leg pain and swelling", use_container_width=True)
|
14 |
+
st.write("The patient presents with severe pain in the lower leg after a motorcycle accident.")
|
15 |
+
|
16 |
+
choice = st.radio(
|
17 |
+
"What will you do first?",
|
18 |
+
["Select an option", "Examine the leg", "Send for X-ray", "Administer painkillers"]
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
)
|
20 |
+
|
21 |
+
if choice == "Examine the leg":
|
22 |
+
st.image("2.jpg", caption="Exam findings: Swollen leg, no significant tension", use_container_width=True)
|
23 |
+
st.write("Findings: Swollen leg with mild tenderness. Compartment Syndrome is not confirmed.")
|
24 |
+
if st.button("Proceed"):
|
25 |
+
st.session_state["scene"] = 2
|
26 |
+
|
27 |
+
elif choice == "Send for X-ray":
|
28 |
+
st.image("3.jpg", caption="X-ray: Tibial fracture observed", use_container_width=True)
|
29 |
+
st.write("Findings: Tibial fracture confirmed. This does not rule out Compartment Syndrome.")
|
30 |
+
if st.button("Go Back"):
|
31 |
+
st.session_state["scene"] = 1
|
32 |
+
|
33 |
+
elif choice == "Administer painkillers":
|
34 |
+
st.image("4.jpg", caption="Painkillers administered", use_container_width=True)
|
35 |
+
st.success("The patient reports feeling better for now.")
|
36 |
+
st.session_state["pain_increase"] = True # Pain will worsen later
|
37 |
+
if st.button("Proceed"):
|
38 |
+
st.session_state["scene"] = 2
|
39 |
+
|
40 |
+
# Scene 2: Monitoring or Further Action
|
41 |
+
elif st.session_state["scene"] == 2:
|
42 |
+
st.title("Scene 2: Monitoring or Further Action")
|
43 |
+
st.write("The patient is stable for now. What would you like to do?")
|
44 |
+
choice = st.radio(
|
45 |
+
"Choose your next step:",
|
46 |
+
["Select an option", "Monitor and Wait", "Repeat Exam", "Measure Compartment Pressure"]
|
47 |
+
)
|
48 |
+
|
49 |
+
if choice == "Monitor and Wait":
|
50 |
+
st.write("Monitoring the patient... Please wait.")
|
51 |
+
time.sleep(5) # Simulate waiting time
|
52 |
+
if st.session_state["pain_increase"]:
|
53 |
+
st.warning("The patient reports severe pain again.")
|
54 |
+
st.session_state["scene"] = 3
|
55 |
+
|
56 |
+
elif choice == "Repeat Exam":
|
57 |
+
st.image("5.jpg", caption="Repeat examination shows no major changes", use_container_width=True)
|
58 |
+
st.write("Findings: The swelling remains mild. Compartment Pressure is not elevated yet.")
|
59 |
+
if st.button("Go Back"):
|
60 |
+
st.session_state["scene"] = 2
|
61 |
+
|
62 |
+
elif choice == "Measure Compartment Pressure":
|
63 |
+
st.image("6.jpg", caption="Compartment pressure measurement", use_container_width=True)
|
64 |
+
st.write("Results: Compartment pressure is within normal limits at this time.")
|
65 |
+
if st.button("Proceed"):
|
66 |
+
st.session_state["scene"] = 2
|
67 |
+
|
68 |
+
# Scene 3: Progression of Symptoms
|
69 |
+
elif st.session_state["scene"] == 3:
|
70 |
+
st.title("Scene 3: Worsening Symptoms")
|
71 |
+
st.write("The patient's symptoms are worsening: severe pain, tense swelling.")
|
72 |
+
choice = st.radio(
|
73 |
+
"Choose your next step:",
|
74 |
+
["Select an option", "Re-check Compartment Pressure", "Continue Monitoring"]
|
75 |
+
)
|
76 |
+
|
77 |
+
if choice == "Re-check Compartment Pressure":
|
78 |
+
st.image("7.jpg", caption="Re-measurement of Compartment Pressure", use_container_width=True)
|
79 |
st.success("Pressure >30 mmHg. Confirmed Compartment Syndrome.")
|
80 |
+
st.session_state["scene"] = 4
|
81 |
+
|
82 |
+
elif choice == "Continue Monitoring":
|
83 |
+
st.error("The patient's condition worsens further. Necrosis has begun.")
|
84 |
+
st.session_state["scene"] = 4
|
85 |
+
|
86 |
+
# Scene 4: Treatment
|
87 |
+
elif st.session_state["scene"] == 4:
|
88 |
+
st.title("Scene 4: Treatment")
|
89 |
+
st.write("What action will you take?")
|
90 |
+
choice = st.radio(
|
91 |
+
"Choose your treatment:",
|
92 |
+
["Select an option", "Perform Fasciotomy", "Delay Treatment"]
|
93 |
+
)
|
94 |
+
|
95 |
+
if choice == "Perform Fasciotomy":
|
96 |
+
st.image("8.jpg", caption="Fasciotomy performed", use_container_width=True)
|
97 |
+
st.success("Outcome: Patient recovers with minimal damage.")
|
98 |
+
elif choice == "Delay Treatment":
|
99 |
+
st.image("9.jpg", caption="Delayed treatment leads to necrosis", use_container_width=True)
|
100 |
+
st.error("Outcome: Permanent damage or amputation required.")
|
|
|
|
|
|