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

1350 adds logs ihe #1772

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ Comments:
- see example of the request here: https://drive.google.com/drive/folders/1yKVHYyQPhkCHDo9Ow8lpT4vFHq7LY_9O

Last updated: Dec 20 2023</description>
<revision>126</revision>
<revision>492</revision>
<sourceConnector version="4.4.2">
<metaDataId>0</metaDataId>
<name>sourceConnector</name>
<properties class="com.mirth.connect.connectors.http.HttpReceiverProperties" version="4.4.2">
<pluginProperties>
<com.mirth.connect.plugins.httpauth.NoneHttpAuthProperties version="4.4.2">
<authType>NONE</authType>
</com.mirth.connect.plugins.httpauth.NoneHttpAuthProperties>
<com.mirth.connect.plugins.ssl.model.SSLConnectorPluginProperties version="4.4.2">
<enabled>false</enabled>
<clientAuthentication>DISABLED</clientAuthentication>
Expand All @@ -42,6 +39,9 @@ Last updated: Dec 20 2023</description>
<implicitFTPS>true</implicitFTPS>
<useSTARTTLS>false</useSTARTTLS>
</com.mirth.connect.plugins.ssl.model.SSLConnectorPluginProperties>
<com.mirth.connect.plugins.httpauth.NoneHttpAuthProperties version="4.4.2">
<authType>NONE</authType>
</com.mirth.connect.plugins.httpauth.NoneHttpAuthProperties>
</pluginProperties>
<listenerConnectorProperties version="4.4.2">
<host>0.0.0.0</host>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var json = null, error = null;
// HTTP 400 Bad Request - by default, the server cannot or will not process the request
channelMap.put("responseCode", "400");

var baseLogMessage = "XCA DQ Bulk Interface: Transformer (Step0) - ";

// Destination is not needed
destinationSet.removeAll();
Expand All @@ -11,6 +12,7 @@ destinationSet.removeAll();
// Decode and parse incoming JSON request
json = getBase64Content(msg, 'json');

logger.info(baseLogMessage + 'request: ' + JSON.stringify(json));

