-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) O3-3367 Add support for person attributes #423
base: main
Are you sure you want to change the base?
Conversation
Size Change: -263 kB (-17.3%) 👏 Total Size: 1.26 MB
ℹ️ View Unchanged
|
be9d967
to
48be05c
Compare
7b25040
to
ebf119f
Compare
ebf119f
to
f95290b
Compare
So the immediate thing I see here is that we're embedding "format" in the form. I don't really love when we duplicate metadata like this in forms. Just load the format from the backend definition of the attribute type, so we don't face weird issues where changing an attribute type causes forms to break. |
8ac443b
to
e0f7bcc
Compare
@@ -102,7 +102,7 @@ export interface FormSchemaTransformer { | |||
/** | |||
* Transforms the raw schema to be compatible with the React Form Engine. | |||
*/ | |||
transform: (form: FormSchema) => FormSchema; | |||
transform: (form: FormSchema) => Promise<FormSchema> | FormSchema; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the Promise here? i believe the form is resolved before we get here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need it
src/types/schema.ts
Outdated
attribute?: { | ||
type?: string; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the ampath schema docs for personAtttribute, we could eliminate the need for this being an object for backwards compatibility as well have a single format unless you have reasons for going this route
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me work on this
} | ||
field.meta.submission.newValue = { | ||
value: value, | ||
attributeType: field.questionOptions?.attribute?.type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggested changes in the schema will trickle down
formJson: any, | ||
schemaTransformers: FormSchemaTransformer[] = [], | ||
formSessionIntent?: string, | ||
): FormSchema { | ||
): Promise<FormSchema> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reservations to the Promise additions to this file because this affects the way the forms load. Maybe you can share why we need this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adjustment is needed because the format of a person attribute uuid can be a text
, location
or concept
and those details are fetched from the getPersonAttributeTypeFormat
endpoint. Based on the response, we transform the question to the right datasource. @ibacher recommended that we get the backend definitions incase they change, we will still always get the right one. You can add suggestions on how to better handle it incase there is a better way to do it.
e0f7bcc
to
e9aa02e
Compare
Requirements
Summary
Add support for person attributes
Schema :
Screenshots
Screen.Recording.2024-11-21.at.13.54.06.mov
Related Issue
Other