Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/srdc/onfhir
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuncay Namli committed Aug 27, 2024
2 parents 38c7f6f + 6eaeaf4 commit ecc6272
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
14 changes: 14 additions & 0 deletions onfhir-common/src/main/scala/io/onfhir/api/util/IOUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@ object IOUtil {
}
}

/**
* Given a filename, removes its extension if an extension exists (e.g., admissions.json -> admissions)
* @param fileName
* @return
*/
def removeFileExtension(fileName: String): String = {
val lastDotIndex = fileName.lastIndexOf('.')
if (lastDotIndex != -1) {
fileName.substring(0, lastDotIndex)
} else {
fileName // No extension found, return the original file name
}
}

/**
* Read and parse FHIR Bundle file
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ case class ConstraintFailure(errorOrWarningMessage: String, isWarning: Boolean =
* @param baseUrl Base profile that this extends if exist
* @param resourceType Resource type for the StructureDefinition
* @param resourceName Given name of the StructureDefinition resource
* @param resourceDescription Description of the StructureDefinition resource
* @param elementRestrictions Defined restrictions on elements with path as key e.g. component.value[x] -> ...
* @param summaryElements Paths of the elements that are defined as summary element
* @param constraints Root constraints defined for the content
Expand All @@ -43,6 +44,7 @@ case class ProfileRestrictions(url: String,
baseUrl: Option[String],
resourceType: String,
resourceName: Option[String],
resourceDescription: Option[String],
elementRestrictions: Seq[(String, ElementRestrictions)],
summaryElements: Set[String],
constraints: Option[FhirRestriction] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,7 @@ class FhirPathUtilFunctions(context: FhirPathEnvironment, current: Seq[FhirPathR
* @return
*/
@FhirPathFunction(documentation = "\uD83D\uDCDC Checks if the given value is a FHIR Quantity expression e.g. 5.2, >7.1, etc. Returns true if given value is numeric, or given value evaluates to string but can be converted to numeric, or given value is string starting with comparators and the remaining string can be converted to numeric; otherwise returns false. If current value returns multiple values, throws exception.\n\n\uD83D\uDD19 <span style=\"color:#ff0000;\">_@return_</span> \n```\ntrue or false\n``` \n\uD83D\uDCA1 **E.g.** 5.utl:isFhirQuantityExpression()",
insertText = "utl:isFhirQuantityExpression()", detail = "utl", label = "utl:isFhirQuantityExpression", kind = "Method", returnType = Seq("boolean")
, inputType = Seq("dateTime", "number", "string"))
insertText = "utl:isFhirQuantityExpression()", detail = "utl", label = "utl:isFhirQuantityExpression", kind = "Method", returnType = Seq("boolean"), inputType = Seq("dateTime", "number", "string"))
def isFhirQuantityExpression(): Seq[FhirPathResult] = {
current match {
case Nil => Nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class StructureDefinitionParser(fhirComplexTypes: Set[String], fhirPrimitiveType
baseUrl = None,
resourceType = rtype,
resourceName = FHIRUtil.extractValueOption[String](structureDef, "name"),
resourceDescription = FHIRUtil.extractValueOption[String](structureDef, "description"),
elementRestrictions = Nil,
summaryElements = Set.empty[String],
constraints = None,
Expand Down Expand Up @@ -64,6 +65,7 @@ class StructureDefinitionParser(fhirComplexTypes: Set[String], fhirPrimitiveType
baseUrl = FHIRUtil.extractValueOption[String](structureDef, "baseDefinition"),
resourceType = rtype,
resourceName = FHIRUtil.extractValueOption[String](structureDef, "name"),
resourceDescription = FHIRUtil.extractValueOption[String](structureDef, "description"),
elementRestrictions = elemDefs.map(e => e._1.path -> e._1),
summaryElements = getSummaryElements(elemDefs), //elemDefs.filter(_._2).map(e => e._1.path).toSet,
constraints =
Expand Down

0 comments on commit ecc6272

Please sign in to comment.