Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit 4a8a3d5

Browse files
committed
Merge remote-tracking branch 'origin/issues/29_chained_parameters' into
develop
2 parents 9ebbc20 + 300a4c3 commit 4a8a3d5

3 files changed

Lines changed: 30 additions & 14 deletions

File tree

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/HapiFhirClientFactory.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class HapiFhirClientFactory
5353
private final String bearerToken;
5454

5555
private final boolean hapiClientVerbose;
56+
private final boolean useChainedParameterNotLogicalReference;
5657

5758
private final ApacheRestfulClientFactory clientFactory;
5859

@@ -73,10 +74,14 @@ public class HapiFhirClientFactory
7374
* >= -1, -1: system default, 0: infinity, >0: timeout in ms
7475
* @param connectionRequestTimeout
7576
* >= -1, -1: system default, 0: infinity, >0: timeout in ms
77+
* @param hapiClientVerbose
78+
* <code>true</code> for verbose logging
79+
* @param useChainedParameterNotLogicalReference
80+
* <code>true</code> to enable modifying the search parameters during data storage
7681
*/
7782
public HapiFhirClientFactory(FhirContext fhirContext, String serverBase, String basicAuthUsername,
7883
String basicAuthPassword, String bearerToken, int connectTimeout, int socketTimeout,
79-
int connectionRequestTimeout, boolean hapiClientVerbose)
84+
int connectionRequestTimeout, boolean hapiClientVerbose, boolean useChainedParameterNotLogicalReference)
8085
{
8186
if (fhirContext != null)
8287
this.fhirContext = fhirContext;
@@ -89,6 +94,7 @@ public HapiFhirClientFactory(FhirContext fhirContext, String serverBase, String
8994
this.bearerToken = bearerToken;
9095

9196
this.hapiClientVerbose = hapiClientVerbose;
97+
this.useChainedParameterNotLogicalReference = useChainedParameterNotLogicalReference;
9298

9399
if (isConfigured())
94100
{
@@ -504,4 +510,9 @@ private void configureLoggingInterceptor(IGenericClient client)
504510
client.registerInterceptor(loggingInterceptor);
505511
}
506512
}
513+
514+
public boolean shouldUseChainedParameterNotLogicalReference()
515+
{
516+
return useChainedParameterNotLogicalReference;
517+
}
507518
}

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/fhir/FhirBridgeClient.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public class FhirBridgeClient extends AbstractComplexFhirClient
3030
private static final Logger logger = LoggerFactory.getLogger(FhirBridgeClient.class);
3131
private static final OutcomeLogger outcomeLogger = new OutcomeLogger(logger);
3232

33-
public static final String RFC_4122_SYSTEM = "urn:ietf:rfc:4122";
34-
3533
/**
3634
* @param fhirContext
3735
* not <code>null</code>
@@ -209,32 +207,35 @@ private void createOrUpdateEntry(int index, BundleEntryComponent entry, Patient
209207

210208
private Optional<Resource> findResourceInLocalFhirStore(String url, Class<? extends Resource> resourceType)
211209
{
210+
if (clientFactory.shouldUseChainedParameterNotLogicalReference())
211+
url = url.replace("patient:identifier", "patient.identifier");
212+
212213
try
213214
{
214-
Bundle patientBundle = clientFactory.getFhirStoreClient().search().byUrl(url).sort()
215+
Bundle resultBundle = clientFactory.getFhirStoreClient().search().byUrl(url).sort()
215216
.descending("_lastUpdated").count(1).returnBundle(Bundle.class).execute();
216217

217218
if (logger.isDebugEnabled())
218219
logger.debug("{} search-bundle result: {}", resourceType.getAnnotation(ResourceDef.class).name(),
219-
fhirContext.newJsonParser().encodeResourceToString(patientBundle));
220+
fhirContext.newJsonParser().encodeResourceToString(resultBundle));
220221

221-
if (patientBundle.getTotal() > 0)
222+
if (resultBundle.getTotal() > 0)
222223
{
223-
if (patientBundle.getTotal() > 1)
224+
if (resultBundle.getTotal() > 1)
224225
logger.warn("FHIR store has more than one Resource with url {}, using last updated", url);
225226

226-
if (patientBundle.getEntryFirstRep().hasResource()
227-
&& resourceType.isInstance(patientBundle.getEntryFirstRep().getResource()))
228-
return Optional.of((Patient) patientBundle.getEntryFirstRep().getResource());
227+
if (resultBundle.getEntryFirstRep().hasResource()
228+
&& resourceType.isInstance(resultBundle.getEntryFirstRep().getResource()))
229+
return Optional.of(resultBundle.getEntryFirstRep().getResource());
229230
else
230231
{
231232
logger.warn("Error while search for Resource with url {}, bundle has no {} resource", url,
232233
resourceType.getAnnotation(ResourceDef.class).name());
233234

234-
if (patientBundle.getEntryFirstRep().getResponse().hasOutcome()
235-
&& patientBundle.getEntryFirstRep().getResponse().getOutcome() instanceof OperationOutcome)
235+
if (resultBundle.getEntryFirstRep().getResponse().hasOutcome()
236+
&& resultBundle.getEntryFirstRep().getResponse().getOutcome() instanceof OperationOutcome)
236237
outcomeLogger.logOutcome(
237-
(OperationOutcome) patientBundle.getEntryFirstRep().getResponse().getOutcome());
238+
(OperationOutcome) resultBundle.getEntryFirstRep().getResponse().getOutcome());
238239

239240
return Optional.empty();
240241
}

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/spring/config/TransferDataConfig.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ public class TransferDataConfig
9393
@Value("${de.netzwerk_universitaetsmedizin.codex.fhir.client:de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.client.fhir.FhirBridgeClient}")
9494
private String fhirStoreClientClass;
9595

96+
@Value("${de.netzwerk_universitaetsmedizin.codex.fhir.useChainedParameterNotLogicalReference:true}")
97+
private boolean fhirStoreUseChainedParameterNotLogicalReference;
98+
9699
@Value("${de.netzwerk_universitaetsmedizin.codex.fhir.searchBundleOverride:#{null}}")
97100
private String fhirStoreSearchBundleOverride;
98101

@@ -176,7 +179,8 @@ public HapiFhirClientFactory hapiFhirClientFactory()
176179
{
177180
return new HapiFhirClientFactory(fhirContext, fhirStoreBaseUrl, fhirStoreUsername, fhirStorePassword,
178181
fhirStoreBearerToken, fhirStoreConnectTimeout, fhirStoreSocketTimeout,
179-
fhirStoreConnectionRequestTimeout, fhirStoreHapiClientVerbose);
182+
fhirStoreConnectionRequestTimeout, fhirStoreHapiClientVerbose,
183+
fhirStoreUseChainedParameterNotLogicalReference);
180184
}
181185

182186
@Bean

0 commit comments

Comments
 (0)