22 Commits

Author SHA1 Message Date
Andrew Charlwood d052d2b16d refactor: remove Trends tab from Patient Pathways (Task E.1)
Remove trends tab, metric toggle, render helper, and callback I/O
from Patient Pathways view. Trends will be re-added as a standalone
3rd view in E.2-E.4. Preserved get_trend_data() and create_trend_figure()
for reuse.
2026-02-07 22:07:01 +00:00
Andrew Charlwood d0404aa18a feat: temporal trends CLI script + Dash tab (Task D.1)
D.1a: cli/compute_trends.py — standalone CLI that imports existing pipeline
functions to replay pathway computation for ~10 historical 6-month endpoints.
Creates pathway_trends table via CREATE TABLE IF NOT EXISTS.

D.1b: Trends tab (10th PP tab) with metric toggle (patients/cost/cost_pp_pa).
Query gracefully returns empty when table doesn't exist, figure shows
instruction message to run compute_trends.
2026-02-07 18:24:34 +00:00
Andrew Charlwood c7e9398d65 feat: average administered doses chart tab (Task D.2) 2026-02-07 03:47:53 +00:00
Andrew Charlwood 0a14f1fce3 feat: drug timeline Gantt chart tab (Task D.3) 2026-02-07 03:40:29 +00:00
Andrew Charlwood 1405476818 feat: drug switching network graph tab (Task C.4) 2026-02-07 03:32:14 +00:00
Andrew Charlwood d8df41619d feat: duration vs cost scatter plot tab (Task C.3) 2026-02-07 03:25:39 +00:00
Andrew Charlwood 55c9af2de7 feat: pathway depth distribution chart tab (Task C.2)
Horizontal bar chart showing patients who stopped at each treatment
line depth (exclusive counts, not cumulative like the funnel).
2026-02-07 03:18:28 +00:00
Andrew Charlwood a6cf6efa18 feat: retention funnel chart tab with treatment line depth (Task C.1) 2026-02-07 03:12:30 +00:00
Andrew Charlwood 8e2e2b7125 feat: heatmap metric toggle for both PP and TC views (Task B.4)
- Add Heatmap tab to Patient Pathways TAB_DEFINITIONS (was only in ALL_TAB_DEFINITIONS)
- Add dmc.SegmentedControl (Patients/Cost/Cost p.a.) to PP chart card header, hidden by default
- update_chart callback controls toggle visibility via heatmap-metric-wrapper style output
- _render_heatmap() now accepts metric param from toggle
- Add dmc.SegmentedControl to TC heatmap chart cell inline
- tc_heatmap callback reads tc-heatmap-metric-toggle value and passes metric to figure fn
2026-02-07 03:05:41 +00:00
Andrew Charlwood 979b79794c feat: reduce Patient Pathways to Icicle + Sankey tabs only (Task 10.5)
Removed 6 chart tabs (Market Share, Cost Effectiveness, Cost Waterfall,
Dosing, Heatmap, Duration) from the Patient Pathways tab bar. These will
reappear in the Trust Comparison dashboard (Task 10.8).

All _render_* helper functions preserved in chart.py for reuse.
2026-02-06 21:57:06 +00:00
Andrew Charlwood 965fc8c3d2 feat: add Treatment Duration bar chart (Task 9.9) 2026-02-06 20:12:01 +00:00
Andrew Charlwood 0af76e68e0 feat: add Directorate × Drug Heatmap chart (Task 9.8) 2026-02-06 20:04:19 +00:00
Andrew Charlwood 02fe4b4e28 feat: add Dosing Interval Comparison chart (Task 9.7) 2026-02-06 19:58:28 +00:00
Andrew Charlwood 4ffcdf4268 feat: add Drug Switching Sankey diagram (Task 9.6) 2026-02-06 19:50:43 +00:00
Andrew Charlwood 73a8d1a49f feat: add Cost Waterfall bar chart (Task 9.5) 2026-02-06 19:44:37 +00:00
Andrew Charlwood 4ef7239eed feat: add Pathway Cost Effectiveness lollipop chart (Task 9.4)
- Create create_cost_effectiveness_figure() in plotly_generator.py
  Horizontal lollipop chart with dot size by patient count,
  colour gradient green→amber→red by cost, retention annotations
- Fix calculate_retention_rate() to accept both 'value' and 'patients' keys
- Add _render_cost_effectiveness() dispatch in chart.py callbacks
- Wire into tab switching for active_tab='cost-effectiveness'
2026-02-06 19:38:54 +00:00
Andrew Charlwood f8960a3064 feat: add First-Line Market Share chart (Task 9.3)
- create_market_share_figure() in src/visualization/plotly_generator.py
- Horizontal stacked bar chart: directorates × drugs with patient %
- Wire into tab dispatch via _render_market_share() helper in chart.py
- Responds to date, chart type, trust, and directorate filters
2026-02-06 19:28:20 +00:00
Andrew Charlwood fe2d048a21 feat: add parsing utilities and 8-tab chart infrastructure (Task 9.1)
- Create src/data_processing/parsing.py with parse_average_spacing(),
  parse_pathway_drugs(), and calculate_retention_rate()
- Add 8-tab bar to chart_card.py (Icicle, Market Share, Cost Effectiveness,
  Cost Waterfall, Sankey, Dosing, Heatmap, Duration)
- Add active-tab dcc.Store and tab switching callback in chart.py
- Remove Chart Views section from sidebar (now in tab bar)
- Lazy rendering: only active tab's chart is computed
2026-02-06 19:13:19 +00:00
Andrew Charlwood 5593d08062 feat: add loading spinner, empty state, and error handling to chart area (Task 5.2) 2026-02-06 14:16:26 +00:00
Andrew Charlwood f0505ee43e feat: add trust selection to drawer with filter wiring (Task 5.1) 2026-02-06 14:09:36 +00:00
Andrew Charlwood 40ce7fc5f9 feat: add icicle chart rendering with NHS colorscale and dynamic titles (Task 3.4)
- Add create_icicle_from_nodes() to src/visualization/plotly_generator.py
  accepting list-of-dicts from dcc.Store with NHS blue gradient colorscale,
  10-field customdata, and matching text/hover templates from Reflex version
- Add update_chart callback to dash_app/callbacks/chart.py rendering
  go.Icicle figure from chart-data store with dynamic subtitle
- Title generation helper mirrors Reflex _generate_pathway_chart_title()
2026-02-06 13:44:13 +00:00
Andrew Charlwood ad9fa1cfec feat: add pathway data loading callback bridging filters to chart-data (Task 3.2) 2026-02-06 13:33:31 +00:00