@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.
Files changed (30) hide show
  1. package/lib/clinical/tools/analyzeSymptomPatternsTool.js +3 -6
  2. package/lib/clinical/tools/getActiveSymptomLandscapeTool.js +2 -2
  3. package/lib/clinical/tools/getPatientHistoryTool.js +1 -1
  4. package/lib/clinical/tools/openClusterHypothesisTool.js +3 -7
  5. package/lib/clinical/tools/openConditionTool.js +2 -2
  6. package/lib/clinical/tools/recordClinicalImpressionTool.js +1 -2
  7. package/lib/clinical/tools/recordInterventionTool.js +3 -5
  8. package/lib/clinical/tools/setContingencyPlanTool.js +3 -7
  9. package/lib/clinical/tools/submitSafetyGateTool.js +1 -5
  10. package/lib/clinical/tools/updateClusterHypothesisTool.js +4 -7
  11. package/lib/clinical/tools/updateConditionStatusTool.js +1 -2
  12. package/lib/fhir/constants/extensionSlugs.js +111 -0
  13. package/lib/fhir/resources/CarePlan.js +8 -7
  14. package/lib/fhir/resources/ClinicalImpression.js +39 -38
  15. package/lib/fhir/resources/CommunicationRequest.js +5 -4
  16. package/lib/fhir/resources/Condition.js +10 -9
  17. package/lib/fhir/resources/Observation.js +7 -6
  18. package/lib/fhir/resources/RiskAssessment.js +13 -12
  19. package/lib/fhir/resources/Task.js +4 -3
  20. package/lib/fhir/services/clusterService.js +9 -8
  21. package/lib/fhir/services/contingencyService.js +14 -11
  22. package/lib/fhir/services/palliativeService.js +23 -22
  23. package/lib/fhir/services/riskService.js +11 -10
  24. package/lib/fhir/services/routingService.js +10 -9
  25. package/lib/fhir/services/symptomCaseService.js +21 -20
  26. package/lib/shared/dtos/ClusterImpression.js +16 -5
  27. package/lib/shared/dtos/ContingencySafetyNet.js +3 -1
  28. package/lib/shared/dtos/Intervention.js +10 -3
  29. package/lib/shared/dtos/ManagedSymptom.js +15 -5
  30. 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(['low', 'moderate', 'high']).nullable().default(null),
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(['characterizing', 'monitoring', 'resolved', 'inactive', 'closed']).default('characterizing'),
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 || ['resolved', 'inactive', 'closed'].includes(c.clinicalStatus), {
39
- message: 'abatementAt requires a terminal clinicalStatus (resolved/inactive/closed)',
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 = { ManagedSymptom };
80
+ module.exports = {
81
+ ManagedSymptom,
82
+ CLINICAL_STATUSES,
83
+ OPEN_STATUSES,
84
+ CLOSED_STATUSES,
85
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.11.0-dev.1120",
3
+ "version": "5.11.0-dev.1122",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",