(chore) Tidy up cruft in O3 form schemas#68
Merged
denniskigen merged 11 commits intoMay 5, 2026
Conversation
- Remove placeholder `description` field ("Test Form 1 Description")
- Fix `isExpanded: "true"` (string) to `true` (boolean)
- Remove empty-string `min`, `max`, `showDate` from questionOptions
Keeps `encounter: "Consultation"` — the AmpathFormsLoader reads this
field (not `encounterType`) and resolves it by name via
encounterService.getEncounterType(String).
- Remove redundant `encounterType` field. AmpathFormsLoader reads `encounter`, not `encounterType`, and the frontend form engine migrates `encounter` -> `encounterType` at runtime. - Remove placeholder `uuid: "xxxx"`. The backend computes the Form UUID deterministically from (name, version) via Utils.generateUuidFromObjects, so the JSON-level uuid field is ignored. - Remove redundant `questionOptions.required` from both child questions. The field-level `required` is the schema-defined location and is what the form engine reads. - Remove empty `validators: []` cruft. - Fix `isExpanded: "true"` (string) to `true` (boolean).
- Remove empty `encounterType: ""` and `uuid: ""` root fields. The backend AmpathFormsLoader ignores the JSON `uuid` (computes it from name+version) and reads `encounter`, not `encounterType`. - Fix `isExpanded: "true"` (string) to `true` (boolean).
- Remove placeholder `uuid: "xxxx"` (ignored by backend loader) - Remove `weeksList: ""` on Time of Procedure (dead data, not read by form engine) - Remove `step: 1` on Estimated Blood Loss (not in schema, not read) - Remove `showDate: "false"` on Estimated Blood Loss (engine checks isTrue(); explicit "false" equivalent to omitting) - Fix `isExpanded: "true"` (string) to `true` (boolean)
- Remove placeholder `uuid: "xxxx"` - Fix `isExpanded: "true"` (string) to `true` (boolean) in both sections - Fix typo in symptom label: "Diarrea" -> "Diarrhea"
- Fix `isExpanded: "true"` (string) to `true` (boolean) in all four sections - Remove 10 dead `hide` blocks with `hideWhenExpression: "false"` on question-level behaviours. The expression evaluates to false, so the element is never hidden. Preserves the legitimate page-level `hideWhenExpression` on PHQ-9 Additional Questions that skips the page when the PHQ-2 screen is negative. - Remove empty `rows: ""` on Clinician Notes textarea
- Fix `isExpanded: "true"` (string) to `true` (boolean) in all four sections - Remove 24 empty `validators: []` arrays from questions - Remove empty `encounterType: ""` and `uuid: ""` root fields
- Fix `isExpanded: "true"` (string) to `true` (boolean) in 16
sections
- Remove 7 dead `hide` blocks with empty `hideWhenExpression: ""`.
Empty expressions evaluate to falsy, so the element is never
hidden; the block has no effect.
- Remove 3 empty `"hide": {}` objects (no expression, same net
effect).
- Preserves all real conditional logic (age-based, HIV status,
pregnancy, sex-based, chief-complaint-driven questions).
Ward Admission was the only form in this directory without either an `encounter` name or `encounterType` UUID. Iniz resolves the "Admission" name to the corresponding encounter type UUID at ingest, matching the convention used by the other forms in this directory.
Two follow-up fixes to this branch: - ipd_admission_request-core_demo.json: revert the addition of `"encounter": "Admission"` at the top of the file. The form already declares `"encounter": "Transfer Request"` further down, so the new line was a duplicate JSON key that parsers silently dropped (the last occurrence wins). Whether `Transfer Request` is the right encounter type is a separate question; if it needs to change, that belongs in its own behavior-changing PR. - structured_soap_note-core_demo.json: strip the remaining 23 empty `validators: []` arrays for consistency with the cleanup already applied to test_results_entry_form_v2-core_demo.json.
NethmiRodrigo
approved these changes
May 5, 2026
Contributor
NethmiRodrigo
left a comment
There was a problem hiding this comment.
Thanks @denniskigen!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No logic changes — this is a hygiene pass across the 8 O3 form schemas included in the demo content package. Drops placeholder values, empty-string options, redundant duplicates, and dead
hideblocks that never fire. Also fixes one user-visible label typo ("Diarrea" → "Diarrhea" in the Covid 19 form).Most of what gets removed is demonstrably dead. The
AmpathFormsLoadercomputes Form UUIDs deterministically from(name, version), so placeholderuuid: "xxxx"fields are ignored. The backend readsencounter(the name);encounterTypeis migrated fromencounterat runtime if missing, so empty or duplicateencounterTypeentries add nothing.questionOptions.requiredhas zero reads inopenmrs-esm-form-engine-lib.hideWhenExpression: "false"or""always evaluates falsy, so the hide never fires. And 47isExpanded: "true"strings become booleans (both work per schema, but boolean is the intent).All real logic stays: age/sex/HIV/pregnancy conditionals, PHQ-9 calculation and page skip,
historicalExpressionprefill, intent behaviours, richconceptMappings, and the correctencounter: "<name>"+encounterType: "<uuid>"dual pattern where it's already set up that way.Follows #67 (filename normalization)