File size: 2,068 Bytes
ed8e16f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Function to simulate WBC activity over time
def simulate_wbc_activity(days):
    # Creating a simple simulation for WBC activity
    # This can be replaced with more complex logic based on real data
    neutrophils = np.random.normal(20, 5, days).clip(0, 50)
    lymphocytes = np.random.normal(15, 4, days).clip(0, 40)
    monocytes = np.random.normal(10, 3, days).clip(0, 30)
    eosinophils = np.random.normal(5, 2, days).clip(0, 20)
    return pd.DataFrame({
        "Day": range(1, days + 1),
        "Neutrophils": neutrophils,
        "Lymphocytes": lymphocytes,
        "Monocytes": monocytes,
        "Eosinophils": eosinophils
    })

# Streamlit UI
st.title("WBC Simulation in Post-Surgery Hematoma and Infection")

st.markdown("""
    ## Understanding White Blood Cells (WBC)
    In the event of a hematoma and infection post-surgery, different types of WBCs play crucial roles.
    - **Neutrophils 🧦**: First responders to infection sites.
    - **Lymphocytes 🧡**: Provide long-term immunity.
    - **Monocytes 🧜**: Transform into macrophages to engulf pathogens.
    - **Eosinophils 🧝**: Combat multicellular parasites and allergic reactions.
""")

# User input for simulation days
days = st.slider("Select number of days for the simulation", 1, 30, 7)

# Simulating WBC activity
wbc_data = simulate_wbc_activity(days)

# Plotting the WBC activity
st.line_chart(wbc_data.set_index("Day"))

st.markdown("""
    ## Simulation Insights
    The graph above simulates the activity of different WBC types over time post-surgery.
    - **Peak in Neutrophils**: Indicates the body's immediate response to infection.
    - **Lymphocytes Trend**: Shows the development of immunity over time.
    - **Monocytes and Eosinophils**: Fluctuate based on the severity of the infection and allergic reactions.
""")

st.markdown("""
    ### Note
    This is a simplified simulation intended for educational purposes and does not represent actual medical data.
""")