Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.1.0.0 #128

Merged
merged 25 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a8e1ea3
updated version to 1.0.0.1-SNAPSHOT
schwzr Mar 16, 2024
40f5b9b
replaced default SearchBundle to match up required searches for Risk …
schwzr Mar 16, 2024
19c8909
added basic support for Specimen resource
schwzr Mar 16, 2024
cea20b5
disabled tests, needs to be modified to use the tested SearchBundle a…
schwzr Mar 16, 2024
56a883a
allow the usage of local pseudonyms
schwzr Mar 18, 2024
e21f00f
re-enabled tests
schwzr Mar 25, 2024
833765b
add support for Specimen and contained resources
schwzr Mar 25, 2024
b89b225
changed default packages to those required by risk principe
schwzr Mar 25, 2024
812c267
implement fix for invalid xhtml content until https://github.com/medi…
schwzr Mar 25, 2024
e3d0774
add workarounds until fixed kds mikrobiologie packages are released
schwzr Mar 25, 2024
6ca78a4
added fixes for local pseudonyms and ensure compatibility with curren…
schwzr Mar 25, 2024
aafb7ec
added missing valuesets required for KdsMikrobiologieBugFixer
schwzr Mar 25, 2024
63b5def
updated docker image versions
schwzr Mar 25, 2024
eadce42
add bundle with demo data for risk principe
schwzr Mar 25, 2024
725f013
implemented suggestions provided by @hhund
schwzr Mar 25, 2024
7e42a75
javadoc formatting fix
schwzr Mar 25, 2024
3384d0c
javadoc formatting fix to please format check
schwzr Mar 25, 2024
f3bacda
add comment explaining the versioned id issue with hapi client
schwzr Mar 25, 2024
4e5a6ff
improved logging by @hhund
schwzr Mar 25, 2024
bd453a8
Merge pull request #124 from schwzr/risk-principe
hhund Mar 25, 2024
89d4235
removed special forward proxy config for validation, closes #122
hhund Mar 25, 2024
8b7ee77
code formatting
hhund Mar 25, 2024
092537f
removed not needed variables
hhund Mar 25, 2024
7e2e2b5
Merge remote-tracking branch
hhund Mar 25, 2024
7710527
1.1.0.0 release
hhund Mar 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codex-process-data-transfer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>de.netzwerk-universitaetsmedizin.codex</groupId>
<artifactId>codex-processes-ap1</artifactId>
<version>1.0.0.0</version>
<version>1.1.0.0</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public interface ConstantsDataTransfer
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_BAD_PATIENT_REFERENCE = "bad-patient-reference";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_FTTP_NOT_REACHABLE = "fttp-not-reachable";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_NO_DIC_PSEUDONYM_FOR_BLOOMFILTER = "no-dic-pseudonym-for-bloomfilter";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_NO_DIC_PSEUDONYM_FOR_LOCAL_PSEUDONYM = "no-dic-pseudonym-for-local-pseudonym";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_VALIDATION_FAILED = "validation-failed";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_ECRYPTION_OF_DATA_FOR_CRR_FAILED = "ecryption-of-data-for-crr-failed";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_UNABLE_TO_STORE_ECRYPTED_DATA = "unable-to-store-ecrypted-data";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

