Repository navigation
fix(fhir search): skip untranslatable MPI patients so one bad record doesn't fail the whole search - #73
Merged
Conversation
…doesn't fail the whole search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
FHIR-mode MPI search (
searchPatient→getMpiPatientMatches) fails wholesale whenever a single linked source patient can't be translated. In production,searchMpifrom the EMR returnedmpiError: trueeven though both OpenCR requests succeeded (verified via the OpenHIM transaction log):Auth, endpoints and queries are all fine — the exception is thrown in Java, while translating a linked source patient via
patientTranslator.toOpenmrsType(...)(e.g. a cross-facility record whose identifier type/system isn't resolvable locally). Because the translation loop had no per-record guard, one bad patient aborted the entire result set.Fix
Wrap each linked source patient's translation in its own
try/catch. A record that fails to translate is now logged (with its reference) and skipped, so the search returns every patient that does translate instead of failing completely. The log line also surfaces the exact translation defect for follow-up.Testing
mvn clean packagebuilds green.