Skip to content

Commit

Permalink
feat: backport logCommunicationType from evs (#462)
Browse files Browse the repository at this point in the history
* feat: backport logCommunicationType from evs

added the ability to also log encrypted incoming and outgoing communication via argument `logCommunicationType`. Possible values: WITHOUT_SECURITY, WITH_SECURITY, ALL. Default: WITHOUT_SECURITY

* Create LogCommunicationTypeConverter.java

* Create LogCommunicationType.java

* feat: sumehr - display items with nullflavor in visualization

* Update VaultExporterArguments.java

* Update VaultExporterFromIde.java

* Update VaultExporterRunner.java

* Update UploaderArguments.java

* Update UploaderFromIde.java

* Update UploaderRunner.java

* Create Kind.java

* Update HubService.java

* Update HubService.java

* Update CommunicationLoggerAfterSecurity.java

* Update CommunicationLoggerBeforeSecurity.java

* Update MessageWriter.java

* Update start EVS.cmd

* Update start EVS RSW.cmd

* Update start EVS RSB.cmd

* Update start EVS exporter.cmd

* Update start EVS.sh

* Update MessageWriter.java

* Update VaultExporterFromIde.java

* Update Problem.java

* Update SumehrMapper.java

---------

Co-authored-by: Jacques Yakoub <[email protected]>
  • Loading branch information
smals-jy and jy95 authored Sep 5, 2024
1 parent 62ce32c commit 777de5b
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
../system/vault-uploader.cmd -rootDir="..\exe\interaction" -writeAsIs=false -exportAfterUpload=true -validateExportAfterUpload=false -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -startTransactonId=100 -shiftAction=no_tag_and_no_shift -hub=RSB -searchType=LOCAL -autoGenerateMSTransactionAuthor=true -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true
../system/vault-uploader.cmd -rootDir="..\exe\interaction" -writeAsIs=false -exportAfterUpload=true -validateExportAfterUpload=false -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -startTransactonId=100 -shiftAction=no_tag_and_no_shift -hub=RSB -searchType=LOCAL -autoGenerateMSTransactionAuthor=true -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true -logCommunicationType=WITHOUT_SECURITY
Original file line number Diff line number Diff line change
@@ -1 +1 @@
../system/vault-uploader.cmd -rootDir="..\exe\interaction" -writeAsIs=false -exportAfterUpload=true -validateExportAfterUpload=false -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -startTransactonId=100 -shiftAction=no_tag_and_no_shift -hub=RSW -searchType=LOCAL -autoGenerateMSTransactionAuthor=true -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true
../system/vault-uploader.cmd -rootDir="..\exe\interaction" -writeAsIs=false -exportAfterUpload=true -validateExportAfterUpload=false -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -startTransactonId=100 -shiftAction=no_tag_and_no_shift -hub=RSW -searchType=LOCAL -autoGenerateMSTransactionAuthor=true -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true -logCommunicationType=WITHOUT_SECURITY
Original file line number Diff line number Diff line change
@@ -1 +1 @@
../system/vault-exporter.cmd -transactionType=medicationscheme -patients=patient_template -actor=gp_van_Doe -exportDir="..\exe\exports" -validate=true -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -hub=VITALINK -searchType=LOCAL -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true
../system/vault-exporter.cmd -transactionType=medicationscheme -patients=patient_template -actor=gp_van_Doe -exportDir="..\exe\exports" -validate=true -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -hub=VITALINK -searchType=LOCAL -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true -logCommunicationType=WITHOUT_SECURITY
Original file line number Diff line number Diff line change
@@ -1 +1 @@
../system/vault-uploader.cmd -rootDir="..\exe\interaction" -writeAsIs=false -exportAfterUpload=true -validateExportAfterUpload=false -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -startTransactonId=100 -shiftAction=no_tag_and_no_shift -hub=VITALINK -searchType=LOCAL -autoGenerateMSTransactionAuthor=true -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true
../system/vault-uploader.cmd -rootDir="..\exe\interaction" -writeAsIs=false -exportAfterUpload=true -validateExportAfterUpload=false -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -startTransactonId=100 -shiftAction=no_tag_and_no_shift -hub=VITALINK -searchType=LOCAL -autoGenerateMSTransactionAuthor=true -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true -logCommunicationType=WITHOUT_SECURITY
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"
../system/vault-uploader.sh -rootDir="../exe/interaction/" -writeAsIs=false -exportAfterUpload=false -validateExportAfterUpload=false -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -startTransactonId=100 -shiftAction=no_tag_and_no_shift -hub=VITALINK -searchType=LOCAL -autoGenerateMSTransactionAuthor=true -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true
../system/vault-uploader.sh -rootDir="../exe/interaction/" -writeAsIs=false -exportAfterUpload=false -validateExportAfterUpload=false -generateGlobalMedicationScheme=true -generateDailyMedicationScheme=false -generateSumehrOverview=true -generateGatewayMedicationScheme=true -startTransactonId=100 -shiftAction=no_tag_and_no_shift -hub=VITALINK -searchType=LOCAL -autoGenerateMSTransactionAuthor=true -generateDiaryNoteVisualization=true -generateVaccinationVisualization=true -generateChildPreventionVisualization=true -generatePopulationBasedScreeningVisualization=true -logCommunicationType=WITHOUT_SECURITY
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class EVSProperties {

public static final String CHOSEN_HUB = "HUB";
public static final String SEARCH_TYPE = "SEARCHTYPE";
public static final String LOG_COMMUNICATION_TYPE = "LOG_COMMUNICATION_TYPE";
public static final String AUTO_GENERATE_KMEHR_MS_TRANSACTION_AUTHOR = "GENERATE_KMEHR_MS_TRANSACTION_AUTHOR";
public static final String FILTER_OUT_TRANSACTIONS_HAVING_PATIENT_ACCESS_NO = "FILTER_OUT_TRANSACTIONS_HAVING_PATIENT_ACCESS_NO";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.imec.ivlab.core.jcommander;

import com.beust.jcommander.IStringConverter;
import org.imec.ivlab.core.model.hub.Hub;
import org.imec.ivlab.core.model.hub.LogCommunicationType;


public class LogCommunicationTypeConverter implements IStringConverter<LogCommunicationType>
{
//@Override
public LogCommunicationType convert(String logCommunicationType) {

return LogCommunicationType.valueOf(logCommunicationType);

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.imec.ivlab.core.model.hub;

public enum LogCommunicationType {

WITHOUT_SECURITY, WITH_SECURITY, ALL;

public static LogCommunicationType fromValue(String input) {
for (LogCommunicationType logCommunicationType : values()) {
if (logCommunicationType.name().equalsIgnoreCase(input)) {
return logCommunicationType;
}
}

throw new IllegalArgumentException("Invalid LogCommunicationType value: " + input);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import lombok.Data;
import org.imec.ivlab.core.model.internal.parser.ItemParsedItem;

@Getter
@Setter
@Data
public class Problem extends ItemParsedItem {

private LocalDateTime recordDateTime;
private LocalDate beginmoment;
private LocalDate endmoment;


private boolean noKnownTreatment;

}
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ public static Treatment toTreatment(ItemType itemType) {

toItem(itemType, tm);

tm.setNoKnownTreatment(hasNullFlavor(itemType));

if (itemType.getBeginmoment() != null) {
tm.setBeginmoment(itemType.getBeginmoment().getDate().toLocalDate());
tm.getUnparsed().getBeginmoment().setDate(null);
Expand All @@ -286,6 +288,8 @@ public static Problem toProblem(ItemType itemType) {

toItem(itemType, pb);

pb.setNoKnownTreatment(hasNullFlavor(itemType));

if (itemType.getBeginmoment() != null) {
pb.setBeginmoment(itemType.getBeginmoment().getDate().toLocalDate());
pb.getUnparsed().getBeginmoment().setDate(null);
Expand All @@ -306,6 +310,13 @@ public static Problem toProblem(ItemType itemType) {
return pb;
}

private static boolean hasNullFlavor(ItemType itemType) {
return CDItemUtil
.getCDItems(itemType.getCds(), CDITEMschemes.CD_ITEM)
.stream()
.anyMatch(cdItem -> org.apache.commons.lang3.StringUtils.equalsIgnoreCase(cdItem.getNullFlavor(), "NA"));
}

public static PatientWill toPatientWill(ItemType itemType) {
PatientWill patientWill = new PatientWill();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import lombok.Getter;
import lombok.Setter;
import org.imec.ivlab.core.jcommander.HubConverter;
import org.imec.ivlab.core.jcommander.LogCommunicationTypeConverter;
import org.imec.ivlab.core.jcommander.SearchTypeConverter;
import org.imec.ivlab.core.model.hub.LogCommunicationType;
import org.imec.ivlab.core.model.upload.TransactionType;
import org.imec.ivlab.core.authentication.AuthenticationConfigReader;
import org.imec.ivlab.core.jcommander.LocalDateConverter;
Expand Down Expand Up @@ -78,4 +80,7 @@ public class VaultExporterArguments {
@Parameter(names = "-filterOutTransactionsHavingPatientAccessNo", description = "Do not attempt to get hub transactions that are marked as PatientAccess=no", arity = 1)
private boolean filterOutTransactionsHavingPatientAccessNo;

@Parameter(names = "-logCommunicationType", description = "What kind communication to log", converter = LogCommunicationTypeConverter.class)
private LogCommunicationType logCommunicationType = LogCommunicationType.WITHOUT_SECURITY;

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.imec.ivlab.core.authentication.AuthenticationConfigReader;
import org.imec.ivlab.core.data.PatientKey;
import org.imec.ivlab.core.model.hub.Hub;
import org.imec.ivlab.core.model.hub.LogCommunicationType;
import org.imec.ivlab.core.model.hub.SearchType;
import org.imec.ivlab.core.model.upload.TransactionType;

Expand Down Expand Up @@ -40,8 +41,10 @@ public static void main(String[] args) throws TechnicalConnectorException {
arguments.setGenerateGatewayMedicationScheme(true);
arguments.setDailyMedicationSchemeDate(LocalDate.now().plusYears(4));
arguments.setFilterOutTransactionsHavingPatientAccessNo(false);

arguments.setHub(Hub.RSB);

arguments.setLogCommunicationType(LogCommunicationType.WITHOUT_SECURITY);

arguments.setHub(Hub.VITALINK);
arguments.setSearchType(SearchType.LOCAL);

// arguments.setBreakTheGlassIfTRMissing(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void start(VaultExporterArguments arguments) {

EVSConfig.getInstance().setProperty(EVSProperties.CHOSEN_HUB, arguments.getHub().name());
EVSConfig.getInstance().setProperty(EVSProperties.SEARCH_TYPE, arguments.getSearchType().name());
EVSConfig.getInstance().setProperty(EVSProperties.LOG_COMMUNICATION_TYPE, arguments.getLogCommunicationType().name());
EVSConfig.getInstance().setProperty(EVSProperties.FILTER_OUT_TRANSACTIONS_HAVING_PATIENT_ACCESS_NO, String.valueOf(arguments.isFilterOutTransactionsHavingPatientAccessNo()));

for (int patientKeyIndex = 0; patientKeyIndex < patientKeys.size(); patientKeyIndex++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import lombok.ToString;
import org.imec.ivlab.core.jcommander.HubConverter;
import org.imec.ivlab.core.jcommander.LocalDateConverter;
import org.imec.ivlab.core.jcommander.LogCommunicationTypeConverter;
import org.imec.ivlab.core.jcommander.PathToFileConverter;
import org.imec.ivlab.core.jcommander.SearchTypeConverter;
import org.imec.ivlab.core.model.hub.Hub;
import org.imec.ivlab.core.model.hub.LogCommunicationType;
import org.imec.ivlab.core.model.hub.SearchType;
import org.imec.ivlab.datagenerator.uploader.dateshift.ShiftAction;
import org.imec.ivlab.datagenerator.uploader.dateshift.ShiftActionConverter;
Expand Down Expand Up @@ -80,4 +82,7 @@ public class UploaderArguments {
@Parameter(names = "-filterOutTransactionsHavingPatientAccessNo", description = "Do not attempt to get hub transactions that are marked as PatientAccess=no", arity = 1)
private boolean filterOutTransactionsHavingPatientAccessNo;

@Parameter(names = "-logCommunicationType", description = "What kind communication to log", converter = LogCommunicationTypeConverter.class)
private LogCommunicationType logCommunicationType = LogCommunicationType.WITHOUT_SECURITY;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.joda.time.LocalDate;
import org.imec.ivlab.core.exceptions.VitalinkException;
import org.imec.ivlab.core.model.hub.Hub;
import org.imec.ivlab.core.model.hub.LogCommunicationType;
import org.imec.ivlab.core.model.hub.SearchType;
import org.imec.ivlab.datagenerator.uploader.dateshift.ShiftAction;
import org.imec.ivlab.datagenerator.uploader.exception.ScannerException;
Expand Down Expand Up @@ -35,6 +36,8 @@ public static void main(String[] args) throws ScannerException, VitalinkExceptio
arguments.setAutoGenerateMSTransactionAuthor(true);
arguments.setFilterOutTransactionsHavingPatientAccessNo(false);

arguments.setLogCommunicationType(LogCommunicationType.WITHOUT_SECURITY);

arguments.setStartTransactionId("100");

arguments.setShiftAction(ShiftAction.NO_TAG_AND_NO_SHIFT);
Expand All @@ -46,4 +49,4 @@ public static void main(String[] args) throws ScannerException, VitalinkExceptio

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void start(UploaderArguments arguments) throws ScannerException, Vitalink

EVSConfig.getInstance().setProperty(EVSProperties.CHOSEN_HUB, arguments.getHub().name());
EVSConfig.getInstance().setProperty(EVSProperties.SEARCH_TYPE, arguments.getSearchType().name());
EVSConfig.getInstance().setProperty(EVSProperties.LOG_COMMUNICATION_TYPE, arguments.getLogCommunicationType().name());
EVSConfig.getInstance().setProperty(EVSProperties.AUTO_GENERATE_KMEHR_MS_TRANSACTION_AUTHOR, String.valueOf(arguments.isAutoGenerateMSTransactionAuthor()));
EVSConfig.getInstance().setProperty(EVSProperties.FILTER_OUT_TRANSACTIONS_HAVING_PATIENT_ACCESS_NO, String.valueOf(arguments.isFilterOutTransactionsHavingPatientAccessNo()));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.imec.ivlab.ehconnector.hub;

import static org.imec.ivlab.ehconnector.hub.logging.Kind.WITHOUT_SECURITY;

import be.ehealth.business.intrahubcommons.exception.IntraHubBusinessConnectorException;
import be.ehealth.businessconnector.hubv3.session.HubSessionServiceFactory;
import be.ehealth.technicalconnector.exception.ConnectorException;
Expand Down Expand Up @@ -54,6 +56,7 @@
import org.imec.ivlab.ehconnector.hub.exception.incurable.NoNodeFoundMatchingTheURI;
import org.imec.ivlab.ehconnector.hub.exception.incurable.RemoveNotAllowedIfDataEntryAlreadyDeleted;
import org.imec.ivlab.ehconnector.hub.exception.incurable.SubjectWithSSINUnknownException;
import org.imec.ivlab.ehconnector.hub.logging.Kind;
import org.imec.ivlab.ehconnector.hub.logging.MessageWriter;

public class HubService {
Expand Down Expand Up @@ -230,7 +233,7 @@ public GetTransactionListResponse getTransactionListOnce(PatientIdType patientId

private PutTransactionSetResponse putTransactionSetOnce(Kmehrmessage kmehrmessage) throws VitalinkException, GatewaySpecificErrorException {
try {
writeKmehrmessage(kmehrmessage, "PutTransactionSetRequest-kmehrmessage");
writeKmehrmessage(kmehrmessage, "PutTransactionSetRequest-kmehrmessage", WITHOUT_SECURITY);
PutTransactionSetResponse putTransactionSetResponse = hubService.putTransactionSet(kmehrmessage);
verifyResponse(putTransactionSetResponse.getAcknowledge());
return putTransactionSetResponse;
Expand All @@ -241,8 +244,8 @@ private PutTransactionSetResponse putTransactionSetOnce(Kmehrmessage kmehrmessag

}

private void writeKmehrmessage(Kmehrmessage kmehrmessage, String operation) {
MessageWriter.logMessage(kmehrToString(kmehrmessage), operation);
private void writeKmehrmessage(Kmehrmessage kmehrmessage, String operation, Kind kind) {
MessageWriter.logMessage(kmehrToString(kmehrmessage), operation, kind);
}

private String kmehrToString(Kmehrmessage kmehrmessage) {
Expand All @@ -259,7 +262,7 @@ private String kmehrToString(Kmehrmessage kmehrmessage) {

private PutTransactionResponse putTransactionOnce(Kmehrmessage kmehrmessage) throws VitalinkException, GatewaySpecificErrorException {
try {
writeKmehrmessage(kmehrmessage, "PutTransactionRequest-kmehrmessage");
writeKmehrmessage(kmehrmessage, "PutTransactionRequest-kmehrmessage", WITHOUT_SECURITY);
PutTransactionResponse putTransactionSetResponse = hubService.putTransaction(kmehrmessage);
verifyResponse(putTransactionSetResponse.getAcknowledge());
return putTransactionSetResponse;
Expand Down Expand Up @@ -299,7 +302,7 @@ private GetTransactionSetResponse getTransactionSetOnce(PatientIdType patientIdT

try {
GetTransactionSetResponse getTransactionSetResponse = hubService.getTransactionSet(patientIdType, transactionBaseType);
writeKmehrmessage(getTransactionSetResponse.getKmehrmessage(), "GetTransactionSetResponse-kmehrmessage");
writeKmehrmessage(getTransactionSetResponse.getKmehrmessage(), "GetTransactionSetResponse-kmehrmessage", WITHOUT_SECURITY);
verifyResponse(getTransactionSetResponse.getAcknowledge());
return getTransactionSetResponse;
} catch (TechnicalConnectorException | IntraHubBusinessConnectorException | GatewayListOfErrorsException e) {
Expand All @@ -313,7 +316,7 @@ private GetTransactionResponse getTransactionOnce(PatientIdType patientIdType, T

try {
GetTransactionResponse getTransactionResponse = hubService.getTransaction(patientIdType, transactionBaseType);
writeKmehrmessage(getTransactionResponse.getKmehrmessage(), "GetTransactionResponse-kmehrmessage");
writeKmehrmessage(getTransactionResponse.getKmehrmessage(), "GetTransactionResponse-kmehrmessage", WITHOUT_SECURITY);
verifyResponse(getTransactionResponse.getAcknowledge());
return getTransactionResponse;
} catch (TechnicalConnectorException | IntraHubBusinessConnectorException | GatewayListOfErrorsException e) {
Expand Down
Loading

0 comments on commit 777de5b

Please sign in to comment.