@peopl-health/nexus 5.71.14 → 5.71.15
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.
|
@@ -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:
|
|
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
|
};
|
|
@@ -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: '
|
|
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 &&
|
|
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}
|
|
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),
|