evo360-types 1.3.604 → 1.3.608
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/dist/apps/evo-csq/zod-schemas.d.ts +585 -0
- package/dist/apps/evo-csq/zod-schemas.js +43 -2
- package/dist/apps/evo-csq/zod-schemas.ts +46 -0
- package/dist/apps/hub-automation/zod-schemas.d.ts +4 -4
- package/dist/types/evo-crm/dic/index.d.ts +5 -5
- package/dist/types/evo-crm/dic/index.js +5 -5
- package/dist/types/evo-crm/dic/index.ts +5 -5
- package/dist/types/evo-csq/index.d.ts +61 -2
- package/dist/types/evo-csq/index.js +5 -1
- package/dist/types/evo-csq/index.ts +72 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.zCsqLeadReportSchema = exports.zCsqRunSchema = exports.zCsqAlertCountsSchema = exports.zCsqEligibilitySchema = exports.zCsqEvaluatedForSchema = exports.zCsqReportHeaderSchema = exports.zCsqReportAttendantSchema = exports.zCsqReportPatientSchema = exports.zCsqReportLeadSchema = exports.zCsqSystemFactsSchema = exports.zCsqBillingFactSchema = exports.zCsqPreviousTicketFactSchema = void 0;
|
|
3
|
+
exports.zCsqJudgeResolvedAlertSchema = exports.zCsqJudgeRevalidationSchema = exports.zCsqLlmUsageSchema = exports.zCsqTranscriptMessageSchema = exports.zCsqTicketSummarySchema = exports.zCsqTrailEntrySchema = exports.zCsqReviewSchema = exports.zCsqDataQualitySchema = exports.zCsqCoverageSchema = exports.zCsqContributorSchema = exports.zCsqEvaluationSchema = exports.zCsqPillarScoreSchema = exports.zCsqPillarCoverageSchema = exports.zCsqCriterionScoreSchema = exports.zCsqCrossCheckSchema = exports.zCsqClaimTypeSchema = exports.zCsqClaimSchema = exports.zCsqClaimPriceInformedSchema = exports.zCsqClaimPatientStatusSchema = exports.zCsqClaimFirstConcreteOfferSchema = exports.zCsqClaimQuestionRequiresAnswerSchema = exports.zCsqClaimOutcomeSchema = exports.zCsqClaimRequiredDataSchema = exports.zCsqClaimDataCollectedSchema = exports.zCsqClaimPromiseSchema = exports.zCsqClaimAppointmentInformedSchema = exports.zCsqLeadStateSchema = exports.zCsqLeadStateListFieldSchema = exports.zCsqLeadStateFieldSchema = exports.zCsqIndicatorsSchema = exports.zCsqIndicatorsSetSchema = exports.zCsqAlertSchema = exports.zCsqEvidenceSchema = exports.zCsqAlertSubtypeSchema = exports.zCsqAlertCodeSchema = exports.zCsqPillarCodeSchema = exports.zCsqCriterionScoreValueSchema = exports.zCsqAuthorKindSchema = exports.zCsqReviewVerdictSchema = exports.zCsqLlmConnectionSourceSchema = exports.zCsqPhaseSchema = exports.zCsqRunStatusSchema = exports.zCsqVerificationStateSchema = exports.zCsqAlertResolvedReasonSchema = exports.zCsqAlertLifecycleSchema = exports.zCsqAlertScopeSchema = exports.zCsqAlertSourceSchema = exports.zCsqSeveritySchema = exports.zCsqStatusSchema = exports.zCsqModeSchema = void 0;
|
|
4
|
+
exports.zCsqLeadReportSchema = exports.zCsqRunSchema = exports.zCsqAlertCountsSchema = exports.zCsqEligibilitySchema = exports.zCsqEvaluatedForSchema = exports.zCsqReportHeaderSchema = exports.zCsqReportAttendantSchema = exports.zCsqReportPatientSchema = exports.zCsqReportLeadSchema = exports.zCsqSystemFactsSchema = exports.zCsqBillingFactSchema = exports.zCsqPreviousTicketFactSchema = exports.zCsqOverlapFactSchema = exports.zCsqOverlapFamilyHintsSchema = exports.zCsqOverlapAppointmentFactSchema = exports.zCsqAppointmentFactSchema = exports.zCsqJudgeOutputSchema = void 0;
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const zod_schemas_1 = require("../shared/zod-schemas");
|
|
7
7
|
// Schemas zod do CSQ 2.0 (feat-154). As interfaces TS equivalentes ficam em
|
|
@@ -23,6 +23,15 @@ exports.zCsqSeveritySchema = zod_1.z.enum(["critica", "alta", "media", "baixa"])
|
|
|
23
23
|
exports.zCsqAlertSourceSchema = zod_1.z.enum(["deterministic", "llm", "hybrid"]);
|
|
24
24
|
exports.zCsqAlertScopeSchema = zod_1.z.enum(["ticket", "journey"]);
|
|
25
25
|
exports.zCsqAlertLifecycleSchema = zod_1.z.enum(["open", "resolved"]);
|
|
26
|
+
/** Motivo da resolucao de um alerta (lote 9). */
|
|
27
|
+
exports.zCsqAlertResolvedReasonSchema = zod_1.z.enum([
|
|
28
|
+
"fact",
|
|
29
|
+
"judge_resolved",
|
|
30
|
+
"judge_dismissed",
|
|
31
|
+
"code_guard",
|
|
32
|
+
"recheck_ok",
|
|
33
|
+
"supervisor_false_positive",
|
|
34
|
+
]);
|
|
26
35
|
exports.zCsqVerificationStateSchema = zod_1.z.enum([
|
|
27
36
|
"pending",
|
|
28
37
|
"confirmed_ok",
|
|
@@ -129,6 +138,8 @@ exports.zCsqAlertSchema = zod_1.z.object({
|
|
|
129
138
|
verification: exports.zCsqVerificationStateSchema.optional(),
|
|
130
139
|
recheck_after: zod_schemas_1.zFirestoreDateSchema.optional(),
|
|
131
140
|
resolved_in_ticket: zod_1.z.string().optional(),
|
|
141
|
+
resolved_reason: exports.zCsqAlertResolvedReasonSchema.optional(),
|
|
142
|
+
resolved_note: zod_1.z.string().optional(),
|
|
132
143
|
appointment_id: zod_1.z.string().optional(),
|
|
133
144
|
calendar_id: zod_1.z.string().optional(),
|
|
134
145
|
first_seen_ticket_id: zod_1.z.string(),
|
|
@@ -378,6 +389,17 @@ exports.zCsqLlmUsageSchema = zod_1.z.object({
|
|
|
378
389
|
cache_creation_tokens: zod_1.z.number().optional(),
|
|
379
390
|
rounds: zod_1.z.number().optional(),
|
|
380
391
|
});
|
|
392
|
+
/** Veredito do juiz sobre um achado automatico revalidavel (lote 9). */
|
|
393
|
+
exports.zCsqJudgeRevalidationSchema = zod_1.z.object({
|
|
394
|
+
fingerprint: zod_1.z.string(),
|
|
395
|
+
verdict: zod_1.z.enum(["confirm", "dismiss"]),
|
|
396
|
+
reason: zod_1.z.string(),
|
|
397
|
+
});
|
|
398
|
+
/** Alerta anterior resolvido pelo juiz, com o motivo (lote 9). */
|
|
399
|
+
exports.zCsqJudgeResolvedAlertSchema = zod_1.z.object({
|
|
400
|
+
fingerprint: zod_1.z.string(),
|
|
401
|
+
reason: zod_1.z.string(),
|
|
402
|
+
});
|
|
381
403
|
/** Schema da tool `submit_csq_evaluation`. ESTRITO de proposito: e o contrato
|
|
382
404
|
* de saida do LLM, nao um doc do Firestore — nada de passthrough aqui. */
|
|
383
405
|
exports.zCsqJudgeOutputSchema = zod_1.z.object({
|
|
@@ -389,6 +411,8 @@ exports.zCsqJudgeOutputSchema = zod_1.z.object({
|
|
|
389
411
|
alerts: zod_1.z.array(exports.zCsqAlertSchema),
|
|
390
412
|
/** Fingerprints de alertas anteriores resolvidos neste atendimento. */
|
|
391
413
|
resolved_alert_ids: zod_1.z.array(zod_1.z.string()),
|
|
414
|
+
resolved_alerts: zod_1.z.array(exports.zCsqJudgeResolvedAlertSchema).optional(),
|
|
415
|
+
revalidations: zod_1.z.array(exports.zCsqJudgeRevalidationSchema).optional(),
|
|
392
416
|
highlights: zod_1.z.array(zod_1.z.string()),
|
|
393
417
|
improvements: zod_1.z.array(zod_1.z.string()),
|
|
394
418
|
confidence: zod_1.z.number().min(0).max(1),
|
|
@@ -407,11 +431,27 @@ exports.zCsqAppointmentFactSchema = zod_1.z.object({
|
|
|
407
431
|
modality: zod_1.z.string().optional(),
|
|
408
432
|
created_at: zod_schemas_1.zFirestoreDateSchema.optional(),
|
|
409
433
|
});
|
|
434
|
+
exports.zCsqOverlapAppointmentFactSchema = zod_1.z.object({
|
|
435
|
+
id: zod_1.z.string(),
|
|
436
|
+
patient_id: zod_1.z.string().optional(),
|
|
437
|
+
patient_name: zod_1.z.string().optional(),
|
|
438
|
+
start_at: zod_schemas_1.zFirestoreDateSchema,
|
|
439
|
+
end_at: zod_schemas_1.zFirestoreDateSchema.optional(),
|
|
440
|
+
professional_name: zod_1.z.string().optional(),
|
|
441
|
+
is_lead: zod_1.z.boolean(),
|
|
442
|
+
});
|
|
443
|
+
exports.zCsqOverlapFamilyHintsSchema = zod_1.z.object({
|
|
444
|
+
same_surname: zod_1.z.boolean(),
|
|
445
|
+
same_contact: zod_1.z.boolean(),
|
|
446
|
+
same_lead: zod_1.z.boolean(),
|
|
447
|
+
});
|
|
410
448
|
exports.zCsqOverlapFactSchema = zod_1.z.object({
|
|
411
449
|
professional_name: zod_1.z.string().optional(),
|
|
412
450
|
appointment_ids: zod_1.z.array(zod_1.z.string()),
|
|
413
451
|
start_at: zod_schemas_1.zFirestoreDateSchema,
|
|
414
452
|
end_at: zod_schemas_1.zFirestoreDateSchema,
|
|
453
|
+
appointments: zod_1.z.array(exports.zCsqOverlapAppointmentFactSchema).optional(),
|
|
454
|
+
family_hints: exports.zCsqOverlapFamilyHintsSchema.optional(),
|
|
415
455
|
});
|
|
416
456
|
exports.zCsqPreviousTicketFactSchema = zod_1.z.object({
|
|
417
457
|
ticket_id: zod_1.z.string(),
|
|
@@ -549,6 +589,7 @@ exports.zCsqLeadReportSchema = zod_schemas_1.zFireDocSchema
|
|
|
549
589
|
coverage: exports.zCsqCoverageSchema,
|
|
550
590
|
data_quality: exports.zCsqDataQualitySchema.optional(),
|
|
551
591
|
review: exports.zCsqReviewSchema.optional(),
|
|
592
|
+
suppressed_alert_fingerprints: zod_1.z.array(zod_1.z.string()).optional(),
|
|
552
593
|
deleted_by_login_id: zod_1.z.string().optional(),
|
|
553
594
|
deleted_reason: zod_1.z.string().optional(),
|
|
554
595
|
verification: exports.zCsqVerificationStateSchema.optional(),
|
|
@@ -29,6 +29,16 @@ export const zCsqAlertScopeSchema = z.enum(["ticket", "journey"]);
|
|
|
29
29
|
|
|
30
30
|
export const zCsqAlertLifecycleSchema = z.enum(["open", "resolved"]);
|
|
31
31
|
|
|
32
|
+
/** Motivo da resolucao de um alerta (lote 9). */
|
|
33
|
+
export const zCsqAlertResolvedReasonSchema = z.enum([
|
|
34
|
+
"fact",
|
|
35
|
+
"judge_resolved",
|
|
36
|
+
"judge_dismissed",
|
|
37
|
+
"code_guard",
|
|
38
|
+
"recheck_ok",
|
|
39
|
+
"supervisor_false_positive",
|
|
40
|
+
]);
|
|
41
|
+
|
|
32
42
|
export const zCsqVerificationStateSchema = z.enum([
|
|
33
43
|
"pending",
|
|
34
44
|
"confirmed_ok",
|
|
@@ -148,6 +158,8 @@ export const zCsqAlertSchema = z.object({
|
|
|
148
158
|
verification: zCsqVerificationStateSchema.optional(),
|
|
149
159
|
recheck_after: zFirestoreDateSchema.optional(),
|
|
150
160
|
resolved_in_ticket: z.string().optional(),
|
|
161
|
+
resolved_reason: zCsqAlertResolvedReasonSchema.optional(),
|
|
162
|
+
resolved_note: z.string().optional(),
|
|
151
163
|
appointment_id: z.string().optional(),
|
|
152
164
|
calendar_id: z.string().optional(),
|
|
153
165
|
first_seen_ticket_id: z.string(),
|
|
@@ -436,6 +448,19 @@ export const zCsqLlmUsageSchema = z.object({
|
|
|
436
448
|
rounds: z.number().optional(),
|
|
437
449
|
});
|
|
438
450
|
|
|
451
|
+
/** Veredito do juiz sobre um achado automatico revalidavel (lote 9). */
|
|
452
|
+
export const zCsqJudgeRevalidationSchema = z.object({
|
|
453
|
+
fingerprint: z.string(),
|
|
454
|
+
verdict: z.enum(["confirm", "dismiss"]),
|
|
455
|
+
reason: z.string(),
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
/** Alerta anterior resolvido pelo juiz, com o motivo (lote 9). */
|
|
459
|
+
export const zCsqJudgeResolvedAlertSchema = z.object({
|
|
460
|
+
fingerprint: z.string(),
|
|
461
|
+
reason: z.string(),
|
|
462
|
+
});
|
|
463
|
+
|
|
439
464
|
/** Schema da tool `submit_csq_evaluation`. ESTRITO de proposito: e o contrato
|
|
440
465
|
* de saida do LLM, nao um doc do Firestore — nada de passthrough aqui. */
|
|
441
466
|
export const zCsqJudgeOutputSchema = z.object({
|
|
@@ -447,6 +472,8 @@ export const zCsqJudgeOutputSchema = z.object({
|
|
|
447
472
|
alerts: z.array(zCsqAlertSchema),
|
|
448
473
|
/** Fingerprints de alertas anteriores resolvidos neste atendimento. */
|
|
449
474
|
resolved_alert_ids: z.array(z.string()),
|
|
475
|
+
resolved_alerts: z.array(zCsqJudgeResolvedAlertSchema).optional(),
|
|
476
|
+
revalidations: z.array(zCsqJudgeRevalidationSchema).optional(),
|
|
450
477
|
highlights: z.array(z.string()),
|
|
451
478
|
improvements: z.array(z.string()),
|
|
452
479
|
confidence: z.number().min(0).max(1),
|
|
@@ -468,11 +495,29 @@ export const zCsqAppointmentFactSchema = z.object({
|
|
|
468
495
|
created_at: zFirestoreDateSchema.optional(),
|
|
469
496
|
});
|
|
470
497
|
|
|
498
|
+
export const zCsqOverlapAppointmentFactSchema = z.object({
|
|
499
|
+
id: z.string(),
|
|
500
|
+
patient_id: z.string().optional(),
|
|
501
|
+
patient_name: z.string().optional(),
|
|
502
|
+
start_at: zFirestoreDateSchema,
|
|
503
|
+
end_at: zFirestoreDateSchema.optional(),
|
|
504
|
+
professional_name: z.string().optional(),
|
|
505
|
+
is_lead: z.boolean(),
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
export const zCsqOverlapFamilyHintsSchema = z.object({
|
|
509
|
+
same_surname: z.boolean(),
|
|
510
|
+
same_contact: z.boolean(),
|
|
511
|
+
same_lead: z.boolean(),
|
|
512
|
+
});
|
|
513
|
+
|
|
471
514
|
export const zCsqOverlapFactSchema = z.object({
|
|
472
515
|
professional_name: z.string().optional(),
|
|
473
516
|
appointment_ids: z.array(z.string()),
|
|
474
517
|
start_at: zFirestoreDateSchema,
|
|
475
518
|
end_at: zFirestoreDateSchema,
|
|
519
|
+
appointments: z.array(zCsqOverlapAppointmentFactSchema).optional(),
|
|
520
|
+
family_hints: zCsqOverlapFamilyHintsSchema.optional(),
|
|
476
521
|
});
|
|
477
522
|
|
|
478
523
|
export const zCsqPreviousTicketFactSchema = z.object({
|
|
@@ -629,6 +674,7 @@ export const zCsqLeadReportSchema = zFireDocSchema
|
|
|
629
674
|
coverage: zCsqCoverageSchema,
|
|
630
675
|
data_quality: zCsqDataQualitySchema.optional(),
|
|
631
676
|
review: zCsqReviewSchema.optional(),
|
|
677
|
+
suppressed_alert_fingerprints: z.array(z.string()).optional(),
|
|
632
678
|
deleted_by_login_id: z.string().optional(),
|
|
633
679
|
deleted_reason: z.string().optional(),
|
|
634
680
|
verification: zCsqVerificationStateSchema.optional(),
|
|
@@ -610,20 +610,20 @@ export declare const zAutomationConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
610
610
|
operator: z.ZodEnum<["eq", "neq", "in", "not_in", "exists", "not_exists", "is_true", "is_false", "between", "not_between"]>;
|
|
611
611
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
612
612
|
}, "strip", z.ZodTypeAny, {
|
|
613
|
-
operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
|
|
614
613
|
fact: string;
|
|
614
|
+
operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
|
|
615
615
|
value?: unknown;
|
|
616
616
|
}, {
|
|
617
|
-
operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
|
|
618
617
|
fact: string;
|
|
618
|
+
operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
|
|
619
619
|
value?: unknown;
|
|
620
620
|
}>, {
|
|
621
|
-
operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
|
|
622
621
|
fact: string;
|
|
622
|
+
operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
|
|
623
623
|
value?: unknown;
|
|
624
624
|
}, {
|
|
625
|
-
operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
|
|
626
625
|
fact: string;
|
|
626
|
+
operator: "in" | "eq" | "neq" | "not_in" | "exists" | "not_exists" | "is_true" | "is_false" | "between" | "not_between";
|
|
627
627
|
value?: unknown;
|
|
628
628
|
}>;
|
|
629
629
|
type ZAutomationConditionGroup = {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export * from "../fb_collections";
|
|
2
2
|
import { FirestoreDocumentReference, IFireDoc, ITag } from "../../shared";
|
|
3
3
|
export declare const EvoCrmDicPermissions: {
|
|
4
|
-
readonly List: "
|
|
5
|
-
readonly Get: "
|
|
6
|
-
readonly Create: "
|
|
7
|
-
readonly Update: "
|
|
8
|
-
readonly Delete: "
|
|
4
|
+
readonly List: "evo_crm_dic_read";
|
|
5
|
+
readonly Get: "evo_crm_dic_read";
|
|
6
|
+
readonly Create: "evo_crm_dic_write";
|
|
7
|
+
readonly Update: "evo_crm_dic_write";
|
|
8
|
+
readonly Delete: "evo_crm_dic_write";
|
|
9
9
|
};
|
|
10
10
|
export type EvoCrmDicPermissions = (typeof EvoCrmDicPermissions)[keyof typeof EvoCrmDicPermissions];
|
|
11
11
|
export type CRMDicAction = "CREATE_DIST_CHANNEL_TYPE" | "DELETE_DIST_CHANNEL_TYPE" | "UPDATE_DIST_CHANNEL_TYPE" | "CREATE_DIST_CHANNEL" | "DELETE_DIST_CHANNEL" | "UPDATE_DIST_CHANNEL" | "CREATE_LEADQUALIFICATION" | "DELETE_LEADQUALIFICATION" | "UPDATE_LEADQUALIFICATION";
|
|
@@ -18,11 +18,11 @@ exports.IQualificationFunnelLevel = exports.ICRMDicAction = exports.EvoCrmDicPer
|
|
|
18
18
|
__exportStar(require("../fb_collections"), exports);
|
|
19
19
|
// Permissões para o dicionário
|
|
20
20
|
exports.EvoCrmDicPermissions = {
|
|
21
|
-
List: "
|
|
22
|
-
Get: "
|
|
23
|
-
Create: "
|
|
24
|
-
Update: "
|
|
25
|
-
Delete: "
|
|
21
|
+
List: "evo_crm_dic_read",
|
|
22
|
+
Get: "evo_crm_dic_read",
|
|
23
|
+
Create: "evo_crm_dic_write",
|
|
24
|
+
Update: "evo_crm_dic_write",
|
|
25
|
+
Delete: "evo_crm_dic_write",
|
|
26
26
|
};
|
|
27
27
|
var ICRMDicAction;
|
|
28
28
|
(function (ICRMDicAction) {
|
|
@@ -4,11 +4,11 @@ import { FirestoreDocumentReference, IFireDoc, ITag } from "../../shared";
|
|
|
4
4
|
|
|
5
5
|
// Permissões para o dicionário
|
|
6
6
|
export const EvoCrmDicPermissions = {
|
|
7
|
-
List: "
|
|
8
|
-
Get: "
|
|
9
|
-
Create: "
|
|
10
|
-
Update: "
|
|
11
|
-
Delete: "
|
|
7
|
+
List: "evo_crm_dic_read",
|
|
8
|
+
Get: "evo_crm_dic_read",
|
|
9
|
+
Create: "evo_crm_dic_write",
|
|
10
|
+
Update: "evo_crm_dic_write",
|
|
11
|
+
Delete: "evo_crm_dic_write",
|
|
12
12
|
} as const;
|
|
13
13
|
|
|
14
14
|
export type EvoCrmDicPermissions =
|
|
@@ -9,7 +9,11 @@ export * from "./fb_collections";
|
|
|
9
9
|
* da rubrica (profissional de saude no canal, nome completo so com agendamento, agenda so pelo
|
|
10
10
|
* codigo, urgencia = encaixe, soma de familia, responsavel x paciente). Serve para separar as
|
|
11
11
|
* series antes/depois na analise. */
|
|
12
|
-
|
|
12
|
+
/** v1.3 (2026-09-24, auditoria dos laudos "encaminhar a supervisao"): mesmos pilares/criterios;
|
|
13
|
+
* muda o TEXTO (hierarquia de precedencia: autorizacao da profissional > roteiro do tenant >
|
|
14
|
+
* regra generica; familia em horarios vizinhos e esperada; `retorno_apos_vou_verificar` e
|
|
15
|
+
* `nomes_corretos` com ponderacao) e a SAIDA do juiz ganha `revalidations` e `resolved_alerts`. */
|
|
16
|
+
export declare const CSQ_RUBRIC_VERSION = "v1.3";
|
|
13
17
|
/** Modo do CSQ por departamento (gravado no binding da HubIA).
|
|
14
18
|
* - `off` : nao avalia (default quando ausente).
|
|
15
19
|
* - `shadow` : avalia e grava o laudo, sem notificar supervisores.
|
|
@@ -29,6 +33,14 @@ export type CsqAlertScope = "ticket" | "journey";
|
|
|
29
33
|
/** Ciclo de vida do alerta. Um alerta da jornada fica `open` no laudo corrente
|
|
30
34
|
* ate uma avaliacao posterior constatar a correcao; entao vira `resolved`. */
|
|
31
35
|
export type CsqAlertLifecycle = "open" | "resolved";
|
|
36
|
+
/** Por que um alerta virou `resolved` (feat-154 lote 9). Ausente em laudos anteriores.
|
|
37
|
+
* - `fact` : o recomputo/fato da avaliacao seguinte o encerrou.
|
|
38
|
+
* - `judge_resolved` : o juiz declarou corrigido/insustentavel (alerta `llm`).
|
|
39
|
+
* - `judge_dismissed` : o juiz revalidou um achado automatico e o descartou.
|
|
40
|
+
* - `code_guard` : guarda deterministica aplicada a alerta herdado.
|
|
41
|
+
* - `recheck_ok` : a rechecagem da agenda passou a bater.
|
|
42
|
+
* - `supervisor_false_positive` : marcado como falso positivo na revisao do supervisor. */
|
|
43
|
+
export type CsqAlertResolvedReason = "fact" | "judge_resolved" | "judge_dismissed" | "code_guard" | "recheck_ok" | "supervisor_false_positive";
|
|
32
44
|
/** Estado da rechecagem agendada de agenda (adendo §B). Alertas de agenda
|
|
33
45
|
* nascem `pending` (sem auto-fail nem notificacao) e sao reavaliados em
|
|
34
46
|
* `closed_at + CSQ_DEFAULTS.recheck_delay_min`.
|
|
@@ -145,6 +157,10 @@ export interface ICsqAlert {
|
|
|
145
157
|
recheck_after?: Date;
|
|
146
158
|
/** Ticket em que o alerta foi constatado como resolvido. */
|
|
147
159
|
resolved_in_ticket?: string;
|
|
160
|
+
/** Motivo da resolucao (lote 9). */
|
|
161
|
+
resolved_reason?: CsqAlertResolvedReason;
|
|
162
|
+
/** Texto do motivo, quando houver (ex.: justificativa do juiz). */
|
|
163
|
+
resolved_note?: string;
|
|
148
164
|
/** So em alertas de agenda: agendamento com que o claim foi cruzado, para o
|
|
149
165
|
* Nexus linkar `/{tenant}/evo-med/calendar/{calendar_id}/appointment/{appointment_id}`. */
|
|
150
166
|
appointment_id?: string;
|
|
@@ -442,6 +458,18 @@ export interface ICsqLlmUsage {
|
|
|
442
458
|
/** Tentativas gastas. Contrato: <= 2 (1 retry por falha de schema). */
|
|
443
459
|
rounds?: number;
|
|
444
460
|
}
|
|
461
|
+
/** Veredito do juiz sobre um achado automatico revalidavel (lote 9). O codigo
|
|
462
|
+
* so aplica `dismiss` a codigos da allowlist de revalidacao. */
|
|
463
|
+
export interface ICsqJudgeRevalidation {
|
|
464
|
+
fingerprint: string;
|
|
465
|
+
verdict: "confirm" | "dismiss";
|
|
466
|
+
reason: string;
|
|
467
|
+
}
|
|
468
|
+
/** Alerta anterior (fonte `llm`) que o juiz declarou resolvido, com o motivo. */
|
|
469
|
+
export interface ICsqJudgeResolvedAlert {
|
|
470
|
+
fingerprint: string;
|
|
471
|
+
reason: string;
|
|
472
|
+
}
|
|
445
473
|
/** Saida estruturada da tool `submit_csq_evaluation`. O juiz NAO recebe tools
|
|
446
474
|
* de leitura e nao decide o score final: so pontua, extrai e cita evidencia. */
|
|
447
475
|
export interface ICsqJudgeOutput {
|
|
@@ -454,6 +482,11 @@ export interface ICsqJudgeOutput {
|
|
|
454
482
|
/** Fingerprints de alertas anteriores que este atendimento resolveu.
|
|
455
483
|
* So resolve alertas de fonte `llm` (adendo §G). */
|
|
456
484
|
resolved_alert_ids: string[];
|
|
485
|
+
/** Lote 9: os mesmos resolvidos, com o motivo. Os fingerprints entram tambem em
|
|
486
|
+
* `resolved_alert_ids` na normalizacao. */
|
|
487
|
+
resolved_alerts?: ICsqJudgeResolvedAlert[];
|
|
488
|
+
/** Lote 9: veredito sobre os "achados automaticos a revalidar" do prompt. */
|
|
489
|
+
revalidations?: ICsqJudgeRevalidation[];
|
|
457
490
|
highlights: string[];
|
|
458
491
|
improvements: string[];
|
|
459
492
|
confidence: number;
|
|
@@ -472,12 +505,35 @@ export interface ICsqAppointmentFact {
|
|
|
472
505
|
modality?: string;
|
|
473
506
|
created_at?: Date;
|
|
474
507
|
}
|
|
475
|
-
/**
|
|
508
|
+
/** Agendamento envolvido numa sobreposicao (lote 9). */
|
|
509
|
+
export interface ICsqOverlapAppointmentFact {
|
|
510
|
+
id: string;
|
|
511
|
+
patient_id?: string;
|
|
512
|
+
patient_name?: string;
|
|
513
|
+
start_at: Date;
|
|
514
|
+
end_at?: Date;
|
|
515
|
+
professional_name?: string;
|
|
516
|
+
/** O agendamento e de paciente vinculado ao lead avaliado. */
|
|
517
|
+
is_lead: boolean;
|
|
518
|
+
}
|
|
519
|
+
/** Pistas de agendamento de familia numa sobreposicao (lote 9). */
|
|
520
|
+
export interface ICsqOverlapFamilyHints {
|
|
521
|
+
/** Os pacientes envolvidos (ou o lead) compartilham o sobrenome. */
|
|
522
|
+
same_surname: boolean;
|
|
523
|
+
/** O outro paciente tem o mesmo telefone do lead. */
|
|
524
|
+
same_contact: boolean;
|
|
525
|
+
/** Todos os pacientes envolvidos estao vinculados ao mesmo lead. */
|
|
526
|
+
same_lead: boolean;
|
|
527
|
+
}
|
|
528
|
+
/** Sobreposicao detectada entre agendamentos do mesmo profissional. Desde o
|
|
529
|
+
* lote 9 so envolve agendamentos em que pelo menos um e do lead. */
|
|
476
530
|
export interface ICsqOverlapFact {
|
|
477
531
|
professional_name?: string;
|
|
478
532
|
appointment_ids: string[];
|
|
479
533
|
start_at: Date;
|
|
480
534
|
end_at: Date;
|
|
535
|
+
appointments?: ICsqOverlapAppointmentFact[];
|
|
536
|
+
family_hints?: ICsqOverlapFamilyHints;
|
|
481
537
|
}
|
|
482
538
|
/** Ticket anterior da jornada (motivo, quem fechou). */
|
|
483
539
|
export interface ICsqPreviousTicketFact {
|
|
@@ -633,6 +689,9 @@ export interface ICsqLeadReport extends IFireDoc {
|
|
|
633
689
|
data_quality?: ICsqDataQuality;
|
|
634
690
|
/** Veredito humano (adendo §D). */
|
|
635
691
|
review?: ICsqReview;
|
|
692
|
+
/** Fingerprints marcados como falso positivo pelo supervisor em laudos anteriores
|
|
693
|
+
* (acumulado, lote 9). Alerta com fingerprint aqui fica `resolved` e nao reabre. */
|
|
694
|
+
suppressed_alert_fingerprints?: string[];
|
|
636
695
|
/** Exclusao (soft delete) pelo supervisor: `deleted_at` vem do IFireDoc. O laudo
|
|
637
696
|
* some da fila e do historico do lead; a proxima avaliacao do lead comeca do zero.
|
|
638
697
|
* Transcricao e prompt ficam em `artifacts/` para auditoria. */
|
|
@@ -34,7 +34,11 @@ __exportStar(require("./fb_collections"), exports);
|
|
|
34
34
|
* da rubrica (profissional de saude no canal, nome completo so com agendamento, agenda so pelo
|
|
35
35
|
* codigo, urgencia = encaixe, soma de familia, responsavel x paciente). Serve para separar as
|
|
36
36
|
* series antes/depois na analise. */
|
|
37
|
-
|
|
37
|
+
/** v1.3 (2026-09-24, auditoria dos laudos "encaminhar a supervisao"): mesmos pilares/criterios;
|
|
38
|
+
* muda o TEXTO (hierarquia de precedencia: autorizacao da profissional > roteiro do tenant >
|
|
39
|
+
* regra generica; familia em horarios vizinhos e esperada; `retorno_apos_vou_verificar` e
|
|
40
|
+
* `nomes_corretos` com ponderacao) e a SAIDA do juiz ganha `revalidations` e `resolved_alerts`. */
|
|
41
|
+
exports.CSQ_RUBRIC_VERSION = "v1.3";
|
|
38
42
|
// ───────── Catalogo de alertas (report-spec §6) ─────────
|
|
39
43
|
/** Codigos de alerta v1. Os subtipos de `POLITICA_VIOLADA` e
|
|
40
44
|
* `FLUXO_VENDA_NAO_SEGUIDO` vivem em `ICsqAlert.subtype`, nao como codigos. */
|
|
@@ -22,7 +22,11 @@ export * from "./fb_collections";
|
|
|
22
22
|
* da rubrica (profissional de saude no canal, nome completo so com agendamento, agenda so pelo
|
|
23
23
|
* codigo, urgencia = encaixe, soma de familia, responsavel x paciente). Serve para separar as
|
|
24
24
|
* series antes/depois na analise. */
|
|
25
|
-
|
|
25
|
+
/** v1.3 (2026-09-24, auditoria dos laudos "encaminhar a supervisao"): mesmos pilares/criterios;
|
|
26
|
+
* muda o TEXTO (hierarquia de precedencia: autorizacao da profissional > roteiro do tenant >
|
|
27
|
+
* regra generica; familia em horarios vizinhos e esperada; `retorno_apos_vou_verificar` e
|
|
28
|
+
* `nomes_corretos` com ponderacao) e a SAIDA do juiz ganha `revalidations` e `resolved_alerts`. */
|
|
29
|
+
export const CSQ_RUBRIC_VERSION = "v1.3";
|
|
26
30
|
|
|
27
31
|
// ───────── Enums / Literals ─────────
|
|
28
32
|
|
|
@@ -57,6 +61,21 @@ export type CsqAlertScope = "ticket" | "journey";
|
|
|
57
61
|
* ate uma avaliacao posterior constatar a correcao; entao vira `resolved`. */
|
|
58
62
|
export type CsqAlertLifecycle = "open" | "resolved";
|
|
59
63
|
|
|
64
|
+
/** Por que um alerta virou `resolved` (feat-154 lote 9). Ausente em laudos anteriores.
|
|
65
|
+
* - `fact` : o recomputo/fato da avaliacao seguinte o encerrou.
|
|
66
|
+
* - `judge_resolved` : o juiz declarou corrigido/insustentavel (alerta `llm`).
|
|
67
|
+
* - `judge_dismissed` : o juiz revalidou um achado automatico e o descartou.
|
|
68
|
+
* - `code_guard` : guarda deterministica aplicada a alerta herdado.
|
|
69
|
+
* - `recheck_ok` : a rechecagem da agenda passou a bater.
|
|
70
|
+
* - `supervisor_false_positive` : marcado como falso positivo na revisao do supervisor. */
|
|
71
|
+
export type CsqAlertResolvedReason =
|
|
72
|
+
| "fact"
|
|
73
|
+
| "judge_resolved"
|
|
74
|
+
| "judge_dismissed"
|
|
75
|
+
| "code_guard"
|
|
76
|
+
| "recheck_ok"
|
|
77
|
+
| "supervisor_false_positive";
|
|
78
|
+
|
|
60
79
|
/** Estado da rechecagem agendada de agenda (adendo §B). Alertas de agenda
|
|
61
80
|
* nascem `pending` (sem auto-fail nem notificacao) e sao reavaliados em
|
|
62
81
|
* `closed_at + CSQ_DEFAULTS.recheck_delay_min`.
|
|
@@ -337,6 +356,10 @@ export interface ICsqAlert {
|
|
|
337
356
|
recheck_after?: Date;
|
|
338
357
|
/** Ticket em que o alerta foi constatado como resolvido. */
|
|
339
358
|
resolved_in_ticket?: string;
|
|
359
|
+
/** Motivo da resolucao (lote 9). */
|
|
360
|
+
resolved_reason?: CsqAlertResolvedReason;
|
|
361
|
+
/** Texto do motivo, quando houver (ex.: justificativa do juiz). */
|
|
362
|
+
resolved_note?: string;
|
|
340
363
|
/** So em alertas de agenda: agendamento com que o claim foi cruzado, para o
|
|
341
364
|
* Nexus linkar `/{tenant}/evo-med/calendar/{calendar_id}/appointment/{appointment_id}`. */
|
|
342
365
|
appointment_id?: string;
|
|
@@ -691,6 +714,20 @@ export interface ICsqLlmUsage {
|
|
|
691
714
|
rounds?: number;
|
|
692
715
|
}
|
|
693
716
|
|
|
717
|
+
/** Veredito do juiz sobre um achado automatico revalidavel (lote 9). O codigo
|
|
718
|
+
* so aplica `dismiss` a codigos da allowlist de revalidacao. */
|
|
719
|
+
export interface ICsqJudgeRevalidation {
|
|
720
|
+
fingerprint: string;
|
|
721
|
+
verdict: "confirm" | "dismiss";
|
|
722
|
+
reason: string;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/** Alerta anterior (fonte `llm`) que o juiz declarou resolvido, com o motivo. */
|
|
726
|
+
export interface ICsqJudgeResolvedAlert {
|
|
727
|
+
fingerprint: string;
|
|
728
|
+
reason: string;
|
|
729
|
+
}
|
|
730
|
+
|
|
694
731
|
/** Saida estruturada da tool `submit_csq_evaluation`. O juiz NAO recebe tools
|
|
695
732
|
* de leitura e nao decide o score final: so pontua, extrai e cita evidencia. */
|
|
696
733
|
export interface ICsqJudgeOutput {
|
|
@@ -703,6 +740,11 @@ export interface ICsqJudgeOutput {
|
|
|
703
740
|
/** Fingerprints de alertas anteriores que este atendimento resolveu.
|
|
704
741
|
* So resolve alertas de fonte `llm` (adendo §G). */
|
|
705
742
|
resolved_alert_ids: string[];
|
|
743
|
+
/** Lote 9: os mesmos resolvidos, com o motivo. Os fingerprints entram tambem em
|
|
744
|
+
* `resolved_alert_ids` na normalizacao. */
|
|
745
|
+
resolved_alerts?: ICsqJudgeResolvedAlert[];
|
|
746
|
+
/** Lote 9: veredito sobre os "achados automaticos a revalidar" do prompt. */
|
|
747
|
+
revalidations?: ICsqJudgeRevalidation[];
|
|
706
748
|
highlights: string[];
|
|
707
749
|
improvements: string[];
|
|
708
750
|
confidence: number;
|
|
@@ -725,12 +767,37 @@ export interface ICsqAppointmentFact {
|
|
|
725
767
|
created_at?: Date;
|
|
726
768
|
}
|
|
727
769
|
|
|
728
|
-
/**
|
|
770
|
+
/** Agendamento envolvido numa sobreposicao (lote 9). */
|
|
771
|
+
export interface ICsqOverlapAppointmentFact {
|
|
772
|
+
id: string;
|
|
773
|
+
patient_id?: string;
|
|
774
|
+
patient_name?: string;
|
|
775
|
+
start_at: Date;
|
|
776
|
+
end_at?: Date;
|
|
777
|
+
professional_name?: string;
|
|
778
|
+
/** O agendamento e de paciente vinculado ao lead avaliado. */
|
|
779
|
+
is_lead: boolean;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/** Pistas de agendamento de familia numa sobreposicao (lote 9). */
|
|
783
|
+
export interface ICsqOverlapFamilyHints {
|
|
784
|
+
/** Os pacientes envolvidos (ou o lead) compartilham o sobrenome. */
|
|
785
|
+
same_surname: boolean;
|
|
786
|
+
/** O outro paciente tem o mesmo telefone do lead. */
|
|
787
|
+
same_contact: boolean;
|
|
788
|
+
/** Todos os pacientes envolvidos estao vinculados ao mesmo lead. */
|
|
789
|
+
same_lead: boolean;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/** Sobreposicao detectada entre agendamentos do mesmo profissional. Desde o
|
|
793
|
+
* lote 9 so envolve agendamentos em que pelo menos um e do lead. */
|
|
729
794
|
export interface ICsqOverlapFact {
|
|
730
795
|
professional_name?: string;
|
|
731
796
|
appointment_ids: string[];
|
|
732
797
|
start_at: Date;
|
|
733
798
|
end_at: Date;
|
|
799
|
+
appointments?: ICsqOverlapAppointmentFact[];
|
|
800
|
+
family_hints?: ICsqOverlapFamilyHints;
|
|
734
801
|
}
|
|
735
802
|
|
|
736
803
|
/** Ticket anterior da jornada (motivo, quem fechou). */
|
|
@@ -905,6 +972,9 @@ export interface ICsqLeadReport extends IFireDoc {
|
|
|
905
972
|
data_quality?: ICsqDataQuality;
|
|
906
973
|
/** Veredito humano (adendo §D). */
|
|
907
974
|
review?: ICsqReview;
|
|
975
|
+
/** Fingerprints marcados como falso positivo pelo supervisor em laudos anteriores
|
|
976
|
+
* (acumulado, lote 9). Alerta com fingerprint aqui fica `resolved` e nao reabre. */
|
|
977
|
+
suppressed_alert_fingerprints?: string[];
|
|
908
978
|
/** Exclusao (soft delete) pelo supervisor: `deleted_at` vem do IFireDoc. O laudo
|
|
909
979
|
* some da fila e do historico do lead; a proxima avaliacao do lead comeca do zero.
|
|
910
980
|
* Transcricao e prompt ficam em `artifacts/` para auditoria. */
|