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

Add survey #547

Merged
merged 5 commits into from
May 11, 2022
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
605 changes: 358 additions & 247 deletions config/postman/fhir-bridge.postman_collection.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import org.ehrbase.fhirbridge.fhir.bundle.converter.AntiBodyPanelConverter;
import org.ehrbase.fhirbridge.fhir.bundle.converter.BloodGasPanelConverter;
import org.ehrbase.fhirbridge.fhir.bundle.converter.DiagnosticReportLabConverter;
import org.ehrbase.fhirbridge.fhir.bundle.converter.UCCAppProDatenBundleConverter;
import org.ehrbase.fhirbridge.fhir.bundle.converter.UCCSensordatenActivityBundleConverter;
import org.ehrbase.fhirbridge.fhir.bundle.converter.UCCSensordatenVitalSignsBundleConverter;
import org.ehrbase.fhirbridge.fhir.bundle.converter.VirologischerBefundConverter;
import org.ehrbase.fhirbridge.fhir.bundle.validator.AntiBodyPanelBundleValidator;
import org.ehrbase.fhirbridge.fhir.bundle.validator.BloodGasPanelBundleValidator;
import org.ehrbase.fhirbridge.fhir.bundle.validator.DiagnosticReportLabBundleValidator;
import org.ehrbase.fhirbridge.fhir.bundle.validator.UCCAppProDatenValidator;
import org.ehrbase.fhirbridge.fhir.bundle.validator.UCCSensorDatenValidator;
import org.ehrbase.fhirbridge.fhir.bundle.validator.VirologischerBefundBundleValidator;
import org.ehrbase.fhirbridge.fhir.common.Profile;
Expand Down Expand Up @@ -68,9 +70,21 @@ public void configure() throws Exception {
.when(header(CamelConstants.PROFILE).isEqualTo(Profile.UCC_SENSORDATEN_VITALSIGNS))
.bean(UCCSensorDatenValidator.class)
.bean(UCCSensordatenVitalSignsBundleConverter.class,"convert")
.when(header(CamelConstants.PROFILE).isEqualTo(Profile.UCC_APP_PRO_DATEN))
.bean(UCCAppProDatenValidator.class)
.bean(UCCAppProDatenBundleConverter.class,"convert")
.otherwise()
.throwException(new UnprocessableEntityException("Unsupported transaction: provided Bundle should have a resource that " +
"uses on of the following profiles: " + Profile.BLOOD_GAS_PANEL.getUri() + ", " + Profile.DIAGNOSTIC_REPORT_LAB.getUri() + ", " + Profile.ANTI_BODY_PANEL.getUri() + ", " +Profile.VIROLOGISCHER_BEFUND.getUri() + ", " + Profile.UCC_SENSORDATEN_STEPS.getUri()+ ", " + Profile.UCC_SENSORDATEN_VITALSIGNS.getUri()))
"uses on of the following profiles: " +
Profile.BLOOD_GAS_PANEL.getUri() +
", " + Profile.DIAGNOSTIC_REPORT_LAB.getUri() +
", " + Profile.ANTI_BODY_PANEL.getUri() +
", " +Profile.VIROLOGISCHER_BEFUND.getUri() +
", " + Profile.UCC_SENSORDATEN_STEPS.getUri()+
", " + Profile.UCC_SENSORDATEN_VITALSIGNS.getUri() +
", " + Profile.UCC_APP_PRO_DATEN.getUri()
))

