-
Notifications
You must be signed in to change notification settings - Fork 9
Look up NHS numbers for pending changes #3591
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
Conversation
bd7f5a7
to
eff9d20
Compare
eff9d20
to
71d7692
Compare
71d7692
to
ce7b35c
Compare
app/lib/update_patients_from_pds.rb
Outdated
priority:, | ||
queue:, | ||
wait: index * wait_between_jobs | ||
wait: jobs_queued * wait_between_jobs |
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.
How large do you think patients
could be? If the collection was large, later jobs could have very significant delays.
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 agree we need to think about this, but maybe we just need to deal with this until we can get Sidekiq in place, which I'd like to start on really soon.
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.
While I agree we have this problem, I don't think this change makes it significantly worse. Most parents don't have pending changes, and therefore there won't be that many additional jobs queued.
5d5926c
to
6d86338
Compare
patient_with_pending_changes.nhs_number = | ||
nil unless patient.nhs_number_changed? | ||
|
||
return unless patient_with_pending_changes.changed? | ||
|
||
if patient_with_pending_changes.nhs_number.present? && | ||
!patient_with_pending_changes.invalidated? | ||
return | ||
end |
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 goal of this bit is really unclear to me. Is it just me? Would it be worth adding a comment just to make it a bit clearer what it is doing? Or maybe put it behind a named method?
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.
Yeah agreed. It's basically doing this logic but for the patient with pending changes, but I will make it clearer.
6d86338
to
3280e31
Compare
3280e31
to
b57ac18
Compare
5cb7b60
to
059779f
Compare
d0a8129
to
56df2b6
Compare
059779f
to
5e461c8
Compare
1cf6b30
to
4e1811d
Compare
dc444db
to
e60f12e
Compare
65b8905
to
e5a081b
Compare
@thomasleese @misaka @murugapl how does the current PDS work affect this change? Is it worth getting this one over the line e.g. in v3.2.0? |
I've been wondering about this, I actually think the PDS work makes this particular PR redundant, as we'll be looking up NHS numbers prior to importing them, so this problem goes away (whereas now the matching is happening before the PDS lookup). |
e5a081b
to
83db116
Compare
This adds a job which handles updating the NHS number for a patient, if it has pending changes, and those changes are different enough to cause the NHS number to be different. This fixes a scenario where twins are uploaded and get flagged as duplicates, but the NHS number shows as the same meaning it's not obvious from the duplicate resolution UI that the patient needs to be created new.
At the same time as looking up the NHS number we should look up the NHS number on any pending changes to highlight this if the NHS number should be different.
This adds a feature test to cover the scenario where twins are uploaded with the same last name, address and date of birth one after the other, ensuring that the separate NHS numbers are shown in the duplicate resolution screen.
83db116
to
20c8015
Compare
|
Ok cool. Is there any test coverage that is worth bringing in to cover the bug, even if the implementation is ok? |
Yes, the twins feature test we could definitely keep I think. |
I've added the test in #4315. |
This ensures that when uploading twins, the second patient will have an NHS number in the pending changes and the users will see clearly that it is two different parents and both need to be kept.
Jira Ticket - MAV-273