Public analysis of the Sleep Health and Lifestyle dataset, rebuilt as a single bilingual product.
- Default language: English
- French is available through an in-app language switch (visitor choice, not a second URL)
- Author: Hadbi Aghiles
Live static dashboard (GitHub Pages):
https://hadbiaghiles.github.io/Sleep-Analysis/
The Streamlit app is the Python experience (app.py). The Pages site presents the same KPIs, filters, charts and EN/FR switch without a server.
- Unified Streamlit app (
app.py) with EN/FR UI strings and translated category labels (gender, BMI, occupation, sleep disorder) that do not change the underlying analysis values - Dataset shipped in the repo:
sleep_health_lifestyle_dataset.csv(Kaggleuom190346aschema, 374 rows) - KPI strip: sample size, average sleep hours, average sleep quality, disorder rate
- Filters: gender, BMI category, occupation, age range
- Plotly charts with captions and computed highlights
- Static bilingual dashboard in
docs/for GitHub Pages
| Surface | Default | How to switch |
|---|---|---|
Streamlit (app.py) |
English | Sidebar Language / Langue radio. Choice is stored in st.session_state. |
GitHub Pages (docs/index.html) |
English | Header English / Français toggle. Choice is stored in localStorage. |
app_en.py |
English | Thin wrapper around app.py. |
app_fr.py |
French pre-selected | Same app; still switchable back to English. |
There is one app, not two deployments.
File: sleep_health_lifestyle_dataset.csv
Source: Kaggle — Sleep Health and Lifestyle Dataset (uom190346a) by Laksika Tharmalingam. The copy in this repo is the public CSV with columns:
Person ID, Gender, Age, Occupation, Sleep Duration, Quality of Sleep, Physical Activity Level, Stress Level, BMI Category, Blood Pressure, Heart Rate, Daily Steps, Sleep Disorder
The publisher notes that the dataset is synthetic and intended for illustration.
Cleaning applied in the app (not in the CSV):
- Missing
Sleep Disordervalues are treated asNone Blood Pressureis split intoSystolic BPandDiastolic BP- Column-name aliases from the original Streamlit scripts are normalised to the Kaggle schema
Python 3.10+ recommended.
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
streamlit run app.pyLegacy launchers (same unified app):
streamlit run app_en.py
streamlit run app_fr.pyThe interactive dashboard lives in docs/index.html (regenerate with python generate_site.py). GitHub Pages is enabled on this repository and serves /docs.
After this branch is merged to main, point Pages at main / docs so the site keeps working if the feature branch is deleted:
Settings → Pages → Source branch main, folder /docs.
- Go to share.streamlit.io and sign in with GitHub
- New app → repository
hadbiaghiles/Sleep-Analysis - Branch:
main(or this feature branch) - Main file path:
app.py - Deploy
requirements.txt and .streamlit/config.toml are already in the repo.
app.py # unified Streamlit entry (use this)
i18n.py # EN/FR strings and category labels
app_en.py / app_fr.py # thin wrappers
sleep_health_lifestyle_dataset.csv # public dataset
requirements.txt
.streamlit/config.toml
docs/index.html # GitHub Pages dashboard
generate_site.py # rebuilds docs/index.html
Notebooks notebook.ipynb and botebook_fr.ipynb are unchanged exploratory work.
Analysis and product by Hadbi Aghiles. Dataset credit: Laksika Tharmalingam via Kaggle (uom190346a).