Skip to content

(feat) O3-5420: Add PersonAttribute adapter support to Form Engine#681

Open
RajPrakash681 wants to merge 3 commits intoopenmrs:mainfrom
RajPrakash681:feat/add-person-attribute-adapter
Open

(feat) O3-5420: Add PersonAttribute adapter support to Form Engine#681
RajPrakash681 wants to merge 3 commits intoopenmrs:mainfrom
RajPrakash681:feat/add-person-attribute-adapter

Conversation

@RajPrakash681
Copy link

@RajPrakash681 RajPrakash681 commented Feb 13, 2026

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This enables Form Builder to render and process person attribute fields. Previously, these fields were silently hidden in preview mode, causing form rendering issues and preventing data submission.

Screenshots

Related Issue

https://issues.openmrs.org/browse/O3-5420

Other

- Implement PersonAttributeAdapter following PatientIdentifierAdapter pattern
- Add personAttribute type to inbuilt field value adapters registry
- Add attributeType field to FormQuestionOptions interface
- Add PersonAttribute interface to domain types
- Add savePersonAttribute API method for backend persistence
- Add personAttribute to contextInitializableTypes array
- Add preparePersonAttributes and savePersonAttributes helper functions
- Integrate person attribute processing in encounter form submission flow
- Add comprehensive unit tests with full coverage (11 tests passing)

This enables Form Builder to render and process person attribute fields.
Previously, these fields were silently hidden in preview mode, causing
form rendering issues and preventing data submission.

Tested with all existing tests passing (334 tests) and no TypeScript errors.
@RajPrakash681 RajPrakash681 changed the title Add PersonAttribute adapter support to Form Engine (feat) O3-5420: Add PersonAttribute adapter support to Form Engine Feb 13, 2026
@RajPrakash681
Copy link
Author

@NethmiRodrigo please have a look!

@RajPrakash681
Copy link
Author

RajPrakash681 commented Feb 16, 2026

Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think this basically looks right, except in cases where we may need more transformation, e.g., attributes that store Concepts, or Locations.

submission: {},
initialValue: {},
},
} as any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to avoid as any wherever possible. Most of these use-cases, it's better to use an explicit cast. This one can be done (satisfies FormField) with very little effort.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!

src/api/index.ts Outdated
'Content-Type': 'application/json',
},
method: 'POST',
body: JSON.stringify(personAttribute),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

Suggested change
body: JSON.stringify(personAttribute),
body: personAttribute,

@RajPrakash681
Copy link
Author

@ibacher, does this look good to go, or would you suggest any further changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants