pytest-cov + pyproject.toml [tool.coverage.*] measure reporting.py, nightscout_client.py, data_processing.py, pdf_export.py, profile_data.py, ui_common.py, and auth.py; app.py and pages/*.py are omitted (thin Streamlit UI scripts, not meaningfully unit-testable without a running Streamlit session — the handful of similarly UI-coupled functions left in ui_common.py/auth.py are marked "# pragma: no cover" with the same rationale, since the logic they call into is already fully tested). The Gitea Actions test job now runs with --cov and fails the build below 80%; the coverage XML is uploaded as a build artifact and fed into the SonarQube scan (closing the gap flagged in homelab-cicd-werkinstructie.md). Backfilled a few missing branches (get_colors() theme fallback, secondary-y-axis overlay traces) to reach 98% on the measured modules — comfortable headroom above the 80% gate. Builds on #29/#30/#31.
1.8 KiB
glucose-dashboard
Dashboard van glucosedata, live opgehaald uit een Nightscout-instantie.
Meerdere pagina's (zie zijbalk): een rollend live-overzicht en een set
klinische rapportagepagina's (zie docs/requirements-reporting.md en
docs/design-reporting.md).
Instellen
-
Zorg voor een draaiende Nightscout-instantie en een API-token (Admin Tools
Manage Tokens in Nightscout — geef het token minimaal
readable-rechten) of het klassieke API secret. -
Kopieer
.env.examplenaar.enven vulNIGHTSCOUT_URL, één van de twee auth-opties, enDASHBOARD_PASSWORD_HASHin (zie het voorbeeldbestand voor hoe je die hash genereert — de dashboard-URL wordt gedeeld met het diabetesteam, dus elke pagina zit achter een wachtwoord).app.pylaadt.envzelf in (viapython-dotenv), dus dit werkt hetzelfde onder PowerShell, cmd of bash — je hoeft de variabelen niet zelf in je shell te zetten.REPORT_INSULIN_TYPE/REPORT_PUMP_TYPE/REPORT_SENSOR_TYPEzijn optioneel en puur informatief (getoond in de kop van het PDF-rapport). -
Lokaal draaien:
uv venv uv pip install -r requirements.txt --python .venv .venv\Scripts\streamlit run app.py -
Met Docker Compose:
docker compose up -ddocker-compose.ymlleest.envviaenv_file— dat bestand wordt niet meegecommit (zie.gitignore).
Tests en lint
pytest tests/ -v
ruff check .
Coverage (zie pyproject.toml se [tool.coverage.*]): de CI-pipeline faalt
als de dekking op de gemeten modules onder 80% zakt (app.py/pages/*.py
zijn uitgesloten — dunne Streamlit-UI-scripts, niet zinvol te unit-testen
zonder een draaiende Streamlit-sessie).
pytest tests/ --cov=. --cov-report=term-missing