@peopl-health/nexus 5.61.0-dev.11186 → 5.61.0-dev.11231
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.
- package/lib/clinical/AssistantProcessor.js +0 -16
- package/lib/clinical/config/subAgentsConfig.js +7 -1
- package/lib/clinical/models/supportLightModel.js +19 -1
- package/lib/clinical/services/escalationDraftService.js +3 -17
- package/lib/clinical/services/gradeSourceService.js +33 -8
- package/lib/clinical/services/supportLightEvaluationService.js +159 -0
- package/lib/clinical/services/treatmentProposalService.js +2 -7
- package/lib/clinical/tools/getActiveSymptomLandscapeTool.js +1 -1
- package/lib/clinical/tools/reportMedicalEscalationTool.js +0 -3
- package/lib/config/lifecycle.js +1 -4
- package/lib/controllers/escalationReviewController.js +0 -15
- package/lib/controllers/messageController.js +1 -21
- package/lib/index.d.ts +33 -14
- package/lib/index.js +2 -20
- package/lib/models/escalationReviewModel.js +2 -64
- package/lib/routes/index.js +0 -2
- package/lib/services/escalationReviewService.js +45 -614
- package/lib/services/patientTaskService.js +0 -1
- package/package.json +1 -1
- package/lib/clinical/helpers/reviewUpdateHelper.js +0 -74
- package/lib/services/reviewAlertSweepService.js +0 -88
- package/lib/services/reviewDraftSweepService.js +0 -79
|
@@ -10,9 +10,8 @@ const HANDOFF_MODES = ['sent_whatsapp', 'copied'];
|
|
|
10
10
|
const INTERRUPTED_STATUSES = ['handing_off', 'sending'];
|
|
11
11
|
const CANCELLABLE_AFTER_HANDOFF_STATUSES = ['awaiting_doctor', 'approved', 'returned', 'indications_queued'];
|
|
12
12
|
const CANCELLABLE_STATUSES = ['open', 'documenting', 'draft_ready', ...CANCELLABLE_AFTER_HANDOFF_STATUSES];
|
|
13
|
-
const DOCTOR_DECISIONS = ['approved', 'edited_approved', 'needs_intervention', 'returned'
|
|
14
|
-
const DECISION_SOURCES = ['platform', 'registered_by_navigator'
|
|
15
|
-
const RETURN_REASONS = ['llamar', 'falta_dato', 'no_requiere'];
|
|
13
|
+
const DOCTOR_DECISIONS = ['approved', 'edited_approved', 'needs_intervention', 'returned'];
|
|
14
|
+
const DECISION_SOURCES = ['platform', 'registered_by_navigator'];
|
|
16
15
|
|
|
17
16
|
const alarmSchema = new mongoose.Schema({
|
|
18
17
|
urgencyLevel: { type: String, enum: URGENCY_LEVELS, required: true },
|
|
@@ -22,41 +21,9 @@ const alarmSchema = new mongoose.Schema({
|
|
|
22
21
|
suspectedCondition: { type: String, default: null },
|
|
23
22
|
recommendedAction: { type: String, default: null },
|
|
24
23
|
justification: { type: String, default: null },
|
|
25
|
-
indicators: { type: [String], default: undefined },
|
|
26
|
-
turnId: { type: String, default: null },
|
|
27
24
|
raisedAt: { type: Date, required: true },
|
|
28
25
|
}, { _id: false });
|
|
29
26
|
|
|
30
|
-
const impressionUpdateSchema = new mongoose.Schema({
|
|
31
|
-
caseId: { type: String, default: null },
|
|
32
|
-
ctcaeTerm: { type: String, default: null },
|
|
33
|
-
event: { type: String, default: null },
|
|
34
|
-
grade: { type: Number, default: null },
|
|
35
|
-
trajectory: { type: String, default: null },
|
|
36
|
-
missingForHigherGrade: { type: String, default: null },
|
|
37
|
-
checkInQuestion: { type: String, default: null },
|
|
38
|
-
}, { _id: false });
|
|
39
|
-
|
|
40
|
-
const doctorAlertSchema = new mongoose.Schema({
|
|
41
|
-
kind: { type: String, enum: ['initial', 'realert'], required: true },
|
|
42
|
-
urgencyLevel: { type: String, enum: URGENCY_LEVELS, default: null },
|
|
43
|
-
physicianEmail: { type: String, default: null },
|
|
44
|
-
transport: { type: String, default: null },
|
|
45
|
-
messageId: { type: String, default: null },
|
|
46
|
-
error: { type: String, default: null },
|
|
47
|
-
teamAlerted: { type: Boolean, default: false },
|
|
48
|
-
sentAt: { type: Date, required: true },
|
|
49
|
-
}, { _id: false });
|
|
50
|
-
|
|
51
|
-
const reviewUpdateSchema = new mongoose.Schema({
|
|
52
|
-
turnId: { type: String, required: true },
|
|
53
|
-
tools: { type: [String], default: [] },
|
|
54
|
-
patientText: { type: String, default: null },
|
|
55
|
-
impressions: { type: [impressionUpdateSchema], default: [] },
|
|
56
|
-
safetyFlags: { type: [String], default: [] },
|
|
57
|
-
at: { type: Date, required: true },
|
|
58
|
-
}, { _id: false });
|
|
59
|
-
|
|
60
27
|
const noteFactSchema = new mongoose.Schema({
|
|
61
28
|
variableId: { type: String, required: true },
|
|
62
29
|
concept: { type: String, default: null },
|
|
@@ -77,21 +44,10 @@ const callLogSchema = new mongoose.Schema({
|
|
|
77
44
|
loggedBy: { type: String, required: true },
|
|
78
45
|
}, { timestamps: { createdAt: true, updatedAt: false } });
|
|
79
46
|
|
|
80
|
-
const suggestCallSchema = new mongoose.Schema({
|
|
81
|
-
value: { type: Boolean, required: true },
|
|
82
|
-
reason: { type: String, default: null },
|
|
83
|
-
}, { _id: false });
|
|
84
|
-
|
|
85
47
|
const draftSchema = new mongoose.Schema({
|
|
86
48
|
doctorText: { type: String, required: true },
|
|
87
49
|
patientMessage: { type: String, required: true },
|
|
88
50
|
writtenBy: { type: String, required: true },
|
|
89
|
-
protocolVersion: { type: String, default: null },
|
|
90
|
-
keyQuestions: { type: [String], default: undefined },
|
|
91
|
-
unassessedRedFlags: { type: [String], default: undefined },
|
|
92
|
-
missingCharacterization: { type: [String], default: undefined },
|
|
93
|
-
suggestCall: { type: suggestCallSchema, default: undefined },
|
|
94
|
-
sectionsUnavailable: { type: [String], default: undefined },
|
|
95
51
|
}, { timestamps: { createdAt: true, updatedAt: false } });
|
|
96
52
|
|
|
97
53
|
const doctorHandoffSchema = new mongoose.Schema({
|
|
@@ -112,8 +68,6 @@ const decisionSchema = new mongoose.Schema({
|
|
|
112
68
|
finalText: { type: String, default: null },
|
|
113
69
|
comment: { type: String, default: null },
|
|
114
70
|
doctorReply: { type: String, default: null },
|
|
115
|
-
returnReason: { type: String, enum: [...RETURN_REASONS, null], default: null },
|
|
116
|
-
warnings: { type: [String], default: undefined },
|
|
117
71
|
decidedBy: { type: String, required: true },
|
|
118
72
|
recordedBy: { type: String, required: true },
|
|
119
73
|
}, { timestamps: { createdAt: true, updatedAt: false } });
|
|
@@ -172,19 +126,6 @@ const escalationReviewSchema = new mongoose.Schema({
|
|
|
172
126
|
openedBy: { type: String, required: true },
|
|
173
127
|
assistantPausedByReview: { type: Boolean, default: false },
|
|
174
128
|
alarms: { type: [alarmSchema], default: [] },
|
|
175
|
-
updates: { type: [reviewUpdateSchema], default: [] },
|
|
176
|
-
updatedSinceSeen: { type: Boolean, default: false },
|
|
177
|
-
followUpCases: { type: [String], default: undefined },
|
|
178
|
-
// The decision the follow-up cases were fixed for; a later indication extends them.
|
|
179
|
-
followUpDecision: { type: Number, default: null },
|
|
180
|
-
draftDueAt: { type: Date, default: null },
|
|
181
|
-
draftAttempts: { type: Number, default: 0 },
|
|
182
|
-
doctorAlerts: { type: [doctorAlertSchema], default: [] },
|
|
183
|
-
doctorAlertDueAt: { type: Date, default: null },
|
|
184
|
-
doctorAlertKind: { type: String, enum: ['initial', 'realert', null], default: null },
|
|
185
|
-
doctorAlertAttempts: { type: Number, default: 0 },
|
|
186
|
-
approverViewedAt: { type: Date, default: null },
|
|
187
|
-
previousReviewId: { type: String, default: null },
|
|
188
129
|
callLogs: { type: [callLogSchema], default: [] },
|
|
189
130
|
noteFacts: { type: [noteFactSchema], default: [] },
|
|
190
131
|
drafts: { type: [draftSchema], default: [] },
|
|
@@ -200,8 +141,6 @@ const escalationReviewSchema = new mongoose.Schema({
|
|
|
200
141
|
}, { timestamps: true });
|
|
201
142
|
|
|
202
143
|
escalationReviewSchema.index({ patientCode: 1, createdAt: -1 });
|
|
203
|
-
escalationReviewSchema.index({ draftDueAt: 1 }, { partialFilterExpression: { draftDueAt: { $type: 'date' } } });
|
|
204
|
-
escalationReviewSchema.index({ doctorAlertDueAt: 1 }, { partialFilterExpression: { doctorAlertDueAt: { $type: 'date' } } });
|
|
205
144
|
escalationReviewSchema.index({ patientCode: 1 }, { unique: true, partialFilterExpression: { closedAt: null } });
|
|
206
145
|
|
|
207
146
|
const getEscalationReview = () => {
|
|
@@ -219,7 +158,6 @@ module.exports = {
|
|
|
219
158
|
DOCTOR_DECISIONS,
|
|
220
159
|
HANDOFF_MODES,
|
|
221
160
|
INTERRUPTED_STATUSES,
|
|
222
|
-
RETURN_REASONS,
|
|
223
161
|
getEscalationReview,
|
|
224
162
|
escalationReviewSchema,
|
|
225
163
|
};
|
package/lib/routes/index.js
CHANGED
|
@@ -122,7 +122,6 @@ const escalationReviewRouteDefinitions = {
|
|
|
122
122
|
'POST /': 'openEscalationReviewController',
|
|
123
123
|
'GET /by-patient/:code': 'listEscalationReviewsController',
|
|
124
124
|
'GET /:id': 'getEscalationReviewController',
|
|
125
|
-
'GET /:id/timeline': 'getReviewTimelineController',
|
|
126
125
|
'POST /:id/cases': 'setEscalationReviewCasesController',
|
|
127
126
|
'POST /:id/call-logs': 'addEscalationReviewCallLogController',
|
|
128
127
|
'POST /:id/draft-suggestions': 'suggestEscalationReviewDraftController',
|
|
@@ -296,7 +295,6 @@ const builtInControllers = {
|
|
|
296
295
|
openEscalationReviewController: escalationReviewController.openEscalationReviewController,
|
|
297
296
|
listEscalationReviewsController: escalationReviewController.listEscalationReviewsController,
|
|
298
297
|
getEscalationReviewController: escalationReviewController.getEscalationReviewController,
|
|
299
|
-
getReviewTimelineController: escalationReviewController.getReviewTimelineController,
|
|
300
298
|
setEscalationReviewCasesController: escalationReviewController.setEscalationReviewCasesController,
|
|
301
299
|
addEscalationReviewCallLogController: escalationReviewController.addEscalationReviewCallLogController,
|
|
302
300
|
suggestEscalationReviewDraftController: escalationReviewController.suggestEscalationReviewDraftController,
|