1
0
mirror of https://github.com/pcvolkmer/mv64e-onkostar-data.git synced 2025-07-02 02:22:54 +00:00

feat: add performance status to Mtb data

This commit is contained in:
2025-06-22 15:04:01 +02:00
parent bd3b5aeda1
commit e848752e45
3 changed files with 29 additions and 4 deletions

View File

@ -51,7 +51,13 @@ public class KpaEcogDataMapper extends AbstractSubformDataMapper<PerformanceStat
var builder = PerformanceStatus.builder();
builder
.id(resultSet.getProcedureId().toString())
.patient(Reference.builder().id(resultSet.getString("patient_id")).build())
.patient(
Reference.builder()
.id(resultSet.getString("patient_id"))
// Use "Patient" since Onkostar only provides patient data
.type("Patient")
.build()
)
.effectiveDate(resultSet.getDate("datum"))
.value(getEcogCoding(resultSet.getString("ecog")))
;
@ -64,9 +70,12 @@ public class KpaEcogDataMapper extends AbstractSubformDataMapper<PerformanceStat
return null;
}
var resultBuilder = EcogCoding.builder();
var resultBuilder = EcogCoding.builder()
.system("ECOG-Performance-Status");
try {
resultBuilder.code(EcogCodingCode.forValue(value));
resultBuilder.display(String.format("ECOG %s", value));
} catch (IOException e) {
throw new IllegalStateException("No valid code found");
}

View File

@ -74,6 +74,9 @@ public class MtbDataMapper implements DataMapper<Mtb> {
catalogueFactory.catalogue(TherapielinieCatalogue.class),
propertyCatalogue
);
var ecogMapper = new KpaEcogDataMapper(
catalogueFactory.catalogue(EcogCatalogue.class)
);
var resultBuilder = Mtb.builder();
@ -87,6 +90,7 @@ public class MtbDataMapper implements DataMapper<Mtb> {
.diagnoses(List.of(diagnosisDataMapper.getById(kpaId)))
.guidelineProcedures(prozedurMapper.getByParentId(kpaId))
.guidelineTherapies(therapielinieMapper.getByParentId(kpaId))
.performanceStatus(ecogMapper.getByParentId(kpaId))
;
} catch (DataAccessException e) {
logger.error("Error while getting Mtb.", e);

View File

@ -67,9 +67,21 @@ class KpaEcogDataMapperTest {
var actual = actualList.get(0);
assertThat(actual).isInstanceOf(PerformanceStatus.class);
assertThat(actual.getId()).isEqualTo("1");
assertThat(actual.getPatient()).isEqualTo(Reference.builder().id("42").build());
assertThat(actual.getPatient())
.isEqualTo(Reference.builder()
.id("42")
.type("Patient")
.build()
);
assertThat(actual.getEffectiveDate()).isEqualTo(new java.sql.Date(Date.from(Instant.parse("2000-01-01T12:00:00Z")).getTime()));
assertThat(actual.getValue()).isEqualTo(EcogCoding.builder().code(EcogCodingCode.CODE_1).build());
assertThat(actual.getValue())
.isEqualTo(
EcogCoding.builder()
.code(EcogCodingCode.CODE_1)
.display("ECOG 1")
.system("ECOG-Performance-Status")
.build()
);
}
}