Skip to content

Latest commit

 

History

History
141 lines (98 loc) · 4.18 KB

File metadata and controls

141 lines (98 loc) · 4.18 KB

synthdiet · Streamlit app

An interactive multi-page web interface for the synthdiet Python library.

synthdiet — hero

The visual style is "clinical clean": white background, medical blue / green accents, glassmorphism cards, smooth fade-up animations and animated Plotly charts.

Pages

🩺 Home

Project overview, hero, feature grid, quick links.

Home

📋 Cohort Builder

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.

Cohort Builder

🍽️ Diet Simulator

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).

Diet Simulator

🧪 RCT Engine

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.

RCT Engine

📚 Case Studies

Browse the 15 built-in clinical cases, filter by difficulty or tag, and grade student diet plans with the OSCE rubric.

Case Studies

ℹ️ About

Author, citation, license, deployment instructions.

About


Run locally

From the repository root:

# 1. Install the library + Streamlit extras
pip install -e ".[app]"

# 2. Launch the app
streamlit run app/streamlit_app.py

The app opens at http://localhost:8501. Streamlit will pick up the multi-page structure under app/pages/ automatically.

Custom theme & styling

  • Theme primaries are defined in app/.streamlit/config.toml (clinical-clean, light, sky-blue + emerald accents).
  • All custom CSS lives in app/style.css and is injected once per page by components.page_setup().
  • Reusable building blocks (hero, metric grid, patient cards, callouts, etc.) are in app/components.py.

Deploy to Streamlit Community Cloud

  1. Sign in at https://share.streamlit.io with your GitHub account.
  2. Click New app, point it to:
    • Repository: bugraayancom/synthdiet
    • Branch: main
    • Main file path: app/streamlit_app.py
  3. Under Advanced settings → Python version, pick 3.11 or 3.12.
  4. The deploy step will read app/requirements.txt (which already pins synthdiet, streamlit, plotly, pandas, numpy, scipy).
  5. Hit Deploy. The first build takes ~2 minutes.

Once deployed, you'll get a public URL of the form https://synthdiet.streamlit.app.

Updating

Streamlit Cloud redeploys automatically on every push to main. If you change app/requirements.txt, the build environment is rebuilt on the next deploy.


Folder structure

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

Notes

  • Patient generation and simulations are cached with @st.cache_data / @st.cache_resource keyed 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 synthdiet API; no private internals are touched.

License

MIT — see the repository root LICENSE.