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.
This commit is contained in:
Andrew Charlwood
2026-02-06 15:19:18 +00:00
parent 54b4a0f743
commit 7be136ac87
3 changed files with 64 additions and 5 deletions
+2 -2
View File
@@ -44,8 +44,8 @@ def register_drawer_callbacks(app):
if not any(n for n in (fragment_clicks or []) if n):
return no_update, no_update
fragment_key = triggered["index"] # e.g. "CARDIOLOGY|ABCIXIMAB"
fragment = fragment_key.split("|", 1)[-1] if "|" in fragment_key else fragment_key
fragment_key = triggered["index"] # e.g. "CARDIOLOGY|acute coronary syndrome|RIVAROXABAN"
fragment = fragment_key.rsplit("|", 1)[-1] if "|" in fragment_key else fragment_key
# Get all available drugs from reference data
all_drugs = (ref_data or {}).get("available_drugs", [])