feat: add get_directorate_from_diagnosis() function (Task 2.1)
- Added DirectorateAssignment dataclass for return type - Added get_directorate_from_diagnosis() function to diagnosis_lookup.py - Logic: Try diagnosis-based lookup first (direct SNOMED match) - Returns FALLBACK source if no match found, letting caller handle fallback - Extracts PatientPseudonym from UPID (last part after provider code) - Updated __all__ exports with new dataclass and function - Tested: function handles no-match cases correctly
This commit is contained in:
@@ -72,12 +72,12 @@ python -m reflex compile
|
||||
## Phase 2: Pathway Processing Updates
|
||||
|
||||
### 2.1 Update Directorate Assignment Logic
|
||||
- [ ] Modify `tools/data.py` `department_identification()` or create wrapper:
|
||||
- [x] Modify `tools/data.py` `department_identification()` or create wrapper:
|
||||
- Add `get_directorate_from_diagnosis(upid, drug_name, connector)` function
|
||||
- Logic: Try diagnosis-based first → fallback to department_identification()
|
||||
- Return: (directorate, source) where source is "DIAGNOSIS" or "FALLBACK"
|
||||
- [ ] Track assignment source for metrics (how many diagnosis-based vs fallback)
|
||||
- [ ] Verify: Test with sample patient data
|
||||
- [x] Track assignment source for metrics (how many diagnosis-based vs fallback)
|
||||
- [x] Verify: Test with sample patient data
|
||||
|
||||
### 2.2 Add Chart Type Support to Schema
|
||||
- [ ] Add `chart_type` column to `pathway_nodes` table:
|
||||
|
||||
Reference in New Issue
Block a user