Skip to content

Commit 740865b

Browse files
author
Tuncay Namli
committed
Merge branch 'master' of https://github.com/srdc/onfhir
2 parents be61401 + a79e5f4 commit 740865b

File tree

6 files changed

+47
-23
lines changed

6 files changed

+47
-23
lines changed

docker/docker-entrypoint.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/usr/bin/env bash
22

3-
JAVA_CMD="java -Xms256m -Xmx3g -jar "
3+
# Set default Java options
4+
DEFAULT_JAVA_OPTIONS="-Xms256m -Xmx3g"
5+
6+
# Use environment variable if provided, otherwise use default value
7+
JAVA_OPTIONS="${JAVA_OPTIONS:-$DEFAULT_JAVA_OPTIONS}"
8+
9+
# Construct JAVA_CMD with Java options
10+
JAVA_CMD="java $JAVA_OPTIONS -jar "
411

512
# Configure application.conf path
613
if [ ! -z "$APP_CONF_FILE" ]; then

onfhir-common/src/main/scala/io/onfhir/api/util/IOUtil.scala

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ object IOUtil {
2020

2121
/**
2222
* Read a FHIR resource from given path or default path (within project resources)
23-
* @param resourcePath Given file path
24-
* @param defaultPath Default resource path (within project resources)
25-
* @param rtype Resource type
23+
*
24+
* @param resourcePath Given file path
25+
* @param defaultPath Default resource path (within project resources)
26+
* @param rtype Resource type
2627
* @return
2728
*/
2829
def readResource(resourcePath: Option[String], defaultPath: String, rtype: String): Resource = {
@@ -43,7 +44,8 @@ object IOUtil {
4344

4445
/**
4546
* Read a FHIR resource from given File path
46-
* @param filePath File path
47+
*
48+
* @param filePath File path
4749
* @return
4850
*/
4951
def readResource(filePath: String): Resource = {
@@ -52,7 +54,8 @@ object IOUtil {
5254

5355
/**
5456
* Read a FHIR resource from project resources with a path
55-
* @param resourcePath Resource path
57+
*
58+
* @param resourcePath Resource path
5659
* @return
5760
*/
5861
def readInnerResource(resourcePath: String): Resource = {
@@ -93,7 +96,7 @@ object IOUtil {
9396
if (!givenFile.isDirectory)
9497
throw new InitializationException(s"Given path '$path' is not a folder or zip file ...")
9598
//Given as folder
96-
getFilesFromFolder(folder = givenFile, withExtension = None, recursively = Some(true))
99+
getFilesFromFolder(folder = givenFile, recursively = true, ignoreHidden = true, withExtension = None)
97100
.map(file => {
98101
try {
99102
parseResource(new InputStreamReader(BOMInputStream.builder.setInputStream(new FileInputStream(file)).get()), file.getAbsolutePath)
@@ -120,19 +123,30 @@ object IOUtil {
120123
* Get the list of files from the given folder.
121124
*
122125
* @param folder The folder to retrieve the files from.
126+
* @param recursively If true, the folder will be searched recursively to retrieve all files within.
127+
* @param ignoreHidden If true, hidden files and directories will be excluded from the result.
123128
* @param withExtension An optional extension (e.g., .json) if the files need to be filtered.
124-
* @param recursively If exists and true, the folder will be searched recursively to retrieve all files within.
125-
* @return
129+
* @return A sequence of files matching the criteria.
126130
*/
127-
def getFilesFromFolder(folder: File, withExtension: Option[String], recursively: Option[Boolean]): Seq[File] = {
131+
def getFilesFromFolder(
132+
folder: File,
133+
recursively: Boolean,
134+
ignoreHidden: Boolean,
135+
withExtension: Option[String]
136+
): Seq[File] = {
128137
if (folder.exists && folder.isDirectory) {
129138
val files = folder.listFiles().toSeq // List all available files in the given folder
139+
140+
// Filter hidden files if ignoreHidden is true
141+
val nonHiddenFiles = if (ignoreHidden) files.filterNot(f => f.isHidden || f.getName.startsWith(".")) else files
142+
130143
val filteredFiles = withExtension
131-
.map(ext => files.filter(_.getName.endsWith(ext))).getOrElse(files)
144+
.map(ext => nonHiddenFiles.filter(_.getName.endsWith(ext))).getOrElse(nonHiddenFiles)
132145
.filterNot(_.isDirectory)
133-
if (recursively.contains(true)) {
134-
val subFolders = files.filter(_.isDirectory)
135-
filteredFiles ++ subFolders.flatMap(f => getFilesFromFolder(f, withExtension, recursively))
146+
147+
if (recursively) {
148+
val subFolders = nonHiddenFiles.filter(_.isDirectory)
149+
filteredFiles ++ subFolders.flatMap(f => getFilesFromFolder(f, recursively, ignoreHidden, withExtension))
136150
} else {
137151
filteredFiles
138152
}
@@ -141,8 +155,10 @@ object IOUtil {
141155
}
142156
}
143157

158+
144159
/**
145160
* Given a filename, removes its extension if an extension exists (e.g., admissions.json -> admissions)
161+
*
146162
* @param fileName
147163
* @return
148164
*/
@@ -254,8 +270,9 @@ object IOUtil {
254270

255271
/**
256272
* Parse a JSON resource
257-
* @param reader Reader
258-
* @param path File path it is read from
273+
*
274+
* @param reader Reader
275+
* @param path File path it is read from
259276
* @return
260277
*/
261278
private def parseResource(reader: Reader, path: String): Resource = {

onfhir-config/src/main/scala/io/onfhir/config/BaseFhirConfigurator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ abstract class BaseFhirConfigurator extends IFhirVersionConfigurator {
5454
//Get the parser for parsing FHIR foundation resources
5555
val foundationResourceParser = getFoundationResourceParser(fhirConfig.FHIR_COMPLEX_TYPES, fhirConfig.FHIR_PRIMITIVE_TYPES)
5656

57-
logger.info("Reading FHIR foundation resources to start configuration of onFhir server ...")
57+
logger.info("Reading FHIR foundation resources to start configuration of onFHIR server ...")
5858
//Read the StructureDefinitions for all supported profiles
5959
val profileResources = configReader.getInfrastructureResources(FHIR_STRUCTURE_DEFINITION)
6060
//Read the ValueSet definitions to be used in this server (within the profiles)

onfhir-core/src/main/scala/io/onfhir/Onfhir.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class Onfhir(
136136
logger.info("OnFhir server is gracefully terminated...")
137137
case Failure(exception) => logger.error("Problem while gracefully terminating OnFhir server!", exception)
138138
}
139-
logger.info("OnFhir FHIR server started on host {} and port {}", OnfhirConfig.serverHost, OnfhirConfig.serverPort)
139+
logger.info("onFHIR FHIR server started on host {} and port {}", OnfhirConfig.serverHost, OnfhirConfig.serverPort)
140140
//Wait for a shutdown signal
141141
Await.ready(waitForShutdownSignal(), Duration.Inf)
142142
fhirServerBinding.terminate(FiniteDuration.apply(60L, TimeUnit.SECONDS))

onfhir-path/src/main/scala/io/onfhir/path/FhirPathAggFunctions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class FhirPathAggFunctions(context:FhirPathEnvironment, current:Seq[FhirPathResu
142142
.flatMap(c => {
143143
val result = new FhirPathExpressionEvaluator(context, Seq(c)).visit(expr)
144144
if (result.length > 1)
145-
throw new FhirPathException(s"Invalid function call 'min', the expression ${expr.getText} does not return a single value or Nil!")
145+
throw new FhirPathException(s"Invalid function call 'max', the expression ${expr.getText} does not return a single value or Nil!")
146146
result.headOption
147147
})
148148

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<akka.version>2.8.5</akka.version>
114114
<!--mongodb.scala.version>4.11.1</mongodb.scala.version-->
115115
<mongodb.scala.version>5.1.3</mongodb.scala.version>
116-
<mongo.embedded.version>4.12.0</mongo.embedded.version>
116+
<mongo.embedded.version>4.18.1</mongo.embedded.version>
117117
<json4s.version>3.7.0-M11</json4s.version>
118118
<scala.xml.version>2.2.0</scala.xml.version>
119119
<logback.version>1.4.14</logback.version>
@@ -122,9 +122,9 @@
122122
<specs2.version>4.20.4</specs2.version>
123123
<nimbus-jose.version>9.37.3</nimbus-jose.version>
124124
<nimbus-oidc.version>11.9.1</nimbus-oidc.version>
125-
<apache-commons-lang.version>3.14.0</apache-commons-lang.version>
126-
<apache-commons-io.version>2.15.1</apache-commons-io.version>
127-
<apache-commons-text.version>1.11.0</apache-commons-text.version>
125+
<apache-commons-lang.version>3.17.0</apache-commons-lang.version>
126+
<apache-commons-io.version>2.18.0</apache-commons-io.version>
127+
<apache-commons-text.version>1.13.0</apache-commons-text.version>
128128
<reflections.version>0.10.2</reflections.version>
129129

130130
<!-- release plugin versions -->

0 commit comments

Comments
 (0)