fix: resolve Snowflake column casing and UPID mapping issues (Task 3.1)
Three issues identified and fixed during Task 3.1 testing: 1. Snowflake column name casing: - Unquoted columns in Snowflake are returned as UPPERCASE - Fixed by aliasing columns with quoted names: AS "Search_Term" - Now correctly populates 139 unique Search_Terms (was 0) 2. Duplicate UPID index error: - indication_df_for_chart could have duplicate UPIDs - Added drop_duplicates(subset=['UPID']) before set_index() - Keeps first occurrence (DIAGNOSIS over FALLBACK) 3. Missing UPIDs in indication lookup: - Old code: built indication_df from unique PseudoNHSNoLinked only - Problem: patients with multiple UPIDs (multi-provider) were missing - Fixed: now builds indication_df from ALL unique UPIDs in df - Also handles NaN values in Directory column safely Validation results from test run: - 36,628 patients queried - 34,006 (92.8%) had GP diagnosis matches - 139 unique Search_Terms found - Top 5: drug misuse (8602), influenza (6239), diabetes (2476) Still to verify: full pathway processing after these fixes.
This commit is contained in:
@@ -90,7 +90,7 @@ python -m reflex compile
|
||||
## Phase 3: Test Full Pipeline
|
||||
|
||||
### 3.1 Test Refresh with Real Data
|
||||
- [ ] Run `python -m cli.refresh_pathways --chart-type all` with Snowflake
|
||||
- [~] Run `python -m cli.refresh_pathways --chart-type all` with Snowflake
|
||||
- [ ] Verify pathway_nodes table has both chart_type values:
|
||||
- `SELECT chart_type, COUNT(*) FROM pathway_nodes GROUP BY chart_type`
|
||||
- [ ] Verify indication hierarchy: Trust → Search_Term → Drug → Pathway
|
||||
|
||||
Reference in New Issue
Block a user