import streamlit as st import time # Track the current scene if "scene" not in st.session_state: st.session_state["scene"] = 1 # Start with Scene 1 if "pain_increase" not in st.session_state: st.session_state["pain_increase"] = False # Track pain progression # Scene 1: Patient arrives at ER if st.session_state["scene"] == 1: st.title("Scene 1: Patient Arrives at ER") st.image("1.jpg", caption="Patient presenting with leg pain and swelling", use_container_width=True) st.write("The patient presents with severe pain in the lower leg after a motorcycle accident.") choice = st.radio( "What will you do first?", ["Select an option", "Examine the leg", "Send for X-ray", "Administer painkillers"] ) if choice == "Examine the leg": st.image("2.jpg", caption="Exam findings: Swollen leg, no significant tension", use_container_width=True) st.write("Findings: Swollen leg with mild tenderness. Compartment Syndrome is not confirmed.") if st.button("Proceed"): st.session_state["scene"] = 2 elif choice == "Send for X-ray": st.image("3.jpg", caption="X-ray: Tibial fracture observed", use_container_width=True) st.write("Findings: Tibial fracture confirmed. This does not rule out Compartment Syndrome.") if st.button("Go Back"): st.session_state["scene"] = 1 elif choice == "Administer painkillers": st.image("4.jpg", caption="Painkillers administered", use_container_width=True) st.success("The patient reports feeling better for now.") st.session_state["pain_increase"] = True # Pain will worsen later if st.button("Proceed"): st.session_state["scene"] = 2 # Scene 2: Monitoring or Further Action elif st.session_state["scene"] == 2: st.title("Scene 2: Monitoring or Further Action") st.write("The patient is stable for now. What would you like to do?") choice = st.radio( "Choose your next step:", ["Select an option", "Monitor and Wait", "Repeat Exam", "Measure Compartment Pressure"] ) if choice == "Monitor and Wait": st.write("Monitoring the patient... Please wait.") time.sleep(5) # Simulate waiting time if st.session_state["pain_increase"]: st.warning("The patient reports severe pain again.") st.session_state["scene"] = 3 elif choice == "Repeat Exam": st.image("5.jpg", caption="Repeat examination shows no major changes", use_container_width=True) st.write("Findings: The swelling remains mild. Compartment Pressure is not elevated yet.") if st.button("Go Back"): st.session_state["scene"] = 2 elif choice == "Measure Compartment Pressure": st.image("6.jpg", caption="Compartment pressure measurement", use_container_width=True) st.write("Results: Compartment pressure is within normal limits at this time.") if st.button("Proceed"): st.session_state["scene"] = 2 # Scene 3: Progression of Symptoms elif st.session_state["scene"] == 3: st.title("Scene 3: Worsening Symptoms") st.write("The patient's symptoms are worsening: severe pain, tense swelling.") choice = st.radio( "Choose your next step:", ["Select an option", "Re-check Compartment Pressure", "Continue Monitoring"] ) if choice == "Re-check Compartment Pressure": st.image("7.jpg", caption="Re-measurement of Compartment Pressure", use_container_width=True) st.success("Pressure >30 mmHg. Confirmed Compartment Syndrome.") st.session_state["scene"] = 4 elif choice == "Continue Monitoring": st.error("The patient's condition worsens further. Necrosis has begun.") st.session_state["scene"] = 4 # Scene 4: Treatment elif st.session_state["scene"] == 4: st.title("Scene 4: Treatment") st.write("What action will you take?") choice = st.radio( "Choose your treatment:", ["Select an option", "Perform Fasciotomy", "Delay Treatment"] ) if choice == "Perform Fasciotomy": st.image("8.jpg", caption="Fasciotomy performed", use_container_width=True) st.success("Outcome: Patient recovers with minimal damage.") elif choice == "Delay Treatment": st.image("9.jpg", caption="Delayed treatment leads to necrosis", use_container_width=True) st.error("Outcome: Permanent damage or amputation required.")