Skip to content

Commit

Permalink
:bugs: fix: Fix the FHIR version handling during configuration to ext…
Browse files Browse the repository at this point in the history
…end it apart from R4 and R5. Now we assume the standard zip file, CapabilityStatement and index configuration file names have the version suffix at the end e.g. definitions-r6.zip
  • Loading branch information
Tuncay Namli committed Nov 7, 2024
1 parent f741ecf commit c8e486f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ abstract class BaseFhirServerConfigurator extends BaseFhirConfigurator with IFhi
val dbIndexFileDefaultPath = fhirVersion match {
case "R4" => DEFAULT_RESOURCE_PATHS.INDEX_CONF_PATH_R4
case "R5" => DEFAULT_RESOURCE_PATHS.INDEX_CONF_PATH_R5
case _ => throw new IllegalArgumentException(s"Unknown FHIR version: $fhirVersion")
case oth =>
FHIRUtil.mergeFilePath(DEFAULT_ROOT_FOLDER,s"db-index-conf-${oth.toLowerCase}.json")
}
//Parse Index configurations, and set configured shard keys
indexConfigurations = IndexConfigurator.parseIndexConfigurationFile(OnfhirConfig.dbIndexConfigurationPath, dbIndexFileDefaultPath, fhirConfig.compartmentRelations)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.onfhir.config

import io.onfhir.api.FHIR_FOUNDATION_RESOURCES.FHIR_CONFORMANCE
import io.onfhir.api.util.IOUtil
import io.onfhir.api.{DEFAULT_RESOURCE_PATHS, FHIR_FOUNDATION_RESOURCES, Resource}
import io.onfhir.api.util.{FHIRUtil, IOUtil}
import io.onfhir.api.{DEFAULT_RESOURCE_PATHS, DEFAULT_ROOT_FOLDER, FHIR_FOUNDATION_RESOURCES, FOUNDATION_RESOURCES_FILE_SUFFIX, Resource}

/**
* FHIR configuration reader from file system
Expand Down Expand Up @@ -39,9 +39,9 @@ class FSConfigReader(
*/
override def readStandardBundleFile(fileName: String, resourceTypeFilter: Set[String]): Seq[Resource] = {
val baseDefinitionsFile = fhirVersion match {
case "R4" => DEFAULT_RESOURCE_PATHS.BASE_DEFINITONS_R4
case "R5" => DEFAULT_RESOURCE_PATHS.BASE_DEFINITONS_R5
case _ => throw new IllegalArgumentException(s"Unknown FHIR version: $fhirVersion")
case "R4" | "4.0.1" => DEFAULT_RESOURCE_PATHS.BASE_DEFINITONS_R4
case "R5" | "5.0.0" => DEFAULT_RESOURCE_PATHS.BASE_DEFINITONS_R5
case oth => FHIRUtil.mergeFilePath(DEFAULT_ROOT_FOLDER, s"definitions-${oth.toLowerCase}${FOUNDATION_RESOURCES_FILE_SUFFIX}.zip")
}
IOUtil
.readStandardBundleFile(
Expand Down Expand Up @@ -79,9 +79,9 @@ class FSConfigReader(

override def readCapabilityStatement(): Resource = {
val conformanceFileDefaultPath = fhirVersion match {
case "R4" => DEFAULT_RESOURCE_PATHS.CONFORMANCE_PATH_R4
case "R5" => DEFAULT_RESOURCE_PATHS.CONFORMANCE_PATH_R5
case _ => throw new IllegalArgumentException(s"Unknown FHIR version: $fhirVersion")
case "R4" | "4.0.1" => DEFAULT_RESOURCE_PATHS.CONFORMANCE_PATH_R4
case "R5" | "5.0.0" => DEFAULT_RESOURCE_PATHS.CONFORMANCE_PATH_R5
case oth => FHIRUtil.mergeFilePath(DEFAULT_ROOT_FOLDER, s"conformance-statement-${oth.toLowerCase()}$FOUNDATION_RESOURCES_FILE_SUFFIX")
}
IOUtil.readResource(conformancePath, conformanceFileDefaultPath, FHIR_CONFORMANCE)
}
Expand Down

0 comments on commit c8e486f

Please sign in to comment.