@peopl-health/nexus 6.4.3 → 6.5.0-dev.19126

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.
@@ -40,9 +40,6 @@ const SENTINELS = [
40
40
  /^no (he recibido|tengo) (alguno|ningun[oa])( mas)?$/,
41
41
  ];
42
42
 
43
- // A bare «Sí» to the allergy question says there is one, so it stays as an unnamed allergy.
44
- const UNNAMED_ALLERGY = 'Alergia a medicamentos referida, sin especificar';
45
-
46
43
  const clean = (s) => sanitizeInlineText(s, Infinity);
47
44
  const fold = (s) => foldAccents(clean(s)).toLowerCase().replace(/[.;,]+$/, '');
48
45
  const isSentinel = (s) => SENTINELS.some((re) => re.test(fold(s)));
@@ -76,9 +73,8 @@ function candidatesFor(record) {
76
73
  // 394 patients hold both keys; written separately the second arbitrates the first into `alternates`.
77
74
  const perVariable = new Map();
78
75
  for (const [key, variableId] of Object.entries(FIELD_MAP)) {
79
- const written = clean(clinical[key]);
80
- if (!written) continue;
81
- const value = key === 'alergias_medicamentos' && fold(written) === 'si' ? UNNAMED_ALLERGY : written;
76
+ const value = clean(clinical[key]);
77
+ if (!value) continue;
82
78
  if (isSentinel(value)) { out.sentinels[key] = (out.sentinels[key] || 0) + 1; continue; }
83
79
  const bucket = perVariable.get(variableId) || [];
84
80
  if (bucket.some((held) => fold(held) === fold(value))) continue;
@@ -310,10 +310,7 @@ async function lastChatMessage(code) {
310
310
  return last;
311
311
  }
312
312
 
313
- const LINK = /https?:\/\/\S+|www\.\S+/gi;
314
-
315
- // A «?» inside a link («…?id=») is no question.
316
- const hasOpenQuestion = (last) => Boolean(last?.from_me && String(last.body ?? '').replace(LINK, ' ').includes('?'));
313
+ const hasOpenQuestion = (last) => Boolean(last?.from_me && String(last.body ?? '').includes('?'));
317
314
 
318
315
  // In urgent, a patient who left the bot's question unanswered gets one reminder, held for the team day at night.
319
316
  async function remindQuietPatient(review, clock, now) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "6.4.3",
3
+ "version": "6.5.0-dev.19126",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",