Skip to content

Commit

Permalink
✨ feat(ExpandOperationHandler): Added support for includeDesignations…
Browse files Browse the repository at this point in the history
… parameter in ValueSet expand operation
  • Loading branch information
msfyuksel committed Oct 21, 2024
1 parent 9fe3311 commit d3b6dbd
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ExpandOperationHandler(fhirConfigurationManager:IFhirConfigurationManager)
final val SEARCHPARAM_URL: String = "url"
final val EXPAND_PARAM_FILTER: String = "filter"
final val EXPAND_PARAM_LANGUAGE: String = "displayLanguage"
final val EXPAND_PARAM_INCLUDE_DESIGNATIONS: String = "includeDesignations"

/**
* Execute the operation and prepare the output parameters for the operation
Expand Down Expand Up @@ -114,6 +115,7 @@ class ExpandOperationHandler(fhirConfigurationManager:IFhirConfigurationManager)

val filterKeys: Seq[String] = operationRequest.extractParamValue[String](EXPAND_PARAM_FILTER).getOrElse("").split(",").toIndexedSeq
val language: Option[String] = operationRequest.extractParamValue[String](EXPAND_PARAM_LANGUAGE)
val includeDesignations: Boolean = operationRequest.extractParamValue[Boolean](EXPAND_PARAM_INCLUDE_DESIGNATIONS).getOrElse(false)

// 1) First, filter all the matching concepts
val matchingList:Seq[JObject] = compose \ "include" match {
Expand All @@ -128,6 +130,7 @@ class ExpandOperationHandler(fhirConfigurationManager:IFhirConfigurationManager)
(filteredConcept.get \ "code").extractOpt[String].foreach(c => {matching = matching ~ ("code" -> c)})
(filteredConcept.get \ "display").extractOpt[String].foreach(d => {matching = matching ~ ("display" -> d)})
(filteredConcept.get \ "extension").extractOpt[JArray].foreach(arr => {matching = matching ~ ("extension" -> arr)})
if(includeDesignations) {(filteredConcept.get \ "designation").extractOpt[JArray].foreach(arr => {matching = matching ~ ("designation" -> arr)})}
Some(matching)
} else None
})
Expand Down

0 comments on commit d3b6dbd

Please sign in to comment.