mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-07-03 02:52:54 +00:00
feat: add therapielinie to Mtb data
This commit is contained in:
@ -3,6 +3,7 @@ package dev.pcvolkmer.onco.datamapper.mapper;
|
|||||||
import dev.pcvolkmer.mv64e.mtb.MtbSystemicTherapy;
|
import dev.pcvolkmer.mv64e.mtb.MtbSystemicTherapy;
|
||||||
import dev.pcvolkmer.mv64e.mtb.PeriodDate;
|
import dev.pcvolkmer.mv64e.mtb.PeriodDate;
|
||||||
import dev.pcvolkmer.mv64e.mtb.Reference;
|
import dev.pcvolkmer.mv64e.mtb.Reference;
|
||||||
|
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
|
||||||
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
||||||
import dev.pcvolkmer.onco.datamapper.datacatalogues.TherapielinieCatalogue;
|
import dev.pcvolkmer.onco.datamapper.datacatalogues.TherapielinieCatalogue;
|
||||||
|
|
||||||
@ -14,8 +15,8 @@ import dev.pcvolkmer.onco.datamapper.datacatalogues.TherapielinieCatalogue;
|
|||||||
*/
|
*/
|
||||||
public class KpaTherapielinieDataMapper extends AbstractKpaTherapieverlaufDataMapper<MtbSystemicTherapy> {
|
public class KpaTherapielinieDataMapper extends AbstractKpaTherapieverlaufDataMapper<MtbSystemicTherapy> {
|
||||||
|
|
||||||
public KpaTherapielinieDataMapper(final TherapielinieCatalogue catalogue) {
|
public KpaTherapielinieDataMapper(final TherapielinieCatalogue catalogue, final PropertyCatalogue propertyCatalogue) {
|
||||||
super(catalogue);
|
super(catalogue, propertyCatalogue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,10 +46,30 @@ public class KpaTherapielinieDataMapper extends AbstractKpaTherapieverlaufDataMa
|
|||||||
.basedOn(Reference.builder().id(diseases.get(0).getDiseaseId().toString()).build())
|
.basedOn(Reference.builder().id(diseases.get(0).getDiseaseId().toString()).build())
|
||||||
.recordedOn(resultSet.getDate("erfassungsdatum"))
|
.recordedOn(resultSet.getDate("erfassungsdatum"))
|
||||||
.therapyLine(resultSet.getLong("therapielinie"))
|
.therapyLine(resultSet.getLong("therapielinie"))
|
||||||
.intent(getMtbTherapyIntentCoding(resultSet.getString("intention")))
|
.intent(
|
||||||
.status(getTherapyStatusCoding(resultSet.getString("status")))
|
getMtbTherapyIntentCoding(
|
||||||
.statusReason(getMtbTherapyStatusReasonCoding(resultSet.getString("statusgrund")))
|
resultSet.getString("intention"),
|
||||||
.period(PeriodDate.builder().start(resultSet.getDate("beginn")).end(resultSet.getDate("ende")).build())
|
resultSet.getInteger("intention_propcat_version")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.status(
|
||||||
|
getTherapyStatusCoding(
|
||||||
|
resultSet.getString("status"),
|
||||||
|
resultSet.getInteger("status_propcat_version")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.statusReason(
|
||||||
|
getMtbTherapyStatusReasonCoding(
|
||||||
|
resultSet.getString("statusgrund"),
|
||||||
|
resultSet.getInteger("statusgrund_propcat_version")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.period(
|
||||||
|
PeriodDate.builder()
|
||||||
|
.start(resultSet.getDate("beginn"))
|
||||||
|
.end(resultSet.getDate("ende"))
|
||||||
|
.build()
|
||||||
|
)
|
||||||
/* TODO JSON deserialisation */
|
/* TODO JSON deserialisation */
|
||||||
//.medication()
|
//.medication()
|
||||||
|
|
||||||
|
@ -66,7 +66,14 @@ public class MtbDataMapper implements DataMapper<Mtb> {
|
|||||||
catalogueFactory.catalogue(TumorgradingCatalogue.class),
|
catalogueFactory.catalogue(TumorgradingCatalogue.class),
|
||||||
propertyCatalogue
|
propertyCatalogue
|
||||||
);
|
);
|
||||||
var prozedurMapper = new KpaProzedurDataMapper(catalogueFactory.catalogue(ProzedurCatalogue.class));
|
var prozedurMapper = new KpaProzedurDataMapper(
|
||||||
|
catalogueFactory.catalogue(ProzedurCatalogue.class),
|
||||||
|
propertyCatalogue
|
||||||
|
);
|
||||||
|
var therapielinieMapper = new KpaTherapielinieDataMapper(
|
||||||
|
catalogueFactory.catalogue(TherapielinieCatalogue.class),
|
||||||
|
propertyCatalogue
|
||||||
|
);
|
||||||
|
|
||||||
var resultBuilder = Mtb.builder();
|
var resultBuilder = Mtb.builder();
|
||||||
|
|
||||||
@ -79,6 +86,7 @@ public class MtbDataMapper implements DataMapper<Mtb> {
|
|||||||
.patient(kpaPatient)
|
.patient(kpaPatient)
|
||||||
.diagnoses(List.of(diagnosisDataMapper.getById(kpaId)))
|
.diagnoses(List.of(diagnosisDataMapper.getById(kpaId)))
|
||||||
.guidelineProcedures(prozedurMapper.getByParentId(kpaId))
|
.guidelineProcedures(prozedurMapper.getByParentId(kpaId))
|
||||||
|
.guidelineTherapies(therapielinieMapper.getByParentId(kpaId))
|
||||||
;
|
;
|
||||||
} catch (DataAccessException e) {
|
} catch (DataAccessException e) {
|
||||||
logger.error("Error while getting Mtb.", e);
|
logger.error("Error while getting Mtb.", e);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package dev.pcvolkmer.onco.datamapper.mapper;
|
package dev.pcvolkmer.onco.datamapper.mapper;
|
||||||
|
|
||||||
import dev.pcvolkmer.mv64e.mtb.*;
|
import dev.pcvolkmer.mv64e.mtb.*;
|
||||||
|
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
|
||||||
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
||||||
import dev.pcvolkmer.onco.datamapper.datacatalogues.TherapielinieCatalogue;
|
import dev.pcvolkmer.onco.datamapper.datacatalogues.TherapielinieCatalogue;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
@ -24,13 +25,18 @@ import static org.mockito.Mockito.when;
|
|||||||
class KpaTherapielinieDataMapperTest {
|
class KpaTherapielinieDataMapperTest {
|
||||||
|
|
||||||
TherapielinieCatalogue catalogue;
|
TherapielinieCatalogue catalogue;
|
||||||
|
PropertyCatalogue propertyCatalogue;
|
||||||
|
|
||||||
KpaTherapielinieDataMapper dataMapper;
|
KpaTherapielinieDataMapper dataMapper;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp(@Mock TherapielinieCatalogue catalogue) {
|
void setUp(
|
||||||
|
@Mock TherapielinieCatalogue catalogue,
|
||||||
|
@Mock PropertyCatalogue propertyCatalogue
|
||||||
|
) {
|
||||||
this.catalogue = catalogue;
|
this.catalogue = catalogue;
|
||||||
this.dataMapper = new KpaTherapielinieDataMapper(catalogue);
|
this.propertyCatalogue = propertyCatalogue;
|
||||||
|
this.dataMapper = new KpaTherapielinieDataMapper(catalogue, propertyCatalogue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -73,29 +79,61 @@ class KpaTherapielinieDataMapperTest {
|
|||||||
.when(catalogue)
|
.when(catalogue)
|
||||||
.getDiseases(anyInt());
|
.getDiseases(anyInt());
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var testPropertyData = Map.of(
|
||||||
|
"S", new PropertyCatalogue.Entry("S", "Sonstiges", "Sonstiges"),
|
||||||
|
"stopped", new PropertyCatalogue.Entry("stopped", "Abgebrochen", "Abgebrochen"),
|
||||||
|
"patient-death", new PropertyCatalogue.Entry("patient-death", "Tod", "Tod")
|
||||||
|
);
|
||||||
|
|
||||||
|
var code = invocationOnMock.getArgument(0, String.class);
|
||||||
|
return testPropertyData.get(code);
|
||||||
|
}
|
||||||
|
).when(propertyCatalogue).getByCodeAndVersion(anyString(), anyInt());
|
||||||
|
|
||||||
var actualList = this.dataMapper.getByParentId(1);
|
var actualList = this.dataMapper.getByParentId(1);
|
||||||
assertThat(actualList).hasSize(1);
|
assertThat(actualList).hasSize(1);
|
||||||
|
|
||||||
var actual = actualList.get(0);
|
var actual = actualList.get(0);
|
||||||
assertThat(actual).isInstanceOf(MtbSystemicTherapy.class);
|
assertThat(actual)
|
||||||
assertThat(actual.getId()).isEqualTo("1");
|
.isInstanceOf(MtbSystemicTherapy.class);
|
||||||
assertThat(actual.getPeriod()).isEqualTo(
|
assertThat(actual.getId())
|
||||||
PeriodDate.builder()
|
.isEqualTo("1");
|
||||||
.start(Date.from(Instant.parse("2000-01-01T12:00:00Z")))
|
assertThat(actual.getPeriod())
|
||||||
.end(Date.from(Instant.parse("2024-06-19T12:00:00Z")))
|
.isEqualTo(
|
||||||
.build()
|
PeriodDate.builder()
|
||||||
);
|
.start(Date.from(Instant.parse("2000-01-01T12:00:00Z")))
|
||||||
assertThat(actual.getRecordedOn()).isEqualTo(Date.from(Instant.parse("2024-06-19T12:00:00Z")));
|
.end(Date.from(Instant.parse("2024-06-19T12:00:00Z")))
|
||||||
assertThat(actual.getIntent()).isEqualTo(
|
.build()
|
||||||
MtbTherapyIntentCoding.builder().code(MtbTherapyIntentCodingCode.S).build()
|
);
|
||||||
);
|
assertThat(actual.getRecordedOn())
|
||||||
assertThat(actual.getStatus()).isEqualTo(
|
.isEqualTo(Date.from(Instant.parse("2024-06-19T12:00:00Z")));
|
||||||
TherapyStatusCoding.builder().code(TherapyStatusCodingCode.STOPPED).build()
|
assertThat(actual.getIntent())
|
||||||
);
|
.isEqualTo(
|
||||||
assertThat(actual.getStatusReason()).isEqualTo(
|
MtbTherapyIntentCoding.builder()
|
||||||
MtbTherapyStatusReasonCoding.builder().code(MtbTherapyStatusReasonCodingCode.PATIENT_DEATH).build()
|
.code(MtbTherapyIntentCodingCode.S)
|
||||||
);
|
.display("Sonstiges")
|
||||||
assertThat(actual.getTherapyLine()).isEqualTo(1);
|
.system("dnpm-dip/therapy/intent")
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
assertThat(actual.getStatus())
|
||||||
|
.isEqualTo(
|
||||||
|
TherapyStatusCoding.builder()
|
||||||
|
.code(TherapyStatusCodingCode.STOPPED)
|
||||||
|
.display("Abgebrochen")
|
||||||
|
.system("dnpm-dip/therapy/status")
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
assertThat(actual.getStatusReason())
|
||||||
|
.isEqualTo(
|
||||||
|
MtbTherapyStatusReasonCoding.builder()
|
||||||
|
.code(MtbTherapyStatusReasonCodingCode.PATIENT_DEATH)
|
||||||
|
.display("Tod")
|
||||||
|
.system("dnpm-dip/therapy/status-reason")
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
assertThat(actual.getTherapyLine())
|
||||||
|
.isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user