@peopl-health/nexus 6.0.0-dev.718 → 6.0.0
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/README.md +104 -0
- package/lib/adapters/BaileysProvider.js +8 -37
- package/lib/adapters/MessageAdapter.js +3 -1
- package/lib/adapters/MessageProvider.js +0 -11
- package/lib/adapters/TwilioProvider.js +44 -77
- package/lib/clinical/AssistantProcessor.js +414 -19
- package/lib/clinical/assistants/BaseAssistant.js +0 -15
- package/lib/clinical/config/checkInConfig.js +3 -0
- package/lib/clinical/config/cohortConfig.js +3 -3
- package/lib/clinical/config/composerConfig.js +42 -0
- package/lib/clinical/config/divergenceConfig.js +80 -50
- package/lib/clinical/config/llmConfig.js +11 -2
- package/lib/clinical/config/safetyNetConfig.js +108 -0
- package/lib/clinical/config/subAgentsConfig.js +61 -2
- package/lib/clinical/context/ToolRuntimeContext.js +121 -6
- package/lib/clinical/context/turnContext.js +50 -0
- package/lib/clinical/flags/bridgeConfig.js +31 -0
- package/lib/clinical/flags/clinicalContextFlags.js +46 -0
- package/lib/clinical/flags/composerFlags.js +14 -0
- package/lib/clinical/flags/contingencyFlags.js +19 -0
- package/lib/clinical/flags/escalationFlags.js +43 -0
- package/lib/clinical/flags/flagSnapshot.js +58 -0
- package/lib/clinical/flags/inboundRecoveryFlags.js +17 -0
- package/lib/clinical/flags/llmAuditConfig.js +7 -0
- package/lib/clinical/flags/llmMonitorConfig.js +18 -0
- package/lib/clinical/flags/patternConsultFlags.js +10 -0
- package/lib/clinical/flags/recommendationRecoveryFlags.js +9 -0
- package/lib/clinical/flags/supportLightFlags.js +7 -0
- package/lib/clinical/flags/triageRecommendationFlags.js +16 -0
- package/lib/clinical/flags/turnEfficiencyFlags.js +19 -0
- package/lib/clinical/helpers/auditReasoningHelper.js +30 -0
- package/lib/clinical/helpers/carePlanInterventionDerivation.js +76 -0
- package/lib/clinical/helpers/carePlanValidationHelper.js +62 -0
- package/lib/clinical/helpers/ceilingGapHelper.js +21 -0
- package/lib/clinical/helpers/chemoContextHelper.js +217 -0
- package/lib/clinical/helpers/clinicalContextHelper.js +162 -0
- package/lib/clinical/helpers/clinicalFactsHelper.js +45 -4
- package/lib/clinical/helpers/clinicalMentionHelper.js +16 -13
- package/lib/clinical/helpers/clinicalProfileHelper.js +60 -0
- package/lib/clinical/helpers/clinicalWorkflowGuard.js +175 -0
- package/lib/clinical/helpers/cohortHelper.js +3 -1
- package/lib/clinical/helpers/contextMirrorHelper.js +68 -0
- package/lib/clinical/helpers/dateAnchorHelper.js +18 -0
- package/lib/clinical/helpers/doctorReviewMessageHelper.js +152 -0
- package/lib/clinical/helpers/drugIdentityHelper.js +67 -0
- package/lib/clinical/helpers/encodedPairHelper.js +12 -0
- package/lib/clinical/helpers/evidenceAnchorHelper.js +70 -0
- package/lib/clinical/helpers/factAssertionHelper.js +300 -0
- package/lib/clinical/helpers/gradeEstimateHelper.js +148 -0
- package/lib/clinical/helpers/hospitalizationContextHelper.js +8 -0
- package/lib/clinical/helpers/legacyContextHelper.js +122 -0
- package/lib/clinical/helpers/legacyRecommendationFormatHelper.js +107 -0
- package/lib/clinical/helpers/llmsHelper.js +170 -87
- package/lib/clinical/helpers/managedSymptomProjectionHelper.js +23 -0
- package/lib/clinical/helpers/medicationNamingRule.js +5 -0
- package/lib/clinical/helpers/palliativeAssessmentHelper.js +62 -0
- package/lib/clinical/helpers/palliativeCarePlanHelper.js +68 -0
- package/lib/clinical/helpers/recommendationGateHelper.js +208 -0
- package/lib/clinical/helpers/recommendationPlanHelper.js +104 -0
- package/lib/clinical/helpers/resultsHelper.js +56 -0
- package/lib/clinical/helpers/reviewUpdateHelper.js +68 -0
- package/lib/clinical/helpers/shadowHelper.js +1 -13
- package/lib/clinical/helpers/skillActivationHelper.js +53 -0
- package/lib/clinical/helpers/structuredTextHelper.js +13 -0
- package/lib/clinical/helpers/toolResultHelper.js +35 -0
- package/lib/clinical/helpers/triageCaseBaseHelper.js +483 -0
- package/lib/clinical/helpers/triageResultMessageHelper.js +30 -0
- package/lib/clinical/helpers/triageRetriggerHelper.js +85 -0
- package/lib/clinical/helpers/triageSymptomsHelper.js +33 -0
- package/lib/clinical/index.js +4 -0
- package/lib/clinical/memory/DefaultMemoryManager.js +211 -39
- package/lib/clinical/memory/EnhancedMemoryManager.js +14 -8
- package/lib/clinical/models/llmCallModel.js +19 -0
- package/lib/clinical/models/llmMonitorCheckpointModel.js +20 -0
- package/lib/clinical/models/llmMonitorEvaluationModel.js +56 -0
- package/lib/clinical/models/patternConsultModel.js +37 -0
- package/lib/clinical/models/riskWarmupEventModel.js +23 -0
- package/lib/clinical/models/supportCandidateModel.js +90 -0
- package/lib/clinical/models/supportLightModel.js +95 -0
- package/lib/clinical/models/triageRecommendationEventModel.js +110 -0
- package/lib/clinical/models/turnTraceModel.js +24 -7
- package/lib/clinical/monitoring/AirtableMonitorSink.js +488 -0
- package/lib/clinical/monitoring/LlmMonitorService.js +558 -0
- package/lib/clinical/monitoring/contingencyMonitorSpec.js +601 -0
- package/lib/clinical/promptPlacement.js +5 -0
- package/lib/clinical/protocols/treatmentFormulary.js +387 -0
- package/lib/clinical/providers/AnthropicProvider.js +459 -31
- package/lib/clinical/providers/BaseLLMProvider.js +689 -52
- package/lib/clinical/providers/GatewayProvider.js +14 -4
- package/lib/clinical/providers/OpenAIResponsesProvider.js +73 -11
- package/lib/clinical/providers/OpenAIResponsesProviderTools.js +24 -9
- package/lib/clinical/providers/OpenRouterProvider.js +9 -2
- package/lib/clinical/services/assistantService.js +51 -7
- package/lib/clinical/services/bridgeService.js +93 -0
- package/lib/clinical/services/checkInDueService.js +134 -0
- package/lib/clinical/services/clinicalAirtableService.js +752 -0
- package/lib/clinical/services/clinicalContextReadService.js +47 -0
- package/lib/clinical/services/clinicalExtractionService.js +156 -23
- package/lib/clinical/services/composerService.js +78 -0
- package/lib/clinical/services/conceptVerifierService.js +127 -0
- package/lib/clinical/services/conditionCloseService.js +138 -0
- package/lib/clinical/services/contextCleanupService.js +85 -0
- package/lib/clinical/services/contextMirrorService.js +72 -0
- package/lib/clinical/services/contextSyncRunner.js +20 -0
- package/lib/clinical/services/contextSyncService.js +258 -0
- package/lib/clinical/services/contingencyDispatchService.js +496 -0
- package/lib/clinical/services/ctcaeLadderService.js +70 -0
- package/lib/clinical/services/ctcaeTermService.js +44 -0
- package/lib/clinical/services/currentRegimenService.js +60 -0
- package/lib/clinical/services/deliverySettlementService.js +39 -0
- package/lib/clinical/services/deniedSymptomBoundaryService.js +218 -0
- package/lib/clinical/services/dispatcherService.js +142 -0
- package/lib/clinical/services/escalationDraftService.js +229 -0
- package/lib/clinical/services/escalationNoteFactsService.js +131 -0
- package/lib/clinical/services/escalationQuestionsService.js +131 -0
- package/lib/clinical/services/gradeAnchorService.js +85 -0
- package/lib/clinical/services/gradeClaimService.js +73 -0
- package/lib/clinical/services/gradeSourceService.js +138 -0
- package/lib/clinical/services/impressionValidationService.js +19 -0
- package/lib/clinical/services/legacyContextSyncService.js +255 -0
- package/lib/clinical/services/llmAuditService.js +23 -0
- package/lib/clinical/services/nutritionPlanService.js +97 -0
- package/lib/clinical/services/outreachCarrierService.js +88 -0
- package/lib/clinical/services/outreachSweepRunner.js +8 -0
- package/lib/clinical/services/outreachSweepService.js +644 -0
- package/lib/clinical/services/patientHistoryService.js +203 -0
- package/lib/clinical/services/patientIdentityService.js +43 -0
- package/lib/clinical/services/patientProfileService.js +145 -0
- package/lib/clinical/services/patternConsultService.js +127 -0
- package/lib/clinical/services/pausedSafetyNetService.js +387 -0
- package/lib/clinical/services/promptComposerService.js +74 -21
- package/lib/clinical/services/radiotherapyContextService.js +40 -0
- package/lib/clinical/services/radiotherapyPhaseService.js +272 -0
- package/lib/clinical/services/recommendationRankService.js +180 -0
- package/lib/clinical/services/recommendationRecoveryService.js +241 -0
- package/lib/clinical/services/recommendationValidationService.js +206 -0
- package/lib/clinical/services/regimenCloserService.js +205 -0
- package/lib/clinical/services/reminderDispatchService.js +36 -0
- package/lib/clinical/services/riskAssessmentService.js +469 -0
- package/lib/clinical/services/riskHeadlineService.js +56 -0
- package/lib/clinical/services/safetyNetPledgeService.js +231 -0
- package/lib/clinical/services/shadowMessageService.js +30 -12
- package/lib/clinical/services/shadowService.js +8 -4
- package/lib/clinical/services/skillService.js +117 -0
- package/lib/clinical/services/supportActionService.js +122 -0
- package/lib/clinical/services/supportCandidateService.js +607 -0
- package/lib/clinical/services/supportInvitability.js +86 -0
- package/lib/clinical/services/supportLightEvaluationService.js +231 -0
- package/lib/clinical/services/supportLightService.js +277 -0
- package/lib/clinical/services/supportRoutingAgentService.js +118 -0
- package/lib/clinical/services/symptomLandscapeService.js +153 -0
- package/lib/clinical/services/treatmentProposalService.js +136 -0
- package/lib/clinical/services/triageRecommendationService.js +1226 -0
- package/lib/clinical/services/turnRiskBriefService.js +217 -0
- package/lib/clinical/services/writeClaimStore.js +126 -0
- package/lib/clinical/stores/CtcaeCatalog.js +21 -0
- package/lib/clinical/tools/analyzeSymptomPatternsTool.js +276 -0
- package/lib/clinical/tools/deliverPatientMessageTool.js +294 -0
- package/lib/clinical/tools/extractClinicalInfoTool.js +252 -37
- package/lib/clinical/tools/getActiveRecommendationsTool.js +44 -0
- package/lib/clinical/tools/getActiveSymptomLandscapeTool.js +37 -0
- package/lib/clinical/tools/getPatientHistoryTool.js +45 -0
- package/lib/clinical/tools/getPatientRiskAssessmentTool.js +66 -0
- package/lib/clinical/tools/getRouterContextBundleTool.js +136 -0
- package/lib/clinical/tools/lookupCtcaeEntryTool.js +36 -0
- package/lib/clinical/tools/openClusterHypothesisTool.js +175 -0
- package/lib/clinical/tools/openConditionTool.js +198 -0
- package/lib/clinical/tools/recordClinicalImpressionTool.js +394 -0
- package/lib/clinical/tools/recordInterventionTool.js +138 -0
- package/lib/clinical/tools/recordRecommendationOutcomeTool.js +72 -0
- package/lib/clinical/tools/registerClinicalTools.js +51 -6
- package/lib/clinical/tools/reportCrisisTool.js +193 -0
- package/lib/clinical/tools/reportMedicalEscalationTool.js +471 -0
- package/lib/clinical/tools/reportResultsReceivedTool.js +176 -0
- package/lib/clinical/tools/reportUnresolvedRequestv2Tool.js +164 -0
- package/lib/clinical/tools/requestPatternConsultTool.js +70 -0
- package/lib/clinical/tools/schedulePatientReminderTool.js +292 -0
- package/lib/clinical/tools/sendBridgeMessageTool.js +33 -0
- package/lib/clinical/tools/setContingencyPlanTool.js +332 -0
- package/lib/clinical/tools/skillTool.js +81 -0
- package/lib/clinical/tools/submitNutritionSafetyDecisionTool.js +200 -0
- package/lib/clinical/tools/submitOutreachDecisionTool.js +139 -0
- package/lib/clinical/tools/submitPalliativeAssessmentTool.js +75 -0
- package/lib/clinical/tools/submitPalliativeCarePlanTool.js +101 -0
- package/lib/clinical/tools/submitRecommendationPlanTool.js +145 -0
- package/lib/clinical/tools/submitRoutingDecisionTool.js +466 -0
- package/lib/clinical/tools/submitSafetyGateTool.js +130 -0
- package/lib/clinical/tools/submitSupportRoutingRecommendationTool.js +149 -0
- package/lib/clinical/tools/updateClusterHypothesisTool.js +178 -0
- package/lib/clinical/tools/updateConditionStatusTool.js +192 -0
- package/lib/clinical/tools/updatePalliativeAssessmentTool.js +78 -0
- package/lib/config/airtableArchiveConfig.js +177 -0
- package/lib/config/airtableConfig.js +24 -1
- package/lib/config/instructionConfig.js +5 -0
- package/lib/config/lifecycle.js +36 -1
- package/lib/config/programConfig.js +20 -0
- package/lib/controllers/assistantController.js +67 -11
- package/lib/controllers/contextSyncController.js +30 -0
- package/lib/controllers/contingencyController.js +28 -0
- package/lib/controllers/conversationController.js +7 -7
- package/lib/controllers/dashboardController.js +7 -4
- package/lib/controllers/escalationReviewController.js +299 -0
- package/lib/controllers/healthController.js +16 -0
- package/lib/controllers/interactionController.js +1 -1
- package/lib/controllers/messageController.js +67 -19
- package/lib/controllers/officeAssistantController.js +57 -0
- package/lib/controllers/patientController.js +216 -48
- package/lib/controllers/prescriptionController.js +10 -3
- package/lib/controllers/templateController.js +8 -17
- package/lib/controllers/traceController.js +26 -0
- package/lib/controllers/triageRecommendationController.js +41 -0
- package/lib/controllers/uploadController.js +2 -2
- package/lib/core/BatchingManager.js +146 -11
- package/lib/core/DeferredWorkRunner.js +257 -0
- package/lib/core/MessageParser.js +2 -2
- package/lib/core/NexusMessaging.js +948 -146
- package/lib/core/PhiProcessor.js +198 -17
- package/lib/core/ProcessingPipeline.js +49 -4
- package/lib/core/interactiveRouteService.js +64 -0
- package/lib/core/runtimeToolPolicy.js +3 -0
- package/lib/eval/EvalProvider.js +72 -25
- package/lib/fhir/config/catalogConfig.js +9 -14
- package/lib/fhir/config/fhirConfig.js +16 -12
- package/lib/fhir/constants/escalationCaseStatus.js +31 -0
- package/lib/fhir/constants/extensionSlugs.js +195 -0
- package/lib/fhir/constants/gradeMethods.js +12 -0
- package/lib/fhir/constants/projectionSlugs.js +69 -1
- package/lib/fhir/constants/severityPriority.js +8 -0
- package/lib/fhir/constants/variableRegistry.js +60 -0
- package/lib/fhir/helpers/compositeHelper.js +65 -12
- package/lib/fhir/helpers/contextArbitrationHelper.js +41 -0
- package/lib/fhir/helpers/elementHelper.js +39 -0
- package/lib/fhir/helpers/fhirHelper.js +4 -1
- package/lib/fhir/helpers/fhirReadHelper.js +62 -0
- package/lib/fhir/helpers/recommendationIds.js +44 -0
- package/lib/fhir/helpers/resourceDisplayHelper.js +9 -0
- package/lib/fhir/helpers/resourceHelper.js +46 -0
- package/lib/fhir/helpers/symptomAliasHelper.js +56 -0
- package/lib/fhir/helpers/termMatchHelper.js +42 -0
- package/lib/fhir/helpers/terminologyHelper.js +92 -5
- package/lib/fhir/helpers/triagePayloadHelper.js +133 -0
- package/lib/fhir/helpers/variableRegistryHelper.js +21 -0
- package/lib/fhir/index.js +75 -0
- package/lib/fhir/models/envelopeModel.js +22 -0
- package/lib/fhir/projections/clinicalMentionProjection.js +208 -46
- package/lib/fhir/projections/clusterProjection.js +124 -0
- package/lib/fhir/projections/contextFactProjection.js +380 -0
- package/lib/fhir/projections/contingencyProjection.js +224 -0
- package/lib/fhir/projections/dispatchedEscalationProjection.js +63 -0
- package/lib/fhir/projections/interventionProjection.js +245 -0
- package/lib/fhir/projections/palliativeCarePlanProjection.js +183 -0
- package/lib/fhir/projections/palliativeProjection.js +175 -0
- package/lib/fhir/projections/proctcaeProjection.js +62 -15
- package/lib/fhir/projections/recommendationPlanProjection.js +557 -0
- package/lib/fhir/projections/registerProjectors.js +10 -2
- package/lib/fhir/projections/reminderProjection.js +20 -0
- package/lib/fhir/projections/riskProjection.js +16 -0
- package/lib/fhir/projections/routingProjection.js +285 -0
- package/lib/fhir/projections/safetyGateProjection.js +42 -0
- package/lib/fhir/projections/symptomCaseProjection.js +324 -0
- package/lib/fhir/resources/CommunicationRequest.js +91 -0
- package/lib/fhir/resources/Condition.js +2 -24
- package/lib/fhir/resources/Encounter.js +30 -0
- package/lib/fhir/resources/Observation.js +22 -69
- package/lib/fhir/resources/Patient.js +57 -6
- package/lib/fhir/resources/Provenance.js +48 -12
- package/lib/fhir/resources/RiskAssessment.js +184 -0
- package/lib/fhir/resources/Task.js +102 -0
- package/lib/fhir/services/clinicalContextService.js +161 -0
- package/lib/fhir/services/clinicalMentionService.js +3 -5
- package/lib/fhir/services/clusterService.js +30 -0
- package/lib/fhir/services/contingencyService.js +47 -0
- package/lib/fhir/services/encounterService.js +16 -0
- package/lib/fhir/services/escalationService.js +85 -0
- package/lib/fhir/services/fhirService.js +20 -0
- package/lib/fhir/services/interventionService.js +50 -0
- package/lib/fhir/services/palliativeService.js +74 -0
- package/lib/fhir/services/patientService.js +41 -0
- package/lib/fhir/services/recommendationService.js +336 -0
- package/lib/fhir/services/resultObservationService.js +53 -0
- package/lib/fhir/services/riskService.js +202 -0
- package/lib/fhir/services/routingService.js +86 -0
- package/lib/fhir/services/snapshotService.js +18 -3
- package/lib/fhir/services/symptomCaseService.js +33 -0
- package/lib/fhir/services/terminologyService.js +16 -21
- package/lib/fhir/services/triageService.js +8 -4
- package/lib/fhir/stores/fhirStore.js +42 -19
- package/lib/fhir/utils/normalizeUtils.js +12 -0
- package/lib/helpers/airtableArchiveHelper.js +51 -0
- package/lib/helpers/airtableFormulaHelper.js +25 -0
- package/lib/helpers/caregiverHelper.js +136 -0
- package/lib/helpers/channelErrorHelper.js +31 -0
- package/lib/helpers/channelRetryHelper.js +156 -0
- package/lib/helpers/conversationWindowHelper.js +2 -2
- package/lib/helpers/deliveryAttemptHelper.js +14 -2
- package/lib/helpers/filesHelper.js +3 -3
- package/lib/helpers/healthHelper.js +40 -0
- package/lib/helpers/messageHelper.js +16 -6
- package/lib/helpers/messageStatusHelper.js +16 -22
- package/lib/helpers/metaSignatureHelper.js +6 -6
- package/lib/helpers/nerHelper.js +24 -0
- package/lib/helpers/outboundAllowlistHelper.js +51 -0
- package/lib/helpers/patientInformationHelper.js +20 -16
- package/lib/helpers/patientMessageHelper.js +79 -0
- package/lib/helpers/patientTaskRulesHelper.js +57 -0
- package/lib/helpers/pausedThreadHelper.js +37 -0
- package/lib/helpers/processHelper.js +47 -16
- package/lib/helpers/sendClaimHelper.js +126 -0
- package/lib/helpers/staffSendHelper.js +4 -0
- package/lib/helpers/templateFlowControllerHelper.js +1 -1
- package/lib/helpers/templateRecoveryHelper.js +66 -8
- package/lib/helpers/triageRecordHelper.js +124 -0
- package/lib/helpers/twilioHelper.js +7 -79
- package/lib/helpers/twilioMediaHelper.js +1 -1
- package/lib/helpers/whatsappHelper.js +3 -1
- package/lib/index.d.ts +844 -34
- package/lib/index.js +169 -11
- package/lib/jobs/ScheduledMessageJob.js +44 -0
- package/lib/jobs/TemplateApprovalJob.js +200 -33
- package/lib/models/agendaMessageModel.js +5 -0
- package/lib/models/airtableArchiveModel.js +225 -0
- package/lib/models/contactGateDecisionModel.js +27 -0
- package/lib/models/contextSyncStateModel.js +26 -0
- package/lib/models/deferredWorkModel.js +24 -0
- package/lib/models/deliveryAttemptModel.js +5 -1
- package/lib/models/escalationReviewModel.js +341 -0
- package/lib/models/flowRoutingModel.js +1 -1
- package/lib/models/messageModel.js +21 -1
- package/lib/models/patientProfileModel.js +24 -0
- package/lib/models/safetyNetPledgeModel.js +31 -0
- package/lib/models/sendClaimModel.js +18 -0
- package/lib/models/templateModel.js +1 -2
- package/lib/models/threadModel.js +7 -0
- package/lib/models/tokenMapModel.js +2 -1
- package/lib/models/writeClaimModel.js +14 -0
- package/lib/observability/telemetry.js +7 -7
- package/lib/providers/NerClient.js +2 -2
- package/lib/queue/QueueAdapter.js +1 -0
- package/lib/queue/RedisQueueAdapter.js +104 -7
- package/lib/routes/index.js +132 -2
- package/lib/services/airtableArchivePlanService.js +197 -0
- package/lib/services/airtableArchiveReadService.js +48 -0
- package/lib/services/airtableArchiveService.js +561 -0
- package/lib/services/airtableMirrorService.js +223 -0
- package/lib/services/airtableService.js +198 -18
- package/lib/services/assistantMessageService.js +140 -0
- package/lib/services/carePlanHistoryService.js +610 -0
- package/lib/services/characterizationOutcomeService.js +294 -0
- package/lib/services/contactGateService.js +178 -0
- package/lib/services/conversationService.js +66 -20
- package/lib/services/dashboard-provider-registry.js +38 -0
- package/lib/services/dashboardService.js +31 -4
- package/lib/services/escalationCaseTaskService.js +134 -0
- package/lib/services/escalationContextService.js +92 -0
- package/lib/services/escalationReviewService.js +2214 -0
- package/lib/services/flowDataExchangeService.js +1 -1
- package/lib/services/globalEntityService.js +1 -1
- package/lib/services/gravePendingService.js +41 -0
- package/lib/services/healthService.js +252 -0
- package/lib/services/heldMessageService.js +141 -0
- package/lib/services/inboundRecoveryService.js +354 -0
- package/lib/services/instructionInFlightService.js +17 -0
- package/lib/services/officeAssistantService.js +217 -0
- package/lib/services/orbisService.js +44 -0
- package/lib/services/patientClinicalStatusService.js +189 -0
- package/lib/services/patientResourceService.js +24 -0
- package/lib/services/patientService.js +28 -16
- package/lib/services/patientTaskService.js +221 -0
- package/lib/services/patientTaskSummaryService.js +93 -0
- package/lib/services/physicianService.js +31 -0
- package/lib/services/preprocessingService.js +18 -6
- package/lib/services/queueReconciliationService.js +161 -0
- package/lib/services/recommendationCarouselService.js +398 -0
- package/lib/services/reviewAlertSweepService.js +99 -0
- package/lib/services/reviewBoardService.js +75 -0
- package/lib/services/reviewDeadlineService.js +116 -0
- package/lib/services/reviewDraftSweepService.js +85 -0
- package/lib/services/teamAlertService.js +140 -0
- package/lib/services/templateService.js +1 -2
- package/lib/{helpers/threadHelper.js → services/threadService.js} +38 -6
- package/lib/services/tokenMapService.js +119 -22
- package/lib/services/toolRegistryService.js +43 -2
- package/lib/services/triageHistoryService.js +128 -0
- package/lib/services/twilioMediaService.js +79 -0
- package/lib/services/undeliverableService.js +36 -0
- package/lib/services/untakenAlertService.js +210 -0
- package/lib/shared/dtos/ClinicalAssertion.js +21 -0
- package/lib/shared/dtos/ClinicalMention.js +4 -0
- package/lib/shared/dtos/ClusterImpression.js +16 -5
- package/lib/shared/dtos/ContingencySafetyNet.js +69 -7
- package/lib/shared/dtos/DispatchedEscalation.js +4 -8
- package/lib/shared/dtos/GradedSymptom.js +2 -0
- package/lib/shared/dtos/Intervention.js +10 -3
- package/lib/shared/dtos/ManagedSymptom.js +40 -11
- package/lib/shared/dtos/NutritionSafetyDecision.js +128 -0
- package/lib/shared/dtos/PalliativeAssessment.js +62 -0
- package/lib/shared/dtos/PalliativeCarePlan.js +47 -0
- package/lib/shared/dtos/PatientRiskAssessment.js +25 -1
- package/lib/shared/dtos/RecommendationPlan.js +102 -0
- package/lib/shared/dtos/RecommendationSafetyGate.js +64 -0
- package/lib/shared/dtos/Reminder.js +2 -2
- package/lib/shared/dtos/RoutingDecision.js +2 -1
- package/lib/shared/dtos/SupportAction.js +28 -0
- package/lib/shared/dtos/SupportRoutingRecommendation.js +124 -0
- package/lib/shared/dtos/TriageCompletion.js +50 -0
- package/lib/shared/dtos/TriageResponse.js +7 -1
- package/lib/storage/MongoStorage.js +10 -1
- package/lib/templates/predefinedTemplates.js +1 -1
- package/lib/templates/templateStructure.js +15 -2
- package/lib/utils/MapCache.js +1 -1
- package/lib/utils/coercionUtils.js +11 -0
- package/lib/utils/concurrencyUtils.js +13 -0
- package/lib/utils/dateUtils.js +114 -6
- package/lib/utils/errorUtils.js +26 -1
- package/lib/utils/formatUtils.js +43 -37
- package/lib/utils/httpErrorUtils.js +9 -0
- package/lib/utils/intervalSweeper.js +75 -0
- package/lib/utils/jsonUtils.js +51 -0
- package/lib/utils/logger.js +8 -6
- package/lib/utils/paginationUtils.js +30 -0
- package/lib/utils/retryUtils.js +9 -1
- package/lib/utils/sanitizerUtils.js +87 -1
- package/lib/utils/scheduleUtils.js +70 -1
- package/lib/utils/shadowScope.js +13 -0
- package/lib/utils/statsUtils.js +21 -0
- package/lib/utils/textMatchUtils.js +76 -0
- package/lib/utils/timeoutUtils.js +16 -0
- package/lib/utils/tokenMapUtils.js +3 -3
- package/package.json +11 -11
- package/lib/clinical/helpers/divergenceHelper.js +0 -100
- package/lib/clinical/models/divergenceModel.js +0 -41
- package/lib/clinical/services/clinicalAgentService.js +0 -18
- package/lib/clinical/services/divergenceService.js +0 -90
- package/lib/core/workflowRunner.js +0 -35
- package/lib/fhir/resources/Appointment.js +0 -28
- package/lib/fhir/resources/MedicationStatement.js +0 -42
- package/lib/fhir/resources/Procedure.js +0 -30
- package/lib/services/twilioService.js +0 -13
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
const { ladderFor, renderLadder } = require('../services/ctcaeLadderService');
|
|
2
|
+
const {
|
|
3
|
+
itemForQuestionId, affirmative, sentinelKind, dimensionsFor, isItemDimension,
|
|
4
|
+
} = require('../../fhir/helpers/terminologyHelper');
|
|
5
|
+
const { daysSince } = require('../../utils/dateUtils');
|
|
6
|
+
const { detectSafetyFlags } = require('./safetyFlagsHelper');
|
|
7
|
+
|
|
8
|
+
const GRADE_FLOOR = 3;
|
|
9
|
+
|
|
10
|
+
function askedTermsOf(catalog, answers = {}) {
|
|
11
|
+
const terms = new Set();
|
|
12
|
+
for (const questionId of Object.keys(answers)) {
|
|
13
|
+
const item = itemForQuestionId(catalog, questionId);
|
|
14
|
+
if (item) terms.add(item[0]);
|
|
15
|
+
}
|
|
16
|
+
return [...terms];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// A term whose only answers were sentinels is not a gap in the questionnaire.
|
|
20
|
+
function sentinelTermsOf(catalog, answers = {}) {
|
|
21
|
+
const kinds = new Map();
|
|
22
|
+
for (const [questionId, label] of Object.entries(answers)) {
|
|
23
|
+
const item = itemForQuestionId(catalog, questionId);
|
|
24
|
+
if (!item) continue;
|
|
25
|
+
const term = item[0];
|
|
26
|
+
if (kinds.get(term) === null) continue;
|
|
27
|
+
const kind = sentinelKind(label);
|
|
28
|
+
if (!kind) { kinds.set(term, null); continue; }
|
|
29
|
+
// "declined" outranks "not applicable": a refusal keeps the symptom inconclusive.
|
|
30
|
+
if (kinds.get(term) !== 'declined') kinds.set(term, kind);
|
|
31
|
+
}
|
|
32
|
+
const notApplicable = [];
|
|
33
|
+
const declined = [];
|
|
34
|
+
for (const [term, kind] of kinds) {
|
|
35
|
+
if (kind === 'not_applicable') notApplicable.push(term);
|
|
36
|
+
if (kind === 'declined') declined.push(term);
|
|
37
|
+
}
|
|
38
|
+
return { notApplicable, declined };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function splitByEpistemics({ graded = [], askedTerms = [], notApplicable = [], declined = [] }) {
|
|
42
|
+
const byTerm = new Map(graded.map((symptom) => [symptom.term, symptom]));
|
|
43
|
+
const sentinel = new Set([...notApplicable, ...declined]);
|
|
44
|
+
const reported = graded.filter((symptom) => symptom.grade >= 1);
|
|
45
|
+
const denied = graded.filter((symptom) => symptom.grade === 0).map((symptom) => symptom.term);
|
|
46
|
+
const unanswered = askedTerms.filter((term) => !byTerm.has(term) && !sentinel.has(term));
|
|
47
|
+
return { reported, denied, unanswered };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function describeNonIdentifiedSymptoms(answer) {
|
|
51
|
+
if (!String(answer ?? '').trim()) return null;
|
|
52
|
+
return affirmative(answer)
|
|
53
|
+
? 'El paciente reporta síntoma(s) adicional(es) NO evaluado(s) en el triaje que afectan su vida diaria: requieren evaluación complementaria.'
|
|
54
|
+
: 'El paciente confirmó que NO tiene síntomas adicionales a los preguntados en el triaje.';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Pain needs no separate check: it arrives graded as the general_pain composite.
|
|
58
|
+
function hasActionableFindings({
|
|
59
|
+
graded = [], additionalSymptoms = [], freeTextDerivedSymptoms = [], freeTextBits = [],
|
|
60
|
+
nonIdentifiedSymptoms = null, ungradedTerms = [],
|
|
61
|
+
}) {
|
|
62
|
+
if (graded.some((symptom) => Number(symptom.grade) >= 1)) return true;
|
|
63
|
+
if (additionalSymptoms.length || freeTextDerivedSymptoms.length) return true;
|
|
64
|
+
// An answered term the table could not grade is unknown, not absent: it still needs a look.
|
|
65
|
+
if (ungradedTerms.length) return true;
|
|
66
|
+
if (affirmative(nonIdentifiedSymptoms)) return true;
|
|
67
|
+
return freeTextBits.some((bit) => String(bit || '').trim());
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const CADENCE_LABEL = {
|
|
71
|
+
weekly: 'semanal (las respuestas describen los últimos 7 días)',
|
|
72
|
+
daily: 'diario (las respuestas describen las últimas 24 horas)',
|
|
73
|
+
'first triage': 'inicial (estado basal del paciente, no un cambio)',
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const DENIED_GATE_RULE = 'Son hallazgos negativos de primera clase: úsalos como events_denied de un '
|
|
77
|
+
+ 'patrón que este triaje YA activó — es decir, que tiene al menos un evento confirmado hoy o una '
|
|
78
|
+
+ 'señal del pre-screen. Ese patrón se documenta con verification_status=\'denied\' y no se omite. '
|
|
79
|
+
+ 'Una negación que no cierra ninguna señal activa no abre un red flag: un patrón que sólo existe '
|
|
80
|
+
+ 'por el perfil del paciente se omite completo.';
|
|
81
|
+
|
|
82
|
+
const DENIED_PLAN_RULE = 'Son hallazgos negativos de primera clase: úsalos para construir clusters, afinar el '
|
|
83
|
+
+ 'diferencial, descartar patrones de riesgo y evitar falsa tranquilización, y razona sobre '
|
|
84
|
+
+ 'ellos en clinical_description cuando aporte. Pero NUNCA generes un elemento para ellos: no '
|
|
85
|
+
+ 'pueden aparecer en name_short, en recommendation.symptoms_patient_facing, en symptoms ni en '
|
|
86
|
+
+ 'targeted_ctcae_terms. Un red_flag con verification_status=\'denied\' es contexto de '
|
|
87
|
+
+ 'razonamiento, no material de tarjeta.';
|
|
88
|
+
|
|
89
|
+
const DIMENSION_ES = {
|
|
90
|
+
presence: 'presencia',
|
|
91
|
+
frequency: 'frecuencia',
|
|
92
|
+
intensity: 'intensidad',
|
|
93
|
+
interference: 'interferencia',
|
|
94
|
+
amount: 'cantidad',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const ADHERENCE_ES = {
|
|
98
|
+
full: 'la siguió',
|
|
99
|
+
partial: 'la siguió en parte',
|
|
100
|
+
none: 'no la siguió',
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const CHANGE_ES = {
|
|
104
|
+
improved: 'mejoró',
|
|
105
|
+
unchanged: 'sigue igual',
|
|
106
|
+
worsened: 'empeoró',
|
|
107
|
+
mixed: 'mixto',
|
|
108
|
+
absent: 'no tuvo el síntoma',
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const ABSENT_CHANGE_RX = /^absent_(.+)_cluster$/;
|
|
112
|
+
|
|
113
|
+
const GRADE_BASIS_ES = {
|
|
114
|
+
composite: 'la tabla compuesta del PRO-CTCAE resolvió el grado con las respuestas de arriba',
|
|
115
|
+
presence: 'sólo se preguntó si el síntoma estaba presente; el grado no sale de una escala de severidad',
|
|
116
|
+
absence: 'la frecuencia contesta que nunca ocurre; la tabla compuesta no resolvió la combinación',
|
|
117
|
+
partial: 'la tabla compuesta no resolvió la combinación completa; el grado es parcial',
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
function reportedSymptomEvidence(symptom, catalog) {
|
|
121
|
+
const lines = [`- ${symptom.term} (grado ${symptom.grade})`];
|
|
122
|
+
const answers = symptom.dimensionAnswers || {};
|
|
123
|
+
const answered = Object.keys(answers);
|
|
124
|
+
if (answered.length) {
|
|
125
|
+
lines.push(` Respuestas del paciente: ${answered
|
|
126
|
+
.map((dimension) => `${DIMENSION_ES[dimension] || dimension}: ${answers[dimension]}`)
|
|
127
|
+
.join(' · ')}`);
|
|
128
|
+
}
|
|
129
|
+
const setAside = Object.entries(symptom.supplementaryAnswers || {});
|
|
130
|
+
if (setAside.length) {
|
|
131
|
+
lines.push(` Preguntas complementarias de PEOPL, fuera del grado: ${setAside
|
|
132
|
+
.map(([dimension, answer]) => `${DIMENSION_ES[dimension] || dimension}: ${answer}`)
|
|
133
|
+
.join(' · ')}. Miden otra cosa que el ítem del PRO-CTCAE; no confirman ni descartan el síntoma.`);
|
|
134
|
+
}
|
|
135
|
+
if (Array.isArray(catalog?.symptoms?.[symptom.term]?.dimensions)) {
|
|
136
|
+
const missing = dimensionsFor(catalog, symptom.term)
|
|
137
|
+
.filter((dimension) => isItemDimension(catalog, symptom.term, dimension) && !answered.includes(dimension));
|
|
138
|
+
if (missing.length) {
|
|
139
|
+
lines.push(` Atributos que este ítem del PRO-CTCAE no preguntó: ${missing
|
|
140
|
+
.map((dimension) => DIMENSION_ES[dimension] || dimension).join(', ')}. No preguntado no es `
|
|
141
|
+
+ 'ausente ni normal: sigue DESCONOCIDO y no puede sostener ni descartar un grado.');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const basis = GRADE_BASIS_ES[symptom.gradeBasis];
|
|
145
|
+
if (basis) lines.push(` Base del grado (${symptom.gradeBasis}): ${basis}.`);
|
|
146
|
+
const ladder = catalog?.symptoms ? ladderFor(catalog, symptom.term) : null;
|
|
147
|
+
if (ladder) lines.push(...renderLadder(ladder, symptom.grade));
|
|
148
|
+
return lines.join('\n');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function buildSymptomsMetadata({
|
|
152
|
+
graded = [],
|
|
153
|
+
askedTerms = [],
|
|
154
|
+
notApplicable = [],
|
|
155
|
+
declined = [],
|
|
156
|
+
additionalSymptoms = [],
|
|
157
|
+
freeTextDerivedSymptoms = [],
|
|
158
|
+
freeTextUnmatchedSymptoms = [],
|
|
159
|
+
nonIdentifiedSymptoms = null,
|
|
160
|
+
stage = 'gate',
|
|
161
|
+
catalog = null,
|
|
162
|
+
}) {
|
|
163
|
+
const { reported, denied, unanswered } = splitByEpistemics({
|
|
164
|
+
graded,
|
|
165
|
+
askedTerms,
|
|
166
|
+
notApplicable,
|
|
167
|
+
declined,
|
|
168
|
+
});
|
|
169
|
+
const parts = [];
|
|
170
|
+
parts.push(
|
|
171
|
+
'Síntomas reportados en el triaje (grados COMPUESTOS del cuestionario — preliminares, '
|
|
172
|
+
+ 'sospechados, NUNCA confirmados; el grado puede confirmarse o re-graduarse, nunca copiarse '
|
|
173
|
+
+ 'como confirmado): '
|
|
174
|
+
+ (reported.length ? reported.map((symptom) => `${symptom.term} (grado ${symptom.grade})`).join('; ') : 'ninguno')
|
|
175
|
+
+ '.',
|
|
176
|
+
);
|
|
177
|
+
if (reported.length) {
|
|
178
|
+
parts.push(reported.map((symptom) => reportedSymptomEvidence(symptom, catalog)).join('\n'));
|
|
179
|
+
}
|
|
180
|
+
if (additionalSymptoms.length) {
|
|
181
|
+
parts.push(
|
|
182
|
+
'Síntomas que el paciente CONFIRMÓ en el checkbox de síntomas adicionales, sin grado '
|
|
183
|
+
+ 'computable (el triaje no les hizo las preguntas de frecuencia/intensidad/interferencia): '
|
|
184
|
+
+ additionalSymptoms.map((symptom) => symptom.label).join(', ')
|
|
185
|
+
+ '. Están PRESENTES: cuentan como reportados y son material válido de recomendación, con '
|
|
186
|
+
+ 'grado sin determinar. No los trates como negados ni como desconocidos.',
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
if (freeTextDerivedSymptoms.length) {
|
|
190
|
+
parts.push(
|
|
191
|
+
'Síntomas que un clasificador derivó del TEXTO LIBRE del paciente, no de una pregunta PRO-CTCAE: '
|
|
192
|
+
+ freeTextDerivedSymptoms.join(', ')
|
|
193
|
+
+ '. Están PRESENTES y son material válido de recomendación, pero el término lo asignó un '
|
|
194
|
+
+ 'clasificador y puede no ser el correcto: verifícalo con el paciente antes de darlo por confirmado.',
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
if (freeTextUnmatchedSymptoms.length) {
|
|
198
|
+
parts.push(
|
|
199
|
+
'Síntomas que el paciente escribió en el TEXTO LIBRE y que no tienen ítem PRO-CTCAE: '
|
|
200
|
+
+ freeTextUnmatchedSymptoms.join(', ')
|
|
201
|
+
+ '. Están PRESENTES, sin grado, y son material válido de recomendación. No los traduzcas a un '
|
|
202
|
+
+ 'ítem PRO-CTCAE parecido: si les haces una tarjeta, pon exactamente esa etiqueta en targeted_ctcae_terms.',
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
if (denied.length) {
|
|
206
|
+
parts.push(
|
|
207
|
+
'Síntomas NEGADOS explícitamente en la ventana de reporte del triaje (respuesta grado 0 a preguntas del triaje): '
|
|
208
|
+
+ denied.join(', ')
|
|
209
|
+
+ '. '
|
|
210
|
+
+ (stage === 'plan' ? DENIED_PLAN_RULE : DENIED_GATE_RULE),
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
if (notApplicable.length) {
|
|
214
|
+
parts.push(
|
|
215
|
+
'Síntomas que NO APLICAN a este paciente (respondió que no corresponden a su situación): '
|
|
216
|
+
+ notApplicable.join(', ')
|
|
217
|
+
+ '. No son desconocidos: el paciente indicó que el ítem no puede ocurrir en su caso. No '
|
|
218
|
+
+ 'construyas red flags de vigilancia sobre ellos ni los cuentes como inconclusive.',
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
if (declined.length) {
|
|
222
|
+
parts.push(
|
|
223
|
+
'Síntomas que el paciente PREFIRIÓ NO CONTESTAR: '
|
|
224
|
+
+ declined.join(', ')
|
|
225
|
+
+ '. Es una negativa a responder, no una negación del síntoma: estado DESCONOCIDO, '
|
|
226
|
+
+ 'inconclusive en el gate, y nunca events_denied.',
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
if (unanswered.length) {
|
|
230
|
+
parts.push(
|
|
231
|
+
'Síntomas preguntados SIN respuesta o sin grado computable (estado DESCONOCIDO): '
|
|
232
|
+
+ unanswered.join(', ')
|
|
233
|
+
+ '. NO son negaciones ni confirmaciones — en el gate cuentan como inconclusive; nunca los '
|
|
234
|
+
+ 'uses en events_denied.',
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
const nonIdentified = describeNonIdentifiedSymptoms(nonIdentifiedSymptoms);
|
|
238
|
+
if (nonIdentified) parts.push(nonIdentified);
|
|
239
|
+
return parts.join('\n');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const OPEN_CASE_RULE = 'Son contexto de razonamiento, NO evidencia de hoy ni material de tarjeta. Úsalos '
|
|
243
|
+
+ 'para ver la evolución, agrupar y afinar el diferencial. Un caso no reportado hoy no va en '
|
|
244
|
+
+ 'events_confirmed, no abre ni sostiene un red flag y nunca aparece en name_short, '
|
|
245
|
+
+ 'recommendation.symptoms_patient_facing, symptoms ni targeted_ctcae_terms. \'improving\' o días sin '
|
|
246
|
+
+ 'evidencia no significan resuelto: si ya se escaló y no hay cierre documentado, anótalo como '
|
|
247
|
+
+ 'pendiente del equipo en el resumen interno (summary en el gate, summary_internal en el plan), nunca '
|
|
248
|
+
+ 'como tarjeta ni urgencia.';
|
|
249
|
+
|
|
250
|
+
const ESCALATION_RULE = 'Registran sólo lo que se ENVIÓ al equipo: nunca si respondió, qué indicó ni si se '
|
|
251
|
+
+ 'resolvió. Son contexto, no evidencia: una escalación pasada nunca crea, sostiene ni sube una urgencia '
|
|
252
|
+
+ 'por sí sola. Si el mismo motivo se escaló en los últimos 14 días, no lo reenvíes si hoy mejoró, se negó '
|
|
253
|
+
+ 'o no se reportó. Reenvíalo sólo con evidencia de hoy: si subió de grado o hay un signo de alarma nuevo, '
|
|
254
|
+
+ 'decide la ruta por sus méritos; si sigue igual, aplica la política de reenvío de tus instrucciones. El '
|
|
255
|
+
+ 'tiempo transcurrido nunca justifica por sí solo una ruta mayor. En '
|
|
256
|
+
+ 'reason_for_escalation cita la evidencia de hoy y di si es nuevo, empeoramiento o persistencia.';
|
|
257
|
+
|
|
258
|
+
function buildOpenCaseBlock(openCases = []) {
|
|
259
|
+
if (!openCases.length) return 'Sin casos clínicos abiertos.';
|
|
260
|
+
const lines = openCases.map((managedSymptom) => {
|
|
261
|
+
const { condition, latestAssessment } = managedSymptom;
|
|
262
|
+
const grade = latestAssessment.grade;
|
|
263
|
+
const range = Array.isArray(grade.possibleRange) ? ` (rango ${grade.possibleRange.join('-')})` : '';
|
|
264
|
+
const estimate = grade.bestEstimate === null ? 'sin grado' : `grado ${grade.bestEstimate}${range}`;
|
|
265
|
+
const parts = [condition.ctcaeTerm, condition.clinicalStatus, estimate];
|
|
266
|
+
if (grade.confidence) parts.push(`confianza ${grade.confidence}`);
|
|
267
|
+
if (latestAssessment.trajectory) parts.push(latestAssessment.trajectory);
|
|
268
|
+
const quiet = daysSince(latestAssessment.performedAt, Date.now());
|
|
269
|
+
if (quiet !== null) parts.push(`${quiet} d sin evidencia nueva`);
|
|
270
|
+
return `- ${parts.join(' · ')}`;
|
|
271
|
+
});
|
|
272
|
+
return `${lines.join('\n')}\n${OPEN_CASE_RULE}`;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function buildEscalationBlock(escalations = []) {
|
|
276
|
+
if (!escalations.length) return 'Sin escalaciones enviadas al equipo en los últimos 14 días.';
|
|
277
|
+
const lines = escalations.map((event) => {
|
|
278
|
+
const days = daysSince(event.escalatedAt, Date.now());
|
|
279
|
+
const when = days === null ? event.escalatedAt : `hace ${days} d (${event.escalatedAt})`;
|
|
280
|
+
return `- ${when} · urgencia ${event.urgency || 'sin registrar'} · ${event.reason || 'sin motivo registrado'}`;
|
|
281
|
+
});
|
|
282
|
+
return `${lines.join('\n')}\n${ESCALATION_RULE}`;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function buildAdherenceBlock(priorResolutions = []) {
|
|
286
|
+
if (!priorResolutions.length) return 'Sin recomendaciones previas con adherencia reportada.';
|
|
287
|
+
return priorResolutions
|
|
288
|
+
.map((row) => {
|
|
289
|
+
const symptom = row.symptoms_patient_facing || row.element_name_short || 'sin síntoma registrado';
|
|
290
|
+
const recommendation = row.patient_main_recommendation || 'sin texto registrado';
|
|
291
|
+
const adherence = ADHERENCE_ES[row.adherence_level] || row.adherence_level || 'sin respuesta';
|
|
292
|
+
const change = CHANGE_ES[row.symptom_change] || row.symptom_change || 'sin respuesta';
|
|
293
|
+
return `- Síntoma(s): ${symptom} · Recomendación previa: ${recommendation} · Adherencia reportada: ${adherence} · Cambio que reportó después de esa recomendación: ${change}`;
|
|
294
|
+
})
|
|
295
|
+
.join('\n');
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function buildSymptomChangeBlock(symptomsChange = []) {
|
|
299
|
+
if (!symptomsChange.length) return 'Sin cambio de síntomas reportado.';
|
|
300
|
+
return symptomsChange
|
|
301
|
+
.map((entry) => {
|
|
302
|
+
const absent = ABSENT_CHANGE_RX.exec(entry);
|
|
303
|
+
if (!absent) return `- ${entry}`;
|
|
304
|
+
return `- ${entry} → el paciente marcó «Nunca tuve este síntoma» para "${absent[1]}". Si este triaje le da grado a ese síntoma, la respuesta se contradice: vale el grado (no lo bajes ni lo descartes), pero en el resumen interno escribe «respuesta contradictoria: marcó Nunca tuve y el cuestionario le da grado N», pide caracterización y que lo primero sea confirmar si lo tuvo estos días. Al paciente no se lo presentes como un hecho («reportas náusea»): dile que en el cuestionario lo marcó y pídele que te confirme si lo tuvo`;
|
|
305
|
+
})
|
|
306
|
+
.join('\n');
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function buildSymptomSignalsBlock(symptomSignals) {
|
|
310
|
+
return symptomSignals.map((signal) => {
|
|
311
|
+
const answers = Object.entries(signal.answers)
|
|
312
|
+
.map(([dimension, answer]) => `${DIMENSION_ES[dimension] || dimension}: ${answer}`)
|
|
313
|
+
.join(', ');
|
|
314
|
+
const ungraded = signal.grade === null && signal.sources.includes('cuestionario');
|
|
315
|
+
const noAnswers = ungraded ? 'sin grado computable (estado DESCONOCIDO)' : 'sin respuestas del cuestionario';
|
|
316
|
+
const noGrade = ungraded ? 'sin grado computable' : 'sin grado';
|
|
317
|
+
return `- ${signal.name} · fuente: ${signal.sources.join(' + ')}`
|
|
318
|
+
+ ` · respuestas: ${answers || noAnswers}`
|
|
319
|
+
+ ` · grado aproximado: ${signal.grade ?? noGrade}`
|
|
320
|
+
+ ` · tendencia: ${signal.trends.join('; ') || 'sin dato'}`;
|
|
321
|
+
}).join('\n');
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function buildSafetySignals({
|
|
325
|
+
graded = [], riskAssessment = null, riskUnavailable = false, freeTextBits = [], patterns = null,
|
|
326
|
+
}) {
|
|
327
|
+
const signals = [];
|
|
328
|
+
const reported = graded.filter((symptom) => symptom.grade >= 1);
|
|
329
|
+
for (const symptom of reported) {
|
|
330
|
+
if (symptom.grade >= GRADE_FLOOR) signals.push(`grado compuesto ≥${GRADE_FLOOR}: ${symptom.term} (grado ${symptom.grade})`);
|
|
331
|
+
}
|
|
332
|
+
const vigilance = (riskAssessment?.predictedAes || [])
|
|
333
|
+
.flatMap((ae) => [ae.aeName, ...(ae.minimumSymptomSet || [])])
|
|
334
|
+
.filter(Boolean)
|
|
335
|
+
.map((entry) => String(entry).toLowerCase());
|
|
336
|
+
const vigilanceText = vigilance.join(' ');
|
|
337
|
+
for (const symptom of reported) {
|
|
338
|
+
if (vigilanceText.includes(String(symptom.term).toLowerCase())) {
|
|
339
|
+
signals.push(`EACAR de vigilancia reportado: ${symptom.term}`);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (riskUnavailable) signals.push('EACAR de vigilancia: no disponible (la evaluación de riesgo no se pudo leer)');
|
|
343
|
+
const text = freeTextBits.filter(Boolean).join(' ');
|
|
344
|
+
if (!Array.isArray(patterns) || !patterns.length) {
|
|
345
|
+
if (text) signals.push('patrón de bandera roja: no disponible (los patrones de seguridad no se pudieron leer)');
|
|
346
|
+
} else if (text) {
|
|
347
|
+
for (const flag of detectSafetyFlags(text, patterns)) {
|
|
348
|
+
signals.push(`patrón de bandera roja: ${flag}`);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return signals;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const EXPOSURE_LABELS = {
|
|
355
|
+
tratamiento_actual: 'Tratamiento actual',
|
|
356
|
+
tratamientos_previos: 'Tratamientos previos',
|
|
357
|
+
medicacion_actual: 'Medicación actual',
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
const EXPOSURE_RULE = 'Estos campos son TEXTO LIBRE del expediente y con frecuencia nombran la vía, el '
|
|
361
|
+
+ 'esquema o el número de ciclos sin nombrar el fármaco. Un fármaco que no aparece aquí NO está '
|
|
362
|
+
+ 'descartado: su ausencia en este texto no es evidencia de que no se administró. No concluyas que un '
|
|
363
|
+
+ 'síntoma carece de causa plausible a partir de los fármacos que sí aparecen, ni se lo atribuyas a '
|
|
364
|
+
+ 'los que aparecen sólo porque son los únicos nombrados. Si la atribución cambiaría la acción, pide '
|
|
365
|
+
+ 'caracterización en vez de concluir.';
|
|
366
|
+
|
|
367
|
+
const MEDICATION_RULE = 'La medicación se registra sin indicación y sin sitio de aplicación. No infieras '
|
|
368
|
+
+ 'para qué se indicó ni dónde se aplica, no la reencamines a otro síntoma ni a otra parte del cuerpo, '
|
|
369
|
+
+ 'y nunca escribas que el equipo la indicó para algo que el caso no documenta.';
|
|
370
|
+
|
|
371
|
+
const exposureText = (value) => (typeof value === 'string' ? value.trim() : '');
|
|
372
|
+
|
|
373
|
+
function buildExposureBlock(profile) {
|
|
374
|
+
const clinical = profile?.datos_clinicos;
|
|
375
|
+
if (!clinical || typeof clinical !== 'object') return null;
|
|
376
|
+
const lines = [];
|
|
377
|
+
for (const [key, label] of Object.entries(EXPOSURE_LABELS)) {
|
|
378
|
+
const value = exposureText(clinical[key]);
|
|
379
|
+
if (value) lines.push(`- ${label}: ${value}`);
|
|
380
|
+
}
|
|
381
|
+
if (!lines.length) return null;
|
|
382
|
+
lines.push(EXPOSURE_RULE);
|
|
383
|
+
if (exposureText(clinical.medicacion_actual)) lines.push(MEDICATION_RULE);
|
|
384
|
+
return lines.join('\n');
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function buildCasoBase({
|
|
388
|
+
profile,
|
|
389
|
+
chemoWindow = null,
|
|
390
|
+
graded = [],
|
|
391
|
+
askedTerms = [],
|
|
392
|
+
notApplicable = [],
|
|
393
|
+
declined = [],
|
|
394
|
+
priorResolutions = [],
|
|
395
|
+
safetySignals = [],
|
|
396
|
+
symptomsChange = [],
|
|
397
|
+
openCases = [],
|
|
398
|
+
escalations = [],
|
|
399
|
+
cadence = null,
|
|
400
|
+
authored = null,
|
|
401
|
+
triageRecordId = null,
|
|
402
|
+
freeText = null,
|
|
403
|
+
additionalSymptoms = [],
|
|
404
|
+
freeTextDerivedSymptoms = [],
|
|
405
|
+
freeTextUnmatchedSymptoms = [],
|
|
406
|
+
nonIdentifiedSymptoms = null,
|
|
407
|
+
stage = 'gate',
|
|
408
|
+
catalog = null,
|
|
409
|
+
symptomSignals = [],
|
|
410
|
+
}) {
|
|
411
|
+
const cadenceLabel = CADENCE_LABEL[String(cadence || '').trim().toLowerCase()] || null;
|
|
412
|
+
const suffix = `${authored ? ` (${authored})` : ''}${triageRecordId ? ` [id: ${triageRecordId}]` : ''}.`;
|
|
413
|
+
const exposure = buildExposureBlock(profile);
|
|
414
|
+
const sections = [
|
|
415
|
+
'## CASO BASE',
|
|
416
|
+
cadenceLabel
|
|
417
|
+
? `Triaje ${cadenceLabel} PRO-CTCAE completado${suffix}`
|
|
418
|
+
: `Triaje PRO-CTCAE completado${suffix} Cadencia desconocida: no asumas ninguna ventana de reporte.`,
|
|
419
|
+
'',
|
|
420
|
+
'### Contexto clínico del paciente (patient_context)',
|
|
421
|
+
profile ? JSON.stringify(profile) : 'No disponible.',
|
|
422
|
+
...(exposure ? ['', '### Exposición antineoplásica y medicación documentadas', exposure] : []),
|
|
423
|
+
...(chemoWindow ? ['', chemoWindow] : []),
|
|
424
|
+
'',
|
|
425
|
+
'### Síntomas del triaje (symptoms_metadata)',
|
|
426
|
+
buildSymptomsMetadata({
|
|
427
|
+
graded,
|
|
428
|
+
askedTerms,
|
|
429
|
+
notApplicable,
|
|
430
|
+
declined,
|
|
431
|
+
additionalSymptoms,
|
|
432
|
+
freeTextDerivedSymptoms,
|
|
433
|
+
freeTextUnmatchedSymptoms,
|
|
434
|
+
nonIdentifiedSymptoms,
|
|
435
|
+
stage,
|
|
436
|
+
catalog,
|
|
437
|
+
}),
|
|
438
|
+
];
|
|
439
|
+
if (freeText) {
|
|
440
|
+
sections.push('', '### Texto libre del paciente', freeText);
|
|
441
|
+
}
|
|
442
|
+
sections.push(
|
|
443
|
+
'',
|
|
444
|
+
'### Cambio reportado de síntomas (symptoms_change)',
|
|
445
|
+
buildSymptomChangeBlock(symptomsChange),
|
|
446
|
+
'',
|
|
447
|
+
'### Casos clínicos abiertos del paciente',
|
|
448
|
+
buildOpenCaseBlock(openCases),
|
|
449
|
+
'',
|
|
450
|
+
'### Escalaciones ya enviadas al equipo (últimos 14 días)',
|
|
451
|
+
buildEscalationBlock(escalations),
|
|
452
|
+
'',
|
|
453
|
+
'### Adherencia y recomendaciones previas',
|
|
454
|
+
buildAdherenceBlock(priorResolutions),
|
|
455
|
+
'',
|
|
456
|
+
'### Señales del pre-screen determinista',
|
|
457
|
+
safetySignals.length ? safetySignals.map((signal) => `- ${signal}`).join('\n') : 'Ninguna.',
|
|
458
|
+
);
|
|
459
|
+
if (stage === 'plan' && symptomSignals.length) {
|
|
460
|
+
sections.push(
|
|
461
|
+
'',
|
|
462
|
+
'### Señales por síntoma para priorizar (el grado es una aproximación del cuestionario)',
|
|
463
|
+
buildSymptomSignalsBlock(symptomSignals),
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
return sections.join('\n');
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
module.exports = {
|
|
470
|
+
buildExposureBlock,
|
|
471
|
+
buildOpenCaseBlock,
|
|
472
|
+
buildEscalationBlock,
|
|
473
|
+
askedTermsOf,
|
|
474
|
+
sentinelTermsOf,
|
|
475
|
+
splitByEpistemics,
|
|
476
|
+
hasActionableFindings,
|
|
477
|
+
buildSymptomsMetadata,
|
|
478
|
+
buildAdherenceBlock,
|
|
479
|
+
buildSymptomChangeBlock,
|
|
480
|
+
buildSafetySignals,
|
|
481
|
+
buildCasoBase,
|
|
482
|
+
GRADE_FLOOR,
|
|
483
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const TRIAGE_RESULT_MARKER = 'acaba de completar el triaje de síntomas PRO-CTCAE';
|
|
2
|
+
|
|
3
|
+
const SCALE_HEADER = 'Escala CTCAE de este síntoma. El grado de arriba es una APROXIMACIÓN calculada a partir del PRO-CTCAE, no una lectura de estas cláusulas: contrasta lo que el paciente describe contra ellas antes de darlo por confirmado. Si la evidencia sostiene otra cláusula, ese es el grado.';
|
|
4
|
+
const DEFINITION_PREFIX = 'Definición del síntoma - ';
|
|
5
|
+
const SCALE_CLAUSE_RX = /^\s+G\d:/;
|
|
6
|
+
|
|
7
|
+
const isTriageResultMessage = (body) => typeof body === 'string' && body.includes(TRIAGE_RESULT_MARKER);
|
|
8
|
+
|
|
9
|
+
const isReferenceLine = (line, next) => line === SCALE_HEADER
|
|
10
|
+
|| (line.startsWith(DEFINITION_PREFIX) && next === SCALE_HEADER);
|
|
11
|
+
|
|
12
|
+
// Drops only fixed CTCAE reference text (the scale header leaves with its clauses); every patient-specific line stays verbatim.
|
|
13
|
+
function compactTriageResult(body) {
|
|
14
|
+
if (!isTriageResultMessage(body)) return body;
|
|
15
|
+
const lines = body.split('\n');
|
|
16
|
+
const kept = [];
|
|
17
|
+
let inScale = false;
|
|
18
|
+
let dropped = false;
|
|
19
|
+
lines.forEach((line, i) => {
|
|
20
|
+
if (inScale && SCALE_CLAUSE_RX.test(line)) { dropped = true; return; }
|
|
21
|
+
inScale = line === SCALE_HEADER;
|
|
22
|
+
if (isReferenceLine(line, lines[i + 1])) { dropped = true; return; }
|
|
23
|
+
const isBlank = !line.trim();
|
|
24
|
+
if (isBlank && kept.length && !kept[kept.length - 1].trim()) return;
|
|
25
|
+
kept.push(line);
|
|
26
|
+
});
|
|
27
|
+
return dropped ? kept.join('\n') : body;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { TRIAGE_RESULT_MARKER, compactTriageResult, isTriageResultMessage };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const { Symptoms_ID } = require('../../config/airtableConfig');
|
|
2
|
+
const { logger } = require('../../utils/logger');
|
|
3
|
+
const { getRecordByFilter } = require('../../services/airtableService');
|
|
4
|
+
const { buildPayloadFromTriageRow } = require('../../fhir/helpers/triagePayloadHelper');
|
|
5
|
+
|
|
6
|
+
const RECORD_ID_RX = /^rec[A-Za-z0-9]+$/;
|
|
7
|
+
const ITEM_TABLE = 'pro_ctcae_questions';
|
|
8
|
+
const ITEM_FIELD = 'item_proctcae';
|
|
9
|
+
|
|
10
|
+
const linkIdsOf = (value) => (Array.isArray(value) ? value : []).filter((id) => RECORD_ID_RX.test(String(id || '')));
|
|
11
|
+
|
|
12
|
+
const fail = (reason, message) => ({ ok: false, reason, message });
|
|
13
|
+
|
|
14
|
+
async function resolveLinkedItems(links, triageRecordId) {
|
|
15
|
+
const resolved = Object.fromEntries(Object.keys(links).map((field) => [field, []]));
|
|
16
|
+
const ids = [...new Set(Object.values(links).flatMap(linkIdsOf))];
|
|
17
|
+
const byId = new Map();
|
|
18
|
+
if (ids.length) {
|
|
19
|
+
const filter = `OR(${ids.map((id) => `RECORD_ID()='${id}'`).join(',')})`;
|
|
20
|
+
let rows;
|
|
21
|
+
try {
|
|
22
|
+
rows = await getRecordByFilter(Symptoms_ID, ITEM_TABLE, filter, null, [ITEM_FIELD], true);
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
for (const row of (Array.isArray(rows) ? rows : [])) byId.set(row._recordId, row[ITEM_FIELD]);
|
|
27
|
+
}
|
|
28
|
+
for (const [field, value] of Object.entries(links)) {
|
|
29
|
+
const linked = (Array.isArray(value) ? value : []).length;
|
|
30
|
+
const wanted = linkIdsOf(value);
|
|
31
|
+
const items = wanted.map((id) => byId.get(id)).filter((item) => item != null && String(item).trim() !== '');
|
|
32
|
+
if (items.length !== linked) {
|
|
33
|
+
logger.warn('[TriageRecommendationController] unresolved triage item links', {
|
|
34
|
+
triageRecordId, field, linked, matchedIdShape: wanted.length, resolved: items.length,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
resolved[field] = items;
|
|
38
|
+
}
|
|
39
|
+
return resolved;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function buildRetriggerPayload({ triageRecordId, code }) {
|
|
43
|
+
if (typeof triageRecordId !== 'string' || !RECORD_ID_RX.test(triageRecordId.trim())) {
|
|
44
|
+
return fail('invalid_triage_id', 'triage_record_id must be an Airtable record id');
|
|
45
|
+
}
|
|
46
|
+
if (!code || typeof code !== 'string') return fail('missing_code', 'code is required');
|
|
47
|
+
|
|
48
|
+
const safeId = triageRecordId.trim();
|
|
49
|
+
const rows = await getRecordByFilter(Symptoms_ID, 'triaje_symptoms', `RECORD_ID()='${safeId}'`).catch(() => undefined);
|
|
50
|
+
if (!Array.isArray(rows)) return fail('triage_read_failed', 'triage record read failed');
|
|
51
|
+
const row = rows[0];
|
|
52
|
+
if (!row) return fail('triage_not_found', 'triage record not found');
|
|
53
|
+
|
|
54
|
+
const patientLink = Array.isArray(row.patient_id) ? row.patient_id[0] : row.patient_id;
|
|
55
|
+
if (!patientLink) return fail('no_patient_link', 'triage row has no patient link');
|
|
56
|
+
|
|
57
|
+
const patients = await getRecordByFilter(Symptoms_ID, 'estado_general', `RECORD_ID()='${patientLink}'`).catch(() => undefined);
|
|
58
|
+
if (!Array.isArray(patients)) return fail('patient_read_failed', 'patient record read failed');
|
|
59
|
+
if (!patients[0]) return fail('patient_not_found', 'patient record not found');
|
|
60
|
+
if (patients[0].whatsapp_id !== code) return fail('code_mismatch', 'code does not match the triage row patient');
|
|
61
|
+
|
|
62
|
+
const linkedItems = await resolveLinkedItems({
|
|
63
|
+
additional_symptoms_select: row.additional_symptoms_select,
|
|
64
|
+
pain_multiselect: row.pain_multiselect,
|
|
65
|
+
}, safeId);
|
|
66
|
+
if (!linkedItems) return fail('item_read_failed', 'triage item read failed');
|
|
67
|
+
|
|
68
|
+
const cadence = row['type_quest (from questionnaire_id)'];
|
|
69
|
+
const {
|
|
70
|
+
additional_symptoms_select: additionalSymptoms,
|
|
71
|
+
pain_multiselect: painOptions,
|
|
72
|
+
} = linkedItems;
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
ok: true,
|
|
76
|
+
payload: buildPayloadFromTriageRow(
|
|
77
|
+
{ ...row, type_quest: Array.isArray(cadence) ? cadence[0] : cadence ?? row.type_quest },
|
|
78
|
+
{ patientCode: code, triageRecordId: safeId, additionalSymptoms, painOptions },
|
|
79
|
+
),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = {
|
|
84
|
+
buildRetriggerPayload,
|
|
85
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const { logger } = require('../../utils/logger');
|
|
2
|
+
|
|
3
|
+
const toArray = (value, parse = (item) => item) => {
|
|
4
|
+
if (typeof value === 'string') return value.split(',').map((item) => parse(item.trim()));
|
|
5
|
+
return Array.isArray(value) ? value.map(parse) : [parse(value)];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function pairTriageSymptoms(record, source = 'triage') {
|
|
9
|
+
const names = record?.symptom_name_positive;
|
|
10
|
+
const grades = record?.['grade_num (from symptoms)'];
|
|
11
|
+
if (!names || !grades) return { symptoms: [], aligned: false };
|
|
12
|
+
|
|
13
|
+
const nameArr = toArray(names);
|
|
14
|
+
const gradeArr = toArray(grades, (grade) => parseInt(grade, 10));
|
|
15
|
+
const aligned = nameArr.length === gradeArr.length;
|
|
16
|
+
if (!aligned) {
|
|
17
|
+
logger.warn(`[${source}] Triage rollups misaligned, omitting grades`, {
|
|
18
|
+
date: record.Date, names: nameArr.length, grades: gradeArr.length,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const symptoms = nameArr.map((name, index) => {
|
|
23
|
+
const grade = aligned ? gradeArr[index] : null;
|
|
24
|
+
return { name, grade: Number.isFinite(grade) ? grade : null };
|
|
25
|
+
});
|
|
26
|
+
if (aligned && symptoms.some((symptom) => symptom.grade === null)) {
|
|
27
|
+
logger.warn(`[${source}] Triage grade is not a number, omitting it`, { date: record.Date });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return { symptoms, aligned };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = { pairTriageSymptoms, toArray };
|
package/lib/clinical/index.js
CHANGED
|
@@ -22,6 +22,8 @@ const { getProviderVariant, getAnthropicClient, setOpenAIProvider, getOpenAIProv
|
|
|
22
22
|
const llmConfigModule = require('./config/llmConfig');
|
|
23
23
|
|
|
24
24
|
const { ToolRuntimeContext } = require('./context/ToolRuntimeContext');
|
|
25
|
+
const { TURN_KIND } = require('./context/turnContext');
|
|
26
|
+
const { runOutreachSweep } = require('./services/outreachSweepService');
|
|
25
27
|
|
|
26
28
|
const { getCtcaeCatalog } = require('./stores/CtcaeCatalog');
|
|
27
29
|
const { registerClinicalTools } = require('./tools/registerClinicalTools');
|
|
@@ -66,6 +68,8 @@ module.exports = {
|
|
|
66
68
|
requireOpenAIProvider,
|
|
67
69
|
configureOpenAIProvider,
|
|
68
70
|
ToolRuntimeContext,
|
|
71
|
+
TURN_KIND,
|
|
72
|
+
runOutreachSweep,
|
|
69
73
|
get openaiClient() { return llmConfigModule.openaiClient; },
|
|
70
74
|
get providerInstance() { return llmConfigModule.providerInstance; },
|
|
71
75
|
};
|