An interactive multi-page web interface for the
synthdiet Python library.
The visual style is "clinical clean": white background, medical blue / green accents, glassmorphism cards, smooth fade-up animations and animated Plotly charts.
Project overview, hero, feature grid, quick links.
Interactive prevalence sliders → live age × sex × BMI × diagnosis
distributions, CSV export. The cohort persists in
st.session_state and is reused by every downstream page.
Apply any of 8 preset diets to a single patient and watch HbA1c, blood pressure, LDL and weight trajectories animate week by week (Plotly frame animation with Play / Pause).
Set up a parallel-arm trial with Weibull dropout, configurable adherence and randomisation strategy, then read the trial through ITT / per-protocol / as-treated lenses with a custom CONSORT flow diagram and forest plot.
Browse the 15 built-in clinical cases, filter by difficulty or tag, and grade student diet plans with the OSCE rubric.
Author, citation, license, deployment instructions.
From the repository root:
# 1. Install the library + Streamlit extras
pip install -e ".[app]"
# 2. Launch the app
streamlit run app/streamlit_app.pyThe app opens at http://localhost:8501. Streamlit will pick up the
multi-page structure under app/pages/ automatically.
- Theme primaries are defined in
app/.streamlit/config.toml(clinical-clean, light, sky-blue + emerald accents). - All custom CSS lives in
app/style.cssand is injected once per page bycomponents.page_setup(). - Reusable building blocks (hero, metric grid, patient cards, callouts,
etc.) are in
app/components.py.
- Sign in at https://share.streamlit.io with your GitHub account.
- Click New app, point it to:
- Repository:
bugraayancom/synthdiet - Branch:
main - Main file path:
app/streamlit_app.py
- Repository:
- Under Advanced settings → Python version, pick
3.11or3.12. - The deploy step will read
app/requirements.txt(which already pinssynthdiet,streamlit,plotly,pandas,numpy,scipy). - Hit Deploy. The first build takes ~2 minutes.
Once deployed, you'll get a public URL of the form
https://synthdiet.streamlit.app.
Streamlit Cloud redeploys automatically on every push to main. If
you change app/requirements.txt, the build environment is rebuilt
on the next deploy.
app/
├── .streamlit/
│ └── config.toml # theme + server config
├── pages/ # Streamlit auto-discovers these
│ ├── 1_📋_Cohort_Builder.py
│ ├── 2_🍽️_Diet_Simulator.py
│ ├── 3_🧪_RCT_Engine.py
│ ├── 4_📚_Case_Studies.py
│ └── 5_ℹ️_About.py
├── streamlit_app.py # Home / landing
├── components.py # Reusable HTML/CSS components
├── style.css # Project-wide custom CSS
├── requirements.txt # For Streamlit Community Cloud
└── README.md # This file
- Patient generation and simulations are cached with
@st.cache_data/@st.cache_resourcekeyed on the active cohort signature, so navigating between pages doesn't re-run heavy work. - Cohorts persist across pages via
st.session_state; if you hard-reload the tab you'll need to regenerate one in the Cohort Builder. - The app relies only on the public
synthdietAPI; no private internals are touched.
MIT — see the repository root LICENSE.






