@peopl-health/nexus 5.68.0-dev.12126 → 5.68.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,7 +23,6 @@ const {
|
|
|
23
23
|
const { getPatientAuditLog } = require('../models/patientAuditLogModel');
|
|
24
24
|
const { isWithin24HourWindow } = require('../helpers/conversationWindowHelper');
|
|
25
25
|
const { ensureWhatsAppFormat } = require('../helpers/twilioHelper');
|
|
26
|
-
const { sendMessage } = require('../core/NexusMessaging');
|
|
27
26
|
const { generateEscalationDraft } = require('../clinical/services/escalationDraftService');
|
|
28
27
|
const { conversationLink, recordEmergency, writeUnresolvedRequest } = require('../clinical/services/clinicalAirtableService');
|
|
29
28
|
const { renderDoctorMessage, templateSummary, withIdentity } = require('../clinical/helpers/doctorReviewMessageHelper');
|
|
@@ -39,6 +38,8 @@ const { getEscalationApprover, listEscalationApprovers } = require('./physicianS
|
|
|
39
38
|
const { switchThreadStoppedStatus } = require('./threadService');
|
|
40
39
|
const { effectiveUrgencyOf, responseDeadlineOf, responseDeadlinePolicy } = require('./reviewDeadlineService');
|
|
41
40
|
|
|
41
|
+
const getMessaging = () => require('../core/NexusMessaging');
|
|
42
|
+
|
|
42
43
|
const AUDIT_SOURCE = 'escalation_review';
|
|
43
44
|
const RECENT_REVIEW_LIMIT = 20;
|
|
44
45
|
const TIMELINE_LIMIT = 500;
|
|
@@ -367,7 +368,7 @@ async function sendDoctorAlert({ message, approver, operator }) {
|
|
|
367
368
|
const outgoing = inWindow
|
|
368
369
|
? { code: doctorCode, body: message.body, triggeredBy: operator }
|
|
369
370
|
: { code: doctorCode, contentSid: configured('ESCALATION_REVIEW_DOCTOR_ALERT_IDENTIFIED_CONTENT_SID'), variables: message.template, triggeredBy: operator };
|
|
370
|
-
const result = await sendMessage(outgoing);
|
|
371
|
+
const result = await getMessaging().sendMessage(outgoing);
|
|
371
372
|
if (!result?.success && !result?.completed) {
|
|
372
373
|
throw httpError(502, 'The WhatsApp message to the physician could not be sent');
|
|
373
374
|
}
|
|
@@ -1608,7 +1609,7 @@ async function sendApprovedIndications({ id, outsideWindowRoute = null, sentBy,
|
|
|
1608
1609
|
|
|
1609
1610
|
let result;
|
|
1610
1611
|
try {
|
|
1611
|
-
result = await sendMessage(message);
|
|
1612
|
+
result = await getMessaging().sendMessage(message);
|
|
1612
1613
|
const alreadyDelivered = result?.status === 'duplicate_suppressed' && result?.completed === true;
|
|
1613
1614
|
if (!result?.success && !alreadyDelivered) {
|
|
1614
1615
|
throw httpError(502, 'The indications could not be sent to the patient');
|