@peopl-health/nexus 6.8.2 → 6.8.4
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.
|
@@ -174,7 +174,7 @@ const WHAT_CHANGED = ['new_symptom', 'higher_grade', 'new_red_flag', 'worse', 'p
|
|
|
174
174
|
const HOLDABLE_CHANGES = [ANSWER_ONLY, IMPROVING];
|
|
175
175
|
|
|
176
176
|
const WHAT_CHANGED_PROPERTY = nullableEnum(WHAT_CHANGED);
|
|
177
|
-
WHAT_CHANGED_PROPERTY.description = 'Solo en `update`: qué trae de nuevo. `answer_only` cuando el paciente solo respondió lo que se le preguntó y su respuesta no agrega síntoma, grado, bandera roja ni empeoramiento (por ejemplo «no tengo fiebre, puedo tragar»). Si el equipo ya decidió el caso, un `answer_only` sin subir el nivel queda anotado en el caso sin volver a avisar al equipo. `improving` cuando el
|
|
177
|
+
WHAT_CHANGED_PROPERTY.description = 'Solo en `update`: qué trae de nuevo. `answer_only` cuando el paciente solo respondió lo que se le preguntó y su respuesta no agrega síntoma, grado, bandera roja ni empeoramiento (por ejemplo «no tengo fiebre, puedo tragar»). Si el equipo ya decidió el caso, un `answer_only` sin subir el nivel queda anotado en el caso sin volver a avisar al equipo. `improving` cuando el síntoma ya escalado se resolvió o bajó de grado, o ya no tiene lo que motivó el nivel, sin síntoma nuevo, sin bandera roja y sin nada que empeore (por ejemplo «ya estoy bien», «ya no me duele la garganta, solo quedó la ronquera»); si sigue igual, no es `improving`. Un `improving` con `urgent` queda anotado en el caso, abierto o cerrado en los últimos 7 días, sin volver a avisar al equipo; si el síntoma sigue presente y todavía necesita al equipo en asap o stat, deja ese nivel y el equipo recibe el aviso. En un update nunca uses `routine`: abre una solicitud aparte y la mejoría no queda en el caso. No aplica a la fiebre. Ante cualquier duda usa el valor que corresponda o `null`: nunca `answer_only` ni `improving` si algo empeoró, apareció algo nuevo o la mejoría es solo parcial con un dato que preocupa.';
|
|
178
178
|
|
|
179
179
|
const FEVER_RULED_OUT_PROPERTY = nullable({
|
|
180
180
|
'type': 'boolean',
|
|
@@ -116,6 +116,7 @@ const ALERT_OPERATOR = 'bot:escalationAlert';
|
|
|
116
116
|
const AIRTABLE_TRANSPORT = 'airtable';
|
|
117
117
|
const NOT_RECORDED = 'no se registró en Airtable';
|
|
118
118
|
const RECLASSIFIABLE_STATUSES = [...DOCUMENTING_STATUSES, 'awaiting_doctor'];
|
|
119
|
+
const FOLLOWUP_CALL_STATUSES = [...FOLLOWUP_STATUSES, 'approved', 'needs_intervention'];
|
|
119
120
|
const SAME_URGENCY = 'The review is already at that urgency';
|
|
120
121
|
const STAT_WATCH = 'A stat case is not watched at home; lower its urgency with a reason first';
|
|
121
122
|
const RECLASSIFY_CHANGED = 'The review changed while you were reclassifying it; read it again before changing the urgency';
|
|
@@ -635,7 +636,7 @@ const notAboveCase = (review, alarm, alarmsOf = (of) => of.alarms ?? []) => {
|
|
|
635
636
|
return Boolean(decided) && (URGENCY_RANK[alarm.urgencyLevel] || 0) <= (URGENCY_RANK[decided] || 0);
|
|
636
637
|
};
|
|
637
638
|
const isImprovingUpdate = (alarm, mode) => mode === 'update' && alarm.whatChanged === IMPROVING;
|
|
638
|
-
const isQuietImprovement = (review, alarm) => alarm.category !== FEVER_CATEGORY
|
|
639
|
+
const isQuietImprovement = (review, alarm) => alarm.category !== FEVER_CATEGORY && !ALERTED_URGENCIES.includes(alarm.urgencyLevel)
|
|
639
640
|
&& !(review.alarms ?? []).some(isLiveFeverOf(review))
|
|
640
641
|
&& !((review.drafts ?? []).at(-1)?.urgentPresentRedFlags?.length);
|
|
641
642
|
const decidedEpisodeOf = (review) => {
|
|
@@ -988,6 +989,9 @@ async function appendWithDoctor(id, entry) {
|
|
|
988
989
|
throw httpError(409, STATUS_CONFLICT);
|
|
989
990
|
}
|
|
990
991
|
|
|
992
|
+
// After the decision the call keeps the status; it flags the case and refreshes the follow-up summary, which is where the team reads it.
|
|
993
|
+
const appendInFollowUp = (id, entry) => updateReview(id, FOLLOWUP_CALL_STATUSES, { $push: { callLogs: entry }, $set: { updatedSinceSeen: true, ...redraftAfterCall() } });
|
|
994
|
+
|
|
991
995
|
async function setReviewCases({ id, patientCaseRecordIds, updatedBy, requestId = null } = {}) {
|
|
992
996
|
const reviewId = reviewIdOf(id);
|
|
993
997
|
const operator = requiredText(updatedBy, 'updatedBy');
|
|
@@ -1058,10 +1062,11 @@ async function addCallLog({ id, outcome, notes = null, calledAt = null, loggedBy
|
|
|
1058
1062
|
const review = await (outcome === 'contacted'
|
|
1059
1063
|
? updateReview(reviewId, DOCUMENTING_STATUSES, { $push: { callLogs: entry }, $set: { status: 'documenting', ...redraftAfterCall() } })
|
|
1060
1064
|
: appendKeepingDraft(reviewId, entry))
|
|
1061
|
-
.catch((error) => (error.statusCode === 409 ? appendWithDoctor(reviewId, entry) : Promise.reject(error)))
|
|
1065
|
+
.catch((error) => (error.statusCode === 409 ? appendWithDoctor(reviewId, entry) : Promise.reject(error)))
|
|
1066
|
+
.catch((error) => (error.statusCode === 409 ? appendInFollowUp(reviewId, entry) : Promise.reject(error)));
|
|
1062
1067
|
await audit(review, operator, requestId, { action: 'call_logged', outcome });
|
|
1063
|
-
// Note facts are confirmed only while the case is documented, so none are proposed
|
|
1064
|
-
if (outcome !== 'contacted' || review.status
|
|
1068
|
+
// Note facts are confirmed only while the case is documented, so none are proposed once it reached the doctor.
|
|
1069
|
+
if (outcome !== 'contacted' || !DOCUMENTING_STATUSES.includes(review.status)) return review;
|
|
1065
1070
|
return proposeNoteFacts(review, operator, requestId);
|
|
1066
1071
|
}
|
|
1067
1072
|
|