public class DataTransferProcessPluginDefinition implements ProcessPluginDefinition
{
public static final String VERSION = "1.0.0.0";
public static final LocalDate DATE = LocalDate.of(2023, 10, 11);
public static final String VERSION = "1.1.0.0";
public static final LocalDate DATE = LocalDate.of(2024, 3, 25);

@Override
public String getName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ public void testConnection()
{
logger.info(
"Testing connection to Data Store FHIR server with {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {},"
+ " basicAuthUsername {}, basicAuthPassword {}, bearerToken {}, serverBase: {}, proxyUrl {}, proxyUsername, proxyPassword {}}",
+ " basicAuthUsername: {}, basicAuthPassword: {}, bearerToken: {}, serverBase: {}, proxy: values from 'DEV_DSF_PROXY'... config}",
trustStorePath, certificatePath, privateKeyPath, privateKeyPassword != null ? "***" : "null",
dataStoreServerBasicAuthUsername, dataStoreServerBasicAuthPassword != null ? "***" : "null",
dataStoreServerBearerToken != null ? "***" : "null", dataStoreServerBase, proxyUrl, proxyUsername,
proxyPassword != null ? "***" : "null");
dataStoreServerBearerToken != null ? "***" : "null", dataStoreServerBase);

getDataStoreClient().testConnection();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ private void configureProxy(IRestfulClientFactory clientFactory, String proxyUrl
clientFactory.setProxy(url.getHost(), url.getPort());
clientFactory.setProxyCredentials(proxyUsername, proxyPassword);

logger.info("Using proxy for data FHIR server connection with {host: {}, port: {}, username: {}}",
url.getHost(), url.getPort(), proxyUsername);
logger.info("Using proxy for data FHIR server connection with values from 'DEV_DSF_PROXY'... config");
}
catch (MalformedURLException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ public interface FttpClient
*/
Optional<String> getDicPseudonym(String bloomFilter);

Optional<String> getDicPseudonymForLocalPseudonym(String localPseudonym);

void testConnection();
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ public Optional<String> getDicPseudonym(String bloomFilter)
return pseudonym;
}

@Override
public Optional<String> getDicPseudonymForLocalPseudonym(String localPseudonym)
{
Optional<String> pseudonym = sha256(localPseudonym).map(p -> "dic_test/" + p);

logger.warn(
"Returning simulated DIC pseudonym '{}' for local pseudonym '{}', fTTP connection not configured.",
pseudonym.orElseThrow(), localPseudonym);

return pseudonym;
}

private Optional<String> sha256(String original)
{
try
Expand Down Expand Up @@ -142,11 +154,10 @@ public void testConnection()
{
logger.info(
"Testing connection to fTTP with {trustStorePath: {}, certificatePath: {}, privateKeyPath: {}, privateKeyPassword: {},"
+ " basicAuthUsername {}, basicAuthPassword {}, serverBase: {}, apiKey: {}, study: {}, target: {}, proxyUrl {}, proxyUsername, proxyPassword {}}",
+ " basicAuthUsername: {}, basicAuthPassword: {}, serverBase: {}, apiKey: {}, study: {}, target: {}, proxy: values from 'DEV_DSF_PROXY'... config}",
trustStorePath, certificatePath, privateKeyPath, privateKeyPassword != null ? "***" : "null",
fttpBasicAuthUsername, fttpBasicAuthPassword != null ? "***" : "null", fttpServerBase,
fttpApiKey != null ? "***" : "null", fttpStudy, fttpTarget, proxyUrl, proxyUsername,
proxyPassword != null ? "***" : "null");
fttpApiKey != null ? "***" : "null", fttpStudy, fttpTarget);

getFttpClient().testConnection();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ private void configureProxy(IRestfulClientFactory clientFactory, String proxyUrl
clientFactory.setProxy(url.getHost(), url.getPort());
clientFactory.setProxyCredentials(proxyUsername, proxyPassword);

logger.info("Using proxy for fTTP connection with {host: {}, port: {}, username: {}}", url.getHost(),
url.getPort(), proxyUsername);
logger.info("Using proxy for fTTP connection with values from 'DEV_DSF_PROXY'... config");
}
catch (MalformedURLException e)
{
Expand Down Expand Up @@ -154,6 +153,18 @@ protected Parameters createParametersForPsnWorkflow(String dicSourceAndPseudonym
return p;
}

protected Parameters createParametersForPsnWorkflowLocalPseudonym(String localPseudonym)
{
Parameters p = new Parameters();
p.addParameter("study", fttpStudy);
p.addParameter("original", localPseudonym);
p.addParameter("source", "local");
p.addParameter("target", fttpTarget);
p.addParameter("apikey", fttpApiKey);

return p;
}

@Override
public Optional<String> getDicPseudonym(String bloomFilter)
{
Expand All @@ -178,6 +189,30 @@ public Optional<String> getDicPseudonym(String bloomFilter)
}
}

@Override
public Optional<String> getDicPseudonymForLocalPseudonym(String localPseudonym)
{
Objects.requireNonNull(localPseudonym, "localPseudonym");

logger.info("Requesting DIC Pseudonym for local Pseudonym {} ...", localPseudonym);

try
{
IGenericClient client = createGenericClient();

Parameters parameters = client.operation().onServer().named("requestPsnWorkflow")
.withParameters(createParametersForPsnWorkflowLocalPseudonym(localPseudonym))
.accept(Constants.CT_FHIR_XML_NEW).encoded(EncodingEnum.XML).execute();

return getPseudonym(parameters).map(p -> fttpTarget + "/" + p);
}
catch (Exception e)
{
logger.error("Error while retrieving DIC pseudonym: {} - {}", e.getClass().getName(), e.getMessage());
throw new BpmnError(CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_FTTP_NOT_REACHABLE, e.getMessage());
}
}

protected Parameters createParametersForBfWorkflow(String bloomFilter)
{
Parameters p = new Parameters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ else if (resource instanceof Encounter e)
e.setSubject(patientRef);
else if (resource instanceof Immunization i)
i.setPatient(patientRef);
else if (resource instanceof Medication m)
else if (resource instanceof Medication)
; // nothing to do
else if (resource instanceof MedicationAdministration ma)
ma.setSubject(patientRef);
Expand Down Expand Up @@ -94,7 +94,7 @@ else if (resource instanceof Encounter e)
return Optional.of(e.getSubject());
else if (resource instanceof Immunization i)
return Optional.of(i.getPatient());
else if (resource instanceof Medication m)
else if (resource instanceof Medication)
return Optional.empty();
else if (resource instanceof MedicationAdministration ma)
return Optional.of(ma.getSubject());
Expand Down Expand Up @@ -198,8 +198,8 @@ protected Optional<Patient> findPatientInLocalFhirStore(String pseudonym)
}
catch (Exception e)
{
logger.warn("Error while searching for Patient with pseudonym " + NAMING_SYSTEM_NUM_CODEX_CRR_PSEUDONYM
+ "|" + pseudonym, e);
logger.warn("Error while searching for Patient with pseudonym {}|{}", NAMING_SYSTEM_NUM_CODEX_CRR_PSEUDONYM,
pseudonym, e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ public Optional<Patient> getPatient(String reference)
logger.warn("Patient {} not found: {} - {}", reference, e.getClass().getName(), e.getMessage());

if (logger.isDebugEnabled())
logger.debug("Error while reading patient " + reference, e);
logger.debug("Error while reading patient {}", reference, e);

return Optional.empty();
}
Expand All @@ -653,6 +653,8 @@ public void updatePatient(Patient patient)
Objects.requireNonNull(patient, "patient");

String id = patient.getIdElement().toVersionless().getValue();
// set the patient id to versionless id to workaround a `If-Match`-header bug in hapi fhir client
patient.setId(id);
logger.info("Updating patient {}", id);

try
Expand Down Expand Up @@ -682,7 +684,7 @@ public void updatePatient(Patient patient)
}
catch (Exception e)
{
logger.warn("Could not update patient " + id, e);
logger.warn("Could not update patient {}", id, e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private Optional<Patient> update(Patient existingPatient, Patient newPatient, St
}
catch (Exception e)
{
logger.warn("Could not update patient " + newPatient.getIdElement().toString(), e);
logger.warn("Could not update patient {}", newPatient.getIdElement().toString(), e);
throw e;
}
}
Expand Down Expand Up @@ -230,7 +230,7 @@ private Optional<Patient> create(Patient newPatient, String pseudonym, String bu
}
catch (Exception e)
{
logger.warn("Could not create patient " + newPatient.getIdElement().toString(), e);
logger.warn("Could not create patient {}", newPatient.getIdElement().toString(), e);
throw e;
}
}
Expand Down Expand Up @@ -318,7 +318,7 @@ private Optional<Resource> findResourceInLocalFhirStore(String url, Class<? exte
}
catch (Exception e)
{
logger.warn("Error while searching for Resource with url " + url, e);
logger.warn("Error while searching for Resource with url {}", url, e);
throw e;
}
}
Expand Down Expand Up @@ -426,8 +426,8 @@ else if (outcome.getOperationOutcome() != null && outcome.getOperationOutcome()
}
catch (Exception e)
{
logger.warn("Count not update " + newResource.getResourceType().name() + " "
+ newResource.getIdElement().toString(), e);
logger.warn("Count not update {} {}", newResource.getResourceType().name(),
newResource.getIdElement().toString(), e);
throw e;
}
}
Expand Down Expand Up @@ -497,8 +497,8 @@ else if (outcome.getOperationOutcome() != null && outcome.getOperationOutcome()
}
catch (Exception e)
{
logger.warn("Could not create " + newResource.getResourceType().name() + " "
+ newResource.getIdElement().toString(), e);
logger.warn("Could not create {} {}", newResource.getResourceType().name(),
newResource.getIdElement().toString(), e);
throw e;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw
catch (InvalidKeyException | BadPaddingException | IllegalBlockSizeException | NoSuchPaddingException
| NoSuchAlgorithmException | InvalidAlgorithmParameterException | IOException e)
{
logger.warn("Unable to decrypt data from DIC: " + e.getMessage(), e);
logger.warn("Unable to decrypt data from DIC: {}", e.getMessage(), e);
throw new BpmnError(CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_DECRYPTION_OF_DATA_FROM_DIC_FAILED,
"Error while decrypting data from DIC");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw
}
catch (Exception e)
{
logger.warn("Error while reading Binary resoruce: " + e.getMessage(), e);
logger.warn("Error while reading Binary resoruce: {}", e.getMessage(), e);

throw new BpmnError(
CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_DOWNLOAD_OF_ENCRYPTED_DATA_FROM_DTS_FAILED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw
| InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException
| ShortBufferException e)
{
logger.warn("Unable to encrypt validation error for DIC: " + e.getMessage(), e);
logger.warn("Unable to encrypt validation error for DIC: {}", e.getMessage(), e);
throw new BpmnError(
CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_ECRYPTION_OF_VALIDATION_ERROR_FOR_DIC_FAILED,
"Unable to encrypt validation error for DIC");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ca.uhn.fhir.context.FhirContext;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.logging.DataLogger;
import dev.dsf.bpe.v1.ProcessPluginApi;
import dev.dsf.bpe.v1.activity.AbstractServiceDelegate;
import dev.dsf.bpe.v1.constants.NamingSystems;
Expand All @@ -26,12 +26,14 @@ public class StoreValidationErrorForDts extends AbstractServiceDelegate
private static final Logger logger = LoggerFactory.getLogger(StoreValidationErrorForDts.class);

private final String dtsIdentifierValue;
private final DataLogger dataLogger;

public StoreValidationErrorForDts(ProcessPluginApi api, String dtsIdentifierValue)
public StoreValidationErrorForDts(ProcessPluginApi api, String dtsIdentifierValue, DataLogger dataLogger)
{
super(api);

this.dtsIdentifierValue = dtsIdentifierValue;
this.dataLogger = dataLogger;
}

@Override
Expand All @@ -40,6 +42,7 @@ public void afterPropertiesSet() throws Exception
super.afterPropertiesSet();

Objects.requireNonNull(dtsIdentifierValue, "dtsIdentifierValue");
Objects.requireNonNull(dataLogger, "dataLogger");
}

@Override
Expand Down Expand Up @@ -72,8 +75,8 @@ private IdType createBinaryResource(Binary binary)
}
catch (Exception e)
{
logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary));
logger.warn("Error while creating Binary resource: " + e.getMessage(), e);
dataLogger.logData("Binary to create", binary);
logger.warn("Error while creating Binary resource: {}", e.getMessage(), e);

