Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

updated symptoms #457

Merged
merged 3 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.ehrbase.fhirbridge.ehr.converter.generic.EntryEntityConverter;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.AusgeschlossenesSymptomEvaluation;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.AussageUberDenAusschlussDefiningCode;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.AussageUeberDenAusschlussDefiningCode;
import org.hl7.fhir.r4.model.Condition;

@SuppressWarnings("java:6212")
Expand All @@ -29,8 +29,8 @@ public class AusgeschlossenesSymptomEvaluationConverter
@Override
protected AusgeschlossenesSymptomEvaluation convertInternal(Condition condition) {
AusgeschlossenesSymptomEvaluation result = new AusgeschlossenesSymptomEvaluation();
result.setAussageUeberDenAusschluss(AussageUberDenAusschlussDefiningCode.N410594000.toDvCodedText());
result.setProblemDiagnose(convertCode(condition));
result.setAussageUeberDenAusschlussDefiningCode(AussageUeberDenAusschlussDefiningCode.KNOWN_ABSENT_QUALIFIER_VALUE);
result.setProblemDiagnoseDefiningCode(convertCode(condition));
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.ehrbase.fhirbridge.ehr.converter.generic.ConditionToCompositionConverter;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.SymptomComposition;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.KategorieDefiningCodeSymptom;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.KategorieDefiningCode;
import org.hl7.fhir.r4.model.Condition;
import org.hl7.fhir.r4.model.codesystems.ConditionVerStatus;
import org.springframework.lang.NonNull;
Expand All @@ -37,7 +37,7 @@ public class SymptomCompositionConverter extends ConditionToCompositionConverter
@Override
public SymptomComposition convertInternal(@NonNull Condition condition) {
SymptomComposition result = new SymptomComposition();
result.setKategorie(KategorieDefiningCodeSymptom.N753251.toDvCodedText());
result.setKategorieDefiningCode(KategorieDefiningCode.SYMPTOM);

Optional<ConditionVerStatus> conditionVerStatus = resolveConditionVerStatus(condition);
if (conditionVerStatus.isPresent() && conditionVerStatus.get() == ConditionVerStatus.CONFIRMED) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.symptom;

import com.nedap.archie.rm.datavalues.DvCodedText;
import org.ehrbase.fhirbridge.ehr.converter.ConversionException;
import org.ehrbase.fhirbridge.ehr.converter.specific.CodeSystem;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.KrankheitsanzeichenCode;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.NameDesSymptomsKrankheitsanzeichensDefiningCode;
import org.hl7.fhir.r4.model.Condition;

public interface SymptomConverter {

default DvCodedText convertCode(Condition condition) {
default NameDesSymptomsKrankheitsanzeichensDefiningCode convertCode(Condition condition) {
return condition.getCode()
.getCoding()
.stream()
.filter(coding -> coding.getSystem().equals(CodeSystem.SNOMED.getUrl()))
.findFirst()
.map(coding -> KrankheitsanzeichenCode.getCodesAsMap().get(coding.getCode()))
.orElseThrow(() -> new ConversionException("Unbekanntes <unbekanntes Symptom>"))
.toDvCodedText();
.map(coding -> NameDesSymptomsKrankheitsanzeichensDefiningCode.getCodesAsMap().get(coding.getCode()))
.orElseThrow(() -> new ConversionException("Unbekanntes <unbekanntes Symptom>"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.symptom;

import org.ehrbase.fhirbridge.ehr.converter.generic.EntryEntityConverter;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.DefiningCode;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.AussageUeberDieFehlendeInformationDefiningCode;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.UnbekanntesSymptomAussageUeberDieFehlendeInformationElement;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.UnbekanntesSymptomEvaluation;
import org.hl7.fhir.r4.model.Condition;
Expand All @@ -31,10 +31,9 @@ public class UnbekanntesSymptomEvaluationConverter extends EntryEntityConverter<
@Override
protected UnbekanntesSymptomEvaluation convertInternal(Condition condition) {
UnbekanntesSymptomEvaluation result = new UnbekanntesSymptomEvaluation();
result.setUnbekanntesSymptom(convertCode(condition));

result.setUnbekanntesSymptomDefiningCode(convertCode(condition));
UnbekanntesSymptomAussageUeberDieFehlendeInformationElement element = new UnbekanntesSymptomAussageUeberDieFehlendeInformationElement();
element.setValue(DefiningCode.N261665006.toDvCodedText());
element.setValue(AussageUeberDieFehlendeInformationDefiningCode.UNKNOWN_QUALIFIER_VALUE);
result.setAussageUeberDieFehlendeInformation(Collections.singletonList(element));

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@

package org.ehrbase.fhirbridge.ehr.converter.specific.symptom;

import com.nedap.archie.rm.datavalues.DvCodedText;
import org.ehrbase.fhirbridge.ehr.converter.ConversionException;
import org.ehrbase.fhirbridge.ehr.converter.generic.ConditionToObservationConverter;
import org.ehrbase.fhirbridge.ehr.converter.generic.TimeConverter;
import org.ehrbase.fhirbridge.ehr.converter.specific.CodeSystem;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.KrankheitsanzeichenCode;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.SchweregradSymptomCode;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.SchweregradDefiningCode;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.VorliegendesSymptomAnatomischeLokalisationElement;
import org.ehrbase.fhirbridge.ehr.opt.symptomcomposition.definition.VorliegendesSymptomObservation;
import org.hl7.fhir.r4.model.Condition;
Expand All @@ -34,30 +31,19 @@
import java.util.stream.Collectors;

@SuppressWarnings("java:S6212")
public class VorliegendesSymptomObservationConverter extends ConditionToObservationConverter<VorliegendesSymptomObservation> {
public class VorliegendesSymptomObservationConverter extends ConditionToObservationConverter<VorliegendesSymptomObservation> implements SymptomConverter {

@Override
protected VorliegendesSymptomObservation convertInternal(Condition condition) {
VorliegendesSymptomObservation result = new VorliegendesSymptomObservation();
result.setNameDesSymptomsKrankheitsanzeichens(convertCode(condition));
result.setNameDesSymptomsKrankheitsanzeichensDefiningCode(convertCode(condition));
result.setAnatomischeLokalisation(convertBodySites(condition));
result.setBeginnDerEpisodeValue(TimeConverter.convertConditionOnset(condition));
convertSeverity(condition).ifPresent(result::setSchweregrad);
convertSeverity(condition).ifPresent(result::setSchweregradDefiningCode);
TimeConverter.convertConditionAbatementTime(condition).ifPresent(result::setDatumUhrzeitDesRueckgangsValue);
return result;
}

private DvCodedText convertCode(Condition condition) {
return condition.getCode()
.getCoding()
.stream()
.filter(coding -> coding.getSystem().equals(CodeSystem.SNOMED.getUrl()))
.findFirst()
.map(coding -> KrankheitsanzeichenCode.getCodesAsMap().get(coding.getCode()))
.orElseThrow(() -> new ConversionException("Unbekanntes <unbekanntes Symptom>"))
.toDvCodedText();
}

private List<VorliegendesSymptomAnatomischeLokalisationElement> convertBodySites(Condition condition) {
if (!condition.hasBodySite()) {
return new ArrayList<>();
Expand All @@ -74,7 +60,7 @@ private List<VorliegendesSymptomAnatomischeLokalisationElement> convertBodySites
.collect(Collectors.toList());
}

private Optional<DvCodedText> convertSeverity(Condition condition) {
private Optional<SchweregradDefiningCode> convertSeverity(Condition condition) {
if (!condition.hasSeverity()) {
return Optional.empty();
}
Expand All @@ -84,7 +70,6 @@ private Optional<DvCodedText> convertSeverity(Condition condition) {
.stream()
.filter(coding -> Objects.equals(coding.getSystem(), CodeSystem.SNOMED.getUrl()))
.findFirst()
.map(coding -> SchweregradSymptomCode.getCodesAsMap().get(coding.getCode()))
.map(SchweregradSymptomCode::toDvCodedText);
.map(coding -> SchweregradDefiningCode.getCodesAsMap().get(coding.getCode()));
}
}
Loading