|
import streamlit as st |
|
import pandas as pd |
|
import numpy as np |
|
import matplotlib.pyplot as plt |
|
|
|
|
|
def simulate_wbc_activity(days): |
|
|
|
|
|
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 |
|
}) |
|
|
|
|
|
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. |
|
""") |
|
|
|
|
|
days = st.slider("Select number of days for the simulation", 1, 30, 7) |
|
|
|
|
|
wbc_data = simulate_wbc_activity(days) |
|
|
|
|
|
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. |
|
""") |
|
|