-
Notifications
You must be signed in to change notification settings - Fork 59
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
[Feature] Delete saved draft of QuestionnaireResponses
when clicking "delete draft"
#3605
Comments
Q. QR Status - |
As discussed
TBD |
Since the deletes cannot be propagated to other devices the following is likely to occur :
|
Some issues TBD
|
isn't this replaced by #3611 ? |
@pld cc @f-odhiambo One of the assumptions for the Save Draft MVP is that This ticket ( #3605 ) deals with deleting an existing draft. See this comment that details the UI/UX for this |
OK, so this will delete the 1 draft that may exist? |
@f-odhiambo @dubdabasoduba The SDK has a ConflictResolver.
On FHIRCore AcceptLocalConflictResolver is set. |
QuestionnaireResponses
from the local SQLite databaseQuestionnaireResponses
when clicking "delete draft"
@f-odhiambo @dubdabasoduba As a follow up, the Changes to handle conflicts during download PR states that |
Delete options
Options for propagating deletes across devices A background worker would have to be implemented that checks for a resource indicating that a certain
Next steps
|
I would go with a soft delete and then instead of introducing the new (Flag) resource use an additive field on the QR to track a deleted resource, for example the Meta tags. That way when the background worker runs to do deletes it will always find the flag unaltered by any other subsequent updates to the QR. We should confirm that the SDK also guarantees deletes of any unsynced local (patch) changes on the device that may be linked to the QR. |
@ndegwamartin This is option 1 as stated above. It fails due to the following
This means that the additive field (e.g metatag) is not added to the |
@Rkareko I agree with @ndegwamartin Let's go with the Based on the review we had today we can approach it as follows
Note: The option that uses the FLAG resources is faster to implement because we don't have to think much about other product relations. However, the Audit Trail would be the best for this kind of thing, and it gives us the opportunity to start the audit trailing work. We can also a 3rd option which is to add the ability to define Conflict resolution strategies per resources. This is much more complicated and needs changes on the SDK. |
Based on the discussion we had on Nov 26th @Rkareko , let's use a flag and in the identifier we pass the QR ID to link them as an entry point for the background worker Here is a sample Flag and FHIR Path expression to query it {
"resourceType": "Flag",
"id": "example",
"identifier": [
{
"value": "QuestionnaireResponse/12345"
}
],
"status": "active",
"code": {
"coding": [
{
"system": "http://smartregister.org",
"code": "delete_draft",
"display": "Delete Draft"
}
],
"text": "QR Draft has been deleted"
},
"subject": {
"reference": "Patient/example",
"display": "Peter Patient"
},
"period": {
"start": "2024-11-26",
"end": "2024-11-26"
}
} |
After further discussions, the use of AuditEvent resource appears to be a better choice for propagating the deleted drafts across devices. A reference to the
|
The following
|
Describe the feature request.
Implement a feature to delete all saved drafts of
QuestionnaireResponses
from the local SQLite database when the user opts to save a questionnaire as a draft. This will help manage storage and ensure that outdated drafts do not clutter the database.Additional context
Currently, when a questionnaire is saved as a draft, it remains in the local database. This can lead to confusion and unnecessary data accumulation. By purging these drafts, we can maintain a cleaner state in the database.
Follow up ticket for #3541
Acceptance criteria
QuestionnaireResponses
marked as drafts.QuestionnaireResponses
marked as drafts after the deletion.Area path
Implementation plan (For Engineers)
LAUNCH_DELETE_DRAFT_FORM
AlertDialogFragment
class that calls the showCancelAlert function. Implement the logic forOpen Draft
,Delete Draft
andCancel
buttonsstatus
of theQuestionnaireResponse
containing the draft changes tostopped
AlertDialogFragment
defined above)The text was updated successfully, but these errors were encountered: