Skip to content

Commit 2880b9e

Browse files
committed
Merge remote-tracking branch 'origin/dev' into Jmpi-bug-notification-screen-pointing-to-deleted-GR-2
2 parents ffae04e + 7203d70 commit 2880b9e

File tree

21 files changed

+126
-138
lines changed

21 files changed

+126
-138
lines changed

JeMPI_Apps/JeMPI_Configuration/reference/config-reference-link-d-validate-dp-match-dp.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@
201201
"indexGoldenRecord": "@index(exact)"
202202
}
203203
],
204+
"indexes": {
205+
"linking": {
206+
"national_id": {
207+
"props": "@index(exact)"
208+
}
209+
}
210+
},
204211
"rules": {
205212
"link": {
206213
"deterministic": {

JeMPI_Apps/JeMPI_Configuration/src/main/scala/configuration/CustomLinkerBackEnd.scala

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ object CustomLinkerBackEnd {
2929
.mkString(sys.props("line.separator"))
3030
}
3131

32+
/*
3233
def createApplyFunctions(): String = {
3334
3435
def applyFields(): String = {
@@ -59,8 +60,10 @@ object CustomLinkerBackEnd {
5960
|${" " * 3} interaction.uniqueInteractionData(),
6061
|${" " * 3} new CustomDemographicData(${applyFields()}));
6162
|${" " * 3}}""".stripMargin
63+
6264
}
6365
66+
*/
6467
config.demographicFields
6568
.filter(f => f.linkMetaData.isDefined)
6669
.foreach(f => {
@@ -87,14 +90,12 @@ object CustomLinkerBackEnd {
8790
|
8891
|${createGenerateFunctions()}
8992
|
90-
| ${createApplyFunctions()}
91-
|
9293
| static void updateGoldenRecordFields(
9394
| final LibMPI libMPI,
9495
| final float threshold,
9596
| final String interactionId,
9697
| final String goldenId) {
97-
| final var expandedGoldenRecord = libMPI.findExpandedGoldenRecords(List.of(goldenId)).get(0);
98+
| final var expandedGoldenRecord = libMPI.findExpandedGoldenRecords(List.of(goldenId)).getFirst();
9899
| final var goldenRecord = expandedGoldenRecord.goldenRecord();
99100
| final var demographicData = goldenRecord.demographicData();
100101
| var k = 0;
@@ -105,13 +106,15 @@ object CustomLinkerBackEnd {
105106
val fieldName = Utils.snakeCaseToCamelCase(field_name)
106107
writer.println(
107108
s"""${" " * 6}k += LinkerDWH.helperUpdateGoldenRecordField(libMPI, interactionId, expandedGoldenRecord,
108-
|${" " * 6} "$fieldName", demographicData.$fieldName, CustomDemographicData::get${fieldName
109-
.charAt(0)
110-
.toUpper}${fieldName.substring(1)})
109+
|${" " * 6} "$fieldName", demographicData.$fieldName,
110+
|${" " * 6} expandedGoldenRecord.interactionsWithScore()
111+
|${" " * 6} .stream()
112+
|${" " * 6} .map(rec -> rec.interaction().demographicData().$fieldName))
111113
|${" " * 12}? 1
112114
|${" " * 12}: 0;""".stripMargin
113115
)
114116
})
117+
115118
writer.println(s"""
116119
|${" " * 6}if (k > 0) {
117120
|${" " * 6} LinkerDWH.helperUpdateInteractionsScore(libMPI, threshold, expandedGoldenRecord);

JeMPI_Apps/JeMPI_Configuration/src/main/scala/configuration/CustomPatient.scala

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private object CustomPatient {
6161
)
6262
}
6363
writer.println()
64-
for (field <- config.demographicFields) {
64+
/* for (field <- config.demographicFields) {
6565
val typeString = field.fieldType
6666
val fieldName = Utils.snakeCaseToCamelCase(field.fieldName)
6767
writer.println(
@@ -73,7 +73,7 @@ private object CustomPatient {
7373
|""".stripMargin
7474
)
7575
}
76-
76+
*/
7777
writer.println(
7878
s"""${" " * indent * 1}public $customClassNameCustomDemographicData() {""".stripMargin
7979
)
@@ -83,6 +83,20 @@ private object CustomPatient {
8383
|""".stripMargin
8484
)
8585

86+
writer.print(
87+
s"""${" " * indent * 1}public $customClassNameCustomDemographicData(final $customClassNameCustomDemographicData demographicData) {"""
88+
)
89+
config.demographicFields.zipWithIndex.foreach { case (field, idx) =>
90+
val fieldName = Utils.snakeCaseToCamelCase(field.fieldName)
91+
writer.print(
92+
s"""
93+
|${" " * indent * 2}this.$fieldName = demographicData.$fieldName;""".stripMargin
94+
)
95+
}
96+
writer.println(s"""
97+
|${" " * indent * 1}}
98+
|""".stripMargin)
99+
86100
writer.println(
87101
s"""${" " * indent * 1}public $customClassNameCustomDemographicData(""".stripMargin
88102
)

JeMPI_Apps/JeMPI_Configuration/src/main/scala/configuration/CustomPostgresqlGoldenRecord.scala

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,10 @@ private object CustomPostgresqlGoldenRecord {
2323
|final class $customClassName extends CustomDemographicData implements NodeData {
2424
|
2525
| $customClassName(final CustomDemographicData customDemographicData) {
26-
| super(${fields
27-
.map(field =>
28-
s"""customDemographicData.${Utils.snakeCaseToCamelCase(
29-
field.fieldName
30-
)}"""
31-
)
32-
.mkString(s",${sys.props("line.separator")} ")});
26+
| super(customDemographicData);
3327
| }
3428
|
35-
|}
36-
|""".stripMargin
29+
|}""".stripMargin
3730
)
3831
writer.close()
3932
}

JeMPI_Apps/JeMPI_Configuration/src/main/scala/configuration/CustomPostgresqlInteraction.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,7 @@ private object CustomPostgresqlInteraction {
2323
|final class $customClassName extends CustomDemographicData implements NodeData {
2424
|
2525
| $customClassName(final CustomDemographicData customDemographicData) {
26-
| super(${fields
27-
.map(field =>
28-
s"""customDemographicData.${Utils.snakeCaseToCamelCase(
29-
field.fieldName
30-
)}"""
31-
)
32-
.mkString(s",${sys.props("line.separator")} ")});
26+
| super(customDemographicData);
3327
| }
3428
|
3529
|}

JeMPI_Apps/JeMPI_Configuration/src/main/scala/configuration/Main.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ object Main {
4444
CustomLinkerProbabilistic.generate(config)
4545
CustomLinkerBackEnd.generate(config)
4646
CustomLinkerMU.generate(config)
47-
CustomPostgresqlInteraction.generate(config.demographicFields)
48-
CustomPostgresqlGoldenRecord.generate(config.demographicFields)
47+
// CustomPostgresqlInteraction.generate(config.demographicFields)
48+
// CustomPostgresqlGoldenRecord.generate(config.demographicFields)
4949
CustomAsyncHelper.generate(config)
5050
CustomPatient.generate(config)
5151
CustomFieldTallies.generate(config)

JeMPI_Apps/JeMPI_LibMPI/src/main/java/org/jembi/jempi/libmpi/lib/hooks/indexes/LibMPIIndexesHooks.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public LibMPIIndexesHooks(final LibMPIClientInterface clientIn) {
1616

1717
@Override
1818
public Option<MpiGeneralError> beforeLinkingHook() {
19-
if (client.shouldUpdateLinkingIndexes()) {
19+
if (Boolean.TRUE.equals(client.shouldUpdateLinkingIndexes())) {
2020
LOGGER.info("Updating indexes for linking.");
2121
return client.loadLinkingIndexes();
2222
}
@@ -25,7 +25,7 @@ public Option<MpiGeneralError> beforeLinkingHook() {
2525

2626
@Override
2727
public Option<MpiGeneralError> afterLinkingHook() {
28-
if (client.shouldUpdateLinkingIndexes()) {
28+
if (Boolean.TRUE.equals(client.shouldUpdateLinkingIndexes())) {
2929
LOGGER.info("Adding default indexes after linking.");
3030
return client.loadDefaultIndexes();
3131
}

JeMPI_Apps/JeMPI_LibMPI/src/main/java/org/jembi/jempi/libmpi/postgresql/CustomGoldenRecordData.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

JeMPI_Apps/JeMPI_LibMPI/src/main/java/org/jembi/jempi/libmpi/postgresql/CustomInteractionData.java

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.jembi.jempi.libmpi.postgresql;
2+
3+
import org.jembi.jempi.shared.models.CustomDemographicData;
4+
5+
final class GoldenRecordData extends CustomDemographicData implements NodeData {
6+
7+
GoldenRecordData(final CustomDemographicData customDemographicData) {
8+
super(customDemographicData);
9+
}
10+
11+
}

0 commit comments

Comments
 (0)