1
0
mirror of https://github.com/pcvolkmer/mv64e-onkostar-data.git synced 2025-09-13 07:52:52 +00:00

feat: filter alterations references by related specimens

This commit is contained in:
2025-07-07 00:59:41 +02:00
parent 3d520042cb
commit 0dba2c7235

View File

@@ -22,6 +22,7 @@ package dev.pcvolkmer.onco.datamapper.mapper;
import dev.pcvolkmer.mv64e.mtb.Mtb; import dev.pcvolkmer.mv64e.mtb.Mtb;
import dev.pcvolkmer.mv64e.mtb.Reference; import dev.pcvolkmer.mv64e.mtb.Reference;
import dev.pcvolkmer.mv64e.mtb.TumorSpecimen;
import dev.pcvolkmer.onco.datamapper.PropertyCatalogue; import dev.pcvolkmer.onco.datamapper.PropertyCatalogue;
import dev.pcvolkmer.onco.datamapper.datacatalogues.*; import dev.pcvolkmer.onco.datamapper.datacatalogues.*;
import dev.pcvolkmer.onco.datamapper.exceptions.DataAccessException; import dev.pcvolkmer.onco.datamapper.exceptions.DataAccessException;
@@ -148,6 +149,11 @@ public class MtbDataMapper implements DataMapper<Mtb> {
var diagnosis = diagnosisDataMapper.getById(kpaId); var diagnosis = diagnosisDataMapper.getById(kpaId);
var specimens = molekulargenetikToSpecimenDataMapper.getAllByKpaId(
kpaId,
Reference.builder().id(diagnosis.getId()).type("MTBDiagnosis").build()
);
resultBuilder resultBuilder
.patient(kpaPatient) .patient(kpaPatient)
.episodesOfCare(List.of(mtbEpisodeDataMapper.getById(kpaId))) .episodesOfCare(List.of(mtbEpisodeDataMapper.getById(kpaId)))
@@ -161,20 +167,29 @@ public class MtbDataMapper implements DataMapper<Mtb> {
.priorDiagnosticReports(kpaVorbefundeDataMapper.getByParentId(kpaId)) .priorDiagnosticReports(kpaVorbefundeDataMapper.getByParentId(kpaId))
// Histologie-Berichte // Histologie-Berichte
.histologyReports(kpaHistologieDataMapper.getByParentId(kpaId)) .histologyReports(kpaHistologieDataMapper.getByParentId(kpaId))
// Tumorproben
.specimens(specimens)
// DNPM Therapieplan // DNPM Therapieplan
.carePlans( .carePlans(
therapieplanCatalogue therapieplanCatalogue
.getByKpaId(kpaId).stream() .getByKpaId(kpaId).stream()
.map(therapieplanDataMapper::getById) .map(therapieplanDataMapper::getById)
// Remove references to alterations not present in specimens
.peek(therapieplan -> therapieplan.setMedicationRecommendations(
therapieplan.getMedicationRecommendations().stream()
.peek(mtbMedicationRecommendation ->
mtbMedicationRecommendation.setSupportingVariants(
mtbMedicationRecommendation.getSupportingVariants().stream()
.filter(geneAlterationReference -> specimens.stream()
.map(TumorSpecimen::getId)
.collect(Collectors.toList()).contains(geneAlterationReference.getVariant().getId()))
.collect(Collectors.toList())
)
).collect(Collectors.toList())
)
)
.collect(Collectors.toList()) .collect(Collectors.toList())
) )
// Tumorproben
.specimens(
molekulargenetikToSpecimenDataMapper.getAllByKpaId(
kpaId,
Reference.builder().id(diagnosis.getId()).type("MTBDiagnosis").build()
)
)
// NGS Berichte // NGS Berichte
.ngsReports( .ngsReports(
kpaMolekulargenetikDataMapper.getAllByKpaId(kpaId) kpaMolekulargenetikDataMapper.getAllByKpaId(kpaId)