Commit Graph

173 Commits

Author SHA1 Message Date
Andrew Charlwood 11b5cc5b81 feat: header fraction KPIs replacing KPI row (Task 10.3)
Remove KPI card row, add 3 inline fraction KPIs to header bar:
filtered/total patients, drugs, cost. Breadcrumb removed.
KPI callback refactored for 6 output IDs (3 filtered + 3 total).
total_cost added to load_initial_data() reference data.
2026-02-06 21:45:13 +00:00
Andrew Charlwood 6c9f68d880 docs: update progress.txt with iteration 34 (Task 10.2 complete — two-view architecture) 2026-02-06 21:38:53 +00:00
Andrew Charlwood 7d51efc25e feat: add two-view architecture with sidebar navigation (Task 10.2)
- Add active_view and selected_comparison_directorate to app-state
- Sidebar: rename to Patient Pathways + add Trust Comparison nav item
- View container pattern: two view divs toggled by active_view
- Navigation callback: sidebar clicks switch views + update active state
- Trust Comparison placeholder landing page with tc-landing structure
2026-02-06 21:38:12 +00:00
Andrew Charlwood 94b1ac640a docs: design specification for Phase 10 two-view architecture (Task 10.1) 2026-02-06 21:33:43 +00:00
Andrew Charlwood 547bc7c867 docs: complete Phase 9 final integration (Task 9.10)
All 8 chart tabs verified — queries, figures, and filter dispatch
tested in both directory and indication modes. CLAUDE.md updated
with new chart types, query functions, and parsing utilities.
Phase 9 completion criteria all satisfied.
2026-02-06 20:22:21 +00:00
Andrew Charlwood e4d6c8886b docs: update progress.txt with iteration 31 (Task 9.9 complete — Duration chart) 2026-02-06 20:13:42 +00:00
Andrew Charlwood 965fc8c3d2 feat: add Treatment Duration bar chart (Task 9.9) 2026-02-06 20:12:01 +00:00
Andrew Charlwood 1b134c46a2 docs: update progress.txt with iteration 30 (Task 9.8 complete — Heatmap chart) 2026-02-06 20:05:05 +00:00
Andrew Charlwood 0af76e68e0 feat: add Directorate × Drug Heatmap chart (Task 9.8) 2026-02-06 20:04:19 +00:00
Andrew Charlwood c1e11a6dd7 docs: update progress.txt with iteration 29 (Task 9.7 complete — Dosing Interval chart) 2026-02-06 19:58:47 +00:00
Andrew Charlwood 02fe4b4e28 feat: add Dosing Interval Comparison chart (Task 9.7) 2026-02-06 19:58:28 +00:00
Andrew Charlwood b1136ad7bf docs: update progress.txt with iteration 28 (Task 9.6 complete — Sankey diagram) 2026-02-06 19:51:44 +00:00
Andrew Charlwood 4ffcdf4268 feat: add Drug Switching Sankey diagram (Task 9.6) 2026-02-06 19:50:43 +00:00
Andrew Charlwood ba39f94c32 docs: update progress.txt with iteration 27 (Task 9.5 complete — cost waterfall chart) 2026-02-06 19:45:24 +00:00
Andrew Charlwood 73a8d1a49f feat: add Cost Waterfall bar chart (Task 9.5) 2026-02-06 19:44:37 +00:00
Andrew Charlwood 47e4aa4df2 docs: update progress.txt with iteration 26 (Task 9.4 complete — cost effectiveness chart) 2026-02-06 19:39:48 +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 c34381a263 docs: update progress.txt with iteration 25 (Task 9.3 complete — market share chart) 2026-02-06 19:29:44 +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 4375d22022 docs: update progress.txt with iteration 24 (Task 9.2 complete — query functions) 2026-02-06 19:22:23 +00:00
Andrew Charlwood d98cd4fd69 feat: add 7 analytics chart query functions (Task 9.2)
New query functions in src/data_processing/pathway_queries.py:
- get_drug_market_share: Level 3 drug nodes grouped by directory
- get_pathway_costs: Level 4+ pathway nodes with cost_pp_pa
- get_cost_waterfall: Directorate cost per patient from level 3 aggregation
- get_drug_transitions: Sankey source/target drug transitions with ordinal line labels
- get_dosing_intervals: Parsed average_spacing by trust/directory
- get_drug_directory_matrix: Directory x drug pivot with patient/cost metrics
- get_treatment_durations: Weighted avg_days by drug within directorates

Thin wrappers added in dash_app/data/queries.py for all 7 functions.
2026-02-06 19:21:10 +00:00
Andrew Charlwood b34a1138fc docs: update progress.txt with iteration 23 (Task 9.1 complete — parsing + tabs) 2026-02-06 19:14:19 +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 8a45ff1ca7 docs: update progress.txt with iteration 22 (Section 8 complete — pruning + KPIs) 2026-02-06 16:27:09 +00:00
Andrew Charlwood de08d4b520 fix: prune empty ancestor nodes and update KPIs for filtered views (Section 8)
- Add _prune_empty_ancestors() to remove directorate/trust nodes with no
  matching children when drug or directorate filters are active (e.g.,
  filtering by Immunoglobulin no longer shows empty Ophthalmology box)
- Sum level-3 drug nodes for KPI values when entity filters are active
  instead of using the root node's pre-computed unfiltered totals
