Add pump profile fetching and Insulineprofiel page #29

Merged
willemjan merged 1 commits from feature/insulin-profile into main 2026-09-05 19:43:58 +00:00
Owner

Summary

  • Fetch the latest-used Nightscout pump profile (/api/v1/profile) via a new fetch_profile() in nightscout_client.py, reusing the existing auth/base-URL helpers.
  • New framework-free profile_data.py module parses the raw profile into normalized basal/ISF/carb-ratio/target segments (minutes-since-midnight, mg/dL→mmol/L conversion where needed) and DIA.
  • New pages/9_Insulineprofiel.py dashboard page: basal-rate bar/area chart by hour of day, plus tables for basal, ISF, and carb-ratio segments.
  • ui_common.py: new load_profile() cache wrapper (6h TTL) and new palette colors (basal, bolus_food, bolus_correction, bolus_smb, target) for reuse in the follow-up chart-overlay PR.

This is PR 1/4 of the insulin-profile/treatment-overlay/report-redesign work, branched from main. See plan context: profile data is the foundation the next PRs (chart overlays, PDF redesign) build on.

Test plan

  • ruff check . passes
  • pytest tests/ -v passes (96 tests, +23 new: tests/test_profile_data.py + fetch_profile tests in tests/test_nightscout_client.py)
  • Manually launched the app (streamlit run app.py) against the real configured Nightscout instance and confirmed the Insulineprofiel page renders real basal/ISF/carb-ratio data with no exceptions or console errors (verified via headless Playwright + screenshots)

🤖 Generated with Claude Code

## Summary - Fetch the latest-used Nightscout pump profile (`/api/v1/profile`) via a new `fetch_profile()` in `nightscout_client.py`, reusing the existing auth/base-URL helpers. - New framework-free `profile_data.py` module parses the raw profile into normalized basal/ISF/carb-ratio/target segments (minutes-since-midnight, mg/dL→mmol/L conversion where needed) and DIA. - New `pages/9_Insulineprofiel.py` dashboard page: basal-rate bar/area chart by hour of day, plus tables for basal, ISF, and carb-ratio segments. - `ui_common.py`: new `load_profile()` cache wrapper (6h TTL) and new palette colors (`basal`, `bolus_food`, `bolus_correction`, `bolus_smb`, `target`) for reuse in the follow-up chart-overlay PR. This is PR 1/4 of the insulin-profile/treatment-overlay/report-redesign work, branched from `main`. See plan context: profile data is the foundation the next PRs (chart overlays, PDF redesign) build on. ## Test plan - [x] `ruff check .` passes - [x] `pytest tests/ -v` passes (96 tests, +23 new: `tests/test_profile_data.py` + `fetch_profile` tests in `tests/test_nightscout_client.py`) - [x] Manually launched the app (`streamlit run app.py`) against the real configured Nightscout instance and confirmed the Insulineprofiel page renders real basal/ISF/carb-ratio data with no exceptions or console errors (verified via headless Playwright + screenshots) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
willemjan added 1 commit 2026-09-05 19:37:42 +00:00
Add pump profile fetching and Insulineprofiel page
willemjan/glucose-dashboard/pipeline/head This commit looks good
79249958c2
Fetch and parse the latest-used Nightscout profile (basal schedule, ISF,
carb ratio, DIA, targets) and show it as a new dashboard page: a list of
basal/ISF/carb-ratio segments plus a bar chart of basal rate by hour of
day. This is the data foundation for treatment overlays on the glucose
charts and the redesigned PDF report in follow-up PRs.
willemjan merged commit 6004f76d76 into main 2026-09-05 19:43:58 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: willemjan/glucose-dashboard#29