Skip to content

Commit

Permalink
[PRMP-534] Formatting fixes (#81)
Browse files Browse the repository at this point in the history
Co-authored-by: Kris Bloe <[email protected]>
  • Loading branch information
chrisbloe-nhse and chrisbloe authored Jul 17, 2024
1 parent 07e5094 commit c215df0
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions src/templates/generate-ehr-acknowledgement.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,56 +15,56 @@ export const buildEhrAcknowledgementPayload = ({
logInfo('Building positive acknowledgement message with typeCode: AA');

return positiveAckMessageTemplate({
acknowledgementMessageId: acknowledgementMessageId.toUpperCase(),
timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'),
acknowledgementTypeCode: 'AA', // positive ACK
acknowledgedMessageId: acknowledgedMessageId.toUpperCase(),
receivingAsid,
sendingAsid
});
acknowledgementMessageId: acknowledgementMessageId.toUpperCase(),
timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'),
acknowledgementTypeCode: 'AA', // positive ACK
acknowledgedMessageId: acknowledgedMessageId.toUpperCase(),
receivingAsid,
sendingAsid
});
case '30': // negative ACK, unknown failure reason
case '99': // negative ACK, unknown failure reason
logInfo(
`Building negative acknowledgement message with typeCode: AE, errorCode: ${errorCode} and errorDisplayName: ${errorDisplayName}`
);

return negativeAckMessageTemplate({
acknowledgementMessageId: acknowledgementMessageId.toUpperCase(),
timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'),
acknowledgementTypeCode: 'AE', // negative ACK, unknown failure reason
acknowledgedMessageId: acknowledgedMessageId.toUpperCase(),
receivingAsid,
sendingAsid,
errorCode,
errorDisplayName
acknowledgementMessageId: acknowledgementMessageId.toUpperCase(),
timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'),
acknowledgementTypeCode: 'AE', // negative ACK, unknown failure reason
acknowledgedMessageId: acknowledgedMessageId.toUpperCase(),
receivingAsid,
sendingAsid,
errorCode,
errorDisplayName
});
default: // negative ACK, known failure reason
logInfo(
`Building negative acknowledgement message with typeCode: AR and errorCode: ${errorCode} and errorDisplayName: ${errorDisplayName}`
);

return negativeAckMessageTemplate({
acknowledgementMessageId: acknowledgementMessageId.toUpperCase(),
timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'),
acknowledgementTypeCode: 'AR', // negative ACK, known failure reason
acknowledgedMessageId: acknowledgedMessageId.toUpperCase(),
receivingAsid,
sendingAsid,
errorCode,
errorDisplayName
acknowledgementMessageId: acknowledgementMessageId.toUpperCase(),
timestamp: dateFormat(Date.now(), 'yyyymmddHHMMss'),
acknowledgementTypeCode: 'AR', // negative ACK, known failure reason
acknowledgedMessageId: acknowledgedMessageId.toUpperCase(),
receivingAsid,
sendingAsid,
errorCode,
errorDisplayName
});
}
};

const positiveAckMessageTemplate = ({
acknowledgementMessageId,
timestamp,
acknowledgementTypeCode,
acknowledgedMessageId,
receivingAsid,
sendingAsid,
}) =>
`<MCCI_IN010000UK13 xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 ..SchemasMCCI_IN010000UK13.xsd">
acknowledgementMessageId,
timestamp,
acknowledgementTypeCode,
acknowledgedMessageId,
receivingAsid,
sendingAsid
}) =>
`<MCCI_IN010000UK13 xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 ..SchemasMCCI_IN010000UK13.xsd">
<id root="${acknowledgementMessageId}" />
<creationTime value="${timestamp}" />
<versionCode code="V3NPfIT4.2.00" />
Expand Down Expand Up @@ -98,17 +98,17 @@ const positiveAckMessageTemplate = ({
</ControlActEvent>
</MCCI_IN010000UK13>`;

const negativeAckMessageTemplate = ({
acknowledgementMessageId,
timestamp,
acknowledgementTypeCode,
acknowledgedMessageId,
receivingAsid,
sendingAsid,
errorCode, // not in a positive ack
errorDisplayName // not in a positive ack
}) =>
`<MCCI_IN010000UK13 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" type="Message" xmlns="urn:hl7-org:v3">
const negativeAckMessageTemplate = ({
acknowledgementMessageId,
timestamp,
acknowledgementTypeCode,
acknowledgedMessageId,
receivingAsid,
sendingAsid,
errorCode, // not in a positive ack
errorDisplayName // not in a positive ack
}) =>
`<MCCI_IN010000UK13 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" type="Message" xmlns="urn:hl7-org:v3">
<id root="${acknowledgementMessageId}" />
<creationTime value="${timestamp}" />
<versionCode code="V3NPfIT3.1.10" />
Expand Down Expand Up @@ -152,4 +152,4 @@ const positiveAckMessageTemplate = ({
</justifyingDetectedIssueEvent>
</reason>
</ControlActEvent>
</MCCI_IN010000UK13>`;
</MCCI_IN010000UK13>`;

0 comments on commit c215df0

Please sign in to comment.