diff --git a/pom.xml b/pom.xml index 49d1ae9..fc3a14a 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ de.difuture.uds odm2fhir - 0.8.4 + 0.8.5 ODM2FHIR Mapper for GECCO based study/patient data in CDISC ODM to HL7 FHIR @@ -25,13 +25,13 @@ UTF-8 UTF-8 - 6.1.3 - 2.13.4 + 6.2.0 + 2.14.0 1.0.2 1.18.24 2.9.2 1.3.4 - 6.3.1 + 6.4.0 3.1.0 3.10.1 diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/anamnesis/item/OrganRecipient.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/anamnesis/item/OrganRecipient.java index 8cf0024..c4dd777 100644 --- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/anamnesis/item/OrganRecipient.java +++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/anamnesis/item/OrganRecipient.java @@ -68,21 +68,16 @@ private Condition createCondition(ItemData transplantCoding) { for (var coding : createCodings(transplantCoding)) { switch (coding.getCode()) { - case "410605003": //YES - condition.setClinicalStatus(ACTIVE).setVerificationStatus(CONFIRMED); - break; - case "410594000": //NO - condition.setVerificationStatus(REFUTED); - break; - case "261665006": //UNKNOWN - condition.addModifierExtension(DATA_PRESENCE_UNKNOWN); - break; - default: + case "410605003" -> condition.setClinicalStatus(ACTIVE).setVerificationStatus(CONFIRMED); //YES + case "410594000" -> condition.setVerificationStatus(REFUTED); //NO + case "261665006" -> condition.addModifierExtension(DATA_PRESENCE_UNKNOWN); //UNKNOWN + default -> { if (ICD_10_GM.getUrl().equals(coding.getSystem())) { //add ICD Code codeCodeableConcept.addCoding(coding); } else if (SNOMED_CT.getUrl().equals(coding.getSystem())) { //add SNOMED Code of bodySite bodySiteCodeableConcept.addCoding(coding); } + } } } diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/consent/item/BroadConsent.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/consent/item/BroadConsent.java index 2b63d07..f27a2c6 100644 --- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/consent/item/BroadConsent.java +++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/consent/item/BroadConsent.java @@ -123,30 +123,25 @@ private Consent createConsent(FormData formData) { .setMeta(createMeta(GERMAN_CONSENT)); switch (formData.getItemData("miibc_consent_status").getValue()) { - case "1": //agreed - consent.setStatus(ConsentState.ACTIVE); - break; - case "2": //rejected - consent.setStatus(REJECTED); - break; - case "3": //revoked + case "1" -> consent.setStatus(ConsentState.ACTIVE); //agreed + case "2" -> consent.setStatus(REJECTED); //rejected + case "3" -> { //revoked var revocationDateItem = formData.getItemData("miibc_w_dat_dok"); switch (formData.getItemData("miibc_widerruf").getValue()) { - case "1": //fully revoked - consent.setStatus(INACTIVE) - .setDateTimeElement(createDateTimeType(revocationDateItem)); //revocation -> replace 'consentDate' by 'revocationDate' - break; - case "2": //partly revoked - consent.setDateTimeElement(createDateTimeType(revocationDateItem)); //revocation -> replace 'consentDate' by 'revocationDate' + case "1" -> //fully revoked + consent.setStatus(INACTIVE).setDateTimeElement( + createDateTimeType(revocationDateItem)); //revocation -> replace 'consentDate' by 'revocationDate' + case "2" -> //partly revoked + consent.setDateTimeElement( + createDateTimeType(revocationDateItem)); //revocation -> replace 'consentDate' by 'revocationDate' //purposely no 'break;' - case "3": //not revoked - case "4": //unknown (REVOCATION-Status, not CONSENT-Status!) + case "3", "4" -> //not revoked, //unknown (REVOCATION-Status, not CONSENT-Status!) consent.setStatus(ConsentState.ACTIVE); //default if not revoked - break; } - break; - case "4": //unknown + } + case "4" -> { //unknown return new Consent(); //skip if general CONSENT-Status is 'unknown' + } } var mainProvisionComponent = new Consent.provisionComponent().setType(DENY); diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/medication/item/Anticoagulation.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/medication/item/Anticoagulation.java index 2ffb4f0..b7c8f20 100644 --- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/medication/item/Anticoagulation.java +++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/medication/item/Anticoagulation.java @@ -75,26 +75,20 @@ private MedicationStatement createMedicationStatement(ItemData generalCoding, It var medicationCodeableConcept = createCodeableConcept(generalCoding); for (var coding : createCodings(specificCoding)) { switch (coding.getCode()) { - case "410605003": //Answer = YES - medicationStatement.setStatus(MedicationStatementStatus.ACTIVE); - break; - case "410594000": //Answer = NO - medicationStatement.setStatus(NOTTAKEN); - break; - case "261665006": //Answer = Unknown - medicationStatement.setStatus(MedicationStatementStatus.UNKNOWN); - break; - case "74964007": //Answer = Sonstige/Other + case "410605003" -> medicationStatement.setStatus(MedicationStatementStatus.ACTIVE); //Answer = YES + case "410594000" -> medicationStatement.setStatus(NOTTAKEN); //Answer = NO + case "261665006" -> medicationStatement.setStatus(MedicationStatementStatus.UNKNOWN); //Answer = Unknown + case "74964007" -> { //Answer = Sonstige/Other medicationCodeableConcept.addCoding(coding.setDisplay("Other (qualifier value)")); if (endsWith(accurateCodingOrText.getItemOID(), "_textfeld") && !accurateCodingOrText.isEmpty()) { medicationCodeableConcept.setText(accurateCodingOrText.getValue()); } - break; - default: //add Medication Codes + } + default -> { //add Medication Codes if (accurateCodingOrText.isEmpty()) { medicationCodeableConcept.addCoding(coding); } - break; + } } } diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/medication/item/COVID19Therapy.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/medication/item/COVID19Therapy.java index 753ad71..f7d5c0c 100644 --- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/medication/item/COVID19Therapy.java +++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/medication/item/COVID19Therapy.java @@ -68,26 +68,20 @@ private MedicationStatement createMedicationStatement(ItemData specificCoding, I var medicationCodeableConcept = new CodeableConcept(); for (var coding : createCodings(specificCoding)) { switch (coding.getCode()) { - case "410605003": - medicationStatement.setStatus(MedicationStatementStatus.ACTIVE); - break; - case "410594000": - medicationStatement.setStatus(NOTTAKEN); - break; - case "261665006": - medicationStatement.setStatus(MedicationStatementStatus.UNKNOWN); - break; - case "74964007": //Answer = Sonstige/Other + case "410605003" -> medicationStatement.setStatus(MedicationStatementStatus.ACTIVE); + case "410594000" -> medicationStatement.setStatus(NOTTAKEN); + case "261665006" -> medicationStatement.setStatus(MedicationStatementStatus.UNKNOWN); + case "74964007" -> { //Answer = Sonstige/Other medicationCodeableConcept.addCoding(coding.setDisplay("Other (qualifier value)")); if (endsWith(accurateCodingOrText.getItemOID(), "_textfeld") && !accurateCodingOrText.isEmpty()) { medicationCodeableConcept.setText(accurateCodingOrText.getValue()); } - break; - default: //add Medication Codes + } + default -> { //add Medication Codes if (accurateCodingOrText.isEmpty()) { medicationCodeableConcept.addCoding(coding); } - break; + } } } diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/symptoms/item/SymptomConditions.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/symptoms/item/SymptomConditions.java index a5186b6..4c986b0 100644 --- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/symptoms/item/SymptomConditions.java +++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/symptoms/item/SymptomConditions.java @@ -69,26 +69,20 @@ private Stream createConditions(FormData formData, ItemData gene var codeCodeableConcept = new CodeableConcept(); for (var coding : specificCodings) { switch (coding.getCode()) { - case "410605003": //PRESENT - condition.setClinicalStatus(ACTIVE).setVerificationStatus(CONFIRMED); - break; - case "410594000": //ABSENT - condition.setVerificationStatus(REFUTED); - break; - case "261665006": //UNKNOWN - condition.addModifierExtension(DATA_PRESENCE_UNKNOWN); - break; - case "74964007": //Answer = Sonstige/Other + case "410605003" -> condition.setClinicalStatus(ACTIVE).setVerificationStatus(CONFIRMED); //PRESENT + case "410594000" -> condition.setVerificationStatus(REFUTED); //ABSENT + case "261665006" -> condition.addModifierExtension(DATA_PRESENCE_UNKNOWN); //UNKNOWN + case "74964007" -> { //Answer = Sonstige/Other codeCodeableConcept.addCoding(coding.setDisplay("Other (qualifier value)")); if (!formData.getItemData("symptome_andere_symptome_textfeld").isEmpty()) { codeCodeableConcept.setText(formData.getItemData("symptome_andere_symptome_textfeld").getValue()); } - break; - default: //SYMPTOM CODING + } + default -> { //SYMPTOM CODING if (!"symptome_geruchs_bzw_geschmacksstoerungen".equals(specificCoding.getItemOID())) { codeCodeableConcept.addCoding(coding); } - break; + } } } diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/util/NUMCodeSystem.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/util/NUMCodeSystem.java index 4677940..1df40c9 100644 --- a/src/main/java/de/difuture/uds/odm2fhir/fhir/util/NUMCodeSystem.java +++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/util/NUMCodeSystem.java @@ -24,7 +24,6 @@ public enum NUMCodeSystem { ECRF_PARAMETER_CODES, FRAILTY_SCORE, - SNOMED_PCE_SUPPLEMENT, SOFA_SCORE; private static final String BASE = "https://www.netzwerk-universitaetsmedizin.de/fhir/CodeSystem/"; diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/writer/FHIRBundler.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/writer/FHIRBundler.java index 02da53a..ced106e 100644 --- a/src/main/java/de/difuture/uds/odm2fhir/fhir/writer/FHIRBundler.java +++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/writer/FHIRBundler.java @@ -50,6 +50,7 @@ import static org.springframework.util.ReflectionUtils.invokeMethod; import static java.lang.String.format; +import static java.util.function.Predicate.not; @Slf4j @Service @@ -88,6 +89,7 @@ public Bundle bundle(Stream domainResources) { var bundle = (Bundle) new Bundle().setType(TRANSACTION).setMeta(new Meta().addProfile(GECCO_BUNDLE.getUrl())); domainResources + .filter(not(DomainResource::isEmpty)) .peek(this::removeCodingDisplays) .filter(domainResource -> resourceValidator == null || resourceValidator.validate(domainResource)) .forEach(domainResource -> { diff --git a/src/main/java/de/difuture/uds/odm2fhir/odm/processor/ODMProcessor.java b/src/main/java/de/difuture/uds/odm2fhir/odm/processor/ODMProcessor.java index 6e64d9d..05c85a4 100644 --- a/src/main/java/de/difuture/uds/odm2fhir/odm/processor/ODMProcessor.java +++ b/src/main/java/de/difuture/uds/odm2fhir/odm/processor/ODMProcessor.java @@ -120,7 +120,7 @@ private void process(InputStream inputStream) throws Exception { if (xmlStreamReader.isStartElement()) { switch (xmlStreamReader.getLocalName()) { - case "ODM": + case "ODM" -> { if (subjectODMHashes != null && initialODMInRun) { var creationDateTime = xmlStreamReader.getAttributeValue(null, "CreationDateTime"); try { @@ -129,12 +129,10 @@ private void process(InputStream inputStream) throws Exception { previousRunDateTime = ZonedDateTime.parse(creationDateTime).toLocalDateTime(); } } - break; - case "SubjectData": + } + case "SubjectData" -> { var subjectData = xmlMapper.readValue(xmlStreamReader, SubjectData.class); - var hash = subjectODMHashes != null ? subjectData.hashCode() : null; - if (hash == null || !hash.equals(subjectODMHashes.get(subjectData.getSubjectKey()))) { fhirBundleWriter.write(fhirBundler.bundle(new Subject().map(subjectData))); @@ -142,6 +140,7 @@ private void process(InputStream inputStream) throws Exception { subjectODMHashes.put(subjectData.getSubjectKey(), hash); } } + } } } }