@peopl-health/nexus 5.71.14 → 5.71.16

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.
@@ -94,6 +94,19 @@ const DIMENSION_ES = {
94
94
  amount: 'cantidad',
95
95
  };
96
96
 
97
+ const ADHERENCE_ES = {
98
+ full: 'la siguió',
99
+ partial: 'la siguió en parte',
100
+ none: 'no la siguió',
101
+ };
102
+
103
+ const CHANGE_ES = {
104
+ improved: 'mejoró',
105
+ unchanged: 'sigue igual',
106
+ worsened: 'empeoró',
107
+ mixed: 'mixto',
108
+ };
109
+
97
110
  const GRADE_BASIS_ES = {
98
111
  composite: 'la tabla compuesta del PRO-CTCAE resolvió el grado con las respuestas de arriba',
99
112
  presence: 'sólo se preguntó si el síntoma estaba presente; el grado no sale de una escala de severidad',
@@ -272,9 +285,9 @@ function buildAdherenceBlock(priorResolutions = []) {
272
285
  .map((row) => {
273
286
  const symptom = row.symptoms_patient_facing || row.element_name_short || 'sin síntoma registrado';
274
287
  const recommendation = row.patient_main_recommendation || 'sin texto registrado';
275
- const adherence = row.adherence_level || 'sin respuesta';
276
- const change = row.symptom_change || 'sin respuesta';
277
- return `- Síntoma(s): ${symptom} · Recomendación previa: ${recommendation} · Adherencia reportada: ${adherence} · Cambio del síntoma: ${change}`;
288
+ const adherence = ADHERENCE_ES[row.adherence_level] || row.adherence_level || 'sin respuesta';
289
+ const change = CHANGE_ES[row.symptom_change] || row.symptom_change || 'sin respuesta';
290
+ return `- Síntoma(s): ${symptom} · Recomendación previa: ${recommendation} · Adherencia reportada: ${adherence} · Cambio que reportó después de esa recomendación: ${change}`;
278
291
  })
279
292
  .join('\n');
280
293
  }
@@ -13,7 +13,8 @@ const { redactDirectIdentifiers } = require('../../utils/sanitizerUtils');
13
13
  const { withTimeout } = require('../../utils/timeoutUtils');
14
14
  const { composePrompt } = require('./promptComposerService');
15
15
 
16
- const FLOOR_LEVELS = ['asap', 'stat'];
16
+ const FLOOR_LEVELS = ['urgent', 'asap', 'stat'];
17
+ const FLOOR_CEILING = 'urgent';
17
18
  const PATTERN_NAME = /^[a-z0-9_]{1,64}$/;
18
19
  const UNLABELLED_PATTERN = 'sin_etiqueta';
19
20
  const MAX_TEXT_LENGTH = 500;
@@ -120,7 +121,7 @@ async function evaluatePatternFloor({ code, turnId, details, justification, prov
120
121
  return degraded('unsupported_level', check);
121
122
  }
122
123
  return {
123
- floor: { level: parsed.min_level, pattern: normalizePattern(parsed.pattern), evidence: clippedText(parsed.evidence), reason: clippedText(parsed.reason) },
124
+ floor: { level: FLOOR_CEILING, pattern: normalizePattern(parsed.pattern), evidence: clippedText(parsed.evidence), reason: clippedText(parsed.reason) },
124
125
  degraded: null,
125
126
  check,
126
127
  };
@@ -31,7 +31,7 @@ function trendReadings(catalog, gradeByKey, priorResolutions, openCases) {
31
31
  readings.push({
32
32
  keys: String(row?.ctcae_terms ?? '').split(',').flatMap((term) => aliasClosure(catalog, term)),
33
33
  trend: CHANGE_TREND[change],
34
- reading: `${change} (cambio reportado de la tarjeta previa)`,
34
+ reading: `${change} (cambio reportado después de la tarjeta previa)`,
35
35
  });
36
36
  }
37
37
  for (const managed of openCases) {
@@ -5,7 +5,7 @@ const { redactDirectIdentifiers } = require('../../utils/sanitizerUtils');
5
5
 
6
6
  const HOUR_MS = 60 * 60 * 1000;
7
7
  const LOOKBACK_MS = 24 * HOUR_MS;
8
- const ROUTE_FLOOR = { emergencia: 'stat', urgencias: 'asap', equipo_tratante_hoy: 'asap' };
8
+ const ROUTE_FLOOR = { emergencia: 'stat', urgencias: 'asap', equipo_tratante_hoy: 'urgent' };
9
9
  const DEFAULT_FLOOR = 'asap';
10
10
  const PROMPT_ROUTES = ['urgencias', 'emergencia'];
11
11
  const NO_FLOOR = { floor: null, degraded: null };
@@ -336,7 +336,7 @@ async function handler(args, context = {}) {
336
336
  const gateFloor = gateCheck?.floor || null;
337
337
  const raisedByGate = Boolean(gateFloor) && (URGENCY_RANK[gateFloor.level] || 0) > (URGENCY_RANK[agentLevel] || 0);
338
338
  const flooredLevel = raisedByGate ? gateFloor.level : agentLevel;
339
- const patternCheck = clinicalPatternFloorLive() && runtime.patientCode && (URGENCY_RANK[flooredLevel] || 0) < URGENCY_RANK.stat
339
+ const patternCheck = clinicalPatternFloorLive() && runtime.patientCode && flooredLevel === 'routine'
340
340
  ? await clinicalPatternFloor({ code: runtime.patientCode, turnId: runtime.turnId, details, justification: args?.urgency_justification })
341
341
  : null;
342
342
  const patternFloor = patternCheck?.floor || null;
@@ -415,7 +415,7 @@ async function handler(args, context = {}) {
415
415
  documentation: [
416
416
  keptOpenLevel ? `Actualización: el bot sugirió ${requestedLevel}; se mantiene ${agentLevel}.` : '',
417
417
  raisedByGate ? `Piso del triaje: el gate de seguridad pidió acción en ${gateFloor.maxActionTimeHours ?? '<24'} h (${gateFloor.escalationRoute}); se aplica ${flooredLevel} aunque el bot sugirió ${agentLevel}.` : '',
418
- raisedByPattern ? `Piso clínico (${patternFloor.pattern}): ${patternFloor.reason || 'patrón de riesgo cumplido'}; se aplica ${urgencyLevel} en lugar de ${flooredLevel}${raisedByGate ? ' (nivel ya elevado por el triaje)' : ''}.` : '',
418
+ raisedByPattern ? `Piso clínico (${patternFloor.pattern}): ${patternFloor.reason || 'patrón de riesgo cumplido'}; se aplica ${urgencyLevel} en lugar de ${flooredLevel}.` : '',
419
419
  args?.urgency_justification || '',
420
420
  details.evidence_quote ? `Evidencia: «${details.evidence_quote}»` : '',
421
421
  assessmentNote(clinicalAssessment),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.71.14",
3
+ "version": "5.71.16",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",