diff --git a/onfhir-common/src/main/scala/io/onfhir/api/util/IOUtil.scala b/onfhir-common/src/main/scala/io/onfhir/api/util/IOUtil.scala index 88b0c930..718ce6c6 100644 --- a/onfhir-common/src/main/scala/io/onfhir/api/util/IOUtil.scala +++ b/onfhir-common/src/main/scala/io/onfhir/api/util/IOUtil.scala @@ -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 * diff --git a/onfhir-path/src/main/scala/io/onfhir/path/FhirPathUtilFunctions.scala b/onfhir-path/src/main/scala/io/onfhir/path/FhirPathUtilFunctions.scala index f7a19c45..d3fec24c 100644 --- a/onfhir-path/src/main/scala/io/onfhir/path/FhirPathUtilFunctions.scala +++ b/onfhir-path/src/main/scala/io/onfhir/path/FhirPathUtilFunctions.scala @@ -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 _@return_ \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