throw new BpmnError(
CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_UNABLE_TO_STORE_ECRYPTED_VALIDATION_ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw
catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException
| InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException | IOException e)
{
logger.warn("Unable to decrypt validation error from CRR: " + e.getMessage(), e);
logger.warn("Unable to decrypt validation error from CRR: {}", e.getMessage(), e);
throw new BpmnError(
CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_DECRYPTION_OF_VALIDATION_ERROR_FROM_CRR_FAILED,
"Error while decrypting validation error from CRR");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw
}
catch (Exception e)
{
logger.warn("Error while reading Binary resoruce: " + e.getMessage(), e);
logger.warn("Error while reading Binary resoruce: {}", e.getMessage(), e);

throw new BpmnError(
CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_DOWNLOAD_OF_ENCRYPTED_VALIDATION_ERROR_FROM_DTS_FAILED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected void doExecute(DelegateExecution execution, dev.dsf.bpe.v1.variables.V
| InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException
| ShortBufferException | IOException e)
{
logger.warn("Unable to encrypt data for CRR: " + e.getMessage(), e);
logger.warn("Unable to encrypt data for CRR: {}", e.getMessage(), e);
throw new BpmnError(CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_ECRYPTION_OF_DATA_FOR_CRR_FAILED,
"Unable to encrypt data for CRR");
}
Expand Down
Loading
Loading