Repository navigation
CDWAgent v0.5.1 — BioRouter Extension Bundle
CDWAgent v0.5.1 — BioRouter Extension Bundle
Major reliability, performance, and multimodal-coverage overhaul (v0.5.0 + v0.5.1),
verified end-to-end against the live UCSF CDW (CDW_NEW.deid_uf, 7.17M patients).
Highlights
- New
build_cohorttool (22 tools total) — answers "how many patients with X" /
"find patients with X" in ONE call across 8 modalities: diagnosis, medication,
procedure, lab, imaging/radiology, immunization, allergy, vitals/flowsheets.
Returns the count, the matched codes/names (cohort transparency), and a reusable
cohort_subqueryfor composing multi-step / cross-modality questions. - DATA MODALITIES guide in the server instructions for the long tail (surgical/OR,
ADT/admissions, cancer staging, radiology report notes, note section headings).
Correctness fixes (found on live data)
- Apostrophe diseases (
Crohn's,Parkinson's,Graves') no longer crash SQL (escaped). - Removed a key-cap that undercounted broad cohorts >100× (type 2 diabetes 1,227 → 219,352).
- RFC-4180 CSV so comma/quote/newline values (note text) don't corrupt output.
search_procedures_by_codeusesProcedureDim(the old terminology table had no key → dead end).crossmap_patientno longer re-parses its own CSV.
Performance (live-measured)
- Key resolution 3–6× faster: name terms = name-dim UNION terminology DisplayString
(full recall); code terms prefix-match only the code column. diabetes 219,352 in ~17s
(was ~57s); G35 13,516 / I10 457,980 in ~3s. vitalcohort no longer times out (resolves FlowsheetRowKey via FlowsheetRowDim first).summarize_tableone bounded pass (was up to 51 scans);cohort_summaryone GROUPING SETS pass.- Per-query/login timeouts; opt-in
approximatecount (APPROX_COUNT_DISTINCT, ~3× faster).
Robustness
Invalid column/object nameerrors are enriched with the closest real names from the
bundled schema reference, so the agent self-corrects after a CDW schema change.
See CHANGELOG.md and eval/ for the full methodology and the 100-question modality-complete suite.