Skip to content

Commit 04d4b62

Browse files
committed
Set default to no params
1 parent c234322 commit 04d4b62

File tree

5 files changed

+22
-42
lines changed

5 files changed

+22
-42
lines changed

README.md

-15.5 KB

Prerequisites

TORCH interacts with the following components directly:

  • a CQL ready FHIR Server like Blaze **OR ** FLARE
  • A FHIR Server / FHIR Search API
  • Reverse Proxy (NGINX)

The reverse proxy allows for integration into a site's multi-server infrastructure and provides a means of serving the extracted data.

Environment Variables

Name Default Description
SERVER_PORT 8080 The Port of the server to use
TORCH_PROFILE_DIR structureDefinitions The directory for profile definitions.
TORCH_MAPPING_CONSENT mappings/consent-mappings_fhir.json The file for consent mappings in FHIR format.
TORCH_MAPPING_TYPE_TO_CONSENT mappings/type_to_consent.json The file mapping Resource Types to time fields against which the consent is checked
TORCH_FHIR_USER "" The FHIR server user.
TORCH_FHIR_PASSWORD "" The FHIR server password.
TORCH_FHIR_OAUTH_ISSUER_URI "" The URI for the OAuth issuer.
TORCH_FHIR_OAUTH_CLIENT_ID "" The client ID for OAuth.
TORCH_FHIR_OAUTH_CLIENT_SECRET "" The client secret for OAuth.
TORCH_FHIR_URL http://localhost:8081/fhir The base URL of the FHIR server to use.
TORCH_FHIR_MAX_CONNECTIONS 5 The maximum number of concurrent connections to use - has to be (TORCH_MAXCONCURRENCY + 1)
TORCH_FHIR_PAGE_COUNT 500 The number of pages in a FHIR search response.
TORCH_FHIR_DISABLE_ASYNC false Set to true in order to disable use of Asynchronous Interaction Request Pattern.
TORCH_FLARE_URL http://localhost:8084 The base URL of the FLARE server to use.
TORCH_RESULTS_DIR output/ The directory for storing results.
TORCH_RESULTS_PERSISTENCE PT2160H Time Block for result persistence in ISO 8601
format in hours/minutes/seconds. Default 90 days
TORCH_BATCHSIZE 500 The batch size used for processing data.
TORCH_MAXCONCURRENCY 4 The maximum concurrency level for processing.
TORCH_MAPPINGS_FILE ontology/mapping_cql.json The file for ontology mappings using CQL.
TORCH_BUFFERSIZE 100 Size in MB of the webclientbuffer that interacts with the FHIR server
TORCH_CONCEPT_TREE_FILE ontology/mapping_tree.json The file for the concept tree mapping.
TORCH_DSE_MAPPING_TREE_FILE ontology/dse_mapping_tree.json The file for DSE concept tree mapping.
TORCH_USE_CQL true Flag indicating if CQL should be used.
TORCH_BASE_URL http://localhost:8080 The server name before the proxy from which torch is accessed
TORCH_OUTPUT_FILE_SERVER_URL http://localhost:8080/output The URL to access Result location TORCH_RESULTS_DIR served by a proxy/fileserver
LOG_LEVEL info Log level for torch core functionality.
LOG_LEVEL
_CA_UHN_FHIR
error Log level for HAPI FHIR library.
SPRING_PROFILES_ACTIVE active The active Spring profile.
SPRING_CODEC_MAX_IN_MEMORY_SIZE 100MB The maximum in-memory size for Spring codecs.
Name Default Description
SERVER_PORT 8080 The Port of the server to use
TORCH_PROFILE_DIR structureDefinitions The directory for profile definitions.
TORCH_MAPPING_CONSENT mappings/consent-mappings_fhir.json The file for consent mappings in FHIR format.
TORCH_MAPPING_TYPE_TO_CONSENT mappings/type_to_consent.json The file mapping Resource Types to time fields against which the consent is checked
TORCH_FHIR_USER The FHIR server user.
TORCH_FHIR_PASSWORD The FHIR server password.
TORCH_FHIR_OAUTH_ISSUER_URI The URI for the OAuth issuer.
TORCH_FHIR_OAUTH_CLIENT_ID The client ID for OAuth.
TORCH_FHIR_OAUTH_CLIENT_SECRET The client secret for OAuth.
TORCH_FHIR_URL The base URL of the FHIR server to use.
TORCH_FHIR_MAX_CONNECTIONS 5 The maximum number of concurrent connections to use - has to be (TORCH_MAXCONCURRENCY + 1)
TORCH_FHIR_PAGE_COUNT 500 The number of pages in a FHIR search response.
TORCH_FHIR_DISABLE_ASYNC false Set to true in order to disable use of Asynchronous Interaction Request Pattern.
TORCH_FLARE_URL The base URL of the FLARE server to use.
TORCH_RESULTS_DIR output/ The directory for storing results.
TORCH_RESULTS_PERSISTENCE PT2160H Time Block for result persistence in ISO 8601
format in hours/minutes/seconds. Default 90 days
TORCH_BATCHSIZE 500 The batch size used for processing data.
TORCH_MAXCONCURRENCY 4 The maximum concurrency level for processing.
TORCH_MAPPINGS_FILE ontology/mapping_cql.json The file for ontology mappings using CQL.
TORCH_BUFFERSIZE 100 Size in MB of the webclientbuffer that interacts with the FHIR server
TORCH_CONCEPT_TREE_FILE ontology/mapping_tree.json The file for the concept tree mapping.
TORCH_DSE_MAPPING_TREE_FILE ontology/dse_mapping_tree.json The file for DSE concept tree mapping.
TORCH_USE_CQL true Flag indicating if CQL should be used.
TORCH_BASE_URL The server name before the proxy from which torch is accessed
TORCH_OUTPUT_FILE_SERVER_URL The URL to access Result location TORCH_RESULTS_DIR served by a proxy/fileserver
LOG_LEVEL
_DE_MEDIZININFORMATIKINITIATIVE_TORCH
info Log level for torch core functionality.
LOG_LEVEL
_CA_UHN_FHIR
error Log level for HAPI FHIR library.
SPRING_PROFILES_ACTIVE active The active Spring profile.
SPRING_CODEC_MAX_IN_MEMORY_SIZE 100MB The maximum in-memory size for Spring codecs.

