Dtypes Findings Migration (Incremental, Endoreg-Safe)¶
Last updated: 2026-06-03 Owner: reporting/frontend/backend
Scope¶
Migrate findings read/write flows to a dtypes-driven API surface exposed by
lx_dtypes under /base_api/** without breaking existing endoreg_db
behavior mounted under /api/**.
In the current frontend, dtypesApi() defaults to /dtypes-api/** and
endoregApi() defaults to /endoreg-api/**; those prefixes are reverse-proxy
front doors for the underlying /base_api/** and /api/** services. Some
legacy frontend call sites still hard-code /api/**.
Current-State Inventory¶
Uses dtypes today¶
Frontend
findingsApisupports backend mode flagVITE_FINDINGS_BACKEND(endoreg,dtypes_read,dtypes).In
dtypes_readanddtypesmodes, frontend findings reads use/dtypes-api/examinations/{examination_id}/findings/,/dtypes-api/findings/{finding_id}/classifications/, and/dtypes-api/classifications/{classification_id}/choices/.Those
/dtypes-api/**routes proxy tolx_dtypes/base_api/**endpoints.In
dtypesmode, patient finding CRUD uses/dtypes-api/patient-findings/**and validates finding/examination compatibility plus classification/choice consistency before persistence.The frontend default is now
dtypeswhenVITE_FINDINGS_BACKENDis unset or invalid, so read and patient-finding write traffic defaults to/dtypes-api/**.
Uses endoreg_db today¶
/api/**remains the backend endoreg_db route namespace.The current frontend helper default for endoreg routes is
/endoreg-api/**; older stores/components still call/api/**directly.Explicit
VITE_FINDINGS_BACKEND=endoregremains available as a rollback mode.In explicit
endoregmode, findings reads use:/api/examinations/{examination_id}/findings/and/api/findings/{finding_id}/classifications/.findingsApi.getClassificationChoices()still exposes the endoreg/api/classifications/{classification_id}/choices/route, but no current frontend source call site invokes it outside the service definition.Patient finding persistence is still on endoreg_db tables (
PatientFinding,PatientFindingClassification) for/base_api/patient-findings/**.Patient finding row CRUD uses
/api/patient-findings/**only in explicitVITE_FINDINGS_BACKEND=endoregorVITE_FINDINGS_BACKEND=dtypes_readmodes. Inendoregmode, classification replacement still goes through/dtypes-api/patient-findings/{id}/classifications/.Patient, gender, center, and patient-examination workflows still use endoreg_db routes from
patient.pyandexamination.py.Report save flows still submit to
/api/patient-examination-reports/save-submission/.
Route Usage Audit (2026-06-03)¶
Question checked: are routes from these backend URL modules still used by the frontend?
/home/admin/endoreg-db/endoreg_db/urls/examination.py/home/admin/endoreg-db/endoreg_db/urls/classification.py/home/admin/endoreg-db/endoreg_db/urls/patient.py
examination.py¶
Backend route |
Frontend status |
Notes |
|---|---|---|
|
Used only in explicit endoreg mode |
|
|
Used only in explicit endoreg mode |
|
|
Exposed, not actively called |
Implemented by |
|
Not found in current frontend source |
Reporting currently derives indication options from patient-examination detail and examination detail payloads instead. |
|
Not found in current frontend source |
No current source call site found. |
|
Used |
Used by reporting case setup and case resolution flows when creating a patient examination context. |
|
Used |
Used by the reporting shell and report editor for patient-examination detail hydration. |
|
Used |
Used by reporting shell, case resolution, anonymization validation, and |
|
Not actively called |
Present in |
|
Not actively called |
Present in |
|
Not found in current frontend source |
No current source call site found. |
|
Not found in current frontend source |
|
classification.py¶
classification.py currently contributes an empty url_patterns list; the NICE,
PARIS, batch, and status paths are commented out. No frontend source call sites
for /api/classifications/nice/, /api/classifications/paris/,
/api/classifications/batch/, or /api/classifications/status/{video_id}/
were found.
patient.py¶
Backend route family |
Frontend status |
Notes |
|---|---|---|
|
Used |
Used by |
|
Used |
Router-generated |
|
Used |
Router-generated |
|
Used |
Used by patient lookup loading in |
|
Used |
Used by patient lookup loading in |
|
Used only in explicit endoreg or dtypes-read modes |
Default row CRUD now uses |
|
Used |
Called by |
Legacy/Residual Notes¶
frontend/src/components/Examination/SimpleExaminationForm.vueremains in source but is not registered in the current router. Its legacyexamination/...endpoint strings do not match the activeexamination.pyroutes.frontend/src/components/CaseGenerator/FindingGenerator*.vueare legacy/demo components and are not reachable from the current router.frontend/src/views/PatientAdder.vueexists but is not currently routed.The current routed reporting flow is under
/reporting/**; the legacy/untersuchungand/report-generatorroutes redirect to/reporting/case-setup.
Phased Checklist¶
Phase 0: Stabilize current findings flow (no behavior break)¶
[x] Remove duplicate findings reactive reload triggers in
FindingsDetailandAddableFindingsDetail.[x] Normalize findings network calls through a single service layer (
findingsApi) for edited components/stores.[x] Keep endoreg-safe create contract: create finding first, then dedicated classifications update route.
[x] Add structured error parsing (
required-finding,duplicate-finding,invalid-choice,invalid-finding).Acceptance criteria:
No repeated watcher-trigger loops for single finding render.
400 errors surface actionable code/message.
Phase 1: Frontend findings API abstraction¶
[x] Add
frontend/src/api/findingsApi.ts+.js.[x] Add
VITE_FINDINGS_BACKENDenv typing.[x] Route
patientFindingStoreandexaminationStorethroughfindingsApi.[x] Route findings reads in the current reporting flow and stores through
findingsApi.Acceptance criteria:
Component/store layer remains camelCase-compatible.
Backend switching does not require component-level endpoint changes.
Phase 2: dtypes read endpoints (parallel, non-breaking)¶
[x]
GET /base_api/examinations/{examination_id}/findings/[x]
GET /base_api/findings/{finding_id}/classifications/[x]
GET /base_api/classifications/{classification_id}/choices/[x] Compatibility-oriented payload shape preserved (
id,name,required,choices, legacy fields where needed).Acceptance criteria:
Frontend can run in
dtypes_readmode without/apifindings reads.
Phase 3: dtypes write endpoints (endoreg-safe persistence)¶
[x]
GET /base_api/patient-findings/?patient_examination=...[x]
POST /base_api/patient-findings/[x]
PATCH /base_api/patient-findings/{id}/[x]
DELETE /base_api/patient-findings/{id}/[x]
POST /base_api/patient-findings/{id}/classifications/[x] Validation rules enforced before persistence.
[x] Persistence remains endoreg_db tables for compatibility.
Acceptance criteria:
/api/**remains fully operational with no contract regression.
Phase 4: Cutover governance¶
[x] Track migration in this document.
[ ] Parity test suite green in CI for all findings endpoints/modes.
[ ] Soak window complete (no regressions in configured period).
[x] Flip default
VITE_FINDINGS_BACKENDfromendoregtodtypeswhen the env var is unset or invalid.
Compatibility Matrix¶
Endpoint / Area |
Read/Write Source |
Persistence |
Rollout Status |
|---|---|---|---|
|
endoreg_db |
endoreg_db |
Explicit |
|
endoreg_db |
endoreg_db |
Explicit |
|
endoreg_db |
endoreg_db |
Exposed by service, no active frontend caller found |
|
endoreg_db |
endoreg_db |
Explicit |
|
dtypes KB |
n/a |
Implemented; default active path |
|
dtypes KB + db mapping |
n/a |
Implemented; default active path |
|
dtypes KB + db mapping |
n/a |
Implemented; no active frontend caller found |
|
dtypes-validated API |
endoreg_db tables |
Implemented; default active CRUD path |
Frontend findings integration |
|
n/a |
Implemented (default |
Decision Log¶
Date |
Decision |
Rationale |
Owner |
|---|---|---|---|
2026-03-09 |
Keep |
Avoid production regressions during migration. |
reporting/backend |
2026-03-09 |
Use |
Enables incremental rollout and targeted testing. |
frontend |
2026-03-09 |
Validate with dtypes but persist patient findings in existing endoreg tables for now. |
Reduces schema/data migration risk while gaining validation parity. |
backend |
2026-03-09 |
Keep explicit create-then-classification flow for endoreg-safe mode. |
Matches existing behavior and prevents nested-write ambiguity. |
frontend/backend |
2026-03-09 |
Pin pytest CI settings to a deterministic findings module ( |
Avoids environment-dependent |
backend |
2026-06-03 |
Document frontend route usage against |
Clarifies which endoreg routes remain part of the active frontend contract during dtypes migration. |
frontend/backend |
2026-06-03 |
Default unset/invalid |
Moves active findings read/write traffic to the dtypes API while preserving explicit |
frontend |
Progress Log¶
Date |
Reference |
Status |
Notes |
|---|---|---|---|
2026-03-09 |
Working tree changes in |
Completed |
Added |
2026-03-09 |
Working tree changes in |
Completed |
Fixed pytest execution path for backend contract tests; |
2026-03-09 |
Working tree changes in |
Completed |
Added unified service layer and backend mode switch. |
2026-03-09 |
Working tree changes in findings components/stores/reporting views |
Completed |
Removed duplicate reload triggers and migrated key calls to |
2026-03-09 |
Frontend validation ( |
Completed |
Type-check and targeted migration tests pass locally. |
2026-06-03 |
Frontend route audit against endoreg URL modules |
Completed |
Confirmed active use of selected |
2026-06-03 |
|
Completed |
Missing or invalid |
Post-Cutover Follow-Up¶
Keep the dtypes default and consider retiring the explicit endoreg fallback
only when all are true:
Contract tests pass for
/base_apiread/write findings endpoints.Frontend mode tests pass for
endoreg,dtypes_read, anddtypes.End-to-end create/update/delete/classification flows pass in staging.
No agreed regression during soak period.