From 199f1143f8d5eb49a5b69669f45079b46cc02ea4 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Fri, 2 Dec 2022 18:01:37 +0100 Subject: [PATCH 1/8] First commit of potential scope names --- ifrs17/Import/ImportScopeCalculation.ipynb | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index d41923e4..5247b5df 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -2048,6 +2048,42 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "public interface ComputePresentValueScopes: IScope" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputeRiskAdjustmentScopes: IScope" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputeActualScopes: IScope" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputePremiumScopes: IScope" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ From 6a176ecaef4c160e4854c0ec961ae42f3cd3652b Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Mon, 5 Dec 2022 12:16:08 +0100 Subject: [PATCH 2/8] Initial split for ComputeAllScopes --- ifrs17/Import/ImportScopeCalculation.ipynb | 291 +++++++++++++++++---- 1 file changed, 237 insertions(+), 54 deletions(-) diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index 5247b5df..e4a61ce5 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -2051,45 +2051,9 @@ { "cell_type": "code", "source": [ - "public interface ComputePresentValueScopes: IScope" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "public interface ComputeRiskAdjustmentScopes: IScope" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "public interface ComputeActualScopes: IScope" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "public interface ComputePremiumScopes: IScope" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "public interface ComputeAllScopes: IScope //ComputeIfrsVariable", + "public interface ComputePresentValueScopes: IScope", "\n{", - "\n IEnumerable PvLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", + "\n IEnumerable PvLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", "\n EstimateType = x.Identity.EstimateType, ", "\n DataNode = x.Identity.Id.DataNode, ", "\n AocType = x.Identity.Id.AocType, ", @@ -2109,6 +2073,17 @@ "\n Value = x.Value,", "\n Partition = GetStorage().TargetPartition", "\n });", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputeRiskAdjustmentScopes: IScope", + "\n{", "\n IEnumerable RaCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", "\n EstimateType = x.Identity.EstimateType, ", "\n DataNode = x.Identity.Id.DataNode, ", @@ -2129,20 +2104,17 @@ "\n Value = x.Value,", "\n Partition = GetStorage().TargetPartition", "\n });", - "\n private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;", - "\n private IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", - "\n ? GetScope(Identity, o => o.WithContext(EconomicBasis))", - "\n .RepeatOnce()", - "\n .Where(x => Math.Abs(x.Value) >= Precision)", - "\n .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", - "\n DataNode = x.Identity.DataNode,", - "\n AocType = x.Identity.AocType,", - "\n Novelty = x.Identity.Novelty,", - "\n EconomicBasis = x.EconomicBasis,", - "\n Value = x.Value,", - "\n Partition = GetStorage().TargetPartition", - "\n })", - "\n : Enumerable.Empty();", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputeActualScopes: IScope", + "\n{", "\n IEnumerable Actual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", "\n DataNode = x.Identity.Id.DataNode,", "\n AocType = x.Identity.Id.AocType,", @@ -2178,7 +2150,17 @@ "\n Value = x.Value,", "\n Partition = GetStorage().TargetPartition", "\n });", - "\n ", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputeForPremiumScopes: IScope", + "\n{", "\n IEnumerable BeEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", "\n || Identity.IsReinsurance", "\n ? Enumerable.Empty()", @@ -2210,7 +2192,31 @@ "\n AmountType = sc.Identity.AmountType,", "\n Value = sc.Value,", "\n Partition = GetStorage().TargetPartition });", - "\n ", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputeTheRemainingScopes: IScope", + "\n{", + "\n private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;", + "\n private IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", + "\n ? GetScope(Identity, o => o.WithContext(EconomicBasis))", + "\n .RepeatOnce()", + "\n .Where(x => Math.Abs(x.Value) >= Precision)", + "\n .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", + "\n DataNode = x.Identity.DataNode,", + "\n AocType = x.Identity.AocType,", + "\n Novelty = x.Identity.Novelty,", + "\n EconomicBasis = x.EconomicBasis,", + "\n Value = x.Value,", + "\n Partition = GetStorage().TargetPartition", + "\n })", + "\n : Enumerable.Empty();", "\n IEnumerable Csms => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", "\n ? Enumerable.Empty()", "\n : GetScope(Identity).RepeatOnce()", @@ -2254,12 +2260,189 @@ "\n ImportFormats.Opening => AdvanceActual.Concat(OverdueActual).Concat(DeferrableActual)", "\n .Concat(Csms).Concat(Loss),", "\n };", + "\n ", "\n}" ], "metadata": {}, "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "// public interface ComputeAllScopes: IScope //ComputeIfrsVariable", + "\n// {", + "\n// IEnumerable PvLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", + "\n// EstimateType = x.Identity.EstimateType, ", + "\n// DataNode = x.Identity.Id.DataNode, ", + "\n// AocType = x.Identity.Id.AocType, ", + "\n// Novelty = x.Identity.Id.Novelty, ", + "\n// AccidentYear = x.Identity.AccidentYear,", + "\n// AmountType = x.Identity.AmountType,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n// IEnumerable PvCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", + "\n// EstimateType = x.Identity.EstimateType, ", + "\n// DataNode = x.Identity.Id.DataNode, ", + "\n// AocType = x.Identity.Id.AocType, ", + "\n// Novelty = x.Identity.Id.Novelty, ", + "\n// AccidentYear = x.Identity.AccidentYear,", + "\n// AmountType = x.Identity.AmountType,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n// IEnumerable RaCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", + "\n// EstimateType = x.Identity.EstimateType, ", + "\n// DataNode = x.Identity.Id.DataNode, ", + "\n// AocType = x.Identity.Id.AocType, ", + "\n// Novelty = x.Identity.Id.Novelty, ", + "\n// AccidentYear = x.Identity.AccidentYear,", + "\n// AmountType = null,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n// IEnumerable RaLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", + "\n// EstimateType = x.Identity.EstimateType, ", + "\n// DataNode = x.Identity.Id.DataNode, ", + "\n// AocType = x.Identity.Id.AocType, ", + "\n// Novelty = x.Identity.Id.Novelty, ", + "\n// AccidentYear = x.Identity.AccidentYear,", + "\n// AmountType = null,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n// private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;", + "\n// private IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", + "\n// ? GetScope(Identity, o => o.WithContext(EconomicBasis))", + "\n// .RepeatOnce()", + "\n// .Where(x => Math.Abs(x.Value) >= Precision)", + "\n// .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", + "\n// DataNode = x.Identity.DataNode,", + "\n// AocType = x.Identity.AocType,", + "\n// Novelty = x.Identity.Novelty,", + "\n// EconomicBasis = x.EconomicBasis,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// })", + "\n// : Enumerable.Empty();", + "\n// IEnumerable Actual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", + "\n// DataNode = x.Identity.Id.DataNode,", + "\n// AocType = x.Identity.Id.AocType,", + "\n// Novelty = x.Identity.Id.Novelty,", + "\n// AccidentYear = x.Identity.AccidentYear,", + "\n// AmountType = x.Identity.AmountType,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n// IEnumerable AdvanceActual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", + "\n// DataNode = x.Identity.Id.DataNode,", + "\n// AocType = x.Identity.Id.AocType,", + "\n// Novelty = x.Identity.Id.Novelty,", + "\n// AccidentYear = x.Identity.AccidentYear,", + "\n// AmountType = x.Identity.AmountType,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n// IEnumerable OverdueActual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", + "\n// DataNode = x.Identity.Id.DataNode,", + "\n// AocType = x.Identity.Id.AocType,", + "\n// Novelty = x.Identity.Id.Novelty,", + "\n// AccidentYear = x.Identity.AccidentYear,", + "\n// AmountType = x.Identity.AmountType,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n// IEnumerable DeferrableActual => GetScope(Identity).RepeatOnce().Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", + "\n// DataNode = x.Identity.DataNode,", + "\n// AocType = x.Identity.AocType,", + "\n// Novelty = x.Identity.Novelty,", + "\n// AccidentYear = null,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n ", + "\n// IEnumerable BeEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", + "\n// || Identity.IsReinsurance", + "\n// ? Enumerable.Empty()", + "\n// : GetScope(Identity)", + "\n// .ByAmountType", + "\n// .Where(x => Math.Abs(x.Value) >= Precision)", + "\n// .Select(sc => new IfrsVariable{ EstimateType = GetScope(Identity).EstimateType, ", + "\n// DataNode = sc.Identity.Id.DataNode, ", + "\n// AocType = sc.Identity.Id.AocType, ", + "\n// Novelty = sc.Identity.Id.Novelty, ", + "\n// AccidentYear = sc.Identity.AccidentYear,", + "\n// EconomicBasis = sc.EconomicBasis,", + "\n// AmountType = sc.Identity.AmountType,", + "\n// Value = sc.Value,", + "\n// Partition = sc.GetStorage().TargetPartition });", + "\n ", + "\n// IEnumerable ActEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", + "\n// || Identity.IsReinsurance", + "\n// ? Enumerable.Empty()", + "\n// : GetScope(Identity)", + "\n// .ByAmountTypeAndEstimateType", + "\n// .Where(x => Math.Abs(x.Value) >= Precision)", + "\n// .Select(sc => new IfrsVariable{ EstimateType = GetStorage().ExperienceAdjustEstimateTypeMapping[sc.Identity.EstimateType], ", + "\n// DataNode = sc.Identity.Id.DataNode, ", + "\n// AocType = sc.Identity.Id.AocType, ", + "\n// Novelty = sc.Identity.Id.Novelty, ", + "\n// AccidentYear = sc.Identity.AccidentYear,", + "\n// //EconomicBasis = scope.EconomicBasis,", + "\n// AmountType = sc.Identity.AmountType,", + "\n// Value = sc.Value,", + "\n// Partition = GetStorage().TargetPartition });", + "\n ", + "\n// IEnumerable Csms => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", + "\n// ? Enumerable.Empty()", + "\n// : GetScope(Identity).RepeatOnce()", + "\n// .Where(x => Math.Abs(x.Value) >= Precision)", + "\n// .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", + "\n// DataNode = x.Identity.DataNode,", + "\n// AocType = x.Identity.AocType,", + "\n// Novelty = x.Identity.Novelty,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n", + "\n// IEnumerable Loss => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", + "\n// ? Enumerable.Empty()", + "\n// : Identity.IsReinsurance ", + "\n// ? GetScope(Identity).RepeatOnce()", + "\n// .Where(x => Math.Abs(x.Value) >= Precision)", + "\n// .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", + "\n// DataNode = x.Identity.DataNode,", + "\n// AocType = x.Identity.AocType,", + "\n// Novelty = x.Identity.Novelty,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// })", + "\n// : GetScope(Identity).RepeatOnce()", + "\n// .Where(x => Math.Abs(x.Value) >= Precision)", + "\n// .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", + "\n// DataNode = x.Identity.DataNode,", + "\n// AocType = x.Identity.AocType,", + "\n// Novelty = x.Identity.Novelty,", + "\n// Value = x.Value,", + "\n// Partition = GetStorage().TargetPartition", + "\n// });", + "\n ", + "\n// IEnumerable CalculatedIfrsVariables => GetStorage().ImportFormat switch {", + "\n// ImportFormats.Actual => Actual.Concat(AdvanceActual).Concat(OverdueActual).Concat(ActEAForPremium)", + "\n// .Concat(DeferrableActual).Concat(Csms).Concat(Loss),", + "\n// ImportFormats.Cashflow => PvLocked.Concat(PvCurrent).Concat(RaCurrent).Concat(RaLocked)", + "\n// .Concat(amortizationFactor).Concat(BeEAForPremium)", + "\n// .Concat(DeferrableActual).Concat(Csms).Concat(Loss),", + "\n// ImportFormats.Opening => AdvanceActual.Concat(OverdueActual).Concat(DeferrableActual)", + "\n// .Concat(Csms).Concat(Loss),", + "\n// };", + "\n// }" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ From d3afd3b3082f7c4fced9ef086d85c91df283502b Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Mon, 5 Dec 2022 16:23:04 +0100 Subject: [PATCH 3/8] Break ComputeAllScopes into 5 scopes --- ifrs17/Import/ImportScopeCalculation.ipynb | 27 +++++++++++++++------- ifrs17/Import/Importers.ipynb | 6 ++--- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index e4a61ce5..41be1e8f 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -2042,7 +2042,7 @@ "source": [ "## Computing All Scopes", "\n", - "\nSince all the calculations defined in the various scopes are to be performed together, it is useful to introduce the scope ComputeAllScopes below, which given a certain Import Identity and Import Storage, performs all the calculations (defined above) based on the corresponding data:" + "\nSince all the calculations defined in the various scopes are to be performed together, it is useful to introduce the scopes: ComputePresentValueScopes, ComputeRiskAdjustmentScopes, ComputeActualScopes, ComputeForPremiumScopes and the ComputeTheRemainingScopes below, which given a certain Import Identity and Import Storage, performs all the calculations (defined above) based on the corresponding data:" ], "metadata": {}, "execution_count": 0, @@ -2252,13 +2252,24 @@ "\n });", "\n ", "\n IEnumerable CalculatedIfrsVariables => GetStorage().ImportFormat switch {", - "\n ImportFormats.Actual => Actual.Concat(AdvanceActual).Concat(OverdueActual).Concat(ActEAForPremium)", - "\n .Concat(DeferrableActual).Concat(Csms).Concat(Loss),", - "\n ImportFormats.Cashflow => PvLocked.Concat(PvCurrent).Concat(RaCurrent).Concat(RaLocked)", - "\n .Concat(amortizationFactor).Concat(BeEAForPremium)", - "\n .Concat(DeferrableActual).Concat(Csms).Concat(Loss),", - "\n ImportFormats.Opening => AdvanceActual.Concat(OverdueActual).Concat(DeferrableActual)", - "\n .Concat(Csms).Concat(Loss),", + "\n ImportFormats.Actual => GetScope(Identity).Actual.Concat(GetScope(Identity).AdvanceActual)", + "\n .Concat(GetScope(Identity).OverdueActual)", + "\n .Concat(GetScope(Identity).ActEAForPremium)", + "\n .Concat(GetScope(Identity).DeferrableActual)", + "\n .Concat(GetScope(Identity).Csms)", + "\n .Concat(GetScope(Identity).Loss),", + "\n ImportFormats.Cashflow => GetScope(Identity).PvLocked.Concat(GetScope(Identity).PvCurrent)", + "\n .Concat(GetScope(Identity).RaCurrent)", + "\n .Concat(GetScope(Identity).RaLocked)", + "\n .Concat(GetScope(Identity).amortizationFactor)", + "\n .Concat(GetScope(Identity).BeEAForPremium)", + "\n .Concat(GetScope(Identity).DeferrableActual)", + "\n .Concat(GetScope(Identity).Csms)", + "\n .Concat(GetScope(Identity).Loss),", + "\n ImportFormats.Opening => GetScope(Identity).AdvanceActual.Concat(GetScope(Identity).OverdueActual)", + "\n .Concat(GetScope(Identity).DeferrableActual)", + "\n .Concat(GetScope(Identity).Csms)", + "\n .Concat(GetScope(Identity).Loss),", "\n };", "\n ", "\n}" diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 9e10fe50..3869abc7 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -998,7 +998,7 @@ "\n ", "\n var universe = Scopes.ForStorage(storage).ToScope();", "\n var identities = universe.GetScopes(storage.DataNodesByImportScope[ImportScope.Primary]).SelectMany(s => s.Identities);", - "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", + "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", "\n if(Activity.HasErrors()) return Activity.Finish().Merge(parsingLog);", "\n ", "\n await workspace.UpdateAsync(ivs);", @@ -1120,7 +1120,7 @@ "\n", "\n var universe = Scopes.ForStorage(storage).ToScope();", "\n var identities = universe.GetScopes(storage.DataNodesByImportScope[ImportScope.Primary]).SelectMany(s => s.Identities);", - "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", + "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", "\n if(Activity.HasErrors()) return Activity.Finish().Merge(parsingLog);", "\n", "\n await workspace.UpdateAsync(ivs);", @@ -1275,7 +1275,7 @@ "\n ", "\n var universe = Scopes.ForStorage(storage).ToScope();", "\n var identities = universe.GetScopes(storage.DataNodesByImportScope[ImportScope.Primary]).SelectMany(s => s.Identities);", - "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", + "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", "\n if(Activity.HasErrors()) return Activity.Finish().Merge(parsingLog);", "\n", "\n await workspace.UpdateAsync(ivs);", From e8707860694aeadabb5586b8991f4137cf160497 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Mon, 5 Dec 2022 16:44:23 +0100 Subject: [PATCH 4/8] Remove commented off cell --- ifrs17/Import/ImportScopeCalculation.ipynb | 176 --------------------- 1 file changed, 176 deletions(-) diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index 41be1e8f..8b059d3c 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -2278,182 +2278,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "// public interface ComputeAllScopes: IScope //ComputeIfrsVariable", - "\n// {", - "\n// IEnumerable PvLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", - "\n// EstimateType = x.Identity.EstimateType, ", - "\n// DataNode = x.Identity.Id.DataNode, ", - "\n// AocType = x.Identity.Id.AocType, ", - "\n// Novelty = x.Identity.Id.Novelty, ", - "\n// AccidentYear = x.Identity.AccidentYear,", - "\n// AmountType = x.Identity.AmountType,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n// IEnumerable PvCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", - "\n// EstimateType = x.Identity.EstimateType, ", - "\n// DataNode = x.Identity.Id.DataNode, ", - "\n// AocType = x.Identity.Id.AocType, ", - "\n// Novelty = x.Identity.Id.Novelty, ", - "\n// AccidentYear = x.Identity.AccidentYear,", - "\n// AmountType = x.Identity.AmountType,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n// IEnumerable RaCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", - "\n// EstimateType = x.Identity.EstimateType, ", - "\n// DataNode = x.Identity.Id.DataNode, ", - "\n// AocType = x.Identity.Id.AocType, ", - "\n// Novelty = x.Identity.Id.Novelty, ", - "\n// AccidentYear = x.Identity.AccidentYear,", - "\n// AmountType = null,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n// IEnumerable RaLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", - "\n// EstimateType = x.Identity.EstimateType, ", - "\n// DataNode = x.Identity.Id.DataNode, ", - "\n// AocType = x.Identity.Id.AocType, ", - "\n// Novelty = x.Identity.Id.Novelty, ", - "\n// AccidentYear = x.Identity.AccidentYear,", - "\n// AmountType = null,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n// private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;", - "\n// private IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", - "\n// ? GetScope(Identity, o => o.WithContext(EconomicBasis))", - "\n// .RepeatOnce()", - "\n// .Where(x => Math.Abs(x.Value) >= Precision)", - "\n// .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", - "\n// DataNode = x.Identity.DataNode,", - "\n// AocType = x.Identity.AocType,", - "\n// Novelty = x.Identity.Novelty,", - "\n// EconomicBasis = x.EconomicBasis,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// })", - "\n// : Enumerable.Empty();", - "\n// IEnumerable Actual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", - "\n// DataNode = x.Identity.Id.DataNode,", - "\n// AocType = x.Identity.Id.AocType,", - "\n// Novelty = x.Identity.Id.Novelty,", - "\n// AccidentYear = x.Identity.AccidentYear,", - "\n// AmountType = x.Identity.AmountType,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n// IEnumerable AdvanceActual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", - "\n// DataNode = x.Identity.Id.DataNode,", - "\n// AocType = x.Identity.Id.AocType,", - "\n// Novelty = x.Identity.Id.Novelty,", - "\n// AccidentYear = x.Identity.AccidentYear,", - "\n// AmountType = x.Identity.AmountType,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n// IEnumerable OverdueActual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", - "\n// DataNode = x.Identity.Id.DataNode,", - "\n// AocType = x.Identity.Id.AocType,", - "\n// Novelty = x.Identity.Id.Novelty,", - "\n// AccidentYear = x.Identity.AccidentYear,", - "\n// AmountType = x.Identity.AmountType,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n// IEnumerable DeferrableActual => GetScope(Identity).RepeatOnce().Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", - "\n// DataNode = x.Identity.DataNode,", - "\n// AocType = x.Identity.AocType,", - "\n// Novelty = x.Identity.Novelty,", - "\n// AccidentYear = null,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n ", - "\n// IEnumerable BeEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", - "\n// || Identity.IsReinsurance", - "\n// ? Enumerable.Empty()", - "\n// : GetScope(Identity)", - "\n// .ByAmountType", - "\n// .Where(x => Math.Abs(x.Value) >= Precision)", - "\n// .Select(sc => new IfrsVariable{ EstimateType = GetScope(Identity).EstimateType, ", - "\n// DataNode = sc.Identity.Id.DataNode, ", - "\n// AocType = sc.Identity.Id.AocType, ", - "\n// Novelty = sc.Identity.Id.Novelty, ", - "\n// AccidentYear = sc.Identity.AccidentYear,", - "\n// EconomicBasis = sc.EconomicBasis,", - "\n// AmountType = sc.Identity.AmountType,", - "\n// Value = sc.Value,", - "\n// Partition = sc.GetStorage().TargetPartition });", - "\n ", - "\n// IEnumerable ActEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", - "\n// || Identity.IsReinsurance", - "\n// ? Enumerable.Empty()", - "\n// : GetScope(Identity)", - "\n// .ByAmountTypeAndEstimateType", - "\n// .Where(x => Math.Abs(x.Value) >= Precision)", - "\n// .Select(sc => new IfrsVariable{ EstimateType = GetStorage().ExperienceAdjustEstimateTypeMapping[sc.Identity.EstimateType], ", - "\n// DataNode = sc.Identity.Id.DataNode, ", - "\n// AocType = sc.Identity.Id.AocType, ", - "\n// Novelty = sc.Identity.Id.Novelty, ", - "\n// AccidentYear = sc.Identity.AccidentYear,", - "\n// //EconomicBasis = scope.EconomicBasis,", - "\n// AmountType = sc.Identity.AmountType,", - "\n// Value = sc.Value,", - "\n// Partition = GetStorage().TargetPartition });", - "\n ", - "\n// IEnumerable Csms => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", - "\n// ? Enumerable.Empty()", - "\n// : GetScope(Identity).RepeatOnce()", - "\n// .Where(x => Math.Abs(x.Value) >= Precision)", - "\n// .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", - "\n// DataNode = x.Identity.DataNode,", - "\n// AocType = x.Identity.AocType,", - "\n// Novelty = x.Identity.Novelty,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n", - "\n// IEnumerable Loss => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", - "\n// ? Enumerable.Empty()", - "\n// : Identity.IsReinsurance ", - "\n// ? GetScope(Identity).RepeatOnce()", - "\n// .Where(x => Math.Abs(x.Value) >= Precision)", - "\n// .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", - "\n// DataNode = x.Identity.DataNode,", - "\n// AocType = x.Identity.AocType,", - "\n// Novelty = x.Identity.Novelty,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// })", - "\n// : GetScope(Identity).RepeatOnce()", - "\n// .Where(x => Math.Abs(x.Value) >= Precision)", - "\n// .Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", - "\n// DataNode = x.Identity.DataNode,", - "\n// AocType = x.Identity.AocType,", - "\n// Novelty = x.Identity.Novelty,", - "\n// Value = x.Value,", - "\n// Partition = GetStorage().TargetPartition", - "\n// });", - "\n ", - "\n// IEnumerable CalculatedIfrsVariables => GetStorage().ImportFormat switch {", - "\n// ImportFormats.Actual => Actual.Concat(AdvanceActual).Concat(OverdueActual).Concat(ActEAForPremium)", - "\n// .Concat(DeferrableActual).Concat(Csms).Concat(Loss),", - "\n// ImportFormats.Cashflow => PvLocked.Concat(PvCurrent).Concat(RaCurrent).Concat(RaLocked)", - "\n// .Concat(amortizationFactor).Concat(BeEAForPremium)", - "\n// .Concat(DeferrableActual).Concat(Csms).Concat(Loss),", - "\n// ImportFormats.Opening => AdvanceActual.Concat(OverdueActual).Concat(DeferrableActual)", - "\n// .Concat(Csms).Concat(Loss),", - "\n// };", - "\n// }" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "code", "source": [ From 10287784e47202dd46cd325a1147f5b048066d74 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Wed, 7 Dec 2022 12:53:44 +0100 Subject: [PATCH 5/8] Create scopes for Actuals, Cashflows and Openings --- ifrs17/Import/ImportScopeCalculation.ipynb | 103 ++++++++++++++------- ifrs17/Import/Importers.ipynb | 6 +- 2 files changed, 70 insertions(+), 39 deletions(-) diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index 8b059d3c..f5c8afa9 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -2051,7 +2051,7 @@ { "cell_type": "code", "source": [ - "public interface ComputePresentValueScopes: IScope", + "public interface PvToIfrsVar: IScope", "\n{", "\n IEnumerable PvLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", "\n EstimateType = x.Identity.EstimateType, ", @@ -2082,7 +2082,7 @@ { "cell_type": "code", "source": [ - "public interface ComputeRiskAdjustmentScopes: IScope", + "public interface RaToIfrsVar: IScope", "\n{", "\n IEnumerable RaCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", "\n EstimateType = x.Identity.EstimateType, ", @@ -2113,7 +2113,7 @@ { "cell_type": "code", "source": [ - "public interface ComputeActualScopes: IScope", + "public interface ActualToIfrsVar: IScope", "\n{", "\n IEnumerable Actual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", "\n DataNode = x.Identity.Id.DataNode,", @@ -2142,14 +2142,25 @@ "\n Value = x.Value,", "\n Partition = GetStorage().TargetPartition", "\n });", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface DaToIfrsVar: IScope", + "\n{", "\n IEnumerable DeferrableActual => GetScope(Identity).RepeatOnce().Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", - "\n DataNode = x.Identity.DataNode,", - "\n AocType = x.Identity.AocType,", - "\n Novelty = x.Identity.Novelty,", - "\n AccidentYear = null,", - "\n Value = x.Value,", - "\n Partition = GetStorage().TargetPartition", - "\n });", + "\n DataNode = x.Identity.DataNode,", + "\n AocType = x.Identity.AocType,", + "\n Novelty = x.Identity.Novelty,", + "\n AccidentYear = null,", + "\n Value = x.Value,", + "\n Partition = GetStorage().TargetPartition", + "\n });", "\n}" ], "metadata": {}, @@ -2159,7 +2170,7 @@ { "cell_type": "code", "source": [ - "public interface ComputeForPremiumScopes: IScope", + "public interface EaForPremiumToIfrsVar: IScope", "\n{", "\n IEnumerable BeEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", "\n || Identity.IsReinsurance", @@ -2201,10 +2212,10 @@ { "cell_type": "code", "source": [ - "public interface ComputeTheRemainingScopes: IScope", + "public interface TmToIfrsVar: IScope", "\n{", "\n private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;", - "\n private IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", + "\n protected IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", "\n ? GetScope(Identity, o => o.WithContext(EconomicBasis))", "\n .RepeatOnce()", "\n .Where(x => Math.Abs(x.Value) >= Precision)", @@ -2250,28 +2261,6 @@ "\n Value = x.Value,", "\n Partition = GetStorage().TargetPartition", "\n });", - "\n ", - "\n IEnumerable CalculatedIfrsVariables => GetStorage().ImportFormat switch {", - "\n ImportFormats.Actual => GetScope(Identity).Actual.Concat(GetScope(Identity).AdvanceActual)", - "\n .Concat(GetScope(Identity).OverdueActual)", - "\n .Concat(GetScope(Identity).ActEAForPremium)", - "\n .Concat(GetScope(Identity).DeferrableActual)", - "\n .Concat(GetScope(Identity).Csms)", - "\n .Concat(GetScope(Identity).Loss),", - "\n ImportFormats.Cashflow => GetScope(Identity).PvLocked.Concat(GetScope(Identity).PvCurrent)", - "\n .Concat(GetScope(Identity).RaCurrent)", - "\n .Concat(GetScope(Identity).RaLocked)", - "\n .Concat(GetScope(Identity).amortizationFactor)", - "\n .Concat(GetScope(Identity).BeEAForPremium)", - "\n .Concat(GetScope(Identity).DeferrableActual)", - "\n .Concat(GetScope(Identity).Csms)", - "\n .Concat(GetScope(Identity).Loss),", - "\n ImportFormats.Opening => GetScope(Identity).AdvanceActual.Concat(GetScope(Identity).OverdueActual)", - "\n .Concat(GetScope(Identity).DeferrableActual)", - "\n .Concat(GetScope(Identity).Csms)", - "\n .Concat(GetScope(Identity).Loss),", - "\n };", - "\n ", "\n}" ], "metadata": {}, @@ -2281,7 +2270,49 @@ { "cell_type": "code", "source": [ - "" + "public interface ComputeIfrsVarsActuals : ActualToIfrsVar, DaToIfrsVar, EaForPremiumToIfrsVar, TmToIfrsVar", + "\n{", + "\n IEnumerable CalculatedIfrsVariables => Actual.Concat(AdvanceActual)", + "\n .Concat(OverdueActual)", + "\n .Concat(ActEAForPremium)", + "\n .Concat(DeferrableActual)", + "\n .Concat(Csms)", + "\n .Concat(Loss);", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputeIfrsVarsCashflows : PvToIfrsVar, RaToIfrsVar, DaToIfrsVar, EaForPremiumToIfrsVar, TmToIfrsVar", + "\n{", + "\n IEnumerable CalculatedIfrsVariables => PvLocked.Concat(PvCurrent)", + "\n .Concat(RaCurrent)", + "\n .Concat(RaLocked)", + "\n .Concat(amortizationFactor)", + "\n .Concat(BeEAForPremium)", + "\n .Concat(DeferrableActual)", + "\n .Concat(Csms)", + "\n .Concat(Loss);", + "\n}" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public interface ComputeIfrsVarsOpenings : ActualToIfrsVar, DaToIfrsVar, TmToIfrsVar", + "\n{", + "\n IEnumerable CalculatedIfrsVariables => AdvanceActual.Concat(OverdueActual)", + "\n .Concat(DeferrableActual)", + "\n .Concat(Csms)", + "\n .Concat(Loss);", + "\n} " ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 3869abc7..3ec5a6aa 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -998,7 +998,7 @@ "\n ", "\n var universe = Scopes.ForStorage(storage).ToScope();", "\n var identities = universe.GetScopes(storage.DataNodesByImportScope[ImportScope.Primary]).SelectMany(s => s.Identities);", - "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", + "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", "\n if(Activity.HasErrors()) return Activity.Finish().Merge(parsingLog);", "\n ", "\n await workspace.UpdateAsync(ivs);", @@ -1120,7 +1120,7 @@ "\n", "\n var universe = Scopes.ForStorage(storage).ToScope();", "\n var identities = universe.GetScopes(storage.DataNodesByImportScope[ImportScope.Primary]).SelectMany(s => s.Identities);", - "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", + "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", "\n if(Activity.HasErrors()) return Activity.Finish().Merge(parsingLog);", "\n", "\n await workspace.UpdateAsync(ivs);", @@ -1275,7 +1275,7 @@ "\n ", "\n var universe = Scopes.ForStorage(storage).ToScope();", "\n var identities = universe.GetScopes(storage.DataNodesByImportScope[ImportScope.Primary]).SelectMany(s => s.Identities);", - "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", + "\n var ivs = universe.GetScopes(identities).SelectMany(x => x.CalculatedIfrsVariables);", "\n if(Activity.HasErrors()) return Activity.Finish().Merge(parsingLog);", "\n", "\n await workspace.UpdateAsync(ivs);", From feab199e3a6652ad42e628beb77c90c8be06daa0 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Wed, 7 Dec 2022 16:30:02 +0100 Subject: [PATCH 6/8] Implement feedback --- ifrs17/Import/ImportScopeCalculation.ipynb | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index f5c8afa9..ae3387bb 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -2042,7 +2042,7 @@ "source": [ "## Computing All Scopes", "\n", - "\nSince all the calculations defined in the various scopes are to be performed together, it is useful to introduce the scopes: ComputePresentValueScopes, ComputeRiskAdjustmentScopes, ComputeActualScopes, ComputeForPremiumScopes and the ComputeTheRemainingScopes below, which given a certain Import Identity and Import Storage, performs all the calculations (defined above) based on the corresponding data:" + "\nSince all the calculations defined in the various scopes are to be performed together, it is useful to introduce the scopes: ComputeIfrsVarsActuals, ComputeIfrsVarsCashflows and the ComputeIfrsVarsOpenings below, which given a certain Import Identity and Import Storage, performs all the calculations (defined above) based on the corresponding data:" ], "metadata": {}, "execution_count": 0, @@ -2051,7 +2051,7 @@ { "cell_type": "code", "source": [ - "public interface PvToIfrsVar: IScope", + "public interface PvToIfrsVariable: IScope", "\n{", "\n IEnumerable PvLocked => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", "\n EstimateType = x.Identity.EstimateType, ", @@ -2082,7 +2082,7 @@ { "cell_type": "code", "source": [ - "public interface RaToIfrsVar: IScope", + "public interface RaToIfrsVariable: IScope", "\n{", "\n IEnumerable RaCurrent => GetScope(Identity).PresentValues.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EconomicBasis = x.EconomicBasis, ", "\n EstimateType = x.Identity.EstimateType, ", @@ -2113,7 +2113,7 @@ { "cell_type": "code", "source": [ - "public interface ActualToIfrsVar: IScope", + "public interface ActualToIfrsVariable: IScope", "\n{", "\n IEnumerable Actual => GetScope(Identity).Actuals.Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.Identity.EstimateType,", "\n DataNode = x.Identity.Id.DataNode,", @@ -2151,7 +2151,7 @@ { "cell_type": "code", "source": [ - "public interface DaToIfrsVar: IScope", + "public interface DeferrableToIfrsVariable: IScope", "\n{", "\n IEnumerable DeferrableActual => GetScope(Identity).RepeatOnce().Where(x => Math.Abs(x.Value) >= Precision).Select(x => new IfrsVariable{ EstimateType = x.EstimateType,", "\n DataNode = x.Identity.DataNode,", @@ -2170,7 +2170,7 @@ { "cell_type": "code", "source": [ - "public interface EaForPremiumToIfrsVar: IScope", + "public interface EaForPremiumToIfrsVariable: IScope", "\n{", "\n IEnumerable BeEAForPremium => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", "\n || Identity.IsReinsurance", @@ -2212,7 +2212,7 @@ { "cell_type": "code", "source": [ - "public interface TmToIfrsVar: IScope", + "public interface TmToIfrsVariable: IScope", "\n{", "\n private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;", "\n protected IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", @@ -2270,7 +2270,7 @@ { "cell_type": "code", "source": [ - "public interface ComputeIfrsVarsActuals : ActualToIfrsVar, DaToIfrsVar, EaForPremiumToIfrsVar, TmToIfrsVar", + "public interface ComputeIfrsVarsActuals : ActualToIfrsVariable, DeferrableToIfrsVariable, EaForPremiumToIfrsVariable, TmToIfrsVariable", "\n{", "\n IEnumerable CalculatedIfrsVariables => Actual.Concat(AdvanceActual)", "\n .Concat(OverdueActual)", @@ -2287,16 +2287,16 @@ { "cell_type": "code", "source": [ - "public interface ComputeIfrsVarsCashflows : PvToIfrsVar, RaToIfrsVar, DaToIfrsVar, EaForPremiumToIfrsVar, TmToIfrsVar", + "public interface ComputeIfrsVarsCashflows : PvToIfrsVariable, RaToIfrsVariable, DeferrableToIfrsVariable, EaForPremiumToIfrsVariable, TmToIfrsVariable", "\n{", "\n IEnumerable CalculatedIfrsVariables => PvLocked.Concat(PvCurrent)", - "\n .Concat(RaCurrent)", - "\n .Concat(RaLocked)", - "\n .Concat(amortizationFactor)", - "\n .Concat(BeEAForPremium)", - "\n .Concat(DeferrableActual)", - "\n .Concat(Csms)", - "\n .Concat(Loss);", + "\n .Concat(RaCurrent)", + "\n .Concat(RaLocked)", + "\n .Concat(amortizationFactor)", + "\n .Concat(BeEAForPremium)", + "\n .Concat(DeferrableActual)", + "\n .Concat(Csms)", + "\n .Concat(Loss);", "\n}" ], "metadata": {}, @@ -2306,7 +2306,7 @@ { "cell_type": "code", "source": [ - "public interface ComputeIfrsVarsOpenings : ActualToIfrsVar, DaToIfrsVar, TmToIfrsVar", + "public interface ComputeIfrsVarsOpenings : ActualToIfrsVariable, DeferrableToIfrsVariable, TmToIfrsVariable", "\n{", "\n IEnumerable CalculatedIfrsVariables => AdvanceActual.Concat(OverdueActual)", "\n .Concat(DeferrableActual)", From 3d3d4dfd7a878b1f1c8632f31279e8335ccd7459 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Thu, 8 Dec 2022 16:28:11 +0100 Subject: [PATCH 7/8] Change modifier of amortizationFactor to public --- ifrs17/Import/ImportScopeCalculation.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index ae3387bb..7bf6e4f0 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -2215,7 +2215,7 @@ "public interface TmToIfrsVariable: IScope", "\n{", "\n private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;", - "\n protected IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", + "\n IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", "\n ? GetScope(Identity, o => o.WithContext(EconomicBasis))", "\n .RepeatOnce()", "\n .Where(x => Math.Abs(x.Value) >= Precision)", From 7952d5f08682bd9f4223ea22923720ab1f0185f8 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Thu, 8 Dec 2022 16:35:01 +0100 Subject: [PATCH 8/8] Implement feedbackx2 --- ifrs17/Import/ImportScopeCalculation.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index 7bf6e4f0..956e823e 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -2042,7 +2042,7 @@ "source": [ "## Computing All Scopes", "\n", - "\nSince all the calculations defined in the various scopes are to be performed together, it is useful to introduce the scopes: ComputeIfrsVarsActuals, ComputeIfrsVarsCashflows and the ComputeIfrsVarsOpenings below, which given a certain Import Identity and Import Storage, performs all the calculations (defined above) based on the corresponding data:" + "\nSince all the calculations defined in the various scopes are to be performed together, it is useful to introduce the scopes: ComputeIfrsVarsActuals, ComputeIfrsVarsCashflows and the ComputeIfrsVarsOpenings below, which given a certain Import Format and Import Storage, performs all the calculations (defined above) based on the corresponding data:" ], "metadata": {}, "execution_count": 0, @@ -2215,7 +2215,7 @@ "public interface TmToIfrsVariable: IScope", "\n{", "\n private string EconomicBasis => Identity.ValuationApproach == ValuationApproaches.VFA ? EconomicBases.C : EconomicBases.L;", - "\n IEnumerable amortizationFactor => Identity.AocType == AocTypes.AM", + "\n IEnumerable AmortizationFactor => Identity.AocType == AocTypes.AM", "\n ? GetScope(Identity, o => o.WithContext(EconomicBasis))", "\n .RepeatOnce()", "\n .Where(x => Math.Abs(x.Value) >= Precision)",