TORCH REST API (based on FHIR Bulk Data Request)

Torch implements the FHIR Asynchronous Bulk Data Request Pattern.

$extract-data

The $extract-data endpoint implements the kick-off request in the Async Bulk Pattern. It receives a FHIR parameters resource with a crtdl parameter containing a valueBase64Binary CRTDL. All examples are with a torch configured with http://localhost:8086.

scripts/create-parameters.sh src/test/resources/CRTDL/CRTDL_observation.json | curl -s 'http://localhost:8086/fhir/$extract-data' -H "Content-Type: application/fhir+json" -d @- -v

src/main/java/de/medizininformatikinitiative/torch/config/AppConfig.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,13 @@ public Clock systemDefaultZone() {
391391

392392

393393
@Bean
394-
ExchangeFilterFunction oauthExchangeFilterFunction(
395-
@Value("${torch.fhir.oauth.issuer.uri:}") String issuerUri,
396-
@Value("${torch.fhir.oauth.client.id:}") String clientId,
397-
@Value("${torch.fhir.oauth.client.secret:}") String clientSecret) {
394+
ExchangeFilterFunction oauthExchangeFilterFunction(TorchProperties torchProperties) {
395+
String issuerUri = torchProperties.fhir().oauth().issuer().uri();
396+
String clientId = torchProperties.fhir().oauth().client().id();
397+
String clientSecret = torchProperties.fhir().oauth().client().secret();
398+
398399
if (!issuerUri.isEmpty() && !clientId.isEmpty() && !clientSecret.isEmpty()) {
399-
logger.debug("Enabling OAuth2 authentication (issuer uri: '{}', client id: '{}').",
400+
logger.info("Enabling OAuth2 authentication (issuer uri: '{}', client id: '{}').",
400401
issuerUri, clientId);
401402
var clientRegistration = ClientRegistrations.fromIssuerLocation(issuerUri)
402403
.registrationId(REGISTRATION_ID)
@@ -414,7 +415,7 @@ ExchangeFilterFunction oauthExchangeFilterFunction(
414415

415416
return oAuthExchangeFilterFunction;
416417
} else {
417-
logger.debug("Skipping OAuth2 authentication.");
418+
logger.info("Skipping OAuth2 authentication.");
418419
return (request, next) -> next.exchange(request);
419420
}
420421
}

src/main/resources/application.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ server:
55
torch:
66
base:
77
url:
8-
http://localhost:8080
8+
99
profile:
1010
dir: structureDefinitions
1111
mapping:
1212
consent: mappings/consent-mappings_fhir.json
1313
type_to_consent: mappings/type_to_consent.json
1414
search_parameters_file: search-parameters.json
1515
fhir:
16-
user: ""
17-
password: ""
16+
user:
17+
password:
1818
oauth:
1919
issuer:
20-
uri: ""
20+
uri:
2121
client:
22-
id: ""
23-
secret: ""
22+
id:
23+
secret:
2424

25-
url: http://localhost:8081/fhir
25+
url:
2626
page:
2727
count: 500
2828
max:
2929
connections: 5
3030
disable:
3131
async: false
3232
flare:
33-
url: http://localhost:8084
33+
url:
3434
results:
3535
dir: output/
3636
persistence: PT2160H # Time Block in ISO 8601 format
@@ -54,5 +54,3 @@ logging:
5454
spring:
5555
profiles:
5656
active: active
57-
codec:
58-
max-in-memory-size: 100MB

src/test/java/de/medizininformatikinitiative/torch/util/ReferenceHandlerIT.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33

44
import ca.uhn.fhir.context.FhirContext;
55
import ca.uhn.fhir.parser.IParser;
6-
import de.medizininformatikinitiative.torch.consent.ConsentValidator;
7-
import de.medizininformatikinitiative.torch.management.CompartmentManager;
86
import de.medizininformatikinitiative.torch.model.crtdl.annotated.AnnotatedAttribute;
97
import de.medizininformatikinitiative.torch.model.crtdl.annotated.AnnotatedAttributeGroup;
108
import de.medizininformatikinitiative.torch.model.management.PatientResourceBundle;
119
import de.medizininformatikinitiative.torch.model.management.ReferenceWrapper;
1210
import de.medizininformatikinitiative.torch.model.management.ResourceBundle;
1311
import de.medizininformatikinitiative.torch.model.management.ResourceGroup;
1412
import de.medizininformatikinitiative.torch.model.management.ResourceGroupWrapper;
15-
import de.medizininformatikinitiative.torch.service.DataStore;
1613
import org.hl7.fhir.r4.model.Medication;
1714
import org.hl7.fhir.r4.model.Organization;
1815
import org.hl7.fhir.r4.model.Patient;
@@ -22,7 +19,6 @@
2219
import org.junit.jupiter.api.TestInstance;
2320
import org.springframework.beans.factory.annotation.Autowired;
2421
import org.springframework.boot.test.context.SpringBootTest;
25-
import org.springframework.boot.test.mock.mockito.MockBean;
2622
import org.springframework.test.annotation.DirtiesContext;
2723
import org.springframework.test.context.ActiveProfiles;
2824
import reactor.core.publisher.Flux;
@@ -101,26 +97,15 @@ class ReferenceHandlerIT {
10197
public static final String PAT_REFERENCE = "Patient/VHF00006";
10298
public static final String REFERENCE_MEDICATION = "Medication/testMedication";
10399

104-
@MockBean
105-
private DataStore dataStore;
106-
107100
@Autowired
108101
private ProfileMustHaveChecker profileMustHaveChecker;
109102

110-
@Autowired
111-
private CompartmentManager compartmentManager;
112-
113-
@MockBean
114-
private ConsentValidator consentValidator;
115-
116103

117104
private ReferenceHandler referenceHandler;
118105

119106
private IParser parser;
120107

121108
AnnotatedAttributeGroup patientGroup;
122-
private Organization organization;
123-
private AnnotatedAttribute medicationID;
124109
private AnnotatedAttribute referenceAttribute;
125110
Map<String, AnnotatedAttributeGroup> attributeGroupMap = new HashMap<>();
126111

@@ -134,7 +119,7 @@ void setUp() {
134119
AnnotatedAttribute conditionSubject = new AnnotatedAttribute("Condition.subject", "Condition.subject", "Condition.subject", true, List.of("Patient1"));
135120
AnnotatedAttributeGroup conditionGroup = new AnnotatedAttributeGroup("Condition1", "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/StructureDefinition/Diagnose", List.of(conditionSubject), List.of(), null);
136121

137-
medicationID = new AnnotatedAttribute("Medication.id", "Medication.id", "Medication.id", true, List.of());
122+
AnnotatedAttribute medicationID = new AnnotatedAttribute("Medication.id", "Medication.id", "Medication.id", true, List.of());
138123
AnnotatedAttribute medicationAdherence = new AnnotatedAttribute("Medication.adherence", "Medication.adherence", "Medication.adherence", true, List.of());
139124
AnnotatedAttributeGroup medicationGroup = new AnnotatedAttributeGroup("Medication1", "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/Medication", List.of(medicationID), List.of(), null);
140125
AnnotatedAttributeGroup medicationGroup2 = new AnnotatedAttributeGroup("Medication2", "https://www.medizininformatik-initiative.de/fhir/core/modul-medikation/StructureDefinition/Medication", List.of(medicationID, medicationAdherence), List.of(), null);
@@ -144,7 +129,7 @@ void setUp() {
144129
attributeGroupMap.put("Medication1", medicationGroup);
145130
attributeGroupMap.put("Medication2", medicationGroup2);
146131

147-
organization = new Organization();
132+
Organization organization = new Organization();
148133
organization.setId("evilInc");
149134

150135

src/test/resources/application.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ server:
55
torch:
66
base:
77
url:
8-
http://localhost:8080
98
profile:
109
dir: structureDefinitions
1110
mapping:
1211
consent: mappings/consent-mappings_fhir.json
1312
type_to_consent: mappings/type_to_consent.json
1413
search_parameters_file: search-parameters.json
1514
fhir:
16-
url: http://localhost:8082/fhir
15+
url:
1716
page:
1817
count: 500
1918
max:
@@ -24,12 +23,12 @@ torch:
2423
path: src/test/resources/BlazeBundle.json
2524
oauth:
2625
issuer:
27-
uri: "https://auth.localhost:444/realms/blaze"
26+
uri:
2827
client:
29-
id: "test"
30-
secret: "tast"
28+
id:
29+
secret:
3130
flare:
32-
url: http://localhost:8084
31+
url:
3332
results:
3433
dir: output/
3534
persistence: PT2160H # Time Block in ISO 8601 format
@@ -51,6 +50,3 @@ logging:
5150
ca.uhn.fhir: WARN
5251
org.hl7.fhir: WARN
5352

54-
spring:
55-
codec:
56-
max-in-memory-size: 100MB

0 commit comments

Comments
 (0)