Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ ReportingNode,Year,Month
CH,2020,12

@@SingleDataNodeParameter
DataNode,PremiumAllocation
DT1.1,0.9
DataNodeInvalid0,0.85
DataNode,PremiumAllocation,CashFlowPeriodicity,InterpolationMethod
DT1.1,0.9,Monthly,Uniform
DataNodeInvalid0,0.85,Monthly,Uniform

@@InterDataNodeParameter
DataNode,LinkedDataNode,ReinsuranceCoverage
Expand Down
17 changes: 17 additions & 0 deletions ifrs17-template/Test/Data/DataNodeParameter_InvalidParameters.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@@Main
ReportingNode,Year,Month
CH,2020,12

@@SingleDataNodeParameter
DataNode,PremiumAllocation,CashFlowPeriodicity,InterpolationMethod
DT1.1,0.9,Monthly,InvalidEntry
DT1.2,0.85,InvalidEntry,Uniform
DT1.3,0.9,,Uniform
DT1.4,0.85,Monthly,
DT1.5,0.9,Yearly,

@@InterDataNodeParameter
DataNode,LinkedDataNode,ReinsuranceCoverage
DTR1.1,DT1.1,1
DTR1.2,DT1.2,1
DTR1.3,DT1.3,1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@@Main
ReportingNode,Year,Month
CH,2020,12

@@SingleDataNodeParameter
DataNode,PremiumAllocation
DT1.1,0.9
DT1.2,0.85
DT1.3,0.9
DT1.4,0.85

