summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/pseudonym/extensions.kt11
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt3
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt4
3 files changed, 15 insertions, 3 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/pseudonym/extensions.kt b/src/main/kotlin/dev/dnpm/etl/processor/pseudonym/extensions.kt
index 21f3a7f..cc13a04 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/pseudonym/extensions.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/pseudonym/extensions.kt
@@ -95,6 +95,9 @@ infix fun PatientRecord.pseudonymizeWith(pseudonymizeService: PseudonymizeServic
this.systemicTherapies?.filterNotNull()?.forEach { systemicTherapy ->
systemicTherapy.history?.filterNotNull()?.forEach { it.patient?.id = patientPseudonym }
}
+ this.studyInclusions?.filterNotNull()?.forEach { studyInclusion ->
+ studyInclusion.history?.filterNotNull()?.forEach { it.patient?.id = patientPseudonym }
+ }
this.followUps?.filterNotNull()?.forEach { it.patient?.id = patientPseudonym }
this.msiFindings?.filterNotNull()?.forEach { it.patient?.id = patientPseudonym }
@@ -278,6 +281,14 @@ infix fun PatientRecord.anonymizeContentWith(pseudonymizeService: PseudonymizeSe
history.basedOn?.id = history.basedOn?.id?.let(::anonymize)
}
}
+
+ this.studyInclusions?.filterNotNull()?.forEach { studyInclusion ->
+ studyInclusion.history?.filterNotNull()?.forEach { history ->
+ history.id = history.id?.let(::anonymize)
+ history.reason?.id = history.reason?.id?.let(::anonymize)
+ history.basedOn?.id = history.basedOn?.id?.let(::anonymize)
+ }
+ }
}
fun PatientRecord.ensureMetaDataIsInitialized() {
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt
index 6ce9d14..d94bfb3 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt
@@ -372,11 +372,12 @@ class RequestProcessor(
}
private fun fingerprint(s: String): Fingerprint {
- return Fingerprint(
+ val f = Fingerprint(
Base32().encodeAsString(DigestUtils.sha256(s))
.replace("=", "")
.lowercase()
)
+ return f
}
}
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt
index 8433e93..5668632 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/services/RequestProcessorTest.kt
@@ -120,7 +120,7 @@ class RequestProcessorTest {
randomRequestId(),
PatientPseudonym("TEST_12345678901"),
PatientId("P1"),
- Fingerprint("tyfimuuc7okhnoholo6jx5o5os3n7haelezphr4477uxbzlotvra"),
+ Fingerprint("qabfhnkyzgnwbk3lvan2su6ttfx6lw5kse4csrv6owwgjewo26xq"),
RequestType.MTB_FILE,
SubmissionType.TEST,
RequestStatus.SUCCESS,
@@ -183,7 +183,7 @@ class RequestProcessorTest {
randomRequestId(),
PatientPseudonym("TEST_12345678901"),
PatientId("P1"),
- Fingerprint("q3qfwecsw3tcmdsg4kg5ki4ob3qw3warnwi4qc54nptjgzft53nq"),
+ Fingerprint("x2cyiw4nbwbxczmo3cmkct4yvumc6yzy37p7fk3gjfu2evvq66oq"),
RequestType.MTB_FILE,
SubmissionType.TEST,
RequestStatus.SUCCESS,