diff --git a/Constants/Consts.ipynb b/Constants/Consts.ipynb
new file mode 100644
index 00000000..21850a86
--- /dev/null
+++ b/Constants/Consts.ipynb
@@ -0,0 +1,386 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "toc-autonumbering": "True",
+ "toc-showcode": "False",
+ "toc-showmarkdowntxt": "False",
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "2kYu9e9ygUipdOuqA9Hk6A",
+ "cell_type": "markdown",
+ "source": [
+ "
Consts
"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "DmUpa-myfk6s7tnBoktcyw",
+ "cell_type": "markdown",
+ "source": [
+ "# Numerical Precision"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "KG3zmL2K_kGTNzWA2eQJvg",
+ "cell_type": "code",
+ "source": [
+ "public const double Precision = 1E-5;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "gMPLPUb7kUiJnLQWtEkkFA",
+ "cell_type": "code",
+ "source": [
+ "public const double ProjectionPrecision = 1E-3;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "gv0HnKTwuU--7Xo8e6UU2w",
+ "cell_type": "code",
+ "source": [
+ "public const double BenchmarkPrecision = 1E-4;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "gbuDd5t2Ike1Jq-lnVVIqg",
+ "cell_type": "markdown",
+ "source": [
+ "# Time Period"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "oX6yOw75DE-NwrYkdYTmzg",
+ "cell_type": "code",
+ "source": [
+ "public const int CurrentPeriod = 0; "
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "2XFjLebnDEWBoNCyq6lKgg",
+ "cell_type": "code",
+ "source": [
+ "public const int PreviousPeriod = -1; "
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "5ydvfd1abEm-CSTH-csz-g",
+ "cell_type": "code",
+ "source": [
+ "public const int MonthInAYear = 12;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "yhpv5BPDJUGKucF6Y_AVeQ",
+ "cell_type": "markdown",
+ "source": [
+ "# Defaults"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "uOfb6nvi8USI3mPOH8YvwQ",
+ "cell_type": "code",
+ "source": [
+ "public const int DefaultDataNodeActivationMonth = 1;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ZU5IN71RqEmHfRQSSCUvnw",
+ "cell_type": "code",
+ "source": [
+ "public const double DefaultPremiumExperienceAdjustmentFactor = 1.0;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "KNUzhe58B0GBnCuZD1ATOg",
+ "cell_type": "markdown",
+ "source": [
+ "# Names"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "hZGPPDopiECnoXlB48cB2Q",
+ "cell_type": "code",
+ "source": [
+ "public const string Main = nameof(Main);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "w5Zs2AGjxkWgRQfAGs8BIA",
+ "cell_type": "code",
+ "source": [
+ "public const string Default = nameof(Default);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "jAyhudwOJkmsPwMaZM1P4g",
+ "cell_type": "code",
+ "source": [
+ "public const string ValueType = nameof(ValueType);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "Aj_qnZxiqUeFHk088tNruA",
+ "cell_type": "markdown",
+ "source": [
+ "GroupCurrency defines the SystemName (from Currency Dimension) to be used as the Group Currency."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "pvlhKSXdW0Wt3dns45SWfQ",
+ "cell_type": "code",
+ "source": [
+ "public const string GroupCurrency = \"CHF\";"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "9SCJFj6zcUK_5Uczpicjjw",
+ "cell_type": "markdown",
+ "source": [
+ "# Import Formats"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "xEDrrk_AxUicpKHTSr6acA",
+ "cell_type": "code",
+ "source": [
+ "public static class ImportFormats{",
+ "\n public const string Cashflow = nameof(Cashflow);",
+ "\n public const string Actual = nameof(Actual);",
+ "\n public const string DataNodeParameter = nameof(DataNodeParameter);",
+ "\n public const string SimpleValue = nameof(SimpleValue);",
+ "\n public const string Opening = nameof(Opening);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "DQHpY4V8xUOGR8L84B7DTg",
+ "cell_type": "markdown",
+ "source": [
+ "# IFRS specific"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "YjgOf6OCyUuxcwR9IhoZvA",
+ "cell_type": "code",
+ "source": [
+ "public static class ValuationApproaches{",
+ "\n public const string BBA = nameof(BBA); //Building Block Approach",
+ "\n public const string VFA = nameof(VFA); //Variable Fee Approach",
+ "\n public const string PAA = nameof(PAA); //Premium Allocation Approach",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "pMhVfzvrjkyXcNpx0Tn4wA",
+ "cell_type": "code",
+ "source": [
+ "public static class LiabilityTypes{",
+ "\n public const string LRC = nameof(LRC); //Liability for Remaining Coverage",
+ "\n public const string LIC = nameof(LIC); //Liability Incurred Claims",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "1eDEjgoZmEOfPbRzZthlTQ",
+ "cell_type": "code",
+ "source": [
+ "public static class CalculationTypes{",
+ "\n public const string BE = nameof(BE); //Best Estimate",
+ "\n public const string CU = nameof(CU); //Coverage Units",
+ "\n public const string RA = nameof(RA); //Risk Adjustment",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "b6cmqzNyQ0q0McHf-Rf5lw",
+ "cell_type": "code",
+ "source": [
+ "public static class EstimateTypes{",
+ "\n public const string BE = nameof(BE); //Best Estimate",
+ "\n public const string RA = nameof(RA); //Risk Adjustment",
+ "\n public const string A = nameof(A); //Actuals",
+ "\n public const string AA = nameof(AA); //Advance Actuals",
+ "\n public const string OA = nameof(OA); //Overdue Actuals",
+ "\n public const string DA = nameof(DA); //Deferrable Actuals",
+ "\n public const string C = nameof(C); //Contractual Service Margin",
+ "\n public const string L = nameof(L); //Loss Component",
+ "\n public const string LR = nameof(LR); //Loss Recovery",
+ "\n public const string F = nameof(F); //factors",
+ "\n public const string FCF = nameof(FCF); //Fulfilment Cash flows",
+ "\n public const string BEPA = nameof(BEPA); //Experience Adjusted BE Premium to Csm",
+ "\n public const string APA = nameof(APA); //Experience Adjusted Written Actual Premium to Csm",
+ "\n public const string AAPA = nameof(AAPA); //Experience Adjusted Advance Actual Premium to Csm",
+ "\n public const string OAPA = nameof(OAPA); //Experience Adjusted Overdue Actual Premium to Csm",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "vCJNvDF6D02HPepD8ay2pA",
+ "cell_type": "code",
+ "source": [
+ "public static class AocTypes{",
+ "\n public const string BOP = nameof(BOP);",
+ "\n public const string MC = nameof(MC);",
+ "\n public const string RCU = nameof(RCU);",
+ "\n public const string CF = nameof(CF);",
+ "\n public const string IA = nameof(IA);",
+ "\n public const string YCU = nameof(YCU);",
+ "\n public const string CRU = nameof(CRU);",
+ "\n public const string WO = nameof(WO);",
+ "\n public const string EV = nameof(EV);",
+ "\n public const string CL = nameof(CL);",
+ "\n public const string EA = nameof(EA);",
+ "\n public const string AM = nameof(AM);",
+ "\n public const string FX = nameof(FX);",
+ "\n public const string EOP = nameof(EOP);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "OE45Je2KUk6WlHo9upd5fA",
+ "cell_type": "code",
+ "source": [
+ "public static class Novelties{",
+ "\n public const string I = nameof(I); //In-Force",
+ "\n public const string N = nameof(N); //New Business",
+ "\n public const string C = nameof(C); //All Novelties Combined",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "BUPmJSTjdkuP8nR7MJyQiw",
+ "cell_type": "code",
+ "source": [
+ "public static class EconomicBases{",
+ "\n public const string L = nameof(L); //Locked Interest Rates",
+ "\n public const string C = nameof(C); //Current Interest Rates",
+ "\n public const string N = nameof(N); //Nominal Interest Rates",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "-cRhXT5tKE-834Umpyaudw",
+ "cell_type": "code",
+ "source": [
+ "public static class AmountTypes{",
+ "\n public const string ACA = nameof(ACA); //Attributable Commissions Acquisition",
+ "\n public const string AEA = nameof(AEA); //Attributable Expenses Acquisition",
+ "\n public const string CDR = nameof(CDR); //Credit Default Risk",
+ "\n public const string CL = nameof(CL); //Claims",
+ "\n public const string PR = nameof(PR); //Premiums",
+ "\n public const string NIC = nameof(NIC); //Claims Non-Investment component",
+ "\n public const string ICO = nameof(ICO); //Claims Investment component",
+ "\n public const string NE = nameof(NE); //Non Attributable Expenses",
+ "\n public const string ACM = nameof(ACM); //Attributable Commissions Maintenance",
+ "\n public const string AEM = nameof(AEM); //Attributable Expenses Maintenance",
+ "\n public const string AC = nameof(AC); //Attributable Commissions",
+ "\n public const string AE = nameof(AE); //Attributable Expenses",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "e33hFwGm9kmVNOsShmvn4w",
+ "cell_type": "markdown",
+ "source": [
+ "# Insurance specific"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "9n2de6iCUEKECrkoUtSuiw",
+ "cell_type": "code",
+ "source": [
+ "public static class LineOfBusinesses{",
+ "\n public const string LI = nameof(LI); //Life",
+ "\n public const string NL = nameof(NL); //Non-Life",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Constants/Enums.ipynb b/Constants/Enums.ipynb
new file mode 100644
index 00000000..5700a892
--- /dev/null
+++ b/Constants/Enums.ipynb
@@ -0,0 +1,269 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "toc-autonumbering": "True",
+ "toc-showcode": "False",
+ "toc-showmarkdowntxt": "False",
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "HUFgBXkmYU6rV0daYBo-nQ",
+ "cell_type": "markdown",
+ "source": [
+ "# Enumerables",
+ "\n",
+ "\nIn the case of data which is not expected to change over time, it is convenient to introduce such data as variables of type \"enumerable\"."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ALWeaAkPh0uiwQ9SYb9Y-w",
+ "cell_type": "markdown",
+ "source": [
+ "## Exchange Rates",
+ "\n",
+ "\nFor exchange rates, we set the type for which the rates apply:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "W6x_0Pa3_kOAd3N9CBgcgQ",
+ "cell_type": "code",
+ "source": [
+ "public enum FxType { Spot, Average }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "r50zPe2AP0KrCOR-fgpccg",
+ "cell_type": "code",
+ "source": [
+ "public enum FxPeriod { NotApplicable, BeginningOfPeriod, Average, EndOfPeriod }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "YCF3tVHQB0eUa0yWpiRD0g",
+ "cell_type": "markdown",
+ "source": [
+ "## Currency Types"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "cF0fRptcGE64Vr1b058rqg",
+ "cell_type": "markdown",
+ "source": [
+ "Currency Types define which currency is used as standard at different aggregation levels (in the Data Level hierarchy).",
+ "\n- Functional: this is the standard Currency Type at Reporting Node level",
+ "\n- Group: this is the standard Currency Type at Group level",
+ "\n- Contractual: this is the standard Currency Type at Data Node level",
+ "\n- Transactional: this is the standard Currency Type at Transactional level (used typically for Actuals)"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "zj07LR0PT0CesH4nRl1Sig",
+ "cell_type": "code",
+ "source": [
+ "public enum CurrencyType { Functional, Group, Contractual, Transactional }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "wL17I9jyQ0eaeXrSdlvJyA",
+ "cell_type": "markdown",
+ "source": [
+ "## Period Type"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "3e3wVNw-rECnTHBTkVOfCQ",
+ "cell_type": "code",
+ "source": [
+ "public enum PeriodType { NotApplicable, BeginningOfPeriod, EndOfPeriod }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "Expd7Urm102om6-y2Skz4w",
+ "cell_type": "markdown",
+ "source": [
+ "## Valuation Period"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "dsJwHWIQPkOB29dEUCLHGg",
+ "cell_type": "code",
+ "source": [
+ "public enum ValuationPeriod { NotApplicable, BeginningOfPeriod, MidOfPeriod, Delta, EndOfPeriod }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "iejG0G0VJ0q_tAg2HGHuOw",
+ "cell_type": "markdown",
+ "source": [
+ "## Portfolio View"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "0Pdzxbnsx0SOaIiUb_X1YQ",
+ "cell_type": "code",
+ "source": [
+ "[Flags] public enum PortfolioView { Gross = 1, Reinsurance = 2, Net = Gross | Reinsurance }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "v7NVqB0p1Ei4vilTCiErFg",
+ "cell_type": "markdown",
+ "source": [
+ "## Structure Type"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "Kge1fD31n0S7BW0EiClT0g",
+ "cell_type": "code",
+ "source": [
+ "public enum StructureType { None, AoC }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "S49a3Gcz_0S7apcSmQy3JA",
+ "cell_type": "markdown",
+ "source": [
+ "## State"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "mJADknA9Q0KQjmTmf03Blw",
+ "cell_type": "markdown",
+ "source": [
+ "State describes the state in which a Data Node can be - There are two types of states:",
+ "\n- Active: visible in reports and queries",
+ "\n- Inactive: not visible in reports and queries"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "lsRYxseYzUaLMcAn7JB2Qw",
+ "cell_type": "code",
+ "source": [
+ "public enum State { Active, Inactive }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "kgMLZfJ4PkCFRU4kLKSGcw",
+ "cell_type": "markdown",
+ "source": [
+ "## Periodicity"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "iV_fcqBE2E6B12CgJq2ybg",
+ "cell_type": "code",
+ "source": [
+ "public enum Periodicity { Monthly, Quarterly, Yearly }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ndV2D2lQL0icIY9VirJweQ",
+ "cell_type": "markdown",
+ "source": [
+ "## Input Source"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "z6t0m-civUGAcBEAW0C3Nw",
+ "cell_type": "code",
+ "source": [
+ "[Flags]",
+ "\npublic enum InputSource {NotApplicable = 0, Opening = 1, Actual = 2, Cashflow = 4} ",
+ "\n//Opening + Actual = 3,",
+ "\n//Opening + Cashflow = 5",
+ "\n//Actual + Cashflow = 6",
+ "\n//Opening + Actual + Cashflow = 7"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "aEqUAtvxPESgt-FHx2e7yA",
+ "cell_type": "markdown",
+ "source": [
+ "## Data Type"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "LR7R7DUA0k6Ywl5WjSrEvg",
+ "cell_type": "code",
+ "source": [
+ "public enum DataType { Optional, Mandatory, Calculated, CalculatedTelescopic }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "euBhm6zy1Uib521-G3w3eQ",
+ "cell_type": "markdown",
+ "source": [
+ "## Import Scope"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "4PP7M-Sv9k6_6MsJWS1bUg",
+ "cell_type": "code",
+ "source": [
+ "public enum ImportScope { Primary, Secondary }"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Constants/Validations.ipynb b/Constants/Validations.ipynb
new file mode 100644
index 00000000..f58110a8
--- /dev/null
+++ b/Constants/Validations.ipynb
@@ -0,0 +1,200 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "toc-autonumbering": "True",
+ "toc-showcode": "False",
+ "toc-showmarkdowntxt": "False",
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "LgEd-jVnbEGK9QI-QWcVQw",
+ "cell_type": "markdown",
+ "source": [
+ " Errors and Warnings
"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "-scbNYag2kmx_38hEmkBgA",
+ "cell_type": "code",
+ "source": [
+ "#!import \"Enums\"",
+ "\n#!import \"Consts\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "8xjDwqEVm0WjJuTlC2QERA",
+ "cell_type": "markdown",
+ "source": [
+ "# Codes"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "9CPbuC0YV0aSt5wA3uOxnw",
+ "cell_type": "code",
+ "source": [
+ "public enum Warning {",
+ "\n // Import",
+ "\n ActiveDataNodeWithCashflowBOPI,",
+ "\n // Default",
+ "\n Generic",
+ "\n}; "
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "QWAQV2xUcEigl3eydHTJaA",
+ "cell_type": "code",
+ "source": [
+ "public enum Error { ",
+ "\n // Import",
+ "\n NoMainTab, IncompleteMainTab, ParsingScientificNotation, ValueTypeNotFound, ValueTypeNotValid, AocTypeNotValid,",
+ "\n // Partition",
+ "\n PartitionNotFound, ParsedPartitionNotFound, PartititionNameNotFound, PartitionTypeNotFound,",
+ "\n // Dimensions",
+ "\n AmountTypeNotFound, EstimateTypeNotFound,CalculationTypeNotFound, ReportingNodeNotFound, AocTypeMapNotFound, AocTypeNotFound, PortfolioGicNotFound, PortfolioGricNotFound, ",
+ "\n InvalidAmountTypeEstimateType, MultipleTechnicalMarginOpening,",
+ "\n // Exchange Rate",
+ "\n ExchangeRateNotFound, ExchangeRateCurrency,",
+ "\n // Data Note State",
+ "\n ChangeDataNodeState, InactiveDataNodeState,",
+ "\n // Parameters",
+ "\n ReinsuranceCoverageDataNode, DuplicateInterDataNode, DuplicateSingleDataNode, InvalidDataNode, ",
+ "\n // Storage",
+ "\n DataNodeNotFound, PartnerNotFound, RatingNotFound, CreditDefaultRateNotFound, MissingPremiumAllocation, ReinsuranceCoverage, ",
+ "\n YieldCurveNotFound, YieldCurvePeriodNotApplicable, EconomicBasisNotFound, AccountingVariableTypeNotFound,",
+ "\n // Scopes",
+ "\n NotSupportedAocStepReference, MultipleEoP,",
+ "\n // Data completeness",
+ "\n MissingDataAtPosting, MissingCombinedLiability, MissingCoverageUnit, ",
+ "\n // Default",
+ "\n Generic",
+ "\n};"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ThPESGETMUm31fuq-qS4_w",
+ "cell_type": "markdown",
+ "source": [
+ "# Messages"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "x3UlljewwEut3M0NRlUDDg",
+ "cell_type": "code",
+ "source": [
+ "public static string Get (Error e, params string[] s) => (e, s.Length) switch ",
+ "\n{",
+ "\n // Import",
+ "\n (Error.NoMainTab , _) => $\"No Main tab in the parsed file.\",",
+ "\n (Error.IncompleteMainTab , _) => $\"Incomplete Main tab in the parsed file.\",",
+ "\n (Error.ParsingScientificNotation , 1) => $\"While parsing found real number in scientific notation: {s[0]}.\",",
+ "\n (Error.ValueTypeNotFound , _) => $\"Value Type not found.\",",
+ "\n (Error.ValueTypeNotValid , 1) => $\"The Value Type {s[0]} is invalid.\",",
+ "\n (Error.AocTypeNotValid , 1) => $\"The parsed AocType {s[0]} is invalid.\",",
+ "\n // Partition",
+ "\n (Error.PartitionNotFound , _) => $\"Partition do not found.\",",
+ "\n (Error.ParsedPartitionNotFound , 1) => $\"Parsed partition not available: ReportingNode {s[0]}.\",",
+ "\n (Error.ParsedPartitionNotFound , 4) => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",",
+ "\n (Error.PartitionTypeNotFound , 1) => $\"Partition type not found: {s[0]}.\",",
+ "\n // Dimensions",
+ "\n (Error.AmountTypeNotFound , 1) => $\"AmountType {s[0]} not found.\",",
+ "\n (Error.EstimateTypeNotFound , 1) => $\"EstimateType {s[0]} not found.\",",
+ "\n (Error.CalculationTypeNotFound , 1) => $\"CalculationType {s[0]} not found.\",",
+ "\n (Error.ReportingNodeNotFound , 1) => $\"Reporting Node {s[0]} not found.\",",
+ "\n (Error.AocTypeNotFound , 1) => $\"AocType {s[0]} not found.\",",
+ "\n (Error.AocTypeMapNotFound , 2) => $\"AocType {s[0]} and Novelty {s[1]} combination not defined in the mapping.\",",
+ "\n (Error.PortfolioGicNotFound , 2) => $\"Portfolio {s[0]} assigned to Group of Insurance Contract {s[1]} does not exist.\",",
+ "\n (Error.PortfolioGricNotFound , 2) => $\"Portfolio {s[0]} assigned to Group of Reinsurance Contract {s[1]} does not exist.\",",
+ "\n (Error.InvalidAmountTypeEstimateType , 2) => $\"Invalid combination of EstimateType {s[0]} and AmountType {s[1]}.\",",
+ "\n (Error.MultipleTechnicalMarginOpening , 1) => $\"Multiple opening for techincal margin are not allowed for DataNode {s[0]}.\",",
+ "\n // Exchange Rate",
+ "\n (Error.ExchangeRateNotFound , 2) => $\"Exchange Rate for {s[0]} {s[1]} is not present.\",",
+ "\n (Error.ExchangeRateCurrency , 1) => $\"{s[0]} does not have any Exchange Rate defined.\", ",
+ "\n // Data Node State",
+ "\n (Error.ChangeDataNodeState , 0) => $\"Data Node State can not change from Inactive state into Active state.\",",
+ "\n (Error.ChangeDataNodeState , 1) => $\"Data Node State for {s[0]} can not change from Inactive state into Active state.\",",
+ "\n (Error.ChangeDataNodeState , 3) => $\"Data Node State for {s[0]} can not change from {s[1]} state into {s[2]} state.\",",
+ "\n (Error.InactiveDataNodeState , 1) => $\"Data imported for inactive Data Node {s[0]}.\",",
+ "\n //Parameters",
+ "\n (Error.ReinsuranceCoverageDataNode , 2) => $\"Invalid Reinsurance Coverage parameter does not link a GroupOfReinsuranceContract to a GroupOfInsuranceContract. Provided GroupOfContracts are: {s[0]}, {s[1]}.\",",
+ "\n (Error.DuplicateInterDataNode , 2) => $\"Duplicated Inter-DataNode parameter for {s[0]}-{s[1]} is found.\",",
+ "\n (Error.DuplicateSingleDataNode , 1) => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",",
+ "\n (Error.InvalidDataNode , 1) => $\"Data imported for invalid Data Node {s[0]}.\",",
+ "\n // Storage",
+ "\n (Error.DataNodeNotFound , 1) => $\"DataNode {s[0]} not found.\",",
+ "\n (Error.PartnerNotFound , 1) => $\"Partner not found for DataNode {s[0]}.\",",
+ "\n (Error.RatingNotFound , 1) => $\"Rating not found for Partner {s[0]}.\",",
+ "\n (Error.CreditDefaultRateNotFound , 1) => $\"Credit Default Rate not found for rating {s[0]}.\",",
+ "\n (Error.MissingPremiumAllocation , 1) => $\"Premium Allocation Rate not found for Group of Contract {s[0]}.\", // TODO: this is now a warning to be produced by a validation in the importers (default is 1)",
+ "\n (Error.ReinsuranceCoverage , 1) => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",",
+ "\n (Error.YieldCurveNotFound , 3) => $\"Yield Curve not found for currency {s[0]}, year {s[1]}, and month {s[2]}.\",",
+ "\n (Error.YieldCurvePeriodNotApplicable , 2) => $\"YieldCurve period NotApplicable not valid for AocStep with AocType {s[0]} and Novelty {s[1]}.\",",
+ "\n (Error.EconomicBasisNotFound , 1) => $\"EconomicBasis not valid for DataNode {s[0]}.\",",
+ "\n (Error.AccountingVariableTypeNotFound , 1) => $\"AccountingVariableType {s[0]} not found.\",",
+ "\n // Scopes",
+ "\n (Error.NotSupportedAocStepReference , 1) => $\"Unsupported reference Aoc Step for Aoc Type {s[0]}.\",",
+ "\n (Error.MultipleEoP , 0) => $\"Closing Balance for both Csm and Lc are computed.\",",
+ "\n // Data Completeness",
+ "\n (Error.MissingDataAtPosting , 1) => $\"Missing imported data for {s[0]} DataNode.\",",
+ "\n (Error.MissingCombinedLiability , 2) => $\"Missing Combined Liability Aoc Type for DataNode {s[0]} and AmountType {s[1]}.\",",
+ "\n (Error.MissingCoverageUnit , 1) => $\"Missing Coverage Unit cash flow for {s[0]} DataNode.\",",
+ "\n // Default",
+ "\n (Error.Generic , _) => $\"{s[0]}\",",
+ "\n (_ , _) => $\"Error not found.\"",
+ "\n};"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "PnguuqruSkaTERChlORdKw",
+ "cell_type": "code",
+ "source": [
+ "public static string Get (Warning w, params string[] s) => (w, s.Length) switch {",
+ "\n // Import",
+ "\n (Warning.ActiveDataNodeWithCashflowBOPI , _) => $\"Cashflows for active DataNode has been parsed with AocType {AocTypes.BOP} and Novelty {Novelties.I} \",",
+ "\n // Default",
+ "\n (Warning.Generic , _) => $\"{s[0]}\",",
+ "\n (_ , _) => $\"Warning not found.\"",
+ "\n};"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "COxOqdqYwUqx0ozqRQof0w",
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/DataModel/DataStructure.ipynb b/DataModel/DataStructure.ipynb
new file mode 100644
index 00000000..1e65f8b1
--- /dev/null
+++ b/DataModel/DataStructure.ipynb
@@ -0,0 +1,2139 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "toc-autonumbering": "True",
+ "toc-showcode": "False",
+ "toc-showmarkdowntxt": "False",
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "E3XGdKdQXkSFZwQ0OR8f9Q",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n Data Model
",
+ "\n",
+ "\nThis notebook has the main structures used to hold data - This is usually called the **data model**."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "wIRyXTP_f0aojedzQ_2yaw",
+ "cell_type": "markdown",
+ "source": [
+ "# References",
+ "\nThis section initializes libraries and code from other notebooks, which will be used here, as well as information needed for querying data from the database."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "_ldA06bDKEyrEr1rDJpRng",
+ "cell_type": "markdown",
+ "source": [
+ "## Libraries"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "iVjxSwqCvkCRk9OnawoClw",
+ "cell_type": "code",
+ "source": [
+ "#r \"nuget:Systemorph.Workspace,1.2.0\"",
+ "\n#r \"nuget:Systemorph.Scopes,1.2.4\"",
+ "\n#r \"nuget:Systemorph.Import,1.3.0\"",
+ "\n#r \"nuget:Systemorph.Test,1.2.4\"",
+ "\n#r \"nuget:Systemorph.Export,1.3.0\"",
+ "\n#r \"nuget:Systemorph.DataSetReader,1.3.0\"",
+ "\n#r \"nuget:Systemorph.DataSource,1.2.0\"",
+ "\n#r \"nuget:Systemorph.DataSource.Conversions,1.2.0\"",
+ "\n#r \"nuget:Systemorph.Reporting,1.2.4\"",
+ "\n#r \"nuget:Systemorph.DomainDesigner,1.3.0\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "tVqfp6kjPEWcWTsE7nmIJQ",
+ "cell_type": "markdown",
+ "source": [
+ "## Usings"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "H4cEfQ5jnE-pcrbgue7FNA",
+ "cell_type": "code",
+ "source": [
+ "using System.ComponentModel.DataAnnotations;",
+ "\nusing System.ComponentModel.DataAnnotations.Schema;",
+ "\nusing Systemorph.Vertex.Grid.Model;",
+ "\nusing static Systemorph.Vertex.Arithmetics.ArithmeticOperations;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "r7mAcZwhpEOp8xf82HvdyQ",
+ "cell_type": "markdown",
+ "source": [
+ "## Notebooks"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "wkcyVZzJ5kqKCJm_siKkNQ",
+ "cell_type": "code",
+ "source": [
+ "#!import \"../Constants/Enums\"",
+ "\n#!import \"../Constants/Consts\"",
+ "\n#!import \"../Constants/Validations\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "HTeT_yYbpUCPrWtjwe9fdQ",
+ "cell_type": "markdown",
+ "source": [
+ "# Data Infrastructure"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "HrfAYsLiM0SFRqKe6IIlxA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Base Interfaces",
+ "\nThe following interfaces are used to define the granularity at which data is stored.",
+ "\n",
+ "\nFor instance, the IKeyed interface corresponds to the lowest granularity which is simply a unique identifier for a certain generic piece of data:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "-JHURlI5Z0mY6_UxQ7gfGA",
+ "cell_type": "code",
+ "source": [
+ "public interface IKeyed",
+ "\n{ ",
+ "\n public Guid Id { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "TLXXKZET0E-dDwCIcdZXBg",
+ "cell_type": "markdown",
+ "source": [
+ "The interface IPartition identifies the partitions in the system."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "A-Onlfa3vkqOVvHu6-JMQg",
+ "cell_type": "code",
+ "source": [
+ "public interface IPartition : IKeyed {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "iF7QiEQqBE2pxD1M85J2Sw",
+ "cell_type": "markdown",
+ "source": [
+ "The interface IPartitioned simply assigns a unique identifier for elements of a data partition - The exact definition of such elements can be found in the [partition](#partition) section below."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "UI71Ps6BF0K27AoG-9UkDw",
+ "cell_type": "code",
+ "source": [
+ "public interface IPartitioned",
+ "\n{",
+ "\n public Guid Partition { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "mwvvs9R7IE6s7-QzaQ44Iw",
+ "cell_type": "markdown",
+ "source": [
+ "The interface IHierarchy is used for modelling dimensions which have an hierarchical structure, such as [Amount Type](#amount-type)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "udn_BFvLkE-kpOBDTNrOzg",
+ "cell_type": "code",
+ "source": [
+ "public interface IHierarchy",
+ "\n{",
+ "\n [Display(Order = 10)]",
+ "\n public string Name { get; init; }",
+ "\n ",
+ "\n [Display(Order = 20)]",
+ "\n public string Parent { get; init; }",
+ "\n ",
+ "\n [Display(Order = 30)]",
+ "\n public string Child { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "qlvXHTn5VUmrP2f97WrtTw",
+ "cell_type": "markdown",
+ "source": [
+ "The interface IWithYearAndMonth allows to speficy to which year and month a certain piece of data applies to:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "jD1t0fnTnUGMALFqTwsLHA",
+ "cell_type": "code",
+ "source": [
+ "public interface IWithYearAndMonth",
+ "\n{",
+ "\n public int Year { get; init; }",
+ "\n ",
+ "\n public int Month { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "WbhV6bUsy0ukIAm920fzwg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Abstract Classes",
+ "\nThese classes are not reflected in the database, i.e. are not persisted."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "EVd9ytkY40OTYvjWp5aziA",
+ "cell_type": "code",
+ "source": [
+ "public abstract record KeyedRecord : IKeyed {",
+ "\n [Key]",
+ "\n [NotVisible] ",
+ "\n public Guid Id { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "h-P8iuN2zUqCz2F1HgnXjQ",
+ "cell_type": "code",
+ "source": [
+ "public abstract record KeyedDimension : INamed {",
+ "\n [Key]",
+ "\n [IdentityProperty]",
+ "\n [StringLength(16)]",
+ "\n [Display(Order = 1)]",
+ "\n public string SystemName { get; init; }",
+ "\n ",
+ "\n [Display(Order = 2)]",
+ "\n [NotVisible]",
+ "\n public string DisplayName { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "q1r9nxY4cEudsXAFS_0LOA",
+ "cell_type": "code",
+ "source": [
+ "public abstract record KeyedOrderedDimension : KeyedDimension, IOrdered {",
+ "\n [NotVisible]",
+ "\n public int Order { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "V0ZEujrm8EeHPz95bLGLOA",
+ "cell_type": "code",
+ "source": [
+ "public abstract record KeyedOrderedDimensionWithExternalId : KeyedOrderedDimension {",
+ "\n [Display(Order = 100)]",
+ "\n [Conversion(typeof(JsonConverter))]",
+ "\n public string[] ExternalId { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "1ZMlcc50Q0yVI7dZBvBCyQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n# Dimensions",
+ "\n",
+ "\nDimensions are data which tipically can be given a short name, here called 'System Name'. They also change slowly with time. A typical example is currencies, and examples of System Names are EUR, CHF, etc.",
+ "\n",
+ "\nThe advantages of using Dimensions are:",
+ "\n- The data is easier to maintain (the data is said to be 'normalized');",
+ "\n- The business logic is easier to read;",
+ "\n- Easier scructuring of the data, e.g. in a data-cube."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "Nh9SUewfGEisAbZfcpYfPA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Hierarchical Dimension With Level",
+ "\nHierarchical dimensions are useful to define for example the legal structure of a company (reporting nodes and their parents).",
+ "\n",
+ "\nBelow we introduce the concept of a hierarchical dimension with level, which is a simple way to keep track of the \"level\" in a hierarchical dimension."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "4JGV542yw0KkgF5wA8Xc-A",
+ "cell_type": "code",
+ "source": [
+ "//TODO: Should this be abstract or have a reference to the type?",
+ "\npublic record HierarchicalDimensionWithLevel(string SystemName, string DisplayName, string Parent, int Level) : IHierarchicalDimension;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "3mdUv9EKwUaRHVRzBFxSNw",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Amount Type"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "oD4Rl6GEpEqnLIn_CUdivg",
+ "cell_type": "markdown",
+ "source": [
+ "Amount Type is a dimension used to describe the nature of numbers. For example: Numbers associated to the payment of premiums have Amount Type 'Premiums'; Numbers associated to the payment of claims have Amount Type 'Claims'; Numbers associated to expenses have Amount Type 'Expenses'. ",
+ "\n",
+ "\nIt is defined as a hierarchical dimension so that higher-granularity types can be introduced. For example: 'Claim Expenses' have parent 'Claims'.",
+ "\n",
+ "\nAmount Types are a central piece in the IFRS 17 application and are used for instance to name the different types of cashflows. For example: There might be cashflows for 'Premiums'; Cashflows for 'Claims', etc. In case the mapping between cash flow and amount type is non-trivial, then specific mappings are introduced through the use of ExternalId."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ffEXk8fDRUSuFc1EOOWVXA",
+ "cell_type": "code",
+ "source": [
+ "public record AmountType : KeyedOrderedDimensionWithExternalId, IHierarchicalDimension",
+ "\n{",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(AmountType))]",
+ "\n public string Parent { get; init; }",
+ "\n ",
+ "\n [Display(Order = 20)]",
+ "\n [Dimension(typeof(PeriodType))]",
+ "\n public PeriodType PeriodType { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "xY7Lv0cnPk2ZqR7zMUKVAQ",
+ "cell_type": "markdown",
+ "source": [
+ "We distinguish between amount types used for cashflows and actuals (**Present Value Amount Types**), and amount types used for deferrable values (**Deferrable Amount Types**). In particular, deferrable amount types are for costs and expenses that can be deferred to the future. These amounts are treated separately from the Present Value Amount Types because they are not considered for the calculation of Contractual Service Margin and Loss Component."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "u1zwrsAl_06VNVKVjqY52g",
+ "cell_type": "code",
+ "source": [
+ "public record PvAmountType : AmountType {} //TODO Rename ",
+ "\n",
+ "\npublic record DeferrableAmountType : AmountType {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "uCEMSSPR00Oh87NXjPpxaQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Calculation Type",
+ "\nThis dimension is used to distinguish between e.g. **Best Estimate** values and **Risk Adjustment** values:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ZNlHEPmkHky4j1HvhgN88A",
+ "cell_type": "code",
+ "source": [
+ "public record CalculationType : KeyedOrderedDimension {",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(PeriodType))]",
+ "\n public PeriodType PeriodType { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "vKJfcG-udU2bWMy_nL8WSQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Risk Driver",
+ "\n",
+ "\nRisk drivers are used to distinguish between the different Risk Adjustment numbers. For instance: Mortality, Disability, Longevity, etc.",
+ "\n",
+ "\nWhen only total risk adjustment values are used, then there is no need to use risk drivers."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "fa88nNjOdk6ESB_dqpM35w",
+ "cell_type": "code",
+ "source": [
+ "public record RiskDriver : KeyedOrderedDimension, IHierarchicalDimension",
+ "\n{",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(RiskDriver))]",
+ "\n public string Parent { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "VkCT-HB9TkyWJJyAcX42QQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Estimate Type",
+ "\n",
+ "\nEstimate Type is a dimension used to distinguish the context to which numbers belong to. For instance: Numbers for present values have Estimate Type 'Present Value'; Numbers for Risk Adjustments have Estimate Type 'Risk Adjustment'."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "PGODf3XfjEOJ2CfpWJNxvw",
+ "cell_type": "code",
+ "source": [
+ "public record EstimateType : KeyedOrderedDimensionWithExternalId",
+ "\n{",
+ "\n [Display(Order = 110)]",
+ "\n public InputSource InputSource { get; init; }",
+ "\n ",
+ "\n [Display(Order = 120)]",
+ "\n public StructureType StructureType { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "bo_ARw7-YEWDtJJsK8ODmA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Novelty",
+ "\n",
+ "\nNovelty is a [dimension](#dimensions) used to identity the novelty of the business. Typical examples of Novelty are New Busines, In-Force, and Combined."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "mV4OXu-r_0e7k1vZthQ1IQ",
+ "cell_type": "code",
+ "source": [
+ "public record Novelty : KeyedOrderedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "O-7_tXaPPEOL_eRj1Ev76g",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Variable Type"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "jFh4gN-zTEyK_KZ55DhlEw",
+ "cell_type": "code",
+ "source": [
+ "public record VariableType : KeyedOrderedDimension, IHierarchicalDimension",
+ "\n{ ",
+ "\n [Display(Order = 10)]",
+ "\n public string Parent { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "RJcV2vGuokmqX1cLgr8tcw",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### AoC Variable Type",
+ "\n",
+ "\nThe AocType describes the type of the Analysis of Change step - For example: Amortization, Cashflow, Combined Liabilities etc.",
+ "\n",
+ "\nThe **Combined Liability** AocType aims in capturing the difference between the sum of all relevant previous Aoc steps and the end of period Aoc step. Unexplained changes (not captured by any other defined AoC step), are then visible in this Aoc step. Note that the nominal cash flows input in the cashflow input file corresponds to cash flow projection for the end of period step.",
+ "\nIn addition, this step distinguishes itself from the others for:",
+ "\n- It is a mandatory AocType as it is used to trigger the Run off of the cashflow. This is achieved by providing a cash flow of 0s. ",
+ "\n- It is the first AocType for the Combined Novelty and therefore it carries the contribution of combining In force and New business.",
+ "\n- Its present value is computed as telescoping difference with the last AoC Step for the In-Force novelty and the New Business novelty.",
+ "\n- In the technical margin calculation it is used to merge the profitability of the In-Force and New business components, which may result in a forced switch."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "uXawxEZ9akakX3cBhzIvkw",
+ "cell_type": "code",
+ "source": [
+ "public record AocType : VariableType",
+ "\n{ ",
+ "\n [Display(Order = 30)]",
+ "\n [Dimension(typeof(AocType))]",
+ "\n public string Parent { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "wURsJ4y22UClSsa-dgRVKg",
+ "cell_type": "code",
+ "source": [
+ "public record AocStep(string AocType, string Novelty){}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "9FQQEf3waUyPGTjoJ3kPvA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### PnL Variable Type",
+ "\n",
+ "\nThe PnlVariableType is used to describe the various profit and loss sections and the corresponding hierarchy."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "yXjDtNxmtUKCm7l4rInNRw",
+ "cell_type": "code",
+ "source": [
+ "public record PnlVariableType : VariableType {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "6TMaVeubb0yfDj0zHl3dNQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Balance Sheet Variable Type",
+ "\n",
+ "\nThe BsVariableType is used to descibe the Anlysis of change of the Balance Sheet reports."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "kmnM353ouUSOXqQD4IcV7Q",
+ "cell_type": "code",
+ "source": [
+ "public record BsVariableType : VariableType {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "WglnqvLArU6Ahc29yVDgSQ",
+ "cell_type": "markdown",
+ "source": [
+ "## Accounting Variable Type",
+ "\nThe AccountingVariableType is used to describe the accounting events that are posted in the accounting output file."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "tqFR7uu7BkOnFUvISdLF1A",
+ "cell_type": "code",
+ "source": [
+ "public record AccountingVariableType : VariableType {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "gQILcufhBU6Gh3ZoHDRIYA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Scenario",
+ "\nThe Scenario record holds the various scenarios for which calculations should also be performed."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "WKR88bI5G0qwjmpDyGZTsw",
+ "cell_type": "code",
+ "source": [
+ "public record Scenario : KeyedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "c-cppckU8UeROzwpBdL44A",
+ "cell_type": "markdown",
+ "source": [
+ " The 'neutral' Scenario (i.e. the default one, with no-stress situations applied) is designated as 'Best Estimate'."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ysCBY_ONbUmbRFL_KEXoXg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Line Of Business"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "XPrjV3N-LE-TKVM80pV5yQ",
+ "cell_type": "markdown",
+ "source": [
+ "Line Of Business is a dimension used to identity insurance business according to usual business classifications (usually a market or company-specific business classification representing a convolution of risk covered, 1st party / 3rd party cover type, product type, etc...)",
+ "\nTypical examples of Line of Business are Motor, Property, Endowment, etc... This is a hierarchical dimension."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "VxLXh8klyEi6UhXPn1ZKKw",
+ "cell_type": "code",
+ "source": [
+ "public record LineOfBusiness : KeyedOrderedDimension, IHierarchicalDimension",
+ "\n{",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(LineOfBusiness))]",
+ "\n public string Parent { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "pnCYzQI05UWCUkXGHAB9QA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Currency"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "PZEeN2QhsEGXT0BQ4Rjlag",
+ "cell_type": "markdown",
+ "source": [
+ "Currency is a dimension used to identity the currency.",
+ "\nTypical examples of Currency are EUR, CHF, USD, etc..."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "TUEcu5Y_ZE6Nv_pUG-_COQ",
+ "cell_type": "code",
+ "source": [
+ "public record Currency : KeyedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "TUfMA1ybakuqVJ73ERA3ZQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Economic Basis",
+ "\n",
+ "\nThe Economic Basis defines the discount type which is used in calculations. Examples are: Nominal, Current and Locked."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "rt_ieWyHpU29K0fpiBXLcQ",
+ "cell_type": "code",
+ "source": [
+ "public record EconomicBasis : KeyedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "CJjymwgpJEiBZhPYBoZV-w",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Valuation Approach",
+ "\nThis dimension holds the various methodologies used in the calculations: BBA, VFA and PAA."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "oPjqx6DSTkyk2Pi5v9Bgww",
+ "cell_type": "code",
+ "source": [
+ "public record ValuationApproach : KeyedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "v5-cD3t8RkaWxWs7t5oTxg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Liability Type",
+ "\nThe Liability Type distinguishes betweeen e.g. liabilities for incurred claims and liabilities for remaining coverage."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "zZBD3LVJqUSlsfat1_eEDw",
+ "cell_type": "code",
+ "source": [
+ "public record LiabilityType : KeyedDimension, IHierarchicalDimension",
+ "\n{",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(LiabilityType))]",
+ "\n public string Parent { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "JkEN-M0lnUaJ5FsC0QM6JQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## OCI Type",
+ "\nOther Comprehensive Income (OCI) Type describes how the financial contributions to the IFRS17 Financial Performance is apportioned between the P&L and the OCI sections."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "pAjz1mAaPUGhHNTdyP54gw",
+ "cell_type": "code",
+ "source": [
+ "public record OciType : KeyedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ZvvcNAbtHki9DK9rkMj5PQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Profitability"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "SpHNgrkn70WBckuZf-9rtA",
+ "cell_type": "markdown",
+ "source": [
+ "Profitability is a dimension used in IFRS 17 to describe the profitability of a Group of Contracts (GIC/GRIC).",
+ "\nTypical examples of Profitability are Profitable, Non-Profitable, etc.."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "rJS1Lqw9gUyBmW8LzFRIAw",
+ "cell_type": "code",
+ "source": [
+ "public record Profitability : KeyedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "5nzILMYUw06HnJmXUyLYgg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Partner",
+ "\nPartner is the counterparty of a reinsurance contract."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "_vf2ckZDHkiTBUqDESRY7A",
+ "cell_type": "code",
+ "source": [
+ "public record Partner : KeyedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "K48oHe7Yw0GIy27KBHbDtQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Credit Risk Rating",
+ "\nThis holds the credit risk rating of each Partner."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "faZdNRqxWkqUXYnGZQNNLQ",
+ "cell_type": "code",
+ "source": [
+ "public record CreditRiskRating : KeyedDimension {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "LrcDCmrTYkiEFks8X5d5qQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Reporting Node",
+ "\nA Reporting Node is an element in the reporting structure of the company. It has a hierarchical structure and the end nodes is the level at which data is imported."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "yfIk7Ocnc0SkfFXciN5yfQ",
+ "cell_type": "code",
+ "source": [
+ "public record ReportingNode : KeyedDimension, IHierarchicalDimension ",
+ "\n{",
+ "\n [Display(Order = 20)]",
+ "\n [Dimension(typeof(ReportingNode))]",
+ "\n public string Parent { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [Display(Order = 40)]",
+ "\n [Dimension(typeof(Currency))]",
+ "\n public virtual string Currency { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "dgSDvMwORkWAHKNhcKsOsQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Projection Configuration"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "SXiQr9uXpEOar1SWj1NbHQ",
+ "cell_type": "markdown",
+ "source": [
+ "Projections are configured by defining the following 2 parameters:",
+ "\n",
+ "\n- Shift defines how many months are in the cashflow file before the first value of the period in interest.
",
+ "\n- TimeStep defines how many months are in the period of interest.
",
+ "\n",
+ "\nBoth Shift and TimeStep are measured in terms of number of months.",
+ "\nFor instance, for the current year and year-to-date view we have $\\rm{Shift}=0$ and $TimeStep=3$ for the first quarter, $TimeStep=6$ for the 2nd quarter and so on."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "5roF1i3RCkuAb120D2hlCw",
+ "cell_type": "code",
+ "source": [
+ "public record ProjectionConfiguration : KeyedDimension",
+ "\n{",
+ "\n [IdentityProperty]",
+ "\n public int Shift { get; init; }",
+ "\n [IdentityProperty]",
+ "\n public int TimeStep { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "0BJMDgWcZ0-7DaVBFvhhrg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n# Parameters"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "lZdeQUGmGUmVPRibX3A4mQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Aoc Step Configuration"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "NRbkQdbBAkSeX6wwNvqeLg",
+ "cell_type": "markdown",
+ "source": [
+ "The record below holds parameters over time for each combination of AocType and Novelty. In particular:",
+ "\n- DataType identifies between Calculated aoc steps and Optional inputs or Mandatory inputs.",
+ "\n- InputSource identifies whether an aoc step is relevant for Actuals, Cashflow or both calculations.",
+ "\n- FxPeriod identifies which fx rate should be used.",
+ "\n- YcPeriod identifies which Yield Curve should be used (from current or previous period).",
+ "\n- CdrPeriod identifies which Credit Default Rate should be used (from current or previous period).",
+ "\n- ValuationPeriod identifies which value from the Cashflow corresponds to the Present Value.",
+ "\n- RcPeriod identifies which Reinsurance Coverage should be used (from current or previous period).",
+ "\n",
+ "\n
The values for each parameter can be found in [Enums Notebook](./Constants/Enums)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "fSKSGQxYvEWCjRwEU8Zp8A",
+ "cell_type": "code",
+ "source": [
+ "public record AocConfiguration : KeyedRecord, IWithYearAndMonth, IOrdered",
+ "\n{",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Year))]",
+ "\n [Range(1900, 2100, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 10)]",
+ "\n public int Year { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Month))]",
+ "\n [Range(1, 12, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 20)]",
+ "\n public int Month { get; init; }",
+ "\n ",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 30)]",
+ "\n [Dimension(typeof(AocType))]",
+ "\n public string AocType { get; init; }",
+ "\n ",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 40)]",
+ "\n [Dimension(typeof(Novelty))]",
+ "\n public string Novelty { get; init; }",
+ "\n ",
+ "\n [Display(Order = 50)]",
+ "\n [Dimension(typeof(DataType))]",
+ "\n public DataType DataType { get; init; }",
+ "\n ",
+ "\n [Display(Order = 55)]",
+ "\n [Dimension(typeof(InputSource))]",
+ "\n public InputSource InputSource { get; init; }",
+ "\n ",
+ "\n [Display(Order = 60)]",
+ "\n [Dimension(typeof(FxPeriod))]",
+ "\n public FxPeriod FxPeriod { get; init; }",
+ "\n ",
+ "\n [Display(Order = 70)]",
+ "\n [Dimension(typeof(PeriodType), nameof(YcPeriod))]",
+ "\n public PeriodType YcPeriod { get; init; }",
+ "\n ",
+ "\n [Display(Order = 80)]",
+ "\n [Dimension(typeof(PeriodType), nameof(CdrPeriod))]",
+ "\n public PeriodType CdrPeriod { get; init; }",
+ "\n ",
+ "\n [Display(Order = 90)]",
+ "\n [Dimension(typeof(ValuationPeriod))]",
+ "\n public ValuationPeriod ValuationPeriod { get; init; }",
+ "\n ",
+ "\n [Display(Order = 100)]",
+ "\n [Dimension(typeof(PeriodType), nameof(RcPeriod))]",
+ "\n public PeriodType RcPeriod { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n public int Order { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "9EDmAQK2o0CtkSqxrxadaw",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Exchange Rate",
+ "\nThe record below holds the Exchange Rates over time and for each exchange type ([FxType](./Constants/Enums)). Exchange Rate must be updated every reporting period as part of the close preparation. In general, the last month of the reporting period should be use to import the new data for the period. ",
+ "\n",
+ "\nIn case the Exchange Rate for the current period is missing, an error is returned. "
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "0UriZBf9PkWxz4YC-Zj6jQ",
+ "cell_type": "code",
+ "source": [
+ "public record ExchangeRate : KeyedRecord",
+ "\n{ ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(Currency))]",
+ "\n public string Currency { get; init; }",
+ "\n",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Year))]",
+ "\n [Range(1900, 2100, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 20)]",
+ "\n public int Year { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Month))]",
+ "\n [Range(1, 12, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 30)]",
+ "\n public int Month { get; init; }",
+ "\n",
+ "\n [IdentityProperty]",
+ "\n [Required]",
+ "\n [Display(Order = 40)]",
+ "\n public FxType FxType { get; init; }",
+ "\n",
+ "\n [Display(Order = 50)]",
+ "\n public double FxToGroupCurrency { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "DqeuCXH1bkmJd_iD726ypg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Credit Default Rate",
+ "\nThe record below holds the Credit Default Rates over time for each [Credit Risk Rating](#credit-risk-rating). Credit Default Rate can be updated every month as part of the close preparation. In general, the last month of the reporting period should be use to import the new data for the period. ",
+ "\n",
+ "\nThe Credit Default Rate values must be entered with monthly granularity, i.e. every value corresponds to the default rate for a certain month. The first month entered in column Values0 always corresponds to January of the year entered in column Year. The last value is considered valid also for the following years (for which no value has been provided). ",
+ "\n",
+ "\nThe latest Credit Default Rate available in the system with Year and Month earlier or equal to Year and Month of the closing period will be used as the current value during calculation."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "dGtfTrO3iUaqdptZ0yybYw",
+ "cell_type": "code",
+ "source": [
+ "public record CreditDefaultRate : KeyedRecord, IWithYearAndMonth",
+ "\n{ ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(CreditRiskRating))]",
+ "\n public string CreditRiskRating { get; init; }",
+ "\n",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Year))]",
+ "\n [Range(1900, 2100, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 20)]",
+ "\n public int Year { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Month))]",
+ "\n [Range(1, 12, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 30)]",
+ "\n public int Month { get; init; }",
+ "\n ",
+ "\n [Conversion(typeof(PrimitiveArrayConverter))]",
+ "\n [Display(Order = 40)]",
+ "\n public double[] Values { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "9_ycC9yzPkG8EqR3gTj3PA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Yield Curve",
+ "\nThe record below holds the Yield Curves across time for each [Currency](#currency) and [Scenario](#scenario).",
+ "\nYield curves can be updated every month as part of the close preparation. In general, the last month of the reporting period should be use to import the new data for the period. ",
+ "\n",
+ "\nThe Yield Curve values must be entered with **yearly** granularity, i.e. every value corresponds to the rate of the whole year starting from the year entered in column Year. The last value is considered valid also for the following years (for which no value has been provided). ",
+ "\n",
+ "\nWhen the current Yield Curve must be used in the calculation, the latest Yield Curve available in the system with Year and Month earlier or equal to Year and Month of the closing period will be used."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "3TbdMYHKKk2Wan-Egtuetg",
+ "cell_type": "code",
+ "source": [
+ "public record YieldCurve : KeyedRecord, IWithYearAndMonth",
+ "\n{ ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(Currency))]",
+ "\n public string Currency { get; init; }",
+ "\n",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Year))]",
+ "\n [Range(1900, 2100, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 20)]",
+ "\n public int Year { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Month))]",
+ "\n [Range(1, 12, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 30)]",
+ "\n public int Month { get; init; }",
+ "\n",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 35)]",
+ "\n public string Scenario { get; init; }",
+ "\n",
+ "\n [Conversion(typeof(PrimitiveArrayConverter))]",
+ "\n [Display(Order = 40)]",
+ "\n public double[] Values { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "kR4nqN3MwkqRBS8Yeb4bOA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Partner Rating",
+ "\nThe record below holds the [Credit Risk Rating](#credit-risk-partner) for each [Partner](#partner) across time. Partner Rating can be updated every month as part of the close preparation. In general, the last month of the reporting period should be use to import the new data for the period. "
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "-yzxBGiz7U62zp3niNtqEA",
+ "cell_type": "code",
+ "source": [
+ "public record PartnerRating : KeyedRecord, IWithYearAndMonth",
+ "\n{ ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(Partner))]",
+ "\n public string Partner { get; init; }",
+ "\n",
+ "\n [Required]",
+ "\n [Display(Order = 20)]",
+ "\n [Dimension(typeof(CreditRiskRating))]",
+ "\n public string CreditRiskRating { get; init; }",
+ "\n",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Year))]",
+ "\n [Range(1900, 2100, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 30)]",
+ "\n public int Year { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Month))]",
+ "\n [Range(1, 12, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 40)]",
+ "\n public int Month { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "4bFzr4BUxECkAZN1KK83Kg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n# Partitions",
+ "\nThe notion of Partition is used to define small but meaningful sets of data, called partitions. Partitions are then used to optimize the extraction of data from the database, i.e. only the data for a certain partition is retrieved."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "lfo6j69S00S5MmeGEgWhWA",
+ "cell_type": "code",
+ "source": [
+ "public abstract record IfrsPartition : IPartition {",
+ "\n [Key]",
+ "\n [PartitionId]",
+ "\n public Guid Id { get; init; }",
+ "\n",
+ "\n [Required]",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(ReportingNode))]",
+ "\n [IdentityProperty]",
+ "\n public string ReportingNode { get; init; }",
+ "\n",
+ "\n [Display(Order = 50)]",
+ "\n [Dimension(typeof(Scenario))]",
+ "\n [IdentityProperty]",
+ "\n public string Scenario { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "Oy6PSvNeAkOrHXzbWi144g",
+ "cell_type": "markdown",
+ "source": [
+ "For instance, the data pertaining to a certain [Reporting Node](#reporting-node) for a certain [Scenario](#scenario) is called an IfrsPartition and assigned a unique identifier:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "YQl5TqjBQUui3Ao3FsgiUw",
+ "cell_type": "code",
+ "source": [
+ "public record PartitionByReportingNode : IfrsPartition {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "M8p4dGJQHkC7dFwqXU4RXQ",
+ "cell_type": "markdown",
+ "source": [
+ "The partition PartitionByReportingNodeAndPeriod is a further partition of the IfrsPartition sets - In particular, it defines sets for the data pertaining to a certain [Reporting Node](#reporting-node), [Scenario](#scenario), year and month. The value of the Month is the last month of the reporting period to which the data belongs to. "
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "a7nDH2imYUeP23B6WT5yZw",
+ "cell_type": "code",
+ "source": [
+ "public record PartitionByReportingNodeAndPeriod : IfrsPartition {",
+ "\n [Display(Order = 30)]",
+ "\n [Dimension(typeof(int), nameof(Year))]",
+ "\n [IdentityProperty]",
+ "\n public int Year { get; init; }",
+ "\n",
+ "\n [Display(Order = 40)]",
+ "\n [Dimension(typeof(int), nameof(Month))]",
+ "\n [IdentityProperty]",
+ "\n public int Month { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "TZvDAkF0M02LQtQKCZLJRA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n# Policy-related Data Structures",
+ "\n",
+ "\nThe data structures below are the pieces of the data model where policy-related data is held."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "kjn-7dhJgEa7EDS2jG2CbA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Data Node",
+ "\n",
+ "\nA data node is basically a set of labels which identify data according to its:",
+ "\n- Reporting Node",
+ "\n- Scenario",
+ "\n- Contractual Currency",
+ "\n- FunctionalCurrency",
+ "\n- LineOfBusiness",
+ "\n- ValuationApproach",
+ "\n- OCI Type"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "7I3_uOSDzkuHhcVJMukGlA",
+ "cell_type": "markdown",
+ "source": [
+ "TODOs:",
+ "\n",
+ "\n- Remove Scenario from Partition and include it as simple property (see Year, Month). Introduce concept of Priority in LoadCurrentAndPreviousParameterAsync query (see ParameterResultsEntityQueryExtensions in IfrsGeneric).
",
+ "\n
"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "XlZfZAGgi0GjV_7P_tJtiQ",
+ "cell_type": "code",
+ "source": [
+ "public record DataNode : KeyedDimension, IPartitioned {",
+ "\n [NotVisible]",
+ "\n [PartitionKey(typeof(PartitionByReportingNode))]",
+ "\n public Guid Partition { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(Currency))]",
+ "\n //[Required] // TODO: check",
+ "\n //[Immutable] // TODO: Not available yet",
+ "\n public string ContractualCurrency { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(Currency))]",
+ "\n //[Required] // TODO: check",
+ "\n //[Immutable]",
+ "\n public string FunctionalCurrency { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(LineOfBusiness))]",
+ "\n //[Immutable]",
+ "\n public string LineOfBusiness { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(ValuationApproach))]",
+ "\n [Required]",
+ "\n //[Immutable]",
+ "\n public string ValuationApproach { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(OciType))]",
+ "\n //[Immutable]",
+ "\n public string OciType { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "0Zg-7p1UNU6Wdzok3kr-AA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Portfolios",
+ "\n",
+ "\nA Portfolio is a set of Group of Contracts. The relationship is set on the Group of Contracts (see below).",
+ "\n",
+ "\nPortfolios are of type DataNode and there are two types: Insurance Portfolio and Reinsurance Portfolios."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "0P3rhAjUNUyBonuP1k9uHg",
+ "cell_type": "code",
+ "source": [
+ "public record Portfolio : DataNode {}",
+ "\n",
+ "\npublic record InsurancePortfolio : Portfolio {}",
+ "\npublic record ReinsurancePortfolio : Portfolio {}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "xbAt9JzjCE614P7B97aiVA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Group of Contracts",
+ "\n",
+ "\nA Group of Contract is a set of contracts with the same Annual Cohort, Liability Type, Profitability and Partner (in case the contracts are done with a re-insurer).",
+ "\n",
+ "\nVarious Group of Contracts are put together into portfolios."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "la_B6Lgw10-Y8UNDpmZ3gA",
+ "cell_type": "code",
+ "source": [
+ "public record GroupOfContract : DataNode {",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(int), nameof(AnnualCohort))]",
+ "\n //[Immutable]",
+ "\n public int AnnualCohort { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(LiabilityType))]",
+ "\n //[Immutable]",
+ "\n public string LiabilityType { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(Profitability))]",
+ "\n //[Immutable]",
+ "\n public string Profitability { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(Portfolio))]",
+ "\n //[Immutable]",
+ "\n public string Portfolio { get; init; }",
+ "\n ",
+ "\n public virtual string Partner { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "qgBtX4_gZEeQFJWmImnXKg",
+ "cell_type": "markdown",
+ "source": [
+ "A group of insurance contracts is called a **GIC** and has no information on Partner.",
+ "\n",
+ "\nOnly Groups of Reinsurance Contracts, defined below and usually called **GRIC**s, have Partner information.",
+ "\nAgain, there are Insurance GRICs and Reinsurance GRICs:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "IGY1DT71jECwSzukcliQKg",
+ "cell_type": "code",
+ "source": [
+ "public record GroupOfInsuranceContract : GroupOfContract {",
+ "\n [Required]",
+ "\n [NotVisible] ",
+ "\n [Display(Name = \"InsurancePortfolio\")]",
+ "\n [Dimension(typeof(InsurancePortfolio))]",
+ "\n //[Immutable]",
+ "\n public string Portfolio { get => base.Portfolio; init => base.Portfolio = value; }",
+ "\n ",
+ "\n // TODO: for the case of internal reinsurance the Partner would be the reporting node, hence not null.",
+ "\n // If this is true we need the [Required] attribute here, add some validation at dataNode import ",
+ "\n // and to add logic in the GetNonPerformanceRiskRate method in ImportStorage.",
+ "\n [NotVisible] ",
+ "\n [NotMapped]",
+ "\n //[Immutable]",
+ "\n public override string Partner => null;",
+ "\n}",
+ "\n",
+ "\npublic record GroupOfReinsuranceContract : GroupOfContract {",
+ "\n [Required]",
+ "\n [NotVisible] ",
+ "\n [Display(Name = \"ReinsurancePortfolio\")]",
+ "\n [Dimension(typeof(ReinsurancePortfolio))]",
+ "\n //[Immutable]",
+ "\n public string Portfolio { get => base.Portfolio; init => base.Portfolio = value; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "STd2Dg5TnU-jBYDxq-VbnA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Data Node State",
+ "\n",
+ "\nThe Data State is used to track whether a GOC is Active or Inactive across time (year and month). ",
+ "\nIt is only possible to update the state of a Group of Contract from Active to Inactive."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "l1RwYYRGQUuYklornedCUA",
+ "cell_type": "code",
+ "source": [
+ "public record DataNodeState : KeyedRecord, IPartitioned, IWithYearAndMonth",
+ "\n{",
+ "\n [NotVisible]",
+ "\n [PartitionKey(typeof(PartitionByReportingNode))]",
+ "\n public Guid Partition { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(GroupOfContract))]",
+ "\n public string DataNode { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Year))]",
+ "\n [Range(1900, 2100, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 20)]",
+ "\n public int Year { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Month))]",
+ "\n [Range(1, 12, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 30)]",
+ "\n [DefaultValue(DefaultDataNodeActivationMonth)]",
+ "\n public int Month { get; init; } = DefaultDataNodeActivationMonth;",
+ "\n ",
+ "\n [Required]",
+ "\n [Display(Order = 40)]",
+ "\n [DefaultValue(State.Active)]",
+ "\n public State State { get; init; } = State.Active;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "siMZOfujgkCvYRhglSafRw",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Data Node Parameters",
+ "\n",
+ "\nData Node Parameters are used to keep track of other parameters pertaining to each Data Node, and their movements in time (year and month).",
+ "\n
PremiumAllocation : defines the weight of Premium to be included in the Experience Adjustement AocType of the Technical Margin and is valid only for Group of Insurance Contract with LiabilityType : Liability for Remaining Coverage.",
+ "\n
ReinsuranceCoverage : defines the weight of the underlying gross business to be considered in the computation of the allocation of the Technical Margin in a Reinsurance case.",
+ "\n",
+ "\nThe latest Data Node Parameters available in the system with Year and Month earlier or equal to Year and Month of the closing period will be used as the current value during calculation."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "Y9V4hdUwV0WlDgxhiVJ0lg",
+ "cell_type": "code",
+ "source": [
+ "public record DataNodeParameter : KeyedRecord, IPartitioned, IWithYearAndMonth",
+ "\n{",
+ "\n [NotVisible]",
+ "\n [PartitionKey(typeof(PartitionByReportingNode))]",
+ "\n public Guid Partition { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Year))]",
+ "\n [Range(1900, 2100, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 20)]",
+ "\n public int Year { get; init; }",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Month))]",
+ "\n [Range(1, 12, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n [Display(Order = 30)]",
+ "\n [DefaultValue(DefaultDataNodeActivationMonth)]",
+ "\n public int Month { get; init; } = DefaultDataNodeActivationMonth;",
+ "\n ",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 10)]",
+ "\n [Dimension(typeof(GroupOfContract))]",
+ "\n public string DataNode { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "Cnr2el8xg0OjF0x79bM9lQ",
+ "cell_type": "code",
+ "source": [
+ "public record SingleDataNodeParameter : DataNodeParameter {",
+ "\n [DefaultValue(DefaultPremiumExperienceAdjustmentFactor)]",
+ "\n [Range(0, 1, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n public double PremiumAllocation { get; init; } = DefaultPremiumExperienceAdjustmentFactor;",
+ "\n}",
+ "\n",
+ "\npublic record InterDataNodeParameter : DataNodeParameter {",
+ "\n [Required]",
+ "\n [IdentityProperty]",
+ "\n [Display(Order = 20)]",
+ "\n [Dimension(typeof(GroupOfContract))]",
+ "\n public string LinkedDataNode { get; init; }",
+ "\n ",
+ "\n [Range(0, 1, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
+ "\n public double ReinsuranceCoverage { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "WCZyCC4Qlkm0FjxSRHM0xw",
+ "cell_type": "markdown",
+ "source": [
+ "## DataNodeData PocoType",
+ "\nThe DataNodeData type is not persisted (i.e. not stored in the database) and is used in order to hold Data Node data during data manipulations."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "koNxFi27ZkuU4_2cCG2GMA",
+ "cell_type": "code",
+ "source": [
+ "public record DataNodeData {",
+ "\n public string DataNode { get; init; }",
+ "\n ",
+ "\n //Portfolio",
+ "\n public string ContractualCurrency { get; init; }",
+ "\n public string FunctionalCurrency { get; init; }",
+ "\n public string LineOfBusiness { get; init; }",
+ "\n public string ValuationApproach { get; init; }",
+ "\n public string OciType { get; init; }",
+ "\n ",
+ "\n //GroupOfContract",
+ "\n public string Portfolio { get; init; }",
+ "\n public int AnnualCohort { get; init; }",
+ "\n public string LiabilityType { get; init; }",
+ "\n public string Profitability { get; init; }",
+ "\n public string Partner { get; init; }",
+ "\n ",
+ "\n //DataNodeState",
+ "\n public int Year { get; init; }",
+ "\n public int Month { get; init; }",
+ "\n public State State { get; init; }",
+ "\n public State PreviousState { get; init; }",
+ "\n ",
+ "\n public bool IsReinsurance { get; init; }",
+ "\n ",
+ "\n public DataNodeData(){}",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "9zeoLgvZ8EKhCCDbihId8w",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Raw Variables (Cashflows)",
+ "\n",
+ "\nRaw Variables are used to store **cashflows** on the database during import, i.e. *after* mappings are applied and *before* calculations are applied.",
+ "\n",
+ "\nThey are stored on the database for both audit and re-calculation purposes."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "vy4oWvNmmUGJTicrwsX63Q",
+ "cell_type": "code",
+ "source": [
+ "public abstract record BaseVariableIdentity {",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(GroupOfContract))]",
+ "\n [IdentityProperty]",
+ "\n public string DataNode { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(AocType))]",
+ "\n [IdentityProperty]",
+ "\n public string AocType { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(Novelty))]",
+ "\n [IdentityProperty]",
+ "\n public string Novelty { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "_bTxTL4-o0efG6zNvhuDjg",
+ "cell_type": "code",
+ "source": [
+ "public abstract record BaseDataRecord : BaseVariableIdentity, IKeyed, IPartitioned {",
+ "\n [Key]",
+ "\n [NotVisible] ",
+ "\n public Guid Id { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [PartitionKey(typeof(PartitionByReportingNodeAndPeriod))]",
+ "\n public Guid Partition { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(AmountType))]",
+ "\n [IdentityProperty]",
+ "\n public string AmountType { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(int),nameof(AccidentYear))]",
+ "\n [IdentityProperty]",
+ "\n public int? AccidentYear { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "X688yB4HTEm3riHh8lTrug",
+ "cell_type": "markdown",
+ "source": [
+ "Basically, RawVariable is defined for a certain Reporting Node, Scenario, Year, Month, Amount Type and Calculation Type:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "kfbf0LwJSEGaxyUuPFnsKg",
+ "cell_type": "code",
+ "source": [
+ "public record RawVariable : BaseDataRecord",
+ "\n{",
+ "\n [Conversion(typeof(PrimitiveArrayConverter))]",
+ "\n public double[] Values { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(CalculationType))]",
+ "\n [IdentityProperty]",
+ "\n public string CalculationType { get; init; }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "IeCO6PmNPEioYptDRrzHTA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Ifrs Variable",
+ "\n",
+ "\nIfrs Variables are used to store:",
+ "\n",
+ "\n- **Actual Values**",
+ "\n- **Present Values**",
+ "\n",
+ "\nPresent Values are calculated from the [raw variables](#raw-variables) during the import of cashflows.",
+ "\n",
+ "\nIfrs Variables are stored on the database, i.e. they are 'persisted', for performance purposes."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "H9N-c0drk0GPoWh-VfRXzA",
+ "cell_type": "code",
+ "source": [
+ "public record IfrsVariable : BaseDataRecord",
+ "\n{",
+ "\n public double Value { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(EstimateType))]",
+ "\n [IdentityProperty]",
+ "\n public string EstimateType { get; init; }",
+ "\n ",
+ "\n [NotVisible] ",
+ "\n [Dimension(typeof(EconomicBasis))]",
+ "\n [IdentityProperty]",
+ "\n public string EconomicBasis { get; init; }",
+ "\n ",
+ "\n public IfrsVariable (){}",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "MCh8EtPVKUyEIcixf6Q_1Q",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Import Identity",
+ "\nThe Import Identity contains the data elements used to determine the data sets which are used when performing data manipulations, e.g. during a [data import](./Import/ImportScopeCalculation) - In particular, an Import Identity is defined by: DataNode, AocType, Novelty, and whether it's reinsurance data or not:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "w5SSaFTyYE-3Xj0yy0eobw",
+ "cell_type": "code",
+ "source": [
+ "public record ImportIdentity : BaseVariableIdentity {",
+ "\n ",
+ "\n [NotVisible]",
+ "\n public bool IsReinsurance { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n public string ValuationApproach { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n public int ProjectionPeriod { get; init; }",
+ "\n ",
+ "\n public (string, string) AocStep => (AocType, Novelty);",
+ "\n ",
+ "\n public ImportScope ImportScope { get; init; }",
+ "\n ",
+ "\n public ImportIdentity(RawVariable rv){",
+ "\n DataNode = rv.DataNode;",
+ "\n AocType = rv.AocType;",
+ "\n Novelty = rv.Novelty;",
+ "\n }",
+ "\n ",
+ "\n public ImportIdentity(IfrsVariable iv){",
+ "\n DataNode = iv.DataNode;",
+ "\n AocType = iv.AocType;",
+ "\n Novelty = iv.Novelty;",
+ "\n }",
+ "\n",
+ "\n public ImportIdentity(){}",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "31-e-C4gwESKBN8E0Rr6gQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n# Report Variable",
+ "\n",
+ "\nReport Variables are used to hold data after data manipulations and before being outputed in the form of a report. They are not persisted, i.e. they are not saved on the database."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "2yvEMKViYE6wZPnuy7AClg",
+ "cell_type": "code",
+ "source": [
+ "public record ReportVariable {",
+ "\n",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(ReportingNode))]",
+ "\n [IdentityProperty]",
+ "\n public string ReportingNode { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(Scenario))]",
+ "\n [IdentityProperty]",
+ "\n public string Scenario { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(Currency), nameof(FunctionalCurrency))]",
+ "\n [IdentityProperty]",
+ "\n //[AggregateBy]",
+ "\n public string FunctionalCurrency { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(Currency), nameof(ContractualCurrency))]",
+ "\n [IdentityProperty]",
+ "\n //[AggregateBy]",
+ "\n public string ContractualCurrency { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(GroupOfContract))]",
+ "\n [IdentityProperty]",
+ "\n public string GroupOfContract { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(Portfolio))]",
+ "\n [IdentityProperty]",
+ "\n public string Portfolio { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(LineOfBusiness))]",
+ "\n [IdentityProperty]",
+ "\n public string LineOfBusiness { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(LiabilityType))]",
+ "\n [IdentityProperty]",
+ "\n public string LiabilityType { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(Profitability), nameof(InitialProfitability))]",
+ "\n [IdentityProperty]",
+ "\n public string InitialProfitability { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(ValuationApproach))]",
+ "\n [IdentityProperty]",
+ "\n public string ValuationApproach { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(AnnualCohort))]",
+ "\n [IdentityProperty]",
+ "\n public int AnnualCohort { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(OciType))]",
+ "\n [IdentityProperty]",
+ "\n public string OciType { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(Partner))]",
+ "\n [IdentityProperty]",
+ "\n public string Partner { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [IdentityProperty]",
+ "\n public bool IsReinsurance { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(AccidentYear))]",
+ "\n [IdentityProperty]",
+ "\n public int AccidentYear { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [NoArithmetics(ArithmeticOperation.Scale)]",
+ "\n [Dimension(typeof(int), nameof(Projection))]",
+ "\n [IdentityProperty]",
+ "\n //[AggregateBy]",
+ "\n public int Projection { get; init;}",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(VariableType))]",
+ "\n [IdentityProperty]",
+ "\n public string VariableType { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(Novelty))]",
+ "\n [IdentityProperty]",
+ "\n public string Novelty { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(AmountType))]",
+ "\n [IdentityProperty]",
+ "\n public string AmountType { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(EstimateType))]",
+ "\n [IdentityProperty]",
+ "\n public string EstimateType { get; init; }",
+ "\n ",
+ "\n [NotVisible]",
+ "\n [Dimension(typeof(EconomicBasis))]",
+ "\n [IdentityProperty]",
+ "\n //[AggregateBy]",
+ "\n public string EconomicBasis { get; init; }",
+ "\n ",
+ "\n public double Value { get; init; }",
+ "\n ",
+ "\n public ReportVariable(){}",
+ "\n public ReportVariable(ReportVariable rv){",
+ "\n ReportingNode = rv.ReportingNode;",
+ "\n Scenario = rv.Scenario;",
+ "\n FunctionalCurrency = rv.FunctionalCurrency;",
+ "\n ContractualCurrency = rv.ContractualCurrency;",
+ "\n GroupOfContract = rv.GroupOfContract;",
+ "\n Portfolio = rv.Portfolio;",
+ "\n LineOfBusiness = rv.LineOfBusiness;",
+ "\n LiabilityType = rv.LiabilityType;",
+ "\n InitialProfitability = rv.InitialProfitability;",
+ "\n ValuationApproach = rv.ValuationApproach;",
+ "\n AnnualCohort = rv.AnnualCohort;",
+ "\n OciType = rv.OciType;",
+ "\n Partner = rv.Partner;",
+ "\n IsReinsurance = rv.IsReinsurance;",
+ "\n AccidentYear = rv.AccidentYear;",
+ "\n Projection = rv.Projection;",
+ "\n VariableType = rv.VariableType;",
+ "\n Novelty = rv.Novelty;",
+ "\n AmountType = rv.AmountType;",
+ "\n EstimateType = rv.EstimateType;",
+ "\n EconomicBasis = rv.EconomicBasis;",
+ "\n Value = rv.Value;",
+ "\n }",
+ "\n public ReportVariable(DataNodeData dn, IfrsVariable iv){",
+ "\n FunctionalCurrency = dn.FunctionalCurrency;",
+ "\n ContractualCurrency = dn.ContractualCurrency;",
+ "\n GroupOfContract = dn.DataNode;",
+ "\n Portfolio = dn.Portfolio;",
+ "\n LineOfBusiness = dn.LineOfBusiness;",
+ "\n LiabilityType = dn.LiabilityType;",
+ "\n InitialProfitability = dn.Profitability;",
+ "\n ValuationApproach = dn.ValuationApproach;",
+ "\n AnnualCohort = dn.AnnualCohort;",
+ "\n OciType = dn.OciType;",
+ "\n Partner = dn.Partner;",
+ "\n IsReinsurance = dn.IsReinsurance;",
+ "\n AccidentYear = iv.AccidentYear ?? default;",
+ "\n VariableType = iv.AocType;",
+ "\n Novelty = iv.Novelty;",
+ "\n AmountType = iv.AmountType;",
+ "\n EstimateType = iv.EstimateType;",
+ "\n EconomicBasis = iv.EconomicBasis;",
+ "\n Value = iv.Value;",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "WtIFU8efQE2aUaVim03Iog",
+ "cell_type": "markdown",
+ "source": [
+ "# Args"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "i8WBwS3IuUqLxaV5XGKWsg",
+ "cell_type": "code",
+ "source": [
+ "public record Args(string ReportingNode, int Year, int Month, Periodicity Periodicity, string Scenario){}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "6FcgQqQpzE2yPeqwZNRfiQ",
+ "cell_type": "code",
+ "source": [
+ "public record ImportArgs : Args",
+ "\n{",
+ "\n public string ImportFormat { get; init; }",
+ "\n ",
+ "\n public ImportArgs(string reportingNode, int year, int month, Periodicity periodicity, string scenario, string importFormat)",
+ "\n : base(reportingNode, year, month, periodicity, scenario)",
+ "\n {",
+ "\n ImportFormat = importFormat;",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "mJUZ9khq1k-jUZcG-qZniQ",
+ "cell_type": "code",
+ "source": [
+ "public record ReportArgs : Args",
+ "\n{",
+ "\n public string HierarchyName { get; init; }",
+ "\n ",
+ "\n public CurrencyType CurrencyType { get; init; }",
+ "\n ",
+ "\n public string ReportName { get; init; } // this is the key to which data to load (like loading behavior). If null, loads everything",
+ "\n ",
+ "\n public ReportArgs(string reportingNode, int year, int month, Periodicity periodicity, string scenario, string hierarchyName, CurrencyType currencyType)",
+ "\n : base(reportingNode, year, month, periodicity, scenario)",
+ "\n {",
+ "\n CurrencyType = currencyType;",
+ "\n HierarchyName = hierarchyName;",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Database/.gitignore b/Database/.gitignore
new file mode 100644
index 00000000..34be061b
--- /dev/null
+++ b/Database/.gitignore
@@ -0,0 +1 @@
+PersonalConnection.ipynb
\ No newline at end of file
diff --git a/Database/Configure.ipynb b/Database/Configure.ipynb
new file mode 100644
index 00000000..2819a9af
--- /dev/null
+++ b/Database/Configure.ipynb
@@ -0,0 +1,131 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "toc-autonumbering": "True",
+ "toc-showcode": "False",
+ "toc-showmarkdowntxt": "False",
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "vWKQtrDv20CeZFovAj82Vw",
+ "cell_type": "markdown",
+ "source": [
+ " DataSource Configuration
"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ekOMREP2YkKF0vgtOn6cyQ",
+ "cell_type": "code",
+ "source": [
+ "#!import \"../DataModel/DataStructure\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "eEI7AS2fc0-CFjAR_WzdHg",
+ "cell_type": "code",
+ "source": [
+ "#!import \"PersonalConnection\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ZoHg5nndvEWdxnUy6nU0aQ",
+ "cell_type": "code",
+ "source": [
+ "using System.Reflection;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "V3sPPe7bkEOIAjZHtM5oTw",
+ "cell_type": "markdown",
+ "source": [
+ "# Database Configure"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ZxIo5q84i02LBlbq4AQnNA",
+ "cell_type": "code",
+ "source": [
+ "var allTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes())",
+ "\n .Where(t => (t.IsAssignableTo(typeof(IKeyed)) || t.IsAssignableTo(typeof(KeyedDimension)))",
+ "\n && !t.IsInterface",
+ "\n && !t.IsAbstract",
+ "\n ).ToArray();"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "Wi93Z_KSukSEMiLoOfsKXA",
+ "cell_type": "code",
+ "source": [
+ "await DataSource.Configure().UseMsSql(opt => opt.WithConnectionString(connectionStringMsSql)",
+ "\n .WithTypes(allTypes)) .ConnectAsync();"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "4jSr3apQzEm6bXs7ot9uJQ",
+ "cell_type": "code",
+ "source": [
+ "await DataSource.CommitAsync();"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "SUiuO25f-0S6Uv5at0MehA",
+ "cell_type": "markdown",
+ "source": [
+ "# Reset Workspace"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "T0pNd11nrkuDwN6S0YgItg",
+ "cell_type": "code",
+ "source": [
+ "Workspace.Reset(x => x.ResetInitializationRules());"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "sAYMeiwmiUWC-T3QYXi7aw",
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Database/Schema Delete.ipynb b/Database/Schema Delete.ipynb
new file mode 100644
index 00000000..49792b90
--- /dev/null
+++ b/Database/Schema Delete.ipynb
@@ -0,0 +1,87 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ },
+ "documentInfo": "{\r\n \"authors\": [\r\n \"Peter Kunszt\"\r\n ],\r\n \"contributors\": [],\r\n \"tags\": [\r\n \"storage\",\r\n \"database\",\r\n \"persistence\",\r\n \"dependency\"\r\n ],\r\n \"title\": \"Multiple Storages with Persistence\",\r\n \"description\": \"Demo the usage of database backend to resolve a data dependency.\",\r\n \"createdDate\": \"Jan. 2022\",\r\n \"publishedDate\": \"Jan. 2022\",\r\n \"changelog\": [\r\n {\r\n \"version\": \"1.0\",\r\n \"description\": \"Initial Notebook\"\r\n }\r\n ]\r\n }"
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "XekEwxVoCk6YtMSTaBi_6A",
+ "cell_type": "code",
+ "source": [
+ "#!import \"PersonalConnection\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "aMGWTiny-EO8ZtyaiC0M2A",
+ "cell_type": "code",
+ "source": [
+ "#r \"nuget:SqlConnection,1.0.4\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "dKBE6yQHq0CZbS4Oq7ZXag",
+ "cell_type": "code",
+ "source": [
+ "string[] split = connectionStringMsSql.Split(new char[] { '=', ':', ',', ';' });",
+ "\n",
+ "\nstring serverName = split[2];",
+ "\nstring database = split[5];",
+ "\nstring userID = split[9];",
+ "\nstring password = split[11];"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "BBbDUGWgHUywoxk289vQ2A",
+ "cell_type": "code",
+ "source": [
+ "using SQLConnection;",
+ "\nusing System;",
+ "\nusing System.Data.SqlClient;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "S-_OArgE70qFUpEbX12H3Q",
+ "cell_type": "code",
+ "source": [
+ "string query = \"DECLARE @sql NVARCHAR(max)='' SELECT @sql += ' Drop table ' + QUOTENAME(TABLE_SCHEMA) + '.'+ QUOTENAME(TABLE_NAME) + '; 'FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' Exec Sp_executesql @sql\";"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "oeQryPr0l0uflGqNrUvmLw",
+ "cell_type": "code",
+ "source": [
+ "int rowAffect = SqlServer.AzureSqlConnection(serverName, database, userID, password, query);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Export/MapTemplate.ipynb b/Export/MapTemplate.ipynb
new file mode 100644
index 00000000..c1fb9d01
--- /dev/null
+++ b/Export/MapTemplate.ipynb
@@ -0,0 +1,338 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "toc-autonumbering": "True",
+ "toc-showcode": "False",
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "J7Lk0NfjhkC9DBXVAnd4ag",
+ "cell_type": "markdown",
+ "source": [
+ " Map Template
"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "nJozo1XeSkeGCLiQXUPlzA",
+ "cell_type": "markdown",
+ "source": [
+ "This Notebook exports the Data nodes, states, and parameters for the target partition to a spreadsheet file which can be read, modified, and is ready to be re-imported."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "T4LYGKNFjke1IDEPU8E44Q",
+ "cell_type": "markdown",
+ "source": [
+ "After setting the desired target Partition, the Data present in the workspace is ready to be exported. "
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "J3Om4qznT0qnFdizsJg6gA",
+ "cell_type": "markdown",
+ "source": [
+ "# Import dependencies"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "jz0ZzjaNNkyPlNjH7p_9CQ",
+ "cell_type": "code",
+ "source": [
+ "#!import \"../Utils/UtilityMethods\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "4kGmVeM2F0y1LR3iEJJAaA",
+ "cell_type": "markdown",
+ "source": [
+ "# Select Initialization"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "nVFGNWhtb0iw49kOFNKpUQ",
+ "cell_type": "markdown",
+ "source": [
+ "Choose to run the Map Template either with the set of Systemorph data in memory or with the data present in the Database. Uncomment the desired option."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "MbQiJg5acUurtMhQFZOPtw",
+ "cell_type": "code",
+ "source": [
+ "/* The DataSource is configured and connected to real database */",
+ "\n//#!eval-notebook \"Database/Configure\"",
+ "\n/* The Systemorph set of dimensions + mockdata are dispatched to the unconfigured in-memory DataSource */",
+ "\n#!eval-notebook \"../Initialization/InitSystemorphBaseToMemory\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "Ma-JBoxkmUqAb81Pb2v8EA",
+ "cell_type": "markdown",
+ "source": [
+ "# Workspace Initialization "
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "zaO0K3_d3UOftmtrwhqrFg",
+ "cell_type": "markdown",
+ "source": [
+ "Firstly, the Workspace is initialized with basic dimensions and with Data Nodes. For a list of the dimensions please refer to the DataModel/DataStructure notebook."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "BP4HG8krfkul6dXSvdGHnw",
+ "cell_type": "code",
+ "source": [
+ "Workspace.InitializeFrom(DataSource);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "CirOR3dQA0iqxXipYfNcFQ",
+ "cell_type": "markdown",
+ "source": [
+ "# Map Template: Data Node"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "z1pGwBuU20ywRLjN6Gj5eg",
+ "cell_type": "markdown",
+ "source": [
+ "## Set Partition"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "8y9ezk2H7EetGACPthoNUw",
+ "cell_type": "code",
+ "source": [
+ "static var partition = new PartitionByReportingNode() { ReportingNode = \"CH\" };"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "XFPlV7vwiUCUY7llRpEeEQ",
+ "cell_type": "code",
+ "source": [
+ "await Workspace.Partition.SetAsync( partition );"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "7MTJTAXvjUCDuc6-sHSUQQ",
+ "cell_type": "markdown",
+ "source": [
+ "## Export"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "yBbsPeQ5XkO5M_mXJtkiTw",
+ "cell_type": "code",
+ "source": [
+ "await Export.ToExcel(\"DataNodes\")",
+ "\n .WithSource(Workspace)",
+ "\n .PortfolioConfiguration()",
+ "\n .PortfolioConfiguration()",
+ "\n .GroupofContractConfiguration(typeof(ReinsurancePortfolio))",
+ "\n .GroupofContractConfiguration(typeof(InsurancePortfolio))",
+ "\n .MainTabConfigurationWoScenario(partition)",
+ "\n.ExecuteAsync()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "SG9iYPdfGkOJqrcbjN-cIQ",
+ "cell_type": "markdown",
+ "source": [
+ "# Map Template: Data Node State"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "go7LKWKxBECDgXOhv9Se8g",
+ "cell_type": "markdown",
+ "source": [
+ "## Set Partition"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "b7xD5r6TuE2QTO-J6L8q-Q",
+ "cell_type": "code",
+ "source": [
+ "static var partition = new PartitionByReportingNodeAndPeriod() { ReportingNode = \"CH\", Year = 2020, Month = 12 };"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "q1MIgSZcNE60Sx6cCGC9YA",
+ "cell_type": "code",
+ "source": [
+ "await Workspace.Partition.SetAsync( new PartitionByReportingNode() { ReportingNode = partition.ReportingNode } );"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "reWr-I2FeUijpPeiXGdOCA",
+ "cell_type": "markdown",
+ "source": [
+ "## Export"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "iW-JFPjuS0q_aGWGSn4Ujg",
+ "cell_type": "code",
+ "source": [
+ "var dataNodeStates = (await Workspace.Query()",
+ "\n .Where(x => (x.Year == partition.Year && x.Month <= partition.Month) || x.Year < partition.Year).ToArrayAsync())",
+ "\n .GroupBy(x => x.DataNode)",
+ "\n .Select(x => x.OrderByDescending(y => y.Year).ThenByDescending(y => y.Month))",
+ "\n .Select(x => x.Last())",
+ "\n .ToArray();"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "64_Gk6W_qkuh47zAJ1xcZw",
+ "cell_type": "code",
+ "source": [
+ "await Export.ToExcel(\"DataNodeState\")",
+ "\n .WithSource(Workspace)",
+ "\n .StateEnumConfiguration() ",
+ "\n .DataNodeStateConfiguration(dataNodeStates)",
+ "\n .MainTabConfigurationWoScenario(partition)",
+ "\n.ExecuteAsync()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "Aolg5llKGkWX3-v94jBP8A",
+ "cell_type": "markdown",
+ "source": [
+ "# Map Template: Data Node Parameter"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "amCy5h6BA0K6wxCh7NvZrg",
+ "cell_type": "markdown",
+ "source": [
+ "## Set Partition"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "kMTcDi7DFEC6FuMagh5uDg",
+ "cell_type": "code",
+ "source": [
+ "static var partition = new PartitionByReportingNodeAndPeriod() { ReportingNode = \"CH\", Year = 2020, Month = 12 };"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "-tmD3uOmwUmFUX_q78nD7A",
+ "cell_type": "code",
+ "source": [
+ "await Workspace.Partition.SetAsync( new PartitionByReportingNode() { ReportingNode = partition.ReportingNode } );"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "z6pkleZXd0mZN82EQprS3w",
+ "cell_type": "markdown",
+ "source": [
+ "## Export"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "0zdLZPrPw0Sm4w1TjesGMQ",
+ "cell_type": "code",
+ "source": [
+ "var dataNodeParameters = (await Workspace.Query()",
+ "\n .Where(x => (x.Year == partition.Year && x.Month <= partition.Month) || x.Year < partition.Year).ToArrayAsync())",
+ "\n .GroupBy(x => x.GetType().Name)",
+ "\n .ToDictionary(x => x.Key, ",
+ "\n x => x.GroupBy(y => y.DataNode)",
+ "\n .Select(y => y.OrderByDescending(z => z.Year).ThenByDescending(z => z.Month))",
+ "\n .Select(y => y.Last())",
+ "\n .ToArray() );"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "xp0dlpVqC0mQfbqqrpn8Aw",
+ "cell_type": "code",
+ "source": [
+ "await Export.ToExcel(\"DataNodeParameter\")",
+ "\n .WithSource(Workspace)",
+ "\n .DataNodeParameterConfiguration(dataNodeParameters)",
+ "\n .MainTabConfiguration(partition)",
+ "\n.ExecuteAsync()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "3tf3mjl0gUqui_fD_X7OmQ",
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Files/300.ReportingNodes/ReportingNodes.csv b/Files/300.ReportingNodes/ReportingNodes.csv
new file mode 100644
index 00000000..ffaab637
--- /dev/null
+++ b/Files/300.ReportingNodes/ReportingNodes.csv
@@ -0,0 +1,10 @@
+@@ReportingNode,,,,
+SystemName,DisplayName,Parent,Currency
+G,Group,,CHF
+CH,Switzerland,G,CHF
+DE,Germany,G,EUR
+ES,Spain,G,EUR
+FR,France,G,EUR
+IT,Italy,G,EUR
+UK,United Kingdom,G,GBP
+SK,Slovakia,G,EUR
diff --git a/Files/700.DataNodes/DataNodeParameters_CH_2020_12.csv b/Files/700.DataNodes/DataNodeParameters_CH_2020_12.csv
new file mode 100644
index 00000000..19a655dc
--- /dev/null
+++ b/Files/700.DataNodes/DataNodeParameters_CH_2020_12.csv
@@ -0,0 +1,22 @@
+@@Main,,
+ReportingNode,Year,Month
+CH,2020,12
+,,
+@@SingleDataNodeParameter,,
+DataNode,PremiumAllocation,
+GicComplex,0.8,
+DT1.1,0.8,
+DT1.2,0.8,
+DT1.3,1,
+DT2.1,0.8,
+DT2.2,0.8,
+DT3.1,0.8,
+DT4.1,0.8,
+,,
+@@InterDataNodeParameter,,
+DataNode,LinkedDataNode,ReinsuranceCoverage
+DT1.1,DTR1.1,1
+DT1.2,DTR1.2,1
+DT2.1,DTR2.1,1
+DT2.2,DTR2.2,1
+GricComplex,GicComplex,1
diff --git a/Files/700.DataNodes/DataNodeStates_CH_2020_12.csv b/Files/700.DataNodes/DataNodeStates_CH_2020_12.csv
new file mode 100644
index 00000000..78802935
--- /dev/null
+++ b/Files/700.DataNodes/DataNodeStates_CH_2020_12.csv
@@ -0,0 +1,19 @@
+@@Main,,
+ReportingNode,Year,Month
+CH,2020,12
+,,
+@@DataNodeState,,
+DataNode,State,
+GicComplex,Active,
+GricComplex,Active,
+DT1.1,Active,
+DT1.2,Active,
+DT1.3,Active,
+DT2.1,Active,
+DT2.2,Active,
+DT3.1,Active,
+DT4.1,Active,
+DTR1.1,Active,
+DTR1.2,Active,
+DTR2.1,Active,
+DTR2.2,Active,
diff --git a/Files/700.DataNodes/DataNodes_CH.csv b/Files/700.DataNodes/DataNodes_CH.csv
new file mode 100644
index 00000000..54f5657f
--- /dev/null
+++ b/Files/700.DataNodes/DataNodes_CH.csv
@@ -0,0 +1,36 @@
+@@Main,,,,,,
+ReportingNode,,,,,,
+CH,,,,,,
+,,,,,,
+@@InsurancePortfolio,,,,,,
+SystemName,DisplayName,ContractualCurrency,LineOfBusiness,ValuationApproach,OciType,
+DT,DT complex CF,USD,ANN,BBA,Default,
+DT1,DT1 OCI,USD,ANN,BBA,Default,
+DT2,DT2 NOCI,USD,ANN,BBA,,
+DT3,DT3 RunOff,USD,ANN,BBA,Default,
+DT4,DT4 OCI,USD,ANN,BBA,Default,
+,,,,,,
+@@GroupOfInsuranceContract,,,,,,
+SystemName,DisplayName,InsurancePortfolio,AnnualCohort,LiabilityType,Profitability,
+GicComplex,Gic test discounting,DT,2020,LRC,P,
+DT1.1,DT1.1 OCI LRC PA 0.8,DT1,2020,LRC,P,
+DT1.2,DT1.2 OCI LIC,DT1,2020,LIC,P,
+DT1.3,DT1.3 OCI LRC PA 1,DT1,2020,LRC,P,
+DT2.1,DT2.1 NOCI LRC PA 0.8,DT2,2020,LRC,P,
+DT2.2,DT2.2 NOCI LIC,DT2,2020,LIC,P,
+DT3.1,DT3.1 Runoff - PA 0.8,DT3,2020,LRC,P,
+DT4.1,DT4.1 CSM PA 0.8,DT4,2020,LRC,P,
+,,,,,,
+@@ReinsurancePortfolio,,,,,,
+SystemName,DisplayName,ContractualCurrency,LineOfBusiness,ValuationApproach,OciType,
+DTR,DTR complex CF,USD,ANN,BBA,,
+DTR1,DTR1 OCI,USD,ANN,BBA,Default,
+DTR2,DTR2 NOCI,USD,ANN,BBA,,
+,,,,,,
+@@GroupOfReinsuranceContract,,,,,,
+SystemName,DisplayName,ReinsurancePortfolio,AnnualCohort,LiabilityType,Profitability,Partner
+GricComplex,Gric test for discounting,DTR,2020,LRC,P,PT1
+DTR1.1,DTR1.1 OCI LRC,DTR1,2020,LRC,P,PT1
+DTR1.2,DTR1.2 OCI LIC,DTR1,2020,LIC,P,PT1
+DTR2.1,DTR2.1 NOCI LRC,DTR2,2020,LRC,P,PT1
+DTR2.2,DTR2.2 NOCI LIC,DTR2,2020,LIC,P,PT1
diff --git a/Files/800.Parameters/CreditDefaultRate.csv b/Files/800.Parameters/CreditDefaultRate.csv
new file mode 100644
index 00000000..b39c644e
--- /dev/null
+++ b/Files/800.Parameters/CreditDefaultRate.csv
@@ -0,0 +1,23 @@
+@@CreditDefaultRate,,,
+Year,Month,CreditRiskRating,Values0
+1900,12,AAA,0.00014
+1900,12,AA+,0.000242487
+1900,12,AA,0.00042
+1900,12,AA-,0.000469849
+1900,12,A+,0.000525615
+1900,12,A,0.000588
+1900,12,A-,0.000853615
+1900,12,BBB+,0.001239215
+1900,12,BBB,0.001799
+1900,12,BBB-,0.00297649
+1900,12,BB+,0.004924677
+1900,12,BB,0.008148
+1900,12,BB-,0.011522675
+1900,12,B+,0.016295046
+1900,12,B,0.023044
+1900,12,B-,0.031505634
+1900,12,CCC+,0.043074334
+1900,12,CCC,0.058891
+1900,12,CCC-,0.079972327
+1900,12,CC,0.108600179
+1900,12,C,0.147476
diff --git a/Files/800.Parameters/ExchangeRate.csv b/Files/800.Parameters/ExchangeRate.csv
new file mode 100644
index 00000000..8ac834c7
--- /dev/null
+++ b/Files/800.Parameters/ExchangeRate.csv
@@ -0,0 +1,14 @@
+@@ExchangeRate
+Currency,Year,Month,FxType,FxToGroupCurrency
+EUR,2021,3,Average,1.2012
+EUR,2021,3,Spot,1.2013
+EUR,2020,12,Average,1.2014
+EUR,2020,12,Spot,1.2015
+USD,2021,3,Average,1.2016
+USD,2021,3,Spot,1.2017
+USD,2020,12,Average,1.2018
+USD,2020,12,Spot,1.2019
+GBP,2021,3,Average,1.4016
+GBP,2021,3,Spot,1.4017
+GBP,2020,12,Average,1.4018
+GBP,2020,12,Spot,1.4019
\ No newline at end of file
diff --git a/Files/800.Parameters/PartnerRating.csv b/Files/800.Parameters/PartnerRating.csv
new file mode 100644
index 00000000..8f9d717c
--- /dev/null
+++ b/Files/800.Parameters/PartnerRating.csv
@@ -0,0 +1,4 @@
+@@PartnerRating
+Partner,CreditRiskRating,Year,Month
+PT1,AAA,2020,12
+PT1,BBB,2021,3
\ No newline at end of file
diff --git a/Files/800.Parameters/YieldCurve.csv b/Files/800.Parameters/YieldCurve.csv
new file mode 100644
index 00000000..892b7ee7
--- /dev/null
+++ b/Files/800.Parameters/YieldCurve.csv
@@ -0,0 +1,11 @@
+@@YieldCurve,,,,,,
+Currency,Year,Month,Values0,Values1,Values2,Values3
+EUR,2020,3,0.008685495,0.008685495,0.018498471,0.019966839
+CHF,2020,3,0.002,0.002,0.002,0.002
+CHF,2021,3,0.1,0.1,0.1,0.1
+USD,2021,3,0.005,0.005,0.005,0.005
+USD,2020,12,0.002,0.002,0.002,0.002
+USD,2020,3,0.002,0.002,0.002,0.002
+USD,2020,1,0.002,0.002,0.002,0.002
+GBP,2021,3,0.005,0.005,0.005,0.005
+GBP,2020,3,0.002,0.002,0.002,0.002
diff --git a/Files/900.TransactionalData/Actuals_CH_2020_12.csv b/Files/900.TransactionalData/Actuals_CH_2020_12.csv
new file mode 100644
index 00000000..12bfc994
--- /dev/null
+++ b/Files/900.TransactionalData/Actuals_CH_2020_12.csv
@@ -0,0 +1,33 @@
+@@Main,,,,
+ReportingNode,Year,Month,,
+CH,2020,12,,
+@@Actual,,,,
+DataNode,AocType,ValueType,AccidentYear,Value
+DT1.1,CF,PR,,-400
+DT1.1,CF,NIC,,280
+DT1.1,CF,ACA,,10
+DT1.1,CF,AEA,,5
+DT1.2,CF,NIC,2020,280
+DT2.1,CF,PR,,-400
+DT2.1,CF,NIC,,280
+DT2.1,CF,ACA,,10
+DT2.1,CF,AEA,,5
+DT1.3,CF,PR,,-400
+DT1.3,CF,NIC,,280
+DT1.3,CF,ACA,,10
+DT1.3,CF,AEA,,5
+DT2.2,CF,NIC,2020,280
+DTR1.1,CF,PR,,200
+DTR1.1,CF,NIC,,-140
+DTR1.2,CF,NIC,2020,-140
+DTR2.1,CF,PR,,200
+DTR2.1,CF,NIC,,-140
+DTR2.2,CF,NIC,2020,-140
+DT3.1,CF,PR,,-400
+DT3.1,CF,NIC,,280
+DT3.1,CF,ACA,,10
+DT3.1,CF,AEA,,5
+DT4.1,CF,PR,,-400
+DT4.1,CF,NIC,,280
+DT4.1,CF,ACA,,10
+DT4.1,CF,AEA,,5
diff --git a/Files/900.TransactionalData/Actuals_CH_2021_3.csv b/Files/900.TransactionalData/Actuals_CH_2021_3.csv
new file mode 100644
index 00000000..d52bae26
--- /dev/null
+++ b/Files/900.TransactionalData/Actuals_CH_2021_3.csv
@@ -0,0 +1,62 @@
+@@Main,,,,
+ReportingNode,Year,Month,,
+CH,2021,3,,
+@@Actual,,,,
+DataNode,AocType,ValueType,AccidentYear,Value
+DT1.1,WO,PayablePR,,-4
+DT1.1,WO,ReceivablePR,,2
+DT1.1,CF,PayablePR,,5
+DT1.1,CF,ReceivablePR,,-3
+DT1.1,CF,PR,,-90
+DT1.1,CF,ICO,,6
+DT1.1,CF,NIC,,70
+DT1.1,CF,ACA,,10
+DT1.1,CF,AEA,,5
+DT1.2,CF,NIC,2020,76
+DT1.3,WO,PayablePR,,-4
+DT1.3,WO,ReceivablePR,,2
+DT1.3,CF,PayablePR,,5
+DT1.3,CF,ReceivablePR,,-3
+DT1.3,CF,PR,,-90
+DT1.3,CF,ICO,,6
+DT1.3,CF,NIC,,70
+DT1.3,CF,ACA,,10
+DT1.3,CF,AEA,,5
+DT2.1,WO,PayablePR,,-4
+DT2.1,WO,ReceivablePR,,2
+DT2.1,CF,PayablePR,,5
+DT2.1,CF,ReceivablePR,,-3
+DT2.1,CF,PR,,-90
+DT2.1,CF,ICO,,6
+DT2.1,CF,NIC,,70
+DT2.1,CF,ACA,,10
+DT2.1,CF,AEA,,5
+DT2.2,CF,NIC,2020,76
+DTR1.1,CF,PayablePR,,-2
+DTR1.1,CF,ReceivablePR,,1.5
+DTR1.1,CF,PR,,45
+DTR1.1,CF,NIC,,-35
+DTR1.2,CF,NIC,2020,-35
+DTR2.1,CF,PayablePR,,-2
+DTR2.1,CF,ReceivablePR,,1.5
+DTR2.1,CF,PR,,45
+DTR2.1,CF,NIC,,-35
+DTR2.2,CF,NIC,2020,-35
+DT3.1,WO,PayablePR,,-4
+DT3.1,WO,ReceivablePR,,2
+DT3.1,CF,PayablePR,,5
+DT3.1,CF,ReceivablePR,,-3
+DT3.1,CF,PR,,-90
+DT3.1,CF,ICO,,6
+DT3.1,CF,NIC,,70
+DT3.1,CF,ACA,,10
+DT3.1,CF,AEA,,5
+DT4.1,WO,PayablePR,,-4
+DT4.1,WO,ReceivablePR,,2
+DT4.1,CF,PayablePR,,5
+DT4.1,CF,ReceivablePR,,-3
+DT4.1,CF,PR,,-90
+DT4.1,CF,ICO,,6
+DT4.1,CF,NIC,,70
+DT4.1,CF,ACA,,10
+DT4.1,CF,AEA,,5
diff --git a/Files/900.TransactionalData/NominalCashflows_CH_2020_12.csv b/Files/900.TransactionalData/NominalCashflows_CH_2020_12.csv
new file mode 100644
index 00000000..8808da31
--- /dev/null
+++ b/Files/900.TransactionalData/NominalCashflows_CH_2020_12.csv
@@ -0,0 +1,85 @@
+@@Main,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+ReportingNode,Year,Month,Scenario,,,,,,,,,,,,,,,,,,,,,,,,,
+CH,2020,12,,,,,,,,,,,,,,,,,,,,,,,,,,
+@@Cashflow,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+DataNode,AmountType,AocType,Novelty,AccidentYear,Values0,Values1,Values2,Values3,Values4,Values5,Values6,Values7,Values8,Values9,Values10,Values11,Values12,Values13,Values14,Values15,Values16,Values17,Values18,Values19,Values20,Values21,Values22,Values23
+DT1.1,PR,BOP,N,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT1.1,NIC,BOP,N,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT1.1,CU,BOP,N,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT1.1,RA,BOP,N,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT1.1,PR,CL,C,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT1.1,NIC,CL,C,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT1.1,CU,CL,C,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT1.1,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT1.2,NIC,BOP,N,2020,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT1.2,CU,BOP,N,2020,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT1.2,RA,BOP,N,2020,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT1.2,NIC,CL,C,2020,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT1.2,CU,CL,C,2020,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT1.2,RA,CL,C,2020,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT1.3,PR,BOP,N,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT1.3,NIC,BOP,N,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT1.3,CU,BOP,N,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT1.3,RA,BOP,N,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT1.3,PR,CL,C,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT1.3,NIC,CL,C,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT1.3,CU,CL,C,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT1.3,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT2.1,PR,BOP,N,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT2.1,NIC,BOP,N,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT2.1,CU,BOP,N,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT2.1,RA,BOP,N,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT2.1,PR,CL,C,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT2.1,NIC,CL,C,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT2.1,CU,CL,C,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT2.1,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT2.2,NIC,BOP,N,2020,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT2.2,CU,BOP,N,2020,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT2.2,RA,BOP,N,2020,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT2.2,NIC,CL,C,2020,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT2.2,CU,CL,C,2020,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT2.2,RA,CL,C,2020,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DTR1.1,PR,BOP,N,,50,0,0,50,0,0,50,0,0,50,0,0,0,50,0,0,50,0,0,50,0,0,50,0
+DTR1.1,NIC,BOP,N,,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5
+DTR1.1,CU,BOP,N,,5,5,5,5,5,5,5,5,5,5,5,5,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5
+DTR1.1,RA,BOP,N,,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25
+DTR1.1,PR,CL,C,,50,0,0,50,0,0,50,0,0,50,0,0,0,50,0,0,50,0,0,50,0,0,50,0
+DTR1.1,NIC,CL,C,,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5
+DTR1.1,CU,CL,C,,5,5,5,5,5,5,5,5,5,5,5,5,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5
+DTR1.1,RA,CL,C,,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25
+DTR1.2,NIC,BOP,N,2020,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5
+DTR1.2,CU,BOP,N,2020,5,5,5,5,5,5,5,5,5,5,5,5,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5
+DTR1.2,RA,BOP,N,2020,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25
+DTR1.2,NIC,CL,C,2020,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5
+DTR1.2,CU,CL,C,2020,5,5,5,5,5,5,5,5,5,5,5,5,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5
+DTR1.2,RA,CL,C,2020,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25
+DTR2.1,PR,BOP,N,,50,0,0,50,0,0,50,0,0,50,0,0,0,50,0,0,50,0,0,50,0,0,50,0
+DTR2.1,NIC,BOP,N,,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5
+DTR2.1,CU,BOP,N,,5,5,5,5,5,5,5,5,5,5,5,5,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5
+DTR2.1,RA,BOP,N,,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25
+DTR2.1,PR,CL,C,,50,0,0,50,0,0,50,0,0,50,0,0,0,50,0,0,50,0,0,50,0,0,50,0
+DTR2.1,NIC,CL,C,,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5
+DTR2.1,CU,CL,C,,5,5,5,5,5,5,5,5,5,5,5,5,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5
+DTR2.1,RA,CL,C,,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25
+DTR2.2,NIC,BOP,N,2020,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5
+DTR2.2,CU,BOP,N,2020,5,5,5,5,5,5,5,5,5,5,5,5,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5
+DTR2.2,RA,BOP,N,2020,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25
+DTR2.2,NIC,CL,C,2020,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5,-12.5
+DTR2.2,CU,CL,C,2020,5,5,5,5,5,5,5,5,5,5,5,5,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5
+DTR2.2,RA,CL,C,2020,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25
+DT3.1,PR,BOP,N,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT3.1,NIC,BOP,N,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT3.1,CU,BOP,N,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT3.1,RA,BOP,N,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT3.1,PR,CL,C,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT3.1,NIC,CL,C,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT3.1,CU,CL,C,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT3.1,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT4.1,PR,BOP,N,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT4.1,NIC,BOP,N,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT4.1,CU,BOP,N,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT4.1,RA,BOP,N,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
+DT4.1,PR,CL,C,,-100,0,0,-100,0,0,-100,0,0,-100,0,0,0,-100,0,0,-100,0,0,-100,0,0,-100,0
+DT4.1,NIC,CL,C,,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
+DT4.1,CU,CL,C,,10,10,10,10,10,10,10,10,10,10,10,10,10,5,5,5,5,5,5,5,5,5,5,3
+DT4.1,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5
diff --git a/Files/900.TransactionalData/NominalCashflows_CH_2021_3.csv b/Files/900.TransactionalData/NominalCashflows_CH_2021_3.csv
new file mode 100644
index 00000000..7bd3bdce
--- /dev/null
+++ b/Files/900.TransactionalData/NominalCashflows_CH_2021_3.csv
@@ -0,0 +1,158 @@
+@@Main,,,,,,,,,,,,,,,,,,,,,,,,,
+ReportingNode,Year,Month,,,,,,,,,,,,,,,,,,,,,,,
+CH,2021,3,,,,,,,,,,,,,,,,,,,,,,,
+@@Cashflow,,,,,,,,,,,,,,,,,,,,,,,,,
+DataNode,AmountType,AocType,Novelty,AccidentYear,Values0,Values1,Values2,Values3,Values4,Values5,Values6,Values7,Values8,Values9,Values10,Values11,Values12,Values13,Values14,Values15,Values16,Values17,Values18,Values19,Values20
+DT1.1,PR,MC,I,,0,-110,0,0,-110,0,0,-110,0,0,-110,0,0,0,0,0,0,0,0,0,0
+DT1.1,NIC,MC,I,,20,20,20,20,20,20,20,20,20,20,20,20,0,0,0,0,0,0,0,0,0
+DT1.1,CU,MC,I,,10,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0,0,0,0,0,0
+DT1.1,RA,MC,I,,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0
+DT1.1,PR,BOP,N,,0,-10,0,0,-10,0,0,-10,0,0,-10,0,0,0,0,0,0,0,0,0,0
+DT1.1,ICO,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.1,NIC,BOP,N,,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0
+DT1.1,RA,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.1,PR,EV,N,,0,-5,0,0,-5,0,0,-5,0,0,-5,0,0,0,0,0,0,0,0,0,0
+DT1.1,ICO,EV,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.1,NIC,EV,N,,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,0,0
+DT1.1,RA,EV,N,,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0,0,0,0,0,0,0,0,0
+DT1.1,PR,CL,C,,0,-115,0,0,-115,0,0,-115,0,0,-115,0,0,0,0,0,0,0,0,0,0
+DT1.1,ICO,CL,C,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.1,NIC,CL,C,,29,29,29,29,29,29,29,29,29,29,29,29,0,0,0,0,0,0,0,0,0
+DT1.1,CU,CL,C,,15,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0
+DT1.1,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,0,0,0,0,0,0,0,0,0
+DT1.2,NIC,MC,I,2020,20,20,20,20,20,20,20,20,20,20,20,20,0,0,0,0,0,0,0,0,0
+DT1.2,CU,MC,I,2020,10,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0,0,0,0,0,0
+DT1.2,RA,MC,I,2020,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0
+DT1.2,NIC,BOP,N,2020,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0
+DT1.2,RA,BOP,N,2020,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.2,NIC,EV,N,2020,10,10,10,10,10,10,10,10,10,10,10,10,0,0,0,0,0,0,0,0,0
+DT1.2,RA,EV,N,2020,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0,0,0,0,0,0,0,0,0
+DT1.2,NIC,CL,C,2020,30,30,30,30,30,30,30,30,30,30,30,30,0,0,0,0,0,0,0,0,0
+DT1.2,CU,CL,C,2020,15,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0
+DT1.2,RA,CL,C,2020,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,0,0,0,0,0,0,0,0,0
+DT1.3,PR,MC,I,,0,-110,0,0,-110,0,0,-110,0,0,-110,0,0,0,0,0,0,0,0,0,0
+DT1.3,NIC,MC,I,,20,20,20,20,20,20,20,20,20,20,20,20,0,0,0,0,0,0,0,0,0
+DT1.3,CU,MC,I,,10,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0,0,0,0,0,0
+DT1.3,RA,MC,I,,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0
+DT1.3,PR,BOP,N,,0,-10,0,0,-10,0,0,-10,0,0,-10,0,0,0,0,0,0,0,0,0,0
+DT1.3,ICO,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.3,NIC,BOP,N,,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0
+DT1.3,RA,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.3,PR,EV,N,,0,-5,0,0,-5,0,0,-5,0,0,-5,0,0,0,0,0,0,0,0,0,0
+DT1.3,ICO,EV,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.3,NIC,EV,N,,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,0,0
+DT1.3,RA,EV,N,,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0,0,0,0,0,0,0,0,0
+DT1.3,PR,CL,C,,0,-115,0,0,-115,0,0,-115,0,0,-115,0,0,0,0,0,0,0,0,0,0
+DT1.3,ICO,CL,C,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT1.3,NIC,CL,C,,29,29,29,29,29,29,29,29,29,29,29,29,0,0,0,0,0,0,0,0,0
+DT1.3,CU,CL,C,,15,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0
+DT1.3,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,0,0,0,0,0,0,0,0,0
+DT2.1,PR,MC,I,,0,-110,0,0,-110,0,0,-110,0,0,-110,0,0,0,0,0,0,0,0,0,0
+DT2.1,NIC,MC,I,,20,20,20,20,20,20,20,20,20,20,20,20,0,0,0,0,0,0,0,0,0
+DT2.1,CU,MC,I,,10,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0,0,0,0,0,0
+DT2.1,RA,MC,I,,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0
+DT2.1,PR,BOP,N,,0,-10,0,0,-10,0,0,-10,0,0,-10,0,0,0,0,0,0,0,0,0,0
+DT2.1,ICO,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT2.1,NIC,BOP,N,,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0
+DT2.1,RA,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT2.1,PR,EV,N,,0,-5,0,0,-5,0,0,-5,0,0,-5,0,0,0,0,0,0,0,0,0,0
+DT2.1,ICO,EV,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT2.1,NIC,EV,N,,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,0,0
+DT2.1,RA,EV,N,,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0,0,0,0,0,0,0,0,0
+DT2.1,PR,CL,C,,0,-115,0,0,-115,0,0,-115,0,0,-115,0,0,0,0,0,0,0,0,0,0
+DT2.1,ICO,CL,C,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT2.1,NIC,CL,C,,29,29,29,29,29,29,29,29,29,29,29,29,0,0,0,0,0,0,0,0,0
+DT2.1,CU,CL,C,,15,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0
+DT2.1,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,0,0,0,0,0,0,0,0,0
+DT2.2,NIC,MC,I,2020,20,20,20,20,20,20,20,20,20,20,20,20,0,0,0,0,0,0,0,0,0
+DT2.2,CU,MC,I,2020,10,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0,0,0,0,0,0
+DT2.2,RA,MC,I,2020,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0
+DT2.2,NIC,BOP,N,2020,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0
+DT2.2,RA,BOP,N,2020,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT2.2,NIC,EV,N,2020,10,10,10,10,10,10,10,10,10,10,10,10,0,0,0,0,0,0,0,0,0
+DT2.2,RA,EV,N,2020,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0,0,0,0,0,0,0,0,0
+DT2.2,NIC,CL,C,2020,30,30,30,30,30,30,30,30,30,30,30,30,0,0,0,0,0,0,0,0,0
+DT2.2,CU,CL,C,2020,15,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0
+DT2.2,RA,CL,C,2020,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,0,0,0,0,0,0,0,0,0
+DTR1.1,PR,MC,I,,0,55,0,0,55,0,0,55,0,0,55,0,0,0,0,0,0,0,0,0,0
+DTR1.1,NIC,MC,I,,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,0,0,0,0,0,0,0,0,0
+DTR1.1,CU,MC,I,,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5,0,0,0,0,0,0,0,0,0
+DTR1.1,RA,MC,I,,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0
+DTR1.1,PR,BOP,N,,0,5,0,0,5,0,0,5,0,0,5,0,0,0,0,0,0,0,0,0,0
+DTR1.1,NIC,BOP,N,,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,0,0,0,0,0,0,0,0,0
+DTR1.1,RA,BOP,N,,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0,0,0,0,0,0,0,0,0
+DTR1.1,PR,EV,N,,0,2.5,0,0,2.5,0,0,2.5,0,0,2.5,0,0,0,0,0,0,0,0,0,0
+DTR1.1,NIC,EV,N,,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,0,0,0,0,0,0,0,0,0
+DTR1.1,RA,EV,N,,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,0,0,0,0,0,0,0,0,0
+DTR1.1,PR,CL,C,,0,57.5,0,0,57.5,0,0,57.5,0,0,57.5,0,0,0,0,0,0,0,0,0,0
+DTR1.1,NIC,CL,C,,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,0,0,0,0,0,0,0,0,0
+DTR1.1,CU,CL,C,,7.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,2.5,0,0,0,0,0,0,0,0,0
+DTR1.1,RA,CL,C,,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,0,0,0,0,0,0,0,0,0
+DTR1.2,NIC,MC,I,2020,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,0,0,0,0,0,0,0,0,0
+DTR1.2,CU,MC,I,2020,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5,0,0,0,0,0,0,0,0,0
+DTR1.2,RA,MC,I,2020,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0
+DTR1.2,NIC,BOP,N,2020,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,0,0,0,0,0,0,0,0,0
+DTR1.2,RA,BOP,N,2020,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0,0,0,0,0,0,0,0,0
+DTR1.2,NIC,EV,N,2020,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,0,0,0,0,0,0,0,0,0
+DTR1.2,RA,EV,N,2020,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,0,0,0,0,0,0,0,0,0
+DTR1.2,NIC,CL,C,2020,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,0,0,0,0,0,0,0,0,0
+DTR1.2,CU,CL,C,2020,7.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,2.5,0,0,0,0,0,0,0,0,0
+DTR1.2,RA,CL,C,2020,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,0,0,0,0,0,0,0,0,0
+DTR2.1,PR,MC,I,,0,55,0,0,55,0,0,55,0,0,55,0,0,0,0,0,0,0,0,0,0
+DTR2.1,NIC,MC,I,,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,0,0,0,0,0,0,0,0,0
+DTR2.1,CU,MC,I,,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5,0,0,0,0,0,0,0,0,0
+DTR2.1,RA,MC,I,,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0
+DTR2.1,PR,BOP,N,,0,5,0,0,5,0,0,5,0,0,5,0,0,0,0,0,0,0,0,0,0
+DTR2.1,NIC,BOP,N,,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,0,0,0,0,0,0,0,0,0
+DTR2.1,RA,BOP,N,,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0,0,0,0,0,0,0,0,0
+DTR2.1,PR,EV,N,,0,2.5,0,0,2.5,0,0,2.5,0,0,2.5,0,0,0,0,0,0,0,0,0,0
+DTR2.1,NIC,EV,N,,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,0,0,0,0,0,0,0,0,0
+DTR2.1,RA,EV,N,,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,0,0,0,0,0,0,0,0,0
+DTR2.1,PR,CL,C,,0,57.5,0,0,57.5,0,0,57.5,0,0,57.5,0,0,0,0,0,0,0,0,0,0
+DTR2.1,NIC,CL,C,,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,0,0,0,0,0,0,0,0,0
+DTR2.1,CU,CL,C,,7.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,2.5,0,0,0,0,0,0,0,0,0
+DTR2.1,RA,CL,C,,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,0,0,0,0,0,0,0,0,0
+DTR2.2,NIC,MC,I,2020,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,0,0,0,0,0,0,0,0,0
+DTR2.2,CU,MC,I,2020,5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,1.5,0,0,0,0,0,0,0,0,0
+DTR2.2,RA,MC,I,2020,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,0
+DTR2.2,NIC,BOP,N,2020,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,-2.5,0,0,0,0,0,0,0,0,0
+DTR2.2,RA,BOP,N,2020,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0,0,0,0,0,0,0,0,0
+DTR2.2,NIC,EV,N,2020,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,0,0,0,0,0,0,0,0,0
+DTR2.2,RA,EV,N,2020,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,-0.25,0,0,0,0,0,0,0,0,0
+DTR2.2,NIC,CL,C,2020,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,-15,0,0,0,0,0,0,0,0,0
+DTR2.2,CU,CL,C,2020,7.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,3.5,2.5,0,0,0,0,0,0,0,0,0
+DTR2.2,RA,CL,C,2020,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,-1.25,0,0,0,0,0,0,0,0,0
+DT3.1,PR,MC,I,,0,-110,0,0,-110,0,0,-110,0,0,-110,0,0,0,0,0,0,0,0,0,0
+DT3.1,NIC,MC,I,,20,20,20,20,20,20,20,20,20,20,20,20,0,0,0,0,0,0,0,0,0
+DT3.1,CU,MC,I,,10,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0,0,0,0,0,0
+DT3.1,RA,MC,I,,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0
+DT3.1,PR,BOP,N,,0,-10,0,0,-10,0,0,-10,0,0,-10,0,0,0,0,0,0,0,0,0,0
+DT3.1,ICO,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT3.1,NIC,BOP,N,,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0
+DT3.1,RA,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT3.1,PR,EV,N,,0,-5,0,0,-5,0,0,-5,0,0,-5,0,0,0,0,0,0,0,0,0,0
+DT3.1,ICO,EV,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT3.1,NIC,EV,N,,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,0,0
+DT3.1,RA,EV,N,,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0,0,0,0,0,0,0,0,0
+DT3.1,PR,CL,C,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+DT3.1,ICO,CL,C,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+DT3.1,NIC,CL,C,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+DT3.1,CU,CL,C,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+DT3.1,RA,CL,C,,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+DT4.1,PR,MC,I,,0,-110,0,0,-110,0,0,-110,0,0,-110,0,0,0,0,0,0,0,0,0,0
+DT4.1,NIC,MC,I,,20,20,20,20,20,20,20,20,20,20,20,20,0,0,0,0,0,0,0,0,0
+DT4.1,CU,MC,I,,10,5,5,5,5,5,5,5,5,5,5,3,0,0,0,0,0,0,0,0,0
+DT4.1,RA,MC,I,,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0
+DT4.1,PR,BOP,N,,0,-20,0,0,-20,0,0,-20,0,0,-20,0,0,0,0,0,0,0,0,0,0
+DT4.1,ICO,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT4.1,NIC,BOP,N,,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0
+DT4.1,RA,BOP,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT4.1,PR,EV,N,,0,-33,0,0,-33,0,0,-33,0,0,-33,0,0,0,0,0,0,0,0,0,0
+DT4.1,ICO,EV,N,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT4.1,NIC,EV,N,,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,0,0,0,0,0,0
+DT4.1,RA,EV,N,,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0,0,0,0,0,0,0,0,0
+DT4.1,PR,CL,C,,0,-143,0,0,-143,0,0,-143,0,0,-143,0,0,0,0,0,0,0,0,0,0
+DT4.1,ICO,CL,C,,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
+DT4.1,NIC,CL,C,,29,29,29,29,29,29,29,29,29,29,29,29,0,0,0,0,0,0,0,0,0
+DT4.1,CU,CL,C,,15,7,7,7,7,7,7,7,7,7,7,5,0,0,0,0,0,0,0,0,0
+DT4.1,RA,CL,C,,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,0,0,0,0,0,0,0,0,0
diff --git a/Files/900.TransactionalData/Openings_CH_2020_12.csv b/Files/900.TransactionalData/Openings_CH_2020_12.csv
new file mode 100644
index 00000000..b52ac64c
--- /dev/null
+++ b/Files/900.TransactionalData/Openings_CH_2020_12.csv
@@ -0,0 +1,8 @@
+@@Main,,,,
+ReportingNode,Year,Month,,
+CH,2020,12,,
+@@Opening,,,,
+DataNode,EstimateType,AmountType,AccidentYear,Value
+DT3.1,C,,,72.2
+DT3.1,AA,PR,,1.5
+DT3.1,OA,PR,,-1.5
diff --git a/Files/DimensionsAndPartitions.csv b/Files/DimensionsAndPartitions.csv
new file mode 100644
index 00000000..80f592bd
--- /dev/null
+++ b/Files/DimensionsAndPartitions.csv
@@ -0,0 +1,259 @@
+@@PvAmountType,,,,,,,,,,,
+SystemName,DisplayName,Parent,Order,PeriodType,ExternalId0,ExternalId1,,,,,
+PR,Premiums,,10,BeginningOfPeriod,PayablePR,ReceivablePR,,,,,
+CL,Claims,,20,EndOfPeriod,,,,,,,
+NIC,Non Investment Component,CL,30,EndOfPeriod,PayableNIC,ReceivableNIC,,,,,
+ICO,Investment Component,CL,40,EndOfPeriod,PayableICO,ReceivableICO,,,,,
+CDR,Credit Default Risk,CL,50,EndOfPeriod,,,,,,,
+CE,Claim Expenses,CL,200,EndOfPeriod,,,,,,,
+ALE,Allocated Loss Adjustment Expenses,CE,210,EndOfPeriod,,,,,,,
+ULE,Unallocated Loss Adjustment Expenses,CE,220,EndOfPeriod,,,,,,,
+AE,Attributable Expenses,,80,BeginningOfPeriod,,,,,,,
+AEA,Aquisition,AE,90,BeginningOfPeriod,,,,,,,
+AEM,Maintenance,AE,100,BeginningOfPeriod,,,,,,,
+NE,Non Attributable Expenses,,110,BeginningOfPeriod,,,,,,,
+AC,Attributable Commission,,120,BeginningOfPeriod,,,,,,,
+ACA,Aquisition,AC,130,BeginningOfPeriod,,,,,,,
+ACM,Maitenance,AC,140,BeginningOfPeriod,,,,,,,
+,,,,,,,,,,,
+@@DeferrableAmountType,,,,,,,,,,,
+SystemName,DisplayName,Parent,Order,PeriodType,,,,,,,
+DE,Deferrals,,10,EndOfPeriod,,,,,,,
+DAE,Aquisition Expenses,DE,20,EndOfPeriod,,,,,,,
+,,,,,,,,,,,
+@@AocType,,,,,,,,,,,
+SystemName,DisplayName,Parent,Order,,,,,,,,
+BOP,Opening Balance,,10,,,,,,,,
+MC,Model Correction,,20,,,,,,,,
+PC,Portfolio Changes,,30,,,,,,,,
+RCU,Reinsurance Coverage Update,PC,40,,,,,,,,
+CF,Cash flow,,50,,,,,,,,
+IA,Interest Accretion,,60,,,,,,,,
+AU,Assumption Update,,70,,,,,,,,
+FAU,Financial Assumption Update,,80,,,,,,,,
+YCU,Yield Curve Update,FAU,90,,,,,,,,
+CRU,Credit Risk Update,FAU,100,,,,,,,,
+EV,Experience Variance,,110,,,,,,,,
+WO,Write-Off,,120,,,,,,,,
+CL,Combined Liabilities,,130,,,,,,,,
+EA,Experience Adjustment,,140,,,,,,,,
+AM,Amortization,,150,,,,,,,,
+FX,FX Impact,,160,,,,,,,,
+EOP,Closing Balance,,170,,,,,,,,
+,,,,,,,,,,,
+@@AocConfiguration,,,,,,,,,,,
+AocType,Novelty,DataType,InputSource,FxPeriod,YcPeriod,CdrPeriod,ValuationPeriod,RcPeriod,Order,Year,Month
+BOP,I,Optional,7,BeginningOfPeriod,BeginningOfPeriod,BeginningOfPeriod,BeginningOfPeriod,BeginningOfPeriod,10,1900,1
+MC,I,Optional,4,BeginningOfPeriod,BeginningOfPeriod,BeginningOfPeriod,BeginningOfPeriod,BeginningOfPeriod,20,1900,1
+RCU,I,Calculated,4,BeginningOfPeriod,BeginningOfPeriod,BeginningOfPeriod,BeginningOfPeriod,EndOfPeriod,30,1900,1
+CF,I,Calculated,4,Average,NotApplicable,BeginningOfPeriod,Delta,EndOfPeriod,40,1900,1
+IA,I,Calculated,5,Average,BeginningOfPeriod,BeginningOfPeriod,Delta,EndOfPeriod,50,1900,1
+AU,I,Optional,4,EndOfPeriod,BeginningOfPeriod,BeginningOfPeriod,EndOfPeriod,EndOfPeriod,60,1900,1
+YCU,I,CalculatedTelescopic,4,EndOfPeriod,EndOfPeriod,BeginningOfPeriod,EndOfPeriod,EndOfPeriod,70,1900,1
+CRU,I,CalculatedTelescopic,4,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,80,1900,1
+EV,I,Optional,4,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,90,1900,1
+BOP,N,Optional,4,Average,EndOfPeriod,EndOfPeriod,BeginningOfPeriod,EndOfPeriod,100,1900,1
+CF,N,Calculated,4,Average,NotApplicable,EndOfPeriod,Delta,EndOfPeriod,110,1900,1
+IA,N,Calculated,4,Average,EndOfPeriod,EndOfPeriod,Delta,EndOfPeriod,120,1900,1
+AU,N,Optional,4,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,130,1900,1
+EV,N,Optional,4,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,140,1900,1
+CF,C,Optional,2,Average,NotApplicable,NotApplicable,NotApplicable,NotApplicable,160,1900,1
+WO,C,Optional,2,Average,NotApplicable,NotApplicable,NotApplicable,NotApplicable,170,1900,1
+CL,C,Mandatory,4,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,180,1900,1
+EA,C,Calculated,4,EndOfPeriod,NotApplicable,NotApplicable,NotApplicable,EndOfPeriod,190,1900,1
+AM,C,Calculated,6,EndOfPeriod,NotApplicable,NotApplicable,NotApplicable,EndOfPeriod,200,1900,1
+FX,C,Calculated,0,NotApplicable,NotApplicable,NotApplicable,NotApplicable,NotApplicable,210,1900,1
+EOP,C,Calculated,6,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,EndOfPeriod,220,1900,1
+,,,,,,,,,,,
+@@CalculationType,,,,,,,,,,,
+SystemName,DisplayName,PeriodType,Order,,,,,,,,
+BE,Best Estimate,EndOfPeriod,10,,,,,,,,
+RA,Risk Adjustment,EndOfPeriod,20,,,,,,,,
+CU,Coverage Unit,EndOfPeriod,30,,,,,,,,
+,,,,,,,,,,,
+@@CreditRiskRating,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+AAA,AAA,,,,,,,,,,
+AA+,AA+,,,,,,,,,,
+AA,AA,,,,,,,,,,
+AA-,AA-,,,,,,,,,,
+A+,A+,,,,,,,,,,
+A,A,,,,,,,,,,
+A-,A-,,,,,,,,,,
+BBB+,BBB+,,,,,,,,,,
+BBB,BBB,,,,,,,,,,
+BBB-,BBB-,,,,,,,,,,
+BB+,BB+,,,,,,,,,,
+BB,BB,,,,,,,,,,
+BB-,BB-,,,,,,,,,,
+B+,B+,,,,,,,,,,
+B,B,,,,,,,,,,
+B-,B-,,,,,,,,,,
+CCC+,CCC+,,,,,,,,,,
+CCC,CCC,,,,,,,,,,
+CCC-,CCC-,,,,,,,,,,
+CC,CC,,,,,,,,,,
+C,C,,,,,,,,,,
+I,I,,,,,,,,,,
+,,,,,,,,,,,
+@@Currency,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+USD,United States Dollar,,,,,,,,,,
+CHF,Swiss Franc,,,,,,,,,,
+DKK,Danish Krone,,,,,,,,,,
+EUR,Euro,,,,,,,,,,
+GBP,British Pound,,,,,,,,,,
+HKD,Hong Kong Dollar,,,,,,,,,,
+ITL,Italian Lira,,,,,,,,,,
+PLN,Polish Zloty (since 01.01.95),,,,,,,,,,
+SKK,Slovakian Krona,,,,,,,,,,
+,,,,,,,,,,,
+@@EconomicBasis,,,,,,,,,,,
+SystemName,DisplayName,Order,,,,,,,,,
+N,Nominal,1,,,,,,,,,
+L,Locked-in,10,,,,,,,,,
+C,Current,20,,,,,,,,,
+,,,,,,,,,,,
+@@EstimateType,,,,,,,,,,,
+SystemName,DisplayName,Order,StructureType,InputSource,ExternalId0,ExternalId1,ExternalId2,,,,
+BE,Best Estimate of Present Value,1,AoC,4,,,,,,,
+RA,Risk Adjustment,10,AoC,4,,,,,,,
+C,Contractual Service Margin,20,AoC,7,,,,,,,
+L,Loss Component,30,AoC,7,,,,,,,
+LR,Loss Recovery Component,40,AoC,7,,,,,,,
+PL,Profit and Loss,50,None,7,,,,,,,
+AA,Advance Actuals,60,AoC,3,PayablePR,ReceivableNIC,ReceivableICO,,,,
+OA,Overdue Actuals,70,AoC,3,ReceivablePR,PayableNIC,PayableICO,,,,
+DA,Deferrable Actuals,80,AoC,3,,,,,,,
+A,Actuals,90,None,2,,,,,,,
+F,Factors,100,None,4,,,,,,,
+AAPA,Advance Actuals,110,None,2,,,,,,,
+OAPA,Overdue Actuals,120,None,2,,,,,,,
+APA,Actuals,130,None,2,,,,,,,
+BEPA,Best Estimate of Present Value,140,None,4,,,,,,,
+,,,,,,,,,,,
+@@LiabilityType,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+LRC,Liability for Remaining Coverage,,,,,,,,,,
+LIC,Liabilities for Incurred Claims,,,,,,,,,,
+,,,,,,,,,,,
+@@LineOfBusiness,,,,,,,,,,,
+SystemName,DisplayName,Parent,,,,,,,,,
+M,Multiline Life and Non-Life,,,,,,,,,,
+LI,Life,M,,,,,,,,,
+NL,Non-Life,M,,,,,,,,,
+LIA,Liability,NL,,,,,,,,,
+MAE,"Marine, Aviation & Energy",NL,,,,,,,,,
+MOT,Motor,NL,,,,,,,,,
+NAH,Non-Life Accident & Health,NL,,,,,,,,,
+PEA,"Property, Engineering & Agriculture",NL,,,,,,,,,
+ONL,Other Non-Life,NL,,,,,,,,,
+ANN,Annuity,LI,,,,,,,,,
+DIS,Disability,LI,,,,,,,,,
+END,Endowment,LI,,,,,,,,,
+HYB,Hybrid,LI,,,,,,,,,
+ULI,Unit Linked,LI,,,,,,,,,
+OLI,Other Life,LI,,,,,,,,,
+,,,,,,,,,,,
+@@Novelty,,,,,,,,,,,
+SystemName,DisplayName,Order,,,,,,,,,
+I,In Force,1,,,,,,,,,
+N,New Business,10,,,,,,,,,
+C,Combined,20,,,,,,,,,
+,,,,,,,,,,,
+@@OciType,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+Default,Default,,,,,,,,,,
+,,,,,,,,,,,
+@@Partner,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+PT1,Partner1,,,,,,,,,,
+,,,,,,,,,,,
+@@BsVariableType,,,,,,,,,,,
+SystemName,DisplayName,Parent,Order,,,,,,,,
+D,Changes in Balance,,10,,,,,,,,
+,,,,,,,,,,,
+@@PnlVariableType,,,,,,,,,,,
+SystemName,DisplayName,Parent,Order,,,,,,,,
+TCI,Total Comprehensive Income,,0,,,,,,,,
+PNL,Profit and Loss,TCI,1,,,,,,,,
+OCI,Other Comprehensive Income,TCI,2,,,,,,,,
+ISR,Insurance Service Result,PNL,3,,,,,,,,
+IR,Insurance Revenue,ISR,4,,,,,,,,
+IR1,Premiums,IR,5,,,,,,,,
+IR2,Exc. Investment Components,IR,6,,,,,,,,
+IR3,CSM Amortization,IR,7,,,,,,,,
+IR4,Acquistion Expenses Amortization,IR,8,,,,,,,,
+IR5,Non-Financial LRC Changes (Exc. CSM Amortization),IR,9,,,,,,,,
+IR6,Exc. Experience Adjustment on Premiums,IR,10,,,,,,,,
+ISE,Insurance Service Expense,ISR,11,,,,,,,,
+ISE1,Reinsurance Premiums,ISE,12,,,,,,,,
+ISE2,Claims,ISE,13,,,,,,,,
+ISE3,Expenses,ISE,14,,,,,,,,
+ISE4,Commissions,ISE,15,,,,,,,,
+ISE5,Exc. Investment Components,ISE,16,,,,,,,,
+ISE6,Acquisition Expenses,ISE,17,,,,,,,,
+ISE7,Reinsurance CSM Amortization,ISE,18,,,,,,,,
+ISE8,LoReCo Release,ISE,19,,,,,,,,
+ISE9,Loss Component Release,ISE,20,,,,,,,,
+ISE10,Non-Financial Reinsurance LRC Changes (Exc. LC/LoReCo),ISE,21,,,,,,,,
+ISE11,Loss Component / LoReCo Changes (Exc. Releases),ISE,22,,,,,,,,
+ISE12,Non Financial LIC Changes,ISE,23,,,,,,,,
+IFIE,Insurance Finance Income/Expense,PNL,24,,,,,,,,
+IFIE1,Financial LRC Changes,IFIE,25,,,,,,,,
+IFIE2,Financial LIC Changes,IFIE,26,,,,,,,,
+OCI1,Financial LRC Changes,OCI,27,,,,,,,,
+OCI2,Financial LIC Changes,OCI,28,,,,,,,,
+,,,,,,,,,,,
+@@Profitability,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+O,Onerous,,,,,,,,,,
+P,Profitabile,,,,,,,,,,
+U,Undetermined,,,,,,,,,,
+,,,,,,,,,,,
+@@RiskDriver,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+Default,Default,,,,,,,,,,
+,,,,,,,,,,,
+@@Scenario,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+BE,Best Estimate,,,,,,,,,,
+,,,,,,,,,,,
+@@ValuationApproach,,,,,,,,,,,
+SystemName,DisplayName,,,,,,,,,,
+BBA,Building Block Approach,,,,,,,,,,
+,,,,,,,,,,,
+@@PartitionByReportingNode,,,,,,,,,,,
+ReportingNode,Id,,,,,,,,,,
+CH,00000000-0000-0000-0000-000000000001,,,,,,,,,,
+,,,,,,,,,,,
+@@PartitionByReportingNodeAndPeriod,,,,,,,,,,,
+ReportingNode,Year,Month,Id,,,,,,,,
+CH,2020,12,10000000-0000-0000-0000-000000000000,,,,,,,,
+CH,2021,3,20000000-0000-0000-0000-000000000000,,,,,,,,
+CH,2021,9,30000000-0000-0000-0000-000000000000,,,,,,,,
+CH,2021,12,35000000-0000-0000-0000-000000000000,,,,,,,,
+CH,2022,3,40000000-0000-0000-0000-000000000000,,,,,,,,
+,,,,,,,,,,,
+@@ProjectionConfiguration,,,,,,,,,,,
+SystemName,DisplayName,Shift,TimeStep,,,,,,,,
+P0,End of January,0,1,,,,,,,,
+P1,End of February,0,2,,,,,,,,
+P2,End of March,0,3,,,,,,,,
+P3,End of April,0,4,,,,,,,,
+P4,End of May,0,5,,,,,,,,
+P5,End of June,0,6,,,,,,,,
+P6,End of July,0,7,,,,,,,,
+P7,End of August,0,8,,,,,,,,
+P8,End of September,0,9,,,,,,,,
+P9,End of October,0,10,,,,,,,,
+P10,End of November,0,11,,,,,,,,
+P11,End of December,0,12,,,,,,,,
+P12,End of Year+1,12,12,,,,,,,,
+P13,End of Year+2,24,12,,,,,,,,
+P14,End of Year+3,36,12,,,,,,,,
+P15,End of Year+4,48,12,,,,,,,,
+P16,Year+5 to Year+10,60,60,,,,,,,,
+P17,Year+10 to Year+15,120,60,,,,,,,,
+P18,Year+15 to Year+20,180,60,,,,,,,,
+P19,Years Over +20,240,9999,,,,,,,,
diff --git a/Images/ActualFormat.png b/Images/ActualFormat.png
new file mode 100644
index 00000000..e055a0a7
Binary files /dev/null and b/Images/ActualFormat.png differ
diff --git a/Images/CashflowFormat.png b/Images/CashflowFormat.png
new file mode 100644
index 00000000..31288bdc
Binary files /dev/null and b/Images/CashflowFormat.png differ
diff --git a/Images/OpeningFormat.png b/Images/OpeningFormat.png
new file mode 100644
index 00000000..8bd3a0d7
Binary files /dev/null and b/Images/OpeningFormat.png differ
diff --git a/Images/SpecificationsCSM.PNG b/Images/SpecificationsCSM.PNG
new file mode 100644
index 00000000..a04d351d
Binary files /dev/null and b/Images/SpecificationsCSM.PNG differ
diff --git a/Images/SpecificationsImportActuals.PNG b/Images/SpecificationsImportActuals.PNG
new file mode 100644
index 00000000..7f3d5d05
Binary files /dev/null and b/Images/SpecificationsImportActuals.PNG differ
diff --git a/Images/SpecificationsImportCashflows.PNG b/Images/SpecificationsImportCashflows.PNG
new file mode 100644
index 00000000..bcb093c8
Binary files /dev/null and b/Images/SpecificationsImportCashflows.PNG differ
diff --git a/Images/SpecificationsPL.PNG b/Images/SpecificationsPL.PNG
new file mode 100644
index 00000000..2eb86dfe
Binary files /dev/null and b/Images/SpecificationsPL.PNG differ
diff --git a/Images/Systemorph_logo.png b/Images/Systemorph_logo.png
new file mode 100644
index 00000000..402f8cfb
Binary files /dev/null and b/Images/Systemorph_logo.png differ
diff --git a/Import/ImportResultPreview.ipynb b/Import/ImportResultPreview.ipynb
new file mode 100644
index 00000000..4b61bb94
--- /dev/null
+++ b/Import/ImportResultPreview.ipynb
@@ -0,0 +1,344 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "toc-autonumbering": "True",
+ "toc-showcode": "False",
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "9Q5yj6YN-EKdGXz1kK8Q6A",
+ "cell_type": "markdown",
+ "source": [
+ "# Temporary for debugging (initialize data and construct/initialize storage)"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "maDeKWCseEWbze58VbJlyw",
+ "cell_type": "code",
+ "source": [
+ "#!eval-notebook \"../Initialization/InitSystemorphToMemory\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "S2vYnVC3LUuldJH71p8jfA",
+ "cell_type": "code",
+ "source": [
+ "#!import \"../Test/SpecificationsSetup\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "BmCoR4B2rEuIBBIgZnqI1w",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\nGiven the current status of the implementation, in order to display Actual reports it is necessary to set Actual format in the Args while to display Cashflow it is necessary to set Cashflow format."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "trcP0qut1kWbOQTgIF35cg",
+ "cell_type": "code",
+ "source": [
+ "var year = 2021 ;",
+ "\nvar month = 3 ;",
+ "\nvar reportingNode = \"CH\" ;",
+ "\nvar economicBasis = \"L\" ;"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "2m1t-aisOEiw325jWesNXQ",
+ "cell_type": "code",
+ "source": [
+ "var UniversePreview = await StartCalculatorAsync(reportingNode, year, month, economicBasis, Periodicity.Quarterly, ImportFormats.Cashflow);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "AbkLGXiDFk6sdSdWtinXjA",
+ "cell_type": "code",
+ "source": [
+ "var importStorage = UniversePreview.GetStorage();"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "k9qNkaSwjUqp_Y_vGf9RwA",
+ "cell_type": "markdown",
+ "source": [
+ "# Import Preview"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "5EP-6YDPFkeMJcxDTaO7qw",
+ "cell_type": "markdown",
+ "source": [
+ "## Present Value"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "XTFLl2lau0SjbCIEtOTHpA",
+ "cell_type": "code",
+ "source": [
+ "var identities = UniversePreview.GetScopes(importStorage.DataNodesByImportScope[ImportScope.Primary]).SelectMany(s => s.Identities);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "yEjsrBVzEk26kz9jgLkJ-Q",
+ "cell_type": "code",
+ "source": [
+ "var pvs = UniversePreview.GetScopes(identities, o => o.WithStorage(importStorage)).SelectMany(x => x.PvCurrent.Concat(x.PvLocked));"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ck9xZbpeDUyh_Tw6FOoxKg",
+ "cell_type": "code",
+ "source": [
+ "Report",
+ "\n .ForObjects(pvs",
+ "\n //.Where(x => x.DataNode == \"DTR1.1\")",
+ "\n )",
+ "\n .WithQuerySource(Workspace)",
+ "\n .GroupColumnsBy(x => x.EconomicBasis)",
+ "\n //.GroupColumnsBy(x => x.AmountType)",
+ "\n .GroupColumnsBy(x => x.DataNode)",
+ "\n .GroupRowsBy(x => x.Novelty)",
+ "\n .GroupRowsBy(x => x.AocType)",
+ "\n //VariableType",
+ "\n //.GroupColumnsBy(x => x.DataNode)",
+ "\n //.GroupColumnsBy(x => x.Novelty)",
+ "\n .WithGridOptionsForIfrsVariable(720)",
+ "\n .ToReport()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "XIPJIPxfyEy6P4JYfRAXTA",
+ "cell_type": "markdown",
+ "source": [
+ "## Risk Adjustment"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "4bBaRnP3pE-ZbxPKKnxOCA",
+ "cell_type": "code",
+ "source": [
+ "var ras = UniversePreview.GetScopes(identities).SelectMany(x => x.RaCurrent.Concat(x.RaLocked));"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "AiOWaeI_Hku1SDbNB-xlXA",
+ "cell_type": "code",
+ "source": [
+ "Report",
+ "\n .ForObjects(ras)",
+ "\n .WithQuerySource(Workspace)",
+ "\n .GroupColumnsBy(x => x.EconomicBasis)",
+ "\n //.GroupRowsBy(x => x.DataNode)",
+ "\n .GroupRowsBy(x => x.Novelty)",
+ "\n .GroupRowsBy(x => x.AocType)",
+ "\n //VariableType",
+ "\n //.GroupColumnsBy(x => x.DataNode)",
+ "\n //.GroupColumnsBy(x => x.Novelty)",
+ "\n .WithGridOptionsForIfrsVariable()",
+ "\n .ToReport()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "rqCr51d6kUGgBzGRAqrtXw",
+ "cell_type": "markdown",
+ "source": [
+ "## Actuals"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "vl8E9tTAT06fpVUcTfflbg",
+ "cell_type": "code",
+ "source": [
+ "var actuals = UniversePreview.GetScopes(identities).SelectMany(x => x.Actual);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "hQUJ7t1AB0O-L0PVYPqsVw",
+ "cell_type": "code",
+ "source": [
+ "Report",
+ "\n .ForObjects(actuals)",
+ "\n .WithQuerySource(Workspace)",
+ "\n .GroupRowsBy(x => x.AmountType)",
+ "\n //.GroupColumnsBy(x => x.DataNode)",
+ "\n .WithGridOptionsForIfrsVariable(550)",
+ "\n .ToReport()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "nwWJHZ5vTUuJsHqFTGwLQw",
+ "cell_type": "markdown",
+ "source": [
+ "## Advance, Overdue Actuals"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "UYvTQnP0NUe4pLm0fnYEAA",
+ "cell_type": "code",
+ "source": [
+ "var aoActuals = UniversePreview.GetScopes(identities).SelectMany(x => x.AdvanceActual.Concat(x.OverdueActual));"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "1v6tcALrVEGG-vdRDV7HIQ",
+ "cell_type": "code",
+ "source": [
+ "Report",
+ "\n .ForObjects(aoActuals)",
+ "\n .WithQuerySource(Workspace)",
+ "\n .GroupColumnsBy(x => x.DataNode)",
+ "\n .GroupColumnsBy(x => x.EstimateType)",
+ "\n .GroupColumnsBy(x => x.AmountType)",
+ "\n .GroupRowsBy(x => x.AocType)",
+ "\n .WithGridOptionsForIfrsVariable(300)",
+ "\n .ToReport()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ab2P4J7DO0mkVrlsP09fhQ",
+ "cell_type": "markdown",
+ "source": [
+ "## Deferrable Actuals"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "KCZlxRFa10CYDduJ65KMHg",
+ "cell_type": "code",
+ "source": [
+ "var deferrableActuals = UniversePreview.GetScopes(identities).SelectMany(x => x.DeferrableActual);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "zln4EOOdqUiUTFbwoqTirw",
+ "cell_type": "code",
+ "source": [
+ "Report",
+ "\n .ForObjects(deferrableActuals)",
+ "\n .WithQuerySource(Workspace)",
+ "\n .GroupColumnsBy(x => x.DataNode)",
+ "\n .GroupRowsBy(x => x.AocType)",
+ "\n .WithGridOptionsForIfrsVariable(350)",
+ "\n .ToReport()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "l5uZz5MhKUOYLsKpzNZwvQ",
+ "cell_type": "markdown",
+ "source": [
+ "## Csm Lc LoReCo"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "WZ_xvxUBtEKO2jingfCpRQ",
+ "cell_type": "code",
+ "source": [
+ "var csm = UniversePreview.GetScopes(identities).SelectMany(x => x.Csms);",
+ "\nvar loss = UniversePreview.GetScopes(identities).SelectMany(x => x.Loss);",
+ "\nvar csmLcLoReCo = Enumerable.Empty().Concat(csm).Concat(loss);"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "RAN7qdbDLECNmb-kxUNx1A",
+ "cell_type": "code",
+ "source": [
+ "Report",
+ "\n .ForObjects(csmLcLoReCo",
+ "\n //.Where(x => x.DataNode == \"DT1.1\")",
+ "\n )",
+ "\n .WithQuerySource(Workspace)",
+ "\n .GroupColumnsBy(x => x.DataNode)",
+ "\n .GroupColumnsBy(x => x.EstimateType)",
+ "\n .GroupRowsBy(x => x.Novelty)",
+ "\n .GroupRowsBy(x => x.AocType)",
+ "\n .WithGridOptionsForIfrsVariable()",
+ "\n .ToReport()"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "GszVX-_KiEa9h0m0P0rlhQ",
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Import/ImportScopeCalculation.ipynb b/Import/ImportScopeCalculation.ipynb
new file mode 100644
index 00000000..2823aead
--- /dev/null
+++ b/Import/ImportScopeCalculation.ipynb
@@ -0,0 +1,2296 @@
+{
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "toc-autonumbering": "True",
+ "toc-showcode": "False",
+ "authors": [],
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "id": "a6wbTgZMQ0q5Of99FfYD-A",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n Import Scopes (IFRS17 Methodology Business Logic)
",
+ "\n",
+ "\nThis notebook contains the logic used to perform calculations upon import of data (actuals and cashflows). This is also called 'Data Loading' and the concept of Scope is used here to define the logic and provide the means of executing the logic."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "6qZO0vcpd0GtSc7GvLlgBQ",
+ "cell_type": "markdown",
+ "source": [
+ "# References",
+ "\nLibraries and other notebooks which are needed for this notebook are imported below."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "G75a3tlrBkqn_MN5as22Jw",
+ "cell_type": "markdown",
+ "source": [
+ "## Notebooks"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "HQwfAINEvUqJK5l5FV_SOg",
+ "cell_type": "code",
+ "source": [
+ "#!import \"ImportStorage\""
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "kd06OH9YcE2hGUtgERwXhA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n# Scopes",
+ "\nScopes are used to define and perform data handling in a structured and easy-to-read-through fashion.",
+ "\n",
+ "\nThe IModel interface below will be used to execute calculations (i.e. evaluate the scopes) based on imported data."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "3ye2s5-hWEWsy3YLTe5R-w",
+ "cell_type": "code",
+ "source": [
+ "public interface IModel : IMutableScopeWithStorage{}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "LjnVkU0bq0yP61Cb1_EMxA",
+ "cell_type": "markdown",
+ "source": [
+ "## Getting Existing Identities",
+ "\n",
+ "\nAn [Identity](../DataModel/DataStructure#import-identity) is a set of identifiers for a certain set of data. In particular, an identity consists of a certain [AoC Type](../DataModel/DataStructure#aoc-type), [Novelty](../DataModel/DataStructure#novelty), [Data Node](../DataModel/DataStructure#data-node), Accident Year, and information on whether the data is for reinsurance or not. ",
+ "\n",
+ "\nGiven a certain Data Node and Accident Year, the interface GetIdentities returns all the existing identities (e.g. for Actuals and Cashflows) which have that Data Node and Accident Year."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "SyhE8EzOsECEpMzUSS6kGQ",
+ "cell_type": "code",
+ "source": [
+ "public interface AllCfIdentities : IScope // string represents a DataNode",
+ "\n{",
+ "\n public IEnumerable ids => GetStorage().GetAllAocSteps(InputSource.Cashflow)",
+ "\n .Select(aocStep => new ImportIdentity {",
+ "\n AocType = aocStep.AocType,",
+ "\n Novelty = aocStep.Novelty,",
+ "\n DataNode = Identity",
+ "\n });",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "_LsQEeHMYE6G4pGS8dK4RQ",
+ "cell_type": "code",
+ "source": [
+ "public interface GetIdentities : IScope",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.GetStorage().IsSecondaryScope(x.Identity))",
+ "\n .WithApplicability(x => x.GetStorage().ImportFormat == ImportFormats.Actual)",
+ "\n .WithApplicability(x => x.GetStorage().ImportFormat == ImportFormats.Cashflow)",
+ "\n .WithApplicability(x => x.GetStorage().ImportFormat == ImportFormats.Opening)",
+ "\n );",
+ "\n ",
+ "\n private IEnumerable computedIdentities => new string[]{AocTypes.EA, AocTypes.AM, AocTypes.EOP}",
+ "\n .Select(aocType => new ImportIdentity {",
+ "\n AocType = aocType,",
+ "\n Novelty = Novelties.C,",
+ "\n DataNode = Identity",
+ "\n });",
+ "\n private IEnumerable allIdentities => ParsedIdentities.Concat(computedIdentities).Concat(SpecialIdentities).ToHashSet(); ",
+ "\n ",
+ "\n IEnumerable ParsedIdentities => Enumerable.Empty(); ",
+ "\n IEnumerable SpecialIdentities => Enumerable.Empty();",
+ "\n ",
+ "\n //Set DataNode properties and ProjectionPeriod",
+ "\n IEnumerable Identities => allIdentities.Select(id => id with { IsReinsurance = GetStorage().DataNodeDataBySystemName[id.DataNode].IsReinsurance,",
+ "\n ValuationApproach = GetStorage().DataNodeDataBySystemName[id.DataNode].ValuationApproach",
+ "\n });",
+ "\n /* .SelectMany(id => Enumerable.Range(0,GetStorage().GetProjectionCount() + 1)",
+ "\n .Select(pp => id with {ProjectionPeriod = pp })",
+ "\n );*/",
+ "\n}",
+ "\n",
+ "\npublic interface AllCashflowIdentities : GetIdentities",
+ "\n{",
+ "\n IEnumerable GetIdentities.SpecialIdentities => GetScope(Identity).ids;",
+ "\n}",
+ "\n",
+ "\n",
+ "\npublic interface GetActualIdentities : GetIdentities",
+ "\n{",
+ "\n private IEnumerable actualEstimateTypes => GetStorage().EstimateTypesByImportFormat[ImportFormats.Actual];",
+ "\n ",
+ "\n IEnumerable GetIdentities.ParsedIdentities => GetStorage().GetIfrsVariables(Identity).Where(iv => actualEstimateTypes.Contains(iv.EstimateType)).Select(v => new ImportIdentity(v));",
+ "\n IEnumerable GetIdentities.SpecialIdentities => GetScope(Identity).ids",
+ "\n .Concat(GetStorage().GetAllAocSteps(InputSource.Opening)",
+ "\n .Select(aocStep => new ImportIdentity {AocType = aocStep.AocType, ",
+ "\n Novelty = aocStep.Novelty,",
+ "\n DataNode = Identity",
+ "\n }));",
+ "\n}",
+ "\n",
+ "\npublic interface GetCashflowIdentities : GetIdentities",
+ "\n{",
+ "\n private bool isReinsurance => GetStorage().DataNodeDataBySystemName[Identity].IsReinsurance; //clean up in the next PR",
+ "\n ",
+ "\n IEnumerable GetIdentities.ParsedIdentities => GetStorage().GetRawVariables(Identity).Select(v => new ImportIdentity(v));",
+ "\n ",
+ "\n IEnumerable GetIdentities.SpecialIdentities => ParsedIdentities.Where(id => id.Novelty != Novelties.C)",
+ "\n .Select(id => id.Novelty).ToHashSet()",
+ "\n .SelectMany(n => (n == Novelties.N ",
+ "\n ? new string[]{AocTypes.IA, AocTypes.CF} //Add IA, CF, for New Business",
+ "\n : isReinsurance ",
+ "\n ? new string[]{AocTypes.IA, AocTypes.CF, AocTypes.YCU, AocTypes.CRU, AocTypes.RCU} //Add IA, CF, YCU, CRU, RCU for in force",
+ "\n : new string[]{AocTypes.IA, AocTypes.CF, AocTypes.YCU}) //Add IA, CF, YCU,",
+ "\n .Select(aocType => new ImportIdentity {",
+ "\n AocType = aocType,",
+ "\n Novelty = n,",
+ "\n DataNode = Identity }))",
+ "\n .Concat(new ImportIdentity {",
+ "\n AocType = AocTypes.CF, //Add CF for Deferral",
+ "\n Novelty = Novelties.C,",
+ "\n DataNode = Identity",
+ "\n }.RepeatOnce()) ",
+ "\n .Concat(GetStorage().GetAllAocSteps(InputSource.Opening)",
+ "\n .Select(aocStep => new ImportIdentity {AocType = aocStep.AocType, ",
+ "\n Novelty = aocStep.Novelty,",
+ "\n DataNode = Identity",
+ "\n })); ",
+ "\n}",
+ "\n",
+ "\npublic interface GetAllIdentities : GetIdentities",
+ "\n{",
+ "\n IEnumerable GetIdentities.SpecialIdentities => GetScope(Identity).ids",
+ "\n .Concat(GetStorage().GetAllAocSteps(InputSource.Actual)",
+ "\n .Select(aocStep => new ImportIdentity {AocType = aocStep.AocType, ",
+ "\n Novelty = aocStep.Novelty,",
+ "\n DataNode = Identity,",
+ "\n }));",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ZVtzxigEF0yEaftuPtLQlw",
+ "cell_type": "markdown",
+ "source": [
+ "## Getting Amount Types",
+ "\n",
+ "\nSimilarly, given a certain Data Node and Accident Year, the interface ValidAmountType returns all the amount types which are used in imported data with that Data Node and Accident Year."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "kE72GkEJNE2GPEnIe78RDA",
+ "cell_type": "code",
+ "source": [
+ "public interface ValidAmountType : IScope",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.GetStorage().ImportFormat != ImportFormats.Cashflow ||",
+ "\n x.GetStorage().IsSecondaryScope(x.Identity)));",
+ "\n ",
+ "\n IEnumerable BeAmountTypes => GetStorage().GetRawVariables(Identity)",
+ "\n .Where(rv => rv.AmountType != null)",
+ "\n .Select(x => x.AmountType)",
+ "\n .Concat(GetStorage().DataNodeDataBySystemName[Identity].IsReinsurance ? (AmountTypes.CDR).RepeatOnce() : Enumerable.Empty())",
+ "\n .ToHashSet();",
+ "\n ",
+ "\n ",
+ "\n IEnumerable ActualAmountTypes => GetStorage().GetIfrsVariables(Identity)",
+ "\n .Where(iv => GetStorage().EstimateTypesByImportFormat[ImportFormats.Actual].Contains(iv.EstimateType))",
+ "\n .Select(x => x.AmountType)",
+ "\n .ToHashSet();",
+ "\n}",
+ "\npublic interface BeAmountTypesFromIfrsVariables : ValidAmountType",
+ "\n{",
+ "\n IEnumerable ValidAmountType.BeAmountTypes => GetStorage().GetIfrsVariables(Identity)",
+ "\n .Where(iv => GetStorage().EstimateTypesByImportFormat[ImportFormats.Cashflow].Contains(iv.EstimateType) && iv.AmountType != null)",
+ "\n .Select(x => x.AmountType)",
+ "\n .ToHashSet();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "OppPBfh8o0-NsCYyUGOVLg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## AoC Step Structure",
+ "\n",
+ "\nThe Aoc step structure is constructed from the data which is delivered as input. It is assumed that it depends only on the Group of Contrat (i.e. it is invariant across Amount types or Accident Year). "
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "54mTUE9VgUG3fW8ov6K3Uw",
+ "cell_type": "markdown",
+ "source": [
+ "### ParentAocStep ",
+ "\nThe **ParentAocStep** scope computes and provides an important piece of information for each [Identity](../DataModel/DataStructure#import-identity), i.e. for a certain [AocType](../DataModel/DataStructure#aoc-type) and [Novelty](../DataModel/DataStructure#novelty).",
+ "\n",
+ "\nIt provides the list of the adjacent AocSteps prior to Identity one. It can be more than one only for the step **CL** where a parent for each novelty is considered.",
+ "\nParentAocStep is critical when computing the *telescoping* differences. ",
+ "\n",
+ "\nThey are defined as follows:",
+ "\n",
+ "\n$$",
+ "\n\\text{ParentAocStep}(\\text{AoC step}) = \\left\\{",
+ "\n\\begin{array}{cl}",
+ "\n\\text{AoC step with AoC Type YCU and Novelty I} & \\text{if AocType CRU} \\\\",
+ "\n\\text{The last AoC step with Data Type != Calculated and same Novelty as the AocStep} & \\text{if AocType YCU} \\\\",
+ "\n\\text{The AoC step which comes before in terms of order (as defined by AocType)} & \\text{otherwise} \\\\",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "l9dack27s0Kc15M14T2vxg",
+ "cell_type": "code",
+ "source": [
+ "public interface ParentAocStep : IScope<(ImportIdentity Id, string AmountType), ImportStorage>",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.Identity.AmountType != AmountTypes.CDR));",
+ "\n ",
+ "\n private HashSet ParsedAocSteps => GetScope(Identity.Id.DataNode).ParsedIdentities.Select(id => new AocStep(id.AocType, id.Novelty)).ToHashSet();",
+ "\n private IEnumerable OrderedParsedAocSteps => ParsedAocSteps.Concat(CalculatedTelescopicAocStep).OrderBy(x => GetStorage().AocConfigurationByAocStep[x].Order);",
+ "\n ",
+ "\n private Dictionary> ParentParsedIdentities => GetPreviousIdentities(OrderedParsedAocSteps);",
+ "\n private AocStep identityAocStep => new AocStep(Identity.Id.AocType, Identity.Id.Novelty);",
+ "\n ",
+ "\n IEnumerable CalculatedTelescopicAocStep => GetStorage().GetCalculatedTelescopicAocSteps();",
+ "\n ",
+ "\n IEnumerable Values => ",
+ "\n Identity.Id.AocType switch {",
+ "\n AocTypes.CRU => new AocStep(AocTypes.YCU, Novelties.I).RepeatOnce(),",
+ "\n AocTypes.YCU => OrderedParsedAocSteps.GetReferenceAocStepForCalculated(GetStorage().AocConfigurationByAocStep, identityAocStep).RepeatOnce(),",
+ "\n _ => ParentParsedIdentities.TryGetValue(identityAocStep, out var parents) ? parents : Enumerable.Empty(),",
+ "\n };",
+ "\n}",
+ "\n",
+ "\npublic interface ParentAocStepForCreditRisk : ParentAocStep",
+ "\n{",
+ "\n IEnumerable ParentAocStep.CalculatedTelescopicAocStep => ",
+ "\n GetStorage().GetCalculatedTelescopicAocSteps().Where(aoc => aoc.AocType != AocTypes.CRU);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "5L-2OpNhxki8UNE8od5BLQ",
+ "cell_type": "markdown",
+ "source": [
+ "### ReferenceAocStep",
+ "\n",
+ "\nThe **ReferenceAocStep** scope provides the AocStep from which to retrieve the data in order to compute its value (e.g. AoC step EA retrieves Present Values, while AoC step YCU retrieves Nominal).",
+ "\n",
+ "\nThey are defined as follows:",
+ "\n",
+ "\n$$",
+ "\n\\text{ReferenceAocStep}(\\text{AoC step}) = \\left\\{",
+ "\n\\begin{array}{cl}",
+ "\n\\text{self} & \\text{if AocStep InputSource is not Calculated} \\\\",
+ "\n\\text{The last AoC step with Data Type != Calculated and same Novelty as the input AocStep} ~, & \\text{if AocType } \\in \\text{\\{RCU, CF, IA, YCU, CRU\\}} \\\\",
+ "\n\\text{AoC step with AoC Type CF and Novelty as the AocStep} & \\text{if AocType EA} \\\\",
+ "\n\\text{AoC step with AoC Type CL and Novelty C} & \\text{if AocType $\\in$ \\{AM, EOP\\}} \\\\",
+ "\n\\text{empty} & \\text{if AocType is BOP} \\\\",
+ "\n\\text{log NotSupportedAocStepReference error} & \\text{otherwise} \\\\",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n",
+ "\nwhere the last AocStep is obtained by ordering the AocSteps according to their order (as defined by its AocType) and taking the last one."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ItSTOo7qmE68A7gENSMguQ",
+ "cell_type": "code",
+ "source": [
+ "public interface ReferenceAocStep : IScope ",
+ "\n{",
+ "\n private IEnumerable OrderedParsedAocSteps => GetScope(Identity.DataNode).ParsedIdentities",
+ "\n .Select(id => new AocStep(id.AocType, id.Novelty))",
+ "\n .Distinct()",
+ "\n .OrderBy(aocStep => GetStorage().AocConfigurationByAocStep[aocStep].Order);",
+ "\n private AocStep identityAocStep => new AocStep(Identity.AocType, Identity.Novelty);",
+ "\n private AocStep GetReferenceAocStep(string aocType) {",
+ "\n return aocType switch {",
+ "\n AocTypes.RCU or AocTypes.CF or AocTypes.IA or AocTypes.YCU or AocTypes.CRU => OrderedParsedAocSteps.GetReferenceAocStepForCalculated(GetStorage().AocConfigurationByAocStep, identityAocStep),",
+ "\n AocTypes.EA => new AocStep(AocTypes.CF, Identity.Novelty),",
+ "\n AocTypes.AM or AocTypes.EOP => new AocStep(AocTypes.CL, Novelties.C),",
+ "\n AocTypes.BOP => new AocStep(default, default), //BOP, C has DataType == Calculated. See ReferenceAocStep condition.",
+ "\n _ => (AocStep)ApplicationMessage.Log(Error.NotSupportedAocStepReference, Identity.AocType),",
+ "\n };",
+ "\n }",
+ "\n",
+ "\n // The Reference AocStep from which get data (Nominal or PV) to compute",
+ "\n AocStep Value => GetStorage().AocConfigurationByAocStep[identityAocStep].DataType == DataType.Calculated ",
+ "\n || GetStorage().AocConfigurationByAocStep[identityAocStep].DataType == DataType.CalculatedTelescopic ",
+ "\n ? GetReferenceAocStep(Identity.AocType)",
+ "\n : identityAocStep;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "tzXoa0VDqUSEqPJLe4LCdA",
+ "cell_type": "markdown",
+ "source": [
+ "### PreviousAocSteps",
+ "\nThe **PreviousAocSteps** scope computes and provides an other important piece of information for each [Identity](../DataModel/DataStructure#import-identity), i.e. for a certain [AocType](../DataModel/DataStructure#aoc-type) and [Novelty](../DataModel/DataStructure#novelty).",
+ "\n",
+ "\nIt provides the list of all previous AocSteps up to the **BOP** step, whereby a Combined novelty will branch into the InForce and New Business AocTypes.",
+ "\n",
+ "\nPreviousAocSteps is critical when computing aggregated values along the various dimensions (such as for example Line of Business) and ",
+ "\nis formed by the ParentAocStep and its parent and so on until there is no parent.",
+ "\n",
+ "\n$$",
+ "\n\\text{PreviousAocSteps}(\\rm{AocStep}) = \\{PAS_1, PAS_2, \\ldots\\}",
+ "\n$$",
+ "\nwhere",
+ "\n$$",
+ "\n\\rm{PAS}_1 = \\rm{ParentAocStep}(\\rm{AocStep})",
+ "\n$$",
+ "\n$$",
+ "\n\\rm{PAS}_2 = \\rm{ParentAocStep}(\\rm{PAS}_1).",
+ "\n$$",
+ "\n",
+ "\nThis scope depends on the InputSource (Actual or Cashflow) for which the PreviousSteps are requested due to the AocChain differences between Actual reports and the rest."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "4AJrFGaLqEm52QmmXGl6pg",
+ "cell_type": "code",
+ "source": [
+ "public interface PreviousAocSteps : IScope<(ImportIdentity Id, InputSource ScopeInputSource), ImportStorage> ",
+ "\n{ ",
+ "\n private AocStep identityAocStep => new AocStep(Identity.Id.AocType, Identity.Id.Novelty);",
+ "\n private int aocStepOrder => GetStorage().AocConfigurationByAocStep[identityAocStep].Order;",
+ "\n private HashSet allAocSteps => GetStorage().GetAllAocSteps(Identity.ScopeInputSource).ToHashSet();",
+ "\n IEnumerable Values => allAocSteps.Contains(identityAocStep)",
+ "\n ? GetScope(Identity.Id.DataNode).Identities",
+ "\n .Select(id => new AocStep(id.AocType, id.Novelty))",
+ "\n .Distinct()",
+ "\n .Where(aoc => allAocSteps.Contains(aoc) && ",
+ "\n GetStorage().AocConfigurationByAocStep[aoc].Order < aocStepOrder && ",
+ "\n (Identity.Id.Novelty != Novelties.C ? aoc.Novelty == Identity.Id.Novelty : true) )",
+ "\n .OrderBy(aoc => GetStorage().AocConfigurationByAocStep[aoc].Order)",
+ "\n : Enumerable.Empty();",
+ "\n} "
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "JJ7sk4vUDUSWJJvVDpbZNw",
+ "cell_type": "markdown",
+ "source": [
+ "The exact structure being return depends on the **order** of the AoC Steps (which is set by the [AoC Type](../DataModel/DataStructure#aoc-type)), and on which AoC steps exist.",
+ "\n",
+ "\nFor an example of the usage of the AocStep scope see [here](../Test/AocStructureTest)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "1qVdizG_x0OI3MI-IEVZKA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Discounting",
+ "\n",
+ "\nThe calculation of IFRS17 figures is based on cumulated discounted cashflows."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "bKrNP0O7ZEOtm23hLJyEyg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Yield Curves",
+ "\n",
+ "\nThe Yield Curves used for the discounting calculations are functions of the [Currency](../DataModel/DataStructure#currency), the [Data Node](../DataModel/DataStructure#data-node) and the [Economic Basis](../DataModel/DataStructure#economic-basis).",
+ "\n",
+ "\nIn particular:",
+ "\n- For the **Locked-in** economic basis, the yield curve used is the latest available as per end of the DataNode's inception year;",
+ "\n- Whereas for the **Current** economic base, the yield curve used is the latest available as per the current period.",
+ "\n",
+ "\nThe algorithm which retrieves the latest available yield curve is [here](../Utils/UtilityMethods#yield-curve)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "DcHXuat1WUaOAFa_MsVSdQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Interest and Discount Rates and Factors",
+ "\n",
+ "\nThe factors used for discounting have the same granularity as the cashflow, i.e. monthly. The yield curves have yearly granularity, so the annual Interest factor is 1 + interest rate. The monthly Interest Interest and Discount factors are obtained from the annual factors such that the product of 12 months results in the annual factors, as follows:",
+ "\n",
+ "\n$$",
+ "\n\\text{Discount}_i = ( 1 + \\text{YC}_i ) ^{-\\frac{1}{12}} ~,",
+ "\n$$",
+ "\nand ",
+ "\n$$",
+ "\n\\text{Interest}_i = ( 1 + \\text{YC}_i) ^{\\frac{1}{12}} ~,",
+ "\n$$",
+ "\n",
+ "\nwhere the index $i$ denotes years."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "yCCcQcUwzEO1lzy3iwRM8Q",
+ "cell_type": "code",
+ "source": [
+ "public interface MonthlyRate : IScope",
+ "\n{",
+ "\n private string EconomicBasis => GetContext();",
+ "\n ",
+ "\n private double[] YearlyYieldCurve => GetStorage().GetYearlyYieldCurve(Identity, EconomicBasis);",
+ "\n ",
+ "\n private double Perturbation => 0; //GetStorage().GetYieldCurvePerturbation(); => switch Args.Scenario { 10ptsU => 0.1, 10ptsD => -0.1, _ => default)",
+ "\n ",
+ "\n double[] Interest => YearlyYieldCurve.Select(rate => Math.Pow(1d + rate, 1d / 12d) + Perturbation).ToArray(); ",
+ "\n ",
+ "\n double[] Discount => Interest^(-1);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "ON4hzALyrkapbo6dsJaCYA",
+ "cell_type": "markdown",
+ "source": [
+ "For an example of these calculations see [here](../Test/SpecificationsImportCashflows#interest-and-discount-rates)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "wCY9O1rFG0OcsUmqNLVm4Q",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Nominal Values",
+ "\n",
+ "\nThe nominal cashflow values correspond to the cashflows provided in the Cashflow input file. ",
+ "\n
These values are stored in the database as [RawVariable](../DataModel/DataStructure#raw-variables).",
+ "\n
Refer to the ReferenceAocStep of the AocStructure calculation to identify the correct AocType and Novelty to retrieve.",
+ "\n
Due to the Credit Default Risk of a reinsurance partner, the logic to compute the Nominal Cashflows for this Amount Type must be defined separately. "
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "YZrg-gGldUGe6pZF0Kh3Qw",
+ "cell_type": "code",
+ "source": [
+ "public interface NominalCashflow : IScope<(ImportIdentity Id, string AmountType, string CalculationType, int? AccidentYear), ImportStorage>",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.Identity.AmountType == AmountTypes.CDR && x.Identity.Id.AocType == AocTypes.CF)",
+ "\n .WithApplicability(x => x.Identity.AmountType == AmountTypes.CDR));",
+ "\n",
+ "\n AocStep referenceAocStep => GetScope(Identity.Id).Value;",
+ "\n double[] Values => GetStorage().GetValues(Identity.Id with {AocType = referenceAocStep.AocType, Novelty = referenceAocStep.Novelty}, Identity.AmountType, Identity.CalculationType, Identity.AccidentYear);",
+ "\n}",
+ "\n",
+ "\npublic interface CreditDefaultRiskNominalCashflow : NominalCashflow",
+ "\n{",
+ "\n private double[] NominalClaimsCashflow => GetStorage().GetClaims()",
+ "\n .Select(claim => GetStorage().GetValues(Identity.Id with {AocType = referenceAocStep.AocType, Novelty = referenceAocStep.Novelty}, claim, Identity.CalculationType, Identity.AccidentYear))",
+ "\n .Aggregate();",
+ "\n ",
+ "\n private double nonPerformanceRiskRate => GetStorage().GetNonPerformanceRiskRate(Identity.Id);",
+ "\n ",
+ "\n private double[] PvCdrDecumulated { get {",
+ "\n var ret = new double[NominalClaimsCashflow.Length];",
+ "\n for (var i = NominalClaimsCashflow.Length - 1; i >= 0; i--)",
+ "\n ret[i] = Math.Exp(-nonPerformanceRiskRate) * ret.ElementAtOrDefault(i + 1) + NominalClaimsCashflow[i] - NominalClaimsCashflow.ElementAtOrDefault(i + 1);",
+ "\n return ret; } } ",
+ "\n ",
+ "\n double[] NominalCashflow.Values => PvCdrDecumulated - NominalClaimsCashflow;",
+ "\n}",
+ "\n",
+ "\npublic interface AllClaimsCashflow : NominalCashflow",
+ "\n{",
+ "\n double[] NominalCashflow.Values => GetStorage().GetClaims()",
+ "\n .Select(claim => GetStorage().GetValues(Identity.Id with {AocType = referenceAocStep.AocType, Novelty = referenceAocStep.Novelty}, claim, Identity.CalculationType, Identity.AccidentYear))",
+ "\n .Aggregate();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "OPI-l8iwREuVVszAP89Hqw",
+ "cell_type": "markdown",
+ "source": [
+ "For a given month $i$ they are denoted as $\\rm{Nominal}_i$."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "7RRmYOmkFEuqu8yfOR-0rw",
+ "cell_type": "markdown",
+ "source": [
+ "For an example of nominal cashflow values see [here](../Test/SpecificationsImportCashflows#nominal-cashflow)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "q0ZU9L_OMUqLUKUOUcLuAw",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Present Values",
+ "\n",
+ "\nPresent Values are calculated during the import of the cashflows and stored on the database. They are computed for the relevant Economic Basis, depending on the Valuation Basis.",
+ "\n",
+ "\nTheir calculation is described in the following sections and is summarized in the $\\rm{PV}$ formula [below](#present-value)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "4SsmFu7Uo0aIEmes8Z4LoQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Cumulated Discounted Cashflows",
+ "\n",
+ "\nCumulated and Discounted cashflows $\\rm{CDC}$ are computed using the monthly discount rates and in a recursive manner, as follows:",
+ "\n",
+ "\n$$",
+ "\n\\text{CDC}_i(\\text{AoC step}) = \\left\\{",
+ "\n\\begin{array}{cl}",
+ "\n\\text{Nominal}_i + \\text{CDC}_{i+1} \\cdot {\\text{Valid Discount}_{\\frac{i}{12}}} ~, & \\text{if Aoc Type's Period Type is Beginning Of Period} \\\\",
+ "\n\\big( \\text{Nominal}_i + \\text{CDC}_{i+1} \\big) \\cdot {\\text{Valid Discount}_{\\frac{i}{12}}} ~, & \\text{if Aoc Type's Period Type is End Of Period}",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n",
+ "\nwhere Transaction Period depends on which Best Estimate value is being computed, in particular on what its [Amount Type](../DataModel/DataStructure#amount-type) is (each Amount Type has its own [Period Type](../Constants/Enums)); and $\\text{Valid Discount}$ stands for the fact that in case the Discount Curves are shorter than the required index, then their last element is returned.",
+ "\n",
+ "\n
Also here, the Credit Default Risk contribution is calculated separately. Since it is based on Claims, the Period Type is implicitly defined."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "n0bMVVX8JUGCvXh-hcQi9g",
+ "cell_type": "code",
+ "source": [
+ "public interface DiscountedCashflow : IScope<(ImportIdentity Id, string AmountType, string CalculationType, int? Accidentyear), ImportStorage>",
+ "\n{",
+ "\n private PeriodType periodType => GetStorage().GetPeriodType(Identity.AmountType, Identity.CalculationType); ",
+ "\n ",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.Identity.Id.IsReinsurance && x.Identity.AmountType == AmountTypes.CDR));",
+ "\n",
+ "\n [NotVisible]",
+ "\n string EconomicBasis => GetContext();",
+ "\n",
+ "\n [NotVisible]",
+ "\n double[] MonthlyDiscounting => GetScope(Identity.Id).Discount;",
+ "\n ",
+ "\n [NotVisible]",
+ "\n double[] NominalValues => GetScope(Identity).Values;",
+ "\n",
+ "\n double[] Values => NominalValues.ComputeDiscountAndCumulate(MonthlyDiscounting, periodType);",
+ "\n}",
+ "\n",
+ "\npublic interface DiscountedCreditRiskCashflow : DiscountedCashflow",
+ "\n{ ",
+ "\n private double nonPerformanceRiskRate => GetStorage().GetNonPerformanceRiskRate(Identity.Id);",
+ "\n ",
+ "\n double[] DiscountedCashflow.Values => NominalValues.ComputeDiscountAndCumulateWithCreditDefaultRisk(MonthlyDiscounting, nonPerformanceRiskRate);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "V8aa9nD9bUqsX54-bD1Hiw",
+ "cell_type": "markdown",
+ "source": [
+ "For example calculations for Cumulated Discounted Cashflows see [here](../Test/SpecificationsImportCashflows#cumulated-discounted-cashflow)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "bYq1f5UE80q1fxb-AON3pA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Telescoping Difference",
+ "\n",
+ "\n",
+ "\nPresent Value figures for a specific period are typically reported through an analysis of change, where for each [AocStep](#aoc-steps-structure) the variation with respect to the preceding AocStep is shown.",
+ "\n",
+ "\nThe Telescoping Difference is basically the delta between two adjacent AoC steps, whereby the [ParentAocStep](#aoc-steps-structure) is used to determine the AoC step. ",
+ "\n",
+ "\nIt is defined as follows:",
+ "\n",
+ "\n$$",
+ "\n\\text{TelescopingDifference}_i = ",
+ "\n\\text{CDC}_{i}\\big(\\text{current AoC step}\\big) - \\text{CDC}_{i}\\big(\\text{parent AoC step}\\big)",
+ "\n$$",
+ "\n",
+ "\nwhere AocType is the AoC Type of the AoC Step for which the calculations are being performed."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "cNNeXkyxjkiDODg6ARR5Zw",
+ "cell_type": "code",
+ "source": [
+ "public interface TelescopicDifference : IScope<(ImportIdentity Id, string AmountType, string CalculationType, int? Accidentyear), ImportStorage>",
+ "\n{",
+ "\n [NotVisible]",
+ "\n string EconomicBasis => GetContext();",
+ "\n private double[] CurrentValues => GetScope(Identity).Values;",
+ "\n ",
+ "\n private double[] PreviousValues => (GetScope((Identity.Id, Identity.AmountType)))",
+ "\n .Values",
+ "\n .Select(aoc => GetScope((Identity.Id with {AocType = aoc.AocType, Novelty = aoc.Novelty}, Identity.AmountType, Identity.CalculationType, Identity.Accidentyear)).Values)",
+ "\n .Where(cf => cf.Count() > 0)",
+ "\n .Aggregate();",
+ "\n ",
+ "\n double[] Values => CurrentValues - PreviousValues;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "cYmNPbah5UaC9Iu3db7pqA",
+ "cell_type": "markdown",
+ "source": [
+ "Examples of Telescoping Difference calculations for different AoC steps start [here](../Test/SpecificationsImportCashflows#modelcorrections)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "Z42Ysovu4UmepvVo0U429w",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Present Value",
+ "\n",
+ "\nThe present value ($\\rm{PV}$) can be determined by taking the appropriate elements of the cumulated discounted cashflows. This is done as function of the two [projection parameters](../DataModel/DataStructure#projection-configuration) $\\rm{Shift}$ ($S$) and $\\rm{TimeStep}$ ($TS$):",
+ "\n",
+ "\n$$",
+ "\n\\text{PV}(S, TS) = \\left\\{",
+ "\n\\begin{array}{cl}",
+ "\n\\text{PV Base}_{S} ~, & \\text{if Valuation Period is Beginning of Period} \\\\",
+ "\n\\text{PV Base}_{S+TS/2 -1} ~, & \\text{if Valuation Period is Mid of Period} \\\\",
+ "\n\\sum_{i=S}^{S + TS - 1}\\text{PV Base}_{i} ~, & \\text{if Valuation Period is Delta} \\\\",
+ "\n\\text{PV Base}_{S + TS} ~, & \\text{if Valuation Period is End of Period} \\\\",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n",
+ "\nwhere [PV Base](#present-value-base) is defined below, and the term $TS/2$ uses MidpointRounding.AwayFromZero (as defined by *https:[]()//docs.microsoft.com/en-us/dotnet/api/system.midpointrounding?view=net-6.0)*: rounding to the nearest number, away from zero in the exact halfway case. Furthermore, if the array is smaller than the index, then the last element is returned.",
+ "\n",
+ "\nFor instance, for the current year and year-to-date view we have $S=0$ and $TS=3$ for the first quarter, $TS=6$ for the 2nd quarter and so on.",
+ "\nFor the projection values of next year first quarter we would have $S=12$ and $TS=3$, etc."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "a_j0Wz_NsEeWjap6zY-mDA",
+ "cell_type": "code",
+ "source": [
+ "public interface IWithGetValueFromValues : IScope<(ImportIdentity Id, string AmountType, string CalculationType, int? AccidentYear), ImportStorage>",
+ "\n{",
+ "\n private int shift => GetStorage().GetShift(0);//Identity.Id.ProjectionPeriod",
+ "\n private int timeStep => GetStorage().GetTimeStep(0);//Identity.Id.ProjectionPeriod",
+ "\n ",
+ "\n public double GetValueFromValues(double[] Values)",
+ "\n {",
+ "\n return GetStorage().GetValuationPeriod(Identity.Id) switch {",
+ "\n ValuationPeriod.BeginningOfPeriod => Values.ElementAtOrDefault(shift),",
+ "\n ValuationPeriod.MidOfPeriod => Values.ElementAtOrDefault(shift + Convert.ToInt32(Math.Round(timeStep / 2d, MidpointRounding.AwayFromZero)) - 1),",
+ "\n ValuationPeriod.Delta => Values.Skip(shift).Take(timeStep).Sum(),",
+ "\n ValuationPeriod.EndOfPeriod => Values.ElementAtOrDefault(shift + timeStep),",
+ "\n ValuationPeriod.NotApplicable => default",
+ "\n };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "LX0IfHO1HkG3juJfHtyRsQ",
+ "cell_type": "markdown",
+ "source": [
+ "An example of Projected Present Value calculations can be found [here](../Test/SpecificationsImportCashflows#present-value)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "JablJ7mjvkSSqXmjUWZ-mg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Interest Accretion",
+ "\n",
+ "\nSince the Interest Accretion cashflows are typically not provided as input (as they can be computed from its parent AocStep), its present values can be computed as follows:",
+ "\n",
+ "\n$$",
+ "\n\\text{InterestAccretion}_i(\\text{AoC step}) = \\left\\{",
+ "\n\\begin{array}{cl}",
+ "\n\\big(\\text{CDC}_i(\\text{Parent AoC step}) - \\text{Nominal}_i(\\text{parent AoC step}) \\big) \\cdot \\big({\\text{Valid Interest}_{\\frac{i}{12}}} - 1 \\big)~, & \\text{if Amount Type's Transaction Period is Beginning of Period} \\\\",
+ "\n\\text{CDC}_i(\\text{parent AoC step}) \\cdot \\big({\\text{Valid Interest}_{\\frac{i}{12}}} - 1 \\big)~, & \\text{otherwise}",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n",
+ "\n
Due to the Credit Default Risk of a reinsurance partner, the logic to compute the Interest Accretion for this Amount Type must be defined separately. Since it is based on Claims, the Period Type is implicitly defined."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "vGVQDaWg2UeXvSxdJ18zpA",
+ "cell_type": "code",
+ "source": [
+ "public interface IWithInterestAccretion : IScope<(ImportIdentity Id, string AmountType, string CalculationType, int? AccidentYear), ImportStorage>",
+ "\n{",
+ "\n private double[] parentDiscountedValues => GetScope(Identity).Values; ",
+ "\n private double[] parentNominalValues => GetScope(Identity).Values;",
+ "\n private double[] monthlyInterestFactor => GetScope(Identity.Id).Interest;",
+ "\n ",
+ "\n double[] GetInterestAccretion() ",
+ "\n {",
+ "\n var periodType = GetStorage().GetPeriodType(Identity.AmountType, Identity.CalculationType);",
+ "\n var ret = new double[parentDiscountedValues.Length];",
+ "\n ",
+ "\n switch (periodType) {",
+ "\n case PeriodType.BeginningOfPeriod :",
+ "\n for (var i = 0; i < parentDiscountedValues.Length; i++)",
+ "\n ret[i] = (parentDiscountedValues[i] - parentNominalValues[i]) * (GetElementOrDefault(monthlyInterestFactor, i/12) - 1d );",
+ "\n break;",
+ "\n default :",
+ "\n for (var i = 0; i < parentDiscountedValues.Length; i++)",
+ "\n ret[i] = parentDiscountedValues[i] * (GetElementOrDefault(monthlyInterestFactor, i/12) - 1d );",
+ "\n break;",
+ "\n }",
+ "\n ",
+ "\n return ret;",
+ "\n }",
+ "\n}",
+ "\n",
+ "\npublic interface IWithInterestAccretionForCreditRisk : IScope<(ImportIdentity Id, string AmountType, string CalculationType, int? AccidentYear), ImportStorage>",
+ "\n{",
+ "\n private double[] nominalClaimsCashflow => GetScope(Identity).Values;",
+ "\n private double[] nominalValuesCreditRisk => -1 * GetScope(Identity with {Id = Identity.Id with {AocType = AocTypes.CF}}).Values;",
+ "\n private double[] monthlyInterestFactor => GetScope(Identity.Id).Interest;",
+ "\n private double nonPerformanceRiskRate => GetStorage().GetNonPerformanceRiskRate(Identity.Id);",
+ "\n ",
+ "\n double[] GetInterestAccretion() ",
+ "\n {",
+ "\n var interestOnClaimsCashflow = new double[nominalClaimsCashflow.Length];",
+ "\n var interestOnClaimsCashflowCreditRisk = new double[nominalClaimsCashflow.Length];",
+ "\n var effectCreditRisk = new double[nominalClaimsCashflow.Length];",
+ "\n for (var i = nominalClaimsCashflow.Length - 1; i >= 0; i--) {",
+ "\n interestOnClaimsCashflow[i] = 1 / GetElementOrDefault(monthlyInterestFactor, i/12) * (interestOnClaimsCashflow.ElementAtOrDefault(i + 1) + nominalClaimsCashflow[i] - nominalClaimsCashflow.ElementAtOrDefault(i + 1));",
+ "\n interestOnClaimsCashflowCreditRisk[i] = 1 / GetElementOrDefault(monthlyInterestFactor, i/12) * (Math.Exp(-nonPerformanceRiskRate) * interestOnClaimsCashflowCreditRisk.ElementAtOrDefault(i + 1) + nominalClaimsCashflow[i] - nominalClaimsCashflow.ElementAtOrDefault(i + 1));",
+ "\n effectCreditRisk[i] = interestOnClaimsCashflow[i] - interestOnClaimsCashflowCreditRisk[i];",
+ "\n }",
+ "\n ",
+ "\n return effectCreditRisk - nominalValuesCreditRisk;",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "f_Nqjp76YUWFtL08hw0iTg",
+ "cell_type": "markdown",
+ "source": [
+ "An example of the Interest Accretion calculations can be found [here](../Test/SpecificationsImportCashflows#interest-accretion)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "lWN9DuSvtkWi8KPDtnLcZA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Present Value Base",
+ "\n",
+ "\nThe PV Base values are valid for all choices of the [Economic Basis](../DataModel/DataStructure#economic-basis):",
+ "\n",
+ "\n$$",
+ "\n\\text{PV Base}_i (\\text{AoC step}) = \\left\\{",
+ "\n\\begin{array}{rl}",
+ "\n\\text{CDC}_i ~, & \\text{if AoCType = BOP} \\\\",
+ "\n-\\text{Nominal}_i(\\text{Parent AoC step}) ~, & \\text{if AoCType = CF } \\\\",
+ "\n\\text{InterestAccretion}_i ~, & \\text{if AoCType = IA } \\\\",
+ "\n0 ~, & \\text{if AoCType = AM } \\\\\\",
+ "\n\\text{CDC}_i(\\text{Parent AoC step}) ~, & \\text{if AoCType = EOP } \\\\",
+ "\n\\text{TelescopingDifference}_i ~, & \\text{otherwise}",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n",
+ "\nwhere $i$ denotes the months, and the [$\\rm{TelescopingDifference}_i$](#telescopic-difference) and the [$\\rm{InterestAccretion}_i$](#interest-accretion) quantities are defined above."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "NX2BdeLNxk2VWROO8E5pBg",
+ "cell_type": "code",
+ "source": [
+ "public interface PvBase : IWithGetValueFromValues",
+ "\n{ ",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.GetStorage().ImportFormat != ImportFormats.Cashflow",
+ "\n || x.GetStorage().IsSecondaryScope(x.Identity.Id.DataNode))",
+ "\n .WithApplicability(x => (x.Identity.Id.AocType == AocTypes.BOP && x.Identity.Id.Novelty != Novelties.C) || x.Identity.Id.AocType == AocTypes.EOP)",
+ "\n .WithApplicability(x => x.Identity.Id.AocType == AocTypes.CF)",
+ "\n .WithApplicability(x => x.Identity.Id.IsReinsurance && x.Identity.AmountType == AmountTypes.CDR && x.Identity.Id.AocType == AocTypes.IA)",
+ "\n .WithApplicability(x => x.Identity.Id.AocType == AocTypes.IA)",
+ "\n .WithApplicability(x => new string[]{AocTypes.BOP, AocTypes.EA, AocTypes.AM, AocTypes.RCU}.Contains(x.Identity.Id.AocType) ) //add here combination CRU for At !CDR?",
+ "\n );",
+ "\n ",
+ "\n [NotVisible][IdentityProperty][Dimension(typeof(EconomicBasis))]",
+ "\n string EconomicBasis => GetContext();",
+ "\n ",
+ "\n [NotVisible]",
+ "\n double[] Values => GetScope(Identity).Values;",
+ "\n ",
+ "\n public double Value => GetValueFromValues(Values);",
+ "\n}",
+ "\n",
+ "\npublic interface ComputePvBaseWithIfrsVariable : PvBase",
+ "\n{",
+ "\n double PvBase.Value => GetStorage().GetValue(Identity.Id, Identity.AmountType, Identity.CalculationType, EconomicBasis, Identity.AccidentYear); //unify CalculationType and EstimateTypeGet",
+ "\n double[] PvBase.Values => Enumerable.Empty().ToArray();",
+ "\n}",
+ "\n",
+ "\npublic interface PvBaseFromDiscountedCashflow : PvBase",
+ "\n{",
+ "\n [NotVisible]",
+ "\n double[] PvBase.Values => GetScope(Identity).Values;",
+ "\n}",
+ "\n",
+ "\npublic interface CashflowAocStep : PvBase",
+ "\n{",
+ "\n [NotVisible]",
+ "\n double[] PvBase.Values => -1d * GetScope(Identity).Values;",
+ "\n}",
+ "\n",
+ "\npublic interface PvBaseWithInterestAccretion : PvBase, IWithInterestAccretion",
+ "\n{",
+ "\n [NotVisible]",
+ "\n double[] PvBase.Values => GetInterestAccretion();",
+ "\n}",
+ "\n",
+ "\npublic interface PvBaseWithInterestAccretionForCreditRisk : PvBase, IWithInterestAccretionForCreditRisk",
+ "\n{",
+ "\n [NotVisible]",
+ "\n double[] PvBase.Values => GetInterestAccretion();",
+ "\n}",
+ "\n",
+ "\npublic interface EmptyValuesAocStep : PvBase",
+ "\n{",
+ "\n [NotVisible]",
+ "\n double[] PvBase.Values => Enumerable.Empty().ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "yZbP0Jm3ckC1XQBFERPm_g",
+ "cell_type": "markdown",
+ "source": [
+ "An example of the Present Value Base calculations can be found [here](../Test/SpecificationsImportCashflows#present-value)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "lWMlf8gT5kGtPaXz4CcdLg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Current and Locked",
+ "\n",
+ "\nPV Current and PV Locked below basically hold the Present Values [PV](#present-value) computed using the **Current** yield curves and the **Locked** yield curves, respectively.",
+ "\n",
+ "\nValues are available for each AmountType (by calling PvLocked.ByAmountType):",
+ "\n",
+ "\n$$",
+ "\n\\text{PV Locked}(\\text{AoC step}, \\text{Amount Type}) = \\text{PV}(\\text{AoC step}, \\text{Amount Type})|_{\\text{Economic Base = L}}",
+ "\n$$",
+ "\n",
+ "\n$$",
+ "\n\\text{PV Current}(\\text{AoC step}, \\text{Amount Type}) = \\text{PV}(\\text{AoC step}, \\text{Amount Type})|_{\\text{Economic Base = C}}",
+ "\n$$",
+ "\n",
+ "\n",
+ "\nAnd aggregated values are also available as the sum over all [Amount Types](../DataModel/DataStructure#amount-type) (by calling PvLocked.Value):",
+ "\n",
+ "\n$$",
+ "\n\\text{PV Locked}(\\text{AoC step}) = \\sum_{\\text{Amount Types}} \\text{PV}(\\text{AoC step}, \\text{Amount Type})|_{\\text{Economic Base = L}}",
+ "\n$$",
+ "\n",
+ "\n$$",
+ "\n\\text{PV Current}(\\text{AoC step}) = \\sum_{\\text{Amount Types}} \\text{PV}(\\text{AoC step}, \\text{Amount Type})|_{\\text{Economic Base = C}}",
+ "\n$$",
+ "\n",
+ "\nThese are used in the BBA methodology, whereby in the CSM calculations only PV Locked is used, and both of them are stored in the database under the [IfrsVariable](../DataModel/DataStructure#ifrs-variable) data structure."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "1wOqzclAjkaUcoGzwf1ldQ",
+ "cell_type": "code",
+ "source": [
+ "public interface PvLocked : IScope",
+ "\n{ ",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(EconomicBasis))]",
+ "\n string EconomicBasis => EconomicBases.L;",
+ "\n ",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(CalculationType))]",
+ "\n string CalculationType => CalculationTypes.BE;",
+ "\n ",
+ "\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray(); ",
+ "\n ",
+ "\n [NotVisible]",
+ "\n PvBase[] PresentValues => GetScope(Identity.DataNode).BeAmountTypes",
+ "\n .SelectMany(at => accidentYears",
+ "\n .Select(ay => GetScope((Identity, at, CalculationType, ay), o => o.WithContext(EconomicBasis))))",
+ "\n .ToArray();",
+ "\n double Value => PresentValues.Aggregate().Value;",
+ "\n}",
+ "\n",
+ "\npublic interface PvCurrent : IScope",
+ "\n{",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(EconomicBasis))]",
+ "\n string EconomicBasis => EconomicBases.C;",
+ "\n ",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(CalculationType))]",
+ "\n string CalculationType => CalculationTypes.BE;",
+ "\n ",
+ "\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray();",
+ "\n ",
+ "\n [NotVisible]",
+ "\n PvBase[] PresentValues => GetScope(Identity.DataNode).BeAmountTypes",
+ "\n .SelectMany(at => accidentYears",
+ "\n .Select(ay => GetScope((Identity, at, CalculationType, ay), o => o.WithContext(EconomicBasis))))",
+ "\n .ToArray();",
+ "\n ",
+ "\n double Value => PresentValues.Aggregate().Value;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "6pCT1yWm30S4fz2w2Km62w",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Risk Adjustment",
+ "\n",
+ "\nRisk Adjustment values ($\\rm{RA}$) are accessible from the [PV Base](#present-value-base) data and have [Calculation Type](../DataModel/DataStructure#calculation-type) $RA$. In particular, the Locked-In and Current values are given by:",
+ "\n",
+ "\n$$",
+ "\n\\text{RA Locked}(\\text{AoC step}) = \\text{PV}(\\text{AoC step})|_{\\text{Calculation Type = RA},~ \\text{Economic Basis = L}}",
+ "\n$$",
+ "\n",
+ "\n$$",
+ "\n\\text{RA Current}(\\text{AoC step}) = \\text{PV}(\\text{AoC step})|_{\\text{Calculation Type = RA},~ \\text{Economic Basis = C}}",
+ "\n$$",
+ "\n",
+ "\nwhere PV is defined [above](#present-value) and uses the input cashflows with Calculation Type = RA."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "TrbvThWf6EergPrBDCULNQ",
+ "cell_type": "code",
+ "source": [
+ "public interface RaLocked : IScope",
+ "\n{ ",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(EconomicBasis))]",
+ "\n string EconomicBasis => EconomicBases.L;",
+ "\n ",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(CalculationType))]",
+ "\n string CalculationType => CalculationTypes.RA;",
+ "\n ",
+ "\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray(); ",
+ "\n ",
+ "\n PvBase[] PresentValues => accidentYears.Select(ay => GetScope((Identity, (string)null, CalculationType, ay), o => o.WithContext(EconomicBasis))).ToArray();",
+ "\n ",
+ "\n double Value => PresentValues.Aggregate().Value;",
+ "\n}",
+ "\npublic interface RaCurrent : IScope",
+ "\n{",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(EconomicBasis))]",
+ "\n string EconomicBasis => EconomicBases.C;",
+ "\n ",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(CalculationType))]",
+ "\n string CalculationType => CalculationTypes.RA;",
+ "\n ",
+ "\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray(); ",
+ "\n ",
+ "\n PvBase[] PresentValues => accidentYears.Select(ay => GetScope((Identity, (string)null, CalculationType, ay), o => o.WithContext(EconomicBasis))).ToArray(); ",
+ "\n ",
+ "\n double Value => PresentValues.Aggregate().Value;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "lCTjmXtNM0anxWCIugOk1g",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Amortization",
+ "\n",
+ "\nFor the Amortization AoC Step (AoC Type **AM**), the amortization factors to be used are defined below."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "1EJRTEzTH02xfXBuVK6aQQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Coverage Units",
+ "\n",
+ "\nThe coverage unit (CU) of a GIC is introduced in the standard as the quantity of the service provided in that GIC. The service is",
+ "\nmeasured by considering the quantity of benefits provided as well as the expected coverage period of the GIC.",
+ "\n",
+ "\nThe cashflows of coverage units are retrieved from the discounted cashflows with [Calculation Type](../DataModel/DataStructure#calculation-type) CU."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "8s4nf1G3h0O5cmlvAC3QLw",
+ "cell_type": "code",
+ "source": [
+ "public interface CoverageUnitCashflow : IScope",
+ "\n{ ",
+ "\n [NotVisible] string EconomicBasis => GetContext();",
+ "\n ",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(CalculationType))]",
+ "\n string CalculationType => CalculationTypes.CU;",
+ "\n ",
+ "\n double[] Values => GetScope((Identity, (string)null, CalculationType, (int?)null)).Values;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "BTET6Z8yrkOpMBOGK5Bu3g",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Amortization Factor"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "m1VQAxKwaEuv9KI6qEVFxA",
+ "cell_type": "markdown",
+ "source": [
+ "For a certain GIC, the monthly Amortization Factors $\\text{Monthly }AF_i$ are computed from the cashflows of the underlying coverage unit for that GIC:",
+ "\n",
+ "\n$$",
+ "\n\\text{Monthly }AF_i = 1 - \\frac{ \\text{Nominal}_i(CL)} {\\text{CDC}_i(CL) } ~.",
+ "\n$$",
+ "\n",
+ "\nwhere:",
+ "\n- $i$ denotes a monthly period;",
+ "\n- the nominal cash flows $\\text{Nominal}_i(CL)$ are the nominal cashflows of the coverage unit for the AoC Step **Combined Liability** (CL) (input data);",
+ "\n- and the corresponding cumulated discounted cashflows $\\text{CDC}_i$ are defined [above](#cumulated-discounted-cashflows)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ilj2SgcU7kOjz53Sf946cw",
+ "cell_type": "code",
+ "source": [
+ "public interface MonthlyAmortizationFactorCashflow : IScope",
+ "\n{",
+ "\n private double[] NominalCuCashflow => GetScope((Identity with {AocType = AocTypes.CL}, (string)null, CalculationTypes.CU, (int?)null)).Values;",
+ "\n private double[] DiscountedCuCashflow => GetScope(Identity with {AocType = AocTypes.CL}, o => o.WithContext(EconomicBasis)).Values;",
+ "\n ",
+ "\n [NotVisible] string EconomicBasis => GetContext();",
+ "\n ",
+ "\n double[] MonthlyAmortizationFactors => Identity.AocType switch {",
+ "\n AocTypes.AM => NominalCuCashflow.Zip(DiscountedCuCashflow, //Extract to an other scope with month in the identity to avoid Zip?",
+ "\n (nominal, discountedCumulated) => discountedCumulated >= Precision ",
+ "\n ? 1 - nominal / discountedCumulated ",
+ "\n : 0).ToArray(),",
+ "\n _ => Enumerable.Empty().ToArray(),",
+ "\n };",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "bqUlBh41xUCZmzV497BLug",
+ "cell_type": "markdown",
+ "source": [
+ "For a certain projection period - defined by the Shift, $S$, and the Time-Step, $TS$, parameters - the Amortization Factor is then given by the product of the corresponding monthly amortization factors:",
+ "\n",
+ "\n$$",
+ "\nAF = \\prod _{i = S}^{TS} \\text{Monthly }AF_i ~.",
+ "\n$$",
+ "\n",
+ "\nEach GIC will have his own AF."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "6OE1dyBDq0-W4sMSuAQoeQ",
+ "cell_type": "code",
+ "source": [
+ "public interface CurrentPeriodAmortizationFactor : IScope",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => ",
+ "\n s.WithApplicability(x => x.GetStorage().ImportFormat != ImportFormats.Cashflow",
+ "\n || x.GetStorage().IsSecondaryScope(x.Identity.DataNode)));",
+ "\n ",
+ "\n private int shift => GetStorage().GetShift(0);//Identity.ProjectionPeriod",
+ "\n private int timeStep => GetStorage().GetTimeStep(0);//Identity.ProjectionPeriod",
+ "\n ",
+ "\n [NotVisible] string EconomicBasis => GetContext();",
+ "\n ",
+ "\n string EstimateType => EstimateTypes.F;",
+ "\n double Value => GetScope(Identity)",
+ "\n .MonthlyAmortizationFactors",
+ "\n .Skip(shift)",
+ "\n .Take(timeStep)",
+ "\n .Aggregate(1d, (x, y) => x * y);",
+ "\n}",
+ "\n",
+ "\npublic interface AmfFromIfrsVariable : CurrentPeriodAmortizationFactor",
+ "\n{",
+ "\n double CurrentPeriodAmortizationFactor.Value => GetStorage().GetValue(Identity, (string)null, EstimateType, EconomicBasis, (int?)null); //unify CalculationType and EstimateTypeGet",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "jpW8fnmKpEi5m8fmZckqfA",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Actual Values",
+ "\n",
+ "\nWe consider 4 types of Actual values, which are distinguished through their [Estimate Type](../DataModel/DataStructure#estimate-type):",
+ "\n- Actuals (A)",
+ "\n- Advance Actuals (AA)",
+ "\n- Overdue Actuals (OA)",
+ "\n- Deferrable Actuals (DA)",
+ "\n",
+ "\nwith the Estimate Type's system name shown between parenthesis above.",
+ "\n",
+ "\nThe following simplified AoC Chain applies for Advance and Overdue Actuals:",
+ "\n
BOP",
+ "\n
Release",
+ "\n
Write-off",
+ "\n
EOP"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "EBK-msISl0WxxcRgAvBDWQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Actual Base",
+ "\n",
+ "\nThe Actual Base sets values for actual, advance, and overdue as follows:",
+ "\n",
+ "\n$$",
+ "\n\\text{Actual Base} (\\text{AoC step}) = \\left\\{",
+ "\n\\begin{array}{rl}",
+ "\n0 ~, & \\text{if AoC Step's AoC Type = AM} \\\\",
+ "\n\\text{Actual Base}(\\rm{BOP}) + \\text{Actual Base}(\\rm{CF}) + \\text{Actual Base}(\\rm{WO}) ~, & \\text{if AoC Step's AoC Type = EOP and EstimateType is not A} \\\\",
+ "\n\\text{Imported Actual} ~, & \\text{otherwise}",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n",
+ "\nwhere the value is also function of the [Estimate Type](../DataModel/DataStructure#EstimateType) and [Amount Type](../DataModel/DataStructure#AmountType), and the $\\text{Imported Actual}$ value is described [here]()."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "_w7DsklRxEy1-gr0L3xnxQ",
+ "cell_type": "code",
+ "source": [
+ "public interface ActualBase : IScope<(ImportIdentity Id, string AmountType, string EstimateType, int? AccidentYear), ImportStorage>",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.GetStorage().ImportFormat == ImportFormats.Actual ",
+ "\n && !x.GetStorage().IsSecondaryScope(x.Identity.Id.DataNode)",
+ "\n && x.Identity.Id.AocType == AocTypes.AM)",
+ "\n .WithApplicability(x => x.GetStorage().ImportFormat != ImportFormats.Cashflow ",
+ "\n && !x.GetStorage().IsSecondaryScope(x.Identity.Id.DataNode)",
+ "\n && x.Identity.Id.AocType == AocTypes.EOP ",
+ "\n && x.Identity.EstimateType != EstimateTypes.A)",
+ "\n );",
+ "\n public double Value => GetStorage().GetValue(Identity.Id, Identity.AmountType, Identity.EstimateType, Identity.AccidentYear); ",
+ "\n}",
+ "\n",
+ "\npublic interface EndOfPeriodActual : ActualBase",
+ "\n{",
+ "\n double ActualBase.Value => GetScope((Identity.Id, InputSource.Actual)).Values",
+ "\n .Sum(aocStep => GetScope((Identity.Id with {AocType = aocStep.AocType, Novelty = aocStep.Novelty}, Identity.AmountType, Identity.EstimateType, Identity.AccidentYear)).Value);",
+ "\n}",
+ "\n",
+ "\npublic interface EmptyValuesActual : ActualBase",
+ "\n{",
+ "\n double ActualBase.Value => 0;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "hZgnWCXsbEm7b3a_M5X91Q",
+ "cell_type": "markdown",
+ "source": [
+ "An example of Actual Base figures can be found [here](../Test/SpecificationsImportActuals#base-actual)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "seP-q4-pNEKPbBJB6XWgGQ",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Actuals",
+ "\nThe Actuals correspond to ActualBase values with estimate type $A$.",
+ "\nThe only valid Aoc step is Release:",
+ "\n",
+ "\n$$",
+ "\n\\text{Actual} (\\text{Release}) = \\text{Actual Base} (\\text{Release})|_{\\text{Estimate Type} = A}",
+ "\n$$"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "rA5FAU7rP0mVtOb_OMRAQQ",
+ "cell_type": "code",
+ "source": [
+ "public interface Actual : IScope",
+ "\n{",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(EstimateType))]",
+ "\n string EstimateType => EstimateTypes.A;",
+ "\n ",
+ "\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray();",
+ "\n ",
+ "\n [NotVisible]",
+ "\n ActualBase[] Actuals => GetScope(Identity.DataNode).ActualAmountTypes",
+ "\n .SelectMany(at => accidentYears",
+ "\n .Select(ay => GetScope((Identity, at, EstimateType, ay)))).ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "tQS8QPziAEWrDh1ztulzDw",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Advance Actuals",
+ "\n",
+ "\n**Advance Actuals** are those cashflows with due date inside the reporting period but which occured *before* the reporting period - They include:",
+ "\n- Receivable Claims",
+ "\n- Receivable Expenses",
+ "\n- Payable Premiums",
+ "\n",
+ "\nAdvance Actuals are given by",
+ "\n",
+ "\n$$",
+ "\n\\text{Advance Actual} (\\text{AoC step}) = \\text{Actual Base} (\\text{AoC step})|_{\\text{Estimate Type} = AA}",
+ "\n$$"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "BGCY3AvaxkWvnU8Py4UK5w",
+ "cell_type": "code",
+ "source": [
+ "public interface AdvanceActual : IScope",
+ "\n{",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(EstimateType))]",
+ "\n string EstimateType => EstimateTypes.AA;",
+ "\n ",
+ "\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray();",
+ "\n ",
+ "\n [NotVisible]",
+ "\n ActualBase[] Actuals => GetScope(Identity.DataNode).ActualAmountTypes",
+ "\n .SelectMany(at => accidentYears",
+ "\n .Select(ay => GetScope((Identity, at, EstimateType, ay)))).ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "EDA0vEXMd0602tAx8vQ8Eg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Overdue Actuals",
+ "\n",
+ "\n**Overdue Actuals** are those cashflows with due date inside the reporting period but which occur *after* the reporting period - They contain:",
+ "\n- Payable Claims",
+ "\n- Payable Expenses",
+ "\n- Receivable Premiums",
+ "\n",
+ "\nThe sign convention is the inverse of the default behavior - In particular: Premiums have positive value, whereas Claims and Expenses have negative value.",
+ "\n",
+ "\nThe Overdue Actuals are given by",
+ "\n",
+ "\n$$",
+ "\n\\text{Overdue Actual} (\\text{AoC step}) = \\text{Actual Base} (\\text{AoC step})|_{\\text{Estimate Type} = OA}",
+ "\n$$"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "JhdC-O-53k-OPdsSNtyTqQ",
+ "cell_type": "code",
+ "source": [
+ "public interface OverdueActual : IScope",
+ "\n{",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(EstimateType))]",
+ "\n string EstimateType => EstimateTypes.OA;",
+ "\n ",
+ "\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray();",
+ "\n ",
+ "\n [NotVisible]",
+ "\n ActualBase[] Actuals => GetScope(Identity.DataNode).ActualAmountTypes",
+ "\n .SelectMany(at => accidentYears",
+ "\n .Select(ay => GetScope((Identity, at, EstimateType, ay)))).ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "BU02PReB0UyuCXL3rgF7kw",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n### Deferrable Actuals",
+ "\n",
+ "\nFinally, Deferrable Actuals are given by",
+ "\n",
+ "\n$$",
+ "\n\\text{Deferrable Actual} (\\text{AoC step}) = \\left\\{",
+ "\n\\begin{array}{rl}",
+ "\n\\sum_{\\text{Amount Type}~\\in~\\text{\\{ACA, AEA}\\}}\\text{Actual Base}(\\rm{CF})|_{\\text{Estimate Type = A}} ~, & \\text{if AoC Step's AoC Type = CF } \\\\",
+ "\n- \\text{Amortization Factor} \\cdot \\big( \\text{Deferrable Actual}(\\rm{BOP}) + \\text{Deferrable Actual}(\\rm{CF}) \\big) ~, & \\text{if AoC Step's AoC Type = AM } \\\\",
+ "\n\\text{Deferrable Actual}(\\rm{BOP}) + \\text{Deferrable Actual}(\\rm{CF}) + \\text{Deferrable Actual}(\\rm{AM}) ~, & \\text{if AoC Step's AoC Type = EOP } \\\\",
+ "\n\\text{Input Actual}|_{\\text{Estimate Type = DA}} ~, & \\text{ otherwise } \\\\",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n",
+ "\nwhere $ACA$ and $AEA$ are *Aquisition* Amount Types from **Attributable Commission** and **Attributable Expenses**, respectively."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "ydbJzjQG6kGLXvpaU9QqxQ",
+ "cell_type": "code",
+ "source": [
+ "public interface DeferrableActual : IScope",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.Identity.ValuationApproach == ValuationApproaches.VFA, ",
+ "\n p => p.ForMember(s => s.EconomicBasis))",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.CF)",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.AM)",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.EOP)",
+ "\n );",
+ "\n ",
+ "\n [IdentityProperty][NotVisible][Dimension(typeof(EstimateType))]",
+ "\n string EstimateType => EstimateTypes.DA;",
+ "\n ",
+ "\n [NotVisible] string EconomicBasis => EconomicBases.L;",
+ "\n ",
+ "\n public double Value => GetStorage().GetValue(Identity, (string)null, EstimateType, (int?)null);",
+ "\n}",
+ "\n",
+ "\npublic interface DeferrableActualForCurrentBasis : DeferrableActual",
+ "\n{",
+ "\n [NotVisible] string DeferrableActual.EconomicBasis => EconomicBases.C;",
+ "\n}",
+ "\n",
+ "\npublic interface ReleaseDeferrable : DeferrableActual",
+ "\n{",
+ "\n double DeferrableActual.Value => GetStorage().GetAttributableExpenseAndCommissionAmountType().Sum(at => GetScope((Identity, at, EstimateTypes.A, (int?)null)).Value);",
+ "\n}",
+ "\n",
+ "\npublic interface AmortizationDeferrable : DeferrableActual",
+ "\n{",
+ "\n private double AmortizationFactor => GetScope(Identity, o => o.WithContext(EconomicBasis)).Value;",
+ "\n private double AggregatedDeferrable => GetScope((Identity, InputSource.Actual)).Values",
+ "\n .Sum(aocStep => GetScope(Identity with {AocType = aocStep.AocType, Novelty = aocStep.Novelty}).Value);",
+ "\n double DeferrableActual.Value => -1d * AggregatedDeferrable * AmortizationFactor;",
+ "\n}",
+ "\n",
+ "\npublic interface EndOfPeriodDeferrable : DeferrableActual",
+ "\n{",
+ "\n double DeferrableActual.Value => GetScope((Identity, InputSource.Actual)).Values",
+ "\n .Sum(aocStep => GetScope(Identity with {AocType = aocStep.AocType, Novelty = aocStep.Novelty}).Value);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "p-VbKXd52UuaKecFYnE8iQ",
+ "cell_type": "markdown",
+ "source": [
+ "An example of Deferrable Actual figures can be found [here](../Test/SpecificationsImportActuals#deferrable-actual)."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "Mtf0XXuvUkS76O6DBZUr4A",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Contractual Service Margin, Loss Component and Loss Recovery Component",
+ "\n",
+ "\nThe Contractual Service Margin ($CSM$) denotes the unearned profit from an insurance contract or group of insurance contracts and plays a critical role in the calculation of profit & loss values. Similarly, the unearned loss is denoted by Loss Component ($LC$), Loss Recovery Component in the case of reinsurance contracts."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "Wq-e5YleykGCYEopzDLT4A",
+ "cell_type": "markdown",
+ "source": [
+ "## Experience Adjustment on Premium"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "JwOnE_oxnE6u4nU3ZQku3Q",
+ "cell_type": "markdown",
+ "source": [
+ "The Experience Adjustment (EA) on Premiums weights the cash-flow (CF aocSteps) for premium amount types by the PremiumAllocationFactor input for each group of insurance contract. ",
+ "\nThe contributions of present values and actuals are computed separately.",
+ "\n",
+ "\n$$",
+ "\nEA (\\rm{PV}) = \\text{Premium Allocation Factor} \\cdot \\big( PV (\\text{AocType = CF}) \\big)~, \\\\",
+ "\n$$",
+ "\n$$",
+ "\nEA (\\text{Actual}) = \\text{Premium Allocation Factor} \\cdot \\big( \\text{Actual}(\\text{AocType = CF}) + \\text{Advance Actual}(\\text{AocType = CF})+ \\text{Overdue Actual}(\\text{AocType = CF}) \\big) ~,",
+ "\n$$",
+ "\nwhere amount type premium and its children are considered, novelties in-force and new business are considered for $PV$ whereas novelty combined is considered for Actual. The allocation is always done in the finest granularity (novelty, line of business, ..) possible."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "pEi0POgs0UejZ_BJaXi_LQ",
+ "cell_type": "code",
+ "source": [
+ "public interface BeExperienceAdjustmentForPremium : IScope",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s",
+ "\n .WithApplicability(x => x.Identity.AocType != AocTypes.CF));",
+ "\n",
+ "\n string EstimateType => EstimateTypes.BEPA;",
+ "\n string EconomicBasis => EconomicBases.L;",
+ "\n ",
+ "\n PvBase[] ByAmountType => GetStorage().GetPremiums().Select(pr => GetStorage().GetPremiumAllocationFactor(Identity) * GetScope((Identity, pr, EstimateTypes.BE, (int?)null), o => o.WithContext(EconomicBasis))).ToArray(); ",
+ "\n}",
+ "\n",
+ "\npublic interface DefaultValueBeExperienceAdjustmentForPremium : BeExperienceAdjustmentForPremium",
+ "\n{",
+ "\n PvBase[] BeExperienceAdjustmentForPremium.ByAmountType => Enumerable.Empty().ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "CA2eQXhYYUevjiAr92nN6Q",
+ "cell_type": "code",
+ "source": [
+ "public interface ActualExperienceAdjustmentForPremium : IScope",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
+ "\n builder.ForScope(s => s",
+ "\n .WithApplicability(x => x.Identity.AocType != AocTypes.CF));",
+ "\n ",
+ "\n public ActualBase[] ByAmountTypeAndEstimateType => GetStorage().GetPremiums().SelectMany(pr => ",
+ "\n GetStorage().ExperienceAdjustEstimateTypeMapping.Keys",
+ "\n .Select(et => GetStorage().GetPremiumAllocationFactor(Identity) * ",
+ "\n GetScope((Identity, pr, et, (int?)null)))).ToArray(); ",
+ "\n}",
+ "\n",
+ "\npublic interface DefaultValueActualExperienceAdjustmentForPremium : ActualExperienceAdjustmentForPremium",
+ "\n{",
+ "\n ActualBase[] ActualExperienceAdjustmentForPremium.ByAmountTypeAndEstimateType => Enumerable.Empty().ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "czmwLF-VTkKtolr0jqiX8w",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Technical Margin",
+ "\n",
+ "\nFor the computation of the $CSM$ or $LC$ component values for each step of the [AoC Step Structure](#aoc-step-structure), it is convenient to introduce the ",
+ "\nnotion of technical margin $TM$. In the case of BBA methodology, the Locked-in interest rates discounting is applied to obtain the PV and RA values.",
+ "\n",
+ "\nThis can be summarized as follows:",
+ "\n",
+ "\n$$",
+ "\nTM(s) = \\left\\{",
+ "\n\\begin{array}{rl}",
+ "\nTM(\\rm{EOP}) \\text{ of the previous period} ~ & \\text{if }s = \\text{BOP and Novelty is In-Force}.",
+ "\n\\\\",
+ "\n0 ~ & \\text{if }s = \\text{CF}.",
+ "\n\\\\",
+ "\nIAF \\cdot~\\text{Aggregated}~TM(\\text{IA}) ~ & \\text{if }s = \\text{IA and Novelty is In-Force}.",
+ "\n\\\\",
+ "\n\\rm{Premiums} + \\text{Attributable Expense and Commissions} + \\text{Investment Claims} ~ & \\text{if }s = \\text{EA}.",
+ "\n\\\\",
+ "\n-AF \\cdot~\\text{Aggregated}~TM(\\text{AM})~ & \\text{if }s = \\text{AM}.",
+ "\n\\\\",
+ "\n\\text{PV}(\\text{s})\\bigg|_{\\substack{\\text{Non Attributable} \\\\ \\text{Amount Types} \\\\ \\text{excluded}}} ",
+ "\n+ \\text{RA}(\\text{s})~ & \\text{otherwise} ",
+ "\n\\end{array}",
+ "\n\\right.",
+ "\n$$",
+ "\n",
+ "\nwhere",
+ "\n",
+ "\n$$",
+ "\n\\text{Aggregated}~TM (\\text{AoC step}) = \\sum_{s\\in\\text{ previous AoC steps}} TM(s)~.",
+ "\n$$",
+ "\n",
+ "\nand the Interest Accretion Factor ($IAF$) is given by",
+ "\n",
+ "\n$$",
+ "\nIAF = \\prod_{i=1}^{TS} \\text{Interest}_i - 1",
+ "\n$$",
+ "\n",
+ "\nwhere $\\text{Interest}_i$ is the monthly interest factor obtained from the [Yield Curve](#yield-curves) and $TS$ is the Time-Step.",
+ "\n",
+ "\nFinally, the Premiums, Attributable Expense and Commissions and Investment Claims terms are given by:",
+ "\n",
+ "\n$$",
+ "\n\\rm{Premiums} = \\sum_{\\text{Amount Type}\\in\\{\\text{PR and its children}\\}}",
+ "\nEA(\\rm{PV}) - EA(\\text{Actual}) ~,",
+ "\n$$",
+ "\n",
+ "\n$$",
+ "\n\\text{Attributable Expense and Commissions} = \\sum_{\\text{Amount Type}\\in\\{\\rm{ACA}, \\rm{AEA}\\}}",
+ "\n\\big(PV_{\\text{Novelty = I}} + PV_{\\text{Novelty = N}} \\big) - \\text{Actual}_{\\text{Novelty=C}} ~,",
+ "\n$$",
+ "\n",
+ "\n$$",
+ "\n\\text{Investment Claims } = \\sum_{\\text{Amount Type}\\in\\{\\text{ICO and its children}\\}}",
+ "\n\\big(PV_{\\text{Novelty = I}} + PV_{\\text{Novelty = N}} \\big) - \\big( \\text{Actual}_{\\text{Novelty=C}} + \\text{Advance Actual}_{\\text{Novelty=C}}+ \\text{Overdue Actual}_{\\text{Novelty=C}} \\big) ~,",
+ "\n$$",
+ "\n",
+ "\nwhere the AoC Step **CF** is implicit for all formulas, $PV$ is the [present value](#present-value) with Calculation Type **BE**, and Actuals have Estimate Types **A**, **AA**, and **OA** (see details [here](#actual-values))."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "uWXzMWj2I0mfBjJ6P43ZFg",
+ "cell_type": "code",
+ "source": [
+ "public interface TechnicalMargin : IScope",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) => ",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.Identity.ValuationApproach == ValuationApproaches.VFA, p => p.ForMember(s => s.EconomicBasis))",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.BOP && x.Identity.Novelty == Novelties.I)",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.CF)",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.IA && x.Identity.Novelty == Novelties.I)",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.EA && !x.Identity.IsReinsurance)",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.AM)",
+ "\n );",
+ "\n ",
+ "\n [NotVisible] string EconomicBasis => EconomicBases.L;",
+ "\n ",
+ "\n double Value => GetScope(Identity.DataNode).BeAmountTypes",
+ "\n .Except(GetStorage().GetNonAttributableAmountType())",
+ "\n .Sum(at => GetScope((Identity, at, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) +",
+ "\n GetScope(Identity).Value;",
+ "\n ",
+ "\n double AggregatedValue => GetScope((Identity, InputSource.Cashflow)).Values",
+ "\n .Sum(aoc => GetScope(Identity with {AocType = aoc.AocType, Novelty = aoc.Novelty}).Value);",
+ "\n}",
+ "\n",
+ "\npublic interface TechnicalMarginForCurrentBasis : TechnicalMargin",
+ "\n{",
+ "\n [NotVisible] string TechnicalMargin.EconomicBasis => EconomicBases.C;",
+ "\n}",
+ "\n",
+ "\npublic interface TechnicalMarginForBOP : TechnicalMargin",
+ "\n{",
+ "\n private double ValueCsm => GetStorage().GetValue(Identity, null, EstimateTypes.C, null);",
+ "\n private double ValueLc => GetStorage().GetValue(Identity, null, EstimateTypes.L, null);",
+ "\n private double ValueLr => GetStorage().GetValue(Identity, null, EstimateTypes.LR, null);",
+ "\n ",
+ "\n double TechnicalMargin.Value => -1d * ValueCsm + ValueLc + ValueLr;",
+ "\n}",
+ "\n",
+ "\npublic interface TechnicalMarginDefaultValue : TechnicalMargin",
+ "\n{",
+ "\n double TechnicalMargin.Value => default;",
+ "\n}",
+ "\n",
+ "\npublic interface TechnicalMarginForIA : TechnicalMargin",
+ "\n{",
+ "\n private int timeStep => GetStorage().GetTimeStep(0);//Identity.Id.ProjectionPeriod",
+ "\n private int shift => GetStorage().GetShift(0);//Identity.Id.ProjectionPeriod",
+ "\n ",
+ "\n private double[] monthlyInterestFactor => GetScope(Identity, o => o.WithContext(EconomicBasis)).Interest;",
+ "\n ",
+ "\n private double interestAccretionFactor => Enumerable.Range(shift,timeStep)",
+ "\n .Select(i => GetElementOrDefault(monthlyInterestFactor, i/12))",
+ "\n .Aggregate(1d, (x, y) => x * y ) - 1d;",
+ "\n ",
+ "\n double TechnicalMargin.Value => AggregatedValue * interestAccretionFactor;",
+ "\n}",
+ "\n",
+ "\npublic interface TechnicalMarginForEA : TechnicalMargin",
+ "\n{",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilderInner(ApplicabilityBuilder builder) => ",
+ "\n builder.ForScope(s => s.WithApplicability(x => x.Identity.IsReinsurance));",
+ "\n ",
+ "\n private string referenceAocType => GetScope(Identity).Value.AocType;",
+ "\n ",
+ "\n private double premiums => GetStorage().GetNovelties(referenceAocType, InputSource.Cashflow)",
+ "\n .Sum(n => GetScope(Identity with {AocType = referenceAocType, Novelty = n}).ByAmountType.Sum(sc => sc.Value)) -",
+ "\n GetScope(Identity with {AocType = referenceAocType, Novelty = Novelties.C}).ByAmountTypeAndEstimateType.Sum(sc => sc.Value);",
+ "\n ",
+ "\n private double attributableExpenseAndCommissions => GetStorage().GetAttributableExpenseAndCommissionAmountType().Sum(d =>",
+ "\n GetStorage().GetNovelties(referenceAocType, InputSource.Cashflow)",
+ "\n .Sum(n => GetScope((Identity with {AocType = referenceAocType, Novelty = n}, d, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) -",
+ "\n GetScope((Identity with {AocType = referenceAocType, Novelty = Novelties.C}, d, EstimateTypes.A, (int?)null)).Value);",
+ "\n",
+ "\n private double investmentClaims => GetStorage().GetInvestmentClaims().Sum(ic =>",
+ "\n GetStorage().GetNovelties(referenceAocType, InputSource.Cashflow)",
+ "\n .Sum(n => GetScope((Identity with {AocType = referenceAocType, Novelty = n}, ic, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) -",
+ "\n GetScope((Identity with {AocType = referenceAocType, Novelty = Novelties.C}, ic, EstimateTypes.A, (int?)null)).Value - ",
+ "\n GetScope((Identity with {AocType = referenceAocType, Novelty = Novelties.C}, ic, EstimateTypes.AA, (int?)null)).Value -",
+ "\n GetScope((Identity with {AocType = referenceAocType, Novelty = Novelties.C}, ic, EstimateTypes.OA, (int?)null)).Value);",
+ "\n ",
+ "\n double TechnicalMargin.Value => premiums + attributableExpenseAndCommissions + investmentClaims;",
+ "\n}",
+ "\n",
+ "\npublic interface TechnicalMarginForAM : TechnicalMargin",
+ "\n{",
+ "\n double TechnicalMargin.Value => -1d * AggregatedValue * GetScope(Identity, o => o.WithContext(EconomicBasis)).Value;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "eV_qYONYOU-QbM_aQVg7vg",
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n## Switch Logic",
+ "\n ",
+ "\nThe $CSM$ and $LC$ components are computed from the [technical margin](#technical-margin). In particular, for a given AoC step $s$, TM is allocated to the $LC$ when $\\text{Aggregated } TM$ is positive whereas it is allocated to the $CSM$ when $\\text{Aggregated } TM$ is negative:",
+ "\n",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\nCSM({\\text{Aoc step}}) = 0,~~ LC({\\text{AoC step}}) = TM({\\text{AoC step}}) ~ & \\text{if }\\text{Aggregated }TM({\\text{AoC step}}) > 0.",
+ "\n\\\\",
+ "\nCSM({\\text{Aoc step}}) = - TM({\\text{AoC step}}),~~ LC({\\text{AoC step}}) = 0 ~ & \\text{otherwise} ",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\n",
+ "\nThe figures reported under CSM are the opposite of the TM value in order to satisfy our sign convention.",
+ "\n",
+ "\nIt is possible to switch from $CSM$ to $LC$ and from $LC$ to $CSM$ at any AoC step $s$ with the only exception of **Amortization** where there is no switch from the previous step.",
+ "\nWhen a switch occurs the total contribution to the $CSM$ ($LC$) prior the switching step is brought to 0 and the remaing amount is allocated to $LC$ ($CSM$).",
+ "\n",
+ "\n",
+ "\n### Gross case (i.e. no reinsurance)",
+ "\n",
+ "\nThe switch logic is applied ***separately*** to the In-Force and New Business novelties. The Combined Liability Aoc Step **CL** will bring both contributions to CSM and LC together as the novelities are summed up.",
+ "\n",
+ "\nIn detail, and as we go through the AoC steps in the AoC chain, we have",
+ "\n",
+ "\n**A)** For the **BOP**:",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\nCSM(\\text{BOP}) &= CSM(\\text{EOP}) \\text{ of the previous period, for Novelty In-Force}",
+ "\n\\\\",
+ "\nLC(\\text{BOP}) &= LC(\\text{EOP}) \\text{ of the previous period, for Novelty In-Force}",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\n",
+ "\n**B)** For the **following AoC steps**, the switch logic is preferably formulated using the delta variations between steps, $\\Delta CSM$ and $\\Delta LC$ for the CSM and the LC respectively.",
+ "\n",
+ "\nThe switch logic for these AoC steps with the *exception* of Combined Liability is:",
+ "\n",
+ "\nIf $\\text{Aggregated }TM(\\text{AoC Step}) > 0$ and $\\text{Aggregated }TM(\\text{AoC Step}) + TM(\\text{AoC Step}) \\le 0$, then there is a switch from $LC$ to $CSM$:",
+ "\n",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\n\\Delta CSM(\\text{AoC step}) &= -TM(\\text{AoC Step}) -\\text{Aggregated } TM(\\text{AoC Step})",
+ "\n\\\\",
+ "\n\\Delta LC(\\text{AoC step}) &= -\\text{Aggregated } TM(\\text{AoC Step}) ",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\nOn the other hand, if $\\text{Aggregated }TM(\\text{AoC Step}) \\le 0$ and $\\text{Aggregated }TM(\\text{AoC Step}) + TM(\\text{AoC Step}) > 0$, then the switch is from $CSM$ to $LC$:",
+ "\n",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\n\\Delta CSM(\\text{AoC step}) &= \\text{Aggregated } TM(\\text{AoC Step}) ",
+ "\n\\\\",
+ "\n\\Delta LC(\\text{AoC step}) &= TM(\\text{AoC Step}) + \\text{Aggregated } TM(\\text{AoC Step}) ",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\nIf there is no switch from $CSM$, i.e. $\\text{Aggregated }TM(\\text{AoC Step}) \\le 0$ and $\\text{Aggregated }TM(\\text{AoC Step}) + TM(\\text{AoC Step}) \\le 0 $, then:",
+ "\n",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\n\\Delta CSM(\\text{AoC step}) &= -TM(\\text{AoC Step})",
+ "\n\\\\",
+ "\n\\Delta LC(\\text{AoC step}) &= 0",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\nAnd finally, if there is no switch from $LC$, i.e. $\\text{Aggregated }TM(\\text{AoC Step}) > 0$ and $\\text{Aggregated }TM(\\text{AoC Step}) + TM(\\text{AoC Step}) \\ge 0 $, then:",
+ "\n",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\n\\Delta CSM(\\text{AoC step}) &= 0",
+ "\n\\\\",
+ "\n\\Delta LC(\\text{AoC step}) &= TM(\\text{AoC Step})",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\n**C)** For the AoC step Combined Liability **CL**, the switch logic is similar to the one above, except that a switch from $LC$ to $CSM$ can happen **because of New Business and despite of In-Force**, in which case we have:",
+ "\n",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\n\\Delta CSM(\\text{AoC step}) &= -TM(\\text{AoC Step}) -\\big(\\text{Aggregated } TM(\\text{Last In-Force AoC step})+TM(\\text{Last In-Force AoC step}) \\big)",
+ "\n\\\\",
+ "\n\\Delta LC(\\text{AoC step}) &= -\\big(\\text{Aggregated } TM(\\text{Last In-Force AoC step}) + TM(\\text{Last In-Force AoC step}) \\big)",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\nIf, on the other hand, the switch from $LC$ to $CSM$ happens **because of In-Force and despite of New Business**, then we have:",
+ "\n",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\n\\Delta CSM(\\text{AoC step}) &= -TM(\\text{AoC Step}) -\\big(\\text{Aggregated } TM(\\text{Last NB AoC step})+TM(\\text{Last NB AoC step}) \\big)",
+ "\n\\\\",
+ "\n\\Delta LC(\\text{AoC step}) &= -\\big(\\text{Aggregated } TM(\\text{Last NB AoC step}) + TM(\\text{Last NB AoC step}) \\big)",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\nFor the switch in the other direction, i.e. from $CSM$ to $LC$ the formulas are similar except that LC and CSM are swapped.",
+ "\n",
+ "\n**D)** Finally, for the last AoC step, the **EOP**, we have:",
+ "\n",
+ "\n$$",
+ "\n\\begin{array}{rl}",
+ "\nCSM(\\text{EOP}) &= \\sum_{s~\\in~\\text{previous AoC steps}}\\Delta CSM(s)",
+ "\n\\\\",
+ "\nLC(\\text{EOP}) &= \\sum_{s~\\in~\\text{previous AoC steps}}\\Delta LC(s)",
+ "\n\\end{array}",
+ "\n$$",
+ "\n",
+ "\n",
+ "\n### Reinsurance case",
+ "\n",
+ "\nFor the reinsurance case, the switch logic is identical to the one described above, except that it uses the gross Technical Margins multiplied by the weights coming from the Reinsurance Coverage Parameter (see [Data Node Parameters](../DataModel/DataStructure#data-node-parameters)). In case a GRIC has multiple GICs, then these weighted $TM$s are aggregated."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "UnZAtItpLkaBp5iMJesSzw",
+ "cell_type": "code",
+ "source": [
+ "public interface AllocateTechnicalMargin: IScope",
+ "\n{",
+ "\n //Switch",
+ "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) => ",
+ "\n builder.ForScope(s => s",
+ "\n .WithApplicability(x => x.Identity.IsReinsurance && x.Identity.AocType == AocTypes.CL) ",
+ "\n .WithApplicability(x => x.Identity.IsReinsurance, ",
+ "\n p => p.ForMember(s => s.ComputedEstimateType)",
+ "\n .ForMember(s => s.HasSwitch))",
+ "\n .WithApplicability(x => x.GetStorage().IsSecondaryScope(x.Identity.DataNode)) ",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.BOP)",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.CL)",
+ "\n .WithApplicability(x => x.Identity.AocType == AocTypes.EOP)",
+ "\n );",
+ "\n ",
+ "\n [NotVisible] double AggregatedTechnicalMargin => GetScope(Identity).AggregatedValue; ",
+ "\n [NotVisible] double TechnicalMargin => GetScope(Identity).Value;",
+ "\n ",
+ "\n [NotVisible] string ComputedEstimateType => ComputeEstimateType(GetScope(Identity).AggregatedValue + TechnicalMargin);",
+ "\n [NotVisible] bool HasSwitch => ComputedEstimateType != ComputeEstimateType(GetScope(Identity).AggregatedValue);",
+ "\n ",
+ "\n //Allocate ",
+ "\n [NotVisible] string EstimateType => GetContext();",
+ "\n ",
+ "\n double Value => (HasSwitch, EstimateType == ComputedEstimateType) switch {",
+ "\n (true, true) => TechnicalMargin + AggregatedTechnicalMargin,",
+ "\n (true, false) => -1d * AggregatedTechnicalMargin,",
+ "\n (false, true) => TechnicalMargin,",
+ "\n _ => default",
+ "\n };",
+ "\n ",
+ "\n string ComputeEstimateType(double aggregatedTechnicalMargin) => aggregatedTechnicalMargin > Precision ? EstimateTypes.L : EstimateTypes.C;",
+ "\n}",
+ "\n",
+ "\npublic interface ComputeAllocateTechnicalMarginWithIfrsVariable : AllocateTechnicalMargin",
+ "\n{ ",
+ "\n double AllocateTechnicalMargin.TechnicalMargin => ComputeTechnicalMarginFromIfrsVariables(Identity);",
+ "\n double AllocateTechnicalMargin.AggregatedTechnicalMargin => GetScope((Identity, InputSource.Cashflow)).Values",
+ "\n .Sum(aoc => ComputeTechnicalMarginFromIfrsVariables(Identity with {AocType = aoc.AocType, Novelty = aoc.Novelty}));",
+ "\n ",
+ "\n private double ComputeTechnicalMarginFromIfrsVariables(ImportIdentity id)",
+ "\n {",
+ "\n return GetStorage().GetValue(Identity, null, EstimateTypes.LR, null) +",
+ "\n GetStorage().GetValue(Identity, null, EstimateTypes.L, null) - ",
+ "\n GetStorage().GetValue(Identity, null, EstimateTypes.C, null);",
+ "\n }",
+ "\n}",
+ "\n",
+ "\npublic interface AllocateTechnicalMarginForReinsurance : AllocateTechnicalMargin",
+ "\n{ ",
+ "\n //TODO add Reinsurance Coverage Update (RCU, Novelty=I) AocStep",
+ "\n private IEnumerable underlyingGic => GetStorage().GetUnderlyingGic(Identity);",
+ "\n ",
+ "\n private double weightedUnderlyingTM => underlyingGic.Sum(gic => GetStorage().GetReinsuranceCoverage(Identity, gic) * ",
+ "\n GetScope(Identity with {DataNode = gic}).TechnicalMargin);",
+ "\n ",
+ "\n private double weightedUnderlyingAggregatedTM => underlyingGic.Sum(gic => GetStorage().GetReinsuranceCoverage(Identity, gic) * ",
+ "\n GetScope(Identity with {DataNode = gic}).AggregatedTechnicalMargin);",
+ "\n ",
+ "\n private string ComputeReinsuranceEstimateType(double aggregatedFcf) => aggregatedFcf > Precision ? EstimateTypes.LR : EstimateTypes.C;",
+ "\n ",
+ "\n [NotVisible] string AllocateTechnicalMargin.ComputedEstimateType => ComputeReinsuranceEstimateType(weightedUnderlyingAggregatedTM + weightedUnderlyingTM);",
+ "\n [NotVisible] bool AllocateTechnicalMargin.HasSwitch => ComputedEstimateType != ComputeReinsuranceEstimateType(weightedUnderlyingAggregatedTM); ",
+ "\n}",
+ "\n",
+ "\npublic interface AllocateTechnicalMarginForReinsuranceCL : AllocateTechnicalMargin",
+ "\n{ ",
+ "\n //In common1",
+ "\n private IEnumerable underlyingGic => GetStorage().GetUnderlyingGic(Identity);",
+ "\n ",
+ "\n private double weightedUnderlyingTM => underlyingGic.Sum(gic => GetStorage().GetReinsuranceCoverage(Identity, gic) * ",
+ "\n GetScope(Identity with {DataNode = gic}).TechnicalMargin);",
+ "\n ",
+ "\n private double weightedUnderlyingAggregatedTM => underlyingGic.Sum(gic => GetStorage().GetReinsuranceCoverage(Identity, gic) * ",
+ "\n GetScope(Identity with {DataNode = gic}).AggregatedTechnicalMargin);",
+ "\n private string ComputeReinsuranceEstimateType(double aggregatedFcf) => aggregatedFcf > Precision ? EstimateTypes.LR : EstimateTypes.C;",
+ "\n ",
+ "\n string AllocateTechnicalMargin.ComputedEstimateType => ComputeReinsuranceEstimateType(weightedUnderlyingAggregatedTM + weightedUnderlyingTM);",
+ "\n //In common2",
+ "\n private double balancingValue => GetScope((Identity, InputSource.Cashflow))",
+ "\n .Values",
+ "\n .GroupBy(x => x.Novelty)",
+ "\n .Select(g => g.Last())",
+ "\n .Sum(aoc => { ",
+ "\n var id = Identity with {AocType = aoc.AocType, Novelty = aoc.Novelty};",
+ "\n return GetScope(id).ComputedEstimateType != ComputedEstimateType ? ",
+ "\n GetScope(id).TechnicalMargin + GetScope(id).AggregatedTechnicalMargin",
+ "\n : (double)default; });",
+ "\n ",
+ "\n [NotVisible] bool AllocateTechnicalMargin.HasSwitch => Math.Abs(balancingValue) > Precision;",
+ "\n [NotVisible] double AllocateTechnicalMargin.AggregatedTechnicalMargin => balancingValue; ",
+ "\n}",
+ "\n",
+ "\npublic interface AllocateTechnicalMarginForCl : AllocateTechnicalMargin",
+ "\n{",
+ "\n private double balancingValue => GetScope((Identity, InputSource.Cashflow))",
+ "\n .Values",
+ "\n .GroupBy(x => x.Novelty)",
+ "\n .Select(g => g.Last())",
+ "\n .Sum(aoc => { ",
+ "\n var id = Identity with {AocType = aoc.AocType, Novelty = aoc.Novelty};",
+ "\n return GetScope(id).ComputedEstimateType != ComputedEstimateType ? ",
+ "\n GetScope(id).TechnicalMargin + GetScope(id).AggregatedTechnicalMargin",
+ "\n : (double)default; });",
+ "\n",
+ "\n [NotVisible] bool AllocateTechnicalMargin.HasSwitch => Math.Abs(balancingValue) > Precision;",
+ "\n ",
+ "\n [NotVisible] double AllocateTechnicalMargin.AggregatedTechnicalMargin => balancingValue;",
+ "\n}",
+ "\n",
+ "\npublic interface AllocateTechnicalMarginForBop : AllocateTechnicalMargin",
+ "\n{ ",
+ "\n bool AllocateTechnicalMargin.HasSwitch => false;",
+ "\n}",
+ "\n",
+ "\npublic interface AllocateTechnicalMarginForEop : AllocateTechnicalMargin",
+ "\n{",
+ "\n double AllocateTechnicalMargin.Value => GetScope((Identity, InputSource.Cashflow)).Values",
+ "\n .Sum(aoc => GetScope(Identity with {AocType = aoc.AocType, Novelty = aoc.Novelty}).Value);",
+ "\n [NotVisible] string AllocateTechnicalMargin.ComputedEstimateType => ComputeEstimateType(AggregatedTechnicalMargin);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "vY4oXJJJ8ke97-m8ASMsAw",
+ "cell_type": "markdown",
+ "source": [
+ "For the **Group of Reinsurance Contracts** (GRICs), the switch is computed within the underlying GIC context and $CSM$ and $LR$ are then computed in the same manner as for the underlying GICs CSM and LC."
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "DqGSuXbt6USNumZ69sErWg",
+ "cell_type": "markdown",
+ "source": [
+ "The scopes below are simply used to set the appropriate Estimate Type (C for $CSM$, L for $LC$ and LR for $LCR$), as well as to set $CSM$ values to be positive:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "n2dT4_znvk2eUSMMef6OIg",
+ "cell_type": "code",
+ "source": [
+ "public interface Csm : IScope",
+ "\n{",
+ "\n [NotVisible]string EstimateType => EstimateTypes.C;",
+ "\n ",
+ "\n double Value => -1d * GetScope(Identity, o => o.WithContext(EstimateType)).Value;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "1fUoYZjlOki4f5GCvCmpoA",
+ "cell_type": "code",
+ "source": [
+ "public interface Lc : IScope",
+ "\n{",
+ "\n [NotVisible]string EstimateType => EstimateTypes.L;",
+ "\n ",
+ "\n double Value => GetScope(Identity, o => o.WithContext(EstimateType)).Value;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "TmqOsKRObkaw3PKUdp_lDw",
+ "cell_type": "code",
+ "source": [
+ "public interface LoReCo : IScope",
+ "\n{ ",
+ "\n [NotVisible]string EstimateType => EstimateTypes.LR;",
+ "\n ",
+ "\n double Value => GetScope(Identity, o => o.WithContext(EstimateType)).Value;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 1,
+ "outputs": []
+ },
+ {
+ "id": "_ejvWQaq-kSPyTqB4Y2n9Q",
+ "cell_type": "markdown",
+ "source": [
+ "## Computing All Scopes",
+ "\n",
+ "\nSince all the calculations defined in the various scopes are to be performed together, it is useful to introduce the scope ComputeAllScopes below, which given a certain Import Identity and Import Storage, performs all the calculations (defined above) based on the corresponding data:"
+ ],
+ "metadata": {}
+ },
+ {
+ "id": "68_d30x6ZUGoP_UjvJ9SBg",
+ "cell_type": "code",
+ "source": [
+ "public interface ComputeAllScopes: IScope //ComputeIfrsVariable",
+ "\n{",
+ "\n IEnumerable PvLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ",
+ "\n EstimateType = x.Identity.CalculationType, ",
+ "\n DataNode = x.Identity.Id.DataNode, ",
+ "\n AocType = x.Identity.Id.AocType, ",
+ "\n Novelty = x.Identity.Id.Novelty, ",
+ "\n AccidentYear = x.Identity.AccidentYear,",
+ "\n AmountType = x.Identity.AmountType,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n });",
+ "\n IEnumerable PvCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ",
+ "\n EstimateType = x.Identity.CalculationType, ",
+ "\n DataNode = x.Identity.Id.DataNode, ",
+ "\n AocType = x.Identity.Id.AocType, ",
+ "\n Novelty = x.Identity.Id.Novelty, ",
+ "\n AccidentYear = x.Identity.AccidentYear,",
+ "\n AmountType = x.Identity.AmountType,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n });",
+ "\n IEnumerable RaCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ",
+ "\n EstimateType = x.Identity.CalculationType, ",
+ "\n DataNode = x.Identity.Id.DataNode, ",
+ "\n AocType = x.Identity.Id.AocType, ",
+ "\n Novelty = x.Identity.Id.Novelty, ",
+ "\n AccidentYear = x.Identity.AccidentYear,",
+ "\n AmountType = null,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n });",
+ "\n IEnumerable RaLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ",
+ "\n EstimateType = x.Identity.CalculationType, ",
+ "\n DataNode = x.Identity.Id.DataNode, ",
+ "\n AocType = x.Identity.Id.AocType, ",
+ "\n Novelty = x.Identity.Id.Novelty, ",
+ "\n AccidentYear = x.Identity.AccidentYear,",
+ "\n AmountType = null,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n });",
+ "\n private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;",
+ "\n private IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM",
+ "\n ? GetScope(Identity, o => o.WithContext(EconomicBasis))",
+ "\n .RepeatOnce()",
+ "\n .Where(x => Math.Abs(x.Value) >= Precision)",
+ "\n .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,",
+ "\n DataNode = x.Identity.DataNode,",
+ "\n AocType = x.Identity.AocType,",
+ "\n Novelty = x.Identity.Novelty,",
+ "\n EconomicBasis = x.EconomicBasis,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n })",
+ "\n : Enumerable.Empty();",
+ "\n IEnumerable Actual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,",
+ "\n DataNode = x.Identity.Id.DataNode,",
+ "\n AocType = x.Identity.Id.AocType,",
+ "\n Novelty = x.Identity.Id.Novelty,",
+ "\n AccidentYear = x.Identity.AccidentYear,",
+ "\n AmountType = x.Identity.AmountType,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n });",
+ "\n IEnumerable AdvanceActual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,",
+ "\n DataNode = x.Identity.Id.DataNode,",
+ "\n AocType = x.Identity.Id.AocType,",
+ "\n Novelty = x.Identity.Id.Novelty,",
+ "\n AccidentYear = x.Identity.AccidentYear,",
+ "\n AmountType = x.Identity.AmountType,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n });",
+ "\n IEnumerable OverdueActual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,",
+ "\n DataNode = x.Identity.Id.DataNode,",
+ "\n AocType = x.Identity.Id.AocType,",
+ "\n Novelty = x.Identity.Id.Novelty,",
+ "\n AccidentYear = x.Identity.AccidentYear,",
+ "\n AmountType = x.Identity.AmountType,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n });",
+ "\n IEnumerable DeferrableActual => GetScope(Identity).RepeatOnce().Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.EstimateType,",
+ "\n DataNode = x.Identity.DataNode,",
+ "\n AocType = x.Identity.AocType,",
+ "\n Novelty = x.Identity.Novelty,",
+ "\n AccidentYear = null,",
+ "\n Value = x.Value,",
+ "\n Partition = GetStorage().TargetPartition",
+ "\n });",
+ "\n ",
+ "\n IEnumerable BeEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC",
+ "\n || Identity.IsReinsurance",
+ "\n ? Enumerable.Empty()",
+ "\n : GetScope(Identity)",
+ "\n .ByAmountType",
+ "\n .Where(x => Math.Abs(x.Value) >= Precision)",
+ "\n .Select(sc => new IfrsVariable{ EstimateType = GetScope(Identity).EstimateType, ",
+ "\n DataNode = sc.Identity.Id.DataNode, ",
+ "\n AocType = sc.Identity.Id.AocType, ",
+ "\n Novelty = sc.Identity.Id.Novelty, ",
+ "\n AccidentYear = sc.Identity.AccidentYear,",
+ "\n EconomicBasis = sc.EconomicBasis,",
+ "\n AmountType = sc.Identity.AmountType,",
+ "\n Value = sc.Value,",
+ "\n Partition = sc.GetStorage().TargetPartition });",
+ "\n ",
+ "\n IEnumerable ActEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC",
+ "\n || Identity.IsReinsurance",
+ "\n ? Enumerable.Empty()",
+ "\n : GetScope(Identity)",
+ "\n .ByAmountTypeAndEstimateType",
+ "\n .Where(x => Math.Abs(x.Value) >= Precision)",
+ "\n .Select(sc => new IfrsVariable{ EstimateType = GetStorage().ExperienceAdjustEstimateTypeMapping[sc.Identity.EstimateType], ",
+ "\n DataNode = sc.Identity.Id.DataNode, ",
+ "\n AocType = sc.Identity.Id.AocType, ",
+ "\n Novelty = sc.Identity.Id.Novelty, ",
+ "\n AccidentYear = sc.Identity.AccidentYear,",
+ "\n //EconomicBasis = scope.EconomicBasis,",
+ "\n AmountType = sc.Identity.AmountType,",
+ "\n Value = sc.Value,",
+ "\n Partition = GetStorage().TargetPartition });",
+ "\n ",
+ "\n IEnumerable Csms => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC",
+ "\n ? Enumerable.Empty()",
+ "\n : GetScope