Skip to content

Commit

Permalink
🚸 Add an helper method for files to IOUtil.
Browse files Browse the repository at this point in the history
  • Loading branch information
sinaci committed Aug 22, 2024
1 parent 4aa4b26 commit 09bddd5
Show file tree
Hide file tree
Showing 2 changed files with 15 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 @@ -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

0 comments on commit 09bddd5

Please sign in to comment.