Skip to content

Commit

Permalink
Release version 0.1.39
Browse files Browse the repository at this point in the history
- Exception feedback for unconfigured fhir_core_app_id user attribute
- Refactor performance metric logs to show seconds and nano second metrics
- Support case insensitive sync strategy configurations
  • Loading branch information
ndegwamartin committed Sep 8, 2023
1 parent 9d9e377 commit 303bec5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 39 deletions.
2 changes: 1 addition & 1 deletion exec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.google.fhir.gateway</groupId>
<artifactId>fhir-gateway</artifactId>
<version>0.1.38</version>
<version>0.1.39</version>
</parent>

<artifactId>exec</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
implementations do not have to do this; they can redeclare those deps. -->
<groupId>com.google.fhir.gateway</groupId>
<artifactId>fhir-gateway</artifactId>
<version>0.1.38</version>
<version>0.1.39</version>
</parent>

<artifactId>plugins</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,10 @@ public class BenchmarkingHelper {
public static void printCompletedInDuration(long startTime, String methodDetails, Logger logger) {
long nanoSecondsTaken = System.nanoTime() - startTime;
long millSecondsTaken = nanoSecondsTaken / 1000000;
logger.error(
logger.info(
String.format(
"########## %s completed in %s : Metric in seconds - %d : Metric in nanoseconds - %d",
methodDetails,
getHumanDuration(millSecondsTaken),
millSecondsTaken / 1000,
nanoSecondsTaken));
}

public static String getHumanDuration(long milliseconds) {

long minutes = (milliseconds / 1000) / 60;
long seconds = (milliseconds / 1000) % 60;
String secondsStr = Long.toString(seconds);
String secs;
if (secondsStr.length() >= 2) {
secs = secondsStr.substring(0, 2);
} else {
secs = "0" + secondsStr;
}

return minutes == 0 && seconds == 0
? "less than a second"
: minutes + " mins " + secs + " secs";
"########## %s : Metric in seconds - %d : Metric in nanoseconds - %d",
methodDetails, millSecondsTaken / 1000, nanoSecondsTaken));
}

public static long startBenchmarking() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public AccessChecker create(
List<String> organizationIds = new ArrayList<>();
List<String> locationIds = new ArrayList<>();
if (StringUtils.isNotBlank(syncStrategy)) {
if (syncStrategy.equals(Constants.CARE_TEAM)) {
if (Constants.CARE_TEAM.equalsIgnoreCase(syncStrategy)) {
careTeams =
practitionerDetails != null
&& practitionerDetails.getFhirPractitionerDetails() != null
Expand All @@ -371,7 +371,7 @@ public AccessChecker create(
careTeamIds.add(careTeam.getIdElement().getIdPart());
}
}
} else if (syncStrategy.equals(Constants.ORGANIZATION)) {
} else if (Constants.ORGANIZATION.equalsIgnoreCase(syncStrategy)) {
organizations =
practitionerDetails != null
&& practitionerDetails.getFhirPractitionerDetails() != null
Expand All @@ -382,17 +382,20 @@ public AccessChecker create(
organizationIds.add(organization.getIdElement().getIdPart());
}
}
} else if (syncStrategy.equals(Constants.LOCATION)) {
} else if (Constants.LOCATION.equalsIgnoreCase(syncStrategy)) {
locationIds =
practitionerDetails != null
&& practitionerDetails.getFhirPractitionerDetails() != null
? OpenSRPHelper.getAttributedLocations(
practitionerDetails.getFhirPractitionerDetails().getLocationHierarchyList())
: locationIds;
}
}
} else
throw new IllegalStateException(
"Sync strategy not configured. Please confirm Keycloak fhir_core_app_id attribute for"
+ " the user matches the Composition.json config official identifier value");

BenchmarkingHelper.printCompletedInDuration(start, "create ", logger);
BenchmarkingHelper.printCompletedInDuration(start, "create", logger);

return new PermissionAccessChecker(
fhirContext,
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<groupId>com.google.fhir.gateway</groupId>
<artifactId>fhir-gateway</artifactId>
<version>0.1.38</version>
<version>0.1.39</version>
<packaging>pom</packaging>

<name>FHIR Information Gateway</name>
Expand Down
9 changes: 1 addition & 8 deletions server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.google.fhir.gateway</groupId>
<artifactId>fhir-gateway</artifactId>
<version>0.1.38</version>
<version>0.1.39</version>
</parent>

<artifactId>server</artifactId>
Expand Down Expand Up @@ -78,13 +78,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>

<!-- For GCP APIs -->
<dependency>
<groupId>com.google.http-client</groupId>
Expand Down

0 comments on commit 303bec5

Please sign in to comment.