Conversation
…ead of comment The obs.comment column was repurposed to track which form field an obs was recorded from, blocking it from being used for real clinical comments. Switch to the purpose-built formNamespaceAndPath field (exposed as formFieldNamespace/formFieldPath), using a fixed "labworkflow" namespace and "/"-joined path segments (the field only allows one "^" total, so nested paths can no longer use "^").
Uses formUtil.setFormAndPathOnObs/hasMatchingFormAndPath (added in the previous commit) instead of hand-rolling the old comment-based ^-joined encoding directly in the saga.
Breaking change: obs form/path tracking moved from comment to formFieldNamespace/formFieldPath.
getFormAndPathFromObs previously keyed entirely off obs.formFieldPath, which is shared across OpenMRS applications (e.g. HTML Form Entry). An obs written by another app whose path happened to have 2+ segments would be mistaken for one of this app's own fields. Now also requires formFieldNamespace === "labworkflow" before treating an obs as ours. hasFormAndPath/hasMatchingFormAndPath needed no direct changes since both already delegate through getFormAndPathFromObs.
…erForm
EncounterForm.initialize() changed to filter obs via formUtil.hasFormAndPath
(instead of comment && comment.includes("^")) as part of the formFieldPath
migration, but this was the one behavior change in the file and had zero
direct test coverage - the existing tests only assert the form renders.
Extract the obs flatten/filter/map logic (including coded/boolean value
unwrapping) into formUtil.existingObsValues(obs), a plain function with
direct unit tests covering: obs with formFieldNamespace/formFieldPath and
a value (included), obs with no formFieldPath (excluded), obs with
formFieldPath but no value (excluded), and coded/boolean value unwrapping.
EncounterForm.jsx now just calls this function and adds the encounter date.
Also clarify the stale "form^path"/comment fixture in EncounterForm.test.jsx
as unrelated 2018-era vitals data that no longer plays any role now that
this code path keys off formFieldNamespace/formFieldPath instead of comment.
3 tasks
mseaton
commented
Jul 30, 2026
…rkflow
react-components is a shared library; hardcoding the formNamespaceAndPath
namespace to "labworkflow" baked a specific downstream consumer's identity
into the library itself. Add a formNamespace prop on EncounterForm, threaded
through the same path formId already uses (prop -> dispatched action ->
saga -> formUtil), defaulting to DEFAULT_FORM_NAMESPACE
("openmrs-react-components") when a consumer doesn't supply one.
Addresses PR review feedback on #281.
4 tasks
mogoodrich
approved these changes
Jul 30, 2026
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.
Summary
The lab-result form machinery (
EncounterForm+ its redux-saga submission pipeline) repurposedobs.commentto track which form field/path an obs was recorded from, predating theformNamespaceAndPathfield being added to the OpenMRS data model. This blockscommentfrom being used for its actual clinical purpose (see the companion pihapps lab-result-comments feature).formNamespaceAndPathfield (RESTformFieldNamespace/formFieldPath), using a fixed"labworkflow"namespace and/-joined nested path segments (the field only permits one^total, so the old^-joined nesting scheme can't be reused as-is).getFormAndPathFromObsnow also verifiesformFieldNamespacematches before treating an obs as this app's own, sinceformFieldPathis shared across OpenMRS applications (e.g. HTML Form Entry).2.0.0. Requires a paired data migration (seeopenmrs-config-pihemrUHM-9418 branch) to convert historicalcomment-encoded obs before this ships toopenmrs-owa-labworkflow(also on a UHM-9418 branch, PR forthcoming) — no dual-read/fallback for old data is implemented.Test plan
npx jest— 63 suites / 242 tests passingnpm run lint— no new errors (pre-existing warnings only)openmrs-owa-labworkflowbump reviewed/merged before release🤖 Generated with Claude Code