Skip to content

Commit

Permalink
refactor: extract body site coding (#107)
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
pcvolkmer authored Sep 15, 2024
1 parent 819e0e5 commit abba11e
Showing 1 changed file with 35 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,39 +120,9 @@ public Bundle mapOnkoResourcesToCondition(
var conditionCode = new CodeableConcept().addCoding(coding);
onkoCondition.setCode(conditionCode);

var bodySiteADTCoding = new Coding();
var bodySiteSNOMEDCoding = new Coding();

var adtBodySite = primDia.getSeitenlokalisation();

if (adtBodySite != null) {
var adtSeitenlokalisationDisplay =
DisplayAdtSeitenlokalisationLookup.lookupDisplay(adtBodySite);
var snomedCtSeitenlokalisationCode = SnomedCtSeitenlokalisationLookup.lookupCode(adtBodySite);
var snomedCtSeitenlokalisationDisplay =
SnomedCtSeitenlokalisationLookup.lookupDisplay(adtBodySite);

if (adtSeitenlokalisationDisplay != null) {
bodySiteADTCoding
.setSystem(fhirProperties.getSystems().getAdtSeitenlokalisation())
.setCode(adtBodySite)
.setDisplay(adtSeitenlokalisationDisplay);
} else {
LOG.warn("Unmappable body site in oBDS data: {}", adtBodySite);
}

if (snomedCtSeitenlokalisationDisplay != null) {
bodySiteSNOMEDCoding
.setSystem(fhirProperties.getSystems().getSnomed())
.setCode(snomedCtSeitenlokalisationCode)
.setDisplay(snomedCtSeitenlokalisationDisplay);
} else {
LOG.warn("Unmappable snomed body site in oBDS data: {}", adtBodySite);
}

var bodySiteConcept = new CodeableConcept();
bodySiteConcept.addCoding(bodySiteADTCoding).addCoding(bodySiteSNOMEDCoding);
onkoCondition.addBodySite(bodySiteConcept);
onkoCondition.addBodySite(getBodySiteConcept(adtBodySite));
}

onkoCondition.setSubject(
Expand Down Expand Up @@ -229,4 +199,38 @@ public Bundle mapOnkoResourcesToCondition(

return bundle;
}

private CodeableConcept getBodySiteConcept(String adtBodySite) {
var bodySiteADTCoding = new Coding();
var bodySiteSNOMEDCoding = new Coding();

var adtSeitenlokalisationDisplay =
DisplayAdtSeitenlokalisationLookup.lookupDisplay(adtBodySite);
var snomedCtSeitenlokalisationCode = SnomedCtSeitenlokalisationLookup.lookupCode(adtBodySite);
var snomedCtSeitenlokalisationDisplay =
SnomedCtSeitenlokalisationLookup.lookupDisplay(adtBodySite);

if (adtSeitenlokalisationDisplay != null) {
bodySiteADTCoding
.setSystem(fhirProperties.getSystems().getAdtSeitenlokalisation())
.setCode(adtBodySite)
.setDisplay(adtSeitenlokalisationDisplay);
} else {
LOG.warn("Unmappable body site in oBDS data: {}", adtBodySite);
}

if (snomedCtSeitenlokalisationDisplay != null) {
bodySiteSNOMEDCoding
.setSystem(fhirProperties.getSystems().getSnomed())
.setCode(snomedCtSeitenlokalisationCode)
.setDisplay(snomedCtSeitenlokalisationDisplay);
} else {
LOG.warn("Unmappable snomed body site in oBDS data: {}", adtBodySite);
}

var bodySiteConcept = new CodeableConcept();
bodySiteConcept.addCoding(bodySiteADTCoding).addCoding(bodySiteSNOMEDCoding);

return bodySiteConcept;
}
}

0 comments on commit abba11e

Please sign in to comment.