Skip to content

Commit

Permalink
Merge pull request #17 from miracum/16-add-error-handling-for-unmappa…
Browse files Browse the repository at this point in the history
…ble-tumor-body-side

fix: fixes NullPointerException for unmappable body site naming in oB…
  • Loading branch information
MarcelErpi authored Jan 4, 2024
2 parents 830a833 + 819482b commit 9d77cd2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public SideEffectTherapyGradingLookup() {
}

public final String lookupSideEffectTherapyGradingCode(String code) {
return lookup.get(code).get(0);
return lookup.get(code) != null ? lookup.get(code).get(0) : null;
}

public final String lookupSideEffectTherapyGradingDisplay(String code) {
return lookup.get(code).get(1);
return lookup.get(code) != null ? lookup.get(code).get(1) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public SnomedCtSeitenlokalisationLookup() {
}

public final String lookupSnomedCode(String AdtCode) {
return lookup.get(AdtCode).get(0);
return lookup.get(AdtCode) != null ? lookup.get(AdtCode).get(0) : null;
}

public final String lookupSnomedDisplay(String AdtCode) {
return lookup.get(AdtCode).get(1);
return lookup.get(AdtCode) != null ? lookup.get(AdtCode).get(1) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,29 @@ public Bundle mapOnkoResourcesToCondition(
var adtBodySite = primDia.getSeitenlokalisation();

if (adtBodySite != null) {
bodySiteADTCoding
.setSystem(fhirProperties.getSystems().getAdtSeitenlokalisation())
.setCode(adtBodySite)
.setDisplay(
displayAdtSeitenlokalisationLookup.lookupAdtSeitenlokalisationDisplay(adtBodySite));
bodySiteSNOMEDCoding
.setSystem(fhirProperties.getSystems().getSnomed())
.setCode(snomedCtSeitenlokalisationLookup.lookupSnomedCode(adtBodySite))
.setDisplay(snomedCtSeitenlokalisationLookup.lookupSnomedDisplay(adtBodySite));

var adtSeitenlokalisationDisplay =
displayAdtSeitenlokalisationLookup.lookupAdtSeitenlokalisationDisplay(adtBodySite);
var snomedCtSeitenlokalisationCode =
snomedCtSeitenlokalisationLookup.lookupSnomedCode(adtBodySite);
var snomedCtSeitenlokalisationDisplay =
snomedCtSeitenlokalisationLookup.lookupSnomedDisplay(adtBodySite);

if (adtSeitenlokalisationDisplay != null) {
bodySiteADTCoding
.setSystem(fhirProperties.getSystems().getAdtSeitenlokalisation())
.setCode(adtBodySite)
.setDisplay(adtSeitenlokalisationDisplay);
} else {
LOG.warn("Unmappable body site in oBDS data: " + adtBodySite);
}
if (adtSeitenlokalisationDisplay != null) {
bodySiteSNOMEDCoding
.setSystem(fhirProperties.getSystems().getSnomed())
.setCode(snomedCtSeitenlokalisationCode)
.setDisplay(snomedCtSeitenlokalisationDisplay);
} else {
LOG.warn("Unmappable body site in oBDS data: " + adtBodySite);
}
var bodySiteConcept = new CodeableConcept();
bodySiteConcept.addCoding(bodySiteADTCoding).addCoding(bodySiteSNOMEDCoding);
onkoCondition.addBodySite(bodySiteConcept);
Expand Down

0 comments on commit 9d77cd2

Please sign in to comment.