Open joyce-x-chen opened 1 month ago
this looks like a good mvp, some questions:
- for "UI update to indicate forms that are in progress", since we exclude register... forms we don't have to worry about those, a form that we launch the form from the hamburger menu on a profile can be configured to only show once, like an "end ANC form", "record patient death" form or similar. Would we show a UI change for the menu items or would we exclude this drafts from forms opened from a drop down menu and only include those from a profile page, like task-related forms?
Good question. I would prioritize a UI update for forms that are displayed in the child's profile, e.g. task-related forms. While there are some forms stored in the overflow menu that might need drafting, they are less likely. The types of forms that are typically accessed in the overflow menu are ones that:
- If I save a draft, then open a draft, then exit the draft and choose "cancel", does this delete the draft?
No, if you open a draft form and exit the draft, you get the same 3 options as if you're in a new form: cancel, save as draft, and discard.
1) sounds good, let's update the scope for the MVP to be only for non-repeatable forms AND forms displayed in the a profile view.
2) Oh sorry, I confused cancel with discard but that's what I was thinking, which means the way to "delete a draft" is to edit a draft then exit it and choose discard.
If you do that, then you sync, is the expected behavior that a draft you discarded also disappears from other devices when they resync their drafts? That seems reasonable. There might be an edge case where User A discards a draft and it's status is set to deleted and User B, completes and submits a draft so it's status is set to completed, we will have to confirm how this is handled by the FHIR API.
I had tried to describe non-repeatable forms here, but maybe the wording isn't so clear? I've edited the description to restrict it to those in the profile view. Feel free to edit for further clarity.
Only relevant to forms that are unique and only expected to be filled out once- i.e. exclude those such as "register client" or "register household" This includes forms that are filled out once per client
Good point on potential conflicts. That's not unique to saving of drafts (can happen due to offline work with new forms and editing of forms too), but we do need to come up with basic rules for how they are handled so it doesn't lead to app crashes or ANRs.
Looks good, the wording on non-repeatable was clear, change was to add in profile view, thank you.
Initial Scoping on Implementation Plan
After initial code review here are my findings
Adding Config
Add config - Already exists
{
"trigger": "ON_CLICK",
"workflow": "LAUNCH_QUESTIONNAIRE",
"questionnaire": {
"id": "2b56ce61-6e33-4d40-8edb-7f273cb358dd",
"title": "{{ questionnaire.title.anc.profile }}",
"saveButtonText": "{{ submit }}",
"setPractitionerDetails": true,
"setOrganizationDetails": true,
"saveDraft": true,
"resourceIdentifier": "@{patientId}"
}
}
If saveDraft
is true, then add QuestionnaireResponse status to in-progress
PS. Everything else after this does not exist
Populate
in-progress
UI/UX
saveDraft
config is provided we need to update the message on the alert dialog from Submit/Discard to SaveDraft/Submit generateTaskServiceStatus
in the rules engine to update the icon and color of the Task.Button in the RulesFactory.kt
Assumptions
Open Questions from grooming with @Rkareko
- UI/UX - Discard/Cancel - Do we have a single button or multiple? Do we show this dialog only on the back press when you want to exit the form?
@f-odhiambo A suggested approach for this using a HouseHold
registration form as an example would be to do the following :
Add House Hold
for this case.
Add Household
button is called, the SDC would perform validation and if any errors exist the validation error dialog would be displayed. This is the normal flow.
saveDraft
as true
then the following dialog would be displayed.
Please note that discard and cancel have 2 different functions. Discard = discard the draft. Cancel = go back to the form to continue editing.
Hi @joyce-x-chen unfortunately we can not have an alert dialog with more than 3 buttons to accommodate adding a cancel I wanted to let you know that we’re currently focusing on the heavy lifting of the code for the button. Once that’s done, we’ll revisit the button press functions and make sure everything aligns with your design preferences. We’ll also keep your concerns in mind and try to avoid any changes to the SDK to minimize any potential impact on the overall implementation. Thanks for your patience! 😊
PS. Cancel also introduces a new scope that may get a life of its own. @Rkareko Check if we can be able to add a cancellable property to the alert dialog to take care of the cancel scenario
CC @HenryRae @rowo
@Rkareko Based on the convo we had we need to maintain the QR top and status for the workflows to populate the correct state of data post-submission
We need to update the docs to show a clear distinction on how draft vs edit works
@joyce-x-chen @f-odhiambo we have designs here on how we would like the feature to work. We will definitely need all 3 CTAs.
Thanks so much @f-odhiambo @Rkareko @HenryRae.
@HenryRae
Discard changes - dismisses user's input, and closes the form without saving the draft.
To clarify - I was suggesting "discard" to mean discard the entire (draft) form. I do see the value of a "discard changes" option (which would return the draft to the state it was in before the person opened the in-progress form), but then we'd have to find another way to provide the user with the option to discard the entire form. Since we don't want to create a register of in-progress forms for the MVP, there's no "delete" option elsewhere at the moment. If we have to choose between "discard changes" and "discard form", and "discard changes" and "cancel", I think discard form is more valuable. Alternatively, could we add an X button to represent cancel (go back to form to resume editing - no discarding of newly input data)?
Good point though on clarifying whichever we settle on. The label needs to be more specific - i.e. "discard form" or "discard changes" rather than simply "discard."
@f-odhiambo
PS. Cancel also introduces a new scope that may get a life of its own. @Rkareko Check if we can be able to add a cancellable property to the alert dialog to take care of the cancel scenario
I thought cancel is an existing functionality in OpenSRP apps if you try to back out of a form. The current options are "Cancel" and "Discard." The new one would be "Save draft." Here is a screenshot from PATH EIR:
Oh never mind @HenryRae I see you've gone above and beyond and suggested more functionalities within the task button! I wasn't even considering this for an MVP implementation. But if there is another way to delete draft, then I like the option of "discard changes" when pressing the back button for an in-progress form. Just not sure how much LOE this adds from an engineering perspective 🙂
SubTasks
CC @Rkareko
These 3 are a must have, for users that are trying to leave an open form.
The options while opening a saved draft i.e open draft, delete draft and cancel, it's fine to drop all them. This means, when someone clicks on a saved draft, we open the draft directly without showing the dialog. When they try to leave the form without submitting, we resurface the same options when saving draft i.e save draft, discard form, cancel. Cc: @joyce-x-chen @f-odhiambo @Rkareko
suspend fun purge(resource: Resource, forcePurge: Boolean) {
try {
fhirEngine.purge(resource.resourceType, resource.logicalId, forcePurge)
} catch (resourceNotFoundException: ResourceNotFoundException) {
Timber.e(
"Purge failed -> Resource with ID ${resource.logicalId} does not exist",
resourceNotFoundException,
)
}
}
CC @joyce-x-chen @HenryRae
I'm not sure if this is supposed to be a bug or we should not do this use case in the first place.
Re-open a completed form, do some changes, and then save as draft; is not working:
See this recording (the bug starts at 0:26) https://drive.google.com/file/d/1qSL40LE1obTROEjzM2xfPoMg1DHA3ffx/view?usp=sharing
Thanks @FikriMilano. That appears to be a bug, because you should not be able to open a completed form (that would be editing, not drafting). You should only be able to open and edit forms that have been saved as a draft.
However, I observed a missing UI change - after the draft is submitted the first time (as well as any subsequent time), the task should appear as yellow with the in-progress icon as in Henry's designs here cc: @Rkareko @f-odhiambo. Do we need a separate issue for the UI changes?
Next steps from the Engage project standup:
@HenryRae would you be ok with us maintaining the + sign for the " in progress" task status (represented by yellow) instead of using the circular progress icon?
Most of the time, the circular progress icon isn't an action button and it's more straightforward to maintain the + button (SDK default). Thank you cc: @rowo
Describe the feature request
A few clients, including SID, Columbia, and PAHO have expressed interest in being able to save a draft of a form that is in progress.
Currently, there are two possible outcomes with a form:
The scope of an MVP feature could be:
Not in scope of the MVP
Example use cases
Acceptance criteria
Implementation plan (For Engineers)
status
=in-progress