mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-07-01 14:12:55 +00:00
chore: update dnpm mtb dto library (#113)
This commit is contained in:
@ -279,12 +279,15 @@ infix fun Mtb.pseudonymizeWith(pseudonymizeService: PseudonymizeService) {
|
||||
this.responses?.forEach { it.patient.id = patientPseudonym }
|
||||
this.specimens?.forEach { it.patient.id = patientPseudonym }
|
||||
this.priorDiagnosticReports?.forEach { it.patient.id = patientPseudonym }
|
||||
this.performanceStatus.forEach { it.patient.id = patientPseudonym }
|
||||
this.systemicTherapies.forEach {
|
||||
this.performanceStatus?.forEach { it.patient.id = patientPseudonym }
|
||||
this.systemicTherapies?.forEach {
|
||||
it.history?.forEach {
|
||||
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.retry.policy.SimpleRetryPolicy
|
||||
import org.springframework.retry.support.RetryTemplateBuilder
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
import java.util.concurrent.CompletableFuture.completedFuture
|
||||
import java.util.concurrent.ExecutionException
|
||||
|
||||
@ -309,24 +311,28 @@ class KafkaMtbFileSenderTest {
|
||||
}.build()
|
||||
}
|
||||
|
||||
fun dnpmV2MtbFile(): Mtb = Mtb.builder()
|
||||
.withPatient(
|
||||
dev.pcvolkmer.mv64e.mtb.Patient.builder()
|
||||
.withId("PID")
|
||||
.withBirthDate("2000-08-08")
|
||||
.withGender(CodingGender.builder().withCode(CodingGender.Code.MALE).build())
|
||||
.build()
|
||||
)
|
||||
.withEpisodesOfCare(
|
||||
listOf(
|
||||
MTBEpisodeOfCare.builder()
|
||||
.withId("1")
|
||||
.withPatient(Reference("PID"))
|
||||
.withPeriod(PeriodDate.builder().withStart("2023-08-08").build())
|
||||
.build()
|
||||
fun dnpmV2MtbFile(): Mtb {
|
||||
return Mtb().apply {
|
||||
this.patient = dev.pcvolkmer.mv64e.mtb.Patient().apply {
|
||||
this.id = "PID"
|
||||
this.birthDate = Date.from(Instant.now())
|
||||
this.gender = GenderCoding().apply {
|
||||
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())
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
fun bwhcV1kafkaRecordData(requestId: RequestId, consentStatus: Consent.Status): MtbRequest {
|
||||
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.response.MockRestResponseCreators.withStatus
|
||||
import org.springframework.web.client.RestTemplate
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
|
||||
class RestDipMtbFileSenderTest {
|
||||
|
||||
@ -155,7 +157,7 @@ class RestDipMtbFileSenderTest {
|
||||
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.body).isEqualTo(requestWithResponse.response.body)
|
||||
}
|
||||
@ -267,24 +269,28 @@ class RestDipMtbFileSenderTest {
|
||||
)
|
||||
.build()
|
||||
|
||||
val dnpmV2MtbFile: Mtb = Mtb.builder()
|
||||
.withPatient(
|
||||
dev.pcvolkmer.mv64e.mtb.Patient.builder()
|
||||
.withId("PID")
|
||||
.withBirthDate("2000-08-08")
|
||||
.withGender(CodingGender.builder().withCode(CodingGender.Code.MALE).build())
|
||||
.build()
|
||||
)
|
||||
.withEpisodesOfCare(
|
||||
listOf(
|
||||
MTBEpisodeOfCare.builder()
|
||||
.withId("1")
|
||||
.withPatient(Reference("PID"))
|
||||
.withPeriod(PeriodDate.builder().withStart("2023-08-08").build())
|
||||
.build()
|
||||
fun dnpmV2MtbFile(): Mtb {
|
||||
return Mtb().apply {
|
||||
this.patient = dev.pcvolkmer.mv64e.mtb.Patient().apply {
|
||||
this.id = "PID"
|
||||
this.birthDate = Date.from(Instant.now())
|
||||
this.gender = GenderCoding().apply {
|
||||
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())
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
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 de.ukw.ccc.bwhc.dto.*
|
||||
import dev.pcvolkmer.mv64e.mtb.MTBEpisodeOfCare
|
||||
import dev.pcvolkmer.mv64e.mtb.Mtb
|
||||
import dev.pcvolkmer.mv64e.mtb.PeriodDate
|
||||
import dev.pcvolkmer.mv64e.mtb.Reference
|
||||
import de.ukw.ccc.bwhc.dto.Patient
|
||||
import dev.pcvolkmer.mv64e.mtb.*
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Nested
|
||||
import org.junit.jupiter.api.Test
|
||||
@ -36,6 +34,8 @@ import org.mockito.kotlin.anyValueClass
|
||||
import org.mockito.kotlin.doAnswer
|
||||
import org.mockito.kotlin.whenever
|
||||
import org.springframework.core.io.ClassPathResource
|
||||
import java.time.Instant
|
||||
import java.util.*
|
||||
|
||||
@ExtendWith(MockitoExtension::class)
|
||||
class ExtensionsTest {
|
||||
@ -207,7 +207,7 @@ class ExtensionsTest {
|
||||
inner class UsingDnpmV2Datamodel {
|
||||
|
||||
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 {
|
||||
val mtbFile = ClassPathResource(FAKE_MTB_FILE_PATH).inputStream
|
||||
@ -244,32 +244,26 @@ class ExtensionsTest {
|
||||
"TESTDOMAIN"
|
||||
}.whenever(pseudonymizeService).prefix()
|
||||
|
||||
val mtbFile = Mtb.builder()
|
||||
.withPatient(
|
||||
dev.pcvolkmer.mv64e.mtb.Patient.builder()
|
||||
.withId("1")
|
||||
.withBirthDate("2000-08-08")
|
||||
.withGender(null)
|
||||
.build()
|
||||
val mtbFile = Mtb().apply {
|
||||
this.patient = dev.pcvolkmer.mv64e.mtb.Patient().apply {
|
||||
this.id = "PID"
|
||||
this.birthDate = Date.from(Instant.now())
|
||||
this.gender = GenderCoding().apply {
|
||||
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("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.anonymizeContentWith(pseudonymizeService)
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user