Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
holger-stenzhorn committed Apr 29, 2021
1 parent d5e8023 commit 39d07e5
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>de.difuture.uds</groupId>
<artifactId>odm2fhir</artifactId>
<version>0.6.1</version>
<version>0.6.2</version>

<name>ODM2FHIR</name>
<description>Mapper for GECCO based study/patient data in CDISC ODM to HL7 FHIR</description>
Expand Down
19 changes: 13 additions & 6 deletions src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/de/difuture/uds/odm2fhir/fhir/mapper/StudyEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -92,17 +92,23 @@ public Stream<DomainResource> 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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -63,7 +63,7 @@ public class Subject {

public Stream<DomainResource> 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()));

Expand All @@ -75,7 +75,7 @@ public Stream<DomainResource> 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()));
Expand All @@ -91,7 +91,7 @@ public Stream<DomainResource> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)));
}

Expand Down

0 comments on commit 39d07e5

Please sign in to comment.