Skip to content

Commit

Permalink
Merge branch 'master' into feature-userRequestRetryVersionConflictsIn…
Browse files Browse the repository at this point in the history
…terceptor
  • Loading branch information
XcrigX authored Nov 11, 2024
2 parents 7dd7b11 + 5d84d9f commit 9275345
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 2 deletions.
28 changes: 28 additions & 0 deletions src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class AppProperties {
private Subscription subscription = new Subscription();
private Cors cors = null;
private Partitioning partitioning = null;
private Boolean validate_resource_status_for_package_upload = true;
private Boolean install_transitive_ig_dependencies = true;
private Map<String, PackageInstallationSpec> implementationGuides = null;

Expand Down Expand Up @@ -107,6 +108,8 @@ public class AppProperties {

private boolean userRequestRetryVersionConflictsInterceptorEnabled = false;

private List<Integer> search_prefetch_thresholds = new ArrayList<>();

public List<String> getCustomInterceptorClasses() {
return custom_interceptor_classes;
}
Expand Down Expand Up @@ -588,6 +591,14 @@ public void setInstall_transitive_ig_dependencies(boolean install_transitive_ig_
this.install_transitive_ig_dependencies = install_transitive_ig_dependencies;
}

public Boolean getValidate_resource_status_for_package_upload() {
return validate_resource_status_for_package_upload;
}

public void setValidate_resource_status_for_package_upload(Boolean validate_resource_status_for_package_upload) {
this.validate_resource_status_for_package_upload = validate_resource_status_for_package_upload;
}

public Integer getBundle_batch_pool_size() {
return this.bundle_batch_pool_size;
}
Expand Down Expand Up @@ -645,6 +656,14 @@ public void setLanguage_search_parameter_enabled(Boolean language_search_paramet
this.language_search_parameter_enabled = language_search_parameter_enabled;
}

public List<Integer> getSearch_prefetch_thresholds() {
return this.search_prefetch_thresholds;
}

public void setSearch_prefetch_thresholds(List<Integer> thePrefetchThresholds) {
this.search_prefetch_thresholds = thePrefetchThresholds;
}

public boolean getUpliftedRefchains_enabled() {
return upliftedRefchains_enabled;
}
Expand Down Expand Up @@ -790,6 +809,7 @@ public static class Partitioning {

private Boolean partitioning_include_in_search_hashes = false;
private Boolean allow_references_across_partitions = false;
private Boolean conditional_create_duplicate_identifiers_enabled = false;

public Boolean getPartitioning_include_in_search_hashes() {
return partitioning_include_in_search_hashes;
Expand All @@ -805,6 +825,14 @@ public Boolean getAllow_references_across_partitions() {
public void setAllow_references_across_partitions(Boolean allow_references_across_partitions) {
this.allow_references_across_partitions = allow_references_across_partitions;
}

public Boolean getConditional_create_duplicate_identifiers_enabled() {
return conditional_create_duplicate_identifiers_enabled;
}

public void setConditional_create_duplicate_identifiers_enabled(Boolean conditional_create_duplicate_identifiers_enabled) {
this.conditional_create_duplicate_identifiers_enabled = conditional_create_duplicate_identifiers_enabled;
}
}

public static class Subscription {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled());
jpaStorageSettings.setLanguageSearchParameterEnabled(appProperties.getLanguage_search_parameter_enabled());
jpaStorageSettings.setValidateResourceStatusForPackageUpload(appProperties.getValidate_resource_status_for_package_upload());
jpaStorageSettings.setIndexOnUpliftedRefchains(appProperties.getUpliftedRefchains_enabled());

if (!appProperties.getSearch_prefetch_thresholds().isEmpty()) {
jpaStorageSettings.setSearchPreFetchThresholds(appProperties.getSearch_prefetch_thresholds());
}

Integer maxFetchSize = appProperties.getMax_page_size();
jpaStorageSettings.setFetchSizeDefaultMaximum(maxFetchSize);
Expand Down Expand Up @@ -243,6 +247,8 @@ public PartitionSettings partitionSettings(AppProperties appProperties) {
} else {
retVal.setAllowReferencesAcrossPartitions(CrossPartitionReferenceMode.NOT_ALLOWED);
}
retVal.setConditionalCreateDuplicateIdentifiersEnabled(
appProperties.getPartitioning().getConditional_create_duplicate_identifiers_enabled());
}

return retVal;
Expand Down
16 changes: 15 additions & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ hapi:
### enable to set the Server URL
# server_address: http://hapi.fhir.org/baseR4
# defer_indexing_for_codesystems_of_size: 101
### Flag is true by default. This flag filters resources during package installation, allowing only those resources with a valid status (e.g. active) to be installed.
# validate_resource_status_for_package_upload: false
# install_transitive_ig_dependencies: true
#implementationguides:
### example from registry (packages.fhir.org)
Expand Down Expand Up @@ -228,6 +230,7 @@ hapi:
# partitioning:
# allow_references_across_partitions: false
# partitioning_include_in_search_hashes: false
# conditional_create_duplicate_identifiers_enabled: false
cors:
allow_Credentials: true
# These are allowed_origin patterns, see: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/cors/CorsConfiguration.html#setAllowedOriginPatterns-java.util.List-
Expand All @@ -238,7 +241,18 @@ hapi:
search-coord-core-pool-size: 20
search-coord-max-pool-size: 100
search-coord-queue-capacity: 200


# Search Prefetch Thresholds.

# This setting sets the number of search results to prefetch. For example, if this list
# is set to [100, 1000, -1] then the server will initially load 100 results and not
# attempt to load more. If the user requests subsequent page(s) of results and goes
# past 100 results, the system will load the next 900 (up to the following threshold of 1000).
# The system will progressively work through these thresholds.
# A threshold of -1 means to load all results. Note that if the final threshold is a
# number other than -1, the system will never prefetch more than the given number.
search_prefetch_thresholds: 13,503,2003,-1

# comma-separated package names, will be @ComponentScan'ed by Spring to allow for creating custom Spring beans
#custom-bean-packages:

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/cds.application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ hapi:
### enable to set the Server URL
# server_address: http://hapi.fhir.org/baseR4
# defer_indexing_for_codesystems_of_size: 101
### Flag is true by default. This flag filters resources during package installation, allowing only those resources with a valid status (e.g. active) to be installed.
# validate_resource_status_for_package_upload: false
# install_transitive_ig_dependencies: true
#implementationguides:
### example from registry (packages.fhir.org)
Expand Down Expand Up @@ -225,6 +227,7 @@ hapi:
# partitioning:
# allow_references_across_partitions: false
# partitioning_include_in_search_hashes: false
# conditional_create_duplicate_identifiers_enabled: false
cors:
allow_Credentials: true
# These are allowed_origin patterns, see: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/cors/CorsConfiguration.html#setAllowedOriginPatterns-java.util.List-
Expand Down
9 changes: 8 additions & 1 deletion src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ void beforeEach() {

private Boolean hasCdsServices() throws IOException {
var response = callCdsServicesDiscovery();
return response.getEntity().getContentLength() > 21 || response.getEntity().isChunked();

// NOTE: this is looking for a repsonse that indicates there are CDS services availalble.
// And empty response looks like: {"services": []}
// Looking at the actual response string consumes the InputStream which has side-effects, making it tricky to compare the actual contents.
// Hence the test just looks at the length to make this determination.
// The actual response has newlines in it which vary in size on some systems, but a value of 25 seems to work across linux/mac/windows
// to ensure the repsonse actually contains CDS services in it
return response.getEntity().getContentLength() > 25 || response.getEntity().isChunked();
}

private CloseableHttpResponse callCdsServicesDiscovery() {
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ hapi:
### enable to set the Server URL
# server_address: http://hapi.fhir.org/baseR4
# defer_indexing_for_codesystems_of_size: 101
### Flag is true by default. This flag filters resources during package installation, allowing only those resources with a valid status (e.g. active) to be installed.
# validate_resource_status_for_package_upload: false
# install_transitive_ig_dependencies: true
# implementationguides:
### example from registry (packages.fhir.org)
Expand Down Expand Up @@ -146,6 +148,7 @@ hapi:
# partitioning:
# allow_references_across_partitions: false
# partitioning_include_in_search_hashes: false
# partitioning_include_in_search_hashes
#cors:
# allow_Credentials: true
# These are allowed_origin patterns, see: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/cors/CorsConfiguration.html#setAllowedOriginPatterns-java.util.List-
Expand Down

0 comments on commit 9275345

Please sign in to comment.