// Validate request
if ('string' == typeof json) {
Expand All @@ -29,5 +31,6 @@ if ('string' == typeof json) {
// Cease processing in case of an error
if (error) {
channelMap.put('NOTE', error);
logger.error(baseLogMessage + 'err: ' + error);
throw error;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
var totalCount = 0;

var baseLogMessage = "XCA DQ Bulk Interface: Transformer (Step1) - ";

// Loop through all request entries
if (json) {
json.forEach(function(entry) {

var entryLogMessage = baseLogMessage + 'requestId: ' + entry.id.toString() + ', cxId: ' + entry.cxId.toString() + ' - ';

totalCount++;
var errorCount = 0;

Expand All @@ -20,16 +24,15 @@ if (json) {
}

} catch(ex) {
if (globalMap.containsKey('TEST_MODE')) logger.error('XCA ITI-38 Bulk Interface: Source - ' + ex);
logger.error(entryLogMessage + 'error: ' + ex);
errorCount++;
}

// Pass to the XCPD Interface channel to process
if (0 == errorCount) {

var result = router.routeMessageByChannelId(globalMap.get('XCAITI38INTERFACE'), JSON.stringify(entry, null, 2));

} else {
logger.error(entryLogMessage + 'error: ' + errorCount.toString() + ' error(s) is/are found in the entries');
channelMap.put("responseCode", "400");
channelMap.put('NOTE', 'ERROR - ' + errorCount.toString() + ' error(s) is/are found in the entries');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Comments:
- see example of the request here: https://drive.google.com/drive/folders/1yKVHYyQPhkCHDo9Ow8lpT4vFHq7LY_9O

Last updated: Dec 05 2023</description>
<revision>126</revision>
<revision>489</revision>
<sourceConnector version="4.4.2">
<metaDataId>0</metaDataId>
<name>sourceConnector</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var json = null, error = null;
// HTTP 400 Bad Request - by default, the server cannot or will not process the request
channelMap.put("responseCode", "400");

var baseLogMessage = "XCA DR Bulk Interface: Transformer (Step0) - ";

// Destination is not needed
destinationSet.removeAll();
Expand All @@ -11,6 +12,7 @@ destinationSet.removeAll();
// Decode and parse incoming JSON request
json = getBase64Content(msg, 'json');

logger.info(baseLogMessage + 'request: ' + JSON.stringify(json));

// Validate request
if ('string' == typeof json) {
Expand All @@ -29,5 +31,6 @@ if ('string' == typeof json) {
// Cease processing in case of an error
if (error) {
channelMap.put('NOTE', error);
logger.error(baseLogMessage + 'err: ' + error);
throw error;
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
var totalCount = 0,
var totalCount = 0,
processedCount = 0;

var baseLogMessage = "XCA DR Bulk Interface: Transformer (Step1) - ";

// Loop through all request entries
if (json) {
json.forEach(function(entry) {

var entryLogMessage = baseLogMessage + 'requestId: ' + entry.id.toString() + ', cxId: ' + entry.cxId.toString() + ' - ';

totalCount++;
var errorCount = 0;

// Check for required parameters
try {

if (!entry.hasOwnProperty('gateway')) {
errorCount++
} else if (!entry.hasOwnProperty('samlAttributes') || 0 == entry.samlAttributes.length) {
Expand All @@ -20,16 +24,15 @@ if (json) {
}

} catch(ex) {
if (globalMap.containsKey('TEST_MODE')) logger.error('XCA ITI-39 Bulk Interface: Source - ' + ex);
logger.error(entryLogMessage + 'error: ' + ex);
errorCount++;
}

// Pass to the XCPD Interface channel to process
if (0 == errorCount) {

var result = router.routeMessageByChannelId($g('XCAITI39Interface'), JSON.stringify(entry, null, 2));

} else {
logger.error(entryLogMessage + 'error: ' + errorCount.toString() + ' error(s) is/are found in the entries');
channelMap.put("responseCode", "400");
channelMap.put('NOTE', 'ERROR - ' + errorCount.toString() + ' error(s) is/are found in the entries');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- expects to receive a single requests to be transmitted to the XCA ITI-38 [Cross Gateway Query] Processor channel

Last updated: Nov 29 2023</description>
<revision>124</revision>
<revision>492</revision>
<sourceConnector version="4.4.2">
<metaDataId>0</metaDataId>
<name>sourceConnector</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ var json = null, error = null;
// HTTP 400 Bad Request - by default, the server cannot or will not process the request
channelMap.put("responseCode", "400");

var baseLogMessage = "XCA DQ Interface: Transformer (Step0) - ";

// Decode and parse incoming JSON request if sent over HTTP
if (msg.toString().startsWith('<HttpRequest>')) {
json = getBase64Content(msg, 'json');

logger.info(baseLogMessage + 'response: ' + JSON.stringify(json));
} else try {

// Parse JSON request if routed from the XCPD Bulk Interface channel
json = JSON.parse(msg.toString());

} catch(ex) {
if (globalMap.containsKey('TEST_MODE')) logger.error('XCA ITI-38 Interface: Source - ' + ex);
logger.error(baseLogMessage + 'error: ' + ex);
error = 'ERROR - ' + ex;
}

Expand All @@ -41,7 +43,7 @@ if ('string' == typeof json) {
}

} catch(ex) {
if (globalMap.containsKey('TEST_MODE')) logger.error('XCA ITI-38 Interface: Source - ' + ex);
logger.error(baseLogMessage + 'error: ' + ex);
error = 'ERROR - ' + ex;
}

Expand All @@ -51,5 +53,14 @@ router.routeMessageByChannelId($g('ITI38PROCESSOR'), JSON.stringify(json));
// Cease processing in case of an error
if (error) {
channelMap.put('NOTE', error);
logger.error(
baseLogMessage +
"requestId: " +
json.id.toString() +
"cxId: " +
json.cxId.toString() +
"err: " +
error
);
throw error;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
TODO: Update SAML Attributes

Last updated: Dec 07 2023</description>
<revision>126</revision>
<revision>513</revision>
<sourceConnector version="4.4.2">
<metaDataId>0</metaDataId>
<name>sourceConnector</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Decode and parse XCA ITI-38 (Cross Gateway Query Response) message
var xml = null;

var requestId = channelMap.get('MSG_ID');
var cxId = channelMap.get('CUSTOMER_ID');

var baseLogMessage = "XCA DQ ITI-38 Processor: Response (Case0) - requestId: " + requestId.toString() + ", " + "cxId: " + cxId.toString() + " - ";

var queryResponseCode = '',
homeCommunityId = null,
soapFaultCode = null,
Expand All @@ -14,15 +19,17 @@ try {
// Store for testing
channelMap.put('RESPONSE', soap.toString());

logger.info(baseLogMessage + 'Response: ' + soap);

xml = new XML(soap.toString());

// SOAP level error
if (soap.indexOf('Fault') > 0) {

channelMap.put('QACK', 'SOAP_FAULT');
// Stop further processing
return;

} else {

xml = xml.*::Body.*::AdhocQueryResponse;
Expand All @@ -32,12 +39,12 @@ try {
// urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure
// urn:ihe:iti:2007:ResponseStatusType:PartialSuccess
queryResponseCode = [email protected]().split(':').pop();

channelMap.put('QACK', queryResponseCode.toString());
}

} catch(ex) {
if (globalMap.containsKey('TEST_MODE')) logger.error('XCA ITI-39 Processor: Response - ' + ex);
logger.error(baseLogMessage + 'Error: ' + ex)
channelMap.put('RESPONSE_ERROR', ex.toString());
throw ex;
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
// This transaction may return both errors and results in an AdhocQueryResponse message.
// The RegistryErrorList element may be present.
// The RegistryErrorList element may be present.
// If present will contain one or more RegistryError elements with warning severity; none with error severity

var requestId = channelMap.get('MSG_ID');
var cxId = channelMap.get('CUSTOMER_ID');

var baseLogMessage = "XCA DQ ITI-38 Processor: Response (Case1) - requestId: " + requestId.toString() + ", " + "cxId: " + cxId.toString() + " - ";

if ('Success' == queryResponseCode.toString() || 'PartialSuccess' == queryResponseCode.toString()) {

var _response = getXCA38ResponseTemplate(channelMap.get('REQUEST'), null);

// Process RegistryObjectList
if (xml.*::RegistryObjectList.length() > 0) {
if (xml.*::RegistryObjectList.length() > 0) {
var contentList = processRegistryObjectList(xml.*::RegistryObjectList);
if (contentList) {
_response.documentReference = contentList;
channelMap.put('RESULT', contentList.length + ' doc(s)');
}
}
}

// Process possible RegistryError entries
Expand All @@ -21,6 +26,8 @@ if ('Success' == queryResponseCode.toString() || 'PartialSuccess' == queryRespon
if (operationOutcome) _response.operationOutcome = operationOutcome;
}

logger.info(baseLogMessage + 'Response: ' + JSON.stringify(_response));

var result = router.routeMessageByChannelId(globalMap.get('XCADQAPPINTERFACE'), JSON.stringify(_response));

// Stop further processing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
// which shall contain corresponding RegistryError elements.
// At least one has error severity; others may have warning severity.

var requestId = channelMap.get('MSG_ID');
var cxId = channelMap.get('CUSTOMER_ID');

var baseLogMessage = "XCA DQ ITI-38 Processor: Response (Case2) - requestId: " + requestId.toString() + ", " + "cxId: " + cxId.toString() + " - ";

if ('Failure' == queryResponseCode.toString()) {

if (xml.*::RegistryErrorList.length() > 0) {
if (xml.*::RegistryErrorList.length() > 0) {

var operationOutcome = processRegistryErrorList(xml.*::RegistryErrorList);
var operationOutcome = processRegistryErrorList(xml.*::RegistryErrorList);
if (operationOutcome) {
var _response = getXCA38ResponseTemplate(channelMap.get('REQUEST'), operationOutcome);
logger.info(baseLogMessage + 'Response: ' + JSON.stringify(_response));
var result = router.routeMessageByChannelId(globalMap.get('XCADQAPPINTERFACE'), JSON.stringify(_response));
}
}

// Stop further processing
return;
return;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ For document searches on the NHIN, it is recommended to use the following elemen
* Class code
* Practice Setting Code
* Healthcare Facility Type
* Document Creation Time
* Document Creation Time
*/

var baseLogMessage =
"XCA DQ ITI-38 Processor - requestId: " +
msg.id.toString() +
", " +
"cxId: " +
msg.cxId.toString() +
" - ";

// XDSDocumentEntryPatientId (REQUIRED) [1..1]
// Dec 20: xcpdPatientId to gatewayPatientId
var patientEntry = getXDSDocumentEntryPatientId(
Expand Down Expand Up @@ -72,3 +80,5 @@ if (msg.hasOwnProperty("serviceDate")) {
// XDSDocumentEntryType (OPTIONAL) [0..*]
var docEntryType = getXDSDocumentEntryType();
if (docEntryType) parameterList += docEntryType;

logger.info(baseLogMessage + "Generated query parameters: " + parameterList.toString());
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- expects to receive a single requests to be transmitted to the XCA ITI-39 [Cross Gateway Retrieve] Processor channel

Last updated: Nov 14 2023</description>
<revision>124</revision>
<revision>483</revision>
<sourceConnector version="4.4.2">
<metaDataId>0</metaDataId>
<name>sourceConnector</name>
Expand Down
Loading
Loading