From fa4760c6c937bdd9025124482b93a597ab82fa0c Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Fri, 22 Nov 2024 12:39:24 +0100 Subject: [PATCH 1/8] feat: add initial SystemischeTherapieMedicationStatementMapper --- .../ume/obdstofhir/FhirProperties.java | 1 + ...scheTherapieMedicationStatementMapper.java | 75 +++++++++++++++++++ src/main/resources/application.yml | 1 + ...TherapieMedicationStatementMapperTest.java | 66 ++++++++++++++++ ...ement.Testpatient_1.xml.approved.fhir.json | 21 ++++++ ...ement.Testpatient_2.xml.approved.fhir.json | 21 ++++++ ...ement.Testpatient_3.xml.approved.fhir.json | 21 ++++++ 7 files changed, 206 insertions(+) create mode 100644 src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java create mode 100644 src/test/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.java create mode 100644 src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json create mode 100644 src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json create mode 100644 src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java b/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java index 62a16eaa..456474fd 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java @@ -100,6 +100,7 @@ public static class FhirProfiles { private String miiPrOnkoDiagnosePrimaertumor; private String miiPrOnkoStrahlentherapie; private String miiPrOnkoSystemischeTherapie; + private String miiPrMedicationStatement; } @Data diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java new file mode 100644 index 00000000..602bce24 --- /dev/null +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java @@ -0,0 +1,75 @@ +package org.miracum.streams.ume.obdstofhir.mapper.mii; + +import de.basisdatensatz.obds.v3.SYSTTyp; +import java.util.Objects; +import org.apache.commons.lang3.Validate; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Enumerations.ResourceType; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.MedicationStatement; +import org.hl7.fhir.r4.model.Reference; +import org.miracum.streams.ume.obdstofhir.FhirProperties; +import org.miracum.streams.ume.obdstofhir.mapper.ObdsToFhirMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +@Service +public class SystemischeTherapieMedicationStatementMapper extends ObdsToFhirMapper { + + private static final Logger LOG = + LoggerFactory.getLogger(SystemischeTherapieProcedureMapper.class); + + public SystemischeTherapieMedicationStatementMapper(FhirProperties fhirProperties) { + super(fhirProperties); + } + + public Bundle map(SYSTTyp syst, Reference patient, Reference procedure) { + Objects.requireNonNull(syst, "Systemtherapie must not be null"); + Objects.requireNonNull(patient, "Reference to Patient must not be null"); + Objects.requireNonNull(procedure, "Reference to Procedure must not be null"); + + Validate.notBlank(syst.getSYSTID(), "Required SYST_ID is unset"); + Validate.isTrue( + Objects.equals( + patient.getReferenceElement().getResourceType(), ResourceType.PATIENT.toCode()), + "The subject reference should point to a Patient resource"); + Validate.isTrue( + Objects.equals( + procedure.getReferenceElement().getResourceType(), ResourceType.PROCEDURE.toCode()), + "The subject reference should point to a Procedure resource"); + + var bundle = new Bundle(); + + for (var substanz : syst.getMengeSubstanz().getSubstanz()) { + var systMedicationStatement = new MedicationStatement(); + systMedicationStatement + .getMeta() + .addProfile(fhirProperties.getProfiles().getMiiPrMedicationStatement()); + + if ((null != substanz.getATC() && StringUtils.hasText(substanz.getATC().getCode())) + || StringUtils.hasText(substanz.getBezeichnung())) { + var substanzId = ""; + if (null != substanz.getATC() && StringUtils.hasText(substanz.getATC().getCode())) { + substanzId = substanz.getATC().getCode(); + } else { + substanzId = substanz.getBezeichnung().replaceAll("[^A-Za-z0-9]", ""); + } + + // TODO: can we be sure that this SYST-ID is globally unqiue across all SYSTs? + // if not we may instead need to construct the ID from the patient-id + others. + var identifier = + new Identifier() + .setSystem(fhirProperties.getSystems().getSystemischeTherapieProcedureId()) + .setValue(String.format("%s_%s", syst.getSYSTID(), substanzId)); + systMedicationStatement.addIdentifier(identifier); + systMedicationStatement.setId(computeResourceIdFromIdentifier(identifier)); + + bundle = addResourceAsEntryInBundle(bundle, systMedicationStatement); + } + } + + return bundle; + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5a577b88..5f806706 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -86,6 +86,7 @@ fhir: mii-pr-onko-diagnose-primaertumor: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-diagnose-primaertumor" mii-pr-onko-strahlentherapie: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-strahlentherapie" mii-pr-onko-systemische-therapie: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie" + mii-pr-medication-statement: "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" display: histologyLoinc: "Histology and Behavior ICD-O-3 Cancer" gradingLoinc: "Grade pathology value Cancer" diff --git a/src/test/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.java b/src/test/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.java new file mode 100644 index 00000000..97987ce2 --- /dev/null +++ b/src/test/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.java @@ -0,0 +1,66 @@ +package org.miracum.streams.ume.obdstofhir.mapper.mii; + +import static org.assertj.core.api.Assertions.assertThat; + +import ca.uhn.fhir.context.FhirContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule; +import de.basisdatensatz.obds.v3.OBDS; +import java.io.IOException; +import org.approvaltests.Approvals; +import org.hl7.fhir.r4.model.Reference; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import org.miracum.streams.ume.obdstofhir.FhirProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest(classes = {FhirProperties.class}) +@EnableConfigurationProperties +class SystemischeTherapieMedicationStatementMapperTest { + private static SystemischeTherapieMedicationStatementMapper sut; + + @BeforeAll + static void beforeAll(@Autowired FhirProperties fhirProps) { + sut = new SystemischeTherapieMedicationStatementMapper(fhirProps); + } + + @ParameterizedTest + @CsvSource({"Testpatient_1.xml", "Testpatient_2.xml", "Testpatient_3.xml"}) + void map_withGivenObds_shouldCreateValidMedicationStatement(String sourceFile) + throws IOException { + final var resource = this.getClass().getClassLoader().getResource("obds3/" + sourceFile); + assertThat(resource).isNotNull(); + + final var xmlMapper = + XmlMapper.builder() + .defaultUseWrapper(false) + .addModule(new JakartaXmlBindAnnotationModule()) + .addModule(new Jdk8Module()) + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .build(); + + final var obds = xmlMapper.readValue(resource.openStream(), OBDS.class); + + var obdsPatient = obds.getMengePatient().getPatient().getFirst(); + + var patient = new Reference("Patient/any"); + var procedure = new Reference("Procedure/any"); + var systMeldung = + obdsPatient.getMengeMeldung().getMeldung().stream() + .filter(m -> m.getSYST() != null) + .findFirst() + .get(); + var bundle = sut.map(systMeldung.getSYST(), patient, procedure); + + var fhirParser = FhirContext.forR4().newJsonParser().setPrettyPrint(true); + var fhirJson = fhirParser.encodeResourceToString(bundle); + + Approvals.verify( + fhirJson, Approvals.NAMES.withParameters(sourceFile).forFile().withExtension(".fhir.json")); + } +} diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json new file mode 100644 index 00000000..d9d27fb2 --- /dev/null +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json @@ -0,0 +1,21 @@ +{ + "resourceType": "Bundle", + "entry": [ { + "fullUrl": "MedicationStatement/99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1", + "resource": { + "resourceType": "MedicationStatement", + "id": "99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1", + "meta": { + "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] + }, + "identifier": [ { + "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", + "value": "101_IN-1_L01FF05" + } ] + }, + "request": { + "method": "PUT", + "url": "MedicationStatement/99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1" + } + } ] +} \ No newline at end of file diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json new file mode 100644 index 00000000..aac6ba72 --- /dev/null +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json @@ -0,0 +1,21 @@ +{ + "resourceType": "Bundle", + "entry": [ { + "fullUrl": "MedicationStatement/d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b", + "resource": { + "resourceType": "MedicationStatement", + "id": "d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b", + "meta": { + "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] + }, + "identifier": [ { + "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", + "value": "11_1_Innere.1_Bicalutamid" + } ] + }, + "request": { + "method": "PUT", + "url": "MedicationStatement/d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b" + } + } ] +} \ No newline at end of file diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json new file mode 100644 index 00000000..52a5276d --- /dev/null +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json @@ -0,0 +1,21 @@ +{ + "resourceType": "Bundle", + "entry": [ { + "fullUrl": "MedicationStatement/9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35", + "resource": { + "resourceType": "MedicationStatement", + "id": "9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35", + "meta": { + "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] + }, + "identifier": [ { + "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", + "value": "12_1_Innere.1_Paclitaxel" + } ] + }, + "request": { + "method": "PUT", + "url": "MedicationStatement/9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35" + } + } ] +} From bf2fae394bc3830acac8fdc99c7082fe2db49b2c Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Fri, 22 Nov 2024 13:14:36 +0100 Subject: [PATCH 2/8] add medication and bundle type --- .../streams/ume/obdstofhir/FhirProperties.java | 2 ++ .../SystemischeTherapieMedicationStatementMapper.java | 9 +++++++++ src/main/resources/application.yml | 2 ++ ...tionStatement.Testpatient_1.xml.approved.fhir.json | 11 +++++++++-- ...tionStatement.Testpatient_2.xml.approved.fhir.json | 8 ++++++-- ...tionStatement.Testpatient_3.xml.approved.fhir.json | 6 +++++- 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java b/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java index 456474fd..d9dc4ac0 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java @@ -81,6 +81,8 @@ public static class FhirSystems { private String miiCsTherapieGrundEnde; private String conditionVerStatus; private String icdo3MorphologieOid; + private String atcBfarm; + private String atcWho; } @Data diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java index 602bce24..b29f659b 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java @@ -4,6 +4,8 @@ import java.util.Objects; import org.apache.commons.lang3.Validate; import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.CodeableConcept; +import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Enumerations.ResourceType; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.MedicationStatement; @@ -41,6 +43,7 @@ public Bundle map(SYSTTyp syst, Reference patient, Reference procedure) { "The subject reference should point to a Procedure resource"); var bundle = new Bundle(); + bundle.setType(Bundle.BundleType.TRANSACTION); for (var substanz : syst.getMengeSubstanz().getSubstanz()) { var systMedicationStatement = new MedicationStatement(); @@ -53,8 +56,14 @@ public Bundle map(SYSTTyp syst, Reference patient, Reference procedure) { var substanzId = ""; if (null != substanz.getATC() && StringUtils.hasText(substanz.getATC().getCode())) { substanzId = substanz.getATC().getCode(); + var atcCoding = + new Coding( + fhirProperties.getSystems().getAtcBfarm(), substanz.getATC().getCode(), ""); + systMedicationStatement.setMedication(new CodeableConcept(atcCoding)); } else { substanzId = substanz.getBezeichnung().replaceAll("[^A-Za-z0-9]", ""); + systMedicationStatement.setMedication( + new CodeableConcept().setText(substanz.getBezeichnung())); } // TODO: can we be sure that this SYST-ID is globally unqiue across all SYSTs? diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5f806706..ee6ffd9c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -69,6 +69,8 @@ fhir: mii-cs-onko-seitenlokalisation: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/CodeSystem/mii-cs-onko-seitenlokalisation" mii-cs-onko-systemische-therapie-art: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/CodeSystem/mii-cs-onko-therapie-typ" mii-cs-therapie-grund-ende: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/CodeSystem/mii-cs-therapie-grund-ende" + atcBfarm: "http://fhir.de/CodeSystem/bfarm/atc" + atcWho: "http://www.whocc.no/atc" profiles: histologie: "http://dktk.dkfz.de/fhir/StructureDefinition/onco-core-Observation-Histologie" grading: "http://dktk.dkfz.de/fhir/StructureDefinition/onco-core-Observation-Grading" diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json index d9d27fb2..2a11d804 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json @@ -1,5 +1,6 @@ { "resourceType": "Bundle", + "type": "transaction", "entry": [ { "fullUrl": "MedicationStatement/99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1", "resource": { @@ -11,11 +12,17 @@ "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "101_IN-1_L01FF05" - } ] + } ], + "medicationCodeableConcept": { + "coding": [ { + "system": "http://fhir.de/CodeSystem/bfarm/atc", + "code": "L01FF05" + } ] + } }, "request": { "method": "PUT", "url": "MedicationStatement/99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1" } } ] -} \ No newline at end of file +} diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json index aac6ba72..1d821834 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json @@ -1,5 +1,6 @@ { "resourceType": "Bundle", + "type": "transaction", "entry": [ { "fullUrl": "MedicationStatement/d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b", "resource": { @@ -11,11 +12,14 @@ "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "11_1_Innere.1_Bicalutamid" - } ] + } ], + "medicationCodeableConcept": { + "text": "Bicalutamid" + } }, "request": { "method": "PUT", "url": "MedicationStatement/d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b" } } ] -} \ No newline at end of file +} diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json index 52a5276d..75008ff8 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json @@ -1,5 +1,6 @@ { "resourceType": "Bundle", + "type": "transaction", "entry": [ { "fullUrl": "MedicationStatement/9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35", "resource": { @@ -11,7 +12,10 @@ "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "12_1_Innere.1_Paclitaxel" - } ] + } ], + "medicationCodeableConcept": { + "text": "Paclitaxel" + } }, "request": { "method": "PUT", From 16485524d86e07110e6ff9ef041e7e5273c8ae05 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 25 Nov 2024 07:11:11 +0100 Subject: [PATCH 3/8] add missing subject, status and effective --- ...scheTherapieMedicationStatementMapper.java | 22 +++++++++++++++++++ ...ement.Testpatient_1.xml.approved.fhir.json | 8 +++++++ ...ement.Testpatient_2.xml.approved.fhir.json | 7 ++++++ ...ement.Testpatient_3.xml.approved.fhir.json | 7 ++++++ 4 files changed, 44 insertions(+) diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java index b29f659b..aaf870b9 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java @@ -1,6 +1,7 @@ package org.miracum.streams.ume.obdstofhir.mapper.mii; import de.basisdatensatz.obds.v3.SYSTTyp; +import de.basisdatensatz.obds.v3.SYSTTyp.Meldeanlass; import java.util.Objects; import org.apache.commons.lang3.Validate; import org.hl7.fhir.r4.model.Bundle; @@ -9,6 +10,7 @@ import org.hl7.fhir.r4.model.Enumerations.ResourceType; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.MedicationStatement; +import org.hl7.fhir.r4.model.Period; import org.hl7.fhir.r4.model.Reference; import org.miracum.streams.ume.obdstofhir.FhirProperties; import org.miracum.streams.ume.obdstofhir.mapper.ObdsToFhirMapper; @@ -75,6 +77,26 @@ public Bundle map(SYSTTyp syst, Reference patient, Reference procedure) { systMedicationStatement.addIdentifier(identifier); systMedicationStatement.setId(computeResourceIdFromIdentifier(identifier)); + // Status / Effective + var meldeanlass = syst.getMeldeanlass(); + var period = new Period(); + if (meldeanlass == Meldeanlass.BEHANDLUNGSENDE) { + systMedicationStatement.setStatus( + MedicationStatement.MedicationStatementStatus.COMPLETED); + convertObdsDatumToDateTimeType(syst.getBeginn()) + .ifPresent(start -> period.setStart(start.getValue(), start.getPrecision())); + convertObdsDatumToDateTimeType(syst.getEnde()) + .ifPresent(end -> period.setEnd(end.getValue(), end.getPrecision())); + } else { + systMedicationStatement.setStatus(MedicationStatement.MedicationStatementStatus.ACTIVE); + convertObdsDatumToDateTimeType(syst.getBeginn()) + .ifPresent(start -> period.setStart(start.getValue(), start.getPrecision())); + } + systMedicationStatement.setEffective(period); + + // Subject + systMedicationStatement.setSubject(patient); + bundle = addResourceAsEntryInBundle(bundle, systMedicationStatement); } } diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json index 2a11d804..1708d70b 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json @@ -13,11 +13,19 @@ "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "101_IN-1_L01FF05" } ], + "status": "completed", "medicationCodeableConcept": { "coding": [ { "system": "http://fhir.de/CodeSystem/bfarm/atc", "code": "L01FF05" } ] + }, + "subject": { + "reference": "Patient/any" + }, + "effectivePeriod": { + "start": "2020-05", + "end": "2020-10-15" } }, "request": { diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json index 1d821834..cc3420a1 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json @@ -13,8 +13,15 @@ "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "11_1_Innere.1_Bicalutamid" } ], + "status": "active", "medicationCodeableConcept": { "text": "Bicalutamid" + }, + "subject": { + "reference": "Patient/any" + }, + "effectivePeriod": { + "start": "2021-11-08" } }, "request": { diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json index 75008ff8..af845914 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json @@ -13,8 +13,15 @@ "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "12_1_Innere.1_Paclitaxel" } ], + "status": "active", "medicationCodeableConcept": { "text": "Paclitaxel" + }, + "subject": { + "reference": "Patient/any" + }, + "effectivePeriod": { + "start": "2018-03-17" } }, "request": { From 71b87df4e156d07b9ee7087c1fb6147529d81bb9 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 25 Nov 2024 12:31:23 +0100 Subject: [PATCH 4/8] change property "mii-pr-medication-statement" Co-authored-by: chgl --- src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ee6ffd9c..d69edcc5 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -88,7 +88,7 @@ fhir: mii-pr-onko-diagnose-primaertumor: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-diagnose-primaertumor" mii-pr-onko-strahlentherapie: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-strahlentherapie" mii-pr-onko-systemische-therapie: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie" - mii-pr-medication-statement: "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" + mii-pr-medication-statement: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" display: histologyLoinc: "Histology and Behavior ICD-O-3 Cancer" gradingLoinc: "Grade pathology value Cancer" From 11205d52b862e8c6e7937f6928f2bddd50503b17 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 25 Nov 2024 13:01:48 +0100 Subject: [PATCH 5/8] set "partOf" --- .../mii/SystemischeTherapieMedicationStatementMapper.java | 5 +++++ ...dMedicationStatement.Testpatient_1.xml.approved.fhir.json | 5 ++++- ...dMedicationStatement.Testpatient_2.xml.approved.fhir.json | 5 ++++- ...dMedicationStatement.Testpatient_3.xml.approved.fhir.json | 5 ++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java index aaf870b9..d2556e65 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java @@ -2,6 +2,8 @@ import de.basisdatensatz.obds.v3.SYSTTyp; import de.basisdatensatz.obds.v3.SYSTTyp.Meldeanlass; + +import java.util.List; import java.util.Objects; import org.apache.commons.lang3.Validate; import org.hl7.fhir.r4.model.Bundle; @@ -97,6 +99,9 @@ public Bundle map(SYSTTyp syst, Reference patient, Reference procedure) { // Subject systMedicationStatement.setSubject(patient); + // Part of + systMedicationStatement.setPartOf(List.of(procedure)); + bundle = addResourceAsEntryInBundle(bundle, systMedicationStatement); } } diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json index 1708d70b..333065e4 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json @@ -7,12 +7,15 @@ "resourceType": "MedicationStatement", "id": "99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1", "meta": { - "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] + "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" ] }, "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "101_IN-1_L01FF05" } ], + "partOf": [ { + "reference": "Procedure/any" + } ], "status": "completed", "medicationCodeableConcept": { "coding": [ { diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json index cc3420a1..603fc53d 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json @@ -7,12 +7,15 @@ "resourceType": "MedicationStatement", "id": "d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b", "meta": { - "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] + "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" ] }, "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "11_1_Innere.1_Bicalutamid" } ], + "partOf": [ { + "reference": "Procedure/any" + } ], "status": "active", "medicationCodeableConcept": { "text": "Bicalutamid" diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json index af845914..de40ff90 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json @@ -7,12 +7,15 @@ "resourceType": "MedicationStatement", "id": "9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35", "meta": { - "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] + "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" ] }, "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", "value": "12_1_Innere.1_Paclitaxel" } ], + "partOf": [ { + "reference": "Procedure/any" + } ], "status": "active", "medicationCodeableConcept": { "text": "Paclitaxel" From 914ba6e987f5874e3796e3f44c174dfdb2588ba3 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 25 Nov 2024 13:16:31 +0100 Subject: [PATCH 6/8] extract and change substance id generation from plain name --- ...ystemischeTherapieMedicationStatementMapper.java | 13 +++++++++++-- ...onStatement.Testpatient_2.xml.approved.fhir.json | 8 ++++---- ...onStatement.Testpatient_3.xml.approved.fhir.json | 8 ++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java index d2556e65..c9901ac2 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java @@ -1,8 +1,9 @@ package org.miracum.streams.ume.obdstofhir.mapper.mii; +import com.google.common.hash.Hashing; import de.basisdatensatz.obds.v3.SYSTTyp; import de.basisdatensatz.obds.v3.SYSTTyp.Meldeanlass; - +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Objects; import org.apache.commons.lang3.Validate; @@ -65,7 +66,7 @@ public Bundle map(SYSTTyp syst, Reference patient, Reference procedure) { fhirProperties.getSystems().getAtcBfarm(), substanz.getATC().getCode(), ""); systMedicationStatement.setMedication(new CodeableConcept(atcCoding)); } else { - substanzId = substanz.getBezeichnung().replaceAll("[^A-Za-z0-9]", ""); + substanzId = createSubstanzIdFromPlain(substanz.getBezeichnung()); systMedicationStatement.setMedication( new CodeableConcept().setText(substanz.getBezeichnung())); } @@ -108,4 +109,12 @@ public Bundle map(SYSTTyp syst, Reference patient, Reference procedure) { return bundle; } + + private String createSubstanzIdFromPlain(String plainName) { + Validate.notBlank(plainName, "Required substance name is unset"); + return String.format( + "%s_%s", + plainName.replaceAll("[^A-Za-z0-9]+", ""), + Hashing.sha256().hashString(plainName, StandardCharsets.UTF_8).toString().substring(0, 4)); + } } diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json index 603fc53d..4c6b013c 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json @@ -2,16 +2,16 @@ "resourceType": "Bundle", "type": "transaction", "entry": [ { - "fullUrl": "MedicationStatement/d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b", + "fullUrl": "MedicationStatement/2be692115f7383b050211e2c4b857655192448b28772b0a5af15839b1a84fa5e", "resource": { "resourceType": "MedicationStatement", - "id": "d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b", + "id": "2be692115f7383b050211e2c4b857655192448b28772b0a5af15839b1a84fa5e", "meta": { "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" ] }, "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", - "value": "11_1_Innere.1_Bicalutamid" + "value": "11_1_Innere.1_Bicalutamid_fa96" } ], "partOf": [ { "reference": "Procedure/any" @@ -29,7 +29,7 @@ }, "request": { "method": "PUT", - "url": "MedicationStatement/d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b" + "url": "MedicationStatement/2be692115f7383b050211e2c4b857655192448b28772b0a5af15839b1a84fa5e" } } ] } diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json index de40ff90..3235e9ba 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json @@ -2,16 +2,16 @@ "resourceType": "Bundle", "type": "transaction", "entry": [ { - "fullUrl": "MedicationStatement/9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35", + "fullUrl": "MedicationStatement/69e986083bed8b3ee0519fda269bfa44104d421348ccd8214f1af901b26650df", "resource": { "resourceType": "MedicationStatement", - "id": "9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35", + "id": "69e986083bed8b3ee0519fda269bfa44104d421348ccd8214f1af901b26650df", "meta": { "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" ] }, "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", - "value": "12_1_Innere.1_Paclitaxel" + "value": "12_1_Innere.1_Paclitaxel_a0a4" } ], "partOf": [ { "reference": "Procedure/any" @@ -29,7 +29,7 @@ }, "request": { "method": "PUT", - "url": "MedicationStatement/9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35" + "url": "MedicationStatement/69e986083bed8b3ee0519fda269bfa44104d421348ccd8214f1af901b26650df" } } ] } From 476019340cc927aec4e3b1703824d0fc9ea87a71 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 25 Nov 2024 14:39:10 +0100 Subject: [PATCH 7/8] Revert "change property "mii-pr-medication-statement"" This reverts commit 71b87df4e156d07b9ee7087c1fb6147529d81bb9. --- src/main/resources/application.yml | 2 +- ...alidMedicationStatement.Testpatient_1.xml.approved.fhir.json | 2 +- ...alidMedicationStatement.Testpatient_2.xml.approved.fhir.json | 2 +- ...alidMedicationStatement.Testpatient_3.xml.approved.fhir.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d69edcc5..ee6ffd9c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -88,7 +88,7 @@ fhir: mii-pr-onko-diagnose-primaertumor: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-diagnose-primaertumor" mii-pr-onko-strahlentherapie: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-strahlentherapie" mii-pr-onko-systemische-therapie: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie" - mii-pr-medication-statement: "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" + mii-pr-medication-statement: "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" display: histologyLoinc: "Histology and Behavior ICD-O-3 Cancer" gradingLoinc: "Grade pathology value Cancer" diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json index 333065e4..42f73feb 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json @@ -7,7 +7,7 @@ "resourceType": "MedicationStatement", "id": "99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1", "meta": { - "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" ] + "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] }, "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json index 4c6b013c..33da4a46 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json @@ -7,7 +7,7 @@ "resourceType": "MedicationStatement", "id": "2be692115f7383b050211e2c4b857655192448b28772b0a5af15839b1a84fa5e", "meta": { - "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" ] + "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] }, "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json index 3235e9ba..f266efc3 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json @@ -7,7 +7,7 @@ "resourceType": "MedicationStatement", "id": "69e986083bed8b3ee0519fda269bfa44104d421348ccd8214f1af901b26650df", "meta": { - "profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-systemische-therapie-medikation" ] + "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] }, "identifier": [ { "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", From 6f8625eb25400cf55414b00e20ab40b793b2a935 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 25 Nov 2024 15:06:20 +0100 Subject: [PATCH 8/8] use custom system for medical statement id --- .../miracum/streams/ume/obdstofhir/FhirProperties.java | 1 + .../mii/SystemischeTherapieMedicationStatementMapper.java | 3 ++- src/main/resources/application.yml | 1 + ...dicationStatement.Testpatient_1.xml.approved.fhir.json | 8 ++++---- ...dicationStatement.Testpatient_2.xml.approved.fhir.json | 8 ++++---- ...dicationStatement.Testpatient_3.xml.approved.fhir.json | 8 ++++---- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java b/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java index d9dc4ac0..023cd23e 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/FhirProperties.java @@ -76,6 +76,7 @@ public static class FhirSystems { private String miiCsOnkoStrahlentherapieZielgebiet; private String strahlentherapieProcedureId; private String systemischeTherapieProcedureId; + private String systemischeTherapieMedicationStatementId; private String miiCsOnkoSystemischeTherapieArt; private String miiCsOnkoSeitenlokalisation; private String miiCsTherapieGrundEnde; diff --git a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java index c9901ac2..a5950d03 100644 --- a/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java +++ b/src/main/java/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapper.java @@ -75,7 +75,8 @@ public Bundle map(SYSTTyp syst, Reference patient, Reference procedure) { // if not we may instead need to construct the ID from the patient-id + others. var identifier = new Identifier() - .setSystem(fhirProperties.getSystems().getSystemischeTherapieProcedureId()) + .setSystem( + fhirProperties.getSystems().getSystemischeTherapieMedicationStatementId()) .setValue(String.format("%s_%s", syst.getSYSTID(), substanzId)); systMedicationStatement.addIdentifier(identifier); systMedicationStatement.setId(computeResourceIdFromIdentifier(identifier)); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ee6ffd9c..f0ce33b6 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -30,6 +30,7 @@ fhir: psaObservationId: "${fhir.default.baseSystemUrl}/obds-to-fhir/identifiers/psa-observation-id" strahlentherapie-procedure-id: "${fhir.default.baseSystemUrl}/obds-to-fhir/identifiers/strahlentherapie-procedure-id" systemische-therapie-procedure-id: "${fhir.default.baseSystemUrl}/obds-to-fhir/identifiers/systemische-therapie-procedure-id" + systemische-therapie-medication-statement-id: "${fhir.default.baseSystemUrl}/obds-to-fhir/identifiers/systemische-therapie-medication-statement-id" loinc: "http://loinc.org" icdo3Morphologie: "http://terminology.hl7.org/CodeSystem/icd-o-3" icdo3MorphologieOid: "urn:oid:2.16.840.1.113883.6.43.1" diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json index 42f73feb..432b740b 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_1.xml.approved.fhir.json @@ -2,15 +2,15 @@ "resourceType": "Bundle", "type": "transaction", "entry": [ { - "fullUrl": "MedicationStatement/99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1", + "fullUrl": "MedicationStatement/050a031e5a9043c28c565c6b60550c3d34cd059bc2f24c195cdb807f099cd978", "resource": { "resourceType": "MedicationStatement", - "id": "99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1", + "id": "050a031e5a9043c28c565c6b60550c3d34cd059bc2f24c195cdb807f099cd978", "meta": { "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] }, "identifier": [ { - "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", + "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-medication-statement-id", "value": "101_IN-1_L01FF05" } ], "partOf": [ { @@ -33,7 +33,7 @@ }, "request": { "method": "PUT", - "url": "MedicationStatement/99635bf8744dadda1f8b293046f2bfb3d021938263616e6228523113af2695c1" + "url": "MedicationStatement/050a031e5a9043c28c565c6b60550c3d34cd059bc2f24c195cdb807f099cd978" } } ] } diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json index 33da4a46..6c8f7289 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_2.xml.approved.fhir.json @@ -2,15 +2,15 @@ "resourceType": "Bundle", "type": "transaction", "entry": [ { - "fullUrl": "MedicationStatement/2be692115f7383b050211e2c4b857655192448b28772b0a5af15839b1a84fa5e", + "fullUrl": "MedicationStatement/e4b35c4756c9668e9c2b92f281667382020c401482e0a674566a695cd20a4cfa", "resource": { "resourceType": "MedicationStatement", - "id": "2be692115f7383b050211e2c4b857655192448b28772b0a5af15839b1a84fa5e", + "id": "e4b35c4756c9668e9c2b92f281667382020c401482e0a674566a695cd20a4cfa", "meta": { "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] }, "identifier": [ { - "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", + "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-medication-statement-id", "value": "11_1_Innere.1_Bicalutamid_fa96" } ], "partOf": [ { @@ -29,7 +29,7 @@ }, "request": { "method": "PUT", - "url": "MedicationStatement/2be692115f7383b050211e2c4b857655192448b28772b0a5af15839b1a84fa5e" + "url": "MedicationStatement/e4b35c4756c9668e9c2b92f281667382020c401482e0a674566a695cd20a4cfa" } } ] } diff --git a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json index f266efc3..e5a45a30 100644 --- a/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json +++ b/src/test/java/snapshots/org/miracum/streams/ume/obdstofhir/mapper/mii/SystemischeTherapieMedicationStatementMapperTest.map_withGivenObds_shouldCreateValidMedicationStatement.Testpatient_3.xml.approved.fhir.json @@ -2,15 +2,15 @@ "resourceType": "Bundle", "type": "transaction", "entry": [ { - "fullUrl": "MedicationStatement/69e986083bed8b3ee0519fda269bfa44104d421348ccd8214f1af901b26650df", + "fullUrl": "MedicationStatement/da9d78a5d066bba6acd32a9a903c8663ecc1421cb373dcb51566b6d23dd30df7", "resource": { "resourceType": "MedicationStatement", - "id": "69e986083bed8b3ee0519fda269bfa44104d421348ccd8214f1af901b26650df", + "id": "da9d78a5d066bba6acd32a9a903c8663ecc1421cb373dcb51566b6d23dd30df7", "meta": { "profile": [ "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/MedicationStatement" ] }, "identifier": [ { - "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-procedure-id", + "system": "https://bzkf.github.io/obds-to-fhir/identifiers/systemische-therapie-medication-statement-id", "value": "12_1_Innere.1_Paclitaxel_a0a4" } ], "partOf": [ { @@ -29,7 +29,7 @@ }, "request": { "method": "PUT", - "url": "MedicationStatement/69e986083bed8b3ee0519fda269bfa44104d421348ccd8214f1af901b26650df" + "url": "MedicationStatement/da9d78a5d066bba6acd32a9a903c8663ecc1421cb373dcb51566b6d23dd30df7" } } ] }