@peopl-health/nexus 5.11.0-dev.1120 → 5.11.0-dev.1122
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/tools/analyzeSymptomPatternsTool.js +3 -6
- package/lib/clinical/tools/getActiveSymptomLandscapeTool.js +2 -2
- package/lib/clinical/tools/getPatientHistoryTool.js +1 -1
- package/lib/clinical/tools/openClusterHypothesisTool.js +3 -7
- package/lib/clinical/tools/openConditionTool.js +2 -2
- package/lib/clinical/tools/recordClinicalImpressionTool.js +1 -2
- package/lib/clinical/tools/recordInterventionTool.js +3 -5
- package/lib/clinical/tools/setContingencyPlanTool.js +3 -7
- package/lib/clinical/tools/submitSafetyGateTool.js +1 -5
- package/lib/clinical/tools/updateClusterHypothesisTool.js +4 -7
- package/lib/clinical/tools/updateConditionStatusTool.js +1 -2
- package/lib/fhir/constants/extensionSlugs.js +111 -0
- package/lib/fhir/resources/CarePlan.js +8 -7
- package/lib/fhir/resources/ClinicalImpression.js +39 -38
- package/lib/fhir/resources/CommunicationRequest.js +5 -4
- package/lib/fhir/resources/Condition.js +10 -9
- package/lib/fhir/resources/Observation.js +7 -6
- package/lib/fhir/resources/RiskAssessment.js +13 -12
- package/lib/fhir/resources/Task.js +4 -3
- package/lib/fhir/services/clusterService.js +9 -8
- package/lib/fhir/services/contingencyService.js +14 -11
- package/lib/fhir/services/palliativeService.js +23 -22
- package/lib/fhir/services/riskService.js +11 -10
- package/lib/fhir/services/routingService.js +10 -9
- package/lib/fhir/services/symptomCaseService.js +21 -20
- package/lib/shared/dtos/ClusterImpression.js +16 -5
- package/lib/shared/dtos/ContingencySafetyNet.js +3 -1
- package/lib/shared/dtos/Intervention.js +10 -3
- package/lib/shared/dtos/ManagedSymptom.js +15 -5
- package/package.json +1 -1
|
@@ -4,9 +4,14 @@ const { BaseDto } = require('./BaseDto');
|
|
|
4
4
|
|
|
5
5
|
const dateTime = z.iso.datetime({ offset: true });
|
|
6
6
|
|
|
7
|
+
const OPEN_STATUSES = ['characterizing', 'monitoring'];
|
|
8
|
+
const CLOSED_STATUSES = ['resolved', 'inactive', 'closed'];
|
|
9
|
+
const CLINICAL_STATUSES = [...OPEN_STATUSES, ...CLOSED_STATUSES];
|
|
10
|
+
const GRADE_CONFIDENCE_LEVELS = ['low', 'moderate', 'high'];
|
|
11
|
+
|
|
7
12
|
const gradeEstimateSchema = z.strictObject({
|
|
8
13
|
bestEstimate: z.number().int().min(1).max(5).nullable().default(null),
|
|
9
|
-
confidence: z.enum(
|
|
14
|
+
confidence: z.enum(GRADE_CONFIDENCE_LEVELS).nullable().default(null),
|
|
10
15
|
possibleRange: z.tuple([z.number().int().min(1).max(5), z.number().int().min(1).max(5)]).nullable().default(null),
|
|
11
16
|
reasoning: z.string().default(''),
|
|
12
17
|
})
|
|
@@ -23,7 +28,7 @@ const symptomConditionSchema = z.strictObject({
|
|
|
23
28
|
conditionId: z.string(),
|
|
24
29
|
patientId: z.string(),
|
|
25
30
|
ctcaeTerm: z.string(),
|
|
26
|
-
clinicalStatus: z.enum(
|
|
31
|
+
clinicalStatus: z.enum(CLINICAL_STATUSES).default('characterizing'),
|
|
27
32
|
onsetAt: dateTime,
|
|
28
33
|
abatementAt: dateTime.nullable().default(null),
|
|
29
34
|
closeReason: z.string().nullable().default(null),
|
|
@@ -35,8 +40,8 @@ const symptomConditionSchema = z.strictObject({
|
|
|
35
40
|
recurrenceCount: z.number().int().nonnegative().default(0),
|
|
36
41
|
reactivatedAt: dateTime.nullable().default(null),
|
|
37
42
|
})
|
|
38
|
-
.refine((c) => c.abatementAt === null ||
|
|
39
|
-
message:
|
|
43
|
+
.refine((c) => c.abatementAt === null || CLOSED_STATUSES.includes(c.clinicalStatus), {
|
|
44
|
+
message: `abatementAt requires a terminal clinicalStatus (${CLOSED_STATUSES.join('/')})`,
|
|
40
45
|
})
|
|
41
46
|
.refine((c) => c.abatementAt === null || new Date(c.abatementAt) >= new Date(c.onsetAt), {
|
|
42
47
|
message: 'abatementAt must be >= onsetAt',
|
|
@@ -72,4 +77,9 @@ class ManagedSymptom extends BaseDto {}
|
|
|
72
77
|
|
|
73
78
|
ManagedSymptom.schema = schema;
|
|
74
79
|
|
|
75
|
-
module.exports = {
|
|
80
|
+
module.exports = {
|
|
81
|
+
ManagedSymptom,
|
|
82
|
+
CLINICAL_STATUSES,
|
|
83
|
+
OPEN_STATUSES,
|
|
84
|
+
CLOSED_STATUSES,
|
|
85
|
+
};
|