Skip to content

Commit

Permalink
Fix IntelliJ IDEA warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Leong Hui Wong committed Feb 25, 2019
1 parent 3eb0324 commit 51c3020
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/main/groovy/RxTermsToFHIR.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Closure readRxNormConceptsFile = {
}
}
}

return true
}

cpcRxnConso.close()
Expand Down Expand Up @@ -221,6 +221,7 @@ Closure readRxNormRelationshipsFile = {
break
}
}
return true
}

cpcRxnRel.close()
Expand Down Expand Up @@ -270,6 +271,7 @@ Closure readRxNormAttributesFile = {
break
}
}
return true
}

cpcRxnSat.close()
Expand Down Expand Up @@ -372,21 +374,21 @@ Closure<Ratio> getAmount = { Map<String, String> scdcAttributes ->
return amount
}

Closure<List<BackboneElement>> getIngredientComponent = { String scdc_rxCui, boolean forMedicationKnowledge ->
Closure<Collection<BackboneElement>> getIngredientComponent = { String scdc_rxCui, boolean forMedicationKnowledge ->
Set<String> ing_rxCuis = hasIngredient.get(scdc_rxCui)

return ing_rxCuis.collect { ing_rxCui ->
return ing_rxCuis.findResults { ing_rxCui ->

CodeableConcept ingredient = ingredients.get(ing_rxCui)

BackboneElement component = null

if (ingredient) {

String substanceId = "rxNorm-$ing_rxCui" // use rxNorm-<rxCui> as resource ID

Substance substance = substances.get(substanceId)

BackboneElement component

if (forMedicationKnowledge) {
component = new MedicationKnowledge.MedicationKnowledgeIngredientComponent()

Expand All @@ -411,22 +413,22 @@ Closure<List<BackboneElement>> getIngredientComponent = { String scdc_rxCui, boo

component.setIsActive(true)
}

return component
}

return component
}
}

Closure setIngredientComponent = { String rxCui, Medication med, MedicationKnowledge medKnowledge ->
List<MedicationIngredientComponent> medIngredientComponents = getIngredientComponent(rxCui, false)
List<MedicationIngredientComponent> medIngredientComponents =
getIngredientComponent(rxCui, false) as List<MedicationIngredientComponent>

medIngredientComponents.each {
med.addIngredient(it)
}

List<MedicationKnowledge.MedicationKnowledgeIngredientComponent> medKnowledgeIngredientComponents =
getIngredientComponent(rxCui, true)
getIngredientComponent(rxCui, true) as List<MedicationKnowledge.MedicationKnowledgeIngredientComponent>

medKnowledgeIngredientComponents.each {
medKnowledge.addIngredient(it)
Expand Down

0 comments on commit 51c3020

Please sign in to comment.