@@InterDataNodeParameter
DataNode,LinkedDataNode,ReinsuranceCoverage
DTR1.1,DT1.1,1
DTR1.2,DT1.2,1
DTR1.3,DT1.3,1
90 changes: 88 additions & 2 deletions ifrs17-template/Test/MapTemplateAndImportTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,42 @@
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Test Data Node Parameter"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var singleParam = (await DataSource.Query<SingleDataNodeParameter>().Where(x => x.DataNode == \"DT1.1\").ToArrayAsync()).Single();"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"singleParam.CashFlowPeriodicity.Should().Be((CashFlowPeriodicity)default);"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"singleParam.InterpolationMethod.Should().Be((InterpolationMethod)default);"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
Expand Down Expand Up @@ -397,7 +433,10 @@
"\n nameof(PartitionByReportingNodeAndPeriod.Month),",
"\n nameof(PartitionByReportingNodeAndPeriod.Scenario)};",
"\nvar singleDataNodeParamCols = new[]{nameof(DataNode),",
"\n nameof(SingleDataNodeParameter.PremiumAllocation)};",
"\n nameof(SingleDataNodeParameter.PremiumAllocation),",
"\n nameof(SingleDataNodeParameter.CashFlowPeriodicity),",
"\n nameof(SingleDataNodeParameter.InterpolationMethod),",
"\n };",
"\nvar interDataNodeParamCols = new[]{nameof(DataNodeParameter.DataNode),",
"\n nameof(InterDataNodeParameter.LinkedDataNode),",
"\n nameof(InterDataNodeParameter.ReinsuranceCoverage)};",
Expand Down Expand Up @@ -546,6 +585,7 @@
"\n{",
"\n Activity.Start();",
"\n var log = await Import.FromFile(inputFileName).WithFormat(ImportFormats.DataNodeParameter).WithTarget(workspace).ExecuteAsync();",
"\n log.Errors.Count().Should().Be(errorBms.Count());",
"\n errorBms.Intersect(log.Errors.Select(x => x.ToString().Substring(0,x.ToString().Length-2).Substring(40)).ToArray()).Count().Should().Be(errorBms.Count());",
"\n return Activity.Finish();",
"\n}"
Expand Down Expand Up @@ -616,7 +656,53 @@
"source": [
"var inputFileName = \"Data/DataNodeParameter_InvalidReinsCov.csv\";",
"\nvar errorsBm = new List<string>(){Get(Error.ReinsuranceCoverageDataNode, \"DT1.1\",\"DT1.1\")};",
"\nvar activity = await CheckErrors(inputFileName, errorsBm, ws3);",
"\nvar activity = await CheckErrors(inputFileName, errorsBm, ws3);"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var ws4 = Workspace.CreateNew();",
"\nws4.InitializeFrom(DataSource);"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var inputFileName = \"Data/DataNodeParameter_MissingNonRequiredColumns.csv\";",
"\nvar errorsBm = new List<string>(){};",
"\nvar activity = await CheckErrors(inputFileName, errorsBm, ws4);",
"\nactivity"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var ws5 = Workspace.CreateNew();",
"\nws5.InitializeFrom(DataSource);"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"var inputFileName = \"Data/DataNodeParameter_InvalidParameters.csv\";",
"\nvar errorsBm = new List<string>(){Get(Error.InvalidInterpolationMethod, \"DT1.1\"), ",
"\n Get(Error.InvalidCashFlowPeriodicity, \"DT1.2\"),",
"\n Get(Error.InvalidCashFlowPeriodicity, \"DT1.3\"),",
"\n Get(Error.InvalidInterpolationMethod, \"DT1.5\")};",
"\nvar activity = await CheckErrors(inputFileName, errorsBm, ws5);",
"\nactivity"
],
"metadata": {},
Expand Down
36 changes: 36 additions & 0 deletions ifrs17/Constants/Enums.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,42 @@
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## CashFlowPeriodicity"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"public enum CashFlowPeriodicity { Monthly, Quarterly, Yearly }"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## Interpolation Method"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"public enum InterpolationMethod { NotApplicable, Uniform /*, Linear, Start, End, Custom*/ }"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
Expand Down
4 changes: 3 additions & 1 deletion ifrs17/Constants/Validations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"\n // Data Note State",
"\n ChangeDataNodeState, InactiveDataNodeState,",
"\n // Parameters",
"\n ReinsuranceCoverageDataNode, DuplicateInterDataNode, DuplicateSingleDataNode, InvalidDataNode, InvalidDataNodeForOpening,",
"\n ReinsuranceCoverageDataNode, DuplicateInterDataNode, DuplicateSingleDataNode, InvalidDataNode, InvalidDataNodeForOpening, InvalidCashFlowPeriodicity, InvalidInterpolationMethod,",
"\n // Storage",
"\n DataNodeNotFound, PartnerNotFound, RatingNotFound, CreditDefaultRateNotFound, MissingPremiumAllocation, ReinsuranceCoverage, ",
"\n YieldCurveNotFound, YieldCurvePeriodNotApplicable, EconomicBasisNotFound, AccountingVariableTypeNotFound,",
Expand Down Expand Up @@ -151,6 +151,8 @@
"\n (Error.DuplicateSingleDataNode , 1) => $\"Duplicated Single-DataNode parameter for {s[0]} is found.\",",
"\n (Error.InvalidDataNode , 1) => $\"Data imported for invalid Data Node {s[0]}.\",",
"\n (Error.InvalidDataNodeForOpening , 1) => $\"Data imported for invalid Data Node or for a Data Node after its inception year {s[0]}.\",",
"\n (Error.InvalidCashFlowPeriodicity, 1) => $\"Single Data Node Parameter CashFlowPeriodicity for Data Node {s[0]} is invalid.\",",
"\n (Error.InvalidInterpolationMethod, 1) => $\"Single Data Node Parameter InterpolationMethod for Data Node {s[0]} is invalid.\",",
"\n // Storage",
"\n (Error.DataNodeNotFound , 1) => $\"DataNode {s[0]} not found.\",",
"\n (Error.PartnerNotFound , 1) => $\"Partner not found for DataNode {s[0]}.\",",
Expand Down
17 changes: 17 additions & 0 deletions ifrs17/DataModel/DataStructure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,8 @@
"\n",
"\nData Node Parameters are used to keep track of other parameters pertaining to each Data Node, and their movements in time (year and month).",
"\n<br> <code>PremiumAllocation</code> : defines the weight of Premium to be included in the Experience Adjustement AoC Type of the Technical Margin and is valid only for Group of Insurance Contract with LiabilityType : Liability for Remaining Coverage.",
"\n<br> <code>CashFlowPeriodicity</code> : defines the periodicity of the provided cash flows, it is not a mandatory input. Supported values can be found [here](../Constants/Enums#cashflowperiodicity). When the column *CashFlowPeriodicity* is missing from the input file it is assumed a monthly periodicity (default value). When the *CashFlowPeriodicity* column is present, a valid value must be entered. ",
"\n<br> <code>InterpolationMethod</code> : defines the interpolation method to be applied to interpolate the cash flow to the monthly granularity, it is not a mandatory input. Supported values can be found [here](../Constants/Enums#interpolation-method). When the *InterpolationMethod* is not present in the input file or the *CashFlowPeriodicity* has the default value, then the default value for the *InterpolationMethod* is applied. The default value is Not Applicable. ",
"\n<br> <code>ReinsuranceCoverage</code> : defines the weight of the underlying gross business to be considered in the computation of the allocation of the Technical Margin in a Reinsurance case. In other words, it represents the percentage to which claims in the underlying GICs are expected to be reinboursed by the Reinsurance Contracts belonging to the GRIC. For proportional contracts, this factor is given by the cession while for other contracts it should be estimated. ",
"\n",
"\nThe latest Data Node Parameters available in the system with Year and Month earlier or equal to Year and Month of the closing period will be used as the current value during calculation."
Expand Down Expand Up @@ -1576,6 +1578,7 @@
"\n [Required]",
"\n [IdentityProperty]",
"\n [Dimension(typeof(GroupOfContract))]",
"\n [Display(Order = 1)]",
"\n public string DataNode { get; init; }",
"\n",
"\n [IdentityProperty]",
Expand All @@ -1593,16 +1596,30 @@
"public record SingleDataNodeParameter : DataNodeParameter {",
"\n [DefaultValue(DefaultPremiumExperienceAdjustmentFactor)]",
"\n [Range(0, 1, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
"\n [Display(Order = 20)]",
"\n public double PremiumAllocation { get; init; } = DefaultPremiumExperienceAdjustmentFactor;",
"\n",
"\n [IdentityProperty]",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these id properties? It should not be, imo, as they are the value of the parameter. Same for InterpolationMethod

"\n [Dimension(typeof(CashFlowPeriodicity))]",
"\n [Display(Order = 30)]",
"\n public CashFlowPeriodicity CashFlowPeriodicity { get; init; }",
"\n ",
"\n [IdentityProperty]",
"\n [Dimension(typeof(InterpolationMethod))]",
"\n [Display(Order = 40)]",
"\n public InterpolationMethod InterpolationMethod { get; init; }",
"\n ",
"\n}",
"\n",
"\npublic record InterDataNodeParameter : DataNodeParameter {",
"\n [Required]",
"\n [IdentityProperty]",
"\n [Dimension(typeof(GroupOfContract))]",
"\n [Display(Order = 10)]",
"\n public string LinkedDataNode { get; init; }",
"\n ",
"\n [Range(0, 1, ErrorMessage = \"Value for {0} must be between {1} and {2}.\")]",
"\n [Display(Order = 20)]",
"\n public double ReinsuranceCoverage { get; init; }",
"\n}"
],
Expand Down
Loading