@peopl-health/nexus 5.59.0 → 5.59.2
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.
|
@@ -28,9 +28,9 @@ function nonClinicalRequestSchema() {
|
|
|
28
28
|
description: [
|
|
29
29
|
'Declara que el mensaje NO trae contenido clínico y que lo contestas tú directamente, sin el equipo.',
|
|
30
30
|
'- external_booking: agendar, reprogramar o cancelar una cita con un médico, una sesión de tratamiento (quimio, radio, infusión) o un estudio de laboratorio o imagen.',
|
|
31
|
-
...(conversational ? ['- conversational: el mensaje es solo conversación (saludo, agradecimiento, acuse, despedida) y no pide nada. Se contesta con un cierre breve, sin routing.'] : []),
|
|
31
|
+
...(conversational ? ['- conversational: el mensaje es solo conversación (saludo, agradecimiento, acuse, despedida) y no pide nada. Se contesta con un cierre breve, sin routing. NO es conversacional la respuesta a una propuesta del `[equipo]` (acepta, elige, rechaza o pide cambiar un día u horario que el equipo ofreció): eso deja un pendiente para el equipo.'] : []),
|
|
32
32
|
'Va con `detected_tags` vacío. Si el mensaje también menciona un síntoma, emoción, medicamento, tratamiento o resultado, etiqueta esas variables y manda `null` aquí.',
|
|
33
|
-
'Manda `null` cuando la petición necesita que el equipo actúe (p. ej. una sesión del programa de acompañamiento de AUNA) y cuando el paciente solo cuenta que tiene una cita.',
|
|
33
|
+
'Manda `null` cuando la petición necesita que el equipo actúe (p. ej. una sesión del programa de acompañamiento de AUNA, también cuando el paciente acepta o elige un horario que propuso el `[equipo]`; regístralo con `reportUnresolvedRequestv2`) y cuando el paciente solo cuenta que tiene una cita.',
|
|
34
34
|
'Con este campo, `bridge_text` va en `null`: la respuesta es un solo mensaje.',
|
|
35
35
|
].join('\n'),
|
|
36
36
|
};
|
|
@@ -4,7 +4,7 @@ const { logger } = require('../../utils/logger');
|
|
|
4
4
|
|
|
5
5
|
const definition = {
|
|
6
6
|
'name': 'reportUnresolvedRequestv2',
|
|
7
|
-
'description': '**Does:** Escalates ADMINISTRATIVE / OPERATIVE matters — and non-clinical referrals to other services (psico-oncología, paliativos, non-oncology medical) — to the appropriate team queue. Records what was left pending, why it needs the team, operational urgency, and what was already communicated to the patient. It carries NO clinical-escalation semantics for the patient\'s oncology condition — those go to `reportMedicalEscalation`.\n\n**Required inputs:** `unresolved_question`, `category` (operational routing — REQUIRED for the queue), `urgency` (`routine` | `soon` | `urgent`; default `routine`), `escalation_details`, `resolution_attempted` (bool), `for_doctor_office` (bool: `true` only for a request your instructions route to the treating doctor or their office, otherwise `false`).\n\n**When to call:**\n- Administrative matter the team has to act on (insurance / authorisations / letters / transport), including scheduling or rescheduling a session of the AUNA accompaniment program (psico-oncología, nutrición).\n- Patient request that needs human (non-clinical) intervention.\n- Outside the agent\'s scope or knowledge (non-clinical).\n- A routine referral (psico-oncología, paliativos).\n- Callback from a specific team member (`category=contact_team_member`), or enrollment in a program / workshop / support group (`category=program_enrollment`).\n- Something the patient\'s own doctor or their office has to answer or do that is not symptom care — a report, letter or insurance form, a prescription or premedication the doctor already indicated, a payment receipt, an administrative question for the office: keep the category that describes it and set `for_doctor_office: true` when your instructions route it to that office. Asking for a prescription or an indication the doctor already gave is an administrative request, not a treatment concern. Symptom management belongs to the accompaniment program, not to the office: a symptom, a side effect, whether or how to take a medication, or a prescription or study the patient wants because of a symptom still goes to `reportMedicalEscalation` — never here with `for_doctor_office: true` — even when the patient asks for their doctor to see, review or answer it. A study, result, image or file the patient shares still goes to `reportResultsReceived`, even when they ask for it to reach the doctor. Never tell the patient to write to the doctor or the secretary themselves.\nAlways pair with a `DeliverPatientMessage` acknowledging the escalation.\n\n**When NOT to call:**\n- ANY medical escalation — confirmed emergency, same-day evaluation, OR an asynchronous clinical concern (a symptom persisting >72h, a worrying trend, a treatment concern, stale clinical context) — use `reportMedicalEscalation` (urgency_level stat | asap | urgent | routine).\n- Active mental-health crisis — use `reportCrisis`.\n- Patient SHARED results / values / files — use `reportResultsReceived`.\n- Booking, rescheduling or cancelling a doctor appointment, a treatment session (chemo / radiotherapy / infusion) or a lab / imaging study — these are not booked through this channel; answer the patient directly with where to book, as your instructions describe. When that turn carries no clinical content, declare it with `non_clinical_request` in `extractClinicalInfo`.\n- Questions answerable from the CTCAE catalog or skill protocols — answer directly.\n\n**Returns:** an ack ({} on the happy path). Out-of-enum `urgency`/`category` are coerced (to `routine`/`other`) and disclosed via `coerced_urgency`/`coerced_category`; inputs over 500 chars are truncated and disclosed via `truncated_fields`. If the escalation could not be queued to the team it comes back with `queued: false` — do NOT tell the patient the team was notified in that case; acknowledge and say you are still working on it.\n\n**Side effects:** Emits `OUT_OF_SCOPE_LOGGED` to the appropriate team queue.',
|
|
7
|
+
'description': '**Does:** Escalates ADMINISTRATIVE / OPERATIVE matters — and non-clinical referrals to other services (psico-oncología, paliativos, non-oncology medical) — to the appropriate team queue. Records what was left pending, why it needs the team, operational urgency, and what was already communicated to the patient. It carries NO clinical-escalation semantics for the patient\'s oncology condition — those go to `reportMedicalEscalation`.\n\n**Required inputs:** `unresolved_question`, `category` (operational routing — REQUIRED for the queue), `urgency` (`routine` | `soon` | `urgent`; default `routine`), `escalation_details`, `resolution_attempted` (bool), `for_doctor_office` (bool: `true` only for a request your instructions route to the treating doctor or their office, otherwise `false`).\n\n**When to call:**\n- Administrative matter the team has to act on (insurance / authorisations / letters / transport), including scheduling or rescheduling a session of the AUNA accompaniment program (psico-oncología, nutrición).\n- The patient accepts, picks, declines or asks to change a day or time the team (`[equipo]`) proposed for an AUNA program session (`category=scheduling`). In `unresolved_question` record what the team offered and the patient\'s answer: the day and time they accepted, the alternative they asked for, or that they declined. That reply is not small talk: the team still has to book the slot, offer another one or close the offer.\n- Patient request that needs human (non-clinical) intervention.\n- Outside the agent\'s scope or knowledge (non-clinical).\n- A routine referral (psico-oncología, paliativos).\n- Callback from a specific team member (`category=contact_team_member`), or enrollment in a program / workshop / support group (`category=program_enrollment`).\n- Something the patient\'s own doctor or their office has to answer or do that is not symptom care — a report, letter or insurance form, a prescription or premedication the doctor already indicated, a payment receipt, an administrative question for the office: keep the category that describes it and set `for_doctor_office: true` when your instructions route it to that office. Asking for a prescription or an indication the doctor already gave is an administrative request, not a treatment concern. Symptom management belongs to the accompaniment program, not to the office: a symptom, a side effect, whether or how to take a medication, or a prescription or study the patient wants because of a symptom still goes to `reportMedicalEscalation` — never here with `for_doctor_office: true` — even when the patient asks for their doctor to see, review or answer it. A study, result, image or file the patient shares still goes to `reportResultsReceived`, even when they ask for it to reach the doctor. Never tell the patient to write to the doctor or the secretary themselves.\nAlways pair with a `DeliverPatientMessage` acknowledging the escalation.\n\n**When NOT to call:**\n- ANY medical escalation — confirmed emergency, same-day evaluation, OR an asynchronous clinical concern (a symptom persisting >72h, a worrying trend, a treatment concern, stale clinical context) — use `reportMedicalEscalation` (urgency_level stat | asap | urgent | routine).\n- Active mental-health crisis — use `reportCrisis`.\n- Patient SHARED results / values / files — use `reportResultsReceived`.\n- Booking, rescheduling or cancelling a doctor appointment, a treatment session (chemo / radiotherapy / infusion) or a lab / imaging study — these are not booked through this channel; answer the patient directly with where to book, as your instructions describe. When that turn carries no clinical content, declare it with `non_clinical_request` in `extractClinicalInfo`.\n- Questions answerable from the CTCAE catalog or skill protocols — answer directly.\n\n**Returns:** an ack ({} on the happy path). Out-of-enum `urgency`/`category` are coerced (to `routine`/`other`) and disclosed via `coerced_urgency`/`coerced_category`; inputs over 500 chars are truncated and disclosed via `truncated_fields`. If the escalation could not be queued to the team it comes back with `queued: false` — do NOT tell the patient the team was notified in that case; acknowledge and say you are still working on it.\n\n**Side effects:** Emits `OUT_OF_SCOPE_LOGGED` to the appropriate team queue.',
|
|
8
8
|
'strict': true,
|
|
9
9
|
'parameters': {
|
|
10
10
|
'type': 'object',
|
|
@@ -32,7 +32,7 @@ const definition = {
|
|
|
32
32
|
'program_enrollment',
|
|
33
33
|
'other'
|
|
34
34
|
],
|
|
35
|
-
'description': 'Categoría operativa/administrativa o de derivación del pendiente para ruteo. `scheduling` = agendar o reprogramar sesiones del programa de acompañamiento de AUNA (no citas médicas, sesiones de tratamiento ni estudios). `contact_team_member` = el paciente quiere hablar con / pasar un mensaje a / que lo llame de vuelta un miembro del equipo. `program_enrollment` = inscribirse a charlas, talleres, grupos de apoyo o check-ups. Las categorías de ESCALACIÓN CLÍNICA (symptom_persistent, treatment_concern, stale_context) se retiraron — esas escalaciones van por `reportMedicalEscalation`.'
|
|
35
|
+
'description': 'Categoría operativa/administrativa o de derivación del pendiente para ruteo. `scheduling` = agendar, confirmar o reprogramar sesiones del programa de acompañamiento de AUNA, también cuando el paciente acepta, rechaza o pide cambiar un horario que propuso el `[equipo]` (no citas médicas, sesiones de tratamiento ni estudios). `contact_team_member` = el paciente quiere hablar con / pasar un mensaje a / que lo llame de vuelta un miembro del equipo. `program_enrollment` = inscribirse a charlas, talleres, grupos de apoyo o check-ups. Las categorías de ESCALACIÓN CLÍNICA (symptom_persistent, treatment_concern, stale_context) se retiraron — esas escalaciones van por `reportMedicalEscalation`.'
|
|
36
36
|
},
|
|
37
37
|
'resolution_attempted': {
|
|
38
38
|
'anyOf': [
|
|
@@ -1191,7 +1191,7 @@ async function closeEscalationReview({ id, closedBy, deliveryConfirmed = false,
|
|
|
1191
1191
|
await audit(review, operator, requestId, closeChanges);
|
|
1192
1192
|
} catch (error) {
|
|
1193
1193
|
logger.error('[EscalationReview] The review closed but its audit entry was not written', {
|
|
1194
|
-
escalationReviewId: String(review._id), error: redactedError(error),
|
|
1194
|
+
escalationReviewId: String(review._id), error: redactedError(error), stack: redactedStack(error),
|
|
1195
1195
|
});
|
|
1196
1196
|
}
|
|
1197
1197
|
await recordEpisode(review);
|