mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-03 09:42:54 +00:00
Issue #28: Initiale Implementierung zur Ermittlung der NGS-Befund-Varianten
This commit is contained in:
104
src/main/java/DNPM/analyzer/EinzelempfehlungAnalyzer.java
Normal file
104
src/main/java/DNPM/analyzer/EinzelempfehlungAnalyzer.java
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
package DNPM.analyzer;
|
||||||
|
|
||||||
|
import DNPM.dto.Variant;
|
||||||
|
import DNPM.security.DelegatingDataBasedPermissionEvaluator;
|
||||||
|
import DNPM.services.molekulargenetik.MolekulargenetikFormService;
|
||||||
|
import de.itc.onkostar.api.Disease;
|
||||||
|
import de.itc.onkostar.api.IOnkostarApi;
|
||||||
|
import de.itc.onkostar.api.Procedure;
|
||||||
|
import de.itc.onkostar.api.analysis.AnalyzerRequirement;
|
||||||
|
import de.itc.onkostar.api.analysis.IProcedureAnalyzer;
|
||||||
|
import de.itc.onkostar.api.analysis.OnkostarPluginType;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Diese Klasse implementiert ein Plugin, welches Funktionen für DNPM UF Einzelempfehlung bereit stellt.
|
||||||
|
*
|
||||||
|
* @since 0.2.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class EinzelempfehlungAnalyzer implements IProcedureAnalyzer {
|
||||||
|
|
||||||
|
private final IOnkostarApi onkostarApi;
|
||||||
|
|
||||||
|
private final MolekulargenetikFormService molekulargenetikFormService;
|
||||||
|
|
||||||
|
private final DelegatingDataBasedPermissionEvaluator permissionEvaluator;
|
||||||
|
|
||||||
|
public EinzelempfehlungAnalyzer(
|
||||||
|
final IOnkostarApi onkostarApi,
|
||||||
|
final MolekulargenetikFormService molekulargenetikFormService,
|
||||||
|
final DelegatingDataBasedPermissionEvaluator permissionEvaluator
|
||||||
|
) {
|
||||||
|
this.onkostarApi = onkostarApi;
|
||||||
|
this.molekulargenetikFormService = molekulargenetikFormService;
|
||||||
|
this.permissionEvaluator = permissionEvaluator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OnkostarPluginType getType() {
|
||||||
|
return OnkostarPluginType.BACKEND_SERVICE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVersion() {
|
||||||
|
return "0.1.0";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "DNPM Einzelempfehlung Backend Service";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Stellt Funktionen zur Nutzung im Therapieplan-Unterformular für Einzelempfehlungen bereit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isRelevantForDeletedProcedure() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRelevantForAnalyzer(Procedure procedure, Disease disease) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSynchronous() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AnalyzerRequirement getRequirement() {
|
||||||
|
return AnalyzerRequirement.PROCEDURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void analyze(Procedure procedure, Disease disease) {
|
||||||
|
// No op
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Variant> getVariants(Map<String, Object> input) {
|
||||||
|
var procedureId = AnalyzerUtils.getRequiredId(input, "id");
|
||||||
|
|
||||||
|
if (procedureId.isEmpty()) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
var procedure = onkostarApi.getProcedure(procedureId.get());
|
||||||
|
if (null == procedure) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
return molekulargenetikFormService.getVariants(procedure);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,6 +3,8 @@ package DNPM.config;
|
|||||||
import DNPM.database.SettingsRepository;
|
import DNPM.database.SettingsRepository;
|
||||||
import DNPM.services.*;
|
import DNPM.services.*;
|
||||||
import DNPM.services.consent.ConsentManagerServiceFactory;
|
import DNPM.services.consent.ConsentManagerServiceFactory;
|
||||||
|
import DNPM.services.molekulargenetik.MolekulargenetikFormService;
|
||||||
|
import DNPM.services.molekulargenetik.OsMolekulargenetikFormService;
|
||||||
import DNPM.services.mtb.DefaultMtbService;
|
import DNPM.services.mtb.DefaultMtbService;
|
||||||
import DNPM.services.mtb.MtbService;
|
import DNPM.services.mtb.MtbService;
|
||||||
import DNPM.services.systemtherapie.DefaultSystemtherapieService;
|
import DNPM.services.systemtherapie.DefaultSystemtherapieService;
|
||||||
@ -68,4 +70,9 @@ public class PluginConfiguration {
|
|||||||
return new TherapieplanServiceFactory(onkostarApi, settingsService, formService);
|
return new TherapieplanServiceFactory(onkostarApi, settingsService, formService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MolekulargenetikFormService molekulargenetikFormService() {
|
||||||
|
return new OsMolekulargenetikFormService();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
67
src/main/java/DNPM/dto/Variant.java
Normal file
67
src/main/java/DNPM/dto/Variant.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package DNPM.dto;
|
||||||
|
|
||||||
|
import de.itc.onkostar.api.Procedure;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class Variant {
|
||||||
|
private final Integer id;
|
||||||
|
|
||||||
|
private final String shortDescription;
|
||||||
|
|
||||||
|
private Variant(
|
||||||
|
final int id,
|
||||||
|
final String shortDescription
|
||||||
|
) {
|
||||||
|
this.id = id;
|
||||||
|
this.shortDescription = shortDescription.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShortDescription() {
|
||||||
|
return shortDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Optional<Variant> fromProcedure(Procedure procedure) {
|
||||||
|
if (! "OS.Molekulargenetische Untersuchung".equals(procedure.getFormName())) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
var ergebnis = procedure.getValue("Ergebnis");
|
||||||
|
var gene = procedure.getValue("Untersucht");
|
||||||
|
var exon = procedure.getValue("ExonInt");
|
||||||
|
var pathogenitaetsklasse = procedure.getValue("Pathogenitaetsklasse");
|
||||||
|
|
||||||
|
if (null == gene) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ergebnis.getString().equals("P")) {
|
||||||
|
return Optional.of(
|
||||||
|
new Variant(
|
||||||
|
procedure.getId(),
|
||||||
|
String.format("Einfache Variante: %s, %s, %s", gene.getString(), exon.getString(), pathogenitaetsklasse.getString())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else if (ergebnis.getString().equals("CNV")) {
|
||||||
|
return Optional.of(
|
||||||
|
new Variant(
|
||||||
|
procedure.getId(),
|
||||||
|
String.format("Copy Number Variation: %s, %s, %s", gene.getString(), exon.getString(), pathogenitaetsklasse.getString())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else if (ergebnis.getString().equals("F")) {
|
||||||
|
return Optional.of(
|
||||||
|
new Variant(
|
||||||
|
procedure.getId(),
|
||||||
|
String.format("Fusion: %s, %s, %s", gene.getString(), exon.getString(), pathogenitaetsklasse.getString())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package DNPM.services.molekulargenetik;
|
||||||
|
|
||||||
|
import DNPM.dto.Variant;
|
||||||
|
import de.itc.onkostar.api.Procedure;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface MolekulargenetikFormService {
|
||||||
|
|
||||||
|
List<Variant> getVariants(Procedure procedure);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package DNPM.services.molekulargenetik;
|
||||||
|
|
||||||
|
import DNPM.dto.Variant;
|
||||||
|
import DNPM.security.FormSecured;
|
||||||
|
import DNPM.security.PersonPoolSecured;
|
||||||
|
import de.itc.onkostar.api.Procedure;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class OsMolekulargenetikFormService implements MolekulargenetikFormService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@FormSecured
|
||||||
|
@PersonPoolSecured
|
||||||
|
public List<Variant> getVariants(Procedure procedure) {
|
||||||
|
if (! "OS.Molekulargenetik".equals(procedure.getFormName())) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
var subforms = procedure.getSubProceduresMap().get("MolekulargenetischeUntersuchung");
|
||||||
|
if (null == subforms) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
return subforms.stream()
|
||||||
|
.map(Variant::fromProcedure)
|
||||||
|
.filter(Optional::isPresent)
|
||||||
|
.map(Optional::get)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user