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

Commit

Permalink
0.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
holger-stenzhorn committed Nov 12, 2022
1 parent 29069e1 commit c4106c8
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 77 deletions.
8 changes: 4 additions & 4 deletions 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.8.4</version>
<version>0.8.5</version>

<name>ODM2FHIR</name>
<description>Mapper for GECCO based study/patient data in CDISC ODM to HL7 FHIR</description>
Expand All @@ -25,13 +25,13 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<hapi-fhir.version>6.1.3</hapi-fhir.version>
<jackson.version>2.13.4</jackson.version>
<hapi-fhir.version>6.2.0</hapi-fhir.version>
<jackson.version>2.14.0</jackson.version>
<kafka-fhir-serializer.version>1.0.2</kafka-fhir-serializer.version>
<lombok.version>1.18.24</lombok.version>
<spring-kafka.version>2.9.2</spring-kafka.version>
<spring-retry.version>1.3.4</spring-retry.version>
<woodstox.version>6.3.1</woodstox.version>
<woodstox.version>6.4.0</woodstox.version>

<maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,20 @@ private Stream<DomainResource> 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;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -88,6 +89,7 @@ public Bundle bundle(Stream<DomainResource> 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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -129,19 +129,18 @@ 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)));

if (subjectODMHashes != null) {
subjectODMHashes.put(subjectData.getSubjectKey(), hash);
}
}
}
}
}
}
Expand Down

0 comments on commit c4106c8

Please sign in to comment.