.end()
.to("direct:provideResource")
.process(BundleResponseProcessor.BEAN_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
import org.ehrbase.fhirbridge.ehr.converter.specific.stationaererversorgungsfall.StationaererVersorgungsfallCompositionConverter;
import org.ehrbase.fhirbridge.ehr.converter.specific.symptom.SymptomCompositionConverter;
import org.ehrbase.fhirbridge.ehr.converter.specific.therapy.TherapyCompositionConverter;
import org.ehrbase.fhirbridge.ehr.converter.specific.sensordaten.UCCSensordatenCompositionConverter;
import org.ehrbase.fhirbridge.ehr.converter.specific.uccappdaten.UCCAppProDatenConverter;
import org.ehrbase.fhirbridge.ehr.converter.specific.uccsensordaten.UCCSensordatenCompositionConverter;
import org.ehrbase.fhirbridge.ehr.converter.specific.virologischerbefund.VirologischerBefundCompositionConverter;
import org.ehrbase.fhirbridge.fhir.common.Profile;
import org.ehrbase.fhirbridge.service.TerminologyService;
Expand Down Expand Up @@ -105,6 +106,7 @@ private void registerDocumentReference(ConversionService conversionService) {
private void registerCompositionConverter(ConversionService conversionService) {
conversionService.registerConverter(Profile.UCC_SENSORDATEN_VITALSIGNS, new UCCSensordatenCompositionConverter());
conversionService.registerConverter(Profile.UCC_SENSORDATEN_STEPS, new UCCSensordatenCompositionConverter());
conversionService.registerConverter(Profile.UCC_APP_PRO_DATEN, new UCCAppProDatenConverter());
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.uccappdaten;

import org.ehrbase.client.classgenerator.shareddefinition.NullFlavour;
import org.ehrbase.fhirbridge.ehr.converter.generic.ObservationToPointEventConverter;
import org.ehrbase.fhirbridge.ehr.converter.specific.CodeSystem;
import org.ehrbase.fhirbridge.ehr.opt.uccappprodatencomposition.definition.BlutdruckBeliebigesEreignisPointEvent;
import org.ehrbase.fhirbridge.ehr.opt.uccappprodatencomposition.definition.BlutdruckBeliebigesEreignisPointEvent;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Observation;

import java.util.Optional;

public class BlutdruckEreignisConverter extends ObservationToPointEventConverter<BlutdruckBeliebigesEreignisPointEvent> {

@Override
protected BlutdruckBeliebigesEreignisPointEvent convertInternal(Observation observation) {
BlutdruckBeliebigesEreignisPointEvent bloodPressureAnyEventPointEvent = new BlutdruckBeliebigesEreignisPointEvent();
setSystolicAndDiastolic(bloodPressureAnyEventPointEvent, observation);
return bloodPressureAnyEventPointEvent;
}

private void setSystolicAndDiastolic(BlutdruckBeliebigesEreignisPointEvent bloodPressure, Observation resource) {
for (Observation.ObservationComponentComponent component:resource.getComponent()) {
for(Coding coding:component.getCode().getCoding()){
mapSystolicAndDiastolic(coding, bloodPressure, component);
}
}
}

private void mapSystolicAndDiastolic(Coding coding, BlutdruckBeliebigesEreignisPointEvent bloodPressure, Observation.ObservationComponentComponent component) {
if (coding.getSystem().equals(CodeSystem.LOINC.getUrl()) && coding.getCode().equals("8480-6")){
setSystolisch(component, bloodPressure);
}else if(coding.getSystem().equals(CodeSystem.LOINC.getUrl()) && coding.getCode().equals("8462-4")){
setDiastolisch(component, bloodPressure);
}
}

private void setSystolisch(Observation.ObservationComponentComponent component, BlutdruckBeliebigesEreignisPointEvent bloodPressure) {
if(component.hasValueQuantity()){
getValue(component).ifPresent(bloodPressure::setSystolischMagnitude);
getUnit(component).ifPresent(bloodPressure::setSystolischUnits);
}else{
bloodPressure.setSystolischNullFlavourDefiningCode(NullFlavour.UNKNOWN);
}
}

private void setDiastolisch(Observation.ObservationComponentComponent component, BlutdruckBeliebigesEreignisPointEvent bloodPressure) {
if(component.hasValueQuantity()){
getValue(component).ifPresent(bloodPressure::setDiastolischMagnitude);
getUnit(component).ifPresent(bloodPressure::setDiastolischUnits);
}else{
bloodPressure.setDiastolischNullFlavourDefiningCode(NullFlavour.UNKNOWN);
}
}

private Optional<Double> getValue(Observation.ObservationComponentComponent component) {
if(component.hasValueQuantity() ){
return Optional.of(component.getValueQuantity().getValue().doubleValue());
}else{
return Optional.empty();
}
}

private Optional<String> getUnit(Observation.ObservationComponentComponent component) {
if(component.hasValueQuantity() ){
return Optional.of(component.getValueQuantity().getCode());
}else{
return Optional.empty();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.uccappdaten;

import org.ehrbase.fhirbridge.ehr.converter.generic.ObservationToObservationConverter;
import org.ehrbase.fhirbridge.ehr.opt.uccappprodatencomposition.definition.BlutdruckObservation;
import org.hl7.fhir.r4.model.Observation;

public class BlutdruckObservationConverter extends ObservationToObservationConverter<BlutdruckObservation> {
//TODO sadly duplicated mapping opt generated templates changed therefore cannot reuse :(

@Override
protected BlutdruckObservation convertInternal(Observation observation) {
BlutdruckObservation bloodPressure = new BlutdruckObservation();
bloodPressure.setBeliebigesEreignis( new BlutdruckEreignisConverter().convert(observation));
return bloodPressure;
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.uccappdaten;

import org.ehrbase.fhirbridge.ehr.converter.generic.ObservationToObservationConverter;
import org.ehrbase.fhirbridge.ehr.opt.uccappprodatencomposition.definition.KoerpergewichtObservation;
import org.hl7.fhir.r4.model.Observation;

public class KoerpergewichtConverter extends ObservationToObservationConverter<KoerpergewichtObservation> {
//TODO sadly duplicated mapping opt generated templates changed therefore cannot reuse :(

@Override
protected KoerpergewichtObservation convertInternal(Observation observation) {
KoerpergewichtObservation bodyWeightObservation = new KoerpergewichtObservation();
bodyWeightObservation.setGewichtMagnitude(mapWeightMagnitude(observation));
bodyWeightObservation.setGewichtUnits(mapWeightUnit(observation));
mapWeightUnit(observation);
return bodyWeightObservation;
}

private String mapWeightUnit(Observation observation) {
return observation.getComponent().get(0).getValueQuantity().getUnit(); //Can contain only one component.
}

private double mapWeightMagnitude(Observation observation) {
return observation.getComponent().get(0).getValueQuantity().getValue().doubleValue(); //Can contain only one component.
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.uccappdaten;

import org.ehrbase.fhirbridge.ehr.converter.generic.ObservationToObservationConverter;
import org.ehrbase.fhirbridge.ehr.opt.uccappprodatencomposition.definition.PulsfrequenzHerzfrequenzObservation;
import org.hl7.fhir.r4.model.Observation;

public class PulsfrequenzConverter extends ObservationToObservationConverter<PulsfrequenzHerzfrequenzObservation> {
@Override
protected PulsfrequenzHerzfrequenzObservation convertInternal(Observation observation) {
PulsfrequenzHerzfrequenzObservation pulseHeartBeatObservation = new PulsfrequenzHerzfrequenzObservation();
pulseHeartBeatObservation.setFrequenzMagnitude(mapPulseRateMagnitude(observation));;
pulseHeartBeatObservation.setFrequenzUnits("/min");;
return pulseHeartBeatObservation;
}

private Double mapPulseRateMagnitude(Observation observation) {
return observation.getComponent().get(0).getValueQuantity().getValue().doubleValue();//Can contain only one component.
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.uccappdaten;

import org.ehrbase.fhirbridge.ehr.converter.generic.CompositionToCompositionConverter;
import org.ehrbase.fhirbridge.ehr.opt.uccappprodatencomposition.UCCAppPRODatenComposition;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Composition;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Reference;

public class UCCAppProDatenConverter extends CompositionToCompositionConverter<UCCAppPRODatenComposition> {

@Override
protected UCCAppPRODatenComposition convertInternal(Composition composition) {
UCCAppPRODatenComposition uccAppPRODatenComposition = new UCCAppPRODatenComposition();
mapEntries(uccAppPRODatenComposition, composition);
return uccAppPRODatenComposition;
}

private void mapEntries(UCCAppPRODatenComposition uccAppPRODatenComposition, Composition composition) {
for (Composition.SectionComponent section : composition.getSection()) {
for (Coding coding : section.getCode().getCoding()) {
if (coding.getCode().equals("vital-signs") && coding.getSystem().equals("http://terminology.hl7.org/CodeSystem/observation-category")) {
for (Reference entry : section.getEntry()) {
mapEntry(uccAppPRODatenComposition, entry);
}
}
}
}
}

private void mapEntry(UCCAppPRODatenComposition composition, Reference entry) {
Observation observation = (Observation) entry.getResource();
for (Coding coding : observation.getCode().getCoding()) {
if (coding.getCode().equals("55284-4")) {
mapBlutdruck(observation, composition);
} else if (coding.getCode().equals("3141-9")) {
mapKoerpergewicht(observation, composition);
} else if (coding.getCode().equals("8867-4")) {
mapPulsfrequenz(observation, composition);
}
}
}

private void mapBlutdruck(Observation observation, UCCAppPRODatenComposition uccAppPRODatenComposition) {
uccAppPRODatenComposition.setBlutdruck(new BlutdruckObservationConverter().convert(observation));
}

private void mapKoerpergewicht(Observation observation, UCCAppPRODatenComposition uccAppPRODatenComposition) {
uccAppPRODatenComposition.setKoerpergewicht(new KoerpergewichtConverter().convert(observation));
}

private void mapPulsfrequenz(Observation observation, UCCAppPRODatenComposition uccAppPRODatenComposition) {
uccAppPRODatenComposition.setPulsfrequenzHerzfrequenz(new PulsfrequenzConverter().convert(observation));
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.sensordaten;
package org.ehrbase.fhirbridge.ehr.converter.specific.uccsensordaten;

import org.ehrbase.fhirbridge.ehr.converter.generic.CompositionToObservationConverter;
import org.ehrbase.fhirbridge.ehr.opt.uccappsensordatencomposition.definition.MitSensorGemesseneKoerperlicheAktivitaetJedesEreignisChoice;
Expand All @@ -11,7 +11,7 @@
import java.util.ArrayList;
import java.util.List;

public class KoerperlicheAktivitaetToObservation extends CompositionToObservationConverter<MitSensorGemesseneKoerperlicheAktivitaetObservation> {
public class KoerperlicheAktivitaetConverter extends CompositionToObservationConverter<MitSensorGemesseneKoerperlicheAktivitaetObservation> {
@Override
protected MitSensorGemesseneKoerperlicheAktivitaetObservation convertInternal(Composition composition) {
MitSensorGemesseneKoerperlicheAktivitaetObservation koerperlicheAktivitaetObservation = new MitSensorGemesseneKoerperlicheAktivitaetObservation();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.sensordaten;
package org.ehrbase.fhirbridge.ehr.converter.specific.uccsensordaten;


import org.ehrbase.fhirbridge.ehr.converter.ConversionException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.sensordaten;
package org.ehrbase.fhirbridge.ehr.converter.specific.uccsensordaten;

import org.ehrbase.fhirbridge.ehr.converter.ConversionException;
import org.ehrbase.fhirbridge.ehr.converter.generic.ObservationToPointEventConverter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.sensordaten;
package org.ehrbase.fhirbridge.ehr.converter.specific.uccsensordaten;

import org.ehrbase.fhirbridge.ehr.converter.generic.CompositionToObservationConverter;
import org.ehrbase.fhirbridge.ehr.opt.uccappsensordatencomposition.definition.PulsfrequenzHerzfrequenzMomentaneHerzfrequenzChoice;
Expand All @@ -11,7 +11,7 @@
import java.util.ArrayList;
import java.util.List;

public class PulsfrequenzHerzfrequenzToObservation extends CompositionToObservationConverter<PulsfrequenzHerzfrequenzObservation> {
public class PulsfrequenzHerzfrequenzObservationConverter extends CompositionToObservationConverter<PulsfrequenzHerzfrequenzObservation> {

@Override
protected PulsfrequenzHerzfrequenzObservation convertInternal(Composition composition) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ehrbase.fhirbridge.ehr.converter.specific.sensordaten;
package org.ehrbase.fhirbridge.ehr.converter.specific.uccsensordaten;

import org.ehrbase.fhirbridge.ehr.converter.generic.CompositionToCompositionConverter;
import org.ehrbase.fhirbridge.ehr.opt.uccappsensordatencomposition.UCCAppSensorDatenComposition;
Expand All @@ -18,10 +18,10 @@ private void convertSections(UCCAppSensorDatenComposition uccAppSensorDatenCompo
for (Composition.SectionComponent section : composition.getSection()) {
for (Coding coding : section.getCode().getCoding()) {
if (coding.getCode().equals("vital-signs") && coding.getSystem().equals("http://terminology.hl7.org/CodeSystem/observation-category")) {
uccAppSensorDatenComposition.setPulsfrequenzHerzfrequenz(new PulsfrequenzHerzfrequenzToObservation().convert(composition));
uccAppSensorDatenComposition.setPulsfrequenzHerzfrequenz(new PulsfrequenzHerzfrequenzObservationConverter().convert(composition));
}
if (coding.getCode().equals("activity") && coding.getSystem().equals("http://terminology.hl7.org/CodeSystem/observation-category")) {
uccAppSensorDatenComposition.setMitSensorGemesseneKoerperlicheAktivitaet(new KoerperlicheAktivitaetToObservation().convert(composition));
uccAppSensorDatenComposition.setMitSensorGemesseneKoerperlicheAktivitaet(new KoerperlicheAktivitaetConverter().convert(composition));
}
}
}
Expand Down
Loading