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
This commit is contained in:
Andrew Charlwood
2026-02-06 16:25:56 +00:00
parent ca64a4ab7d
commit de08d4b520
2 changed files with 55 additions and 0 deletions
+4
View File
@@ -320,6 +320,10 @@ Drawer selection → update_drug_selection → app-state store → load_pathway_
- [x] Remove drawer-related sidebar callbacks (`open_drawer` in `dash_app/callbacks/drawer.py`)
- **Checkpoint**: Filter bar has drug/trust/directorate buttons with count badges, each opens correct modal, filter bar is visible across all views.
## 8 - Additional notes
- [x] When filtering drugs, ensure that any 2nd levels (e.g., directorate) with no children is hidden. For example, if Immunoglobulin is filtered, then directorates with no pathways such ar ophthalmology are hidden.
- [x] ensure filters update the KPI cards at the top to reflect the icicle chart visible
---
## Completion Criteria