mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-07-01 14:12:55 +00:00
Merge branch 'refs/heads/master' into 63-check-consent-status
This commit is contained in:
@ -5,7 +5,7 @@ import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
war
|
war
|
||||||
id("org.springframework.boot") version "3.4.5"
|
id("org.springframework.boot") version "3.5.0"
|
||||||
id("io.spring.dependency-management") version "1.1.7"
|
id("io.spring.dependency-management") version "1.1.7"
|
||||||
kotlin("jvm") version "1.9.25"
|
kotlin("jvm") version "1.9.25"
|
||||||
kotlin("plugin.spring") version "1.9.25"
|
kotlin("plugin.spring") version "1.9.25"
|
||||||
|
@ -279,12 +279,15 @@ infix fun Mtb.pseudonymizeWith(pseudonymizeService: PseudonymizeService) {
|
|||||||
this.responses?.forEach { it.patient.id = patientPseudonym }
|
this.responses?.forEach { it.patient.id = patientPseudonym }
|
||||||
this.specimens?.forEach { it.patient.id = patientPseudonym }
|
this.specimens?.forEach { it.patient.id = patientPseudonym }
|
||||||
this.priorDiagnosticReports?.forEach { it.patient.id = patientPseudonym }
|
this.priorDiagnosticReports?.forEach { it.patient.id = patientPseudonym }
|
||||||
this.performanceStatus.forEach { it.patient.id = patientPseudonym }
|
this.performanceStatus?.forEach { it.patient.id = patientPseudonym }
|
||||||
this.systemicTherapies.forEach {
|
this.systemicTherapies?.forEach {
|
||||||
it.history?.forEach {
|
it.history?.forEach {
|
||||||
it.patient.id = patientPseudonym
|
it.patient.id = patientPseudonym
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.followUps?.forEach {
|
||||||
|
it.patient.id = patientPseudonym
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +44,8 @@ import org.springframework.kafka.core.KafkaTemplate
|
|||||||
import org.springframework.kafka.support.SendResult
|
import org.springframework.kafka.support.SendResult
|
||||||
import org.springframework.retry.policy.SimpleRetryPolicy
|
import org.springframework.retry.policy.SimpleRetryPolicy
|
||||||
import org.springframework.retry.support.RetryTemplateBuilder
|
import org.springframework.retry.support.RetryTemplateBuilder
|
||||||
|
import java.time.Instant
|
||||||
|
import java.util.*
|
||||||
import java.util.concurrent.CompletableFuture.completedFuture
|
import java.util.concurrent.CompletableFuture.completedFuture
|
||||||
import java.util.concurrent.ExecutionException
|
import java.util.concurrent.ExecutionException
|
||||||
|
|
||||||
@ -309,24 +311,28 @@ class KafkaMtbFileSenderTest {
|
|||||||
}.build()
|
}.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun dnpmV2MtbFile(): Mtb = Mtb.builder()
|
fun dnpmV2MtbFile(): Mtb {
|
||||||
.withPatient(
|
return Mtb().apply {
|
||||||
dev.pcvolkmer.mv64e.mtb.Patient.builder()
|
this.patient = dev.pcvolkmer.mv64e.mtb.Patient().apply {
|
||||||
.withId("PID")
|
this.id = "PID"
|
||||||
.withBirthDate("2000-08-08")
|
this.birthDate = Date.from(Instant.now())
|
||||||
.withGender(CodingGender.builder().withCode(CodingGender.Code.MALE).build())
|
this.gender = GenderCoding().apply {
|
||||||
.build()
|
this.code = GenderCodingCode.MALE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.episodesOfCare = listOf(
|
||||||
|
MtbEpisodeOfCare().apply {
|
||||||
|
this.id = "1"
|
||||||
|
this.patient = Reference().apply {
|
||||||
|
this.id = "PID"
|
||||||
|
}
|
||||||
|
this.period = PeriodDate().apply {
|
||||||
|
this.start = Date.from(Instant.now())
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.withEpisodesOfCare(
|
}
|
||||||
listOf(
|
}
|
||||||
MTBEpisodeOfCare.builder()
|
|
||||||
.withId("1")
|
|
||||||
.withPatient(Reference("PID"))
|
|
||||||
.withPeriod(PeriodDate.builder().withStart("2023-08-08").build())
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
fun bwhcV1kafkaRecordData(requestId: RequestId, consentStatus: Consent.Status): MtbRequest {
|
fun bwhcV1kafkaRecordData(requestId: RequestId, consentStatus: Consent.Status): MtbRequest {
|
||||||
return BwhcV1MtbFileRequest(requestId, bwhcV1MtbFile(consentStatus))
|
return BwhcV1MtbFileRequest(requestId, bwhcV1MtbFile(consentStatus))
|
||||||
|
@ -49,6 +49,8 @@ import org.springframework.test.web.client.MockRestServiceServer
|
|||||||
import org.springframework.test.web.client.match.MockRestRequestMatchers.*
|
import org.springframework.test.web.client.match.MockRestRequestMatchers.*
|
||||||
import org.springframework.test.web.client.response.MockRestResponseCreators.withStatus
|
import org.springframework.test.web.client.response.MockRestResponseCreators.withStatus
|
||||||
import org.springframework.web.client.RestTemplate
|
import org.springframework.web.client.RestTemplate
|
||||||
|
import java.time.Instant
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class RestDipMtbFileSenderTest {
|
class RestDipMtbFileSenderTest {
|
||||||
|
|
||||||
@ -155,7 +157,7 @@ class RestDipMtbFileSenderTest {
|
|||||||
withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it)
|
withStatus(requestWithResponse.httpStatus).body(requestWithResponse.body).createResponse(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
val response = restMtbFileSender.send(DnpmV2MtbFileRequest(TEST_REQUEST_ID, dnpmV2MtbFile))
|
val response = restMtbFileSender.send(DnpmV2MtbFileRequest(TEST_REQUEST_ID, dnpmV2MtbFile()))
|
||||||
assertThat(response.status).isEqualTo(requestWithResponse.response.status)
|
assertThat(response.status).isEqualTo(requestWithResponse.response.status)
|
||||||
assertThat(response.body).isEqualTo(requestWithResponse.response.body)
|
assertThat(response.body).isEqualTo(requestWithResponse.response.body)
|
||||||
}
|
}
|
||||||
@ -267,24 +269,28 @@ class RestDipMtbFileSenderTest {
|
|||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val dnpmV2MtbFile: Mtb = Mtb.builder()
|
fun dnpmV2MtbFile(): Mtb {
|
||||||
.withPatient(
|
return Mtb().apply {
|
||||||
dev.pcvolkmer.mv64e.mtb.Patient.builder()
|
this.patient = dev.pcvolkmer.mv64e.mtb.Patient().apply {
|
||||||
.withId("PID")
|
this.id = "PID"
|
||||||
.withBirthDate("2000-08-08")
|
this.birthDate = Date.from(Instant.now())
|
||||||
.withGender(CodingGender.builder().withCode(CodingGender.Code.MALE).build())
|
this.gender = GenderCoding().apply {
|
||||||
.build()
|
this.code = GenderCodingCode.MALE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.episodesOfCare = listOf(
|
||||||
|
MtbEpisodeOfCare().apply {
|
||||||
|
this.id = "1"
|
||||||
|
this.patient = Reference().apply {
|
||||||
|
this.id = "PID"
|
||||||
|
}
|
||||||
|
this.period = PeriodDate().apply {
|
||||||
|
this.start = Date.from(Instant.now())
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.withEpisodesOfCare(
|
}
|
||||||
listOf(
|
}
|
||||||
MTBEpisodeOfCare.builder()
|
|
||||||
.withId("1")
|
|
||||||
.withPatient(Reference("PID"))
|
|
||||||
.withPeriod(PeriodDate.builder().withStart("2023-08-08").build())
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
private const val ERROR_RESPONSE_BODY = "Sonstiger Fehler bei der Übertragung"
|
private const val ERROR_RESPONSE_BODY = "Sonstiger Fehler bei der Übertragung"
|
||||||
|
|
||||||
|
@ -21,10 +21,8 @@ package dev.dnpm.etl.processor.pseudonym
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import de.ukw.ccc.bwhc.dto.*
|
import de.ukw.ccc.bwhc.dto.*
|
||||||
import dev.pcvolkmer.mv64e.mtb.MTBEpisodeOfCare
|
import de.ukw.ccc.bwhc.dto.Patient
|
||||||
import dev.pcvolkmer.mv64e.mtb.Mtb
|
import dev.pcvolkmer.mv64e.mtb.*
|
||||||
import dev.pcvolkmer.mv64e.mtb.PeriodDate
|
|
||||||
import dev.pcvolkmer.mv64e.mtb.Reference
|
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.junit.jupiter.api.Nested
|
import org.junit.jupiter.api.Nested
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
@ -36,6 +34,8 @@ import org.mockito.kotlin.anyValueClass
|
|||||||
import org.mockito.kotlin.doAnswer
|
import org.mockito.kotlin.doAnswer
|
||||||
import org.mockito.kotlin.whenever
|
import org.mockito.kotlin.whenever
|
||||||
import org.springframework.core.io.ClassPathResource
|
import org.springframework.core.io.ClassPathResource
|
||||||
|
import java.time.Instant
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension::class)
|
@ExtendWith(MockitoExtension::class)
|
||||||
class ExtensionsTest {
|
class ExtensionsTest {
|
||||||
@ -207,7 +207,7 @@ class ExtensionsTest {
|
|||||||
inner class UsingDnpmV2Datamodel {
|
inner class UsingDnpmV2Datamodel {
|
||||||
|
|
||||||
val FAKE_MTB_FILE_PATH = "mv64e-mtb-fake-patient.json"
|
val FAKE_MTB_FILE_PATH = "mv64e-mtb-fake-patient.json"
|
||||||
val CLEAN_PATIENT_ID = "63f8fd7b-8127-4f3c-8843-aa9199e21c29"
|
val CLEAN_PATIENT_ID = "e14bf9b6-7982-4933-a648-cfdea6484f1c"
|
||||||
|
|
||||||
private fun fakeMtbFile(): Mtb {
|
private fun fakeMtbFile(): Mtb {
|
||||||
val mtbFile = ClassPathResource(FAKE_MTB_FILE_PATH).inputStream
|
val mtbFile = ClassPathResource(FAKE_MTB_FILE_PATH).inputStream
|
||||||
@ -244,32 +244,26 @@ class ExtensionsTest {
|
|||||||
"TESTDOMAIN"
|
"TESTDOMAIN"
|
||||||
}.whenever(pseudonymizeService).prefix()
|
}.whenever(pseudonymizeService).prefix()
|
||||||
|
|
||||||
val mtbFile = Mtb.builder()
|
val mtbFile = Mtb().apply {
|
||||||
.withPatient(
|
this.patient = dev.pcvolkmer.mv64e.mtb.Patient().apply {
|
||||||
dev.pcvolkmer.mv64e.mtb.Patient.builder()
|
this.id = "PID"
|
||||||
.withId("1")
|
this.birthDate = Date.from(Instant.now())
|
||||||
.withBirthDate("2000-08-08")
|
this.gender = GenderCoding().apply {
|
||||||
.withGender(null)
|
this.code = GenderCodingCode.MALE
|
||||||
.build()
|
}
|
||||||
|
}
|
||||||
|
this.episodesOfCare = listOf(
|
||||||
|
MtbEpisodeOfCare().apply {
|
||||||
|
this.id = "1"
|
||||||
|
this.patient = Reference().apply {
|
||||||
|
this.id = "PID"
|
||||||
|
}
|
||||||
|
this.period = PeriodDate().apply {
|
||||||
|
this.start = Date.from(Instant.now())
|
||||||
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
.withEpisodesOfCare(
|
}
|
||||||
listOf(
|
|
||||||
MTBEpisodeOfCare.builder()
|
|
||||||
.withId("1")
|
|
||||||
.withPatient(Reference("1"))
|
|
||||||
.withPeriod(PeriodDate.builder().withStart("2023-08-08").build())
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.withClaims(null)
|
|
||||||
.withDiagnoses(null)
|
|
||||||
.withCarePlans(null)
|
|
||||||
.withClaimResponses(null)
|
|
||||||
.withHistologyReports(null)
|
|
||||||
.withNgsReports(null)
|
|
||||||
.withResponses(null)
|
|
||||||
.withSpecimens(null)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
mtbFile.pseudonymizeWith(pseudonymizeService)
|
mtbFile.pseudonymizeWith(pseudonymizeService)
|
||||||
mtbFile.anonymizeContentWith(pseudonymizeService)
|
mtbFile.anonymizeContentWith(pseudonymizeService)
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user