Skip to content

Commit adaafc3

Browse files
committed
Update invalidated patients from PDS
This should improve dealing with cases where a patient was invalidated without an NHS number, but they now have an NHS number. There are currently 75 patients in production marked as invalid. We first want to check whether any of these are now superseded, and whether, if we were to refresh their details from PDS, we would get new patient details for them. If this is the case then we should ensure that invalidated patients are also updated from PDS as part of the nightly background job. Jira-Issue: MAV-1962
1 parent f78ed1a commit adaafc3

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

app/jobs/patient_update_from_pds_job.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ class PatientUpdateFromPDSJob < ApplicationJob
88
def perform(patient)
99
raise MissingNHSNumber if patient.nhs_number.nil?
1010

11-
return if patient.invalidated?
12-
1311
pds_patient = PDS::Patient.find(patient.nhs_number)
1412

1513
if pds_patient.nhs_number != patient.nhs_number

spec/jobs/patient_update_from_pds_job_spec.rb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
end
1414
end
1515

16-
context "invalidated patient" do
17-
let!(:patient) { create(:patient, :invalidated) }
18-
19-
it "doesn't update the patient" do
20-
expect(patient).not_to receive(:update_from_pds!)
21-
perform_now
22-
end
23-
end
24-
2516
context "with an NHS number" do
2617
before { create(:gp_practice, ods_code: "Y12345") }
2718

@@ -61,6 +52,17 @@
6152
)
6253
end
6354

55+
context "when the patient is invalidated" do
56+
let!(:patient) do
57+
create(:patient, :invalidated, nhs_number: "9000000009")
58+
end
59+
60+
it "updates the patient details from PDS" do
61+
expect(patient).to receive(:update_from_pds!)
62+
perform_now
63+
end
64+
end
65+
6466
context "when the NHS number for the patient has changed" do
6567
let!(:patient) { create(:patient, nhs_number: "0123456789") }
6668

0 commit comments

Comments
 (0)