Skip to content

Commit

Permalink
extract and change substance id generation from plain name
Browse files Browse the repository at this point in the history
  • Loading branch information
pcvolkmer committed Nov 25, 2024
1 parent 11205d5 commit 914ba6e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -29,7 +29,7 @@
},
"request": {
"method": "PUT",
"url": "MedicationStatement/d5925147316a1e8c6e69c3f663fad0301c1666ca5bf1b14f4c75cdda22ffce3b"
"url": "MedicationStatement/2be692115f7383b050211e2c4b857655192448b28772b0a5af15839b1a84fa5e"
}
} ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -29,7 +29,7 @@
},
"request": {
"method": "PUT",
"url": "MedicationStatement/9d5246fd9512f352552a8ea37cbb65991f06e7497c6bf0575f81a49e1b9bfa35"
"url": "MedicationStatement/69e986083bed8b3ee0519fda269bfa44104d421348ccd8214f1af901b26650df"
}
} ]
}

0 comments on commit 914ba6e

Please sign in to comment.