@@ -93,6 +93,21 @@ private static boolean helperUpdateGoldenRecordField(
93
93
return changed ;
94
94
}
95
95
96
+ private static String patientName (final Interaction interaction ) {
97
+ var patientRecord = interaction .demographicData ();
98
+ String givenName = patientRecord .fields .stream ()
99
+ .filter (field -> "given_name" .equals (field .ccTag ()))
100
+ .map (DemographicData .DemographicField ::value )
101
+ .findFirst ()
102
+ .orElse ("" );
103
+ String familyName = patientRecord .fields .stream ()
104
+ .filter (field -> "family_name" .equals (field .ccTag ()))
105
+ .map (DemographicData .DemographicField ::value )
106
+ .findFirst ()
107
+ .orElse ("" );
108
+ return (givenName + " " + familyName ).trim ();
109
+ }
110
+
96
111
/**
97
112
* Helper update interactions score.
98
113
*
@@ -126,7 +141,7 @@ static void helperUpdateInteractionsScore(
126
141
if (score <= threshold ) {
127
142
sendNotification (Notification .NotificationType .UPDATE ,
128
143
interaction .interactionId (),
129
- DemographicData . getAliases ( ),
144
+ patientName ( interaction ),
130
145
new Notification .MatchData (expandedGoldenRecord .goldenRecord ().goldenId (), score ),
131
146
List .of ());
132
147
}
@@ -325,14 +340,13 @@ static Either<List<ExternalLinkCandidate>, LinkInfo> linkInteraction(
325
340
aboveThresholdNotifications .add (new Notification .MatchData (v .goldenRecord ().goldenId (), v .score ()));
326
341
}
327
342
}).filter (v -> v .score () >= matchThreshold ).collect (Collectors .toCollection (ArrayList ::new ));
328
-
329
343
if (candidatesAboveMatchThreshold .isEmpty ()) {
330
344
if (candidatesInExternalLinkRange .isEmpty ()) {
331
345
linkInfo = libMPI .createInteractionAndLinkToClonedGoldenRecord (interaction , 1.0F );
332
346
if (!belowThresholdNotifications .isEmpty ()) {
333
347
sendNotification (Notification .NotificationType .BELOW_THRESHOLD ,
334
348
linkInfo .interactionUID (),
335
- DemographicData . getAliases ( ),
349
+ patientName ( interaction ),
336
350
new Notification .MatchData (linkInfo .goldenUID (), linkInfo .score ()),
337
351
belowThresholdNotifications );
338
352
}
@@ -359,7 +373,7 @@ static Either<List<ExternalLinkCandidate>, LinkInfo> linkInteraction(
359
373
if (linkToGoldenId .score () <= matchThreshold + 0.1 ) {
360
374
sendNotification (Notification .NotificationType .ABOVE_THRESHOLD ,
361
375
linkInfo .interactionUID (),
362
- DemographicData . getAliases ( ),
376
+ patientName ( interaction ),
363
377
new Notification .MatchData (linkInfo .goldenUID (), linkInfo .score ()),
364
378
aboveThresholdNotifications .stream ()
365
379
.filter (m -> !Objects .equals (m .gID (),
@@ -385,7 +399,7 @@ static Either<List<ExternalLinkCandidate>, LinkInfo> linkInteraction(
385
399
if (!marginCandidates .isEmpty ()) {
386
400
sendNotification (Notification .NotificationType .MARGIN ,
387
401
linkInfo .interactionUID (),
388
- DemographicData . getAliases ( ),
402
+ patientName ( interaction ),
389
403
new Notification .MatchData (linkInfo .goldenUID (), linkInfo .score ()),
390
404
marginCandidates );
391
405
}
0 commit comments