Files
willemjan 7f4377329a
willemjan/glucose-dashboard/pipeline/head This commit looks good
Add CI test-coverage gate at 80%, backfill remaining logic-module gaps
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.
2026-09-05 22:52:29 +02:00

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

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

  2. Kopieer .env.example naar .env en vul NIGHTSCOUT_URL, één van de twee auth-opties, en DASHBOARD_PASSWORD_HASH in (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.py laadt .env zelf in (via python-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_TYPE zijn optioneel en puur informatief (getoond in de kop van het PDF-rapport).

  3. Lokaal draaien:

    uv venv
    uv pip install -r requirements.txt --python .venv
    .venv\Scripts\streamlit run app.py
    
  4. Met Docker Compose:

    docker compose up -d
    

    docker-compose.yml leest .env via env_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