mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-07-02 02:22: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.PeriodDate;
|
||||
import dev.pcvolkmer.mv64e.mtb.Reference;
|
||||
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
|
||||
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
||||
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 KpaTherapielinieDataMapper(final TherapielinieCatalogue catalogue) {
|
||||
super(catalogue);
|
||||
public KpaTherapielinieDataMapper(final TherapielinieCatalogue catalogue, final PropertyCatalogue propertyCatalogue) {
|
||||
super(catalogue, propertyCatalogue);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,10 +46,30 @@ public class KpaTherapielinieDataMapper extends AbstractKpaTherapieverlaufDataMa
|
||||
.basedOn(Reference.builder().id(diseases.get(0).getDiseaseId().toString()).build())
|
||||
.recordedOn(resultSet.getDate("erfassungsdatum"))
|
||||
.therapyLine(resultSet.getLong("therapielinie"))
|
||||
.intent(getMtbTherapyIntentCoding(resultSet.getString("intention")))
|
||||
.status(getTherapyStatusCoding(resultSet.getString("status")))
|
||||
.statusReason(getMtbTherapyStatusReasonCoding(resultSet.getString("statusgrund")))
|
||||
.period(PeriodDate.builder().start(resultSet.getDate("beginn")).end(resultSet.getDate("ende")).build())
|
||||
.intent(
|
||||
getMtbTherapyIntentCoding(
|
||||
resultSet.getString("intention"),
|
||||
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 */
|
||||
//.medication()
|
||||
|
||||
|
@ -66,7 +66,14 @@ public class MtbDataMapper implements DataMapper<Mtb> {
|
||||
catalogueFactory.catalogue(TumorgradingCatalogue.class),
|
||||
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();
|
||||
|
||||
@ -79,6 +86,7 @@ public class MtbDataMapper implements DataMapper<Mtb> {
|
||||
.patient(kpaPatient)
|
||||
.diagnoses(List.of(diagnosisDataMapper.getById(kpaId)))
|
||||
.guidelineProcedures(prozedurMapper.getByParentId(kpaId))
|
||||
.guidelineTherapies(therapielinieMapper.getByParentId(kpaId))
|
||||
;
|
||||
} catch (DataAccessException e) {
|
||||
logger.error("Error while getting Mtb.", e);
|
||||
|
@ -1,6 +1,7 @@
|
||||
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.TherapielinieCatalogue;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@ -24,13 +25,18 @@ import static org.mockito.Mockito.when;
|
||||
class KpaTherapielinieDataMapperTest {
|
||||
|
||||
TherapielinieCatalogue catalogue;
|
||||
PropertyCatalogue propertyCatalogue;
|
||||
|
||||
KpaTherapielinieDataMapper dataMapper;
|
||||
|
||||
@BeforeEach
|
||||
void setUp(@Mock TherapielinieCatalogue catalogue) {
|
||||
void setUp(
|
||||
@Mock TherapielinieCatalogue catalogue,
|
||||
@Mock PropertyCatalogue propertyCatalogue
|
||||
) {
|
||||
this.catalogue = catalogue;
|
||||
this.dataMapper = new KpaTherapielinieDataMapper(catalogue);
|
||||
this.propertyCatalogue = propertyCatalogue;
|
||||
this.dataMapper = new KpaTherapielinieDataMapper(catalogue, propertyCatalogue);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -73,29 +79,61 @@ class KpaTherapielinieDataMapperTest {
|
||||
.when(catalogue)
|
||||
.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);
|
||||
assertThat(actualList).hasSize(1);
|
||||
|
||||
var actual = actualList.get(0);
|
||||
assertThat(actual).isInstanceOf(MtbSystemicTherapy.class);
|
||||
assertThat(actual.getId()).isEqualTo("1");
|
||||
assertThat(actual.getPeriod()).isEqualTo(
|
||||
PeriodDate.builder()
|
||||
.start(Date.from(Instant.parse("2000-01-01T12:00:00Z")))
|
||||
.end(Date.from(Instant.parse("2024-06-19T12:00:00Z")))
|
||||
.build()
|
||||
);
|
||||
assertThat(actual.getRecordedOn()).isEqualTo(Date.from(Instant.parse("2024-06-19T12:00:00Z")));
|
||||
assertThat(actual.getIntent()).isEqualTo(
|
||||
MtbTherapyIntentCoding.builder().code(MtbTherapyIntentCodingCode.S).build()
|
||||
);
|
||||
assertThat(actual.getStatus()).isEqualTo(
|
||||
TherapyStatusCoding.builder().code(TherapyStatusCodingCode.STOPPED).build()
|
||||
);
|
||||
assertThat(actual.getStatusReason()).isEqualTo(
|
||||
MtbTherapyStatusReasonCoding.builder().code(MtbTherapyStatusReasonCodingCode.PATIENT_DEATH).build()
|
||||
);
|
||||
assertThat(actual.getTherapyLine()).isEqualTo(1);
|
||||
assertThat(actual)
|
||||
.isInstanceOf(MtbSystemicTherapy.class);
|
||||
assertThat(actual.getId())
|
||||
.isEqualTo("1");
|
||||
assertThat(actual.getPeriod())
|
||||
.isEqualTo(
|
||||
PeriodDate.builder()
|
||||
.start(Date.from(Instant.parse("2000-01-01T12:00:00Z")))
|
||||
.end(Date.from(Instant.parse("2024-06-19T12:00:00Z")))
|
||||
.build()
|
||||
);
|
||||
assertThat(actual.getRecordedOn())
|
||||
.isEqualTo(Date.from(Instant.parse("2024-06-19T12:00:00Z")));
|
||||
assertThat(actual.getIntent())
|
||||
.isEqualTo(
|
||||
MtbTherapyIntentCoding.builder()
|
||||
.code(MtbTherapyIntentCodingCode.S)
|
||||
.display("Sonstiges")
|
||||
.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