- Added logs when MDM candidate search parameters are not defined and candidate search limit is exceeded. (#5446)

- fixed extra indentation for example survivorship rule in quickstart.md
This commit is contained in:
TynerGjs 2023-11-10 13:51:26 -05:00 committed by GitHub
parent c89fc46863
commit 8a39da4e91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 6 deletions

View File

@ -0,0 +1,4 @@
---
type: fix
issue: 5445
title: "Added warnings when MDM candidate search parameters are not defined and candidate search limit is exceeded."

View File

@ -87,9 +87,6 @@ public class MdmMessageHandler implements MessageHandler {
if (toProcess) {
matchMdmAndUpdateLinks(sourceResource, msg);
}
} catch (TooManyCandidatesException e) {
ourLog.error(e.getMessage(), e);
// skip this one with an error message and continue processing
} catch (Exception e) {
ourLog.error("Failed to handle MDM Matching Resource:", e);
throw e;
@ -123,6 +120,12 @@ public class MdmMessageHandler implements MessageHandler {
ourLog.trace("Not processing modified message for {}", theMsg.getOperationType());
}
} catch (Exception e) {
if (e instanceof TooManyCandidatesException) {
ourLog.debug(
"Failed to handle MDM Matching for resource: {} since candidate matches exceeded the "
+ "candidate search limit",
theSourceResource.getIdElement());
}
log(mdmContext, "Failure during MDM processing: " + e.getMessage(), e);
mdmContext.addTransactionLogMessage(e.getMessage());
} finally {

View File

@ -159,7 +159,8 @@ public class MdmCandidateSearchSvc {
myCandidateSearcher.search(theResourceType, resourceCriteria, theRequestPartitionId);
if (!bundleProvider.isPresent()) {
throw new TooManyCandidatesException(Msg.code(762) + "More than " + myMdmSettings.getCandidateSearchLimit()
+ " candidate matches found for " + resourceCriteria + ". Aborting mdm matching.");
+ " candidate matches found for " + resourceCriteria + ". Aborting mdm matching. Updating the "
+ "candidate search parameters is strongly recommended for better performance of MDM.");
}
List<IBaseResource> resources = bundleProvider.get().getAllResources();

View File

@ -149,7 +149,7 @@ public class MdmCandidateSearchSvcIT extends BaseMdmR4Test {
myMdmCandidateSearchSvc.findCandidates("Patient", newJane, RequestPartitionId.allPartitions());
fail();
} catch (TooManyCandidatesException e) {
assertEquals("HAPI-0762: More than 3 candidate matches found for Patient?identifier=http%3A%2F%2Fa.tv%2F%7CID.JANE.123&active=true. Aborting mdm matching.", e.getMessage());
assertEquals("HAPI-0762: More than 3 candidate matches found for Patient?identifier=http%3A%2F%2Fa.tv%2F%7CID.JANE.123&active=true. Aborting mdm matching. Updating the candidate search parameters is strongly recommended for better performance of MDM.", e.getMessage());
}
}

View File

@ -136,7 +136,10 @@ public class MdmRuleValidator implements IMdmRuleValidator {
private void validateSearchParams(MdmRulesJson theMdmRulesJson) {
ourLog.info("Validating search parameters {}", theMdmRulesJson.getCandidateSearchParams());
if (theMdmRulesJson.getCandidateSearchParams().isEmpty()) {
ourLog.warn("No candidate search parameter was found. Defining candidate search parameter is strongly "
+ "recommended for better performance of MDM");
}
for (MdmResourceSearchParamJson searchParams : theMdmRulesJson.getCandidateSearchParams()) {
searchParams
.iterator()