-
Notifications
You must be signed in to change notification settings - Fork 14
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) Add support for pre-filled questions #70
(feat) Add support for pre-filled questions #70
Conversation
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.
Thanks @icrc-jofrancisco, but I do think we want to try to collect things as a standard form element instead of adding yet another form schema in the configuration.
src/config-schema.ts
Outdated
_type: Type.UUID, | ||
_description: "Concept UUID of the question.", | ||
}, | ||
answers: { |
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.
Why is this element necessary?
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.
Basically, can we rework things to use the existing form?
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.
Thanks @ibacher , This element is just to know the translated label of the question, coming from the backend, thus avoiding specifying a hardcoded label.
src/FormBootstrap.tsx
Outdated
@@ -138,6 +144,7 @@ const FormBootstrap = ({ | |||
} | |||
}, [patientUuid, formUuid, patient]); | |||
|
|||
const { activeSessionMeta } = useContext(GroupFormWorkflowContext); |
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 would move this up in the compontn a big.
|
||
type PreFilledQuestions = { | ||
[key: string]: 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.
}; | |
}; | |
const { specificQuestions } = useConfig(); | ||
const { formUuid } = useParams() as ParamTypes; | ||
|
||
const questions = useMemo( |
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.
What is this doing?
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.
To search for the form for which we are using in and see if there are any specific questions for this session/form.
@@ -122,6 +138,41 @@ const SessionDetailsForm = () => { | |||
</Layer> | |||
</Tile> | |||
</Layer> | |||
{getSpecificQuestionsByForm(specificQuestions, formUuid).length > |
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.
Why are we calling getSpecificQuestionsByForm()
twice here instead of relying on a single call?
@@ -122,6 +138,41 @@ const SessionDetailsForm = () => { | |||
</Layer> | |||
</Tile> | |||
</Layer> | |||
{getSpecificQuestionsByForm(specificQuestions, formUuid).length > | |||
0 && ( |
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.
Always prefer:
condition ? <ReactJSX> : null
Thanks @ibacher ! |
Hi @ibacher , Actually, I've implemented your suggestion. Now, all you need to do is specify the questionId and the forms list. It'll automatically fetch the labels and values for the questions and answers. If you've got more suggestions,feel free to comment, Appreciate your input! |
Requirements
Summary
IN PROGRESS
In the fast data entry app, users often need to input data for multiple patient encounters. With this enhancement, users can now pre-populate several questions with the same answers for all patients. This streamlines the data entry process and enhances efficiency, especially in scenarios where consistent information needs to be entered across different patient records.
Specific Questions:
Introduces a flexible structure for capturing specific questions associated with forms.
Each specific question includes:
Configuration example:
Screenshots
Related Issue
Other
This pull request is dependent on the changes introduced in here.
Thanks,
CC: @ibacher