2026-02-06 16:25:56 +00:00
Andrew Charlwood ca64a4ab7d docs: update progress.txt with iteration 21 (Tasks 7.4 + 7.5 complete — modals + filter bar) 2026-02-06 15:43:46 +00:00
Andrew Charlwood f2c5b2645e refactor: replace dmc.Drawer with dmc.Modal for filter selection (Task 7.4 + 7.5)
- Created 3 separate modals: Drug Selection (lg), Trust Selection (sm),
  Directorate Browser (xl) with centered overlay
- Added filter trigger buttons to filter bar with count badges
- Added "Clear All" button in filter bar for global filter reset
- Per-modal clear buttons for drugs and trusts
- Preserved all existing selection logic (same component IDs)
- Deleted drawer.py component and callbacks (replaced by modals.py)
- Updated CSS: filter-btn styles, modal chip/badge styles
2026-02-06 15:42:48 +00:00
Andrew Charlwood 0cb63146dd docs: update progress.txt with iteration 20 (Task 7.3 complete — sidebar restructure) 2026-02-06 15:31:00 +00:00
Andrew Charlwood 7aa49b0d6b refactor: restructure sidebar with chart views, remove placeholder items (Task 7.3)
- Remove non-functional sidebar items: Cost Analysis, Export Data
- Remove filter trigger items: Drug/Trust/Directory Selection, Indications
- Add Chart Views section: Icicle Chart (active), Sankey Diagram (disabled), Timeline (disabled)
- Remove tab row from chart_card.py (chart view selection now in sidebar)
- Remove open_drawer callback (sidebar no longer has filter triggers)
- Add .sidebar__item--disabled CSS class
2026-02-06 15:29:53 +00:00
Andrew Charlwood 74c243c8a2 docs: update progress.txt with iteration 19 (Task 7.2 complete — filter fix) 2026-02-06 15:24:59 +00:00
Andrew Charlwood 00627a7299 fix: preserve ancestor nodes in drug/directorate filters to prevent broken icicle hierarchy (Task 7.2)
Drug filter WHERE clause used `drug_sequence IS NULL` to keep ancestor nodes,
but levels 0-2 have empty string '' not NULL. Changed to level-based gating:
- Drug filter: `(level < 3 OR drug_sequence LIKE ...)`
- Directorate filter: `(level < 2 OR directory IN (...) OR directory IS NULL OR directory = '')`
- Trust filter was already correct (had `OR trust_name = ''`)
2026-02-06 15:24:09 +00:00
Andrew Charlwood d38c5515fe docs: update progress.txt with iteration 18 (Task 7.1 complete — duplicate ID fix) 2026-02-06 15:19:57 +00:00
Andrew Charlwood 7be136ac87 fix: resolve DuplicateIdError by including search_term in drug-fragment badge IDs (Task 7.1)
Badge IDs changed from f"{directorate}|{frag}" to f"{directorate}|{search_term}|{frag}"
to handle fragments appearing under multiple indications within the same directorate.
Callback parsing updated to use rsplit("|", 1)[-1] for the 3-part key.
2026-02-06 15:19:18 +00:00
Andrew Charlwood 54b4a0f743 docs: update all documentation for Dash migration (Phase 6)
Rewrote README.md, USER_GUIDE.md, and DEPLOYMENT.md to reflect
the Dash application. Updated RALPH_PROMPT.md, guardrails.md, and
DESIGN_SYSTEM.md to remove Reflex references. All non-archive
documentation now reflects the current Dash + DMC architecture.
2026-02-06 14:54:12 +00:00
Andrew Charlwood 4cb5641c2d docs: update progress.txt with iteration 16 (Task 5.4 complete — migration done) 2026-02-06 14:36:39 +00:00
Andrew Charlwood fe8642dfaf feat: remove Reflex, archive old app, update docs for Dash migration (Task 5.4)
- Remove reflex dependency from pyproject.toml
- Move pathways_app/ and rxconfig.py to archive/
- Update CLAUDE.md: Dash app structure, callback chain, run command
- All completion criteria validated (10/10 pass)
2026-02-06 14:35:43 +00:00
Andrew Charlwood 7a4f9ce567 docs: update progress.txt with iteration 15 (Task 5.3 complete) 2026-02-06 14:23:14 +00:00
Andrew Charlwood e877268805 feat: add data freshness indicator with relative time and patient count (Task 5.3) 2026-02-06 14:21:45 +00:00
Andrew Charlwood b739d47e18 docs: update progress.txt with iteration 14 (Task 5.2 complete) 2026-02-06 14:17:30 +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 4540e110e1 docs: update progress.txt with iteration 13 (Task 5.1 complete) 2026-02-06 14:10:39 +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 e8145867c1 docs: update progress.txt with iteration 12 (Task 4.2 complete) 2026-02-06 14:00:21 +00:00
Andrew Charlwood fe76e5a313 feat: add drawer callbacks for drug selection, fragment matching, and clear (Task 4.2) 2026-02-06 13:59:00 +00:00
Andrew Charlwood b5d32224e2 docs: update progress.txt with iteration 11 (Task 4.1 complete) 2026-02-06 13:52:52 +00:00
Andrew Charlwood 5dc552f8c5 feat: add dmc.Drawer drug browser with directorate cards and drug chips (Task 4.1) 2026-02-06 13:51:24 +00:00
Andrew Charlwood 0e4184541a docs: update progress.txt with iteration 10 (Task 3.4 complete) 2026-02-06 13:45:13 +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 ac731780b5 docs: update progress.txt with iteration 9 (Task 3.3 complete) 2026-02-06 13:39:22 +00:00
Andrew Charlwood 9c971c083b feat: add KPI update callback with formatted patient/drug/cost display (Task 3.3) 2026-02-06 13:38:11 +00:00