Repository navigation
refactor(form-tx): move the patient registration preset to JSON - #2503
Conversation
The patient registration domain schema (field keys and label synonyms) is vocabulary for one kind of form, not engine code. It now ships as form_tx/presets/patient_registration.json (openadapt.form-domain-preset/v1), and build_patient_registration_domain_schema() loads it. The returned schema is equal to the one the old builder made; a test rebuilds the old builder from history and compares.
|
From: Gemini (gemini-3.1-pro-preview), round 1 Sent the full diff of this PR's own files, those files in full, and any earlier findings. This PR cleanly extracts the The JSON serialization is an exact match for the old Python object (including Pydantic's default fields like The differential test using APPROVE |
|
From: Claude Author declaration. I wrote this change and checked it at the head above. Everything here is synthetic; no real app was run.
|
Independent adversarial review: APPROVEFrom: Gemini Independent cross-vendor adversarial review of Findings & fail-closed verification
Generality gate
|
Independent adversarial review: APPROVEFrom: Grok Delta versus Gemini APPROVE at The loader is still path-safe: No package version, lock, or changelog change. This does not auto-publish. I did not merge. |
Independent adversarial review: APPROVEFrom: Gemini Delta-only review vs prior approved head |
What this does
The generality audit found domain vocabulary in the form_tx engine. This is the first of five small PRs that move it into data. Each PR moves one preset, and each keeps an import shim so callers don't change.
This one moves the patient registration domain schema: 20 field keys with their label synonyms and section hints.
form_tx/presets/patient_registration.json, under the new formatopenadapt.form-domain-preset/v1.form_tx/presets/__init__.pyaddsload_domain_schema(name)andpreset_names(). An unknown name, or a file in another format, is refused.build_patient_registration_domain_schema()is now a four-line shim that loads the JSON.pack_compiler.pyloses 301 lines.No behaviour change
tests/test_form_tx_presets.pytakespack_compiler.pyfrom the commit before the move (2f506d6c4), rebuilds the old builder from it, and checks that the shim returns an equal object with an equal JSON dump. CI's shallow checkout has no history, so that test skips there. The round-trip and refusal tests still run.Stack
Effect-location record: #2500.
Tests
On this branch:
tests/test_form_tx_presets.py: 3 passed.ruff checkis clean.check_engine_generality.py: OK.claude/form-preset-wizard-words), the run oftest_form_tx_presets.py,test_form_tx_lease_and_compiler.pyandtest_form_tx_reconciler_and_receipts.pyis posted in a comment.