Skip to content

Commit

Permalink
Merge branch 'dev' into CU-86bznypcf_Notifications-End-To-End-Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
NyashaMuusha authored Jul 29, 2024
2 parents d547f89 + ca5b193 commit 67b2966
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ private static boolean helperUpdateGoldenRecordField(
return changed;
}

private static String patientName(final Interaction interaction) {
var patientRecord = interaction.demographicData();
String givenName = patientRecord.fields.stream()
.filter(field -> "given_name".equals(field.ccTag()))
.map(DemographicData.DemographicField::value)
.findFirst()
.orElse("");
String familyName = patientRecord.fields.stream()
.filter(field -> "family_name".equals(field.ccTag()))
.map(DemographicData.DemographicField::value)
.findFirst()
.orElse("");
return (givenName + " " + familyName).trim();
}

/**
* Helper update interactions score.
*
Expand Down Expand Up @@ -126,7 +141,7 @@ static void helperUpdateInteractionsScore(
if (score <= threshold) {
sendNotification(Notification.NotificationType.UPDATE,
interaction.interactionId(),
DemographicData.getAliases(),
patientName(interaction),
new Notification.MatchData(expandedGoldenRecord.goldenRecord().goldenId(), score),
List.of());
}
Expand Down Expand Up @@ -325,14 +340,13 @@ static Either<List<ExternalLinkCandidate>, LinkInfo> linkInteraction(
aboveThresholdNotifications.add(new Notification.MatchData(v.goldenRecord().goldenId(), v.score()));
}
}).filter(v -> v.score() >= matchThreshold).collect(Collectors.toCollection(ArrayList::new));

if (candidatesAboveMatchThreshold.isEmpty()) {
if (candidatesInExternalLinkRange.isEmpty()) {
linkInfo = libMPI.createInteractionAndLinkToClonedGoldenRecord(interaction, 1.0F);
if (!belowThresholdNotifications.isEmpty()) {
sendNotification(Notification.NotificationType.BELOW_THRESHOLD,
linkInfo.interactionUID(),
DemographicData.getAliases(),
patientName(interaction),
new Notification.MatchData(linkInfo.goldenUID(), linkInfo.score()),
belowThresholdNotifications);
}
Expand All @@ -359,7 +373,7 @@ static Either<List<ExternalLinkCandidate>, LinkInfo> linkInteraction(
if (linkToGoldenId.score() <= matchThreshold + 0.1) {
sendNotification(Notification.NotificationType.ABOVE_THRESHOLD,
linkInfo.interactionUID(),
DemographicData.getAliases(),
patientName(interaction),
new Notification.MatchData(linkInfo.goldenUID(), linkInfo.score()),
aboveThresholdNotifications.stream()
.filter(m -> !Objects.equals(m.gID(),
Expand All @@ -385,7 +399,7 @@ static Either<List<ExternalLinkCandidate>, LinkInfo> linkInteraction(
if (!marginCandidates.isEmpty()) {
sendNotification(Notification.NotificationType.MARGIN,
linkInfo.interactionUID(),
DemographicData.getAliases(),
patientName(interaction),
new Notification.MatchData(linkInfo.goldenUID(), linkInfo.score()),
marginCandidates);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
"/record-details/:uid",
"/browse-records"
],
"readOnly": true,
"accessLevel": []
},
{
Expand Down Expand Up @@ -255,6 +256,7 @@
"/record-details/:uid",
"/browse-records"
],
"readOnly": true,
"accessLevel": []
},
{
Expand Down
4 changes: 2 additions & 2 deletions devops/linux/docker/deployment/deploy-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "9. Destroy JeMPI (This process will wipe all data and Volumes)."


# Prompt user for choice
read -p "Enter your choice (1-8): " choice
read -p "Enter your choice (1-9): " choice

# Function to ask for confirmation
confirm() {
Expand Down Expand Up @@ -249,6 +249,6 @@ case $choice in
exit 0
;;
*)
echo "Invalid choice. Please enter a number."
echo "Invalid choice. Please enter a number between 1-9."
;;
esac

0 comments on commit 67b2966

Please sign in to comment.