Skip to content

Conversation

murugapl
Copy link
Contributor

This implements the "cascading" search in MAV-1415. In the event an NHS number isn't found
through our default search, we try different PDS search options and return any unique NHS number we find.

Screenshot 2025-08-18 at 07 36 25

https://nhsd-jira.digital.nhs.uk/browse/MAV-1415

@thomasleese thomasleese added this to the v3.2.0 milestone Aug 18, 2025
@thomasleese thomasleese added the feature New functionality label Aug 18, 2025
@murugapl murugapl force-pushed the multiple-pds-searches-during-import branch from 2df858b to a53bc57 Compare August 19, 2025 08:04
@murugapl murugapl changed the base branch from next to perform-pds-search-for-all-patients August 19, 2025 08:04
@murugapl murugapl marked this pull request as ready for review August 19, 2025 08:04
@murugapl murugapl requested a review from a team as a code owner August 19, 2025 08:04
@murugapl murugapl force-pushed the perform-pds-search-for-all-patients branch from f2dc512 to 931294d Compare August 19, 2025 08:08
@murugapl murugapl force-pushed the multiple-pds-searches-during-import branch from a53bc57 to 86498f3 Compare August 19, 2025 08:18
@murugapl murugapl force-pushed the perform-pds-search-for-all-patients branch 2 times, most recently from a00670d to 29d1159 Compare August 19, 2025 08:28
@murugapl murugapl force-pushed the multiple-pds-searches-during-import branch from 86498f3 to d10fd9b Compare August 19, 2025 08:29
Base automatically changed from perform-pds-search-for-all-patients to next August 19, 2025 09:13
@thomasleese thomasleese requested review from a team as code owners August 19, 2025 16:18
@murugapl murugapl force-pushed the multiple-pds-searches-during-import branch from d10fd9b to 5ba56ae Compare August 19, 2025 16:24
@murugapl murugapl force-pushed the multiple-pds-searches-during-import branch 2 times, most recently from 42a5744 to 4507bee Compare August 19, 2025 18:11
@thomasleese thomasleese modified the milestones: v3.2.0, v3.3.0 Aug 20, 2025
@murugapl murugapl force-pushed the multiple-pds-searches-during-import branch 2 times, most recently from 273a09a to 6bc8a54 Compare August 20, 2025 19:38
Update PDS::Patient.search to accept history and fuzzy parameters. This allows us to
run tailored queries for MAV-1415.
…on outcome

This implements the "cascading" search in MAV-1415. In the event an NHS number isn't found
through our default search, we try different PDS search options and return any uniques Nhs number we find.
Introduces a complete test suite for `ProcessPatientChangesetsJob` to verify the cascading search flow, job enquieing process and NHS number retrieval based on various search results.
@murugapl murugapl force-pushed the multiple-pds-searches-during-import branch 3 times, most recently from cda7428 to 18597e8 Compare August 21, 2025 08:45
This will store the results from PDS searches done during a class or cohort import.
It will store the step name, NHS number retrieved if any and result (one match, too many etc).

We can use this to surface which step found the NHS number on a record to the user in the future.
This saves all the PDS searches performed and their results on the patient and import when committing the records.
This model was not covered by any tests directly.
This covers the case where the initial and all subsequent searches do not return results from PDS, so the patient should have multiple `pds_search_results`.
When previously a signle no_patient respponse from PDS was enough, we now need to stub the whole flow to return nothing or simply return the correct NHS number in the first request.
For data consistency, and to enable flaggind PDS info in the patient activity log, it would help to store any NHS numbers retrieved from the daily lookup job as well. This is unlikely to happen given that the dialy job is more restrictive than the import pds jobs. But int he event it does, we should have the info stored.
@murugapl murugapl force-pushed the multiple-pds-searches-during-import branch from 18597e8 to d2b5f98 Compare August 21, 2025 10:20
Copy link

@misaka misaka merged commit 021c6a5 into next Aug 22, 2025
13 checks passed
@misaka misaka deleted the multiple-pds-searches-during-import branch August 22, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants