From 556577102ed8287b25351f68241264c7062fd362 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Tue, 16 Jun 2026 13:32:59 +0200 Subject: feat: do not request research consent if reason missing is given (#298) This is a first approach to make use of a reason missing given in MTB file at UKGM Marburg due to special handling of research consent. Without these changes, the request will be canceled without any further processing.--- .../etl/processor/services/ConsentProcessorTest.kt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/test') diff --git a/src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt index a85d555..8899fc6 100644 --- a/src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt +++ b/src/test/kotlin/dev/dnpm/etl/processor/services/ConsentProcessorTest.kt @@ -28,8 +28,10 @@ import dev.dnpm.etl.processor.consent.ConsentDomain import dev.dnpm.etl.processor.consent.GicsConsentService import dev.dnpm.etl.processor.consent.MtbFileConsentService import dev.pcvolkmer.mv64e.mtb.Mtb +import dev.pcvolkmer.mv64e.mtb.MvhMetadata import dev.pcvolkmer.mv64e.mtb.MvhSubmissionType import dev.pcvolkmer.mv64e.mtb.Patient +import dev.pcvolkmer.mv64e.mtb.ResearchConsentReasonMissing import org.assertj.core.api.Assertions.assertThat import org.hl7.fhir.r4.model.Bundle import org.hl7.fhir.r4.model.CodeableConcept @@ -46,6 +48,8 @@ import org.mockito.junit.jupiter.MockitoExtension import org.mockito.kotlin.any import org.mockito.kotlin.doAnswer import org.mockito.kotlin.eq +import org.mockito.kotlin.times +import org.mockito.kotlin.verify import org.mockito.kotlin.whenever import org.springframework.core.io.ClassPathResource import tools.jackson.databind.json.JsonMapper @@ -267,4 +271,26 @@ class ConsentProcessorTest { assertThat(inputMtb.metadata.type).isEqualTo(MvhSubmissionType.INITIAL) } } + + @Test + fun doNotRequestBroadConsentIfReasonMissingIsGiven() { + doAnswer { Bundle() } + .whenever(gicsConsentService) + .getConsent(any(), any(), eq(ConsentDomain.MODELLVORHABEN_64E)) + + val inputMtb = + Mtb.builder() + .patient(Patient.builder().id("d611d429-5003-11f0-a144-661e92ac9503").build()) + .metadata(MvhMetadata.builder().reasonResearchConsentMissing(ResearchConsentReasonMissing.OTHER_PATIENT_REASON).build()) + .build() + val checkResult = consentProcessor.consentGatedCheckAndTryEmbedding(inputMtb) + + verify(gicsConsentService, times(1)) + .getConsent(any(), any(), eq(ConsentDomain.MODELLVORHABEN_64E)) + verify(gicsConsentService, times(0)) + .getConsent(any(), any(), eq(ConsentDomain.BROAD_CONSENT)) + + assertThat(checkResult).isFalse + assertThat(inputMtb.metadata.researchConsents).isEmpty() + } } -- cgit v1.2.3