Anthony-Nolan / Atlas

A free & open-source Donor Search Algorithm Service
GNU General Public License v3.0
9 stars 5 forks source link

Fetch donor information in matching algorithm to avoid MPA fetching donors again #728

Closed benbelow closed 1 year ago

benbelow commented 2 years ago

The matching algorithm already needs to query the donor store to fetch e.g. external donor code and registry info.

Match prediction algorithm also queries the donor store for registry + ethnicity info - but if this was included in the matching results, we could remove the MPA -> Donor SQL queries, and save some time.

zabeen commented 1 year ago

Adding this ticket to backlog as it would also prevent search failure caused by a matching donor that has been removed from the donor store since the search began, as was the cause of #1030

zabeen commented 1 year ago

HLD

Matching algorithm changes

Match prediction changes

zabeen commented 1 year ago
  • If a match result donor cannot be found in the donor store, then code should not throw an exception but simply remove that donor from the result set before it is written

@IgorKupreychik I just found this in the support README. It makes a good point that if a "donor not found" exception is thrown during matching, then retry logic will automatically re-run the search by which time the donor deletion update should have reached the matching db. That's probably why we have not observed this issue in matching all this time.

On that basis, I suggest we don't remove the donor from the result set, as that would mask syncing issues between donor store and matching db.

I do think we should catch and log a clear trace message (and then rethrow) so it is easy to understand what went wrong

zabeen commented 1 year ago

Testing Notes

DmitriyShcherbina commented 1 year ago

@zabeen Testing status: Ok

Image Image Image