-
Notifications
You must be signed in to change notification settings - Fork 10
Disallow offline spreadsheets from editing records received from the Imms API #4650
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
base: next
Are you sure you want to change the base?
Disallow offline spreadsheets from editing records received from the Imms API #4650
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.
The functionality looks good, I think we should try and make it more generic, so fewer classes need to know about the Immunisations API and the logic around it. I think if we can keep that limited to ImportDuplicateForm
, and then the views and controllers use methods from the form that would be ideal.
8bfd712
to
46802f3
Compare
@thomasleese I've done as you described in your comment. I don't think it's reasonable to keep this logic out of the |
46802f3
to
d6399b3
Compare
@misaka I just changed the logic to make it much more generic, like we discussed this morning. cc @thomasleese hopefully this makes you happy |
4016b4f
to
3ecde1a
Compare
Vaccination records which are received from the Imms API are considered immutable in Mavis, because we are not the vaccination record's primary source. As such, users should not be allowed to edit the records by any means, including an offline spreadsheet upload. We (Thomas, Mike, Alistair) considered exposing this as a validation error on the import, but that approach was discarded. This is because we would have needed to duplicate a lot of the import logic to decide whether it was appropriate to throw a validation error. This led to circular dependencies in the validation logic. Instead this approach was taken, where an adjusted import issue page is shown, forcing the user to discard the incoming changes. Manually set `apply_changes` in the `.html` Instead of depending on custom logic in the form.
3ecde1a
to
ab91ef1
Compare
There are a number of issues which cause unedited Imms API records to flag as duplicates when uploading an offline spreadsheet. These are listed below. ## Round time objects when comparing in `stage_changes` There was an issue with detecting import duplicates on `VaccinationRecord`s; the value in the offline spreadsheet was rounded to the nearest second, whereas the value in the database was accurate to the nearest millisecond. This was causing the times to show as a duplicate to review unnecessarily. ## ODS code The offline spreadsheet used to always use the session's ODS code, not the existing `VaccinationRecord`'s. ## Performer's names I see no reason to overwrite these if they're `nil` in the upload. ## Protocol Should always be `nil` for an Imms API record. ## Location This can't be properly encoded in the offline spreadsheet, so instead have ignored it on import if importing an Imms API record.
This is a nonsensical case which causes an error. As such it should be validated out.
Tests the case where no edits are made to the vaccination record between download and upload, for Imms API records.
This test file now includes a flu session, so describing it as "HPV" is no longer accurate.
ab91ef1
to
535ebd2
Compare
|
Vaccination records which are received from the Imms API are considered
immutable in Mavis, because we are not the vaccination record's primary
source. As such, users should not be allowed to edit the records by any
means, including an offline spreadsheet upload.
We (Thomas, Mike, Alistair) considered exposing this as a validation
error on the import, but that approach was discarded. This is because we
would have needed to duplicate a lot of the import logic to decide
whether it was appropriate to throw a validation error. This led to
circular dependencies in the validation logic.
Instead this approach was taken, where an adjusted import issue page is
shown, forcing the user to discard the incoming changes.
Off the back of this change, another issue needed to be resolved;
unedited vaccination records from the API were being flagged for review.
This required a bit of a rewrite of the import logic, as well as the offline
spreadsheet logic.
MAV-1781