@peopl-health/nexus 5.72.16 → 5.72.17
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.
|
@@ -3,7 +3,9 @@ const { logger } = require('../utils/logger');
|
|
|
3
3
|
const { mapConcurrent } = require('../utils/concurrencyUtils');
|
|
4
4
|
const { mexicoClock, mexicoWeekStart } = require('../utils/dateUtils');
|
|
5
5
|
const { withTimeout } = require('../utils/timeoutUtils');
|
|
6
|
+
const { inlineOf } = require('../utils/coercionUtils');
|
|
6
7
|
const { createdBetween } = require('../helpers/airtableFormulaHelper');
|
|
8
|
+
const { isArchivedPatientCode } = require('../helpers/twilioHelper');
|
|
7
9
|
const { STATUS, worst, signatureOf, countBySignature, lastDigits, hoursAgo } = require('../helpers/healthHelper');
|
|
8
10
|
const { getTurnTraceModel } = require('../clinical/models/turnTraceModel');
|
|
9
11
|
|
|
@@ -93,7 +95,8 @@ async function checkWeeklyCoverage(now) {
|
|
|
93
95
|
]);
|
|
94
96
|
const covered = new Set(weeklies.flatMap((q) => q.patient_id || []));
|
|
95
97
|
// A patient whose first triage landed this week is not due a weekly until next Sunday.
|
|
96
|
-
const expected = patients.filter((p) => !(
|
|
98
|
+
const expected = patients.filter((p) => !isArchivedPatientCode(inlineOf(p.whatsapp_id))
|
|
99
|
+
&& !(p.first_triage_date_received && new Date(p.first_triage_date_received) >= weekStart));
|
|
97
100
|
const base = {
|
|
98
101
|
check: 'H2',
|
|
99
102
|
key: 'weekly_coverage',
|
|
@@ -9,7 +9,7 @@ const { PATIENT_CODE, redactDirectIdentifiers } = require('../utils/sanitizerUti
|
|
|
9
9
|
const { escapeFormulaValue, fieldEquals } = require('../helpers/airtableFormulaHelper');
|
|
10
10
|
const { isWithin24HourWindow } = require('../helpers/conversationWindowHelper');
|
|
11
11
|
const { prepareMessageMedia } = require('../helpers/mediaHelper');
|
|
12
|
-
const { ensureWhatsAppFormat } = require('../helpers/twilioHelper');
|
|
12
|
+
const { ensureWhatsAppFormat, isArchivedPatientCode } = require('../helpers/twilioHelper');
|
|
13
13
|
const { sendMessage } = require('../core/NexusMessaging');
|
|
14
14
|
|
|
15
15
|
const { getRecordByFilter } = require('./airtableService');
|
|
@@ -66,7 +66,7 @@ async function listOfficePatients({ requestedBy }) {
|
|
|
66
66
|
const patients = await getRecordByFilter(Estado_General_ID, 'estado_general', fieldEquals('doctor', assistant.doctor), undefined, PATIENT_FIELDS) || [];
|
|
67
67
|
|
|
68
68
|
return patients
|
|
69
|
-
.filter((patient) => inlineOf(patient.doctor) === assistant.doctor && inlineOf(patient.whatsapp_id))
|
|
69
|
+
.filter((patient) => inlineOf(patient.doctor) === assistant.doctor && inlineOf(patient.whatsapp_id) && !isArchivedPatientCode(inlineOf(patient.whatsapp_id)))
|
|
70
70
|
.map((patient) => ({ code: inlineOf(patient.whatsapp_id), name: inlineOf(patient.name) || null }))
|
|
71
71
|
.sort((a, b) => String(a.name ?? '').localeCompare(String(b.name ?? ''), 'es'));
|
|
72
72
|
}
|