@actuarial-ts/interchange 0.2.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +52 -0
- package/dist/convert/result.d.ts +45 -0
- package/dist/convert/result.d.ts.map +1 -0
- package/dist/convert/result.js +122 -0
- package/dist/convert/result.js.map +1 -0
- package/dist/convert/selection.d.ts +114 -0
- package/dist/convert/selection.d.ts.map +1 -0
- package/dist/convert/selection.js +383 -0
- package/dist/convert/selection.js.map +1 -0
- package/dist/convert/triangle.d.ts +49 -0
- package/dist/convert/triangle.d.ts.map +1 -0
- package/dist/convert/triangle.js +111 -0
- package/dist/convert/triangle.js.map +1 -0
- package/dist/envelope.d.ts +113 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +139 -0
- package/dist/envelope.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/parse.d.ts +38 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +48 -0
- package/dist/parse.js.map +1 -0
- package/dist/referee/crosscheck.d.ts +38 -0
- package/dist/referee/crosscheck.d.ts.map +1 -0
- package/dist/referee/crosscheck.js +212 -0
- package/dist/referee/crosscheck.js.map +1 -0
- package/dist/referee/profiles.d.ts +36 -0
- package/dist/referee/profiles.d.ts.map +1 -0
- package/dist/referee/profiles.js +80 -0
- package/dist/referee/profiles.js.map +1 -0
- package/dist/schemas/bundle.d.ts +45 -0
- package/dist/schemas/bundle.d.ts.map +1 -0
- package/dist/schemas/bundle.js +20 -0
- package/dist/schemas/bundle.js.map +1 -0
- package/dist/schemas/crosscheck.d.ts +3567 -0
- package/dist/schemas/crosscheck.d.ts.map +1 -0
- package/dist/schemas/crosscheck.js +72 -0
- package/dist/schemas/crosscheck.js.map +1 -0
- package/dist/schemas/manifest.d.ts +43 -0
- package/dist/schemas/manifest.d.ts.map +1 -0
- package/dist/schemas/manifest.js +39 -0
- package/dist/schemas/manifest.js.map +1 -0
- package/dist/schemas/result.d.ts +2163 -0
- package/dist/schemas/result.d.ts.map +1 -0
- package/dist/schemas/result.js +95 -0
- package/dist/schemas/result.js.map +1 -0
- package/dist/schemas/selection.d.ts +10388 -0
- package/dist/schemas/selection.d.ts.map +1 -0
- package/dist/schemas/selection.js +138 -0
- package/dist/schemas/selection.js.map +1 -0
- package/dist/schemas/study.d.ts +62 -0
- package/dist/schemas/study.d.ts.map +1 -0
- package/dist/schemas/study.js +35 -0
- package/dist/schemas/study.js.map +1 -0
- package/dist/schemas/triangle.d.ts +1260 -0
- package/dist/schemas/triangle.d.ts.map +1 -0
- package/dist/schemas/triangle.js +120 -0
- package/dist/schemas/triangle.js.map +1 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @actuarial-ts/interchange
|
|
2
|
+
|
|
3
|
+
The `actuarial-interchange` format (spec v1) for the actuarial-ts SDK:
|
|
4
|
+
language-neutral, versioned documents that carry **data, intent, results,
|
|
5
|
+
and governance** between actuarial-ts, chainladder-python, and R
|
|
6
|
+
ChainLadder — plus the deterministic cross-implementation referee.
|
|
7
|
+
|
|
8
|
+
- **Document kinds**: `triangle`, `selection`, `method-result`,
|
|
9
|
+
`stochastic-result`, `study`, `bundle`, `crosscheck-report` — zod
|
|
10
|
+
schemas with inferred types, mechanically emitted to JSON Schema under
|
|
11
|
+
`schema/interchange/1.0/` (committed; a drift test fails the build if
|
|
12
|
+
the emitted schemas and the committed files diverge).
|
|
13
|
+
- **Canonicalization** is RFC 8785 (JCS) via `@actuarial-ts/core`'s
|
|
14
|
+
`canonicalJson`; the committed cross-language vector suite
|
|
15
|
+
(`schema/interchange/1.0/jcs-vectors.json`) is part of the spec.
|
|
16
|
+
- **Integrity tags** cover the semantic body only —
|
|
17
|
+
`fnv1a64(canonicalJson(<kind-named object>))` — never the envelope, so
|
|
18
|
+
a re-export by another adapter changes the envelope, not the tag. Tags
|
|
19
|
+
detect ACCIDENTAL divergence; they are not a security control.
|
|
20
|
+
- **Selections travel as intent + values** with a normative coherence
|
|
21
|
+
rule: computable intents must recompute to the stated value within
|
|
22
|
+
1e-9 relative, verified on import (warn or refuse via a strictness
|
|
23
|
+
flag; refusal is `INCOHERENT_SELECTION`). Values are authoritative only
|
|
24
|
+
for `judgmental`/`external` intents, whose rationale is required.
|
|
25
|
+
- **Converters**: `triangleToDoc`/`docToTriangle`,
|
|
26
|
+
`selectionsToDoc`/`docToSelections` (intent ↔ the standard averages
|
|
27
|
+
menu), `resultToDoc` (chainLadder, mack, bornhuetterFerguson,
|
|
28
|
+
benktander in Phase A; more methods arrive with later phases), and
|
|
29
|
+
`parseDocument` (version-checked, integrity-verified,
|
|
30
|
+
warning-channeled).
|
|
31
|
+
- **The referee**: `crosscheck({ a, b, tolerance?, selection?, createdAt })`
|
|
32
|
+
compares two `method-result` documents by appliesTo tags and convention
|
|
33
|
+
profile, computes per-origin and total relative deviations, applies
|
|
34
|
+
requested-vs-effective downgrades, and returns a `crosscheck-report`
|
|
35
|
+
with verdict `agree | disagree | not-comparable | verified-by-value`.
|
|
36
|
+
Convention profiles (`deterministic-cl`, `mack1993-vw`) are shipped as
|
|
37
|
+
data, including each engine's pinned alignment parameters.
|
|
38
|
+
|
|
39
|
+
Version handling (spec 3.5): wrong-major documents throw
|
|
40
|
+
`ReservingError("UNSUPPORTED_VERSION")`; same-major unknown minor fields
|
|
41
|
+
are accepted and preserved (schemas are passthrough), and
|
|
42
|
+
`governance`/`extensions` round-trip opaquely.
|
|
43
|
+
|
|
44
|
+
Everything is pure and browser-safe: no clock reads (`createdAt` is
|
|
45
|
+
caller-supplied), no randomness, no node builtins. Depends on
|
|
46
|
+
`@actuarial-ts/core` and `zod` only; `zod-to-json-schema` is a build-time
|
|
47
|
+
devDependency used by `npm run emit-schema` (which builds first, then
|
|
48
|
+
regenerates the committed JSON Schemas).
|
|
49
|
+
|
|
50
|
+
This package is designed to support the actuary's compliance with the
|
|
51
|
+
ASOPs; cross-implementation agreement supports, but does not by itself
|
|
52
|
+
constitute, the model validation contemplated by ASOP No. 56.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type BenktanderResult, type BornhuetterFergusonResult, type ChainLadderResult, type MackResult } from "@actuarial-ts/core";
|
|
2
|
+
import { type GeneratorStamp } from "../envelope.js";
|
|
3
|
+
import type { TriangleDoc } from "../schemas/triangle.js";
|
|
4
|
+
import type { SelectionDoc } from "../schemas/selection.js";
|
|
5
|
+
import { type EngineStamp, type MethodResultDoc } from "../schemas/result.js";
|
|
6
|
+
/**
|
|
7
|
+
* core method results → MethodResultDoc, stamping `appliesTo` (spec 3.2 /
|
|
8
|
+
* 4.1).
|
|
9
|
+
*
|
|
10
|
+
* Phase A converts the deterministic quartet — ChainLadderResult,
|
|
11
|
+
* MackResult, BornhuetterFergusonResult, BenktanderResult; further
|
|
12
|
+
* methods (Cape Cod, Clark, Munich, the stochastic layer, ...) arrive
|
|
13
|
+
* with later phases. Method names use the actuarial-ts namespace
|
|
14
|
+
* (unprefixed discriminants); `clpy:`/`rcl:` are reserved for the other
|
|
15
|
+
* shores.
|
|
16
|
+
*
|
|
17
|
+
* Row vocabulary is the spec's: `unpaid` carries what core's Mack calls
|
|
18
|
+
* `reserve` (identical quantity, interchange field name).
|
|
19
|
+
*/
|
|
20
|
+
export type ConvertibleResult = ChainLadderResult | MackResult | BornhuetterFergusonResult | BenktanderResult;
|
|
21
|
+
/**
|
|
22
|
+
* The engine stamp for results computed by @actuarial-ts/core. A sync test
|
|
23
|
+
* pins the version to the installed core package so it cannot drift.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CORE_ENGINE: EngineStamp;
|
|
26
|
+
export interface ResultToDocOptions {
|
|
27
|
+
/** The triangle document the result was computed from. */
|
|
28
|
+
triangleDoc: TriangleDoc;
|
|
29
|
+
/** The selection document used, when one exists; null/omitted = none
|
|
30
|
+
* (e.g. Mack on its own volume-weighted factors). */
|
|
31
|
+
selectionDoc?: SelectionDoc | null;
|
|
32
|
+
/** ISO timestamp for the envelope (caller-supplied; purity rule). */
|
|
33
|
+
createdAt: string;
|
|
34
|
+
/** Convention profile the run aligns to (referee comparability input). */
|
|
35
|
+
conventionProfile?: string;
|
|
36
|
+
/** Requested-parameter echo; defaults to {}. */
|
|
37
|
+
parameters?: Record<string, unknown>;
|
|
38
|
+
/** Effective parameters when the engine deviated from requested. */
|
|
39
|
+
effectiveParameters?: Record<string, unknown>;
|
|
40
|
+
engine?: EngineStamp;
|
|
41
|
+
generator?: GeneratorStamp;
|
|
42
|
+
extensions?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
export declare function resultToDoc(result: ConvertibleResult, options: ResultToDocOptions): MethodResultDoc;
|
|
45
|
+
//# sourceMappingURL=result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/convert/result.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,iBAAiB,GACzB,iBAAiB,GACjB,UAAU,GACV,yBAAyB,GACzB,gBAAgB,CAAC;AAErB;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,WAAwD,CAAC;AAEnF,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,WAAW,EAAE,WAAW,CAAC;IACzB;yDACqD;IACrD,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AA6ED,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,kBAAkB,GAC1B,eAAe,CAgEjB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ReservingError, } from "@actuarial-ts/core";
|
|
2
|
+
import { DEFAULT_GENERATOR, INTERCHANGE_SPEC_VERSION, stampIntegrity, } from "../envelope.js";
|
|
3
|
+
import { methodResultDocSchema, } from "../schemas/result.js";
|
|
4
|
+
/**
|
|
5
|
+
* The engine stamp for results computed by @actuarial-ts/core. A sync test
|
|
6
|
+
* pins the version to the installed core package so it cannot drift.
|
|
7
|
+
*/
|
|
8
|
+
export const CORE_ENGINE = { name: "actuarial-ts", version: "0.2.0" };
|
|
9
|
+
function mapResult(result) {
|
|
10
|
+
switch (result.method) {
|
|
11
|
+
case "chainLadder":
|
|
12
|
+
return {
|
|
13
|
+
method: "chainLadder",
|
|
14
|
+
rows: result.rows.map((r) => ({
|
|
15
|
+
origin: r.origin,
|
|
16
|
+
ultimate: r.ultimate,
|
|
17
|
+
unpaid: r.unpaid,
|
|
18
|
+
})),
|
|
19
|
+
totals: { ultimate: result.totals.ultimate, unpaid: result.totals.unpaid },
|
|
20
|
+
warnings: [...result.warnings],
|
|
21
|
+
basis: result.basis,
|
|
22
|
+
};
|
|
23
|
+
case "mack":
|
|
24
|
+
return {
|
|
25
|
+
method: "mack",
|
|
26
|
+
rows: result.rows.map((r) => ({
|
|
27
|
+
origin: r.origin,
|
|
28
|
+
ultimate: r.ultimate,
|
|
29
|
+
unpaid: r.reserve,
|
|
30
|
+
standardError: r.standardError,
|
|
31
|
+
})),
|
|
32
|
+
totals: {
|
|
33
|
+
ultimate: result.totals.ultimate,
|
|
34
|
+
unpaid: result.totals.reserve,
|
|
35
|
+
standardError: result.totals.standardError,
|
|
36
|
+
},
|
|
37
|
+
warnings: [...result.warnings],
|
|
38
|
+
basis: null,
|
|
39
|
+
};
|
|
40
|
+
case "bornhuetterFerguson":
|
|
41
|
+
return {
|
|
42
|
+
method: "bornhuetterFerguson",
|
|
43
|
+
rows: result.rows.map((r) => ({
|
|
44
|
+
origin: r.origin,
|
|
45
|
+
ultimate: r.ultimate,
|
|
46
|
+
unpaid: r.unpaid,
|
|
47
|
+
})),
|
|
48
|
+
totals: { ultimate: result.totals.ultimate, unpaid: result.totals.unpaid },
|
|
49
|
+
warnings: [...result.warnings],
|
|
50
|
+
basis: result.basis,
|
|
51
|
+
};
|
|
52
|
+
case "benktander":
|
|
53
|
+
return {
|
|
54
|
+
method: "benktander",
|
|
55
|
+
rows: result.rows.map((r) => ({
|
|
56
|
+
origin: r.origin,
|
|
57
|
+
ultimate: r.ultimate,
|
|
58
|
+
unpaid: r.unpaid,
|
|
59
|
+
})),
|
|
60
|
+
totals: { ultimate: result.totals.ultimate, unpaid: result.totals.unpaid },
|
|
61
|
+
warnings: [...result.warnings],
|
|
62
|
+
basis: result.basis,
|
|
63
|
+
};
|
|
64
|
+
default: {
|
|
65
|
+
const method = result.method ?? "(unknown)";
|
|
66
|
+
throw new ReservingError("BAD_INTERCHANGE", `resultToDoc does not support method "${method}" yet; Phase A converts chainLadder, ` +
|
|
67
|
+
"mack, bornhuetterFerguson, and benktander (more arrive with later phases)");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function resultToDoc(result, options) {
|
|
72
|
+
const selectionDoc = options.selectionDoc ?? null;
|
|
73
|
+
if (selectionDoc !== null &&
|
|
74
|
+
selectionDoc.selection.appliesTo.triangleIntegrity !== options.triangleDoc.integrity) {
|
|
75
|
+
throw new ReservingError("BAD_INTERCHANGE", `The selection document applies to triangle ${selectionDoc.selection.appliesTo.triangleIntegrity} ` +
|
|
76
|
+
`but the supplied triangle document's integrity is ${options.triangleDoc.integrity}`);
|
|
77
|
+
}
|
|
78
|
+
const mapped = mapResult(result);
|
|
79
|
+
if (mapped.basis !== null && mapped.basis !== options.triangleDoc.triangle.measure) {
|
|
80
|
+
throw new ReservingError("BAD_INTERCHANGE", `Result basis "${mapped.basis}" does not match the triangle document's measure ` +
|
|
81
|
+
`"${options.triangleDoc.triangle.measure}"`);
|
|
82
|
+
}
|
|
83
|
+
const engine = { ...(options.engine ?? CORE_ENGINE) };
|
|
84
|
+
if (options.conventionProfile !== undefined) {
|
|
85
|
+
engine.conventionProfile = options.conventionProfile;
|
|
86
|
+
}
|
|
87
|
+
const body = {
|
|
88
|
+
appliesTo: {
|
|
89
|
+
triangleIntegrity: options.triangleDoc.integrity,
|
|
90
|
+
selectionIntegrity: selectionDoc?.integrity ?? null,
|
|
91
|
+
},
|
|
92
|
+
engine,
|
|
93
|
+
method: mapped.method,
|
|
94
|
+
parameters: options.parameters ?? {},
|
|
95
|
+
rows: mapped.rows,
|
|
96
|
+
totals: mapped.totals,
|
|
97
|
+
};
|
|
98
|
+
// Authoring convention (shared with the Python adapter): `warnings` is
|
|
99
|
+
// omitted when empty, so a warning-free result hashes identically no
|
|
100
|
+
// matter which shore authored it.
|
|
101
|
+
if (mapped.warnings.length > 0)
|
|
102
|
+
body.warnings = mapped.warnings;
|
|
103
|
+
if (options.effectiveParameters !== undefined) {
|
|
104
|
+
body.effectiveParameters = options.effectiveParameters;
|
|
105
|
+
}
|
|
106
|
+
const doc = stampIntegrity({
|
|
107
|
+
interchangeVersion: INTERCHANGE_SPEC_VERSION,
|
|
108
|
+
kind: "method-result",
|
|
109
|
+
generator: options.generator ?? DEFAULT_GENERATOR,
|
|
110
|
+
createdAt: options.createdAt,
|
|
111
|
+
extensions: options.extensions ?? {},
|
|
112
|
+
result: body,
|
|
113
|
+
});
|
|
114
|
+
const checked = methodResultDocSchema.safeParse(doc);
|
|
115
|
+
if (!checked.success) {
|
|
116
|
+
throw new ReservingError("BAD_INTERCHANGE", `resultToDoc produced an invalid document: ${checked.error.issues
|
|
117
|
+
.map((i) => `${i.path.join(".") || "$"}: ${i.message}`)
|
|
118
|
+
.join("; ")}`);
|
|
119
|
+
}
|
|
120
|
+
return checked.data;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/convert/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EAExB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAKL,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAuB9B;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgB,EAAE,IAAI,EAAE,cAAc,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IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;IACF,uEAAuE;IACvE,qEAAqE;IACrE,kCAAkC;IAClC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAChE,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;QAC9C,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IACzD,CAAC;IAED,MAAM,GAAG,GAAG,cAAc,CAAkB;QAC1C,kBAAkB,EAAE,wBAAwB;QAC5C,IAAI,EAAE,eAAe;QACrB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,iBAAiB;QACjD,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,qBAAqB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,cAAc,CACtB,iBAAiB,EACjB,6CAA6C,OAAO,CAAC,KAAK,CAAC,MAAM;aAC9D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;aACtD,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type AverageKey, type LdfSelections } from "@actuarial-ts/core";
|
|
2
|
+
import { type GeneratorStamp } from "../envelope.js";
|
|
3
|
+
import type { OriginLengthMonths, TriangleDoc } from "../schemas/triangle.js";
|
|
4
|
+
import { type DevelopmentIntent, type SelectionBody, type SelectionDoc, type TailIntent } from "../schemas/selection.js";
|
|
5
|
+
/**
|
|
6
|
+
* core `LdfSelections` ↔ SelectionDoc, with the coherence rule (spec 3.2).
|
|
7
|
+
*
|
|
8
|
+
* THE COHERENCE RULE (normative): for COMPUTABLE intents (everything
|
|
9
|
+
* except judgmental/external), `value` MUST equal the intent's
|
|
10
|
+
* recomputation on the referenced triangle within 1e-9 relative. Every
|
|
11
|
+
* conforming importer verifies this and, per a strictness flag, warns or
|
|
12
|
+
* refuses (INCOHERENT_SELECTION) on divergence. Intent is authoritative
|
|
13
|
+
* for replay and promotion; values are authoritative only for
|
|
14
|
+
* judgmental/external intents.
|
|
15
|
+
*
|
|
16
|
+
* REPLAY CAPABILITY (spec 3.2 equivalence table): this shore recomputes
|
|
17
|
+
* only the cells the table marks `exact` for actuarial-ts —
|
|
18
|
+
* volume-weighted/simple all-period on any cadence, windowed n ∈ {5, 3}
|
|
19
|
+
* on 12-month cadence, geometric all-period, and medial {5, 1, 1} — via
|
|
20
|
+
* core's computeDevelopmentFactors, plus fitted tails via core's fitTail.
|
|
21
|
+
* Everything else (regression, other windows/trims, and any intent with
|
|
22
|
+
* origin exclusions, which core's menu machinery does not model) is
|
|
23
|
+
* value-only HERE: the value is accepted with a warning naming the
|
|
24
|
+
* limitation, never silently, and never recomputed with semantics the
|
|
25
|
+
* table does not claim. Cross-engine verification of those cells is the
|
|
26
|
+
* conformance suite's and the referee's business.
|
|
27
|
+
*/
|
|
28
|
+
/** Spec coherence tolerance: 1e-9 relative (spec 3.2). */
|
|
29
|
+
export declare const COHERENCE_TOLERANCE = 1e-9;
|
|
30
|
+
/** The interchange intent a standard-menu average key expresses. */
|
|
31
|
+
export declare function intentFromAverageKey(key: AverageKey): DevelopmentIntent;
|
|
32
|
+
/**
|
|
33
|
+
* The standard-menu key that replays this intent EXACTLY on the given
|
|
34
|
+
* cadence per the spec 3.2 equivalence table, or null (value-only here).
|
|
35
|
+
*/
|
|
36
|
+
export declare function averageKeyForIntent(intent: DevelopmentIntent, originLengthMonths: OriginLengthMonths): AverageKey | null;
|
|
37
|
+
export interface CoherenceFinding {
|
|
38
|
+
/** The development interval, or "tail". */
|
|
39
|
+
target: {
|
|
40
|
+
fromAgeMonths: number;
|
|
41
|
+
toAgeMonths: number;
|
|
42
|
+
} | "tail";
|
|
43
|
+
/** Whether this shore could recompute the intent exactly. */
|
|
44
|
+
capability: "exact" | "value-only";
|
|
45
|
+
/** Which side of the intent/value pair is authoritative (spec 3.2). */
|
|
46
|
+
authoritative: "intent" | "value";
|
|
47
|
+
/** The recomputed value where capability is exact; null otherwise. */
|
|
48
|
+
expected: number | null;
|
|
49
|
+
/** The value the document states. */
|
|
50
|
+
actual: number;
|
|
51
|
+
relativeDeviation: number | null;
|
|
52
|
+
/** true = verified coherent; false = divergent; null = not recomputed. */
|
|
53
|
+
coherent: boolean | null;
|
|
54
|
+
note?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface CoherenceCheck {
|
|
57
|
+
coherent: boolean;
|
|
58
|
+
findings: CoherenceFinding[];
|
|
59
|
+
warnings: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface CheckCoherenceOptions {
|
|
62
|
+
/** warn: report divergence; refuse: throw INCOHERENT_SELECTION. */
|
|
63
|
+
strictness: "warn" | "refuse";
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Verifies the coherence rule for a selection body against its referenced
|
|
67
|
+
* triangle document. Verifies the appliesTo linkage first (tag + measure);
|
|
68
|
+
* a mismatch is BAD_INTERCHANGE, not incoherence.
|
|
69
|
+
*/
|
|
70
|
+
export declare function checkSelectionCoherence(selection: SelectionBody, triangleDoc: TriangleDoc, options: CheckCoherenceOptions): CoherenceCheck;
|
|
71
|
+
/** Per-column intent: a standard-menu key or an explicit interchange intent. */
|
|
72
|
+
export type DevelopmentIntentInput = AverageKey | DevelopmentIntent;
|
|
73
|
+
export interface SelectionsToDocOptions {
|
|
74
|
+
/** The triangle document the selection applies to (source of the tag). */
|
|
75
|
+
triangleDoc: TriangleDoc;
|
|
76
|
+
/** ISO timestamp for the envelope (caller-supplied; purity rule). */
|
|
77
|
+
createdAt: string;
|
|
78
|
+
/**
|
|
79
|
+
* Per development column j (length = agesMonths.length - 1): the intent
|
|
80
|
+
* behind selected[j]. Required wherever selected[j] is a number; columns
|
|
81
|
+
* with null selections are omitted from the document.
|
|
82
|
+
*/
|
|
83
|
+
intents: readonly (DevelopmentIntentInput | null | undefined)[];
|
|
84
|
+
/** Tail intent; required when selections.tailFactor ≠ 1. */
|
|
85
|
+
tailIntent?: TailIntent;
|
|
86
|
+
/** Authoring-side coherence strictness. Default "refuse": never author
|
|
87
|
+
* an incoherent document silently. */
|
|
88
|
+
strictness?: "warn" | "refuse";
|
|
89
|
+
generator?: GeneratorStamp;
|
|
90
|
+
extensions?: Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
export interface SelectionsToDocResult {
|
|
93
|
+
doc: SelectionDoc;
|
|
94
|
+
coherence: CoherenceCheck;
|
|
95
|
+
warnings: string[];
|
|
96
|
+
}
|
|
97
|
+
export declare function selectionsToDoc(selections: LdfSelections, options: SelectionsToDocOptions): SelectionsToDocResult;
|
|
98
|
+
export interface DocToSelectionsOptions {
|
|
99
|
+
/** The triangle document the selection claims to apply to. */
|
|
100
|
+
triangleDoc: TriangleDoc;
|
|
101
|
+
/** Importer-side coherence strictness. Default "warn"; promotion gates
|
|
102
|
+
* and other refuse-mode consumers pass "refuse". */
|
|
103
|
+
strictness?: "warn" | "refuse";
|
|
104
|
+
}
|
|
105
|
+
export interface DocToSelectionsResult {
|
|
106
|
+
selections: LdfSelections;
|
|
107
|
+
/** Per column: the standard-menu key that replays the intent exactly,
|
|
108
|
+
* or null (value-only on this shore / no selection). */
|
|
109
|
+
averageKeys: (AverageKey | null)[];
|
|
110
|
+
coherence: CoherenceCheck;
|
|
111
|
+
warnings: string[];
|
|
112
|
+
}
|
|
113
|
+
export declare function docToSelections(doc: unknown, options: DocToSelectionsOptions): DocToSelectionsResult;
|
|
114
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../src/convert/selection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,aAAa,EAOnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,UAAU,EAGhB,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAgBxC,oEAAoE;AACpE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,UAAU,GAAG,iBAAiB,CAEvE;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,EACzB,kBAAkB,EAAE,kBAAkB,GACrC,UAAU,GAAG,IAAI,CA4BnB;AA6BD,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IAChE,6DAA6D;IAC7D,UAAU,EAAE,OAAO,GAAG,YAAY,CAAC;IACnC,uEAAuE;IACvE,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,GAA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