mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-07-04 03:22:53 +00:00
feat: add recommendationsMissingReason and noSequencingPerformedReason
This commit is contained in:
@ -1,11 +1,14 @@
|
|||||||
package dev.pcvolkmer.onco.datamapper.mapper;
|
package dev.pcvolkmer.onco.datamapper.mapper;
|
||||||
|
|
||||||
import dev.pcvolkmer.mv64e.mtb.MtbCarePlan;
|
import dev.pcvolkmer.mv64e.mtb.*;
|
||||||
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
|
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
|
||||||
import dev.pcvolkmer.onco.datamapper.datacatalogues.EinzelempfehlungCatalogue;
|
import dev.pcvolkmer.onco.datamapper.datacatalogues.EinzelempfehlungCatalogue;
|
||||||
import dev.pcvolkmer.onco.datamapper.datacatalogues.TherapieplanCatalogue;
|
import dev.pcvolkmer.onco.datamapper.datacatalogues.TherapieplanCatalogue;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static dev.pcvolkmer.onco.datamapper.mapper.MapperUtils.getPatientReference;
|
import static dev.pcvolkmer.onco.datamapper.mapper.MapperUtils.getPatientReference;
|
||||||
|
|
||||||
@ -59,7 +62,37 @@ public class TherapieplanDataMapper implements DataMapper<MtbCarePlan> {
|
|||||||
builder.notes(List.of(therapieplanData.getString("protokollauszug")));
|
builder.notes(List.of(therapieplanData.getString("protokollauszug")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
null != therapieplanData.getString("status_begruendung")
|
||||||
|
&& therapieplanData.getString("status_begruendung").equals(MtbCarePlanRecommendationsMissingReasonCodingCode.NO_TARGET.toValue())
|
||||||
|
) {
|
||||||
|
builder.recommendationsMissingReason(
|
||||||
|
MtbCarePlanRecommendationsMissingReasonCoding.builder()
|
||||||
|
.code(MtbCarePlanRecommendationsMissingReasonCodingCode.NO_TARGET)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
builder.noSequencingPerformedReason(
|
||||||
|
getCarePlanNoSequencingPerformedReasonCoding(therapieplanData.getString("status_begruendung"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CarePlanNoSequencingPerformedReasonCoding getCarePlanNoSequencingPerformedReasonCoding(String value) {
|
||||||
|
if (value == null || !Arrays.stream(NoSequencingPerformedReasonCode.values()).map(NoSequencingPerformedReasonCode::toValue).collect(Collectors.toSet()).contains(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var resultBuilder = CarePlanNoSequencingPerformedReasonCoding.builder();
|
||||||
|
try {
|
||||||
|
resultBuilder.code(NoSequencingPerformedReasonCode.forValue(value));
|
||||||
|
} catch (IOException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultBuilder.build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package dev.pcvolkmer.onco.datamapper.mapper;
|
package dev.pcvolkmer.onco.datamapper.mapper;
|
||||||
|
|
||||||
import dev.pcvolkmer.mv64e.mtb.MtbCarePlan;
|
import dev.pcvolkmer.mv64e.mtb.*;
|
||||||
import dev.pcvolkmer.mv64e.mtb.Reference;
|
|
||||||
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
|
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
|
||||||
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
||||||
import dev.pcvolkmer.onco.datamapper.datacatalogues.EinzelempfehlungCatalogue;
|
import dev.pcvolkmer.onco.datamapper.datacatalogues.EinzelempfehlungCatalogue;
|
||||||
@ -75,4 +74,56 @@ class TherapieplanDataMapperTest {
|
|||||||
assertThat(actual.getNotes().get(0)).isEqualTo("Das ist ein Protokollauszug");
|
assertThat(actual.getNotes().get(0)).isEqualTo("Das ist ein Protokollauszug");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldSetRecommendationsMissingReason() {
|
||||||
|
final Map<String, Object> testData = Map.of(
|
||||||
|
"id", 1,
|
||||||
|
"patient_id", 42,
|
||||||
|
"status_begruendung", "no-target"
|
||||||
|
);
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> ResultSet.from(testData))
|
||||||
|
.when(therapieplanCatalogue)
|
||||||
|
.getById(anyInt());
|
||||||
|
|
||||||
|
var actual = this.dataMapper.getById(1);
|
||||||
|
assertThat(actual).isInstanceOf(MtbCarePlan.class);
|
||||||
|
assertThat(actual.getId()).isEqualTo("1");
|
||||||
|
|
||||||
|
assertThat(actual.getRecommendationsMissingReason())
|
||||||
|
.isEqualTo(
|
||||||
|
MtbCarePlanRecommendationsMissingReasonCoding.builder()
|
||||||
|
.code(MtbCarePlanRecommendationsMissingReasonCodingCode.NO_TARGET)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
|
assertThat(actual.getNoSequencingPerformedReason()).isNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldSetNoSequencingPerformedReason() {
|
||||||
|
final Map<String, Object> testData = Map.of(
|
||||||
|
"id", 1,
|
||||||
|
"patient_id", 42,
|
||||||
|
"status_begruendung", "non-genetic-cause"
|
||||||
|
);
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> ResultSet.from(testData))
|
||||||
|
.when(therapieplanCatalogue)
|
||||||
|
.getById(anyInt());
|
||||||
|
|
||||||
|
var actual = this.dataMapper.getById(1);
|
||||||
|
assertThat(actual).isInstanceOf(MtbCarePlan.class);
|
||||||
|
assertThat(actual.getId()).isEqualTo("1");
|
||||||
|
|
||||||
|
assertThat(actual.getRecommendationsMissingReason()).isNull();
|
||||||
|
|
||||||
|
|
||||||
|
assertThat(actual.getNoSequencingPerformedReason()).isEqualTo(
|
||||||
|
CarePlanNoSequencingPerformedReasonCoding.builder()
|
||||||
|
.code(NoSequencingPerformedReasonCode.NON_GENETIC_CAUSE)
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user