diff --git a/pom.xml b/pom.xml
index 24f63b6..1831fa8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
de.difuture.uds
odm2fhir
- 0.6.1
+ 0.6.2
ODM2FHIR
Mapper for GECCO based study/patient data in CDISC ODM to HL7 FHIR
diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Item.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Item.java
index 14f6aff..f055bff 100644
--- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Item.java
+++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Item.java
@@ -83,6 +83,7 @@
import static de.difuture.uds.odm2fhir.fhir.util.NUMStructureDefinition.UNCERTAINTY_OF_PRESENCE;
import static de.difuture.uds.odm2fhir.util.EnvironmentProvider.getEnvironment;
+import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.split;
import static org.apache.commons.lang3.StringUtils.splitByWholeSeparator;
@@ -387,14 +388,20 @@ protected final Identifier createIdentifier(ResourceTypes resourceType, ItemData
var formData = itemGroupData.getFormData();
var studyEventData = formData.getStudyEventData();
var subjectData = studyEventData.getSubjectData();
+ var value = format("%s-%s.%s-%s.%s-%s.%s-%s",
+ subjectData.getSubjectKey(),
+ studyEventData.getStudyEventOID(), studyEventData.getStudyEventRepeatKey(),
+ formData.getFormOID(), formData.getFormRepeatKey(),
+ itemGroupData.getItemGroupOID(), itemGroupData.getItemGroupRepeatKey(),
+ itemData.getItemOID());
+
+ if (!getEnvironment().containsProperty("debug")) {
+ value = sha256Hex(value);
+ }
+
return new Identifier()
.setSystem(getEnvironment().getProperty("fhir.identifier.system." + resourceType.toCode().toLowerCase()))
- .setValue(format("%s-%s.%s-%s.%s-%s.%s-%s",
- subjectData.getSubjectKey(),
- studyEventData.getStudyEventOID(), studyEventData.getStudyEventRepeatKey(),
- formData.getFormOID(), formData.getFormRepeatKey(),
- itemGroupData.getItemGroupOID(), itemGroupData.getItemGroupRepeatKey(),
- itemData.getItemOID()));
+ .setValue(value);
}
protected final Age createAge(ItemData itemData) {
diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/StudyEvent.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/StudyEvent.java
index e3e43db..5e4fc3f 100644
--- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/StudyEvent.java
+++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/StudyEvent.java
@@ -48,7 +48,7 @@
import static de.difuture.uds.odm2fhir.util.EnvironmentProvider.getEnvironment;
-import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
+import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
import static org.apache.commons.lang3.StringUtils.containsAny;
import static org.apache.commons.lang3.StringUtils.equalsAny;
@@ -92,17 +92,23 @@ public Stream map(Subject subject, StudyEventData studyEventData
var encounter = new Encounter();
if (containsAny(studyEventData.getStudyEventOID(), "GECCOVISIT", "fall")) {
+ var value = format("%s-%s.%s",
+ studyEventData.getSubjectData().getSubjectKey(),
+ studyEventData.getStudyEventOID(), studyEventData.getStudyEventRepeatKey());
+
+ if (!getEnvironment().containsProperty("debug")) {
+ value = sha256Hex(value);
+ }
+
var encounterIdentifier = new Identifier()
.setSystem(getEnvironment().getProperty("fhir.identifier.system.encounter"))
- .setValue(format("%s-%s.%s",
- studyEventData.getSubjectData().getSubjectKey(),
- studyEventData.getStudyEventOID(), studyEventData.getStudyEventRepeatKey()))
+ .setValue(value)
.setAssigner(subject.getOrganizationReference());
encounter.setStatus(UNKNOWN)
.setClass_(new Coding(IMP.getSystem(), IMP.toCode(), IMP.getDisplay()))
.addIdentifier(encounterIdentifier)
- .setId(md5Hex(encounterIdentifier.getSystem() + encounterIdentifier.getValue()));
+ .setId(sha256Hex(encounterIdentifier.getSystem() + encounterIdentifier.getValue()));
encounterReference = new Reference(format("%s/%s", ENCOUNTER.toCode(), encounter.getId()));
}
diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Subject.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Subject.java
index 58d62ef..3aa28d2 100644
--- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Subject.java
+++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Subject.java
@@ -39,7 +39,7 @@
import static de.difuture.uds.odm2fhir.fhir.util.CommonCodeSystem.IDENTIFIER_TYPE_CODES;
import static de.difuture.uds.odm2fhir.util.EnvironmentProvider.getEnvironment;
-import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
+import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
import static org.apache.commons.lang3.StringUtils.equalsAny;
import static org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR;
@@ -63,7 +63,7 @@ public class Subject {
public Stream map(SubjectData subjectData) {
var organization = new Organization().setName(getEnvironment().getProperty("fhir.identifier.assigner"));
- organization.setId(md5Hex(organization.getName()));
+ organization.setId(sha256Hex(organization.getName()));
organizationReference = new Reference(format("%s/%s", ORGANIZATION.toCode(), organization.getId()));
@@ -75,7 +75,7 @@ public Stream map(SubjectData subjectData) {
patient = (Patient) new Patient()
.addIdentifier(patientIdentifier)
- .setId(md5Hex(patientIdentifier.getSystem() + patientIdentifier.getValue()))
+ .setId(sha256Hex(patientIdentifier.getSystem() + patientIdentifier.getValue()))
.setMeta(new Meta().addProfile(NUMStructureDefinition.PATIENT.getUrl()));
patientReference = new Reference(format("%s/%s", PATIENT.toCode(), patient.getId()));
@@ -91,7 +91,7 @@ public Stream map(SubjectData subjectData) {
private void setId(DomainResource domainResource) {
var identifier = (Identifier) invokeMethod(
findMethod(domainResource.getClass(), "getIdentifierFirstRep"), domainResource);
- domainResource.setId(md5Hex(identifier.getSystem() + identifier.getValue()));
+ domainResource.setId(sha256Hex(identifier.getSystem() + identifier.getValue()));
}
private void setPatientSubject(DomainResource domainResource) {
diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/imaging/item/ImagingProcedures.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/imaging/item/ImagingProcedures.java
index b143bfa..22388f8 100644
--- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/imaging/item/ImagingProcedures.java
+++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/imaging/item/ImagingProcedures.java
@@ -37,7 +37,7 @@
import static de.difuture.uds.odm2fhir.fhir.util.NUMStructureDefinition.DIAGNOSTIC_REPORT_RADIOLOGY;
import static de.difuture.uds.odm2fhir.fhir.util.NUMStructureDefinition.RADIOLOGY_PROCEDURES;
-import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
+import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
import static org.apache.commons.lang3.StringUtils.contains;
import static org.apache.commons.lang3.StringUtils.equalsAny;
@@ -90,7 +90,7 @@ public DiagnosticReport createDiagnosticReport(ItemData befundCoding) {
.setCode(createCodeableConcept(createCoding(LOINC, "18748-4", "Diagnostic imaging study")))
.addConclusionCode(createCodeableConcept(befundCoding))
.setMeta(createMeta(DIAGNOSTIC_REPORT_RADIOLOGY))
- .setId(md5Hex(identifier.getSystem() + identifier.getValue()));
+ .setId(sha256Hex(identifier.getSystem() + identifier.getValue()));
}
private Procedure createProcedure(ItemData techniqueCoding) {
diff --git a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/laboratory_values/item/SARSCoV2Antibodies.java b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/laboratory_values/item/SARSCoV2Antibodies.java
index 8037fac..4f50eec 100644
--- a/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/laboratory_values/item/SARSCoV2Antibodies.java
+++ b/src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/laboratory_values/item/SARSCoV2Antibodies.java
@@ -44,7 +44,7 @@
import static de.difuture.uds.odm2fhir.fhir.util.NUMStructureDefinition.SARS_COV_2_IGM_SER_PL_IA_ACNC;
import static de.difuture.uds.odm2fhir.fhir.util.NUMStructureDefinition.SARS_COV_2_IGM_SER_PL_QL_IA;
-import static org.apache.commons.codec.digest.DigestUtils.md5Hex;
+import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
import static org.apache.commons.lang3.StringUtils.substringAfterLast;
import static org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL;
@@ -137,7 +137,7 @@ private Observation createObservation(FormData formData, ItemData labValue) {
.addCategory(LABORATORY.copy().addCoding(createCoding(LOINC.getUrl(), "26436-6")))
.setValue(value)
.setCode(new CodeableConcept().setCoding(usableCodings).setText(labValueName)) // TODO Add parameter name as text!!!
- .setId(md5Hex(identifier.getSystem() + identifier.getValue())) // This really needs to be and stay here!!!
+ .setId(sha256Hex(identifier.getSystem() + identifier.getValue())) // This really needs to be and stay here!!!
.setMeta(createMeta(PROFILES.get(labValueName)));
}