@actuarial-ts/data 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -6
- package/dist/customizationContracts.d.ts +116 -42
- package/dist/customizationContracts.d.ts.map +1 -1
- package/dist/customizationContracts.js +48 -5
- package/dist/customizationContracts.js.map +1 -1
- package/dist/historyMapping.d.ts +199 -9
- package/dist/historyMapping.d.ts.map +1 -1
- package/dist/historyMapping.js +34 -8
- package/dist/historyMapping.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/customizationContracts.ts +48 -5
- package/src/historyMapping.ts +41 -10
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Typed ingestion, preparation, and data-review boundaries for the actuarial-ts SDK. It supports loss-run/exposure CSVs, annual claim-development adaptation, triangle assembly, and generalized diagnostic review designed to support ASOP No. 23 work.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install @actuarial-ts/data@0.
|
|
6
|
+
npm install @actuarial-ts/data@0.10.0 @actuarial-ts/core@0.10.0
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Node 20+, ESM. Responsibility for the review and resulting actuarial work remains with the actuary.
|
|
10
10
|
|
|
11
11
|
SDK 0.8 adds strict parsers, source mapping, externally staged revision
|
|
12
12
|
history, and complete customization resource-policy validation. See the
|
|
13
|
-
[0.8 adoption guide](https://github.com/yerromnitsuj/actng/blob/v0.
|
|
14
|
-
and [customization reference](https://github.com/yerromnitsuj/actng/blob/v0.
|
|
13
|
+
[0.8 adoption guide](https://github.com/yerromnitsuj/actng/blob/v0.10.0/docs/migrations/0.8-reusable-customization.md)
|
|
14
|
+
and [customization reference](https://github.com/yerromnitsuj/actng/blob/v0.10.0/docs/reference/reusable-customization.md).
|
|
15
15
|
|
|
16
16
|
## Existing ingestion and triangle review
|
|
17
17
|
|
|
@@ -98,8 +98,8 @@ JSON, spreads, and casts cannot recreate these owners. Use
|
|
|
98
98
|
`createCompactDiagnosticRunIdentity` in compliance for compact completed runs;
|
|
99
99
|
the eager provenance function is not interchangeable.
|
|
100
100
|
|
|
101
|
-
See the runnable [compact adoption guide](https://github.com/yerromnitsuj/actng/blob/v0.
|
|
102
|
-
and [replay/resource-policy reference](https://github.com/yerromnitsuj/actng/blob/v0.
|
|
101
|
+
See the runnable [compact adoption guide](https://github.com/yerromnitsuj/actng/blob/v0.10.0/docs/migrations/0.7-compact-diagnostics.md)
|
|
102
|
+
and [replay/resource-policy reference](https://github.com/yerromnitsuj/actng/blob/v0.10.0/docs/reference/diagnostic-replay-stream.md).
|
|
103
103
|
Compact representation preserves evidence; it is not a claim that an arbitrary
|
|
104
104
|
large dataset or host memory budget has passed acceptance.
|
|
105
105
|
|
|
@@ -114,8 +114,18 @@ immutable preparation and exact review evidence; every other selection follows
|
|
|
114
114
|
the ordinary compact preparation path. The API does not promise a latency or
|
|
115
115
|
process-memory target.
|
|
116
116
|
|
|
117
|
-
See the [formula catalog](https://github.com/yerromnitsuj/actng/blob/v0.
|
|
117
|
+
See the [formula catalog](https://github.com/yerromnitsuj/actng/blob/v0.10.0/docs/reference/diagnostic-formulas.md) and [migration guide](https://github.com/yerromnitsuj/actng/blob/v0.10.0/docs/migrations/0.6-generalized-diagnostics.md).
|
|
118
118
|
|
|
119
119
|
## License
|
|
120
120
|
|
|
121
121
|
Apache-2.0. See LICENSE and NOTICE.
|
|
122
|
+
|
|
123
|
+
SDK 0.9 adds native post-aggregation formulas and correct financial currency units.
|
|
124
|
+
See the [0.9 migration guide](https://github.com/yerromnitsuj/actng/blob/v0.10.0/docs/migrations/0.9-analysis-expressions.md).
|
|
125
|
+
|
|
126
|
+
## Composite history sources
|
|
127
|
+
|
|
128
|
+
SDK 0.10 adds multiple original artifacts within one claim namespace, explicit
|
|
129
|
+
composite identity selectors and complete input-artifact membership checks.
|
|
130
|
+
Upgrade the five SDK packages together and preserve the producing runtime
|
|
131
|
+
with archived evidence. See the [0.10 migration guide](https://github.com/yerromnitsuj/actng/blob/v0.10.0/docs/migrations/0.10-composite-history.md).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnalysisDefinition, type AnalysisClassificationDefinition, type AnalysisPredicate, type AnalysisRecipe, type AnalysisResult, type AnalysisScenario, type AnalysisScenarioGrid, type CustomizationExposureObservation, type CustomizationResourceLimits, type ExposureAllocationTarget, type ExposureLevelSchedule, type ExposureRevisionSelection, type HistoricalDatasetInput, type JsonValue } from "@actuarial-ts/core";
|
|
1
|
+
import { type AnalysisDefinition, type AnalysisMeasureExpression, type AnalysisClassificationDefinition, type AnalysisPredicate, type AnalysisRecipe, type AnalysisResult, type AnalysisScenario, type AnalysisScenarioGrid, type CustomizationExposureObservation, type CustomizationResourceLimits, type ExposureAllocationTarget, type ExposureLevelSchedule, type ExposureRevisionSelection, type HistoricalDatasetInput, type JsonValue } from "@actuarial-ts/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
/** Complete, closed resource policy for every customization streaming boundary. */
|
|
4
4
|
export declare const customizationResourceLimitsSchema: z.ZodType<CustomizationResourceLimits>;
|
|
@@ -223,14 +223,32 @@ export declare const historicalDatasetInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
223
223
|
namespace: z.ZodEffects<z.ZodString, string, string>;
|
|
224
224
|
artifactId: z.ZodEffects<z.ZodString, string, string>;
|
|
225
225
|
mappingVersion: z.ZodEffects<z.ZodString, string, string>;
|
|
226
|
+
additionalArtifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
227
|
+
artifactId: z.ZodEffects<z.ZodString, string, string>;
|
|
228
|
+
mappingVersion: z.ZodEffects<z.ZodString, string, string>;
|
|
229
|
+
}, "strict", z.ZodTypeAny, {
|
|
230
|
+
artifactId: string;
|
|
231
|
+
mappingVersion: string;
|
|
232
|
+
}, {
|
|
233
|
+
artifactId: string;
|
|
234
|
+
mappingVersion: string;
|
|
235
|
+
}>, "many">>;
|
|
226
236
|
}, "strict", z.ZodTypeAny, {
|
|
227
237
|
artifactId: string;
|
|
228
238
|
namespace: string;
|
|
229
239
|
mappingVersion: string;
|
|
240
|
+
additionalArtifacts?: {
|
|
241
|
+
artifactId: string;
|
|
242
|
+
mappingVersion: string;
|
|
243
|
+
}[] | undefined;
|
|
230
244
|
}, {
|
|
231
245
|
artifactId: string;
|
|
232
246
|
namespace: string;
|
|
233
247
|
mappingVersion: string;
|
|
248
|
+
additionalArtifacts?: {
|
|
249
|
+
artifactId: string;
|
|
250
|
+
mappingVersion: string;
|
|
251
|
+
}[] | undefined;
|
|
234
252
|
}>, "many">;
|
|
235
253
|
evaluationDates: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
236
254
|
openingBalances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -473,6 +491,10 @@ export declare const historicalDatasetInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
473
491
|
artifactId: string;
|
|
474
492
|
namespace: string;
|
|
475
493
|
mappingVersion: string;
|
|
494
|
+
additionalArtifacts?: {
|
|
495
|
+
artifactId: string;
|
|
496
|
+
mappingVersion: string;
|
|
497
|
+
}[] | undefined;
|
|
476
498
|
}[];
|
|
477
499
|
revisionView: {
|
|
478
500
|
kind: "as-known";
|
|
@@ -536,6 +558,10 @@ export declare const historicalDatasetInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
536
558
|
artifactId: string;
|
|
537
559
|
namespace: string;
|
|
538
560
|
mappingVersion: string;
|
|
561
|
+
additionalArtifacts?: {
|
|
562
|
+
artifactId: string;
|
|
563
|
+
mappingVersion: string;
|
|
564
|
+
}[] | undefined;
|
|
539
565
|
}[];
|
|
540
566
|
revisionView: {
|
|
541
567
|
kind: "as-known";
|
|
@@ -599,6 +625,10 @@ export declare const historicalDatasetInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
599
625
|
artifactId: string;
|
|
600
626
|
namespace: string;
|
|
601
627
|
mappingVersion: string;
|
|
628
|
+
additionalArtifacts?: {
|
|
629
|
+
artifactId: string;
|
|
630
|
+
mappingVersion: string;
|
|
631
|
+
}[] | undefined;
|
|
602
632
|
}[];
|
|
603
633
|
revisionView: {
|
|
604
634
|
kind: "as-known";
|
|
@@ -662,6 +692,10 @@ export declare const historicalDatasetInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
662
692
|
artifactId: string;
|
|
663
693
|
namespace: string;
|
|
664
694
|
mappingVersion: string;
|
|
695
|
+
additionalArtifacts?: {
|
|
696
|
+
artifactId: string;
|
|
697
|
+
mappingVersion: string;
|
|
698
|
+
}[] | undefined;
|
|
665
699
|
}[];
|
|
666
700
|
revisionView: {
|
|
667
701
|
kind: "as-known";
|
|
@@ -871,6 +905,13 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
871
905
|
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
872
906
|
}>, "many">;
|
|
873
907
|
}, "strict", z.ZodTypeAny, {
|
|
908
|
+
exposure: {
|
|
909
|
+
id: string;
|
|
910
|
+
populationKeys: string[];
|
|
911
|
+
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
912
|
+
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
913
|
+
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
914
|
+
}[];
|
|
874
915
|
financial: {
|
|
875
916
|
id: string;
|
|
876
917
|
subject: "claim" | "claimant" | "occurrence" | "policy" | "coverage";
|
|
@@ -899,6 +940,7 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
899
940
|
asOfDate: string;
|
|
900
941
|
};
|
|
901
942
|
};
|
|
943
|
+
}, {
|
|
902
944
|
exposure: {
|
|
903
945
|
id: string;
|
|
904
946
|
populationKeys: string[];
|
|
@@ -906,7 +948,6 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
906
948
|
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
907
949
|
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
908
950
|
}[];
|
|
909
|
-
}, {
|
|
910
951
|
financial: {
|
|
911
952
|
id: string;
|
|
912
953
|
subject: "claim" | "claimant" | "occurrence" | "policy" | "coverage";
|
|
@@ -935,13 +976,6 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
935
976
|
asOfDate: string;
|
|
936
977
|
};
|
|
937
978
|
};
|
|
938
|
-
exposure: {
|
|
939
|
-
id: string;
|
|
940
|
-
populationKeys: string[];
|
|
941
|
-
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
942
|
-
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
943
|
-
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
944
|
-
}[];
|
|
945
979
|
}>;
|
|
946
980
|
policySchedule: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
947
981
|
id: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -1264,6 +1298,7 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1264
1298
|
event: "closed-date";
|
|
1265
1299
|
censor: "evaluation-date";
|
|
1266
1300
|
}>]>;
|
|
1301
|
+
unitFactors: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodNumber>, Record<string, number>, Record<string, number>>>;
|
|
1267
1302
|
populationScopeId: z.ZodEffects<z.ZodString, string, string>;
|
|
1268
1303
|
condition: z.ZodOptional<z.ZodType<AnalysisPredicate, z.ZodTypeDef, AnalysisPredicate>>;
|
|
1269
1304
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -1310,6 +1345,7 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1310
1345
|
censor: "evaluation-date";
|
|
1311
1346
|
};
|
|
1312
1347
|
populationScopeId: string;
|
|
1348
|
+
unitFactors?: Record<string, number> | undefined;
|
|
1313
1349
|
condition?: AnalysisPredicate | undefined;
|
|
1314
1350
|
}, {
|
|
1315
1351
|
id: string;
|
|
@@ -1355,8 +1391,22 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1355
1391
|
censor: "evaluation-date";
|
|
1356
1392
|
};
|
|
1357
1393
|
populationScopeId: string;
|
|
1394
|
+
unitFactors?: Record<string, number> | undefined;
|
|
1358
1395
|
condition?: AnalysisPredicate | undefined;
|
|
1359
1396
|
}>, "many">;
|
|
1397
|
+
derivedMeasures: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1398
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
1399
|
+
expression: z.ZodType<AnalysisMeasureExpression, z.ZodTypeDef, AnalysisMeasureExpression>;
|
|
1400
|
+
developmentSemantics: z.ZodEnum<["cumulative", "incremental", "point-in-time"]>;
|
|
1401
|
+
}, "strict", z.ZodTypeAny, {
|
|
1402
|
+
expression: AnalysisMeasureExpression;
|
|
1403
|
+
id: string;
|
|
1404
|
+
developmentSemantics: "point-in-time" | "cumulative" | "incremental";
|
|
1405
|
+
}, {
|
|
1406
|
+
expression: AnalysisMeasureExpression;
|
|
1407
|
+
id: string;
|
|
1408
|
+
developmentSemantics: "point-in-time" | "cumulative" | "incremental";
|
|
1409
|
+
}>, "many">>;
|
|
1360
1410
|
financialTerms: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
1361
1411
|
kind: z.ZodEnum<["claim-layer", "occurrence-layer"]>;
|
|
1362
1412
|
id: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -1512,11 +1562,19 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1512
1562
|
censor: "evaluation-date";
|
|
1513
1563
|
};
|
|
1514
1564
|
populationScopeId: string;
|
|
1565
|
+
unitFactors?: Record<string, number> | undefined;
|
|
1515
1566
|
condition?: AnalysisPredicate | undefined;
|
|
1516
1567
|
}[];
|
|
1517
1568
|
analysisContractVersion: "actuarial-analysis/1";
|
|
1518
1569
|
version: string;
|
|
1519
1570
|
scopes: {
|
|
1571
|
+
exposure: {
|
|
1572
|
+
id: string;
|
|
1573
|
+
populationKeys: string[];
|
|
1574
|
+
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
1575
|
+
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
1576
|
+
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
1577
|
+
}[];
|
|
1520
1578
|
financial: {
|
|
1521
1579
|
id: string;
|
|
1522
1580
|
subject: "claim" | "claimant" | "occurrence" | "policy" | "coverage";
|
|
@@ -1545,13 +1603,6 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1545
1603
|
asOfDate: string;
|
|
1546
1604
|
};
|
|
1547
1605
|
};
|
|
1548
|
-
exposure: {
|
|
1549
|
-
id: string;
|
|
1550
|
-
populationKeys: string[];
|
|
1551
|
-
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
1552
|
-
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
1553
|
-
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
1554
|
-
}[];
|
|
1555
1606
|
};
|
|
1556
1607
|
policySchedule: {
|
|
1557
1608
|
id: string;
|
|
@@ -1616,6 +1667,11 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1616
1667
|
allocation: "proportional" | "chronological";
|
|
1617
1668
|
deductible: number;
|
|
1618
1669
|
})[];
|
|
1670
|
+
derivedMeasures?: {
|
|
1671
|
+
expression: AnalysisMeasureExpression;
|
|
1672
|
+
id: string;
|
|
1673
|
+
developmentSemantics: "point-in-time" | "cumulative" | "incremental";
|
|
1674
|
+
}[] | undefined;
|
|
1619
1675
|
financialAdjustments?: ({
|
|
1620
1676
|
kind: "scale";
|
|
1621
1677
|
id: string;
|
|
@@ -1688,11 +1744,19 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1688
1744
|
censor: "evaluation-date";
|
|
1689
1745
|
};
|
|
1690
1746
|
populationScopeId: string;
|
|
1747
|
+
unitFactors?: Record<string, number> | undefined;
|
|
1691
1748
|
condition?: AnalysisPredicate | undefined;
|
|
1692
1749
|
}[];
|
|
1693
1750
|
analysisContractVersion: "actuarial-analysis/1";
|
|
1694
1751
|
version: string;
|
|
1695
1752
|
scopes: {
|
|
1753
|
+
exposure: {
|
|
1754
|
+
id: string;
|
|
1755
|
+
populationKeys: string[];
|
|
1756
|
+
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
1757
|
+
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
1758
|
+
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
1759
|
+
}[];
|
|
1696
1760
|
financial: {
|
|
1697
1761
|
id: string;
|
|
1698
1762
|
subject: "claim" | "claimant" | "occurrence" | "policy" | "coverage";
|
|
@@ -1721,13 +1785,6 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1721
1785
|
asOfDate: string;
|
|
1722
1786
|
};
|
|
1723
1787
|
};
|
|
1724
|
-
exposure: {
|
|
1725
|
-
id: string;
|
|
1726
|
-
populationKeys: string[];
|
|
1727
|
-
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
1728
|
-
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
1729
|
-
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
1730
|
-
}[];
|
|
1731
1788
|
};
|
|
1732
1789
|
policySchedule: {
|
|
1733
1790
|
id: string;
|
|
@@ -1792,6 +1849,11 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1792
1849
|
allocation: "proportional" | "chronological";
|
|
1793
1850
|
deductible: number;
|
|
1794
1851
|
})[];
|
|
1852
|
+
derivedMeasures?: {
|
|
1853
|
+
expression: AnalysisMeasureExpression;
|
|
1854
|
+
id: string;
|
|
1855
|
+
developmentSemantics: "point-in-time" | "cumulative" | "incremental";
|
|
1856
|
+
}[] | undefined;
|
|
1795
1857
|
financialAdjustments?: ({
|
|
1796
1858
|
kind: "scale";
|
|
1797
1859
|
id: string;
|
|
@@ -1864,11 +1926,19 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1864
1926
|
censor: "evaluation-date";
|
|
1865
1927
|
};
|
|
1866
1928
|
populationScopeId: string;
|
|
1929
|
+
unitFactors?: Record<string, number> | undefined;
|
|
1867
1930
|
condition?: AnalysisPredicate | undefined;
|
|
1868
1931
|
}[];
|
|
1869
1932
|
analysisContractVersion: "actuarial-analysis/1";
|
|
1870
1933
|
version: string;
|
|
1871
1934
|
scopes: {
|
|
1935
|
+
exposure: {
|
|
1936
|
+
id: string;
|
|
1937
|
+
populationKeys: string[];
|
|
1938
|
+
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
1939
|
+
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
1940
|
+
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
1941
|
+
}[];
|
|
1872
1942
|
financial: {
|
|
1873
1943
|
id: string;
|
|
1874
1944
|
subject: "claim" | "claimant" | "occurrence" | "policy" | "coverage";
|
|
@@ -1897,13 +1967,6 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1897
1967
|
asOfDate: string;
|
|
1898
1968
|
};
|
|
1899
1969
|
};
|
|
1900
|
-
exposure: {
|
|
1901
|
-
id: string;
|
|
1902
|
-
populationKeys: string[];
|
|
1903
|
-
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
1904
|
-
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
1905
|
-
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
1906
|
-
}[];
|
|
1907
1970
|
};
|
|
1908
1971
|
policySchedule: {
|
|
1909
1972
|
id: string;
|
|
@@ -1968,6 +2031,11 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1968
2031
|
allocation: "proportional" | "chronological";
|
|
1969
2032
|
deductible: number;
|
|
1970
2033
|
})[];
|
|
2034
|
+
derivedMeasures?: {
|
|
2035
|
+
expression: AnalysisMeasureExpression;
|
|
2036
|
+
id: string;
|
|
2037
|
+
developmentSemantics: "point-in-time" | "cumulative" | "incremental";
|
|
2038
|
+
}[] | undefined;
|
|
1971
2039
|
financialAdjustments?: ({
|
|
1972
2040
|
kind: "scale";
|
|
1973
2041
|
id: string;
|
|
@@ -2040,11 +2108,19 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2040
2108
|
censor: "evaluation-date";
|
|
2041
2109
|
};
|
|
2042
2110
|
populationScopeId: string;
|
|
2111
|
+
unitFactors?: Record<string, number> | undefined;
|
|
2043
2112
|
condition?: AnalysisPredicate | undefined;
|
|
2044
2113
|
}[];
|
|
2045
2114
|
analysisContractVersion: "actuarial-analysis/1";
|
|
2046
2115
|
version: string;
|
|
2047
2116
|
scopes: {
|
|
2117
|
+
exposure: {
|
|
2118
|
+
id: string;
|
|
2119
|
+
populationKeys: string[];
|
|
2120
|
+
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
2121
|
+
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
2122
|
+
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
2123
|
+
}[];
|
|
2048
2124
|
financial: {
|
|
2049
2125
|
id: string;
|
|
2050
2126
|
subject: "claim" | "claimant" | "occurrence" | "policy" | "coverage";
|
|
@@ -2073,13 +2149,6 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2073
2149
|
asOfDate: string;
|
|
2074
2150
|
};
|
|
2075
2151
|
};
|
|
2076
|
-
exposure: {
|
|
2077
|
-
id: string;
|
|
2078
|
-
populationKeys: string[];
|
|
2079
|
-
timeBasis: "interval" | "point-in-time" | "already-earned";
|
|
2080
|
-
reportingFilterEffect: "none" | "matching-exposure-dimensions";
|
|
2081
|
-
valuationSelection?: "exact" | "origin-static" | "latest-on-or-before" | undefined;
|
|
2082
|
-
}[];
|
|
2083
2152
|
};
|
|
2084
2153
|
policySchedule: {
|
|
2085
2154
|
id: string;
|
|
@@ -2144,6 +2213,11 @@ export declare const analysisDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2144
2213
|
allocation: "proportional" | "chronological";
|
|
2145
2214
|
deductible: number;
|
|
2146
2215
|
})[];
|
|
2216
|
+
derivedMeasures?: {
|
|
2217
|
+
expression: AnalysisMeasureExpression;
|
|
2218
|
+
id: string;
|
|
2219
|
+
developmentSemantics: "point-in-time" | "cumulative" | "incremental";
|
|
2220
|
+
}[] | undefined;
|
|
2147
2221
|
financialAdjustments?: ({
|
|
2148
2222
|
kind: "scale";
|
|
2149
2223
|
id: string;
|
|
@@ -2238,7 +2312,7 @@ export declare const analysisRecipeSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2238
2312
|
kind: "adapt-diagnostics";
|
|
2239
2313
|
diagnosticDefinitionId: string;
|
|
2240
2314
|
}>]>, "many">;
|
|
2241
|
-
requiredCapabilities: z.ZodArray<z.ZodEnum<["history-snapshots", "history-changes", "irregular-periods", "exposure-earning", "typed-populations", "descriptive-statistics", "reserving-triangle-adapter", "bounded-execution", "shared-financial-terms", "recipes", "scenarios"]>, "many">;
|
|
2315
|
+
requiredCapabilities: z.ZodArray<z.ZodEnum<["history-snapshots", "history-changes", "irregular-periods", "exposure-earning", "typed-populations", "descriptive-statistics", "derived-analysis-measures", "reserving-triangle-adapter", "bounded-execution", "shared-financial-terms", "recipes", "scenarios"]>, "many">;
|
|
2242
2316
|
parameters: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
|
|
2243
2317
|
}, "strict", z.ZodTypeAny, {
|
|
2244
2318
|
id: string;
|
|
@@ -2268,7 +2342,7 @@ export declare const analysisRecipeSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2268
2342
|
kind: "adapt-diagnostics";
|
|
2269
2343
|
diagnosticDefinitionId: string;
|
|
2270
2344
|
})[];
|
|
2271
|
-
requiredCapabilities: ("history-snapshots" | "history-changes" | "irregular-periods" | "exposure-earning" | "typed-populations" | "descriptive-statistics" | "reserving-triangle-adapter" | "bounded-execution" | "shared-financial-terms" | "recipes" | "scenarios")[];
|
|
2345
|
+
requiredCapabilities: ("history-snapshots" | "history-changes" | "irregular-periods" | "exposure-earning" | "typed-populations" | "descriptive-statistics" | "derived-analysis-measures" | "reserving-triangle-adapter" | "bounded-execution" | "shared-financial-terms" | "recipes" | "scenarios")[];
|
|
2272
2346
|
parameters: Record<string, JsonValue>;
|
|
2273
2347
|
}, {
|
|
2274
2348
|
id: string;
|
|
@@ -2298,7 +2372,7 @@ export declare const analysisRecipeSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2298
2372
|
kind: "adapt-diagnostics";
|
|
2299
2373
|
diagnosticDefinitionId: string;
|
|
2300
2374
|
})[];
|
|
2301
|
-
requiredCapabilities: ("history-snapshots" | "history-changes" | "irregular-periods" | "exposure-earning" | "typed-populations" | "descriptive-statistics" | "reserving-triangle-adapter" | "bounded-execution" | "shared-financial-terms" | "recipes" | "scenarios")[];
|
|
2375
|
+
requiredCapabilities: ("history-snapshots" | "history-changes" | "irregular-periods" | "exposure-earning" | "typed-populations" | "descriptive-statistics" | "derived-analysis-measures" | "reserving-triangle-adapter" | "bounded-execution" | "shared-financial-terms" | "recipes" | "scenarios")[];
|
|
2302
2376
|
parameters: Record<string, JsonValue>;
|
|
2303
2377
|
}>, {
|
|
2304
2378
|
id: string;
|
|
@@ -2328,7 +2402,7 @@ export declare const analysisRecipeSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2328
2402
|
kind: "adapt-diagnostics";
|
|
2329
2403
|
diagnosticDefinitionId: string;
|
|
2330
2404
|
})[];
|
|
2331
|
-
requiredCapabilities: ("history-snapshots" | "history-changes" | "irregular-periods" | "exposure-earning" | "typed-populations" | "descriptive-statistics" | "reserving-triangle-adapter" | "bounded-execution" | "shared-financial-terms" | "recipes" | "scenarios")[];
|
|
2405
|
+
requiredCapabilities: ("history-snapshots" | "history-changes" | "irregular-periods" | "exposure-earning" | "typed-populations" | "descriptive-statistics" | "derived-analysis-measures" | "reserving-triangle-adapter" | "bounded-execution" | "shared-financial-terms" | "recipes" | "scenarios")[];
|
|
2332
2406
|
parameters: Record<string, JsonValue>;
|
|
2333
2407
|
}, {
|
|
2334
2408
|
id: string;
|
|
@@ -2358,7 +2432,7 @@ export declare const analysisRecipeSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2358
2432
|
kind: "adapt-diagnostics";
|
|
2359
2433
|
diagnosticDefinitionId: string;
|
|
2360
2434
|
})[];
|
|
2361
|
-
requiredCapabilities: ("history-snapshots" | "history-changes" | "irregular-periods" | "exposure-earning" | "typed-populations" | "descriptive-statistics" | "reserving-triangle-adapter" | "bounded-execution" | "shared-financial-terms" | "recipes" | "scenarios")[];
|
|
2435
|
+
requiredCapabilities: ("history-snapshots" | "history-changes" | "irregular-periods" | "exposure-earning" | "typed-populations" | "descriptive-statistics" | "derived-analysis-measures" | "reserving-triangle-adapter" | "bounded-execution" | "shared-financial-terms" | "recipes" | "scenarios")[];
|
|
2362
2436
|
parameters: Record<string, JsonValue>;
|
|
2363
2437
|
}>;
|
|
2364
2438
|
export declare const analysisResultSchema: z.ZodType<AnalysisResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customizationContracts.d.ts","sourceRoot":"","sources":["../src/customizationContracts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"customizationContracts.d.ts","sourceRoot":"","sources":["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CAAgC,EAAE,CAElH;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,wBAAwB,EAAE,CAElG;AAED,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CAExF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAEhF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,gCAAgC,CAE5F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ANALYSIS_DEFINITION_CONTRACT_VERSION, ANALYSIS_RECIPE_CONTRACT_VERSION, ANALYSIS_RESULT_CONTRACT_VERSION, CUSTOMIZATION_CAPABILITIES, HISTORICAL_DATASET_CONTRACT_VERSION, DiagnosticValidationError, diagnosticJsonPreflight, isDiagnosticToken, isRealIsoDate, } from "@actuarial-ts/core";
|
|
1
|
+
import { ANALYSIS_DEFINITION_CONTRACT_VERSION, ANALYSIS_RECIPE_CONTRACT_VERSION, ANALYSIS_RESULT_CONTRACT_VERSION, CUSTOMIZATION_CAPABILITIES, HISTORICAL_DATASET_CONTRACT_VERSION, DiagnosticValidationError, diagnosticJsonPreflight, compileAnalysisExpressions, isDiagnosticToken, isRealIsoDate, } from "@actuarial-ts/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
const token = z
|
|
4
4
|
.string()
|
|
@@ -203,7 +203,10 @@ export const historicalDatasetInputSchema = z
|
|
|
203
203
|
missingSnapshotRecord: z.enum(["unknown", "carried-forward"]),
|
|
204
204
|
sources: z
|
|
205
205
|
.array(z
|
|
206
|
-
.object({
|
|
206
|
+
.object({
|
|
207
|
+
namespace: token, artifactId: token, mappingVersion: token,
|
|
208
|
+
additionalArtifacts: z.array(z.object({ artifactId: token, mappingVersion: token }).strict()).min(1).optional(),
|
|
209
|
+
})
|
|
207
210
|
.strict())
|
|
208
211
|
.min(1),
|
|
209
212
|
evaluationDates: z.array(date).optional(),
|
|
@@ -232,7 +235,13 @@ export const historicalDatasetInputSchema = z
|
|
|
232
235
|
message: "Source namespace is duplicated",
|
|
233
236
|
});
|
|
234
237
|
namespaces.add(source.namespace);
|
|
235
|
-
|
|
238
|
+
const artifacts = new Set([source.artifactId]);
|
|
239
|
+
source.additionalArtifacts?.forEach((artifact, position) => {
|
|
240
|
+
if (artifacts.has(artifact.artifactId))
|
|
241
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["sources", index, "additionalArtifacts", position, "artifactId"], message: "Artifact ID is duplicated within the source namespace" });
|
|
242
|
+
artifacts.add(artifact.artifactId);
|
|
243
|
+
});
|
|
244
|
+
artifactByNamespace.set(source.namespace, artifacts);
|
|
236
245
|
});
|
|
237
246
|
input.records.forEach((record, index) => {
|
|
238
247
|
if (!namespaces.has(record.sourceNamespace))
|
|
@@ -242,7 +251,7 @@ export const historicalDatasetInputSchema = z
|
|
|
242
251
|
message: "Record references an unknown source namespace",
|
|
243
252
|
});
|
|
244
253
|
if (artifactByNamespace.has(record.sourceNamespace) &&
|
|
245
|
-
artifactByNamespace.get(record.sourceNamespace)
|
|
254
|
+
!artifactByNamespace.get(record.sourceNamespace).has(record.source.artifactId))
|
|
246
255
|
context.addIssue({
|
|
247
256
|
code: z.ZodIssueCode.custom,
|
|
248
257
|
path: ["records", index, "source", "artifactId"],
|
|
@@ -326,7 +335,7 @@ export const historicalDatasetInputSchema = z
|
|
|
326
335
|
message: "Opening balance references an unknown source namespace",
|
|
327
336
|
});
|
|
328
337
|
if (artifactByNamespace.has(balance.sourceNamespace) &&
|
|
329
|
-
artifactByNamespace.get(balance.sourceNamespace)
|
|
338
|
+
!artifactByNamespace.get(balance.sourceNamespace).has(balance.source.artifactId))
|
|
330
339
|
context.addIssue({
|
|
331
340
|
code: z.ZodIssueCode.custom,
|
|
332
341
|
path: ["openingBalances", index, "source", "artifactId"],
|
|
@@ -452,6 +461,15 @@ function duplicatePaths(values, base, context) {
|
|
|
452
461
|
seen.add(value.id);
|
|
453
462
|
});
|
|
454
463
|
}
|
|
464
|
+
const unitFactors = z.record(token, z.number().int().min(-32).max(32)).refine((value) => Object.keys(value).length <= 32, "At most 32 unit factors are supported");
|
|
465
|
+
const measureExpression = z.lazy(() => z.discriminatedUnion("op", [
|
|
466
|
+
z.object({ op: z.literal("measure"), measureId: token }).strict(),
|
|
467
|
+
z.object({ op: z.literal("exposure"), exposureId: token }).strict(),
|
|
468
|
+
z.object({ op: z.literal("constant"), value: finite, unitFactors }).strict(),
|
|
469
|
+
z.object({ op: z.literal("add"), terms: z.array(measureExpression).min(1).max(32) }).strict(),
|
|
470
|
+
z.object({ op: z.enum(["subtract", "multiply"]), left: measureExpression, right: measureExpression }).strict(),
|
|
471
|
+
z.object({ op: z.literal("divide"), numerator: measureExpression, denominator: measureExpression }).strict(),
|
|
472
|
+
]));
|
|
455
473
|
export const analysisDefinitionSchema = z
|
|
456
474
|
.object({
|
|
457
475
|
analysisContractVersion: z.literal(ANALYSIS_DEFINITION_CONTRACT_VERSION),
|
|
@@ -546,15 +564,30 @@ export const analysisDefinitionSchema = z
|
|
|
546
564
|
unit: token,
|
|
547
565
|
developmentSemantics: z.enum(["cumulative", "incremental", "point-in-time"]),
|
|
548
566
|
statistic,
|
|
567
|
+
unitFactors: unitFactors.optional(),
|
|
549
568
|
populationScopeId: token,
|
|
550
569
|
condition: predicate.optional(),
|
|
551
570
|
})
|
|
552
571
|
.strict()),
|
|
572
|
+
derivedMeasures: z.array(z.object({
|
|
573
|
+
id: token,
|
|
574
|
+
expression: measureExpression,
|
|
575
|
+
developmentSemantics: z.enum(["cumulative", "incremental", "point-in-time"]),
|
|
576
|
+
}).strict()).max(64).optional(),
|
|
553
577
|
financialTerms: z.array(financialTerm),
|
|
554
578
|
financialAdjustments: z.array(financialAdjustment).optional(),
|
|
555
579
|
})
|
|
556
580
|
.strict()
|
|
557
581
|
.superRefine((definition, context) => {
|
|
582
|
+
try {
|
|
583
|
+
compileAnalysisExpressions(definition);
|
|
584
|
+
}
|
|
585
|
+
catch (error) {
|
|
586
|
+
if (!(error instanceof DiagnosticValidationError))
|
|
587
|
+
throw error;
|
|
588
|
+
for (const issue of error.issues)
|
|
589
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["derivedMeasures"], message: issue.message });
|
|
590
|
+
}
|
|
558
591
|
duplicatePaths(definition.dimensions, "dimensions", context);
|
|
559
592
|
duplicatePaths(definition.scopes.exposure, "scopes.exposure", context);
|
|
560
593
|
duplicatePaths(definition.policySchedule, "policySchedule", context);
|
|
@@ -729,6 +762,16 @@ export const analysisResultSchema = z.object({
|
|
|
729
762
|
numerator: finite.nullable(),
|
|
730
763
|
denominator: finite.nullable(),
|
|
731
764
|
findings: z.array(capabilityFinding),
|
|
765
|
+
derivation: z.object({
|
|
766
|
+
stage: z.literal("post-aggregation"),
|
|
767
|
+
unitFactors,
|
|
768
|
+
components: z.array(z.object({
|
|
769
|
+
kind: z.enum(["measure", "exposure"]), id: token, unit: token,
|
|
770
|
+
value: finite.nullable(), status: z.enum(["available", "unavailable"]),
|
|
771
|
+
contributingObservations: z.number().int().nonnegative(),
|
|
772
|
+
excludedObservations: z.number().int().nonnegative(),
|
|
773
|
+
}).strict()).max(1024),
|
|
774
|
+
}).strict().optional(),
|
|
732
775
|
}).strict()),
|
|
733
776
|
}).strict();
|
|
734
777
|
const scenarioChange = z.discriminatedUnion("kind", [
|