Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: extract body site coding #107

Merged
merged 1 commit into from
Sep 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
Loading