feat: implement data loading from SQLite (Task 3.2)

- Add load_data() method to AppState that connects to SQLite database
- Populate available_drugs, available_directorates, available_indications from DB
- Detect latest date in dataset and set filter defaults accordingly
- Load KPI values: total_records, unique_patients, total_drugs, total_cost
- Add on_load handler to trigger data loading on page initialization
- Handle database errors gracefully with meaningful error messages
This commit is contained in:
Andrew Charlwood
2026-02-04 14:11:03 +00:00
parent a18de83c8d
commit f38ccfc128
3 changed files with 170 additions and 7 deletions
+5 -5
View File
@@ -115,11 +115,11 @@ cd pathways_app && timeout 60 python -m reflex run 2>&1 | head -30
- `current_chart: str = "icicle"`
### 3.2 Data Loading
- [ ] Create `load_data()` method that reads from SQLite
- [ ] Populate available options for dropdowns (drugs, indications, directorates)
- [ ] Detect latest date in dataset for "to" date defaults
- [ ] Calculate total records and last updated timestamp
- [ ] Call on app initialization
- [x] Create `load_data()` method that reads from SQLite
- [x] Populate available options for dropdowns (drugs, indications, directorates)
- [x] Detect latest date in dataset for "to" date defaults
- [x] Calculate total records and last updated timestamp
- [x] Call on app initialization
### 3.3 Filter Logic
- [ ] Create `apply_filters()` computed method that filters the data based on current state