mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-09-14 00:12:52 +00:00
feat: add Tumor-Proben
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package dev.pcvolkmer.onco.datamapper.datacatalogues;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class MolekulargenetikCatalogueTest {
|
||||
|
||||
JdbcTemplate jdbcTemplate;
|
||||
MolekulargenetikCatalogue catalogue;
|
||||
|
||||
@BeforeEach
|
||||
void setUp(@Mock JdbcTemplate jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.catalogue = MolekulargenetikCatalogue.create(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseCorrectQuery(@Mock Map<String, Object> resultSet) {
|
||||
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||
.when(jdbcTemplate)
|
||||
.queryForList(anyString(), anyInt());
|
||||
|
||||
this.catalogue.getById(1);
|
||||
|
||||
var captor = ArgumentCaptor.forClass(String.class);
|
||||
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||
|
||||
assertThat(captor.getValue())
|
||||
.isEqualTo("SELECT * FROM dk_molekulargenetik JOIN prozedur ON (prozedur.id = dk_molekulargenetik.id) WHERE geloescht = 0 AND prozedur.id = ?");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseCorrectSubformQuery(@Mock Map<String, Object> resultSet) {
|
||||
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||
.when(jdbcTemplate)
|
||||
.queryForList(anyString(), anyInt());
|
||||
|
||||
this.catalogue.getAllByParentId(1);
|
||||
|
||||
var captor = ArgumentCaptor.forClass(String.class);
|
||||
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||
|
||||
assertThat(captor.getValue())
|
||||
.isEqualTo("SELECT * FROM dk_molekulargenetik JOIN prozedur ON (prozedur.id = dk_molekulargenetik.id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package dev.pcvolkmer.onco.datamapper.datacatalogues;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class RebiopsieCatalogueTest {
|
||||
|
||||
JdbcTemplate jdbcTemplate;
|
||||
RebiopsieCatalogue catalogue;
|
||||
|
||||
@BeforeEach
|
||||
void setUp(@Mock JdbcTemplate jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.catalogue = RebiopsieCatalogue.create(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseCorrectQuery(@Mock Map<String, Object> resultSet) {
|
||||
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||
.when(jdbcTemplate)
|
||||
.queryForList(anyString(), anyInt());
|
||||
|
||||
this.catalogue.getById(1);
|
||||
|
||||
var captor = ArgumentCaptor.forClass(String.class);
|
||||
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||
|
||||
assertThat(captor.getValue())
|
||||
.isEqualTo("SELECT * FROM dk_dnpm_uf_rebiopsie JOIN prozedur ON (prozedur.id = dk_dnpm_uf_rebiopsie.id) WHERE geloescht = 0 AND prozedur.id = ?");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseCorrectSubformQuery(@Mock Map<String, Object> resultSet) {
|
||||
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||
.when(jdbcTemplate)
|
||||
.queryForList(anyString(), anyInt());
|
||||
|
||||
this.catalogue.getAllByParentId(1);
|
||||
|
||||
var captor = ArgumentCaptor.forClass(String.class);
|
||||
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||
|
||||
assertThat(captor.getValue())
|
||||
.isEqualTo("SELECT * FROM dk_dnpm_uf_rebiopsie JOIN prozedur ON (prozedur.id = dk_dnpm_uf_rebiopsie.id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package dev.pcvolkmer.onco.datamapper.datacatalogues;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class ReevaluationCatalogueTest {
|
||||
|
||||
JdbcTemplate jdbcTemplate;
|
||||
ReevaluationCatalogue catalogue;
|
||||
|
||||
@BeforeEach
|
||||
void setUp(@Mock JdbcTemplate jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.catalogue = ReevaluationCatalogue.create(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseCorrectQuery(@Mock Map<String, Object> resultSet) {
|
||||
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||
.when(jdbcTemplate)
|
||||
.queryForList(anyString(), anyInt());
|
||||
|
||||
this.catalogue.getById(1);
|
||||
|
||||
var captor = ArgumentCaptor.forClass(String.class);
|
||||
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||
|
||||
assertThat(captor.getValue())
|
||||
.isEqualTo("SELECT * FROM dk_dnpm_uf_reevaluation JOIN prozedur ON (prozedur.id = dk_dnpm_uf_reevaluation.id) WHERE geloescht = 0 AND prozedur.id = ?");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldUseCorrectSubformQuery(@Mock Map<String, Object> resultSet) {
|
||||
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||
.when(jdbcTemplate)
|
||||
.queryForList(anyString(), anyInt());
|
||||
|
||||
this.catalogue.getAllByParentId(1);
|
||||
|
||||
var captor = ArgumentCaptor.forClass(String.class);
|
||||
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||
|
||||
assertThat(captor.getValue())
|
||||
.isEqualTo("SELECT * FROM dk_dnpm_uf_reevaluation JOIN prozedur ON (prozedur.id = dk_dnpm_uf_reevaluation.id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,435 @@
|
||||
package dev.pcvolkmer.onco.datamapper.mapper;
|
||||
|
||||
import dev.pcvolkmer.mv64e.mtb.*;
|
||||
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
|
||||
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
||||
import dev.pcvolkmer.onco.datamapper.datacatalogues.*;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class MolekulargenetikToSpecimenDataMapperTest {
|
||||
|
||||
MolekulargenetikCatalogue molekulargenetikCatalogue;
|
||||
TherapieplanCatalogue therapieplanCatalogue;
|
||||
RebiopsieCatalogue rebiopsieCatalogue;
|
||||
ReevaluationCatalogue reevaluationCatalogue;
|
||||
EinzelempfehlungCatalogue einzelempfehlungCatalogue;
|
||||
PropertyCatalogue propertyCatalogue;
|
||||
|
||||
MolekulargenetikToSpecimenDataMapper mapper;
|
||||
|
||||
@BeforeEach
|
||||
void setUp(
|
||||
@Mock MolekulargenetikCatalogue molekulargenetikCatalogue,
|
||||
@Mock TherapieplanCatalogue therapieplanCatalogue,
|
||||
@Mock RebiopsieCatalogue rebiopsieCatalogue,
|
||||
@Mock ReevaluationCatalogue reevaluationCatalogue,
|
||||
@Mock EinzelempfehlungCatalogue einzelempfehlungCatalogue,
|
||||
@Mock PropertyCatalogue propertyCatalogue
|
||||
) {
|
||||
this.molekulargenetikCatalogue = molekulargenetikCatalogue;
|
||||
this.therapieplanCatalogue = therapieplanCatalogue;
|
||||
this.rebiopsieCatalogue = rebiopsieCatalogue;
|
||||
this.reevaluationCatalogue = reevaluationCatalogue;
|
||||
this.einzelempfehlungCatalogue = einzelempfehlungCatalogue;
|
||||
this.propertyCatalogue = propertyCatalogue;
|
||||
|
||||
this.mapper = new MolekulargenetikToSpecimenDataMapper(
|
||||
molekulargenetikCatalogue,
|
||||
therapieplanCatalogue,
|
||||
rebiopsieCatalogue,
|
||||
reevaluationCatalogue,
|
||||
einzelempfehlungCatalogue,
|
||||
propertyCatalogue
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldFetchAllRelatedSpecimens() {
|
||||
|
||||
// Mock Einzelempfehlungen ID
|
||||
when(therapieplanCatalogue.getByKpaId(anyInt()))
|
||||
.thenReturn(List.of(1, 2));
|
||||
|
||||
// Mock Rebiopsien - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 40)));
|
||||
}).when(rebiopsieCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock Reevaluationen - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 41)));
|
||||
}).when(reevaluationCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock Einzelempfehlungen - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 42)));
|
||||
}).when(einzelempfehlungCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return ResultSet.from(
|
||||
Map.of(
|
||||
"id", id,
|
||||
"patient_id", 4711,
|
||||
"entnahmemethode", "B",
|
||||
"probenmaterial", "T"
|
||||
)
|
||||
);
|
||||
}).when(molekulargenetikCatalogue).getById(anyInt());
|
||||
|
||||
var actual = this.mapper.getAllByKpaId(1, Reference.builder().build());
|
||||
|
||||
assertThat(actual).hasSize(3);
|
||||
|
||||
assertThat(actual.get(0).getId())
|
||||
.isEqualTo("40");
|
||||
assertThat(actual.get(1).getId())
|
||||
.isEqualTo("41");
|
||||
assertThat(actual.get(2).getId())
|
||||
.isEqualTo("42");
|
||||
|
||||
assertThat(actual.get(0).getPatient())
|
||||
.isEqualTo(Reference.builder().id("4711").type("Patient").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotFetchRelatedSpecimensTwice() {
|
||||
|
||||
// Mock Einzelempfehlungen ID
|
||||
when(therapieplanCatalogue.getByKpaId(anyInt()))
|
||||
.thenReturn(List.of(1, 2));
|
||||
|
||||
// Mock Rebiopsien - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 40)));
|
||||
}).when(rebiopsieCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock Reevaluationen - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 40)));
|
||||
}).when(reevaluationCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock Einzelempfehlungen - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 42)));
|
||||
}).when(einzelempfehlungCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return ResultSet.from(
|
||||
Map.of(
|
||||
"id", id,
|
||||
"patient_id", 4711,
|
||||
"entnahmemethode", "B",
|
||||
"probenmaterial", "T"
|
||||
)
|
||||
);
|
||||
}).when(molekulargenetikCatalogue).getById(anyInt());
|
||||
|
||||
var actual = this.mapper.getAllByKpaId(1, Reference.builder().build());
|
||||
|
||||
assertThat(actual).hasSize(2);
|
||||
|
||||
assertThat(actual.get(0).getId())
|
||||
.isEqualTo("40");
|
||||
assertThat(actual.get(1).getId())
|
||||
.isEqualTo("42");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("specimenTypeTestData")
|
||||
void shouldReturnExpectedSpecimenType(String value, TumorSpecimenCoding coding) {
|
||||
|
||||
// Mock Einzelempfehlungen ID
|
||||
when(therapieplanCatalogue.getByKpaId(anyInt()))
|
||||
.thenReturn(List.of(1, 2));
|
||||
|
||||
// Mock Einzelempfehlungen - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 42)));
|
||||
}).when(einzelempfehlungCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return ResultSet.from(
|
||||
Map.of(
|
||||
"id", id,
|
||||
"patient_id", 4711,
|
||||
"materialfixierung", value,
|
||||
"entnahmemethode", "B",
|
||||
"probenmaterial", "T"
|
||||
)
|
||||
);
|
||||
}).when(molekulargenetikCatalogue).getById(anyInt());
|
||||
|
||||
var actual = this.mapper.getAllByKpaId(1, Reference.builder().build());
|
||||
|
||||
assertThat(actual).hasSize(1);
|
||||
assertThat(actual.get(0).getType()).isEqualTo(coding);
|
||||
}
|
||||
|
||||
// Returns all available Onkostar values and - best effort - expected mapping
|
||||
// See property catalogue OS.Material and https://ibmi-ut.atlassian.net/wiki/spaces/DAM/pages/698777783/ line 80
|
||||
static Stream<Arguments> specimenTypeTestData() {
|
||||
return Stream.of(
|
||||
Arguments.of(
|
||||
"0",
|
||||
TumorSpecimenCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/type").code(TumorSpecimenCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"1",
|
||||
TumorSpecimenCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/type").code(TumorSpecimenCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"2",
|
||||
TumorSpecimenCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/type").code(TumorSpecimenCodingCode.CRYO_FROZEN).display("Cryo-frozen")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"3",
|
||||
TumorSpecimenCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/type").code(TumorSpecimenCodingCode.FFPE).display("FFPE")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"4",
|
||||
TumorSpecimenCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/type").code(TumorSpecimenCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"9",
|
||||
TumorSpecimenCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/type").code(TumorSpecimenCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("specimenMethodTestData")
|
||||
void shouldReturnExpectedSpecimenMethod(String value, TumorSpecimenCollectionMethodCoding coding) {
|
||||
|
||||
// Mock Einzelempfehlungen ID
|
||||
when(therapieplanCatalogue.getByKpaId(anyInt()))
|
||||
.thenReturn(List.of(1, 2));
|
||||
|
||||
// Mock Einzelempfehlungen - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 42)));
|
||||
}).when(einzelempfehlungCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return ResultSet.from(
|
||||
Map.of(
|
||||
"id", id,
|
||||
"patient_id", 4711,
|
||||
"entnahmemethode", value,
|
||||
"probenmaterial", "T"
|
||||
)
|
||||
);
|
||||
}).when(molekulargenetikCatalogue).getById(anyInt());
|
||||
|
||||
var actual = this.mapper.getAllByKpaId(1, Reference.builder().build());
|
||||
|
||||
assertThat(actual).hasSize(1);
|
||||
assertThat(actual.get(0).getCollection().getMethod()).isEqualTo(coding);
|
||||
}
|
||||
|
||||
// Returns all available Onkostar values and - best effort - expected mapping
|
||||
// See property catalogue OS.MolDiagEntnahmemethode and https://ibmi-ut.atlassian.net/wiki/spaces/DAM/pages/698777783/ line 84
|
||||
static Stream<Arguments> specimenMethodTestData() {
|
||||
return Stream.of(
|
||||
Arguments.of(
|
||||
"B",
|
||||
TumorSpecimenCollectionMethodCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/method").code(TumorSpecimenCollectionMethodCodingCode.BIOPSY).display("Biopsie")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"R",
|
||||
TumorSpecimenCollectionMethodCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/method").code(TumorSpecimenCollectionMethodCodingCode.RESECTION).display("Resektat")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"LB",
|
||||
TumorSpecimenCollectionMethodCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/method").code(TumorSpecimenCollectionMethodCodingCode.LIQUID_BIOPSY).display("Liquid Biopsy")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"Z",
|
||||
TumorSpecimenCollectionMethodCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/method").code(TumorSpecimenCollectionMethodCodingCode.CYTOLOGY).display("Zytologie")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"U",
|
||||
TumorSpecimenCollectionMethodCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/method").code(TumorSpecimenCollectionMethodCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("specimenLocalizationTestData")
|
||||
void shouldReturnExpectedSpecimenLocalization(String value, TumorSpecimenCollectionLocalizationCoding coding) {
|
||||
|
||||
// Mock Einzelempfehlungen ID
|
||||
when(therapieplanCatalogue.getByKpaId(anyInt()))
|
||||
.thenReturn(List.of(1, 2));
|
||||
|
||||
// Mock Einzelempfehlungen - two referencing the same OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return List.of(ResultSet.from(Map.of("id", id, "ref_molekulargenetik", 42)));
|
||||
}).when(einzelempfehlungCatalogue).getAllByParentId(anyInt());
|
||||
|
||||
// Mock OS.Molekulargenetik
|
||||
doAnswer(invocationOnMock -> {
|
||||
var id = invocationOnMock.getArgument(0, Integer.class);
|
||||
return ResultSet.from(
|
||||
Map.of(
|
||||
"id", id,
|
||||
"patient_id", 4711,
|
||||
"entnahmemethode", "B",
|
||||
"probenmaterial", value
|
||||
)
|
||||
);
|
||||
}).when(molekulargenetikCatalogue).getById(anyInt());
|
||||
|
||||
var actual = this.mapper.getAllByKpaId(1, Reference.builder().build());
|
||||
|
||||
assertThat(actual).hasSize(1);
|
||||
assertThat(actual.get(0).getCollection().getLocalization()).isEqualTo(coding);
|
||||
}
|
||||
|
||||
// Returns all available Onkostar values and - best effort - expected mapping
|
||||
// See property catalogue OS.Probenmaterial and https://ibmi-ut.atlassian.net/wiki/spaces/DAM/pages/698777783/ line 82
|
||||
static Stream<Arguments> specimenLocalizationTestData() {
|
||||
return Stream.of(
|
||||
Arguments.of(
|
||||
"T",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.PRIMARY_TUMOR).display("Primärtumor")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"R",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"LK",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.METASTASIS).display("Metastase")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"M",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.METASTASIS).display("Metastase")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"ITM",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.METASTASIS).display("Metastase")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"SM",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.METASTASIS).display("Metastase")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"KM",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"NG",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"AS",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"PLERG",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"B",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder().
|
||||
system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"L",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"U",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
),
|
||||
Arguments.of(
|
||||
"S",
|
||||
TumorSpecimenCollectionLocalizationCoding.builder()
|
||||
.system("dnpm-dip/mtb/tumor-specimen/collection/localization").code(TumorSpecimenCollectionLocalizationCodingCode.UNKNOWN).display("Unbekannt")
|
||||
.build()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user