fhir-emr
fhir-emr copied to clipboard
Revise server-side drafts
Currently, we have two type of drafts: server-side and local-side The server-side drafts were implemented similar to local-side: every time user edits the form (after the first editing) we save QR in status in-progress to the FHIR server.
This approach by-design has few flaws:
- Every time user edits form, it creates a new history instance (it might be critical for big questionnaires)
- There's no way to cancel changes that were done since the last saving the draft
I suggest new approach, that should fix these two issues:
- Don't save any QR resources to the DB until user manually confirm this action, as a result add new button called "Save draft"
- Add additional checks when the form was edited and not saved as draft:
- Ask user to confirm losing not-saved data in the way "You did changes to the form, do you want to discard changes and leave the page? Yes/No" on refreshing/leaving the page
- Ask the user either to save draft or discard changes when the user clicks Cancel
- Moreover, this approach can be used along with local-side drafts and can be always enabled for patient documents