Skip to content
Closed
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
2 changes: 2 additions & 0 deletions ifrs17/DataModel/DataStructure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,8 @@
"public record IfrsVariable : BaseDataRecord",
"\n{",
"\n public double Value { get; init; }",
"\n public double Value1 { get; init; }",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I was wondering why we did this here, also in V7. The RawVar have double[], the Report Variable have Value and Projection as properties. Isn't there a way we can do that without hardcoding the number of projections?

"\n",
"\n ",
"\n [NotVisible] ",
"\n [Dimension(typeof(EstimateType))]",
Expand Down
48 changes: 40 additions & 8 deletions ifrs17/Import/ImportScopeCalculation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,8 @@
"source": [
"public interface IWithGetValueFromValues : IScope<(ImportIdentity Id, string AmountType, string EstimateType, int? AccidentYear), ImportStorage>",
"\n{",
"\n private int shift => GetStorage().GetShift(0);//Identity.Id.ProjectionPeriod",
"\n private int timeStep => GetStorage().GetTimeStep(0);//Identity.Id.ProjectionPeriod",
"\n private int shift => GetStorage().GetShift(Identity.Id.ProjectionPeriod);//Identity.Id.ProjectionPeriod",
"\n private int timeStep => GetStorage().GetTimeStep(Identity.Id.ProjectionPeriod);//Identity.Id.ProjectionPeriod",
"\n ",
"\n public double GetValueFromValues(double[] Values)",
"\n {",
Expand Down Expand Up @@ -1193,8 +1193,8 @@
"\n s.WithApplicability<AmfFromIfrsVariable>(x => x.GetStorage().ImportFormat != ImportFormats.Cashflow",
"\n || x.GetStorage().IsSecondaryScope(x.Identity.DataNode)));",
"\n",
"\n private int shift => GetStorage().GetShift(0);//Identity.ProjectionPeriod",
"\n private int timeStep => GetStorage().GetTimeStep(0);//Identity.ProjectionPeriod",
"\n private int shift => GetStorage().GetShift(Identity.ProjectionPeriod);//Identity.ProjectionPeriod",
"\n private int timeStep => GetStorage().GetTimeStep(Identity.ProjectionPeriod);//Identity.ProjectionPeriod",
"\n private double amortizedFactor => GetScope<MonthlyAmortizationFactorCashflow>(Identity)",
"\n .MonthlyAmortizationFactors",
"\n .Skip(shift)",
Expand Down Expand Up @@ -1692,8 +1692,8 @@
"\n",
"\npublic interface TechnicalMarginForIA : TechnicalMargin",
"\n{",
"\n private int timeStep => GetStorage().GetTimeStep(0);//Identity.Id.ProjectionPeriod",
"\n private int shift => GetStorage().GetShift(0);//Identity.Id.ProjectionPeriod",
"\n private int timeStep => GetStorage().GetTimeStep(Identity.ProjectionPeriod);//Identity.Id.ProjectionPeriod",
"\n private int shift => GetStorage().GetShift(Identity.ProjectionPeriod);//Identity.Id.ProjectionPeriod",
"\n ",
"\n private double[] monthlyInterestFactor => GetScope<MonthlyRate>(Identity, o => o.WithContext(EconomicBasis)).Interest;",
"\n ",
Expand Down Expand Up @@ -2317,7 +2317,39 @@
{
"cell_type": "code",
"source": [
"public interface ComputeIfrsVarsOpenings : ActualToIfrsVariable, DeferrableToIfrsVariable, TmToIfrsVariable",
"//This scope replaces ComputeIfrsVarsCashflows. Something similar should be done for other calculations that need projections. ",
"\n//Also we still need a way to make BoP for a projection Period be same as EoP for previous period. ",
"\npublic interface ProjectionScopeCashflows : IScope<ImportIdentity, ImportStorage>{",
"\n IEnumerable<IfrsVariable> CalculatedIfrsVariables => Enumerable.Range(0,2).Select(x => GetScope<ComputeIfrsVarsCashflows>(Identity with { ProjectionPeriod = x} ).CalculatedIfrsVariables //Here Projection Period needs to be x...and then the right information needs to be found. ",
"\n .Select(y => AdjustProjection(y, x))).SelectMany(l => l).AggregateOver().Select(x => x with {Partition = GetStorage().TargetPartition});",
"\n",
"\nIfrsVariable AdjustProjection(IfrsVariable iv, int projectionPeriod){",
"\nvar ret = new IfrsVariable{ ",
"\n DataNode = iv.DataNode,",
"\n AocType = iv.AocType,",
"\n Novelty = iv.Novelty,",
"\n Partition = iv.Partition,",
"\n Value = projectionPeriod == 0 ? iv.Value : 0.0d,",
"\n Value1 = projectionPeriod == 1 ? iv.Value : 0.0d , //Here Value2...etc would be needed. ",
"\n EstimateType = iv.EstimateType, ",
"\n AccidentYear = iv.AccidentYear,",
"\n AmountType = iv.AmountType,",
"\n EconomicBasis = iv.EconomicBasis",
"\n };",
"\n return ret;",
"\n}",
"\n",
"\n}"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"",
"\npublic interface ComputeIfrsVarsOpenings : ActualToIfrsVariable, DeferrableToIfrsVariable, TmToIfrsVariable",
"\n{",
"\n IEnumerable<IfrsVariable> CalculatedIfrsVariables => AdvanceActual.Concat(OverdueActual)",
"\n .Concat(DeferrableActual)",
Expand All @@ -2336,7 +2368,7 @@
"\n{",
"\n IEnumerable<IfrsVariable> CalculatedIfrsVariables => GetStorage().ImportFormat switch {",
"\n ImportFormats.Actual => GetScope<ComputeIfrsVarsActuals>(Identity).CalculatedIfrsVariables,",
"\n ImportFormats.Cashflow => GetScope<ComputeIfrsVarsCashflows>(Identity).CalculatedIfrsVariables,",
"\n ImportFormats.Cashflow => GetScope<ProjectionScopeCashflows>(Identity).CalculatedIfrsVariables,",
"\n ImportFormats.Opening => GetScope<ComputeIfrsVarsOpenings>(Identity).CalculatedIfrsVariables,",
"\n };",
"\n}"
Expand Down