Serve CaCu instance and episode publications with benchmark notes

This commit is contained in:
2026-11-24 19:17:47 -06:00
parent 098cbf7066
commit 63bb802116
4 changed files with 133 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
# CaCu follow-up benchmarks
The `feature/cacu-seguimiento-instances` branch introduces an indexed, opt-in follow-up list for simulated data. It also moves the study-date filter for the existing patient-level list into SQL.
| Test | Requests per path | Baseline median / p95 | New median / p95 |
|---|---:|---:|---:|
| Existing `/cacu/seguimiento` on the synthetic CaCu fixture with 25,000 extra cytologies outside the requested six-month window | 15 | 203.69 ms / 379.72 ms | 97.02 ms / 141.29 ms |
| `/cacu/seguimiento/instancias`, first filtered 50-row page from a publication with 120,000 instances | 20 | 934.36 ms / 1,091.52 ms | 3.20 ms / 5.11 ms |
Both experiments used local SQLite and Flask's in-process HTTP client. Each comparison checked that the baseline and new path returned the same JSON before measuring request times. The existing endpoint uses WebApi commit `4840bd3` as its baseline. The instance endpoint uses the same response and publication on both paths, comparing a full read with Python filtering and paging against indexed SQL pagination.
The existing endpoint's median fell by 52% in this fixture. Building and indexing the complete synthetic publication took 4.71 seconds, measured separately from requests. Live publication time and deployed API latency remain unmeasured.
## Verify endpoint behavior
Use the Models checkout on `feature/cacu-seguimiento-instances` and make it importable by the WebApi test environment. Run the regression tests in the WebApi checkout with `DBT_MANIFEST` set to a compiled CaCu manifest for the standard synthetic fixture.
```bash
python -m pytest -q tests/test_seguimiento.py tests/test_follow_up_instances.py tests/test_follow_up_study_window.py
```
The CaCu design and the PIM verification are documented in `models/docs/seguimiento_instancias_cacu.md` on the matching branch.