@kontourai/survey 0.4.3 → 0.4.4
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 +211 -9
- package/dist/examples/review-workbench/downstream-public-directory-adapter.d.ts +3 -0
- package/dist/examples/review-workbench/downstream-public-directory-adapter.js +262 -0
- package/dist/examples/review-workbench/review-queue-session.d.ts +54 -0
- package/dist/examples/review-workbench/review-queue-session.js +122 -0
- package/dist/examples/review-workbench/review-surface-preview.d.ts +55 -0
- package/dist/examples/review-workbench/review-surface-preview.js +104 -0
- package/dist/examples/review-workbench/review-workbench-data.d.ts +261 -0
- package/dist/examples/review-workbench/review-workbench-data.js +199 -0
- package/dist/examples/review-workbench/review-workbench.d.ts +7 -0
- package/dist/examples/review-workbench/review-workbench.js +488 -0
- package/dist/fixtures/downstream-public-directory-proposal.d.ts +100 -0
- package/dist/fixtures/downstream-public-directory-proposal.js +59 -0
- package/dist/fixtures/public-directory-review-resource.d.ts +156 -0
- package/dist/fixtures/public-directory-review-resource.js +157 -0
- package/dist/fixtures/regulated-document-review-resource.d.ts +121 -0
- package/dist/fixtures/regulated-document-review-resource.js +131 -0
- package/dist/src/builder.d.ts +4 -1
- package/dist/src/builder.js +7 -0
- package/dist/src/index.d.ts +8 -4
- package/dist/src/index.js +4 -2
- package/dist/src/learning-projections.d.ts +19 -0
- package/dist/src/learning-projections.js +77 -0
- package/dist/src/raw-source.d.ts +15 -0
- package/dist/src/raw-source.js +22 -0
- package/dist/src/review-proof.d.ts +28 -0
- package/dist/src/review-proof.js +58 -1
- package/dist/src/review-resource.d.ts +111 -0
- package/dist/src/review-resource.js +1 -0
- package/dist/src/to-surface.js +226 -13
- package/dist/src/types.d.ts +17 -1
- package/package.json +10 -4
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export declare const publicDirectoryReviewItemFixture: {
|
|
2
|
+
apiVersion: "survey.kontourai.io/v1alpha1";
|
|
3
|
+
kind: "ReviewItem";
|
|
4
|
+
metadata: {
|
|
5
|
+
name: string;
|
|
6
|
+
labels: {
|
|
7
|
+
domain: string;
|
|
8
|
+
};
|
|
9
|
+
producer: {
|
|
10
|
+
displayName: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
spec: {
|
|
15
|
+
target: string;
|
|
16
|
+
selectedCandidateId: string;
|
|
17
|
+
candidateSetStatus: "resolved";
|
|
18
|
+
rationale: string;
|
|
19
|
+
candidates: ({
|
|
20
|
+
id: string;
|
|
21
|
+
role: "current";
|
|
22
|
+
value: string;
|
|
23
|
+
confidence: number;
|
|
24
|
+
source: {
|
|
25
|
+
sourceId: string;
|
|
26
|
+
sourceRef: string;
|
|
27
|
+
kind: "web-page";
|
|
28
|
+
observedAt: string;
|
|
29
|
+
fetchedAt: string;
|
|
30
|
+
locatorScheme: "html";
|
|
31
|
+
};
|
|
32
|
+
locator: {
|
|
33
|
+
scheme: "html";
|
|
34
|
+
locator: string;
|
|
35
|
+
excerpt: string;
|
|
36
|
+
};
|
|
37
|
+
extraction: {
|
|
38
|
+
extractionId: string;
|
|
39
|
+
target: string;
|
|
40
|
+
confidence: number;
|
|
41
|
+
extractor: string;
|
|
42
|
+
extractedAt: string;
|
|
43
|
+
};
|
|
44
|
+
claimTarget: {
|
|
45
|
+
claimId: string;
|
|
46
|
+
subjectType: string;
|
|
47
|
+
subjectId: string;
|
|
48
|
+
surface: string;
|
|
49
|
+
claimType: string;
|
|
50
|
+
fieldOrBehavior: string;
|
|
51
|
+
impactLevel: "medium";
|
|
52
|
+
collectedBy: string;
|
|
53
|
+
};
|
|
54
|
+
projection: {
|
|
55
|
+
rawSourceId: string;
|
|
56
|
+
extractionId: string;
|
|
57
|
+
candidateSetId: string;
|
|
58
|
+
candidateId: string;
|
|
59
|
+
reviewOutcomeId: string;
|
|
60
|
+
claimId: string;
|
|
61
|
+
};
|
|
62
|
+
producer: {
|
|
63
|
+
sourceAuthority: {
|
|
64
|
+
authorityClass: string;
|
|
65
|
+
declaredBy: string;
|
|
66
|
+
scope: string;
|
|
67
|
+
};
|
|
68
|
+
proposalId?: undefined;
|
|
69
|
+
oldValue?: undefined;
|
|
70
|
+
};
|
|
71
|
+
} | {
|
|
72
|
+
id: string;
|
|
73
|
+
role: "proposed";
|
|
74
|
+
value: string;
|
|
75
|
+
confidence: number;
|
|
76
|
+
source: {
|
|
77
|
+
sourceId: string;
|
|
78
|
+
sourceRef: string;
|
|
79
|
+
kind: "web-page";
|
|
80
|
+
observedAt: string;
|
|
81
|
+
fetchedAt: string;
|
|
82
|
+
locatorScheme: "html";
|
|
83
|
+
};
|
|
84
|
+
locator: {
|
|
85
|
+
scheme: "html";
|
|
86
|
+
locator: string;
|
|
87
|
+
excerpt: string;
|
|
88
|
+
};
|
|
89
|
+
extraction: {
|
|
90
|
+
extractionId: string;
|
|
91
|
+
target: string;
|
|
92
|
+
confidence: number;
|
|
93
|
+
extractor: string;
|
|
94
|
+
extractedAt: string;
|
|
95
|
+
};
|
|
96
|
+
claimTarget: {
|
|
97
|
+
claimId: string;
|
|
98
|
+
subjectType: string;
|
|
99
|
+
subjectId: string;
|
|
100
|
+
surface: string;
|
|
101
|
+
claimType: string;
|
|
102
|
+
fieldOrBehavior: string;
|
|
103
|
+
impactLevel: "medium";
|
|
104
|
+
collectedBy: string;
|
|
105
|
+
};
|
|
106
|
+
projection: {
|
|
107
|
+
rawSourceId: string;
|
|
108
|
+
extractionId: string;
|
|
109
|
+
candidateSetId: string;
|
|
110
|
+
candidateId: string;
|
|
111
|
+
claimId: string;
|
|
112
|
+
reviewOutcomeId?: undefined;
|
|
113
|
+
};
|
|
114
|
+
producer: {
|
|
115
|
+
proposalId: string;
|
|
116
|
+
oldValue: string;
|
|
117
|
+
sourceAuthority: {
|
|
118
|
+
authorityClass: string;
|
|
119
|
+
declaredBy: string;
|
|
120
|
+
scope: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
})[];
|
|
124
|
+
};
|
|
125
|
+
status: {
|
|
126
|
+
observedCandidateCount: number;
|
|
127
|
+
selectedCandidateId: string;
|
|
128
|
+
reviewDecisionName: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
export declare const publicDirectoryReviewDecisionFixture: {
|
|
132
|
+
apiVersion: "survey.kontourai.io/v1alpha1";
|
|
133
|
+
kind: "ReviewDecision";
|
|
134
|
+
metadata: {
|
|
135
|
+
name: string;
|
|
136
|
+
};
|
|
137
|
+
spec: {
|
|
138
|
+
reviewItemName: string;
|
|
139
|
+
candidateId: string;
|
|
140
|
+
status: "verified";
|
|
141
|
+
actor: {
|
|
142
|
+
id: string;
|
|
143
|
+
};
|
|
144
|
+
reviewedAt: string;
|
|
145
|
+
rationale: string;
|
|
146
|
+
projection: {
|
|
147
|
+
reviewOutcomeId: string;
|
|
148
|
+
candidateSetId: string;
|
|
149
|
+
candidateId: string;
|
|
150
|
+
claimId: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
status: {
|
|
154
|
+
appliedToClaimIds: string[];
|
|
155
|
+
};
|
|
156
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { reviewResourceApiVersion } from "../src/index.js";
|
|
2
|
+
export const publicDirectoryReviewItemFixture = {
|
|
3
|
+
apiVersion: reviewResourceApiVersion,
|
|
4
|
+
kind: "ReviewItem",
|
|
5
|
+
metadata: {
|
|
6
|
+
name: "public-directory-availability",
|
|
7
|
+
labels: {
|
|
8
|
+
domain: "public-directory",
|
|
9
|
+
},
|
|
10
|
+
producer: {
|
|
11
|
+
displayName: "Example Program",
|
|
12
|
+
slug: "example-program",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
spec: {
|
|
16
|
+
target: "availabilityStatus",
|
|
17
|
+
selectedCandidateId: "public-directory:candidate:current",
|
|
18
|
+
candidateSetStatus: "resolved",
|
|
19
|
+
rationale: "Reviewed public directory field and retained the current value.",
|
|
20
|
+
candidates: [
|
|
21
|
+
{
|
|
22
|
+
id: "public-directory:candidate:current",
|
|
23
|
+
role: "current",
|
|
24
|
+
value: "AVAILABLE",
|
|
25
|
+
confidence: 0.91,
|
|
26
|
+
source: {
|
|
27
|
+
sourceId: "public-field:source:approved-page",
|
|
28
|
+
sourceRef: "https://example.test/listings/example-program",
|
|
29
|
+
kind: "web-page",
|
|
30
|
+
observedAt: "2026-05-30T18:00:00.000Z",
|
|
31
|
+
fetchedAt: "2026-05-30T18:00:00.000Z",
|
|
32
|
+
locatorScheme: "html",
|
|
33
|
+
},
|
|
34
|
+
locator: {
|
|
35
|
+
scheme: "html",
|
|
36
|
+
locator: "html:field=availabilityStatus",
|
|
37
|
+
excerpt: "Availability is open for the example program.",
|
|
38
|
+
},
|
|
39
|
+
extraction: {
|
|
40
|
+
extractionId: "public-field:extraction:approved",
|
|
41
|
+
target: "availabilityStatus",
|
|
42
|
+
confidence: 0.91,
|
|
43
|
+
extractor: "example-field-review",
|
|
44
|
+
extractedAt: "2026-05-30T18:00:00.000Z",
|
|
45
|
+
},
|
|
46
|
+
claimTarget: {
|
|
47
|
+
claimId: "public-field.entity-123.availability-status.current",
|
|
48
|
+
subjectType: "public-record.entity",
|
|
49
|
+
subjectId: "entity-123",
|
|
50
|
+
surface: "public-record.profile",
|
|
51
|
+
claimType: "public-data.field",
|
|
52
|
+
fieldOrBehavior: "availabilityStatus",
|
|
53
|
+
impactLevel: "medium",
|
|
54
|
+
collectedBy: "example-field-review",
|
|
55
|
+
},
|
|
56
|
+
projection: {
|
|
57
|
+
rawSourceId: "public-field:source:approved-page",
|
|
58
|
+
extractionId: "public-field:extraction:approved",
|
|
59
|
+
candidateSetId: "public-field:candidates:current",
|
|
60
|
+
candidateId: "public-field:candidate:approved",
|
|
61
|
+
reviewOutcomeId: "public-field:review:approved",
|
|
62
|
+
claimId: "public-field.entity-123.availability-status.current",
|
|
63
|
+
},
|
|
64
|
+
producer: {
|
|
65
|
+
sourceAuthority: {
|
|
66
|
+
authorityClass: "public-directory-listing",
|
|
67
|
+
declaredBy: "Example Program public directory",
|
|
68
|
+
scope: "availabilityStatus field on entity-123",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "public-directory:candidate:proposed",
|
|
74
|
+
role: "proposed",
|
|
75
|
+
value: "WAITLIST",
|
|
76
|
+
confidence: 0.82,
|
|
77
|
+
source: {
|
|
78
|
+
sourceId: "public-field:source:proposal-page",
|
|
79
|
+
sourceRef: "https://example.test/listings/example-program",
|
|
80
|
+
kind: "web-page",
|
|
81
|
+
observedAt: "2026-05-31T15:00:00.000Z",
|
|
82
|
+
fetchedAt: "2026-05-31T15:00:00.000Z",
|
|
83
|
+
locatorScheme: "html",
|
|
84
|
+
},
|
|
85
|
+
locator: {
|
|
86
|
+
scheme: "html",
|
|
87
|
+
locator: "html:field=availabilityStatus",
|
|
88
|
+
excerpt: "Join the waitlist for this listing.",
|
|
89
|
+
},
|
|
90
|
+
extraction: {
|
|
91
|
+
extractionId: "public-field:extraction:proposal",
|
|
92
|
+
target: "availabilityStatus",
|
|
93
|
+
confidence: 0.82,
|
|
94
|
+
extractor: "example-crawl",
|
|
95
|
+
extractedAt: "2026-05-31T15:00:00.000Z",
|
|
96
|
+
},
|
|
97
|
+
claimTarget: {
|
|
98
|
+
claimId: "public-field.entity-123.availability-status.proposal-456",
|
|
99
|
+
subjectType: "public-record.entity",
|
|
100
|
+
subjectId: "entity-123",
|
|
101
|
+
surface: "public-record.profile",
|
|
102
|
+
claimType: "public-data.field-candidate",
|
|
103
|
+
fieldOrBehavior: "availabilityStatus",
|
|
104
|
+
impactLevel: "medium",
|
|
105
|
+
collectedBy: "example-crawl",
|
|
106
|
+
},
|
|
107
|
+
projection: {
|
|
108
|
+
rawSourceId: "public-field:source:proposal-page",
|
|
109
|
+
extractionId: "public-field:extraction:proposal",
|
|
110
|
+
candidateSetId: "public-field:candidates:proposal",
|
|
111
|
+
candidateId: "public-field:candidate:proposal",
|
|
112
|
+
claimId: "public-field.entity-123.availability-status.proposal-456",
|
|
113
|
+
},
|
|
114
|
+
producer: {
|
|
115
|
+
proposalId: "proposal-456",
|
|
116
|
+
oldValue: "AVAILABLE",
|
|
117
|
+
sourceAuthority: {
|
|
118
|
+
authorityClass: "public-directory-listing",
|
|
119
|
+
declaredBy: "Example Program public directory crawler",
|
|
120
|
+
scope: "availabilityStatus field on entity-123",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
status: {
|
|
127
|
+
observedCandidateCount: 2,
|
|
128
|
+
selectedCandidateId: "public-directory:candidate:current",
|
|
129
|
+
reviewDecisionName: "public-directory-availability-operator-decision",
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
export const publicDirectoryReviewDecisionFixture = {
|
|
133
|
+
apiVersion: reviewResourceApiVersion,
|
|
134
|
+
kind: "ReviewDecision",
|
|
135
|
+
metadata: {
|
|
136
|
+
name: "public-directory-availability-operator-decision",
|
|
137
|
+
},
|
|
138
|
+
spec: {
|
|
139
|
+
reviewItemName: "public-directory-availability",
|
|
140
|
+
candidateId: "public-directory:candidate:current",
|
|
141
|
+
status: "verified",
|
|
142
|
+
actor: {
|
|
143
|
+
id: "example-operator",
|
|
144
|
+
},
|
|
145
|
+
reviewedAt: "2026-05-30T18:05:00.000Z",
|
|
146
|
+
rationale: "Operator approved the field source.",
|
|
147
|
+
projection: {
|
|
148
|
+
reviewOutcomeId: "public-field:review:approved",
|
|
149
|
+
candidateSetId: "public-field:candidates:current",
|
|
150
|
+
candidateId: "public-field:candidate:approved",
|
|
151
|
+
claimId: "public-field.entity-123.availability-status.current",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
status: {
|
|
155
|
+
appliedToClaimIds: ["public-field.entity-123.availability-status.current"],
|
|
156
|
+
},
|
|
157
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export declare const regulatedDocumentReviewItemFixture: {
|
|
2
|
+
apiVersion: "survey.kontourai.io/v1alpha1";
|
|
3
|
+
kind: "ReviewItem";
|
|
4
|
+
metadata: {
|
|
5
|
+
name: string;
|
|
6
|
+
labels: {
|
|
7
|
+
domain: string;
|
|
8
|
+
};
|
|
9
|
+
producer: {
|
|
10
|
+
documentFamily: string;
|
|
11
|
+
reportingPeriod: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
spec: {
|
|
15
|
+
target: string;
|
|
16
|
+
candidateSetStatus: "needs-review";
|
|
17
|
+
selectedCandidateId: string;
|
|
18
|
+
rationale: string;
|
|
19
|
+
candidates: ({
|
|
20
|
+
id: string;
|
|
21
|
+
role: "source-version";
|
|
22
|
+
value: {
|
|
23
|
+
totalAmount: number;
|
|
24
|
+
creditAmount: number;
|
|
25
|
+
position: string;
|
|
26
|
+
};
|
|
27
|
+
confidence: number;
|
|
28
|
+
sourceRank: number;
|
|
29
|
+
source: {
|
|
30
|
+
sourceId: string;
|
|
31
|
+
sourceRef: string;
|
|
32
|
+
kind: "manual-entry";
|
|
33
|
+
observedAt: string;
|
|
34
|
+
locatorScheme: "structured-field";
|
|
35
|
+
};
|
|
36
|
+
locator: {
|
|
37
|
+
scheme: "structured-field";
|
|
38
|
+
excerpt: string;
|
|
39
|
+
};
|
|
40
|
+
extraction: {
|
|
41
|
+
extractionId: string;
|
|
42
|
+
target: string;
|
|
43
|
+
confidence: number;
|
|
44
|
+
extractor: string;
|
|
45
|
+
extractedAt: string;
|
|
46
|
+
};
|
|
47
|
+
claimTarget: {
|
|
48
|
+
claimId: string;
|
|
49
|
+
subjectType: string;
|
|
50
|
+
subjectId: string;
|
|
51
|
+
surface: string;
|
|
52
|
+
claimType: string;
|
|
53
|
+
fieldOrBehavior: string;
|
|
54
|
+
impactLevel: "high";
|
|
55
|
+
evidenceType: "calculation_trace";
|
|
56
|
+
evidenceMethod: "validation";
|
|
57
|
+
collectedBy: string;
|
|
58
|
+
derivedFrom: string[];
|
|
59
|
+
};
|
|
60
|
+
projection: {
|
|
61
|
+
rawSourceId: string;
|
|
62
|
+
extractionId: string;
|
|
63
|
+
candidateSetId: string;
|
|
64
|
+
candidateId: string;
|
|
65
|
+
claimId: string;
|
|
66
|
+
};
|
|
67
|
+
} | {
|
|
68
|
+
id: string;
|
|
69
|
+
role: "computed";
|
|
70
|
+
value: {
|
|
71
|
+
totalAmount: number;
|
|
72
|
+
creditAmount: number;
|
|
73
|
+
position: string;
|
|
74
|
+
};
|
|
75
|
+
confidence: number;
|
|
76
|
+
sourceRank: number;
|
|
77
|
+
source: {
|
|
78
|
+
sourceId: string;
|
|
79
|
+
sourceRef: string;
|
|
80
|
+
kind: "manual-entry";
|
|
81
|
+
observedAt: string;
|
|
82
|
+
locatorScheme: "structured-field";
|
|
83
|
+
};
|
|
84
|
+
locator: {
|
|
85
|
+
scheme: "structured-field";
|
|
86
|
+
excerpt: string;
|
|
87
|
+
};
|
|
88
|
+
extraction: {
|
|
89
|
+
extractionId: string;
|
|
90
|
+
target: string;
|
|
91
|
+
confidence: number;
|
|
92
|
+
extractor: string;
|
|
93
|
+
extractedAt: string;
|
|
94
|
+
};
|
|
95
|
+
claimTarget: {
|
|
96
|
+
claimId: string;
|
|
97
|
+
subjectType: string;
|
|
98
|
+
subjectId: string;
|
|
99
|
+
surface: string;
|
|
100
|
+
claimType: string;
|
|
101
|
+
fieldOrBehavior: string;
|
|
102
|
+
impactLevel: "high";
|
|
103
|
+
evidenceType: "calculation_trace";
|
|
104
|
+
evidenceMethod: "validation";
|
|
105
|
+
collectedBy: string;
|
|
106
|
+
derivedFrom: string[];
|
|
107
|
+
};
|
|
108
|
+
projection: {
|
|
109
|
+
rawSourceId: string;
|
|
110
|
+
extractionId: string;
|
|
111
|
+
candidateSetId: string;
|
|
112
|
+
candidateId: string;
|
|
113
|
+
claimId: string;
|
|
114
|
+
};
|
|
115
|
+
})[];
|
|
116
|
+
};
|
|
117
|
+
status: {
|
|
118
|
+
observedCandidateCount: number;
|
|
119
|
+
selectedCandidateId: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { reviewResourceApiVersion } from "../src/index.js";
|
|
2
|
+
export const regulatedDocumentReviewItemFixture = {
|
|
3
|
+
apiVersion: reviewResourceApiVersion,
|
|
4
|
+
kind: "ReviewItem",
|
|
5
|
+
metadata: {
|
|
6
|
+
name: "regulated-document-statement-position",
|
|
7
|
+
labels: {
|
|
8
|
+
domain: "regulated-document",
|
|
9
|
+
},
|
|
10
|
+
producer: {
|
|
11
|
+
documentFamily: "example-statement",
|
|
12
|
+
reportingPeriod: "2026",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
spec: {
|
|
16
|
+
target: "statementPosition",
|
|
17
|
+
candidateSetStatus: "needs-review",
|
|
18
|
+
selectedCandidateId: "document:candidate:statement-position:current",
|
|
19
|
+
rationale: "Computed candidates are presented as source versions, not current/proposed UI policy.",
|
|
20
|
+
candidates: [
|
|
21
|
+
{
|
|
22
|
+
id: "document:candidate:statement-position:original",
|
|
23
|
+
role: "source-version",
|
|
24
|
+
value: {
|
|
25
|
+
totalAmount: 82000,
|
|
26
|
+
creditAmount: 8600,
|
|
27
|
+
position: "credit-present",
|
|
28
|
+
},
|
|
29
|
+
confidence: 0.96,
|
|
30
|
+
sourceRank: 2,
|
|
31
|
+
source: {
|
|
32
|
+
sourceId: "document:source:statement-position:original",
|
|
33
|
+
sourceRef: "documents://entities/entity-1/periods/2026/resolved-fields/statement",
|
|
34
|
+
kind: "manual-entry",
|
|
35
|
+
observedAt: "2026-05-31T16:00:00.000Z",
|
|
36
|
+
locatorScheme: "structured-field",
|
|
37
|
+
},
|
|
38
|
+
locator: {
|
|
39
|
+
scheme: "structured-field",
|
|
40
|
+
excerpt: "original statement position from source fields.",
|
|
41
|
+
},
|
|
42
|
+
extraction: {
|
|
43
|
+
extractionId: "document:extraction:statement-position:original",
|
|
44
|
+
target: "statementPosition",
|
|
45
|
+
confidence: 0.96,
|
|
46
|
+
extractor: "statement-position-rule",
|
|
47
|
+
extractedAt: "2026-05-31T16:00:00.000Z",
|
|
48
|
+
},
|
|
49
|
+
claimTarget: {
|
|
50
|
+
claimId: "document.entity-1.statement-position.original",
|
|
51
|
+
subjectType: "verified-record.period",
|
|
52
|
+
subjectId: "entity-1:2026",
|
|
53
|
+
surface: "document-review",
|
|
54
|
+
claimType: "computed-field",
|
|
55
|
+
fieldOrBehavior: "statementPosition",
|
|
56
|
+
impactLevel: "high",
|
|
57
|
+
evidenceType: "calculation_trace",
|
|
58
|
+
evidenceMethod: "validation",
|
|
59
|
+
collectedBy: "survey-document-fixture",
|
|
60
|
+
derivedFrom: [
|
|
61
|
+
"document.entity-1.statement.amount.original",
|
|
62
|
+
"document.entity-1.statement.credit.original",
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
projection: {
|
|
66
|
+
rawSourceId: "document:source:statement-position:original",
|
|
67
|
+
extractionId: "document:extraction:statement-position:original",
|
|
68
|
+
candidateSetId: "document:candidates:statement-position:original",
|
|
69
|
+
candidateId: "document:candidate:statement-position:original",
|
|
70
|
+
claimId: "document.entity-1.statement-position.original",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "document:candidate:statement-position:current",
|
|
75
|
+
role: "computed",
|
|
76
|
+
value: {
|
|
77
|
+
totalAmount: 84000,
|
|
78
|
+
creditAmount: 9100,
|
|
79
|
+
position: "credit-present",
|
|
80
|
+
},
|
|
81
|
+
confidence: 0.96,
|
|
82
|
+
sourceRank: 1,
|
|
83
|
+
source: {
|
|
84
|
+
sourceId: "document:source:statement-position:current",
|
|
85
|
+
sourceRef: "documents://entities/entity-1/periods/2026/resolved-fields/statement",
|
|
86
|
+
kind: "manual-entry",
|
|
87
|
+
observedAt: "2026-05-31T16:00:00.000Z",
|
|
88
|
+
locatorScheme: "structured-field",
|
|
89
|
+
},
|
|
90
|
+
locator: {
|
|
91
|
+
scheme: "structured-field",
|
|
92
|
+
excerpt: "current statement position from source fields.",
|
|
93
|
+
},
|
|
94
|
+
extraction: {
|
|
95
|
+
extractionId: "document:extraction:statement-position:current",
|
|
96
|
+
target: "statementPosition",
|
|
97
|
+
confidence: 0.96,
|
|
98
|
+
extractor: "statement-position-rule",
|
|
99
|
+
extractedAt: "2026-05-31T16:00:00.000Z",
|
|
100
|
+
},
|
|
101
|
+
claimTarget: {
|
|
102
|
+
claimId: "document.entity-1.statement-position.current",
|
|
103
|
+
subjectType: "verified-record.period",
|
|
104
|
+
subjectId: "entity-1:2026",
|
|
105
|
+
surface: "document-review",
|
|
106
|
+
claimType: "computed-field",
|
|
107
|
+
fieldOrBehavior: "statementPosition",
|
|
108
|
+
impactLevel: "high",
|
|
109
|
+
evidenceType: "calculation_trace",
|
|
110
|
+
evidenceMethod: "validation",
|
|
111
|
+
collectedBy: "survey-document-fixture",
|
|
112
|
+
derivedFrom: [
|
|
113
|
+
"document.entity-1.statement.amount.corrected",
|
|
114
|
+
"document.entity-1.statement.credit.corrected",
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
projection: {
|
|
118
|
+
rawSourceId: "document:source:statement-position:current",
|
|
119
|
+
extractionId: "document:extraction:statement-position:current",
|
|
120
|
+
candidateSetId: "document:candidates:statement-position:current",
|
|
121
|
+
candidateId: "document:candidate:statement-position:current",
|
|
122
|
+
claimId: "document.entity-1.statement-position.current",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
status: {
|
|
128
|
+
observedCandidateCount: 2,
|
|
129
|
+
selectedCandidateId: "document:candidate:statement-position:current",
|
|
130
|
+
},
|
|
131
|
+
};
|
package/dist/src/builder.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CandidateSet, ClaimTarget, EscalationRecord, Extraction, RawSource, ReviewOutcome, SurveyInput } from "./types.js";
|
|
1
|
+
import type { CandidateSet, ClaimTarget, EscalationRecord, Extraction, Interpretation, RawSource, ReviewOutcome, SurveyInput } from "./types.js";
|
|
2
2
|
export interface SurveyInputBuilderArgs {
|
|
3
3
|
source: string;
|
|
4
4
|
generatedAt?: string;
|
|
@@ -22,6 +22,7 @@ export interface SurveyObservationInput {
|
|
|
22
22
|
id?: string;
|
|
23
23
|
confidence?: number;
|
|
24
24
|
sourceRank?: number;
|
|
25
|
+
rejectionReason?: string;
|
|
25
26
|
metadata?: Record<string, unknown>;
|
|
26
27
|
};
|
|
27
28
|
candidateSet?: {
|
|
@@ -59,6 +60,7 @@ export declare class SurveyInputBuilder {
|
|
|
59
60
|
private readonly reviewOutcomes;
|
|
60
61
|
private readonly claims;
|
|
61
62
|
private readonly escalations;
|
|
63
|
+
private readonly interpretations;
|
|
62
64
|
constructor(args: SurveyInputBuilderArgs);
|
|
63
65
|
addRawSource(rawSource: RawSource): this;
|
|
64
66
|
addExtraction(extraction: Extraction): this;
|
|
@@ -66,6 +68,7 @@ export declare class SurveyInputBuilder {
|
|
|
66
68
|
addReviewOutcome(reviewOutcome: ReviewOutcome): this;
|
|
67
69
|
addClaim(claim: ClaimTarget): this;
|
|
68
70
|
addEscalation(escalation: EscalationRecord): this;
|
|
71
|
+
addInterpretation(interpretation: Interpretation): this;
|
|
69
72
|
addClaimRecord(record: SurveyClaimRecord): this;
|
|
70
73
|
addClaimRecords(records: SurveyClaimRecord[]): this;
|
|
71
74
|
addObservation(observation: SurveyObservationInput): this;
|
package/dist/src/builder.js
CHANGED
|
@@ -7,6 +7,7 @@ export class SurveyInputBuilder {
|
|
|
7
7
|
reviewOutcomes = new Map();
|
|
8
8
|
claims = new Map();
|
|
9
9
|
escalations = new Map();
|
|
10
|
+
interpretations = new Map();
|
|
10
11
|
constructor(args) {
|
|
11
12
|
this.source = args.source;
|
|
12
13
|
this.generatedAt = args.generatedAt ?? new Date().toISOString();
|
|
@@ -35,6 +36,10 @@ export class SurveyInputBuilder {
|
|
|
35
36
|
addUnique(this.escalations, escalation, "escalation");
|
|
36
37
|
return this;
|
|
37
38
|
}
|
|
39
|
+
addInterpretation(interpretation) {
|
|
40
|
+
addUnique(this.interpretations, interpretation, "interpretation");
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
38
43
|
addClaimRecord(record) {
|
|
39
44
|
this.addRecordRawSource(record.rawSource);
|
|
40
45
|
this.addExtraction(record.extraction);
|
|
@@ -67,6 +72,7 @@ export class SurveyInputBuilder {
|
|
|
67
72
|
reviewOutcomes: [...this.reviewOutcomes.values()],
|
|
68
73
|
claims: [...this.claims.values()],
|
|
69
74
|
escalations: this.escalations.size > 0 ? [...this.escalations.values()] : undefined,
|
|
75
|
+
interpretations: this.interpretations.size > 0 ? [...this.interpretations.values()] : undefined,
|
|
70
76
|
};
|
|
71
77
|
}
|
|
72
78
|
addRecordCandidateSet(candidateSet) {
|
|
@@ -168,6 +174,7 @@ function observationToClaimRecord(observation) {
|
|
|
168
174
|
value,
|
|
169
175
|
confidence,
|
|
170
176
|
sourceRank: observation.candidate?.sourceRank,
|
|
177
|
+
rejectionReason: observation.candidate?.rejectionReason,
|
|
171
178
|
metadata: observation.candidate?.metadata,
|
|
172
179
|
}],
|
|
173
180
|
},
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export type { CandidateSetStatus, Candidate, CandidateSet, ClaimTarget, EscalationDimension, EscalationRecord, Extraction, LocatorScheme, RawSource, RawSourceKind, ReviewOutcome, ReviewStatus, SurveyInput, } from "./types.js";
|
|
1
|
+
export type { CandidateSetStatus, Candidate, CandidateSet, ClaimTarget, EscalationDimension, EscalationRecord, Extraction, Interpretation, LocatorScheme, RawSource, RawSourceKind, ReviewOutcome, ReviewStatus, SurveyInput, } from "./types.js";
|
|
2
|
+
export { reviewResourceApiVersion } from "./review-resource.js";
|
|
3
|
+
export type { CandidateRole, ClaimTargetHint, ExtractionReference, ResourceEnvelope, ResourceMetadata, ReviewActor, ReviewCandidate, ReviewDecision, ReviewDecisionSpec, ReviewDecisionStatus, ReviewItem, ReviewItemSpec, ReviewItemStatus, ReviewLocator, ReviewResource, ReviewResourceApiVersion, ReviewResourceKind, SourceReference, SurveyRecordProjectionHint, } from "./review-resource.js";
|
|
2
4
|
export { candidateReviewRecord, SurveyInputBuilder } from "./builder.js";
|
|
3
5
|
export type { CandidateReviewRecordInput, SurveyClaimRecord, SurveyInputBuilderArgs, SurveyObservationInput, } from "./builder.js";
|
|
4
6
|
export { reviewedCandidateResolution } from "./reviewed-candidate-resolution.js";
|
|
@@ -7,7 +9,9 @@ export { reviewedCurrentProposedResolution } from "./reviewed-current-proposed-r
|
|
|
7
9
|
export type { CurrentProposedCandidateRole, ReviewedCurrentProposedResolutionInput, } from "./reviewed-current-proposed-resolution.js";
|
|
8
10
|
export { buildSurveyTrustInput } from "./to-surface.js";
|
|
9
11
|
export type { BuildSurveyTrustInputOptions } from "./to-surface.js";
|
|
10
|
-
export {
|
|
12
|
+
export { buildSurveyLearningProjections } from "./learning-projections.js";
|
|
13
|
+
export type { LearningProjection, LearningProjectionKind, LearningProjectionSeverity, LearningProjectionSignal, } from "./learning-projections.js";
|
|
14
|
+
export { buildCanonicalReviewProofPayload, buildReviewProofAnchor, canonicalReviewProofJson, hashCanonicalReviewProofPayload, REVIEW_PROOF_CONTRACT_VERSION, REVIEW_PROOF_PACKAGE_NAME, REVIEW_PROOF_SCHEMA, REVIEW_PROOF_SCHEMA_VERSION, } from "./review-proof.js";
|
|
11
15
|
export type { CanonicalReviewProofPayload, ReviewProofInput, } from "./review-proof.js";
|
|
12
16
|
export { fieldObservation } from "./field-observation.js";
|
|
13
17
|
export type { FieldObservationInput } from "./field-observation.js";
|
|
@@ -15,5 +19,5 @@ export { repeatedObservation } from "./repeated-observation.js";
|
|
|
15
19
|
export type { RepeatedObservationInput } from "./repeated-observation.js";
|
|
16
20
|
export { sourceOfAuthorityObservation, sourceOfAuthorityObservationBuilder, SourceOfAuthorityObservationBuilder, } from "./source-of-authority-observation.js";
|
|
17
21
|
export type { SourceAuthorityClass, SourceAuthorityMetadata, SourceOfAuthorityObservationBuilderArgs, SourceOfAuthorityObservationInput, } from "./source-of-authority-observation.js";
|
|
18
|
-
export { apiRecordSource, manualEntrySource, uploadedDocumentSource, webPageSource, } from "./raw-source.js";
|
|
19
|
-
export type { ApiRecordSourceInput, ChecksumInput, ManualEntrySourceInput, RawSourceInput, UploadedDocumentSourceInput, WebPageSourceInput, } from "./raw-source.js";
|
|
22
|
+
export { apiRecordSource, manualEntrySource, policyStandardSource, uploadedDocumentSource, webPageSource, } from "./raw-source.js";
|
|
23
|
+
export type { ApiRecordSourceInput, ChecksumInput, ManualEntrySourceInput, PolicyStandardMetadata, PolicyStandardSourceInput, RawSourceInput, UploadedDocumentSourceInput, WebPageSourceInput, } from "./raw-source.js";
|
package/dist/src/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export { reviewResourceApiVersion } from "./review-resource.js";
|
|
1
2
|
export { candidateReviewRecord, SurveyInputBuilder } from "./builder.js";
|
|
2
3
|
export { reviewedCandidateResolution } from "./reviewed-candidate-resolution.js";
|
|
3
4
|
export { reviewedCurrentProposedResolution } from "./reviewed-current-proposed-resolution.js";
|
|
4
5
|
export { buildSurveyTrustInput } from "./to-surface.js";
|
|
5
|
-
export {
|
|
6
|
+
export { buildSurveyLearningProjections } from "./learning-projections.js";
|
|
7
|
+
export { buildCanonicalReviewProofPayload, buildReviewProofAnchor, canonicalReviewProofJson, hashCanonicalReviewProofPayload, REVIEW_PROOF_CONTRACT_VERSION, REVIEW_PROOF_PACKAGE_NAME, REVIEW_PROOF_SCHEMA, REVIEW_PROOF_SCHEMA_VERSION, } from "./review-proof.js";
|
|
6
8
|
export { fieldObservation } from "./field-observation.js";
|
|
7
9
|
export { repeatedObservation } from "./repeated-observation.js";
|
|
8
10
|
export { sourceOfAuthorityObservation, sourceOfAuthorityObservationBuilder, SourceOfAuthorityObservationBuilder, } from "./source-of-authority-observation.js";
|
|
9
|
-
export { apiRecordSource, manualEntrySource, uploadedDocumentSource, webPageSource, } from "./raw-source.js";
|
|
11
|
+
export { apiRecordSource, manualEntrySource, policyStandardSource, uploadedDocumentSource, webPageSource, } from "./raw-source.js";
|