From 9b7dceb43582f84a32517ccffd7f1b999c0828ba Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Wed, 2 Aug 2023 11:34:02 +0200 Subject: [PATCH 01/26] Rewrite warnings as a class with a protected constructor. Should work, but have not tested it yet. --- ifrs17/Constants/Validations.ipynb | 50 ++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 5f77b612..7d2e47e2 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -47,12 +47,35 @@ { "cell_type": "code", "source": [ - "public enum Warning {", + "/*public enum Warning {", "\n // Import", "\n ActiveDataNodeWithCashflowBOPI, VariablesAlreadyImported, VariablesAlreadyCalculated, ScenarioReCalculations, MandatoryAocStepMissing,", "\n // Default", "\n Generic", - "\n}; " + "\n}; */" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public class Warning {", + "\n public int InternalValue {get; protected set;}", + "\n", + "\n protected Warning(int internalValue){", + "\n this.InternalValue = internalValue;", + "\n }", + "\n", + "\n public static readonly Warning ActiveDataNodeWithCashflowBOPI = new Warning(1);", + "\n public static readonly Warning VariablesAlreadyImported = new Warning(2);", + "\n public static readonly Warning VariablesAlreadyCalculated = new Warning(3);", + "\n public static readonly Warning ScenarioReCalculations = new Warning(4);", + "\n public static readonly Warning MandatoryAocStepMissing = new Warning(5);", + "\n public static readonly Warning Generic = new Warning(6);", + "\n ", + "\n}" ], "metadata": {}, "execution_count": 0, @@ -96,6 +119,15 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [ @@ -202,15 +234,15 @@ { "cell_type": "code", "source": [ - "public static string Get (Warning w, params string[] s) => (w, s.Length) switch {", + "public static string Get (Warning w, params string[] s) => s.Length switch {", "\n // Import", - "\n (Warning.ActiveDataNodeWithCashflowBOPI , 1) => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", - "\n (Warning.VariablesAlreadyImported , 0) => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", - "\n (Warning.MandatoryAocStepMissing , 3) => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", - "\n (Warning.ScenarioReCalculations , 1) => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", + "\n 1 when w == Warning.ActiveDataNodeWithCashflowBOPI => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", + "\n 0 when w == Warning.VariablesAlreadyImported => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", + "\n 3 when w == Warning.MandatoryAocStepMissing => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", + "\n 1 when w == Warning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", "\n // Default", - "\n (Warning.Generic , _) => $\"{s[0]}\",", - "\n (_ , _) => $\"Warning not found.\"", + "\n _ when w == Warning.Generic => $\"{s[0]}\",", + "\n _ => $\"Warning not found.\"", "\n};" ], "metadata": {}, From 9ba0ae03021c359fb3b1c824c728292ef11b75f0 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Wed, 2 Aug 2023 14:12:39 +0200 Subject: [PATCH 02/26] partial rearrangement of errors. Not done yet --- ifrs17/Constants/Validations.ipynb | 179 ++++++++++++++++++++++++----- 1 file changed, 150 insertions(+), 29 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 7d2e47e2..6d15b0d5 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -58,23 +58,144 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "Comment: Warnings and Errors are designed to act as an effective enumerables, that allow however inheritance in the client projects. However, this stricture is not identical to the enumerables. An important difference is that it does not allow using them directly in the *case* statements. The workaround would be to use *when* in the *case* statment. Also, to avoid assigning identical internal values to two different messages in the case of extending the CE class, it would be recommended to start the numerical values in the inherting classes from 1000. " + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ - "public class Warning {", + "public abstract class ValidationBase{", "\n public int InternalValue {get; protected set;}", "\n", - "\n protected Warning(int internalValue){", + "\n protected ValidationBase(int internalValue){", "\n this.InternalValue = internalValue;", "\n }", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public class Warning : ValidationBase{", + "\n", + "\n protected Warning(int internalValue) : base(internalValue) {}", "\n", "\n public static readonly Warning ActiveDataNodeWithCashflowBOPI = new Warning(1);", - "\n public static readonly Warning VariablesAlreadyImported = new Warning(2);", - "\n public static readonly Warning VariablesAlreadyCalculated = new Warning(3);", - "\n public static readonly Warning ScenarioReCalculations = new Warning(4);", - "\n public static readonly Warning MandatoryAocStepMissing = new Warning(5);", - "\n public static readonly Warning Generic = new Warning(6);", + "\n public static readonly Warning VariablesAlreadyImported = new Warning(2);", + "\n public static readonly Warning VariablesAlreadyCalculated = new Warning(3);", + "\n public static readonly Warning ScenarioReCalculations = new Warning(4);", + "\n public static readonly Warning MandatoryAocStepMissing = new Warning(5);", + "\n public static readonly Warning Generic = new Warning(6);", + "\n ", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public class Error : ValidationBase{", "\n ", + "\n protected Error(int internalValue) : base(internalValue) {}", + "\n", + "\n // Import Errors; Range 1 - 19", + "\n public static readonly Error NoMainTab = new Error(1);", + "\n public static readonly Error IncompleteMainTab = new Error(2);", + "\n public static readonly Error ParsingInvalidOrScientificValue = new Error(3);", + "\n public static readonly Error ValueTypeNotFound = new Error(4);", + "\n public static readonly Error ValueTypeNotValid = new Error(5);", + "\n public static readonly Error ReportingNodeInMainNotFound = new Error(6);", + "\n public static readonly Error YearInMainNotFound = new Error(7);", + "\n public static readonly Error MonthInMainNotFound = new Error(8);", + "\n public static readonly Error ScenarioInMainNotAvailable = new Error(9);", + "\n public static readonly Error AocTypeNotValid = new Error(10);", + "\n public static readonly Error AocTypeCompulsoryNotFound = new Error(11);", + "\n public static readonly Error AocTypePositionNotSupported = new Error(12);", + "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(13);", + "\n public static readonly Error AccidentYearTypeNotValid = new Error(14);", + "\n", + "\n // Partition Errors; Range 20 - 29", + "\n public static readonly Error PartitionNotFound = new Error(20);", + "\n public static readonly Error ParsedPartitionNotFound = new Error(21);", + "\n public static readonly Error PartititionNameNotFound = new Error(22);", + "\n public static readonly Error PartitionTypeNotFound = new Error(23);", + "\n", + "\n // Dimensions Errors; Range 30 - 49", + "\n public static readonly Error AmountTypeNotFound = new Error(30);", + "\n public static readonly Error EstimateTypeNotFound = new Error(31); ", + "\n public static readonly Error ReportingNodeNotFound = new Error(32);", + "\n public static readonly Error AocTypeMapNotFound = new Error(33);", + "\n public static readonly Error AocTypeNotFound = new Error(34);", + "\n public static readonly Error PortfolioGicNotFound = new Error(35);", + "\n public static readonly Error PortfolioGricNotFound = new Error(36);", + "\n public static readonly Error InvalidAmountTypeEstimateType = new Error(37);", + "\n public static readonly Error MultipleTechnicalMarginOpening = new Error(38);", + "\n public static readonly Error DimensionNotFound = new Error(39);", + "\n public static readonly Error NoScenarioOpening = new Error(40);", + "\n", + "\n // Exchange Rate Errors; Range 50 - 59", + "\n public static readonly Error ExchangeRateNotFound = new Error(50);", + "\n public static readonly Error ExchangeRateCurrency = new Error(51);", + "\n", + "\n // Data Node State Errors; Range 60 - 69", + "\n public static readonly Error ChangeDataNodeState = new Error(60);", + "\n public static readonly Error InactiveDataNodeState = new Error(61);", + "\n", + "\n // Parameters Errors: Range 70 - 89 ", + "\n public static readonly Error ReinsuranceCoverageDataNode = new Error(70);", + "\n public static readonly Error DuplicateInterDataNode = new Error(71);", + "\n public static readonly Error DuplicateSingleDataNode = new Error(72);", + "\n public static readonly Error MissingSingleDataNodeParameter = new Error(73);", + "\n public static readonly Error InvalidDataNode = new Error(74);", + "\n public static readonly Error InvalidDataNodeForOpening = new Error(75);", + "\n public static readonly Error InvalidCashFlowPeriodicity = new Error(76);", + "\n public static readonly Error MissingInterpolationMethod = new Error(77);", + "\n public static readonly Error InvalidInterpolationMethod = new Error(78);", + "\n public static readonly Error InvalidEconomicBasisDriver = new Error(79);", + "\n public static readonly Error InvalidReleasePattern = new Error(80);", + "\n", + "\n // Storage Errors; Range 90 - 109", + "\n public static readonly Error DataNodeNotFound = new Error(90);", + "\n public static readonly Error PartnerNotFound = new Error(91);", + "\n public static readonly Error PeriodNotFound = new Error(92);", + "\n public static readonly Error RatingNotFound = new Error(93);", + "\n public static readonly Error CreditDefaultRateNotFound = new Error(94);", + "\n public static readonly Error MissingPremiumAllocation = new Error(95);", + "\n public static readonly Error ReinsuranceCoverage = new Error(96);", + "\n public static readonly Error YieldCurveNotFound = new Error(97);", + "\n public static readonly Error YieldCurvePeriodNotApplicable = new Error(98);", + "\n public static readonly Error EconomicBasisNotFound = new Error(99);", + "\n public static readonly Error AccountingVariableTypeNotFound = new Error(100);", + "\n public static readonly Error InvalidGric = new Error(101);", + "\n public static readonly Error InvalidGic = new Error(102);", + "\n public static readonly Error ReleasePatternNotFound = new Error(103);", + "\n public static readonly Error MissingPreviousPeriodData = new Error(104);", + "\n", + "\n // Scopes Errors; Range 110 -119", + "\n public static readonly Error NotSupportedAocStepReference = new Error(110);", + "\n public static readonly Error MultipleEoP = new Error(111);", + "\n", + "\n // Data Completeness Errors; Range 120 - 129", + "\n public static readonly Error MissingDataAtPosting = new Error(120);", + "\n public static readonly Error MissingCombinedLiability = new Error(121);", + "\n public static readonly Error MissingCoverageUnit = new Error(122);", + "\n", + "\n // Index Error ", + "\n public static readonly Error NegativeIndex = new Error(130);", + "\n", + "\n // Generic Errors", + "\n public static readonly Error Generic = new Error(140); ", "\n}" ], "metadata": {}, @@ -84,7 +205,7 @@ { "cell_type": "code", "source": [ - "public enum Error { ", + "/*public enum Error { ", "\n // Import", "\n NoMainTab, IncompleteMainTab, ParsingInvalidOrScientificValue, ValueTypeNotFound, ValueTypeNotValid, ", "\n ReportingNodeInMainNotFound, YearInMainNotFound, MonthInMainNotFound, ScenarioInMainNotAvailable,", @@ -113,7 +234,7 @@ "\n NegativeIndex,", "\n // Default", "\n Generic", - "\n};" + "\n}; */" ], "metadata": {}, "execution_count": 0, @@ -140,28 +261,28 @@ { "cell_type": "code", "source": [ - "public static string Get (Error e, params string[] s) => (e, s.Length) switch ", + "public static string Get (Error e, params string[] s) => 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.ParsingInvalidOrScientificValue, 1) => $\"While parsing found invalid value or 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.ReportingNodeInMainNotFound , _) => $\"Reporting Node missing from the Main tab.\",", - "\n (Error.YearInMainNotFound , _) => $\"Year missing from the Main tab.\",", - "\n (Error.MonthInMainNotFound , _) => $\"Month missing from the Main tab.\",", - "\n (Error.ScenarioInMainNotAvailable , 1) => $\"Scenario {s[0]} has not been defined.\",", - "\n (Error.AocTypeNotValid , 1) => $\"The parsed AoC Type {s[0]} is invalid.\",", - "\n (Error.AocTypeCompulsoryNotFound , _) => $\"Not all compulsory AoC Types have been imported.\",", - "\n (Error.AocTypePositionNotSupported , 1) => $\"The position of the AoC Type {s[0]} is not supported.\",", - "\n (Error.AocConfigurationOrderNotUnique , _) => $\"Two or more AoC Configurations have the same Order.\",", - "\n (Error.AccidentYearTypeNotValid , 1) => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n _ where e == Error.NoMainTab => $\"No Main tab in the parsed file.\",", + "\n _ where e == Error.IncompleteMainTab => $\"Incomplete Main tab in the parsed file.\",", + "\n 1 where e == Error.ParsingInvalidOrScientificValue => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", + "\n _ where e == Error.ValueTypeNotFound => $\"Value Type not found.\",", + "\n 1 where e == Error.ValueTypeNotValid => $\"The Value Type {s[0]} is invalid.\",", + "\n _ where e == Error.ReportingNodeInMainNotFound => $\"Reporting Node missing from the Main tab.\",", + "\n _ where e == Error.YearInMainNotFound => $\"Year missing from the Main tab.\",", + "\n _ where e == Error.MonthInMainNotFound => $\"Month missing from the Main tab.\",", + "\n 1 where e == Error.ScenarioInMainNotAvailable => $\"Scenario {s[0]} has not been defined.\",", + "\n 1 where e == Error.AocTypeNotValid => $\"The parsed AoC Type {s[0]} is invalid.\",", + "\n _ where e == Error.AocTypeCompulsoryNotFound => $\"Not all compulsory AoC Types have been imported.\",", + "\n 1 where e == Error.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", + "\n _ where e == Error.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", + "\n 1 where e == Error.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", "\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 _ where e == Error.PartitionNotFound => $\"Partition do not found.\",", + "\n 1 where e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}.\",", + "\n 4 where e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", + "\n 1 where e == Error.PartitionTypeNotFound => $\"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.\",", @@ -242,7 +363,7 @@ "\n 1 when w == Warning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", "\n // Default", "\n _ when w == Warning.Generic => $\"{s[0]}\",", - "\n _ => $\"Warning not found.\"", + "\n _ => $\"Warning not found.\"", "\n};" ], "metadata": {}, From ee3219ccae65b0cb27b2609610f903fa2bd7f5c4 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Wed, 2 Aug 2023 15:08:07 +0200 Subject: [PATCH 03/26] compiling error get --- ifrs17/Constants/Validations.ipynb | 146 +++++++++++++++-------------- 1 file changed, 77 insertions(+), 69 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 6d15b0d5..8c39df5f 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -264,87 +264,95 @@ "public static string Get (Error e, params string[] s) => s.Length switch ", "\n{", "\n // Import", - "\n _ where e == Error.NoMainTab => $\"No Main tab in the parsed file.\",", - "\n _ where e == Error.IncompleteMainTab => $\"Incomplete Main tab in the parsed file.\",", - "\n 1 where e == Error.ParsingInvalidOrScientificValue => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", - "\n _ where e == Error.ValueTypeNotFound => $\"Value Type not found.\",", - "\n 1 where e == Error.ValueTypeNotValid => $\"The Value Type {s[0]} is invalid.\",", - "\n _ where e == Error.ReportingNodeInMainNotFound => $\"Reporting Node missing from the Main tab.\",", - "\n _ where e == Error.YearInMainNotFound => $\"Year missing from the Main tab.\",", - "\n _ where e == Error.MonthInMainNotFound => $\"Month missing from the Main tab.\",", - "\n 1 where e == Error.ScenarioInMainNotAvailable => $\"Scenario {s[0]} has not been defined.\",", - "\n 1 where e == Error.AocTypeNotValid => $\"The parsed AoC Type {s[0]} is invalid.\",", - "\n _ where e == Error.AocTypeCompulsoryNotFound => $\"Not all compulsory AoC Types have been imported.\",", - "\n 1 where e == Error.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", - "\n _ where e == Error.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", - "\n 1 where e == Error.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n 0 when e == Error.NoMainTab => $\"No Main tab in the parsed file.\", ", + "\n _ when e == Error.IncompleteMainTab => $\"Incomplete Main tab in the parsed file.\",", + "\n 1 when e == Error.ParsingInvalidOrScientificValue => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", + "\n _ when e == Error.ValueTypeNotFound => $\"Value Type not found.\",", + "\n 1 when e == Error.ValueTypeNotValid => $\"The Value Type {s[0]} is invalid.\",", + "\n _ when e == Error.ReportingNodeInMainNotFound => $\"Reporting Node missing from the Main tab.\",", + "\n _ when e == Error.YearInMainNotFound => $\"Year missing from the Main tab.\",", + "\n _ when e == Error.MonthInMainNotFound => $\"Month missing from the Main tab.\",", + "\n 1 when e == Error.ScenarioInMainNotAvailable => $\"Scenario {s[0]} has not been defined.\",", + "\n 1 when e == Error.AocTypeNotValid => $\"The parsed AoC Type {s[0]} is invalid.\",", + "\n _ when e == Error.AocTypeCompulsoryNotFound => $\"Not all compulsory AoC Types have been imported.\",", + "\n 1 when e == Error.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", + "\n _ when e == Error.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", + "\n 1 when e == Error.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n", "\n // Partition", - "\n _ where e == Error.PartitionNotFound => $\"Partition do not found.\",", - "\n 1 where e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}.\",", - "\n 4 where e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", - "\n 1 where e == Error.PartitionTypeNotFound => $\"Partition type not found: {s[0]}.\",", + "\n _ when e == Error.PartitionNotFound => $\"Partition do not found.\",", + "\n 1 when e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}.\",", + "\n 4 when e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", + "\n 1 when e == Error.PartitionTypeNotFound => $\"Partition type not found: {s[0]}.\",", + "\n", "\n // Dimensions", - "\n (Error.AmountTypeNotFound , 1) => $\"AmountType {s[0]} not found.\",", - "\n (Error.EstimateTypeNotFound , 1) => $\"EstimateType {s[0]} not found.\",", - "\n (Error.ReportingNodeNotFound , 1) => $\"Reporting Node {s[0]} not found.\",", - "\n (Error.AocTypeNotFound , 1) => $\"AoC Type {s[0]} not found.\",", - "\n (Error.AocTypeMapNotFound , 2) => $\"AoC Type {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 (Error.DimensionNotFound , 2) => $\"Column {0} has unknown value {1}.\",", - "\n (Error.NoScenarioOpening , 0) => \"Only Best Estimate is valid Scenario for Openings\",", + "\n 1 when e == Error.AmountTypeNotFound => $\"AmountType {s[0]} not found.\",", + "\n 1 when e == Error.EstimateTypeNotFound => $\"EstimateType {s[0]} not found.\",", + "\n 1 when e == Error.ReportingNodeNotFound => $\"Reporting Node {s[0]} not found.\",", + "\n 1 when e == Error.AocTypeNotFound => $\"AoC Type {s[0]} not found.\",", + "\n 2 when e == Error.AocTypeMapNotFound => $\"AoC Type {s[0]} and Novelty {s[1]} combination not defined in the mapping.\",", + "\n 2 when e == Error.PortfolioGicNotFound => $\"Portfolio {s[0]} assigned to Group of Insurance Contract {s[1]} does not exist.\",", + "\n 2 when e == Error.PortfolioGricNotFound => $\"Portfolio {s[0]} assigned to Group of Reinsurance Contract {s[1]} does not exist.\",", + "\n 2 when e == Error.InvalidAmountTypeEstimateType => $\"Invalid combination of EstimateType {s[0]} and AmountType {s[1]}.\",", + "\n 1 when e == Error.MultipleTechnicalMarginOpening => $\"Multiple opening for techincal margin are not allowed for DataNode {s[0]}.\",", + "\n 2 when e == Error.DimensionNotFound => $\"Column {0} has unknown value {1}.\",", + "\n 0 when e == Error.NoScenarioOpening => \"Only Best Estimate is valid Scenario for Openings\",", "\n ", "\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 2 when e == Error.ExchangeRateNotFound => $\"Exchange Rate for {s[0]} {s[1]} is not present.\",", + "\n 1 when e == Error.ExchangeRateCurrency => $\"{s[0]} does not have any Exchange Rate defined.\",", + "\n", "\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 0 when e == Error.ChangeDataNodeState => $\"Data Node State can not change from Inactive state into Active state.\",", + "\n 1 when e == Error.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from Inactive state into Active state.\",", + "\n 3 when e == Error.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from {s[1]} state into {s[2]} state.\",", + "\n 1 when e == Error.InactiveDataNodeState => $\"Data imported for inactive Data Node {s[0]}.\",", + "\n", "\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.MissingSingleDataNodeParameter , 1) => $\"Single DataNode Parameter for Data Node {s[0]} is not found.\",", - "\n (Error.InvalidDataNode , 1) => $\"Data imported for invalid Data Node {s[0]}.\",", - "\n (Error.InvalidDataNodeForOpening , 1) => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",", - "\n (Error.InvalidCashFlowPeriodicity , 1) => $\"Invalid CashFlowPeriodicity parameter for Data Node {s[0]}.\",", - "\n (Error.MissingInterpolationMethod , 1) => $\"Missing InterpolationMethod parameter for Data Node {s[0]}.\",", - "\n (Error.InvalidInterpolationMethod , 1) => $\"Invalid InterpolationMethod parameter for Data Node {s[0]}.\",", - "\n (Error.InvalidEconomicBasisDriver , 1) => $\"Invalid EconomicBasisDriver parameter for Data Node {s[0]}.\",", - "\n (Error.InvalidReleasePattern , 1) => $\"Invalid ReleasePattern parameters for Data Node {s[0]}.\",", + "\n 2 when e == Error.ReinsuranceCoverageDataNode => $\"Invalid Reinsurance Coverage parameter does not link a GroupOfReinsuranceContract to a GroupOfInsuranceContract. Provided GroupOfContracts are: {s[0]}, {s[1]}.\",", + "\n 2 when e == Error.DuplicateInterDataNode => $\"Duplicated Inter-DataNode parameter for {s[0]}-{s[1]} is found.\",", + "\n 1 when e == Error.DuplicateSingleDataNode => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",", + "\n 1 when e == Error.MissingSingleDataNodeParameter => $\"Single DataNode Parameter for Data Node {s[0]} is not found.\",", + "\n 1 when e == Error.InvalidDataNode => $\"Data imported for invalid Data Node {s[0]}.\",", + "\n 1 when e == Error.InvalidDataNodeForOpening => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",", + "\n 1 when e == Error.InvalidCashFlowPeriodicity => $\"Invalid CashFlowPeriodicity parameter for Data Node {s[0]}.\",", + "\n 1 when e == Error.MissingInterpolationMethod => $\"Missing InterpolationMethod parameter for Data Node {s[0]}.\",", + "\n 1 when e == Error.InvalidInterpolationMethod => $\"Invalid InterpolationMethod parameter for Data Node {s[0]}.\",", + "\n 1 when e == Error.InvalidEconomicBasisDriver => $\"Invalid EconomicBasisDriver parameter for Data Node {s[0]}.\",", + "\n 1 when e == Error.InvalidReleasePattern => $\"Invalid ReleasePattern parameters for Data Node {s[0]}.\",", "\n ", "\n // Storage", - "\n (Error.DataNodeNotFound , 1) => $\"DataNode {s[0]} not found.\",", - "\n (Error.PartnerNotFound , 1) => $\"Partner not found for DataNode {s[0]}.\",", - "\n (Error.PeriodNotFound , 1) => $\"Invalid Period {s[0]} used during calculation. Allowed values are Current Period (0) and Previous Period (-1).\",", - "\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 , 5) => $\"Yield Curve not found for Currency {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {(s[3] == null ? \"Best Estimate\" : s[3])} and Name {s[4]}.\",", - "\n (Error.YieldCurvePeriodNotApplicable , 2) => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {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 (Error.InvalidGric , 1) => $\"Invalid Group of Reinsurance Contract {s[0]} has been requested during calculation.\",", - "\n (Error.InvalidGic , 1) => $\"Invalid Group of Insurance Contract {s[0]} has been requested during calculation.\",", - "\n (Error.ReleasePatternNotFound , 2) => $\"Release pattern for Group of Contract {s[0]} and AmountType {s[1]} is not found.\",", - "\n (Error.MissingPreviousPeriodData , 3) => $\"Data for previous period (Year: {s[0]}, Month: {s[1]}) is missing for Group of contracts: {s[2]}.\",", + "\n 1 when e == Error.DataNodeNotFound => $\"DataNode {s[0]} not found.\",", + "\n 1 when e == Error.PartnerNotFound => $\"Partner not found for DataNode {s[0]}.\",", + "\n 1 when e == Error.PeriodNotFound => $\"Invalid Period {s[0]} used during calculation. Allowed values are Current Period (0) and Previous Period (-1).\",", + "\n 1 when e == Error.RatingNotFound => $\"Rating not found for Partner {s[0]}.\",", + "\n 1 when e == Error.CreditDefaultRateNotFound => $\"Credit Default Rate not found for rating {s[0]}.\",", + "\n 1 when e == Error.MissingPremiumAllocation => $\"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 1 when e == Error.ReinsuranceCoverage => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",", + "\n 5 when e == Error.YieldCurveNotFound => $\"Yield Curve not found for Currency {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {(s[3] == null ? \"Best Estimate\" : s[3])} and Name {s[4]}.\",", + "\n 2 when e == Error.YieldCurvePeriodNotApplicable => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {s[0]} and Novelty {s[1]}.\",", + "\n 1 when e == Error.EconomicBasisNotFound => $\"EconomicBasis not valid for DataNode {s[0]}.\",", + "\n 1 when e == Error.AccountingVariableTypeNotFound => $\"AccountingVariableType {s[0]} not found.\",", + "\n 1 when e == Error.InvalidGric => $\"Invalid Group of Reinsurance Contract {s[0]} has been requested during calculation.\",", + "\n 1 when e == Error.InvalidGic => $\"Invalid Group of Insurance Contract {s[0]} has been requested during calculation.\",", + "\n 2 when e == Error.ReleasePatternNotFound => $\"Release pattern for Group of Contract {s[0]} and AmountType {s[1]} is not found.\",", + "\n 3 when e == Error.MissingPreviousPeriodData => $\"Data for previous period (Year: {s[0]}, Month: {s[1]}) is missing for Group of contracts: {s[2]}.\",", + "\n", "\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 1 when e == Error.NotSupportedAocStepReference => $\"Unsupported reference AoC Step for AoC Type {s[0]}.\",", + "\n 0 when e == Error.MultipleEoP => $\"Closing Balance for both Csm and Lc are computed.\",", + "\n", "\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 1 when e == Error.MissingDataAtPosting => $\"Missing imported data for {s[0]} DataNode.\",", + "\n 2 when e == Error.MissingCombinedLiability => $\"Missing Combined Liability AoC Type for DataNode {s[0]} and AmountType {s[1]}.\",", + "\n 1 when e == Error.MissingCoverageUnit => $\"Missing Coverage Unit cash flow for {s[0]} DataNode.\",", + "\n", "\n // Index", - "\n (Error.NegativeIndex , 0) => $\"Index was out of range. Must be non-negative.\",", + "\n 0 when e == Error.NegativeIndex => $\"Index was out of range. Must be non-negative.\",", + "\n", "\n // Default", - "\n (Error.Generic , _) => $\"{s[0]}\",", - "\n (_ , _) => $\"Error not found.\"", + "\n 1 when e == Error.Generic => $\"{s[0]}\", ", + "\n _ => $\"Error not found.\"", "\n};", "\n" ], From dcfb91dc26cde0628660ee24867b96eb8c6e75ec Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Wed, 2 Aug 2023 16:11:45 +0200 Subject: [PATCH 04/26] remove obsolete pieces of code --- ifrs17/Constants/Validations.ipynb | 61 ------------------------------ 1 file changed, 61 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index b51b04e3..8bac0db2 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -44,20 +44,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "/*public enum Warning {", - "\n // Import", - "\n ActiveDataNodeWithCashflowBOPI, VariablesAlreadyImported, VariablesAlreadyCalculated, ScenarioReCalculations, MandatoryAocStepMissing,", - "\n // Default", - "\n Generic", - "\n}; */" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "markdown", "source": [ @@ -202,53 +188,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "/*public enum Error { ", - "\n // Import", - "\n NoMainTab, IncompleteMainTab, ParsingInvalidOrScientificValue, ValueTypeNotFound, ValueTypeNotValid, ", - "\n ReportingNodeInMainNotFound, YearInMainNotFound, MonthInMainNotFound, ScenarioInMainNotAvailable,", - "\n AocTypeNotValid, AocTypeCompulsoryNotFound, AocTypePositionNotSupported, AocConfigurationOrderNotUnique,", - "\n AccidentYearTypeNotValid,", - "\n // Partition", - "\n PartitionNotFound, ParsedPartitionNotFound, PartititionNameNotFound, PartitionTypeNotFound,", - "\n // Dimensions", - "\n AmountTypeNotFound, EstimateTypeNotFound, ReportingNodeNotFound, AocTypeMapNotFound, AocTypeNotFound, PortfolioGicNotFound, PortfolioGricNotFound, ", - "\n InvalidAmountTypeEstimateType, MultipleTechnicalMarginOpening, DimensionNotFound, NoScenarioOpening,", - "\n // Exchange Rate", - "\n ExchangeRateNotFound, ExchangeRateCurrency,", - "\n // Data Note State", - "\n ChangeDataNodeState, InactiveDataNodeState,", - "\n // Parameters", - "\n ReinsuranceCoverageDataNode, DuplicateInterDataNode, DuplicateSingleDataNode, MissingSingleDataNodeParameter, InvalidDataNode, InvalidDataNodeForOpening, InvalidCashFlowPeriodicity, MissingInterpolationMethod, InvalidInterpolationMethod, InvalidEconomicBasisDriver, InvalidReleasePattern,", - "\n // Storage", - "\n DataNodeNotFound, PartnerNotFound, PeriodNotFound, RatingNotFound, CreditDefaultRateNotFound, MissingPremiumAllocation, ReinsuranceCoverage, ", - "\n YieldCurveNotFound, YieldCurvePeriodNotApplicable, EconomicBasisNotFound, AccountingVariableTypeNotFound, InvalidGric, InvalidGic, ReleasePatternNotFound,", - "\n MissingPreviousPeriodData,", - "\n // Scopes", - "\n NotSupportedAocStepReference, MultipleEoP,", - "\n // Data completeness", - "\n MissingDataAtPosting, MissingCombinedLiability, MissingCoverageUnit, ", - "\n // Index", - "\n NegativeIndex,", - "\n // Default", - "\n Generic", - "\n}; */" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "markdown", "source": [ From a4be22c271d95677f190075477ecb875fa31c6b2 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Wed, 2 Aug 2023 16:28:22 +0200 Subject: [PATCH 05/26] bug fixed, tests pass --- ifrs17/Constants/Validations.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 8bac0db2..9a9d717b 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -268,7 +268,7 @@ "\n 1 when e == Error.CreditDefaultRateNotFound => $\"Credit Default Rate not found for rating {s[0]}.\",", "\n 1 when e == Error.MissingPremiumAllocation => $\"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 1 when e == Error.ReinsuranceCoverage => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",", - "\n 6 when e == Error.YieldCurveNotFound => $\"Yield Curve not found for DataNode {s[0]}, Currency {s[1]}, Year {s[2]}, Month {s[3]}, Scenario {(s[4] == null ? \"Best Estimate\" : s[3])} and Name {s[5]}.\",", + "\n 6 when e == Error.YieldCurveNotFound => $\"Yield Curve not found for DataNode {s[0]}, Currency {s[1]}, Year {s[2]}, Month {s[3]}, Scenario {(s[4] == null ? \"Best Estimate\" : s[4])} and Name {s[5]}.\",", "\n 2 when e == Error.YieldCurvePeriodNotApplicable => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {s[0]} and Novelty {s[1]}.\",", "\n 1 when e == Error.EconomicBasisNotFound => $\"EconomicBasis not valid for DataNode {s[0]}.\",", "\n 1 when e == Error.AccountingVariableTypeNotFound => $\"AccountingVariableType {s[0]} not found.\",", From c1f15e16b4c10ee67ea7a9e799d73a42df804b97 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Wed, 2 Aug 2023 20:48:58 +0200 Subject: [PATCH 06/26] name change: not sure it was necessary --- ifrs17/Constants/Validations.ipynb | 306 ++++++++++++++--------------- 1 file changed, 153 insertions(+), 153 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 9a9d717b..38e29ac5 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -71,16 +71,16 @@ { "cell_type": "code", "source": [ - "public class Warning : ValidationBase{", + "public class CEWarning : ValidationBase{", "\n", - "\n protected Warning(int internalValue) : base(internalValue) {}", + "\n protected CEWarning(int internalValue) : base(internalValue) {}", "\n", - "\n public static readonly Warning ActiveDataNodeWithCashflowBOPI = new Warning(1);", - "\n public static readonly Warning VariablesAlreadyImported = new Warning(2);", - "\n public static readonly Warning VariablesAlreadyCalculated = new Warning(3);", - "\n public static readonly Warning ScenarioReCalculations = new Warning(4);", - "\n public static readonly Warning MandatoryAocStepMissing = new Warning(5);", - "\n public static readonly Warning Generic = new Warning(6);", + "\n public static readonly CEWarning ActiveDataNodeWithCashflowBOPI = new CEWarning(1);", + "\n public static readonly CEWarning VariablesAlreadyImported = new CEWarning(2);", + "\n public static readonly CEWarning VariablesAlreadyCalculated = new CEWarning(3);", + "\n public static readonly CEWarning ScenarioReCalculations = new CEWarning(4);", + "\n public static readonly CEWarning MandatoryAocStepMissing = new CEWarning(5);", + "\n public static readonly CEWarning Generic = new CEWarning(6);", "\n ", "\n}" ], @@ -91,97 +91,97 @@ { "cell_type": "code", "source": [ - "public class Error : ValidationBase{", + "public class CEError : ValidationBase{", "\n ", - "\n protected Error(int internalValue) : base(internalValue) {}", + "\n protected CEError(int internalValue) : base(internalValue) {}", "\n", "\n // Import Errors; Range 1 - 19", - "\n public static readonly Error NoMainTab = new Error(1);", - "\n public static readonly Error IncompleteMainTab = new Error(2);", - "\n public static readonly Error ParsingInvalidOrScientificValue = new Error(3);", - "\n public static readonly Error ValueTypeNotFound = new Error(4);", - "\n public static readonly Error ValueTypeNotValid = new Error(5);", - "\n public static readonly Error ReportingNodeInMainNotFound = new Error(6);", - "\n public static readonly Error YearInMainNotFound = new Error(7);", - "\n public static readonly Error MonthInMainNotFound = new Error(8);", - "\n public static readonly Error ScenarioInMainNotAvailable = new Error(9);", - "\n public static readonly Error AocTypeNotValid = new Error(10);", - "\n public static readonly Error AocTypeCompulsoryNotFound = new Error(11);", - "\n public static readonly Error AocTypePositionNotSupported = new Error(12);", - "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(13);", - "\n public static readonly Error AccidentYearTypeNotValid = new Error(14);", + "\n public static readonly CEError NoMainTab = new CEError(1);", + "\n public static readonly CEError IncompleteMainTab = new CEError(2);", + "\n public static readonly CEError ParsingInvalidOrScientificValue = new CEError(3);", + "\n public static readonly CEError ValueTypeNotFound = new CEError(4);", + "\n public static readonly CEError ValueTypeNotValid = new CEError(5);", + "\n public static readonly CEError ReportingNodeInMainNotFound = new CEError(6);", + "\n public static readonly CEError YearInMainNotFound = new CEError(7);", + "\n public static readonly CEError MonthInMainNotFound = new CEError(8);", + "\n public static readonly CEError ScenarioInMainNotAvailable = new CEError(9);", + "\n public static readonly CEError AocTypeNotValid = new CEError(10);", + "\n public static readonly CEError AocTypeCompulsoryNotFound = new CEError(11);", + "\n public static readonly CEError AocTypePositionNotSupported = new CEError(12);", + "\n public static readonly CEError AocConfigurationOrderNotUnique = new CEError(13);", + "\n public static readonly CEError AccidentYearTypeNotValid = new CEError(14);", "\n", "\n // Partition Errors; Range 20 - 29", - "\n public static readonly Error PartitionNotFound = new Error(20);", - "\n public static readonly Error ParsedPartitionNotFound = new Error(21);", - "\n public static readonly Error PartititionNameNotFound = new Error(22);", - "\n public static readonly Error PartitionTypeNotFound = new Error(23);", + "\n public static readonly CEError PartitionNotFound = new CEError(20);", + "\n public static readonly CEError ParsedPartitionNotFound = new CEError(21);", + "\n public static readonly CEError PartititionNameNotFound = new CEError(22);", + "\n public static readonly CEError PartitionTypeNotFound = new CEError(23);", "\n", "\n // Dimensions Errors; Range 30 - 49", - "\n public static readonly Error AmountTypeNotFound = new Error(30);", - "\n public static readonly Error EstimateTypeNotFound = new Error(31); ", - "\n public static readonly Error ReportingNodeNotFound = new Error(32);", - "\n public static readonly Error AocTypeMapNotFound = new Error(33);", - "\n public static readonly Error AocTypeNotFound = new Error(34);", - "\n public static readonly Error PortfolioGicNotFound = new Error(35);", - "\n public static readonly Error PortfolioGricNotFound = new Error(36);", - "\n public static readonly Error InvalidAmountTypeEstimateType = new Error(37);", - "\n public static readonly Error MultipleTechnicalMarginOpening = new Error(38);", - "\n public static readonly Error DimensionNotFound = new Error(39);", - "\n public static readonly Error NoScenarioOpening = new Error(40);", + "\n public static readonly CEError AmountTypeNotFound = new CEError(30);", + "\n public static readonly CEError EstimateTypeNotFound = new CEError(31); ", + "\n public static readonly CEError ReportingNodeNotFound = new CEError(32);", + "\n public static readonly CEError AocTypeMapNotFound = new CEError(33);", + "\n public static readonly CEError AocTypeNotFound = new CEError(34);", + "\n public static readonly CEError PortfolioGicNotFound = new CEError(35);", + "\n public static readonly CEError PortfolioGricNotFound = new CEError(36);", + "\n public static readonly CEError InvalidAmountTypeEstimateType = new CEError(37);", + "\n public static readonly CEError MultipleTechnicalMarginOpening = new CEError(38);", + "\n public static readonly CEError DimensionNotFound = new CEError(39);", + "\n public static readonly CEError NoScenarioOpening = new CEError(40);", "\n", "\n // Exchange Rate Errors; Range 50 - 59", - "\n public static readonly Error ExchangeRateNotFound = new Error(50);", - "\n public static readonly Error ExchangeRateCurrency = new Error(51);", + "\n public static readonly CEError ExchangeRateNotFound = new CEError(50);", + "\n public static readonly CEError ExchangeRateCurrency = new CEError(51);", "\n", "\n // Data Node State Errors; Range 60 - 69", - "\n public static readonly Error ChangeDataNodeState = new Error(60);", - "\n public static readonly Error InactiveDataNodeState = new Error(61);", + "\n public static readonly CEError ChangeDataNodeState = new CEError(60);", + "\n public static readonly CEError InactiveDataNodeState = new CEError(61);", "\n", "\n // Parameters Errors: Range 70 - 89 ", - "\n public static readonly Error ReinsuranceCoverageDataNode = new Error(70);", - "\n public static readonly Error DuplicateInterDataNode = new Error(71);", - "\n public static readonly Error DuplicateSingleDataNode = new Error(72);", - "\n public static readonly Error MissingSingleDataNodeParameter = new Error(73);", - "\n public static readonly Error InvalidDataNode = new Error(74);", - "\n public static readonly Error InvalidDataNodeForOpening = new Error(75);", - "\n public static readonly Error InvalidCashFlowPeriodicity = new Error(76);", - "\n public static readonly Error MissingInterpolationMethod = new Error(77);", - "\n public static readonly Error InvalidInterpolationMethod = new Error(78);", - "\n public static readonly Error InvalidEconomicBasisDriver = new Error(79);", - "\n public static readonly Error InvalidReleasePattern = new Error(80);", + "\n public static readonly CEError ReinsuranceCoverageDataNode = new CEError(70);", + "\n public static readonly CEError DuplicateInterDataNode = new CEError(71);", + "\n public static readonly CEError DuplicateSingleDataNode = new CEError(72);", + "\n public static readonly CEError MissingSingleDataNodeParameter = new CEError(73);", + "\n public static readonly CEError InvalidDataNode = new CEError(74);", + "\n public static readonly CEError InvalidDataNodeForOpening = new CEError(75);", + "\n public static readonly CEError InvalidCashFlowPeriodicity = new CEError(76);", + "\n public static readonly CEError MissingInterpolationMethod = new CEError(77);", + "\n public static readonly CEError InvalidInterpolationMethod = new CEError(78);", + "\n public static readonly CEError InvalidEconomicBasisDriver = new CEError(79);", + "\n public static readonly CEError InvalidReleasePattern = new CEError(80);", "\n", "\n // Storage Errors; Range 90 - 109", - "\n public static readonly Error DataNodeNotFound = new Error(90);", - "\n public static readonly Error PartnerNotFound = new Error(91);", - "\n public static readonly Error PeriodNotFound = new Error(92);", - "\n public static readonly Error RatingNotFound = new Error(93);", - "\n public static readonly Error CreditDefaultRateNotFound = new Error(94);", - "\n public static readonly Error MissingPremiumAllocation = new Error(95);", - "\n public static readonly Error ReinsuranceCoverage = new Error(96);", - "\n public static readonly Error YieldCurveNotFound = new Error(97);", - "\n public static readonly Error YieldCurvePeriodNotApplicable = new Error(98);", - "\n public static readonly Error EconomicBasisNotFound = new Error(99);", - "\n public static readonly Error AccountingVariableTypeNotFound = new Error(100);", - "\n public static readonly Error InvalidGric = new Error(101);", - "\n public static readonly Error InvalidGic = new Error(102);", - "\n public static readonly Error ReleasePatternNotFound = new Error(103);", - "\n public static readonly Error MissingPreviousPeriodData = new Error(104);", + "\n public static readonly CEError DataNodeNotFound = new CEError(90);", + "\n public static readonly CEError PartnerNotFound = new CEError(91);", + "\n public static readonly CEError PeriodNotFound = new CEError(92);", + "\n public static readonly CEError RatingNotFound = new CEError(93);", + "\n public static readonly CEError CreditDefaultRateNotFound = new CEError(94);", + "\n public static readonly CEError MissingPremiumAllocation = new CEError(95);", + "\n public static readonly CEError ReinsuranceCoverage = new CEError(96);", + "\n public static readonly CEError YieldCurveNotFound = new CEError(97);", + "\n public static readonly CEError YieldCurvePeriodNotApplicable = new CEError(98);", + "\n public static readonly CEError EconomicBasisNotFound = new CEError(99);", + "\n public static readonly CEError AccountingVariableTypeNotFound = new CEError(100);", + "\n public static readonly CEError InvalidGric = new CEError(101);", + "\n public static readonly CEError InvalidGic = new CEError(102);", + "\n public static readonly CEError ReleasePatternNotFound = new CEError(103);", + "\n public static readonly CEError MissingPreviousPeriodData = new CEError(104);", "\n", "\n // Scopes Errors; Range 110 -119", - "\n public static readonly Error NotSupportedAocStepReference = new Error(110);", - "\n public static readonly Error MultipleEoP = new Error(111);", + "\n public static readonly CEError NotSupportedAocStepReference = new CEError(110);", + "\n public static readonly CEError MultipleEoP = new CEError(111);", "\n", "\n // Data Completeness Errors; Range 120 - 129", - "\n public static readonly Error MissingDataAtPosting = new Error(120);", - "\n public static readonly Error MissingCombinedLiability = new Error(121);", - "\n public static readonly Error MissingCoverageUnit = new Error(122);", + "\n public static readonly CEError MissingDataAtPosting = new CEError(120);", + "\n public static readonly CEError MissingCombinedLiability = new CEError(121);", + "\n public static readonly CEError MissingCoverageUnit = new CEError(122);", "\n", "\n // Index Error ", - "\n public static readonly Error NegativeIndex = new Error(130);", + "\n public static readonly CEError NegativeIndex = new CEError(130);", "\n", "\n // Generic Errors", - "\n public static readonly Error Generic = new Error(140); ", + "\n public static readonly CEError Generic = new CEError(140); ", "\n}" ], "metadata": {}, @@ -200,98 +200,98 @@ { "cell_type": "code", "source": [ - "public static string Get (Error e, params string[] s) => s.Length switch ", + "public static string Get (CEError e, params string[] s) => s.Length switch ", "\n{", "\n // Import", - "\n 0 when e == Error.NoMainTab => $\"No Main tab in the parsed file.\", ", - "\n _ when e == Error.IncompleteMainTab => $\"Incomplete Main tab in the parsed file.\",", - "\n 1 when e == Error.ParsingInvalidOrScientificValue => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", - "\n _ when e == Error.ValueTypeNotFound => $\"Value Type not found.\",", - "\n 1 when e == Error.ValueTypeNotValid => $\"The Value Type {s[0]} is invalid.\",", - "\n _ when e == Error.ReportingNodeInMainNotFound => $\"Reporting Node missing from the Main tab.\",", - "\n _ when e == Error.YearInMainNotFound => $\"Year missing from the Main tab.\",", - "\n _ when e == Error.MonthInMainNotFound => $\"Month missing from the Main tab.\",", - "\n 1 when e == Error.ScenarioInMainNotAvailable => $\"Scenario {s[0]} has not been defined.\",", - "\n 1 when e == Error.AocTypeNotValid => $\"The parsed AoC Type {s[0]} is invalid.\",", - "\n _ when e == Error.AocTypeCompulsoryNotFound => $\"Not all compulsory AoC Types have been imported.\",", - "\n 1 when e == Error.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", - "\n _ when e == Error.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", - "\n 1 when e == Error.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n 0 when e == CEError.NoMainTab => $\"No Main tab in the parsed file.\", ", + "\n _ when e == CEError.IncompleteMainTab => $\"Incomplete Main tab in the parsed file.\",", + "\n 1 when e == CEError.ParsingInvalidOrScientificValue => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", + "\n _ when e == CEError.ValueTypeNotFound => $\"Value Type not found.\",", + "\n 1 when e == CEError.ValueTypeNotValid => $\"The Value Type {s[0]} is invalid.\",", + "\n _ when e == CEError.ReportingNodeInMainNotFound => $\"Reporting Node missing from the Main tab.\",", + "\n _ when e == CEError.YearInMainNotFound => $\"Year missing from the Main tab.\",", + "\n _ when e == CEError.MonthInMainNotFound => $\"Month missing from the Main tab.\",", + "\n 1 when e == CEError.ScenarioInMainNotAvailable => $\"Scenario {s[0]} has not been defined.\",", + "\n 1 when e == CEError.AocTypeNotValid => $\"The parsed AoC Type {s[0]} is invalid.\",", + "\n _ when e == CEError.AocTypeCompulsoryNotFound => $\"Not all compulsory AoC Types have been imported.\",", + "\n 1 when e == CEError.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", + "\n _ when e == CEError.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", + "\n 1 when e == CEError.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", "\n", "\n // Partition", - "\n _ when e == Error.PartitionNotFound => $\"Partition do not found.\",", - "\n 1 when e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}.\",", - "\n 4 when e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", - "\n 1 when e == Error.PartitionTypeNotFound => $\"Partition type not found: {s[0]}.\",", + "\n _ when e == CEError.PartitionNotFound => $\"Partition do not found.\",", + "\n 1 when e == CEError.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}.\",", + "\n 4 when e == CEError.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", + "\n 1 when e == CEError.PartitionTypeNotFound => $\"Partition type not found: {s[0]}.\",", "\n", "\n // Dimensions", - "\n 1 when e == Error.AmountTypeNotFound => $\"AmountType {s[0]} not found.\",", - "\n 1 when e == Error.EstimateTypeNotFound => $\"EstimateType {s[0]} not found.\",", - "\n 1 when e == Error.ReportingNodeNotFound => $\"Reporting Node {s[0]} not found.\",", - "\n 1 when e == Error.AocTypeNotFound => $\"AoC Type {s[0]} not found.\",", - "\n 2 when e == Error.AocTypeMapNotFound => $\"AoC Type {s[0]} and Novelty {s[1]} combination not defined in the mapping.\",", - "\n 2 when e == Error.PortfolioGicNotFound => $\"Portfolio {s[0]} assigned to Group of Insurance Contract {s[1]} does not exist.\",", - "\n 2 when e == Error.PortfolioGricNotFound => $\"Portfolio {s[0]} assigned to Group of Reinsurance Contract {s[1]} does not exist.\",", - "\n 2 when e == Error.InvalidAmountTypeEstimateType => $\"Invalid combination of EstimateType {s[0]} and AmountType {s[1]}.\",", - "\n 1 when e == Error.MultipleTechnicalMarginOpening => $\"Multiple opening for techincal margin are not allowed for DataNode {s[0]}.\",", - "\n 2 when e == Error.DimensionNotFound => $\"Column {0} has unknown value {1}.\",", - "\n 0 when e == Error.NoScenarioOpening => \"Only Best Estimate is valid Scenario for Openings\",", + "\n 1 when e == CEError.AmountTypeNotFound => $\"AmountType {s[0]} not found.\",", + "\n 1 when e == CEError.EstimateTypeNotFound => $\"EstimateType {s[0]} not found.\",", + "\n 1 when e == CEError.ReportingNodeNotFound => $\"Reporting Node {s[0]} not found.\",", + "\n 1 when e == CEError.AocTypeNotFound => $\"AoC Type {s[0]} not found.\",", + "\n 2 when e == CEError.AocTypeMapNotFound => $\"AoC Type {s[0]} and Novelty {s[1]} combination not defined in the mapping.\",", + "\n 2 when e == CEError.PortfolioGicNotFound => $\"Portfolio {s[0]} assigned to Group of Insurance Contract {s[1]} does not exist.\",", + "\n 2 when e == CEError.PortfolioGricNotFound => $\"Portfolio {s[0]} assigned to Group of Reinsurance Contract {s[1]} does not exist.\",", + "\n 2 when e == CEError.InvalidAmountTypeEstimateType => $\"Invalid combination of EstimateType {s[0]} and AmountType {s[1]}.\",", + "\n 1 when e == CEError.MultipleTechnicalMarginOpening => $\"Multiple opening for techincal margin are not allowed for DataNode {s[0]}.\",", + "\n 2 when e == CEError.DimensionNotFound => $\"Column {0} has unknown value {1}.\",", + "\n 0 when e == CEError.NoScenarioOpening => \"Only Best Estimate is valid Scenario for Openings\",", "\n ", "\n // Exchange Rate", - "\n 2 when e == Error.ExchangeRateNotFound => $\"Exchange Rate for {s[0]} {s[1]} is not present.\",", - "\n 1 when e == Error.ExchangeRateCurrency => $\"{s[0]} does not have any Exchange Rate defined.\",", + "\n 2 when e == CEError.ExchangeRateNotFound => $\"Exchange Rate for {s[0]} {s[1]} is not present.\",", + "\n 1 when e == CEError.ExchangeRateCurrency => $\"{s[0]} does not have any Exchange Rate defined.\",", "\n", "\n // Data Node State", - "\n 0 when e == Error.ChangeDataNodeState => $\"Data Node State can not change from Inactive state into Active state.\",", - "\n 1 when e == Error.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from Inactive state into Active state.\",", - "\n 3 when e == Error.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from {s[1]} state into {s[2]} state.\",", - "\n 1 when e == Error.InactiveDataNodeState => $\"Data imported for inactive Data Node {s[0]}.\",", + "\n 0 when e == CEError.ChangeDataNodeState => $\"Data Node State can not change from Inactive state into Active state.\",", + "\n 1 when e == CEError.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from Inactive state into Active state.\",", + "\n 3 when e == CEError.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from {s[1]} state into {s[2]} state.\",", + "\n 1 when e == CEError.InactiveDataNodeState => $\"Data imported for inactive Data Node {s[0]}.\",", "\n", "\n //Parameters", - "\n 2 when e == Error.ReinsuranceCoverageDataNode => $\"Invalid Reinsurance Coverage parameter does not link a GroupOfReinsuranceContract to a GroupOfInsuranceContract. Provided GroupOfContracts are: {s[0]}, {s[1]}.\",", - "\n 2 when e == Error.DuplicateInterDataNode => $\"Duplicated Inter-DataNode parameter for {s[0]}-{s[1]} is found.\",", - "\n 1 when e == Error.DuplicateSingleDataNode => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",", - "\n 1 when e == Error.MissingSingleDataNodeParameter => $\"Single DataNode Parameter for Data Node {s[0]} is not found.\",", - "\n 1 when e == Error.InvalidDataNode => $\"Data imported for invalid Data Node {s[0]}.\",", - "\n 1 when e == Error.InvalidDataNodeForOpening => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",", - "\n 1 when e == Error.InvalidCashFlowPeriodicity => $\"Invalid CashFlowPeriodicity parameter for Data Node {s[0]}.\",", - "\n 1 when e == Error.MissingInterpolationMethod => $\"Missing InterpolationMethod parameter for Data Node {s[0]}.\",", - "\n 1 when e == Error.InvalidInterpolationMethod => $\"Invalid InterpolationMethod parameter for Data Node {s[0]}.\",", - "\n 1 when e == Error.InvalidEconomicBasisDriver => $\"Invalid EconomicBasisDriver parameter for Data Node {s[0]}.\",", - "\n 1 when e == Error.InvalidReleasePattern => $\"Invalid ReleasePattern parameters for Data Node {s[0]}.\",", + "\n 2 when e == CEError.ReinsuranceCoverageDataNode => $\"Invalid Reinsurance Coverage parameter does not link a GroupOfReinsuranceContract to a GroupOfInsuranceContract. Provided GroupOfContracts are: {s[0]}, {s[1]}.\",", + "\n 2 when e == CEError.DuplicateInterDataNode => $\"Duplicated Inter-DataNode parameter for {s[0]}-{s[1]} is found.\",", + "\n 1 when e == CEError.DuplicateSingleDataNode => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",", + "\n 1 when e == CEError.MissingSingleDataNodeParameter => $\"Single DataNode Parameter for Data Node {s[0]} is not found.\",", + "\n 1 when e == CEError.InvalidDataNode => $\"Data imported for invalid Data Node {s[0]}.\",", + "\n 1 when e == CEError.InvalidDataNodeForOpening => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",", + "\n 1 when e == CEError.InvalidCashFlowPeriodicity => $\"Invalid CashFlowPeriodicity parameter for Data Node {s[0]}.\",", + "\n 1 when e == CEError.MissingInterpolationMethod => $\"Missing InterpolationMethod parameter for Data Node {s[0]}.\",", + "\n 1 when e == CEError.InvalidInterpolationMethod => $\"Invalid InterpolationMethod parameter for Data Node {s[0]}.\",", + "\n 1 when e == CEError.InvalidEconomicBasisDriver => $\"Invalid EconomicBasisDriver parameter for Data Node {s[0]}.\",", + "\n 1 when e == CEError.InvalidReleasePattern => $\"Invalid ReleasePattern parameters for Data Node {s[0]}.\",", "\n ", "\n // Storage", - "\n 1 when e == Error.DataNodeNotFound => $\"DataNode {s[0]} not found.\",", - "\n 1 when e == Error.PartnerNotFound => $\"Partner not found for DataNode {s[0]}.\",", - "\n 1 when e == Error.PeriodNotFound => $\"Invalid Period {s[0]} used during calculation. Allowed values are Current Period (0) and Previous Period (-1).\",", - "\n 1 when e == Error.RatingNotFound => $\"Rating not found for Partner {s[0]}.\",", - "\n 1 when e == Error.CreditDefaultRateNotFound => $\"Credit Default Rate not found for rating {s[0]}.\",", - "\n 1 when e == Error.MissingPremiumAllocation => $\"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 1 when e == Error.ReinsuranceCoverage => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",", - "\n 6 when e == Error.YieldCurveNotFound => $\"Yield Curve not found for DataNode {s[0]}, Currency {s[1]}, Year {s[2]}, Month {s[3]}, Scenario {(s[4] == null ? \"Best Estimate\" : s[4])} and Name {s[5]}.\",", - "\n 2 when e == Error.YieldCurvePeriodNotApplicable => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {s[0]} and Novelty {s[1]}.\",", - "\n 1 when e == Error.EconomicBasisNotFound => $\"EconomicBasis not valid for DataNode {s[0]}.\",", - "\n 1 when e == Error.AccountingVariableTypeNotFound => $\"AccountingVariableType {s[0]} not found.\",", - "\n 1 when e == Error.InvalidGric => $\"Invalid Group of Reinsurance Contract {s[0]} has been requested during calculation.\",", - "\n 1 when e == Error.InvalidGic => $\"Invalid Group of Insurance Contract {s[0]} has been requested during calculation.\",", - "\n 2 when e == Error.ReleasePatternNotFound => $\"Release pattern for Group of Contract {s[0]} and AmountType {s[1]} is not found.\",", - "\n 3 when e == Error.MissingPreviousPeriodData => $\"Data for previous period (Year: {s[0]}, Month: {s[1]}) is missing for Group of contracts: {s[2]}.\",", + "\n 1 when e == CEError.DataNodeNotFound => $\"DataNode {s[0]} not found.\",", + "\n 1 when e == CEError.PartnerNotFound => $\"Partner not found for DataNode {s[0]}.\",", + "\n 1 when e == CEError.PeriodNotFound => $\"Invalid Period {s[0]} used during calculation. Allowed values are Current Period (0) and Previous Period (-1).\",", + "\n 1 when e == CEError.RatingNotFound => $\"Rating not found for Partner {s[0]}.\",", + "\n 1 when e == CEError.CreditDefaultRateNotFound => $\"Credit Default Rate not found for rating {s[0]}.\",", + "\n 1 when e == CEError.MissingPremiumAllocation => $\"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 1 when e == CEError.ReinsuranceCoverage => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",", + "\n 6 when e == CEError.YieldCurveNotFound => $\"Yield Curve not found for DataNode {s[0]}, Currency {s[1]}, Year {s[2]}, Month {s[3]}, Scenario {(s[4] == null ? \"Best Estimate\" : s[4])} and Name {s[5]}.\",", + "\n 2 when e == CEError.YieldCurvePeriodNotApplicable => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {s[0]} and Novelty {s[1]}.\",", + "\n 1 when e == CEError.EconomicBasisNotFound => $\"EconomicBasis not valid for DataNode {s[0]}.\",", + "\n 1 when e == CEError.AccountingVariableTypeNotFound => $\"AccountingVariableType {s[0]} not found.\",", + "\n 1 when e == CEError.InvalidGric => $\"Invalid Group of Reinsurance Contract {s[0]} has been requested during calculation.\",", + "\n 1 when e == CEError.InvalidGic => $\"Invalid Group of Insurance Contract {s[0]} has been requested during calculation.\",", + "\n 2 when e == CEError.ReleasePatternNotFound => $\"Release pattern for Group of Contract {s[0]} and AmountType {s[1]} is not found.\",", + "\n 3 when e == CEError.MissingPreviousPeriodData => $\"Data for previous period (Year: {s[0]}, Month: {s[1]}) is missing for Group of contracts: {s[2]}.\",", "\n", "\n // Scopes", - "\n 1 when e == Error.NotSupportedAocStepReference => $\"Unsupported reference AoC Step for AoC Type {s[0]}.\",", - "\n 0 when e == Error.MultipleEoP => $\"Closing Balance for both Csm and Lc are computed.\",", + "\n 1 when e == CEError.NotSupportedAocStepReference => $\"Unsupported reference AoC Step for AoC Type {s[0]}.\",", + "\n 0 when e == CEError.MultipleEoP => $\"Closing Balance for both Csm and Lc are computed.\",", "\n", "\n // Data Completeness", - "\n 1 when e == Error.MissingDataAtPosting => $\"Missing imported data for {s[0]} DataNode.\",", - "\n 2 when e == Error.MissingCombinedLiability => $\"Missing Combined Liability AoC Type for DataNode {s[0]} and AmountType {s[1]}.\",", - "\n 1 when e == Error.MissingCoverageUnit => $\"Missing Coverage Unit cash flow for {s[0]} DataNode.\",", + "\n 1 when e == CEError.MissingDataAtPosting => $\"Missing imported data for {s[0]} DataNode.\",", + "\n 2 when e == CEError.MissingCombinedLiability => $\"Missing Combined Liability AoC Type for DataNode {s[0]} and AmountType {s[1]}.\",", + "\n 1 when e == CEError.MissingCoverageUnit => $\"Missing Coverage Unit cash flow for {s[0]} DataNode.\",", "\n", "\n // Index", - "\n 0 when e == Error.NegativeIndex => $\"Index was out of range. Must be non-negative.\",", + "\n 0 when e == CEError.NegativeIndex => $\"Index was out of range. Must be non-negative.\",", "\n", "\n // Default", - "\n 1 when e == Error.Generic => $\"{s[0]}\", ", - "\n _ => $\"Error not found.\"", + "\n 1 when e == CEError.Generic => $\"{s[0]}\", ", + "\n _ => $\"Error not found.\"", "\n};", "\n" ], @@ -302,15 +302,15 @@ { "cell_type": "code", "source": [ - "public static string Get (Warning w, params string[] s) => s.Length switch {", + "public static string Get (CEWarning w, params string[] s) => s.Length switch {", "\n // Import", - "\n 1 when w == Warning.ActiveDataNodeWithCashflowBOPI => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", - "\n 0 when w == Warning.VariablesAlreadyImported => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", - "\n 3 when w == Warning.MandatoryAocStepMissing => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", - "\n 1 when w == Warning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", + "\n 1 when w == CEWarning.ActiveDataNodeWithCashflowBOPI => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", + "\n 0 when w == CEWarning.VariablesAlreadyImported => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", + "\n 3 when w == CEWarning.MandatoryAocStepMissing => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", + "\n 1 when w == CEWarning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", "\n // Default", - "\n _ when w == Warning.Generic => $\"{s[0]}\",", - "\n _ => $\"Warning not found.\"", + "\n _ when w == CEWarning.Generic => $\"{s[0]}\",", + "\n _ => $\"Warning not found.\"", "\n};" ], "metadata": {}, From 9a7d558635581920ce6aa5bf880e098367758017 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Wed, 2 Aug 2023 20:58:49 +0200 Subject: [PATCH 07/26] revert to old names --- ifrs17/Constants/Validations.ipynb | 302 ++++++++++++++--------------- 1 file changed, 151 insertions(+), 151 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 38e29ac5..06f064a6 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -71,16 +71,16 @@ { "cell_type": "code", "source": [ - "public class CEWarning : ValidationBase{", + "public class Warning : ValidationBase{", "\n", - "\n protected CEWarning(int internalValue) : base(internalValue) {}", + "\n protected Warning(int internalValue) : base(internalValue) {}", "\n", - "\n public static readonly CEWarning ActiveDataNodeWithCashflowBOPI = new CEWarning(1);", - "\n public static readonly CEWarning VariablesAlreadyImported = new CEWarning(2);", - "\n public static readonly CEWarning VariablesAlreadyCalculated = new CEWarning(3);", - "\n public static readonly CEWarning ScenarioReCalculations = new CEWarning(4);", - "\n public static readonly CEWarning MandatoryAocStepMissing = new CEWarning(5);", - "\n public static readonly CEWarning Generic = new CEWarning(6);", + "\n public static readonly Warning ActiveDataNodeWithCashflowBOPI = new Warning(1);", + "\n public static readonly Warning VariablesAlreadyImported = new Warning(2);", + "\n public static readonly Warning VariablesAlreadyCalculated = new Warning(3);", + "\n public static readonly Warning ScenarioReCalculations = new Warning(4);", + "\n public static readonly Warning MandatoryAocStepMissing = new Warning(5);", + "\n public static readonly Warning Generic = new Warning(6);", "\n ", "\n}" ], @@ -91,97 +91,97 @@ { "cell_type": "code", "source": [ - "public class CEError : ValidationBase{", + "public class Error : ValidationBase{", "\n ", - "\n protected CEError(int internalValue) : base(internalValue) {}", + "\n protected Error(int internalValue) : base(internalValue) {}", "\n", "\n // Import Errors; Range 1 - 19", - "\n public static readonly CEError NoMainTab = new CEError(1);", - "\n public static readonly CEError IncompleteMainTab = new CEError(2);", - "\n public static readonly CEError ParsingInvalidOrScientificValue = new CEError(3);", - "\n public static readonly CEError ValueTypeNotFound = new CEError(4);", - "\n public static readonly CEError ValueTypeNotValid = new CEError(5);", - "\n public static readonly CEError ReportingNodeInMainNotFound = new CEError(6);", - "\n public static readonly CEError YearInMainNotFound = new CEError(7);", - "\n public static readonly CEError MonthInMainNotFound = new CEError(8);", - "\n public static readonly CEError ScenarioInMainNotAvailable = new CEError(9);", - "\n public static readonly CEError AocTypeNotValid = new CEError(10);", - "\n public static readonly CEError AocTypeCompulsoryNotFound = new CEError(11);", - "\n public static readonly CEError AocTypePositionNotSupported = new CEError(12);", - "\n public static readonly CEError AocConfigurationOrderNotUnique = new CEError(13);", - "\n public static readonly CEError AccidentYearTypeNotValid = new CEError(14);", + "\n public static readonly Error NoMainTab = new Error(1);", + "\n public static readonly Error IncompleteMainTab = new Error(2);", + "\n public static readonly Error ParsingInvalidOrScientificValue = new Error(3);", + "\n public static readonly Error ValueTypeNotFound = new Error(4);", + "\n public static readonly Error ValueTypeNotValid = new Error(5);", + "\n public static readonly Error ReportingNodeInMainNotFound = new Error(6);", + "\n public static readonly Error YearInMainNotFound = new Error(7);", + "\n public static readonly Error MonthInMainNotFound = new Error(8);", + "\n public static readonly Error ScenarioInMainNotAvailable = new Error(9);", + "\n public static readonly Error AocTypeNotValid = new Error(10);", + "\n public static readonly Error AocTypeCompulsoryNotFound = new Error(11);", + "\n public static readonly Error AocTypePositionNotSupported = new Error(12);", + "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(13);", + "\n public static readonly Error AccidentYearTypeNotValid = new Error(14);", "\n", "\n // Partition Errors; Range 20 - 29", - "\n public static readonly CEError PartitionNotFound = new CEError(20);", - "\n public static readonly CEError ParsedPartitionNotFound = new CEError(21);", - "\n public static readonly CEError PartititionNameNotFound = new CEError(22);", - "\n public static readonly CEError PartitionTypeNotFound = new CEError(23);", + "\n public static readonly Error PartitionNotFound = new Error(20);", + "\n public static readonly Error ParsedPartitionNotFound = new Error(21);", + "\n public static readonly Error PartititionNameNotFound = new Error(22);", + "\n public static readonly Error PartitionTypeNotFound = new Error(23);", "\n", "\n // Dimensions Errors; Range 30 - 49", - "\n public static readonly CEError AmountTypeNotFound = new CEError(30);", - "\n public static readonly CEError EstimateTypeNotFound = new CEError(31); ", - "\n public static readonly CEError ReportingNodeNotFound = new CEError(32);", - "\n public static readonly CEError AocTypeMapNotFound = new CEError(33);", - "\n public static readonly CEError AocTypeNotFound = new CEError(34);", - "\n public static readonly CEError PortfolioGicNotFound = new CEError(35);", - "\n public static readonly CEError PortfolioGricNotFound = new CEError(36);", - "\n public static readonly CEError InvalidAmountTypeEstimateType = new CEError(37);", - "\n public static readonly CEError MultipleTechnicalMarginOpening = new CEError(38);", - "\n public static readonly CEError DimensionNotFound = new CEError(39);", - "\n public static readonly CEError NoScenarioOpening = new CEError(40);", + "\n public static readonly Error AmountTypeNotFound = new Error(30);", + "\n public static readonly Error EstimateTypeNotFound = new Error(31); ", + "\n public static readonly Error ReportingNodeNotFound = new Error(32);", + "\n public static readonly Error AocTypeMapNotFound = new Error(33);", + "\n public static readonly Error AocTypeNotFound = new Error(34);", + "\n public static readonly Error PortfolioGicNotFound = new Error(35);", + "\n public static readonly Error PortfolioGricNotFound = new Error(36);", + "\n public static readonly Error InvalidAmountTypeEstimateType = new Error(37);", + "\n public static readonly Error MultipleTechnicalMarginOpening = new Error(38);", + "\n public static readonly Error DimensionNotFound = new Error(39);", + "\n public static readonly Error NoScenarioOpening = new Error(40);", "\n", "\n // Exchange Rate Errors; Range 50 - 59", - "\n public static readonly CEError ExchangeRateNotFound = new CEError(50);", - "\n public static readonly CEError ExchangeRateCurrency = new CEError(51);", + "\n public static readonly Error ExchangeRateNotFound = new Error(50);", + "\n public static readonly Error ExchangeRateCurrency = new Error(51);", "\n", "\n // Data Node State Errors; Range 60 - 69", - "\n public static readonly CEError ChangeDataNodeState = new CEError(60);", - "\n public static readonly CEError InactiveDataNodeState = new CEError(61);", + "\n public static readonly Error ChangeDataNodeState = new Error(60);", + "\n public static readonly Error InactiveDataNodeState = new Error(61);", "\n", "\n // Parameters Errors: Range 70 - 89 ", - "\n public static readonly CEError ReinsuranceCoverageDataNode = new CEError(70);", - "\n public static readonly CEError DuplicateInterDataNode = new CEError(71);", - "\n public static readonly CEError DuplicateSingleDataNode = new CEError(72);", - "\n public static readonly CEError MissingSingleDataNodeParameter = new CEError(73);", - "\n public static readonly CEError InvalidDataNode = new CEError(74);", - "\n public static readonly CEError InvalidDataNodeForOpening = new CEError(75);", - "\n public static readonly CEError InvalidCashFlowPeriodicity = new CEError(76);", - "\n public static readonly CEError MissingInterpolationMethod = new CEError(77);", - "\n public static readonly CEError InvalidInterpolationMethod = new CEError(78);", - "\n public static readonly CEError InvalidEconomicBasisDriver = new CEError(79);", - "\n public static readonly CEError InvalidReleasePattern = new CEError(80);", + "\n public static readonly Error ReinsuranceCoverageDataNode = new Error(70);", + "\n public static readonly Error DuplicateInterDataNode = new Error(71);", + "\n public static readonly Error DuplicateSingleDataNode = new Error(72);", + "\n public static readonly Error MissingSingleDataNodeParameter = new Error(73);", + "\n public static readonly Error InvalidDataNode = new Error(74);", + "\n public static readonly Error InvalidDataNodeForOpening = new Error(75);", + "\n public static readonly Error InvalidCashFlowPeriodicity = new Error(76);", + "\n public static readonly Error MissingInterpolationMethod = new Error(77);", + "\n public static readonly Error InvalidInterpolationMethod = new Error(78);", + "\n public static readonly Error InvalidEconomicBasisDriver = new Error(79);", + "\n public static readonly Error InvalidReleasePattern = new Error(80);", "\n", "\n // Storage Errors; Range 90 - 109", - "\n public static readonly CEError DataNodeNotFound = new CEError(90);", - "\n public static readonly CEError PartnerNotFound = new CEError(91);", - "\n public static readonly CEError PeriodNotFound = new CEError(92);", - "\n public static readonly CEError RatingNotFound = new CEError(93);", - "\n public static readonly CEError CreditDefaultRateNotFound = new CEError(94);", - "\n public static readonly CEError MissingPremiumAllocation = new CEError(95);", - "\n public static readonly CEError ReinsuranceCoverage = new CEError(96);", - "\n public static readonly CEError YieldCurveNotFound = new CEError(97);", - "\n public static readonly CEError YieldCurvePeriodNotApplicable = new CEError(98);", - "\n public static readonly CEError EconomicBasisNotFound = new CEError(99);", - "\n public static readonly CEError AccountingVariableTypeNotFound = new CEError(100);", - "\n public static readonly CEError InvalidGric = new CEError(101);", - "\n public static readonly CEError InvalidGic = new CEError(102);", - "\n public static readonly CEError ReleasePatternNotFound = new CEError(103);", - "\n public static readonly CEError MissingPreviousPeriodData = new CEError(104);", + "\n public static readonly Error DataNodeNotFound = new Error(90);", + "\n public static readonly Error PartnerNotFound = new Error(91);", + "\n public static readonly Error PeriodNotFound = new Error(92);", + "\n public static readonly Error RatingNotFound = new Error(93);", + "\n public static readonly Error CreditDefaultRateNotFound = new Error(94);", + "\n public static readonly Error MissingPremiumAllocation = new Error(95);", + "\n public static readonly Error ReinsuranceCoverage = new Error(96);", + "\n public static readonly Error YieldCurveNotFound = new Error(97);", + "\n public static readonly Error YieldCurvePeriodNotApplicable = new Error(98);", + "\n public static readonly Error EconomicBasisNotFound = new Error(99);", + "\n public static readonly Error AccountingVariableTypeNotFound = new Error(100);", + "\n public static readonly Error InvalidGric = new Error(101);", + "\n public static readonly Error InvalidGic = new Error(102);", + "\n public static readonly Error ReleasePatternNotFound = new Error(103);", + "\n public static readonly Error MissingPreviousPeriodData = new Error(104);", "\n", "\n // Scopes Errors; Range 110 -119", - "\n public static readonly CEError NotSupportedAocStepReference = new CEError(110);", - "\n public static readonly CEError MultipleEoP = new CEError(111);", + "\n public static readonly Error NotSupportedAocStepReference = new Error(110);", + "\n public static readonly Error MultipleEoP = new Error(111);", "\n", "\n // Data Completeness Errors; Range 120 - 129", - "\n public static readonly CEError MissingDataAtPosting = new CEError(120);", - "\n public static readonly CEError MissingCombinedLiability = new CEError(121);", - "\n public static readonly CEError MissingCoverageUnit = new CEError(122);", + "\n public static readonly Error MissingDataAtPosting = new Error(120);", + "\n public static readonly Error MissingCombinedLiability = new Error(121);", + "\n public static readonly Error MissingCoverageUnit = new Error(122);", "\n", "\n // Index Error ", - "\n public static readonly CEError NegativeIndex = new CEError(130);", + "\n public static readonly Error NegativeIndex = new Error(130);", "\n", "\n // Generic Errors", - "\n public static readonly CEError Generic = new CEError(140); ", + "\n public static readonly Error Generic = new Error(140); ", "\n}" ], "metadata": {}, @@ -200,97 +200,97 @@ { "cell_type": "code", "source": [ - "public static string Get (CEError e, params string[] s) => s.Length switch ", + "public static string Get (Error e, params string[] s) => s.Length switch ", "\n{", "\n // Import", - "\n 0 when e == CEError.NoMainTab => $\"No Main tab in the parsed file.\", ", - "\n _ when e == CEError.IncompleteMainTab => $\"Incomplete Main tab in the parsed file.\",", - "\n 1 when e == CEError.ParsingInvalidOrScientificValue => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", - "\n _ when e == CEError.ValueTypeNotFound => $\"Value Type not found.\",", - "\n 1 when e == CEError.ValueTypeNotValid => $\"The Value Type {s[0]} is invalid.\",", - "\n _ when e == CEError.ReportingNodeInMainNotFound => $\"Reporting Node missing from the Main tab.\",", - "\n _ when e == CEError.YearInMainNotFound => $\"Year missing from the Main tab.\",", - "\n _ when e == CEError.MonthInMainNotFound => $\"Month missing from the Main tab.\",", - "\n 1 when e == CEError.ScenarioInMainNotAvailable => $\"Scenario {s[0]} has not been defined.\",", - "\n 1 when e == CEError.AocTypeNotValid => $\"The parsed AoC Type {s[0]} is invalid.\",", - "\n _ when e == CEError.AocTypeCompulsoryNotFound => $\"Not all compulsory AoC Types have been imported.\",", - "\n 1 when e == CEError.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", - "\n _ when e == CEError.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", - "\n 1 when e == CEError.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n 0 when e == Error.NoMainTab => $\"No Main tab in the parsed file.\", ", + "\n _ when e == Error.IncompleteMainTab => $\"Incomplete Main tab in the parsed file.\",", + "\n 1 when e == Error.ParsingInvalidOrScientificValue => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", + "\n _ when e == Error.ValueTypeNotFound => $\"Value Type not found.\",", + "\n 1 when e == Error.ValueTypeNotValid => $\"The Value Type {s[0]} is invalid.\",", + "\n _ when e == Error.ReportingNodeInMainNotFound => $\"Reporting Node missing from the Main tab.\",", + "\n _ when e == Error.YearInMainNotFound => $\"Year missing from the Main tab.\",", + "\n _ when e == Error.MonthInMainNotFound => $\"Month missing from the Main tab.\",", + "\n 1 when e == Error.ScenarioInMainNotAvailable => $\"Scenario {s[0]} has not been defined.\",", + "\n 1 when e == Error.AocTypeNotValid => $\"The parsed AoC Type {s[0]} is invalid.\",", + "\n _ when e == Error.AocTypeCompulsoryNotFound => $\"Not all compulsory AoC Types have been imported.\",", + "\n 1 when e == Error.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", + "\n _ when e == Error.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", + "\n 1 when e == Error.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", "\n", "\n // Partition", - "\n _ when e == CEError.PartitionNotFound => $\"Partition do not found.\",", - "\n 1 when e == CEError.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}.\",", - "\n 4 when e == CEError.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", - "\n 1 when e == CEError.PartitionTypeNotFound => $\"Partition type not found: {s[0]}.\",", + "\n _ when e == Error.PartitionNotFound => $\"Partition do not found.\",", + "\n 1 when e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}.\",", + "\n 4 when e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", + "\n 1 when e == Error.PartitionTypeNotFound => $\"Partition type not found: {s[0]}.\",", "\n", "\n // Dimensions", - "\n 1 when e == CEError.AmountTypeNotFound => $\"AmountType {s[0]} not found.\",", - "\n 1 when e == CEError.EstimateTypeNotFound => $\"EstimateType {s[0]} not found.\",", - "\n 1 when e == CEError.ReportingNodeNotFound => $\"Reporting Node {s[0]} not found.\",", - "\n 1 when e == CEError.AocTypeNotFound => $\"AoC Type {s[0]} not found.\",", - "\n 2 when e == CEError.AocTypeMapNotFound => $\"AoC Type {s[0]} and Novelty {s[1]} combination not defined in the mapping.\",", - "\n 2 when e == CEError.PortfolioGicNotFound => $\"Portfolio {s[0]} assigned to Group of Insurance Contract {s[1]} does not exist.\",", - "\n 2 when e == CEError.PortfolioGricNotFound => $\"Portfolio {s[0]} assigned to Group of Reinsurance Contract {s[1]} does not exist.\",", - "\n 2 when e == CEError.InvalidAmountTypeEstimateType => $\"Invalid combination of EstimateType {s[0]} and AmountType {s[1]}.\",", - "\n 1 when e == CEError.MultipleTechnicalMarginOpening => $\"Multiple opening for techincal margin are not allowed for DataNode {s[0]}.\",", - "\n 2 when e == CEError.DimensionNotFound => $\"Column {0} has unknown value {1}.\",", - "\n 0 when e == CEError.NoScenarioOpening => \"Only Best Estimate is valid Scenario for Openings\",", + "\n 1 when e == Error.AmountTypeNotFound => $\"AmountType {s[0]} not found.\",", + "\n 1 when e == Error.EstimateTypeNotFound => $\"EstimateType {s[0]} not found.\",", + "\n 1 when e == Error.ReportingNodeNotFound => $\"Reporting Node {s[0]} not found.\",", + "\n 1 when e == Error.AocTypeNotFound => $\"AoC Type {s[0]} not found.\",", + "\n 2 when e == Error.AocTypeMapNotFound => $\"AoC Type {s[0]} and Novelty {s[1]} combination not defined in the mapping.\",", + "\n 2 when e == Error.PortfolioGicNotFound => $\"Portfolio {s[0]} assigned to Group of Insurance Contract {s[1]} does not exist.\",", + "\n 2 when e == Error.PortfolioGricNotFound => $\"Portfolio {s[0]} assigned to Group of Reinsurance Contract {s[1]} does not exist.\",", + "\n 2 when e == Error.InvalidAmountTypeEstimateType => $\"Invalid combination of EstimateType {s[0]} and AmountType {s[1]}.\",", + "\n 1 when e == Error.MultipleTechnicalMarginOpening => $\"Multiple opening for techincal margin are not allowed for DataNode {s[0]}.\",", + "\n 2 when e == Error.DimensionNotFound => $\"Column {0} has unknown value {1}.\",", + "\n 0 when e == Error.NoScenarioOpening => \"Only Best Estimate is valid Scenario for Openings\",", "\n ", "\n // Exchange Rate", - "\n 2 when e == CEError.ExchangeRateNotFound => $\"Exchange Rate for {s[0]} {s[1]} is not present.\",", - "\n 1 when e == CEError.ExchangeRateCurrency => $\"{s[0]} does not have any Exchange Rate defined.\",", + "\n 2 when e == Error.ExchangeRateNotFound => $\"Exchange Rate for {s[0]} {s[1]} is not present.\",", + "\n 1 when e == Error.ExchangeRateCurrency => $\"{s[0]} does not have any Exchange Rate defined.\",", "\n", "\n // Data Node State", - "\n 0 when e == CEError.ChangeDataNodeState => $\"Data Node State can not change from Inactive state into Active state.\",", - "\n 1 when e == CEError.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from Inactive state into Active state.\",", - "\n 3 when e == CEError.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from {s[1]} state into {s[2]} state.\",", - "\n 1 when e == CEError.InactiveDataNodeState => $\"Data imported for inactive Data Node {s[0]}.\",", + "\n 0 when e == Error.ChangeDataNodeState => $\"Data Node State can not change from Inactive state into Active state.\",", + "\n 1 when e == Error.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from Inactive state into Active state.\",", + "\n 3 when e == Error.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from {s[1]} state into {s[2]} state.\",", + "\n 1 when e == Error.InactiveDataNodeState => $\"Data imported for inactive Data Node {s[0]}.\",", "\n", "\n //Parameters", - "\n 2 when e == CEError.ReinsuranceCoverageDataNode => $\"Invalid Reinsurance Coverage parameter does not link a GroupOfReinsuranceContract to a GroupOfInsuranceContract. Provided GroupOfContracts are: {s[0]}, {s[1]}.\",", - "\n 2 when e == CEError.DuplicateInterDataNode => $\"Duplicated Inter-DataNode parameter for {s[0]}-{s[1]} is found.\",", - "\n 1 when e == CEError.DuplicateSingleDataNode => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",", - "\n 1 when e == CEError.MissingSingleDataNodeParameter => $\"Single DataNode Parameter for Data Node {s[0]} is not found.\",", - "\n 1 when e == CEError.InvalidDataNode => $\"Data imported for invalid Data Node {s[0]}.\",", - "\n 1 when e == CEError.InvalidDataNodeForOpening => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",", - "\n 1 when e == CEError.InvalidCashFlowPeriodicity => $\"Invalid CashFlowPeriodicity parameter for Data Node {s[0]}.\",", - "\n 1 when e == CEError.MissingInterpolationMethod => $\"Missing InterpolationMethod parameter for Data Node {s[0]}.\",", - "\n 1 when e == CEError.InvalidInterpolationMethod => $\"Invalid InterpolationMethod parameter for Data Node {s[0]}.\",", - "\n 1 when e == CEError.InvalidEconomicBasisDriver => $\"Invalid EconomicBasisDriver parameter for Data Node {s[0]}.\",", - "\n 1 when e == CEError.InvalidReleasePattern => $\"Invalid ReleasePattern parameters for Data Node {s[0]}.\",", + "\n 2 when e == Error.ReinsuranceCoverageDataNode => $\"Invalid Reinsurance Coverage parameter does not link a GroupOfReinsuranceContract to a GroupOfInsuranceContract. Provided GroupOfContracts are: {s[0]}, {s[1]}.\",", + "\n 2 when e == Error.DuplicateInterDataNode => $\"Duplicated Inter-DataNode parameter for {s[0]}-{s[1]} is found.\",", + "\n 1 when e == Error.DuplicateSingleDataNode => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",", + "\n 1 when e == Error.MissingSingleDataNodeParameter => $\"Single DataNode Parameter for Data Node {s[0]} is not found.\",", + "\n 1 when e == Error.InvalidDataNode => $\"Data imported for invalid Data Node {s[0]}.\",", + "\n 1 when e == Error.InvalidDataNodeForOpening => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",", + "\n 1 when e == Error.InvalidCashFlowPeriodicity => $\"Invalid CashFlowPeriodicity parameter for Data Node {s[0]}.\",", + "\n 1 when e == Error.MissingInterpolationMethod => $\"Missing InterpolationMethod parameter for Data Node {s[0]}.\",", + "\n 1 when e == Error.InvalidInterpolationMethod => $\"Invalid InterpolationMethod parameter for Data Node {s[0]}.\",", + "\n 1 when e == Error.InvalidEconomicBasisDriver => $\"Invalid EconomicBasisDriver parameter for Data Node {s[0]}.\",", + "\n 1 when e == Error.InvalidReleasePattern => $\"Invalid ReleasePattern parameters for Data Node {s[0]}.\",", "\n ", "\n // Storage", - "\n 1 when e == CEError.DataNodeNotFound => $\"DataNode {s[0]} not found.\",", - "\n 1 when e == CEError.PartnerNotFound => $\"Partner not found for DataNode {s[0]}.\",", - "\n 1 when e == CEError.PeriodNotFound => $\"Invalid Period {s[0]} used during calculation. Allowed values are Current Period (0) and Previous Period (-1).\",", - "\n 1 when e == CEError.RatingNotFound => $\"Rating not found for Partner {s[0]}.\",", - "\n 1 when e == CEError.CreditDefaultRateNotFound => $\"Credit Default Rate not found for rating {s[0]}.\",", - "\n 1 when e == CEError.MissingPremiumAllocation => $\"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 1 when e == CEError.ReinsuranceCoverage => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",", - "\n 6 when e == CEError.YieldCurveNotFound => $\"Yield Curve not found for DataNode {s[0]}, Currency {s[1]}, Year {s[2]}, Month {s[3]}, Scenario {(s[4] == null ? \"Best Estimate\" : s[4])} and Name {s[5]}.\",", - "\n 2 when e == CEError.YieldCurvePeriodNotApplicable => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {s[0]} and Novelty {s[1]}.\",", - "\n 1 when e == CEError.EconomicBasisNotFound => $\"EconomicBasis not valid for DataNode {s[0]}.\",", - "\n 1 when e == CEError.AccountingVariableTypeNotFound => $\"AccountingVariableType {s[0]} not found.\",", - "\n 1 when e == CEError.InvalidGric => $\"Invalid Group of Reinsurance Contract {s[0]} has been requested during calculation.\",", - "\n 1 when e == CEError.InvalidGic => $\"Invalid Group of Insurance Contract {s[0]} has been requested during calculation.\",", - "\n 2 when e == CEError.ReleasePatternNotFound => $\"Release pattern for Group of Contract {s[0]} and AmountType {s[1]} is not found.\",", - "\n 3 when e == CEError.MissingPreviousPeriodData => $\"Data for previous period (Year: {s[0]}, Month: {s[1]}) is missing for Group of contracts: {s[2]}.\",", + "\n 1 when e == Error.DataNodeNotFound => $\"DataNode {s[0]} not found.\",", + "\n 1 when e == Error.PartnerNotFound => $\"Partner not found for DataNode {s[0]}.\",", + "\n 1 when e == Error.PeriodNotFound => $\"Invalid Period {s[0]} used during calculation. Allowed values are Current Period (0) and Previous Period (-1).\",", + "\n 1 when e == Error.RatingNotFound => $\"Rating not found for Partner {s[0]}.\",", + "\n 1 when e == Error.CreditDefaultRateNotFound => $\"Credit Default Rate not found for rating {s[0]}.\",", + "\n 1 when e == Error.MissingPremiumAllocation => $\"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 1 when e == Error.ReinsuranceCoverage => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",", + "\n 6 when e == Error.YieldCurveNotFound => $\"Yield Curve not found for DataNode {s[0]}, Currency {s[1]}, Year {s[2]}, Month {s[3]}, Scenario {(s[4] == null ? \"Best Estimate\" : s[4])} and Name {s[5]}.\",", + "\n 2 when e == Error.YieldCurvePeriodNotApplicable => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {s[0]} and Novelty {s[1]}.\",", + "\n 1 when e == Error.EconomicBasisNotFound => $\"EconomicBasis not valid for DataNode {s[0]}.\",", + "\n 1 when e == Error.AccountingVariableTypeNotFound => $\"AccountingVariableType {s[0]} not found.\",", + "\n 1 when e == Error.InvalidGric => $\"Invalid Group of Reinsurance Contract {s[0]} has been requested during calculation.\",", + "\n 1 when e == Error.InvalidGic => $\"Invalid Group of Insurance Contract {s[0]} has been requested during calculation.\",", + "\n 2 when e == Error.ReleasePatternNotFound => $\"Release pattern for Group of Contract {s[0]} and AmountType {s[1]} is not found.\",", + "\n 3 when e == Error.MissingPreviousPeriodData => $\"Data for previous period (Year: {s[0]}, Month: {s[1]}) is missing for Group of contracts: {s[2]}.\",", "\n", "\n // Scopes", - "\n 1 when e == CEError.NotSupportedAocStepReference => $\"Unsupported reference AoC Step for AoC Type {s[0]}.\",", - "\n 0 when e == CEError.MultipleEoP => $\"Closing Balance for both Csm and Lc are computed.\",", + "\n 1 when e == Error.NotSupportedAocStepReference => $\"Unsupported reference AoC Step for AoC Type {s[0]}.\",", + "\n 0 when e == Error.MultipleEoP => $\"Closing Balance for both Csm and Lc are computed.\",", "\n", "\n // Data Completeness", - "\n 1 when e == CEError.MissingDataAtPosting => $\"Missing imported data for {s[0]} DataNode.\",", - "\n 2 when e == CEError.MissingCombinedLiability => $\"Missing Combined Liability AoC Type for DataNode {s[0]} and AmountType {s[1]}.\",", - "\n 1 when e == CEError.MissingCoverageUnit => $\"Missing Coverage Unit cash flow for {s[0]} DataNode.\",", + "\n 1 when e == Error.MissingDataAtPosting => $\"Missing imported data for {s[0]} DataNode.\",", + "\n 2 when e == Error.MissingCombinedLiability => $\"Missing Combined Liability AoC Type for DataNode {s[0]} and AmountType {s[1]}.\",", + "\n 1 when e == Error.MissingCoverageUnit => $\"Missing Coverage Unit cash flow for {s[0]} DataNode.\",", "\n", "\n // Index", - "\n 0 when e == CEError.NegativeIndex => $\"Index was out of range. Must be non-negative.\",", + "\n 0 when e == Error.NegativeIndex => $\"Index was out of range. Must be non-negative.\",", "\n", "\n // Default", - "\n 1 when e == CEError.Generic => $\"{s[0]}\", ", + "\n 1 when e == Error.Generic => $\"{s[0]}\", ", "\n _ => $\"Error not found.\"", "\n};", "\n" @@ -302,14 +302,14 @@ { "cell_type": "code", "source": [ - "public static string Get (CEWarning w, params string[] s) => s.Length switch {", + "public static string Get (Warning w, params string[] s) => s.Length switch {", "\n // Import", - "\n 1 when w == CEWarning.ActiveDataNodeWithCashflowBOPI => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", - "\n 0 when w == CEWarning.VariablesAlreadyImported => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", - "\n 3 when w == CEWarning.MandatoryAocStepMissing => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", - "\n 1 when w == CEWarning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", + "\n 1 when w == Warning.ActiveDataNodeWithCashflowBOPI => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", + "\n 0 when w == Warning.VariablesAlreadyImported => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", + "\n 3 when w == Warning.MandatoryAocStepMissing => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", + "\n 1 when w == Warning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", "\n // Default", - "\n _ when w == CEWarning.Generic => $\"{s[0]}\",", + "\n _ when w == Warning.Generic => $\"{s[0]}\",", "\n _ => $\"Warning not found.\"", "\n};" ], From 5d8ab6a4427ccfebcc4f4a231de603d9f0deee72 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 11:58:35 +0200 Subject: [PATCH 08/26] add new error and log it into the cashflow importer --- ifrs17/Constants/Validations.ipynb | 6 ++-- ifrs17/Import/Importers.ipynb | 45 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 06f064a6..3ff41267 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -110,6 +110,7 @@ "\n public static readonly Error AocTypePositionNotSupported = new Error(12);", "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(13);", "\n public static readonly Error AccidentYearTypeNotValid = new Error(14);", + "\n public static readonly Error TableNotFound = new Error(15);", "\n", "\n // Partition Errors; Range 20 - 29", "\n public static readonly Error PartitionNotFound = new Error(20);", @@ -217,6 +218,7 @@ "\n 1 when e == Error.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", "\n _ when e == Error.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", "\n 1 when e == Error.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n 1 when e == Error.TableNotFound => $\"The import file does not contain table {s[0]}.\",", "\n", "\n // Partition", "\n _ when e == Error.PartitionNotFound => $\"Partition do not found.\",", @@ -225,7 +227,7 @@ "\n 1 when e == Error.PartitionTypeNotFound => $\"Partition type not found: {s[0]}.\",", "\n", "\n // Dimensions", - "\n 1 when e == Error.AmountTypeNotFound => $\"AmountType {s[0]} not found.\",", + "\n 1 when e == Error.AmountTypeNotFound => $\"AmountType {s[0]} not found.\",", "\n 1 when e == Error.EstimateTypeNotFound => $\"EstimateType {s[0]} not found.\",", "\n 1 when e == Error.ReportingNodeNotFound => $\"Reporting Node {s[0]} not found.\",", "\n 1 when e == Error.AocTypeNotFound => $\"AoC Type {s[0]} not found.\",", @@ -310,7 +312,7 @@ "\n 1 when w == Warning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", "\n // Default", "\n _ when w == Warning.Generic => $\"{s[0]}\",", - "\n _ => $\"Warning not found.\"", + "\n _ => $\"Warning not found.\"", "\n};" ], "metadata": {}, diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 770e66c4..b56a92be 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -1363,7 +1363,13 @@ "\n Activity.Start();", "\n var parsingStorage = new ParsingStorage(args, targetDataSource, workspace);", "\n await parsingStorage.InitializeAsync();", + "\n //if (!dataSet.Tables.Contains(ImportFormats.Cashflow)) Activity.Errors.Add(new ActivityMessageNotification(Get(Error.TableNotFound, ImportFormats.Cashflow)));", "\n if(Activity.HasErrors()) return Activity.Finish();", + "\n if(!dataSet.Tables.Contains(ImportFormats.Cashflow)){", + "\n var activityLog = Activity.Finish();", + "\n activityLog.Errors.Add(new ActivityMessageNotification(Get(Error.TableNotFound, ImportFormats.Cashflow)));", + "\n return activityLog;", + "\n }", "\n ", "\n var hasAccidentYearColumn = dataSet.Tables[ImportFormats.Cashflow].Columns.Any(x => x.ColumnName == nameof(RawVariable.AccidentYear));", "\n var hasCashFlowPeriodicityColumn = dataSet.Tables[ImportFormats.Cashflow].Columns.Any(x => x.ColumnName == nameof(CashFlowPeriodicity));", @@ -1793,6 +1799,45 @@ "metadata": {}, "execution_count": 0, "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "typeof(ActivityLog).GetMethods().Where((_, i) => i > 10).Select(x => x.Name)" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var activity = new ActivityLog(new Guid(), new DateTime(), new DateTime(), \"bla\", ActivityLogStatus.Succeeded, ", + "\n new List(), ", + "\n new List(), ", + "\n new List());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Errors.Add(new ActivityMessageNotification(\"bla\"))" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] } ] } \ No newline at end of file From 71db57ac2f74819eb6ac67d8775554faf519c3c1 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 12:34:33 +0200 Subject: [PATCH 09/26] define a Util and use it to end the activity if there is no table --- ifrs17/Import/Importers.ipynb | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index b56a92be..df0aa986 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -36,6 +36,19 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "ActivityLog EndActivityIfTableNotFound(IActivityVariable activity, string tableName){", + "\n var activityLog = activity.Finish();", + "\n activityLog.Errors.Add(new ActivityMessageNotification(Get(Error.TableNotFound, tableName)));", + "\n return activityLog;", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [ @@ -1173,6 +1186,7 @@ "\n var storage = new ParsingStorage(args, targetDataSource, workspace);", "\n await storage.InitializeAsync();", "\n if(Activity.HasErrors()) return Activity.Finish();", + "\n if (!dataSet.Tables.Contains(nameof(SingleDataNodeParameter))) return EndActivityIfTableNotFound(Activity, nameof(SingleDataNodeParameter));", "\n var singleDataNode = new List();", "\n var interDataNode = new List<(string,string)>();", "\n", @@ -1363,13 +1377,8 @@ "\n Activity.Start();", "\n var parsingStorage = new ParsingStorage(args, targetDataSource, workspace);", "\n await parsingStorage.InitializeAsync();", - "\n //if (!dataSet.Tables.Contains(ImportFormats.Cashflow)) Activity.Errors.Add(new ActivityMessageNotification(Get(Error.TableNotFound, ImportFormats.Cashflow)));", "\n if(Activity.HasErrors()) return Activity.Finish();", - "\n if(!dataSet.Tables.Contains(ImportFormats.Cashflow)){", - "\n var activityLog = Activity.Finish();", - "\n activityLog.Errors.Add(new ActivityMessageNotification(Get(Error.TableNotFound, ImportFormats.Cashflow)));", - "\n return activityLog;", - "\n }", + "\n if(!dataSet.Tables.Contains(ImportFormats.Cashflow)) return EndActivityIfTableNotFound(Activity, ImportFormats.Cashflow);", "\n ", "\n var hasAccidentYearColumn = dataSet.Tables[ImportFormats.Cashflow].Columns.Any(x => x.ColumnName == nameof(RawVariable.AccidentYear));", "\n var hasCashFlowPeriodicityColumn = dataSet.Tables[ImportFormats.Cashflow].Columns.Any(x => x.ColumnName == nameof(CashFlowPeriodicity));", From 74f9fcd6a1be7dbca111ef3a8d871eb1a3e3b748 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 14:17:13 +0200 Subject: [PATCH 10/26] Yield curve --- ifrs17/Import/Importers.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index df0aa986..08dcee96 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -900,6 +900,7 @@ "\n var primaryArgs = GetArgsFromMain(dataSet) with {ImportFormat = ImportFormats.YieldCurve};", "\n primaryArgs.ValidateArgsForPeriodAsync(options.TargetDataSource);", "\n if(ApplicationMessage.HasErrors()) return Activity.Finish();", + "\n if(!dataSet.Tables.Contains(ImportFormats.YieldCurve)) return EndActivityIfTableNotFound(Activity, ImportFormats.YieldCurve);", "\n var workspace = Workspace.CreateNew();", "\n workspace.Initialize(x => x.FromSource(options.TargetDataSource)", "\n .DisableInitialization()", From fc52ee2a89f1d1f37a6f513070e8ebd925b5cf5b Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 15:50:03 +0200 Subject: [PATCH 11/26] API improvement: use everywhere the Yield Curve way to log the error --- ifrs17/Constants/Validations.ipynb | 12 ++++++------ ifrs17/Import/Importers.ipynb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 3ff41267..526a3f97 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -304,14 +304,14 @@ { "cell_type": "code", "source": [ - "public static string Get (Warning w, params string[] s) => s.Length switch {", + "public static string Get (Warning w, params string[] s) => (s.Length, w.InternalValue) switch {", "\n // Import", - "\n 1 when w == Warning.ActiveDataNodeWithCashflowBOPI => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", - "\n 0 when w == Warning.VariablesAlreadyImported => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", - "\n 3 when w == Warning.MandatoryAocStepMissing => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", - "\n 1 when w == Warning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", + "\n (1, 1) => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", + "\n (0, 2) => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", + "\n (3, 3) => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", + "\n (1, 4) => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", "\n // Default", - "\n _ when w == Warning.Generic => $\"{s[0]}\",", + "\n (_ , 5) => $\"{s[0]}\",", "\n _ => $\"Warning not found.\"", "\n};" ], diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 08dcee96..029af304 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -899,8 +899,8 @@ "\n Activity.Start();", "\n var primaryArgs = GetArgsFromMain(dataSet) with {ImportFormat = ImportFormats.YieldCurve};", "\n primaryArgs.ValidateArgsForPeriodAsync(options.TargetDataSource);", + "\n if(!dataSet.Tables.Contains(ImportFormats.YieldCurve)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat);", "\n if(ApplicationMessage.HasErrors()) return Activity.Finish();", - "\n if(!dataSet.Tables.Contains(ImportFormats.YieldCurve)) return EndActivityIfTableNotFound(Activity, ImportFormats.YieldCurve);", "\n var workspace = Workspace.CreateNew();", "\n workspace.Initialize(x => x.FromSource(options.TargetDataSource)", "\n .DisableInitialization()", From b1b41125641d31927b3d57b8ac8b1f0913879d01 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 16:08:00 +0200 Subject: [PATCH 12/26] warnings: new more compact API --- ifrs17/Constants/Validations.ipynb | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 06f064a6..bb17bc71 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -57,9 +57,9 @@ "cell_type": "code", "source": [ "public abstract class ValidationBase{", - "\n public int InternalValue {get; protected set;}", + "\n public string InternalValue {get; protected set;}", "\n", - "\n protected ValidationBase(int internalValue){", + "\n protected ValidationBase(string internalValue){", "\n this.InternalValue = internalValue;", "\n }", "\n}" @@ -73,14 +73,24 @@ "source": [ "public class Warning : ValidationBase{", "\n", - "\n protected Warning(int internalValue) : base(internalValue) {}", + "\n protected Warning(string internalValue) : base(internalValue) {}", "\n", - "\n public static readonly Warning ActiveDataNodeWithCashflowBOPI = new Warning(1);", - "\n public static readonly Warning VariablesAlreadyImported = new Warning(2);", - "\n public static readonly Warning VariablesAlreadyCalculated = new Warning(3);", - "\n public static readonly Warning ScenarioReCalculations = new Warning(4);", - "\n public static readonly Warning MandatoryAocStepMissing = new Warning(5);", - "\n public static readonly Warning Generic = new Warning(6);", + "\n public static readonly Warning ActiveDataNodeWithCashflowBOPI = new Warning(nameof(ActiveDataNodeWithCashflowBOPI));", + "\n public static readonly Warning VariablesAlreadyImported = new Warning(nameof(VariablesAlreadyImported));", + "\n public static readonly Warning VariablesAlreadyCalculated = new Warning(nameof(VariablesAlreadyCalculated));", + "\n public static readonly Warning ScenarioReCalculations = new Warning(nameof(ScenarioReCalculations));", + "\n public static readonly Warning MandatoryAocStepMissing = new Warning(nameof(MandatoryAocStepMissing));", + "\n public static readonly Warning Generic = new Warning(nameof(Generic));", + "\n", + "\n public string GetMessage(params string[] s) => (InternalValue, s.Length) switch{", + "\n (nameof(ActiveDataNodeWithCashflowBOPI), 1) => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", + "\n (nameof(VariablesAlreadyImported), 0) => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", + "\n (nameof(MandatoryAocStepMissing), 3) => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", + "\n (nameof(ScenarioReCalculations), 1) => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", + "\n // Default", + "\n (nameof(Generic), _) => $\"{s[0]}\",", + "\n _ => $\"Warning not found.\"", + "\n };", "\n ", "\n}" ], From 8f89e3db048cb4847eafb660f73e827c283af9c3 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 17:35:56 +0200 Subject: [PATCH 13/26] moved the Get functions to be virtual methods of the error and warning classes. The application message in Utils must be updated accordingly. --- ifrs17/Constants/Validations.ipynb | 358 +++++++++++++---------------- 1 file changed, 162 insertions(+), 196 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index bb17bc71..5c20733f 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -73,6 +73,8 @@ "source": [ "public class Warning : ValidationBase{", "\n", + "\n protected const string DefaultMessage = \"Warning not found.\";", + "\n", "\n protected Warning(string internalValue) : base(internalValue) {}", "\n", "\n public static readonly Warning ActiveDataNodeWithCashflowBOPI = new Warning(nameof(ActiveDataNodeWithCashflowBOPI));", @@ -82,14 +84,14 @@ "\n public static readonly Warning MandatoryAocStepMissing = new Warning(nameof(MandatoryAocStepMissing));", "\n public static readonly Warning Generic = new Warning(nameof(Generic));", "\n", - "\n public string GetMessage(params string[] s) => (InternalValue, s.Length) switch{", + "\n public virtual string GetMessage(params string[] s) => (InternalValue, s.Length) switch{", "\n (nameof(ActiveDataNodeWithCashflowBOPI), 1) => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", "\n (nameof(VariablesAlreadyImported), 0) => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", "\n (nameof(MandatoryAocStepMissing), 3) => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", "\n (nameof(ScenarioReCalculations), 1) => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", "\n // Default", "\n (nameof(Generic), _) => $\"{s[0]}\",", - "\n _ => $\"Warning not found.\"", + "\n _ => DefaultMessage", "\n };", "\n ", "\n}" @@ -103,225 +105,189 @@ "source": [ "public class Error : ValidationBase{", "\n ", - "\n protected Error(int internalValue) : base(internalValue) {}", + "\n protected Error(string internalValue) : base(internalValue) {}", "\n", - "\n // Import Errors; Range 1 - 19", - "\n public static readonly Error NoMainTab = new Error(1);", - "\n public static readonly Error IncompleteMainTab = new Error(2);", - "\n public static readonly Error ParsingInvalidOrScientificValue = new Error(3);", - "\n public static readonly Error ValueTypeNotFound = new Error(4);", - "\n public static readonly Error ValueTypeNotValid = new Error(5);", - "\n public static readonly Error ReportingNodeInMainNotFound = new Error(6);", - "\n public static readonly Error YearInMainNotFound = new Error(7);", - "\n public static readonly Error MonthInMainNotFound = new Error(8);", - "\n public static readonly Error ScenarioInMainNotAvailable = new Error(9);", - "\n public static readonly Error AocTypeNotValid = new Error(10);", - "\n public static readonly Error AocTypeCompulsoryNotFound = new Error(11);", - "\n public static readonly Error AocTypePositionNotSupported = new Error(12);", - "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(13);", - "\n public static readonly Error AccidentYearTypeNotValid = new Error(14);", + "\n // Import Errors", + "\n public static readonly Error NoMainTab = new Error(nameof(NoMainTab));", + "\n public static readonly Error IncompleteMainTab = new Error(nameof(IncompleteMainTab));", + "\n public static readonly Error ParsingInvalidOrScientificValue = new Error(nameof(ParsingInvalidOrScientificValue));", + "\n public static readonly Error ValueTypeNotFound = new Error(nameof(ValueTypeNotFound));", + "\n public static readonly Error ValueTypeNotValid = new Error(nameof(ValueTypeNotValid));", + "\n public static readonly Error ReportingNodeInMainNotFound = new Error(nameof(ReportingNodeInMainNotFound));", + "\n public static readonly Error YearInMainNotFound = new Error(nameof(YearInMainNotFound));", + "\n public static readonly Error MonthInMainNotFound = new Error(nameof(MonthInMainNotFound));", + "\n public static readonly Error ScenarioInMainNotAvailable = new Error(nameof(ScenarioInMainNotAvailable));", + "\n public static readonly Error AocTypeNotValid = new Error(nameof(AocTypeNotValid));", + "\n public static readonly Error AocTypeCompulsoryNotFound = new Error(nameof(AocTypeCompulsoryNotFound));", + "\n public static readonly Error AocTypePositionNotSupported = new Error(nameof(AocTypePositionNotSupported));", + "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(nameof(AocConfigurationOrderNotUnique));", + "\n public static readonly Error AccidentYearTypeNotValid = new Error(nameof(AccidentYearTypeNotValid));", "\n", - "\n // Partition Errors; Range 20 - 29", - "\n public static readonly Error PartitionNotFound = new Error(20);", - "\n public static readonly Error ParsedPartitionNotFound = new Error(21);", - "\n public static readonly Error PartititionNameNotFound = new Error(22);", - "\n public static readonly Error PartitionTypeNotFound = new Error(23);", + "\n // Partition Errors", + "\n public static readonly Error PartitionNotFound = new Error(nameof(PartitionNotFound));", + "\n public static readonly Error ParsedPartitionNotFound = new Error(nameof(ParsedPartitionNotFound));", + "\n public static readonly Error PartititionNameNotFound = new Error(nameof(PartititionNameNotFound));", + "\n public static readonly Error PartitionTypeNotFound = new Error(nameof(PartitionTypeNotFound));", "\n", - "\n // Dimensions Errors; Range 30 - 49", - "\n public static readonly Error AmountTypeNotFound = new Error(30);", - "\n public static readonly Error EstimateTypeNotFound = new Error(31); ", - "\n public static readonly Error ReportingNodeNotFound = new Error(32);", - "\n public static readonly Error AocTypeMapNotFound = new Error(33);", - "\n public static readonly Error AocTypeNotFound = new Error(34);", - "\n public static readonly Error PortfolioGicNotFound = new Error(35);", - "\n public static readonly Error PortfolioGricNotFound = new Error(36);", - "\n public static readonly Error InvalidAmountTypeEstimateType = new Error(37);", - "\n public static readonly Error MultipleTechnicalMarginOpening = new Error(38);", - "\n public static readonly Error DimensionNotFound = new Error(39);", - "\n public static readonly Error NoScenarioOpening = new Error(40);", + "\n // Dimensions Errors", + "\n public static readonly Error AmountTypeNotFound = new Error(nameof(AmountTypeNotFound));", + "\n public static readonly Error EstimateTypeNotFound = new Error(nameof(EstimateTypeNotFound)); ", + "\n public static readonly Error ReportingNodeNotFound = new Error(nameof(ReportingNodeNotFound));", + "\n public static readonly Error AocTypeMapNotFound = new Error(nameof(AocTypeMapNotFound));", + "\n public static readonly Error AocTypeNotFound = new Error(nameof(AocTypeNotFound));", + "\n public static readonly Error PortfolioGicNotFound = new Error(nameof(PortfolioGicNotFound));", + "\n public static readonly Error PortfolioGricNotFound = new Error(nameof(PortfolioGricNotFound));", + "\n public static readonly Error InvalidAmountTypeEstimateType = new Error(nameof(InvalidAmountTypeEstimateType));", + "\n public static readonly Error MultipleTechnicalMarginOpening = new Error(nameof(MultipleTechnicalMarginOpening));", + "\n public static readonly Error DimensionNotFound = new Error(nameof(DimensionNotFound));", + "\n public static readonly Error NoScenarioOpening = new Error(nameof(NoScenarioOpening));", "\n", - "\n // Exchange Rate Errors; Range 50 - 59", - "\n public static readonly Error ExchangeRateNotFound = new Error(50);", - "\n public static readonly Error ExchangeRateCurrency = new Error(51);", + "\n // Exchange Rate Errors", + "\n public static readonly Error ExchangeRateNotFound = new Error(nameof(ExchangeRateNotFound));", + "\n public static readonly Error ExchangeRateCurrency = new Error(nameof(ExchangeRateCurrency));", "\n", - "\n // Data Node State Errors; Range 60 - 69", - "\n public static readonly Error ChangeDataNodeState = new Error(60);", - "\n public static readonly Error InactiveDataNodeState = new Error(61);", + "\n // Data Node State Errors", + "\n public static readonly Error ChangeDataNodeState = new Error(nameof(ChangeDataNodeState));", + "\n public static readonly Error InactiveDataNodeState = new Error(nameof(InactiveDataNodeState));", "\n", - "\n // Parameters Errors: Range 70 - 89 ", - "\n public static readonly Error ReinsuranceCoverageDataNode = new Error(70);", - "\n public static readonly Error DuplicateInterDataNode = new Error(71);", - "\n public static readonly Error DuplicateSingleDataNode = new Error(72);", - "\n public static readonly Error MissingSingleDataNodeParameter = new Error(73);", - "\n public static readonly Error InvalidDataNode = new Error(74);", - "\n public static readonly Error InvalidDataNodeForOpening = new Error(75);", - "\n public static readonly Error InvalidCashFlowPeriodicity = new Error(76);", - "\n public static readonly Error MissingInterpolationMethod = new Error(77);", - "\n public static readonly Error InvalidInterpolationMethod = new Error(78);", - "\n public static readonly Error InvalidEconomicBasisDriver = new Error(79);", - "\n public static readonly Error InvalidReleasePattern = new Error(80);", + "\n // Parameters Errors", + "\n public static readonly Error ReinsuranceCoverageDataNode = new Error(nameof(ReinsuranceCoverageDataNode));", + "\n public static readonly Error DuplicateInterDataNode = new Error(nameof(DuplicateInterDataNode));", + "\n public static readonly Error DuplicateSingleDataNode = new Error(nameof(DuplicateSingleDataNode));", + "\n public static readonly Error MissingSingleDataNodeParameter = new Error(nameof(MissingSingleDataNodeParameter));", + "\n public static readonly Error InvalidDataNode = new Error(nameof(InvalidDataNode));", + "\n public static readonly Error InvalidDataNodeForOpening = new Error(nameof(InvalidDataNodeForOpening));", + "\n public static readonly Error InvalidCashFlowPeriodicity = new Error(nameof(InvalidCashFlowPeriodicity));", + "\n public static readonly Error MissingInterpolationMethod = new Error(nameof(MissingInterpolationMethod));", + "\n public static readonly Error InvalidInterpolationMethod = new Error(nameof(InvalidInterpolationMethod));", + "\n public static readonly Error InvalidEconomicBasisDriver = new Error(nameof(InvalidEconomicBasisDriver));", + "\n public static readonly Error InvalidReleasePattern = new Error(nameof(InvalidReleasePattern));", "\n", - "\n // Storage Errors; Range 90 - 109", - "\n public static readonly Error DataNodeNotFound = new Error(90);", - "\n public static readonly Error PartnerNotFound = new Error(91);", - "\n public static readonly Error PeriodNotFound = new Error(92);", - "\n public static readonly Error RatingNotFound = new Error(93);", - "\n public static readonly Error CreditDefaultRateNotFound = new Error(94);", - "\n public static readonly Error MissingPremiumAllocation = new Error(95);", - "\n public static readonly Error ReinsuranceCoverage = new Error(96);", - "\n public static readonly Error YieldCurveNotFound = new Error(97);", - "\n public static readonly Error YieldCurvePeriodNotApplicable = new Error(98);", - "\n public static readonly Error EconomicBasisNotFound = new Error(99);", - "\n public static readonly Error AccountingVariableTypeNotFound = new Error(100);", - "\n public static readonly Error InvalidGric = new Error(101);", - "\n public static readonly Error InvalidGic = new Error(102);", - "\n public static readonly Error ReleasePatternNotFound = new Error(103);", - "\n public static readonly Error MissingPreviousPeriodData = new Error(104);", + "\n // Storage Errors", + "\n public static readonly Error DataNodeNotFound = new Error(nameof(DataNodeNotFound));", + "\n public static readonly Error PartnerNotFound = new Error(nameof(PartnerNotFound));", + "\n public static readonly Error PeriodNotFound = new Error(nameof(PeriodNotFound));", + "\n public static readonly Error RatingNotFound = new Error(nameof(RatingNotFound));", + "\n public static readonly Error CreditDefaultRateNotFound = new Error(nameof(CreditDefaultRateNotFound));", + "\n public static readonly Error MissingPremiumAllocation = new Error(nameof(MissingPremiumAllocation));", + "\n public static readonly Error ReinsuranceCoverage = new Error(nameof(ReinsuranceCoverage));", + "\n public static readonly Error YieldCurveNotFound = new Error(nameof(YieldCurveNotFound));", + "\n public static readonly Error YieldCurvePeriodNotApplicable = new Error(nameof(YieldCurvePeriodNotApplicable));", + "\n public static readonly Error EconomicBasisNotFound = new Error(nameof(EconomicBasisNotFound));", + "\n public static readonly Error AccountingVariableTypeNotFound = new Error(nameof(AccountingVariableTypeNotFound));", + "\n public static readonly Error InvalidGric = new Error(nameof(InvalidGric));", + "\n public static readonly Error InvalidGic = new Error(nameof(InvalidGic));", + "\n public static readonly Error ReleasePatternNotFound = new Error(nameof(ReleasePatternNotFound));", + "\n public static readonly Error MissingPreviousPeriodData = new Error(nameof(MissingPreviousPeriodData));", "\n", "\n // Scopes Errors; Range 110 -119", - "\n public static readonly Error NotSupportedAocStepReference = new Error(110);", - "\n public static readonly Error MultipleEoP = new Error(111);", + "\n public static readonly Error NotSupportedAocStepReference = new Error(nameof(NotSupportedAocStepReference));", + "\n public static readonly Error MultipleEoP = new Error(nameof(MultipleEoP));", "\n", "\n // Data Completeness Errors; Range 120 - 129", - "\n public static readonly Error MissingDataAtPosting = new Error(120);", - "\n public static readonly Error MissingCombinedLiability = new Error(121);", - "\n public static readonly Error MissingCoverageUnit = new Error(122);", + "\n public static readonly Error MissingDataAtPosting = new Error(nameof(MissingDataAtPosting));", + "\n public static readonly Error MissingCombinedLiability = new Error(nameof(MissingCombinedLiability));", + "\n public static readonly Error MissingCoverageUnit = new Error(nameof(MissingCoverageUnit));", "\n", "\n // Index Error ", - "\n public static readonly Error NegativeIndex = new Error(130);", + "\n public static readonly Error NegativeIndex = new Error(nameof(NegativeIndex));", "\n", "\n // Generic Errors", - "\n public static readonly Error Generic = new Error(140); ", - "\n}" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "markdown", - "source": [ - "# Messages" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "public static string Get (Error e, params string[] s) => s.Length switch ", - "\n{", - "\n // Import", - "\n 0 when e == Error.NoMainTab => $\"No Main tab in the parsed file.\", ", - "\n _ when e == Error.IncompleteMainTab => $\"Incomplete Main tab in the parsed file.\",", - "\n 1 when e == Error.ParsingInvalidOrScientificValue => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", - "\n _ when e == Error.ValueTypeNotFound => $\"Value Type not found.\",", - "\n 1 when e == Error.ValueTypeNotValid => $\"The Value Type {s[0]} is invalid.\",", - "\n _ when e == Error.ReportingNodeInMainNotFound => $\"Reporting Node missing from the Main tab.\",", - "\n _ when e == Error.YearInMainNotFound => $\"Year missing from the Main tab.\",", - "\n _ when e == Error.MonthInMainNotFound => $\"Month missing from the Main tab.\",", - "\n 1 when e == Error.ScenarioInMainNotAvailable => $\"Scenario {s[0]} has not been defined.\",", - "\n 1 when e == Error.AocTypeNotValid => $\"The parsed AoC Type {s[0]} is invalid.\",", - "\n _ when e == Error.AocTypeCompulsoryNotFound => $\"Not all compulsory AoC Types have been imported.\",", - "\n 1 when e == Error.AocTypePositionNotSupported => $\"The position of the AoC Type {s[0]} is not supported.\",", - "\n _ when e == Error.AocConfigurationOrderNotUnique => $\"Two or more AoC Configurations have the same Order.\",", - "\n 1 when e == Error.AccidentYearTypeNotValid => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n public static readonly Error Generic = new Error(nameof(Generic)); ", + "\n", + "\n public virtual string GetMessage (params string[] s) => (InternalValue, s.Length) switch{", + "\n // Import", + "\n (nameof(NoMainTab), 0) => $\"No Main tab in the parsed file.\", ", + "\n (nameof(IncompleteMainTab), _) => $\"Incomplete Main tab in the parsed file.\",", + "\n (nameof(ParsingInvalidOrScientificValue), 1) => $\"While parsing found invalid value or real number in scientific notation: {s[0]}.\",", + "\n (nameof(ValueTypeNotFound), _) => $\"Value Type not found.\",", + "\n (nameof(ValueTypeNotValid), 1) => $\"The Value Type {s[0]} is invalid.\",", + "\n (nameof(ReportingNodeInMainNotFound), _) => $\"Reporting Node missing from the Main tab.\",", + "\n (nameof(YearInMainNotFound), _) => $\"Year missing from the Main tab.\",", + "\n (nameof(MonthInMainNotFound), _) => $\"Month missing from the Main tab.\",", + "\n (nameof(ScenarioInMainNotAvailable), 1) => $\"Scenario {s[0]} has not been defined.\",", + "\n (nameof(AocTypeNotValid), 1) => $\"The parsed AoC Type {s[0]} is invalid.\",", + "\n (nameof(AocTypeCompulsoryNotFound), _) => $\"Not all compulsory AoC Types have been imported.\",", + "\n (nameof(AocTypePositionNotSupported), 1) => $\"The position of the AoC Type {s[0]} is not supported.\",", + "\n (nameof(AocConfigurationOrderNotUnique), _) => $\"Two or more AoC Configurations have the same Order.\",", + "\n (nameof(AccidentYearTypeNotValid), 1) => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", "\n", - "\n // Partition", - "\n _ when e == Error.PartitionNotFound => $\"Partition do not found.\",", - "\n 1 when e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}.\",", - "\n 4 when e == Error.ParsedPartitionNotFound => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", - "\n 1 when e == Error.PartitionTypeNotFound => $\"Partition type not found: {s[0]}.\",", + "\n // Partition", + "\n (nameof(PartitionNotFound), _) => $\"Partition do not found.\",", + "\n (nameof(ParsedPartitionNotFound), 1) => $\"Parsed partition not available: ReportingNode {s[0]}.\",", + "\n (nameof(ParsedPartitionNotFound), 4) => $\"Parsed partition not available: ReportingNode {s[0]}, Year {s[1]}, Month {s[2]}, Scenario {s[3]}.\",", + "\n (nameof(PartitionTypeNotFound), 1) => $\"Partition type not found: {s[0]}.\",", "\n", - "\n // Dimensions", - "\n 1 when e == Error.AmountTypeNotFound => $\"AmountType {s[0]} not found.\",", - "\n 1 when e == Error.EstimateTypeNotFound => $\"EstimateType {s[0]} not found.\",", - "\n 1 when e == Error.ReportingNodeNotFound => $\"Reporting Node {s[0]} not found.\",", - "\n 1 when e == Error.AocTypeNotFound => $\"AoC Type {s[0]} not found.\",", - "\n 2 when e == Error.AocTypeMapNotFound => $\"AoC Type {s[0]} and Novelty {s[1]} combination not defined in the mapping.\",", - "\n 2 when e == Error.PortfolioGicNotFound => $\"Portfolio {s[0]} assigned to Group of Insurance Contract {s[1]} does not exist.\",", - "\n 2 when e == Error.PortfolioGricNotFound => $\"Portfolio {s[0]} assigned to Group of Reinsurance Contract {s[1]} does not exist.\",", - "\n 2 when e == Error.InvalidAmountTypeEstimateType => $\"Invalid combination of EstimateType {s[0]} and AmountType {s[1]}.\",", - "\n 1 when e == Error.MultipleTechnicalMarginOpening => $\"Multiple opening for techincal margin are not allowed for DataNode {s[0]}.\",", - "\n 2 when e == Error.DimensionNotFound => $\"Column {0} has unknown value {1}.\",", - "\n 0 when e == Error.NoScenarioOpening => \"Only Best Estimate is valid Scenario for Openings\",", + "\n // Dimensions", + "\n (nameof(AmountTypeNotFound), 1) => $\"AmountType {s[0]} not found.\",", + "\n (nameof(EstimateTypeNotFound), 1) => $\"EstimateType {s[0]} not found.\",", + "\n (nameof(ReportingNodeNotFound), 1) => $\"Reporting Node {s[0]} not found.\",", + "\n (nameof(AocTypeNotFound), 1) => $\"AoC Type {s[0]} not found.\",", + "\n (nameof(AocTypeMapNotFound), 2) => $\"AoC Type {s[0]} and Novelty {s[1]} combination not defined in the mapping.\",", + "\n (nameof(PortfolioGicNotFound), 2) => $\"Portfolio {s[0]} assigned to Group of Insurance Contract {s[1]} does not exist.\",", + "\n (nameof(PortfolioGricNotFound), 2) => $\"Portfolio {s[0]} assigned to Group of Reinsurance Contract {s[1]} does not exist.\",", + "\n (nameof(InvalidAmountTypeEstimateType), 2) => $\"Invalid combination of EstimateType {s[0]} and AmountType {s[1]}.\",", + "\n (nameof(MultipleTechnicalMarginOpening), 1) => $\"Multiple opening for techincal margin are not allowed for DataNode {s[0]}.\",", + "\n (nameof(DimensionNotFound), 2) => $\"Column {0} has unknown value {1}.\",", + "\n (nameof(NoScenarioOpening), 0) => \"Only Best Estimate is valid Scenario for Openings\",", "\n ", - "\n // Exchange Rate", - "\n 2 when e == Error.ExchangeRateNotFound => $\"Exchange Rate for {s[0]} {s[1]} is not present.\",", - "\n 1 when e == Error.ExchangeRateCurrency => $\"{s[0]} does not have any Exchange Rate defined.\",", + "\n // Exchange Rate", + "\n (nameof(ExchangeRateNotFound), 2) => $\"Exchange Rate for {s[0]} {s[1]} is not present.\",", + "\n (nameof(ExchangeRateCurrency), 1) => $\"{s[0]} does not have any Exchange Rate defined.\",", "\n", - "\n // Data Node State", - "\n 0 when e == Error.ChangeDataNodeState => $\"Data Node State can not change from Inactive state into Active state.\",", - "\n 1 when e == Error.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from Inactive state into Active state.\",", - "\n 3 when e == Error.ChangeDataNodeState => $\"Data Node State for {s[0]} can not change from {s[1]} state into {s[2]} state.\",", - "\n 1 when e == Error.InactiveDataNodeState => $\"Data imported for inactive Data Node {s[0]}.\",", + "\n // Data Node State", + "\n (nameof(ChangeDataNodeState), 0) => $\"Data Node State can not change from Inactive state into Active state.\",", + "\n (nameof(ChangeDataNodeState), 1) => $\"Data Node State for {s[0]} can not change from Inactive state into Active state.\",", + "\n (nameof(ChangeDataNodeState), 3) => $\"Data Node State for {s[0]} can not change from {s[1]} state into {s[2]} state.\",", + "\n (nameof(InactiveDataNodeState), 1) => $\"Data imported for inactive Data Node {s[0]}.\",", "\n", - "\n //Parameters", - "\n 2 when e == Error.ReinsuranceCoverageDataNode => $\"Invalid Reinsurance Coverage parameter does not link a GroupOfReinsuranceContract to a GroupOfInsuranceContract. Provided GroupOfContracts are: {s[0]}, {s[1]}.\",", - "\n 2 when e == Error.DuplicateInterDataNode => $\"Duplicated Inter-DataNode parameter for {s[0]}-{s[1]} is found.\",", - "\n 1 when e == Error.DuplicateSingleDataNode => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",", - "\n 1 when e == Error.MissingSingleDataNodeParameter => $\"Single DataNode Parameter for Data Node {s[0]} is not found.\",", - "\n 1 when e == Error.InvalidDataNode => $\"Data imported for invalid Data Node {s[0]}.\",", - "\n 1 when e == Error.InvalidDataNodeForOpening => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",", - "\n 1 when e == Error.InvalidCashFlowPeriodicity => $\"Invalid CashFlowPeriodicity parameter for Data Node {s[0]}.\",", - "\n 1 when e == Error.MissingInterpolationMethod => $\"Missing InterpolationMethod parameter for Data Node {s[0]}.\",", - "\n 1 when e == Error.InvalidInterpolationMethod => $\"Invalid InterpolationMethod parameter for Data Node {s[0]}.\",", - "\n 1 when e == Error.InvalidEconomicBasisDriver => $\"Invalid EconomicBasisDriver parameter for Data Node {s[0]}.\",", - "\n 1 when e == Error.InvalidReleasePattern => $\"Invalid ReleasePattern parameters for Data Node {s[0]}.\",", + "\n //Parameters", + "\n (nameof(ReinsuranceCoverageDataNode), 2) => $\"Invalid Reinsurance Coverage parameter does not link a GroupOfReinsuranceContract to a GroupOfInsuranceContract. Provided GroupOfContracts are: {s[0]}, {s[1]}.\",", + "\n (nameof(DuplicateInterDataNode), 2) => $\"Duplicated Inter-DataNode parameter for {s[0]}-{s[1]} is found.\",", + "\n (nameof(DuplicateSingleDataNode), 1) => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",", + "\n (nameof(MissingSingleDataNodeParameter), 1) => $\"Single DataNode Parameter for Data Node {s[0]} is not found.\",", + "\n (nameof(InvalidDataNode), 1) => $\"Data imported for invalid Data Node {s[0]}.\",", + "\n (nameof(InvalidDataNodeForOpening), 1) => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",", + "\n (nameof(InvalidCashFlowPeriodicity), 1) => $\"Invalid CashFlowPeriodicity parameter for Data Node {s[0]}.\",", + "\n (nameof(MissingInterpolationMethod), 1) => $\"Missing InterpolationMethod parameter for Data Node {s[0]}.\",", + "\n (nameof(InvalidInterpolationMethod), 1) => $\"Invalid InterpolationMethod parameter for Data Node {s[0]}.\",", + "\n (nameof(InvalidEconomicBasisDriver), 1) => $\"Invalid EconomicBasisDriver parameter for Data Node {s[0]}.\",", + "\n (nameof(InvalidReleasePattern), 1) => $\"Invalid ReleasePattern parameters for Data Node {s[0]}.\",", "\n ", - "\n // Storage", - "\n 1 when e == Error.DataNodeNotFound => $\"DataNode {s[0]} not found.\",", - "\n 1 when e == Error.PartnerNotFound => $\"Partner not found for DataNode {s[0]}.\",", - "\n 1 when e == Error.PeriodNotFound => $\"Invalid Period {s[0]} used during calculation. Allowed values are Current Period (0) and Previous Period (-1).\",", - "\n 1 when e == Error.RatingNotFound => $\"Rating not found for Partner {s[0]}.\",", - "\n 1 when e == Error.CreditDefaultRateNotFound => $\"Credit Default Rate not found for rating {s[0]}.\",", - "\n 1 when e == Error.MissingPremiumAllocation => $\"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 1 when e == Error.ReinsuranceCoverage => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",", - "\n 6 when e == Error.YieldCurveNotFound => $\"Yield Curve not found for DataNode {s[0]}, Currency {s[1]}, Year {s[2]}, Month {s[3]}, Scenario {(s[4] == null ? \"Best Estimate\" : s[4])} and Name {s[5]}.\",", - "\n 2 when e == Error.YieldCurvePeriodNotApplicable => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {s[0]} and Novelty {s[1]}.\",", - "\n 1 when e == Error.EconomicBasisNotFound => $\"EconomicBasis not valid for DataNode {s[0]}.\",", - "\n 1 when e == Error.AccountingVariableTypeNotFound => $\"AccountingVariableType {s[0]} not found.\",", - "\n 1 when e == Error.InvalidGric => $\"Invalid Group of Reinsurance Contract {s[0]} has been requested during calculation.\",", - "\n 1 when e == Error.InvalidGic => $\"Invalid Group of Insurance Contract {s[0]} has been requested during calculation.\",", - "\n 2 when e == Error.ReleasePatternNotFound => $\"Release pattern for Group of Contract {s[0]} and AmountType {s[1]} is not found.\",", - "\n 3 when e == Error.MissingPreviousPeriodData => $\"Data for previous period (Year: {s[0]}, Month: {s[1]}) is missing for Group of contracts: {s[2]}.\",", + "\n // Storage", + "\n (nameof(DataNodeNotFound), 1) => $\"DataNode {s[0]} not found.\",", + "\n (nameof(PartnerNotFound), 1) => $\"Partner not found for DataNode {s[0]}.\",", + "\n (nameof(PeriodNotFound), 1) => $\"Invalid Period {s[0]} used during calculation. Allowed values are Current Period (0) and Previous Period (-1).\",", + "\n (nameof(RatingNotFound), 1) => $\"Rating not found for Partner {s[0]}.\",", + "\n (nameof(CreditDefaultRateNotFound), 1) => $\"Credit Default Rate not found for rating {s[0]}.\",", + "\n (nameof(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 (nameof(ReinsuranceCoverage), 1) => $\"Reinsurance Allocation Rate not found for Group of Insurance Contract {s[0]}.\",", + "\n (nameof(YieldCurveNotFound), 6) => $\"Yield Curve not found for DataNode {s[0]}, Currency {s[1]}, Year {s[2]}, Month {s[3]}, Scenario {(s[4] == null ? \"Best Estimate\" : s[4])} and Name {s[5]}.\",", + "\n (nameof(YieldCurvePeriodNotApplicable), 2) => $\"YieldCurve period NotApplicable not valid for AoC Step with AoC Type {s[0]} and Novelty {s[1]}.\",", + "\n (nameof(EconomicBasisNotFound), 1) => $\"EconomicBasis not valid for DataNode {s[0]}.\",", + "\n (nameof(AccountingVariableTypeNotFound), 1) => $\"AccountingVariableType {s[0]} not found.\",", + "\n (nameof(InvalidGric), 1) => $\"Invalid Group of Reinsurance Contract {s[0]} has been requested during calculation.\",", + "\n (nameof(InvalidGic), 1) => $\"Invalid Group of Insurance Contract {s[0]} has been requested during calculation.\",", + "\n (nameof(ReleasePatternNotFound), 2) => $\"Release pattern for Group of Contract {s[0]} and AmountType {s[1]} is not found.\",", + "\n (nameof(MissingPreviousPeriodData), 3) => $\"Data for previous period (Year: {s[0]}, Month: {s[1]}) is missing for Group of contracts: {s[2]}.\",", "\n", - "\n // Scopes", - "\n 1 when e == Error.NotSupportedAocStepReference => $\"Unsupported reference AoC Step for AoC Type {s[0]}.\",", - "\n 0 when e == Error.MultipleEoP => $\"Closing Balance for both Csm and Lc are computed.\",", + "\n // Scopes", + "\n (nameof(NotSupportedAocStepReference), 1) => $\"Unsupported reference AoC Step for AoC Type {s[0]}.\",", + "\n (nameof(MultipleEoP), 0) => $\"Closing Balance for both Csm and Lc are computed.\",", "\n", - "\n // Data Completeness", - "\n 1 when e == Error.MissingDataAtPosting => $\"Missing imported data for {s[0]} DataNode.\",", - "\n 2 when e == Error.MissingCombinedLiability => $\"Missing Combined Liability AoC Type for DataNode {s[0]} and AmountType {s[1]}.\",", - "\n 1 when e == Error.MissingCoverageUnit => $\"Missing Coverage Unit cash flow for {s[0]} DataNode.\",", + "\n // Data Completeness", + "\n (nameof(MissingDataAtPosting), 1) => $\"Missing imported data for {s[0]} DataNode.\",", + "\n (nameof(MissingCombinedLiability), 2) => $\"Missing Combined Liability AoC Type for DataNode {s[0]} and AmountType {s[1]}.\",", + "\n (nameof(MissingCoverageUnit), 1) => $\"Missing Coverage Unit cash flow for {s[0]} DataNode.\",", "\n", - "\n // Index", - "\n 0 when e == Error.NegativeIndex => $\"Index was out of range. Must be non-negative.\",", + "\n // Index", + "\n (nameof(NegativeIndex), 0) => $\"Index was out of range. Must be non-negative.\", ", "\n", - "\n // Default", - "\n 1 when e == Error.Generic => $\"{s[0]}\", ", - "\n _ => $\"Error not found.\"", - "\n};", - "\n" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "public static string Get (Warning w, params string[] s) => s.Length switch {", - "\n // Import", - "\n 1 when w == Warning.ActiveDataNodeWithCashflowBOPI => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", - "\n 0 when w == Warning.VariablesAlreadyImported => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", - "\n 3 when w == Warning.MandatoryAocStepMissing => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", - "\n 1 when w == Warning.ScenarioReCalculations => $\"The present Best Estimate import makes the result of dependent Scenarios out of date. Hence, the following Scenarios are re-calculated: {s[0]}.\", ", - "\n // Default", - "\n _ when w == Warning.Generic => $\"{s[0]}\",", - "\n _ => $\"Warning not found.\"", - "\n};" + "\n // Default", + "\n (nameof(Generic), 1) => $\"{s[0]}\", ", + "\n _ => $\"Error not found.\"", + "\n };", + "\n}" ], "metadata": {}, "execution_count": 0, From fa9f5f2d3ec95e1b5467cc312f9155414424bcc9 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 17:40:59 +0200 Subject: [PATCH 14/26] application message updated --- ifrs17/Utils/ApplicationMessage.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17/Utils/ApplicationMessage.ipynb b/ifrs17/Utils/ApplicationMessage.ipynb index 64c766ed..8e59018c 100644 --- a/ifrs17/Utils/ApplicationMessage.ipynb +++ b/ifrs17/Utils/ApplicationMessage.ipynb @@ -51,8 +51,8 @@ "\n ApplicationMessage.activity = activity;", "\n }", "\n ", - "\n public static Object Log (Error e, params string[] s) { log.LogError(Get(e,s)); return null; }", - "\n public static Object Log (Warning w, params string[] s) { log.LogWarning(Get(w,s)); return null; }", + "\n public static Object Log (Error e, params string[] s) { log.LogError(e.GetMessage(s)); return null; }", + "\n public static Object Log (Warning w, params string[] s) { log.LogWarning(w.GetMessage(s)); return null; }", "\n ", "\n public static Object Log (ActivityLog activityLog) {", "\n foreach(var error in activityLog.Errors) log.LogError(error.ToString());", From 077f3c11efbadaefcdd6427b73f42ef4a4a8d72a Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 20:45:25 +0200 Subject: [PATCH 15/26] Tests adaptation --- ifrs17/Test/DataNodeParameterTest.ipynb | 26 ++++++++++++------------- ifrs17/Test/QueriesTest.ipynb | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ifrs17/Test/DataNodeParameterTest.ipynb b/ifrs17/Test/DataNodeParameterTest.ipynb index 758bf7e4..ed0263c0 100644 --- a/ifrs17/Test/DataNodeParameterTest.ipynb +++ b/ifrs17/Test/DataNodeParameterTest.ipynb @@ -186,9 +186,9 @@ "\nDataNodeInvalid1,DTR1.1,1", "\nDTR1.1,DataNodeInvalid2,1\";", "\n", - "\nvar errorsBm = new List(){Get(Error.InvalidDataNode, \"DataNodeInvalid0\"),", - "\n Get(Error.InvalidDataNode, \"DataNodeInvalid1\"),", - "\n Get(Error.InvalidDataNode, \"DataNodeInvalid2\")};" + "\nvar errorsBm = new List(){Error.InvalidDataNode.GetMessage(\"DataNodeInvalid0\"),", + "\n Error.InvalidDataNode.GetMessage(\"DataNodeInvalid1\"),", + "\n Error.InvalidDataNode.GetMessage(\"DataNodeInvalid2\")};" ], "metadata": {}, "execution_count": 0, @@ -231,8 +231,8 @@ "\nDTR1.1,DT1.1,1", "\nDT1.1,DTR1.1,1", "\n\";", - "\nvar errorsBm = new List(){Get(Error.DuplicateSingleDataNode, \"DT1.1\"),", - "\n Get(Error.DuplicateInterDataNode, \"DT1.1\",\"DTR1.1\"),};" + "\nvar errorsBm = new List(){Error.DuplicateSingleDataNode.GetMessage(\"DT1.1\"),", + "\n Error.DuplicateInterDataNode.GetMessage(\"DT1.1\",\"DTR1.1\"),};" ], "metadata": {}, "execution_count": 0, @@ -273,7 +273,7 @@ "\nDataNode,LinkedDataNode,ReinsuranceCoverage", "\nDT1.1,DT1.1,1", "\n\";", - "\nvar errorsBm = new List(){Get(Error.ReinsuranceCoverageDataNode, \"DT1.1\",\"DT1.1\")};" + "\nvar errorsBm = new List(){Error.ReinsuranceCoverageDataNode.GetMessage(\"DT1.1\",\"DT1.1\")};" ], "metadata": {}, "execution_count": 0, @@ -319,7 +319,7 @@ "\nDataNode,PremiumAllocation,CashFlowPeriodicity,InterpolationMethod", "\nDT1.1,0.85,Monthly,InvalidEntry", "\n\";", - "\nvar errorsBm = new List(){Get(Error.InvalidInterpolationMethod, \"DT1.1\"),};" + "\nvar errorsBm = new List(){Error.InvalidInterpolationMethod.GetMessage(\"DT1.1\"),};" ], "metadata": {}, "execution_count": 0, @@ -393,7 +393,7 @@ "\nDataNode,PremiumAllocation,CashFlowPeriodicity,InterpolationMethod", "\nDT1.1,0.85,Yearly,,", "\n\";", - "\nvar errorsBm = new List(){Get(Error.InvalidInterpolationMethod, \"DT1.1\"),};" + "\nvar errorsBm = new List(){Error.InvalidInterpolationMethod.GetMessage(\"DT1.1\"),};" ], "metadata": {}, "execution_count": 0, @@ -439,7 +439,7 @@ "\nDataNode,PremiumAllocation,CashFlowPeriodicity,InterpolationMethod", "\nDT1.1,0.85,A,,", "\n\";", - "\nvar errorsBm = new List(){Get(Error.InvalidCashFlowPeriodicity, \"DT1.1\"),};" + "\nvar errorsBm = new List(){Error.InvalidCashFlowPeriodicity.GetMessage(\"DT1.1\"),};" ], "metadata": {}, "execution_count": 0, @@ -477,7 +477,7 @@ "\nDataNode,PremiumAllocation,CashFlowPeriodicity,InterpolationMethod", "\nDT1.1,0.85,,Uniform,", "\n\";", - "\nvar errorsBm = new List(){Get(Error.InvalidCashFlowPeriodicity, \"DT1.1\"),};" + "\nvar errorsBm = new List(){Error.InvalidCashFlowPeriodicity.GetMessage(\"DT1.1\"),};" ], "metadata": {}, "execution_count": 0, @@ -514,7 +514,7 @@ "\nDataNode,PremiumAllocation,CashFlowPeriodicity,InterpolationMethod", "\nDT1.1,0.85,,,", "\n\";", - "\nvar errorsBm = new List(){Get(Error.InvalidCashFlowPeriodicity, \"DT1.1\"),};" + "\nvar errorsBm = new List(){Error.InvalidCashFlowPeriodicity.GetMessage(\"DT1.1\"),};" ], "metadata": {}, "execution_count": 0, @@ -560,7 +560,7 @@ "\nDataNode,PremiumAllocation,EconomicBasisDriver", "\nDT1.1,0.85,A", "\n\";", - "\nvar errorsBm = new List(){Get(Error.InvalidEconomicBasisDriver, \"DT1.1\"),};" + "\nvar errorsBm = new List(){Error.InvalidEconomicBasisDriver.GetMessage(\"DT1.1\"),};" ], "metadata": {}, "execution_count": 0, @@ -687,7 +687,7 @@ "\nDataNode,PremiumAllocation,ReleasePattern0,ReleasePattern1", "\nDT1.1,0.85,InvalidValue0,InvalidValue1", "\n\";", - "\nvar errorsBm = new List(){Get(Error.ParsingInvalidOrScientificValue, \"InvalidValue0\"),Get(Error.ParsingInvalidOrScientificValue, \"InvalidValue1\")};" + "\nvar errorsBm = new List(){Error.ParsingInvalidOrScientificValue.GetMessage(\"InvalidValue0\"), Error.ParsingInvalidOrScientificValue.GetMessage(\"InvalidValue1\")};" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17/Test/QueriesTest.ipynb b/ifrs17/Test/QueriesTest.ipynb index 7232f5c1..0d55a8ec 100644 --- a/ifrs17/Test/QueriesTest.ipynb +++ b/ifrs17/Test/QueriesTest.ipynb @@ -783,7 +783,7 @@ { "cell_type": "code", "source": [ - "var expectedErrorMessage = Get(Error.YieldCurveNotFound, \"DT1.1\", \"EUR\",\"2016\",\"12\",\"Best Estimate\",\"A\");", + "var expectedErrorMessage = Error.YieldCurveNotFound.GetMessage(\"DT1.1\", \"EUR\",\"2016\",\"12\",\"Best Estimate\",\"A\");", "\nvar errorMessage = activity.Errors.First().ToString();", "\nerrorMessage.Contains(expectedErrorMessage).Should().Be(true);" ], @@ -822,7 +822,7 @@ { "cell_type": "code", "source": [ - "var expectedErrorMessage = Get(Error.YieldCurveNotFound, \"DT1.1\", \"EUR\",\"2016\",\"9\",\"Best Estimate\",\"A\");", + "var expectedErrorMessage = Error.YieldCurveNotFound.GetMessage(\"DT1.1\", \"EUR\",\"2016\",\"9\",\"Best Estimate\",\"A\");", "\nvar errorMessage = activity.Errors.First().ToString();", "\nerrorMessage.Contains(expectedErrorMessage).Should().Be(true);" ], From 1177d6e7b45820471a3c242c6bdd0070dfdce5b9 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Thu, 3 Aug 2023 21:02:04 +0200 Subject: [PATCH 16/26] adapt two tests from the template --- ifrs17-template/Test/ScenarioParametersImportTest.ipynb | 2 +- ifrs17-template/Test/ScenarioYieldCurveImportTest.ipynb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17-template/Test/ScenarioParametersImportTest.ipynb b/ifrs17-template/Test/ScenarioParametersImportTest.ipynb index ff8fd02e..0abc120e 100644 --- a/ifrs17-template/Test/ScenarioParametersImportTest.ipynb +++ b/ifrs17-template/Test/ScenarioParametersImportTest.ipynb @@ -260,7 +260,7 @@ { "cell_type": "code", "source": [ - "((log.Warnings.FirstOrDefault()?.ToString().Remove(0,40).Remove(125,2)?? \"\") == Get(Warning.VariablesAlreadyImported)).Should().Be(true);" + "((log.Warnings.FirstOrDefault()?.ToString().Remove(0,40).Remove(125,2)?? \"\") == Warning.VariablesAlreadyImported.GetMessage()).Should().Be(true);" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17-template/Test/ScenarioYieldCurveImportTest.ipynb b/ifrs17-template/Test/ScenarioYieldCurveImportTest.ipynb index 243164fd..cc65f604 100644 --- a/ifrs17-template/Test/ScenarioYieldCurveImportTest.ipynb +++ b/ifrs17-template/Test/ScenarioYieldCurveImportTest.ipynb @@ -290,7 +290,7 @@ { "cell_type": "code", "source": [ - "((log.Warnings.FirstOrDefault()?.ToString().Remove(0,40).Remove(125,2)?? \"\") == Get(Warning.VariablesAlreadyImported)).Should().Be(true);" + "((log.Warnings.FirstOrDefault()?.ToString().Remove(0,40).Remove(125,2)?? \"\") == Warning.VariablesAlreadyImported.GetMessage()).Should().Be(true);" ], "metadata": {}, "execution_count": 0, From 27b9ef13be088e8c219e68a14b7f71ca3b056766 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Fri, 4 Aug 2023 09:08:34 +0200 Subject: [PATCH 17/26] one more test adaptation --- ifrs17-template/Test/MapTemplateAndImportTest.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17-template/Test/MapTemplateAndImportTest.ipynb b/ifrs17-template/Test/MapTemplateAndImportTest.ipynb index d87aad73..11d9254c 100644 --- a/ifrs17-template/Test/MapTemplateAndImportTest.ipynb +++ b/ifrs17-template/Test/MapTemplateAndImportTest.ipynb @@ -508,7 +508,7 @@ "\nawait Workspace.ValidateDataNodeStatesAsync(persistentDataNodeDataByDataNode);", "\nActivity.HasErrors().Should().Be(true);", "\nvar log = Activity.Finish().Errors.First().ToString().Substring(40);", - "\n(log.Substring(0,log.Length-2) == Get(Error.ChangeDataNodeState, \"GIC1\")).Should().Be(true);" + "\n(log.Substring(0,log.Length-2) == Error.ChangeDataNodeState.GetMessage(\"GIC1\")).Should().Be(true);" ], "metadata": {}, "execution_count": 0, From 599dca49865f859d8130316efd738566a4820d63 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Fri, 4 Aug 2023 09:39:52 +0200 Subject: [PATCH 18/26] include GetMessage as an abstract method in the base class --- ifrs17/Constants/Validations.ipynb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 5c20733f..ae467da4 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -62,6 +62,8 @@ "\n protected ValidationBase(string internalValue){", "\n this.InternalValue = internalValue;", "\n }", + "\n", + "\n public abstract string GetMessage(params string[] s);", "\n}" ], "metadata": {}, @@ -84,7 +86,7 @@ "\n public static readonly Warning MandatoryAocStepMissing = new Warning(nameof(MandatoryAocStepMissing));", "\n public static readonly Warning Generic = new Warning(nameof(Generic));", "\n", - "\n public virtual string GetMessage(params string[] s) => (InternalValue, s.Length) switch{", + "\n public override string GetMessage(params string[] s) => (InternalValue, s.Length) switch{", "\n (nameof(ActiveDataNodeWithCashflowBOPI), 1) => $\"Cash flow with AoC Type: {AocTypes.BOP} and Novelty: {Novelties.I} for Group of Contract {s[0]} is not allowed because previous period data are available.\",", "\n (nameof(VariablesAlreadyImported), 0) => $\"The import of the current file does not contain any new data. Hence, no data will be saved or calculations will be performed.\",", "\n (nameof(MandatoryAocStepMissing), 3) => $\"The AoC step ({s[0]}, {s[1]}) is not imported for ({s[2]}).\",", @@ -104,6 +106,8 @@ "cell_type": "code", "source": [ "public class Error : ValidationBase{", + "\n", + "\n protected const string DefaultMessage = \"Error not found.\";", "\n ", "\n protected Error(string internalValue) : base(internalValue) {}", "\n", @@ -195,7 +199,7 @@ "\n // Generic Errors", "\n public static readonly Error Generic = new Error(nameof(Generic)); ", "\n", - "\n public virtual string GetMessage (params string[] s) => (InternalValue, s.Length) switch{", + "\n public override string GetMessage (params string[] s) => (InternalValue, s.Length) switch{", "\n // Import", "\n (nameof(NoMainTab), 0) => $\"No Main tab in the parsed file.\", ", "\n (nameof(IncompleteMainTab), _) => $\"Incomplete Main tab in the parsed file.\",", @@ -285,7 +289,7 @@ "\n", "\n // Default", "\n (nameof(Generic), 1) => $\"{s[0]}\", ", - "\n _ => $\"Error not found.\"", + "\n _ => DefaultMessage", "\n };", "\n}" ], From cde580e6e4fe27a1bd7ead7b5b2c4c227afe44f4 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Fri, 4 Aug 2023 15:17:49 +0200 Subject: [PATCH 19/26] define new error and log the error --- ifrs17/Constants/Validations.ipynb | 3 ++ ifrs17/Import/Importers.ipynb | 56 +----------------------------- 2 files changed, 4 insertions(+), 55 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index ae467da4..6c8dc9a3 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -57,6 +57,7 @@ "cell_type": "code", "source": [ "public abstract class ValidationBase{", + "\n ", "\n public string InternalValue {get; protected set;}", "\n", "\n protected ValidationBase(string internalValue){", @@ -126,6 +127,7 @@ "\n public static readonly Error AocTypePositionNotSupported = new Error(nameof(AocTypePositionNotSupported));", "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(nameof(AocConfigurationOrderNotUnique));", "\n public static readonly Error AccidentYearTypeNotValid = new Error(nameof(AccidentYearTypeNotValid));", + "\n public static readonly Error TableNotFound = new Error(nameof(TableNotFound));", "\n", "\n // Partition Errors", "\n public static readonly Error PartitionNotFound = new Error(nameof(PartitionNotFound));", @@ -215,6 +217,7 @@ "\n (nameof(AocTypePositionNotSupported), 1) => $\"The position of the AoC Type {s[0]} is not supported.\",", "\n (nameof(AocConfigurationOrderNotUnique), _) => $\"Two or more AoC Configurations have the same Order.\",", "\n (nameof(AccidentYearTypeNotValid), 1) => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n (nameof(TableNotFound), 1) => $\"The import file does not contain table {s[0]}\",", "\n", "\n // Partition", "\n (nameof(PartitionNotFound), _) => $\"Partition do not found.\",", diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 029af304..3b19cce9 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -36,19 +36,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "ActivityLog EndActivityIfTableNotFound(IActivityVariable activity, string tableName){", - "\n var activityLog = activity.Finish();", - "\n activityLog.Errors.Add(new ActivityMessageNotification(Get(Error.TableNotFound, tableName)));", - "\n return activityLog;", - "\n}" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "markdown", "source": [ @@ -899,7 +886,6 @@ "\n Activity.Start();", "\n var primaryArgs = GetArgsFromMain(dataSet) with {ImportFormat = ImportFormats.YieldCurve};", "\n primaryArgs.ValidateArgsForPeriodAsync(options.TargetDataSource);", - "\n if(!dataSet.Tables.Contains(ImportFormats.YieldCurve)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat);", "\n if(ApplicationMessage.HasErrors()) return Activity.Finish();", "\n var workspace = Workspace.CreateNew();", "\n workspace.Initialize(x => x.FromSource(options.TargetDataSource)", @@ -1187,7 +1173,6 @@ "\n var storage = new ParsingStorage(args, targetDataSource, workspace);", "\n await storage.InitializeAsync();", "\n if(Activity.HasErrors()) return Activity.Finish();", - "\n if (!dataSet.Tables.Contains(nameof(SingleDataNodeParameter))) return EndActivityIfTableNotFound(Activity, nameof(SingleDataNodeParameter));", "\n var singleDataNode = new List();", "\n var interDataNode = new List<(string,string)>();", "\n", @@ -1378,8 +1363,8 @@ "\n Activity.Start();", "\n var parsingStorage = new ParsingStorage(args, targetDataSource, workspace);", "\n await parsingStorage.InitializeAsync();", + "\n if(!dataSet.Tables.Contains(ImportFormats.Cashflow)) ApplicationMessage.Log(Error.TableNotFound, ImportFormats.Cashflow);", "\n if(Activity.HasErrors()) return Activity.Finish();", - "\n if(!dataSet.Tables.Contains(ImportFormats.Cashflow)) return EndActivityIfTableNotFound(Activity, ImportFormats.Cashflow);", "\n ", "\n var hasAccidentYearColumn = dataSet.Tables[ImportFormats.Cashflow].Columns.Any(x => x.ColumnName == nameof(RawVariable.AccidentYear));", "\n var hasCashFlowPeriodicityColumn = dataSet.Tables[ImportFormats.Cashflow].Columns.Any(x => x.ColumnName == nameof(CashFlowPeriodicity));", @@ -1809,45 +1794,6 @@ "metadata": {}, "execution_count": 0, "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "typeof(ActivityLog).GetMethods().Where((_, i) => i > 10).Select(x => x.Name)" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "var activity = new ActivityLog(new Guid(), new DateTime(), new DateTime(), \"bla\", ActivityLogStatus.Succeeded, ", - "\n new List(), ", - "\n new List(), ", - "\n new List());" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "activity.Errors.Add(new ActivityMessageNotification(\"bla\"))" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] } ] } \ No newline at end of file From a569cba8785774dbd124e52d8dcfb47920d6438e Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Fri, 4 Aug 2023 16:09:55 +0200 Subject: [PATCH 20/26] Move the checks to the format definitions --- ifrs17/Import/Importers.ipynb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 3b19cce9..5be4f5b5 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -1363,7 +1363,6 @@ "\n Activity.Start();", "\n var parsingStorage = new ParsingStorage(args, targetDataSource, workspace);", "\n await parsingStorage.InitializeAsync();", - "\n if(!dataSet.Tables.Contains(ImportFormats.Cashflow)) ApplicationMessage.Log(Error.TableNotFound, ImportFormats.Cashflow);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n ", "\n var hasAccidentYearColumn = dataSet.Tables[ImportFormats.Cashflow].Columns.Any(x => x.ColumnName == nameof(RawVariable.AccidentYear));", @@ -1479,6 +1478,7 @@ "\n if(Activity.HasErrors()) return Activity.Finish();", "\n", "\n var allArgs = await GetAllArgsAsync(primaryArgs, options.TargetDataSource, ImportFormats.Cashflow);", + "\n if(!dataSet.Tables.Contains(primaryArgs.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat);", "\n await DataNodeFactoryAsync(dataSet, ImportFormats.Cashflow, primaryArgs, options.TargetDataSource);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n ", @@ -1604,6 +1604,7 @@ "\n if(Activity.HasErrors()) return Activity.Finish();", "\n", "\n var allArgs = await GetAllArgsAsync(primaryArgs, options.TargetDataSource, ImportFormats.Actual);", + "\n if(!dataSet.Tables.Contains(primaryArgs.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat);", "\n await DataNodeFactoryAsync(dataSet, ImportFormats.Actual, primaryArgs, options.TargetDataSource);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n", @@ -1731,6 +1732,7 @@ "Import.DefineFormat(ImportFormats.SimpleValue, async (options, dataSet) => {", "\n Activity.Start();", "\n var args = await GetArgsAndCommitPartitionAsync(dataSet, options.TargetDataSource) with {ImportFormat = ImportFormats.SimpleValue};", + "\n if(!dataSet.Tables.Contains(args.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, args.ImportFormat);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n await DataNodeFactoryAsync(dataSet, ImportFormats.SimpleValue, args, options.TargetDataSource);", "\n if(Activity.HasErrors()) return Activity.Finish();", From 066f8c1a8390e624e683b010ec183651c4bc172d Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Fri, 4 Aug 2023 16:24:28 +0200 Subject: [PATCH 21/26] openings --- ifrs17/Import/Importers.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 5be4f5b5..6268d172 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -1772,6 +1772,7 @@ "\n Activity.Start();", "\n var primaryArgs = await GetArgsAndCommitPartitionAsync(dataSet, options.TargetDataSource) with {ImportFormat = ImportFormats.Opening};", "\n if(primaryArgs.Scenario != default(string)) ApplicationMessage.Log(Error.NoScenarioOpening);", + "\n if(!dataSet.Tables.Contains(primaryArgs.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat)", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n", "\n var allArgs = await GetAllArgsAsync(primaryArgs, options.TargetDataSource, ImportFormats.Opening);", From 40f7d99cf818828a795f21ceacf31f1379f3aa4f Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Fri, 4 Aug 2023 18:03:53 +0200 Subject: [PATCH 22/26] verbal explanation slightly modified. --- ifrs17/Constants/Validations.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index ae467da4..a265aab6 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -47,7 +47,7 @@ { "cell_type": "markdown", "source": [ - "Comment: Warnings and Errors are designed to act as an effective enumerables, that allow however inheritance in the client projects. However, this stricture is not identical to the enumerables. An important difference is that it does not allow using them directly in the *case* statements. The workaround would be to use *when* in the *case* statment. Also, to avoid assigning identical internal values to two different messages in the case of extending the CE class, it would be recommended to start the numerical values in the inherting classes from 1000. " + "Comment: Warnings and Errors are designed to act as an effective enumerables, that allow however inheritance in the client projects. However, this stricture is not identical to the enumerables. An important difference is that it does not allow using them directly in the *case* statements. The workaround would be to use the InternalValue, which is set to be the string name of the variable itself. " ], "metadata": {}, "execution_count": 0, From 7735eb1098fd28ac196daacbf66b2b29151eafc2 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Fri, 4 Aug 2023 18:09:42 +0200 Subject: [PATCH 23/26] further adjustment to the explanation --- ifrs17/Constants/Validations.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index a265aab6..962524d8 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -47,7 +47,7 @@ { "cell_type": "markdown", "source": [ - "Comment: Warnings and Errors are designed to act as an effective enumerables, that allow however inheritance in the client projects. However, this stricture is not identical to the enumerables. An important difference is that it does not allow using them directly in the *case* statements. The workaround would be to use the InternalValue, which is set to be the string name of the variable itself. " + "Comment: Warnings and Errors are designed to act similar enumerables, that allow however inheritance in the client projects. However, this stricture is not identical to the enumerables. An important difference is that it does not allow using them directly in the *case* statements. The workaround would be to use the InternalValue, which is set to be the string name of the variable itself. Also, we do not keep the numerical value, attached to the enumerable, because we do not use it anywhere. " ], "metadata": {}, "execution_count": 0, From 9505c30df7cf1b5803b5e7b338c8f9bd7f102004 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Mon, 7 Aug 2023 10:22:49 +0200 Subject: [PATCH 24/26] all validations are in place --- ifrs17/Import/Importers.ipynb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 6268d172..b90cc121 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -886,6 +886,7 @@ "\n Activity.Start();", "\n var primaryArgs = GetArgsFromMain(dataSet) with {ImportFormat = ImportFormats.YieldCurve};", "\n primaryArgs.ValidateArgsForPeriodAsync(options.TargetDataSource);", + "\n if (!dataSet.Tables.Contains(primaryArgs.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat);", "\n if(ApplicationMessage.HasErrors()) return Activity.Finish();", "\n var workspace = Workspace.CreateNew();", "\n workspace.Initialize(x => x.FromSource(options.TargetDataSource)", @@ -985,6 +986,7 @@ "\n ", "\n Activity.Start();", "\n var args = await GetArgsAndCommitPartitionAsync(dataSet, targetDataSource);", + "\n", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n ", "\n var storage = new ParsingStorage(args, targetDataSource, workspace);", @@ -1014,7 +1016,6 @@ "\n .ExecuteAsync();", "\n ", "\n var portfolios = await workspace.Query().ToDictionaryAsync(x => x.SystemName);", - "\n", "\n var yieldCurveColumnGroupOfInsuranceContract = dataSet.Tables.Contains(nameof(GroupOfInsuranceContract)) && dataSet.Tables[nameof(GroupOfInsuranceContract)].Columns.Any(x => x.ColumnName == nameof(GroupOfInsuranceContract.YieldCurveName));", "\n var yieldCurveColumnGroupOfReinsuranceContract = dataSet.Tables.Contains(nameof(GroupOfReinsuranceContract)) && dataSet.Tables[nameof(GroupOfReinsuranceContract)].Columns.Any(x => x.ColumnName == nameof(GroupOfReinsuranceContract.YieldCurveName));", "\n", @@ -1117,6 +1118,7 @@ "\n .DisableInitialization());", "\n Activity.Start();", "\n var args = await GetArgsAndCommitPartitionAsync(dataSet, targetDataSource) with {ImportFormat = ImportFormats.DataNodeState};", + "\n if (!dataSet.Tables.Contains(args.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, args.ImportFormat);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n ", "\n var storage = new ParsingStorage(args, targetDataSource, workspace);", @@ -1288,6 +1290,7 @@ "\n Activity.Start();", "\n var primaryArgs = GetArgsFromMain(dataSet) with {ImportFormat = ImportFormats.DataNodeParameter};", "\n primaryArgs.ValidateArgsForPeriodAsync(options.TargetDataSource);", + "\n if (!dataSet.Tables.Contains(primaryArgs.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat);", "\n if(ApplicationMessage.HasErrors()) return Activity.Finish();", "\n var workspace = Workspace.CreateNew();", "\n workspace.Initialize(x => x.FromSource(options.TargetDataSource).DisableInitialization().DisableInitialization());", @@ -1772,7 +1775,7 @@ "\n Activity.Start();", "\n var primaryArgs = await GetArgsAndCommitPartitionAsync(dataSet, options.TargetDataSource) with {ImportFormat = ImportFormats.Opening};", "\n if(primaryArgs.Scenario != default(string)) ApplicationMessage.Log(Error.NoScenarioOpening);", - "\n if(!dataSet.Tables.Contains(primaryArgs.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat)", + "\n if(!dataSet.Tables.Contains(primaryArgs.ImportFormat)) ApplicationMessage.Log(Error.TableNotFound, primaryArgs.ImportFormat);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n", "\n var allArgs = await GetAllArgsAsync(primaryArgs, options.TargetDataSource, ImportFormats.Opening);", @@ -1797,6 +1800,15 @@ "metadata": {}, "execution_count": 0, "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] } ] } \ No newline at end of file From 4bf5d7f1820384bca35de07b4e7a29d74b175204 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Tue, 8 Aug 2023 14:16:28 +0200 Subject: [PATCH 25/26] update the validations file correctly --- ifrs17/Constants/Validations.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index b48ffbee..8b9dcb98 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -117,6 +117,7 @@ "\n public static readonly Error AocTypePositionNotSupported = new Error(nameof(AocTypePositionNotSupported));", "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(nameof(AocConfigurationOrderNotUnique));", "\n public static readonly Error AccidentYearTypeNotValid = new Error(nameof(AccidentYearTypeNotValid));", + "\n public static readonly Error TableNotFound = new Error(nameof(TableNotFound));", "\n", "\n // Partition Errors", "\n public static readonly Error PartitionNotFound = new Error(nameof(PartitionNotFound));", @@ -206,6 +207,7 @@ "\n (nameof(AocTypePositionNotSupported), 1) => $\"The position of the AoC Type {s[0]} is not supported.\",", "\n (nameof(AocConfigurationOrderNotUnique), _) => $\"Two or more AoC Configurations have the same Order.\",", "\n (nameof(AccidentYearTypeNotValid), 1) => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\n (nameof(TableNotFound), 1) => $\"The import file does not contain table {s[0]}\",", "\n", "\n // Partition", "\n (nameof(PartitionNotFound), _) => $\"Partition do not found.\",", From c86b0406f7f649d91f54160c80d4abf8424df839 Mon Sep 17 00:00:00 2001 From: Andrey Katz Date: Tue, 8 Aug 2023 14:28:12 +0200 Subject: [PATCH 26/26] identations --- ifrs17-template/Constants/CalculationEngine.ipynb | 2 +- ifrs17/Constants/Validations.ipynb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ifrs17-template/Constants/CalculationEngine.ipynb b/ifrs17-template/Constants/CalculationEngine.ipynb index 052892cc..b8a11471 100644 --- a/ifrs17-template/Constants/CalculationEngine.ipynb +++ b/ifrs17-template/Constants/CalculationEngine.ipynb @@ -29,4 +29,4 @@ "outputs": [] } ] -} +} \ No newline at end of file diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 8b9dcb98..01788ef5 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -117,7 +117,7 @@ "\n public static readonly Error AocTypePositionNotSupported = new Error(nameof(AocTypePositionNotSupported));", "\n public static readonly Error AocConfigurationOrderNotUnique = new Error(nameof(AocConfigurationOrderNotUnique));", "\n public static readonly Error AccidentYearTypeNotValid = new Error(nameof(AccidentYearTypeNotValid));", - "\n public static readonly Error TableNotFound = new Error(nameof(TableNotFound));", + "\n public static readonly Error TableNotFound = new Error(nameof(TableNotFound));", "\n", "\n // Partition Errors", "\n public static readonly Error PartitionNotFound = new Error(nameof(PartitionNotFound));", @@ -207,7 +207,7 @@ "\n (nameof(AocTypePositionNotSupported), 1) => $\"The position of the AoC Type {s[0]} is not supported.\",", "\n (nameof(AocConfigurationOrderNotUnique), _) => $\"Two or more AoC Configurations have the same Order.\",", "\n (nameof(AccidentYearTypeNotValid), 1) => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",", - "\n (nameof(TableNotFound), 1) => $\"The import file does not contain table {s[0]}\",", + "\n (nameof(TableNotFound), 1) => $\"The import file does not contain table {s[0]}\",", "\n", "\n // Partition", "\n (nameof(PartitionNotFound), _) => $\"Partition do not found.\",",