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
58 changes: 29 additions & 29 deletions Import/ImportScopeCalculation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -896,15 +896,15 @@
"id": "NX2BdeLNxk2VWROO8E5pBg",
"cell_type": "code",
"source": [
"public interface PvBase : IWithGetValueFromValues",
"public interface PresentValue : IWithGetValueFromValues",
"\n{ ",
"\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>",
"\n builder.ForScope<PvBase>(s => s.WithApplicability<ComputePvBaseWithIfrsVariable>(x => x.GetStorage().ImportFormat != ImportFormats.Cashflow",
"\n builder.ForScope<PresentValue>(s => s.WithApplicability<ComputePresentValueWithIfrsVariable>(x => x.GetStorage().ImportFormat != ImportFormats.Cashflow",
"\n || x.GetStorage().IsSecondaryScope(x.Identity.Id.DataNode))",
"\n .WithApplicability<PvBaseFromDiscountedCashflow>(x => (x.Identity.Id.AocType == AocTypes.BOP && x.Identity.Id.Novelty != Novelties.C) || x.Identity.Id.AocType == AocTypes.EOP)",
"\n .WithApplicability<PresentValueFromDiscountedCashflow>(x => (x.Identity.Id.AocType == AocTypes.BOP && x.Identity.Id.Novelty != Novelties.C) || x.Identity.Id.AocType == AocTypes.EOP)",
"\n .WithApplicability<CashflowAocStep>(x => x.Identity.Id.AocType == AocTypes.CF)",
"\n .WithApplicability<PvBaseWithInterestAccretionForCreditRisk>(x => x.Identity.Id.IsReinsurance && x.Identity.AmountType == AmountTypes.CDR && x.Identity.Id.AocType == AocTypes.IA)",
"\n .WithApplicability<PvBaseWithInterestAccretion>(x => x.Identity.Id.AocType == AocTypes.IA)",
"\n .WithApplicability<PresentValueWithInterestAccretionForCreditRisk>(x => x.Identity.Id.IsReinsurance && x.Identity.AmountType == AmountTypes.CDR && x.Identity.Id.AocType == AocTypes.IA)",
"\n .WithApplicability<PresentValueWithInterestAccretion>(x => x.Identity.Id.AocType == AocTypes.IA)",
"\n .WithApplicability<EmptyValuesAocStep>(x => new string[]{AocTypes.BOP, AocTypes.EA, AocTypes.AM, AocTypes.RCU}.Contains(x.Identity.Id.AocType) ) //add here combination CRU for At !CDR?",
"\n );",
"\n ",
Expand All @@ -917,40 +917,40 @@
"\n public double Value => GetValueFromValues(Values);",
"\n}",
"\n",
"\npublic interface ComputePvBaseWithIfrsVariable : PvBase",
"\npublic interface ComputePresentValueWithIfrsVariable : PresentValue",
"\n{",
"\n double PvBase.Value => GetStorage().GetValue(Identity.Id, Identity.AmountType, Identity.CalculationType, EconomicBasis, Identity.AccidentYear); //unify CalculationType and EstimateTypeGet",
"\n double[] PvBase.Values => Enumerable.Empty<double>().ToArray();",
"\n double PresentValue.Value => GetStorage().GetValue(Identity.Id, Identity.AmountType, Identity.CalculationType, EconomicBasis, Identity.AccidentYear); //unify CalculationType and EstimateTypeGet",
"\n double[] PresentValue.Values => Enumerable.Empty<double>().ToArray();",
"\n}",
"\n",
"\npublic interface PvBaseFromDiscountedCashflow : PvBase",
"\npublic interface PresentValueFromDiscountedCashflow : PresentValue",
"\n{",
"\n [NotVisible]",
"\n double[] PvBase.Values => GetScope<DiscountedCashflow>(Identity).Values;",
"\n double[] PresentValue.Values => GetScope<DiscountedCashflow>(Identity).Values;",
"\n}",
"\n",
"\npublic interface CashflowAocStep : PvBase",
"\npublic interface CashflowAocStep : PresentValue",
"\n{",
"\n [NotVisible]",
"\n double[] PvBase.Values => -1d * GetScope<NominalCashflow>(Identity).Values;",
"\n double[] PresentValue.Values => -1d * GetScope<NominalCashflow>(Identity).Values;",
"\n}",
"\n",
"\npublic interface PvBaseWithInterestAccretion : PvBase, IWithInterestAccretion",
"\npublic interface PresentValueWithInterestAccretion : PresentValue, IWithInterestAccretion",
"\n{",
"\n [NotVisible]",
"\n double[] PvBase.Values => GetInterestAccretion();",
"\n double[] PresentValue.Values => GetInterestAccretion();",
"\n}",
"\n",
"\npublic interface PvBaseWithInterestAccretionForCreditRisk : PvBase, IWithInterestAccretionForCreditRisk",
"\npublic interface PresentValueWithInterestAccretionForCreditRisk : PresentValue, IWithInterestAccretionForCreditRisk",
"\n{",
"\n [NotVisible]",
"\n double[] PvBase.Values => GetInterestAccretion();",
"\n double[] PresentValue.Values => GetInterestAccretion();",
"\n}",
"\n",
"\npublic interface EmptyValuesAocStep : PvBase",
"\npublic interface EmptyValuesAocStep : PresentValue",
"\n{",
"\n [NotVisible]",
"\n double[] PvBase.Values => Enumerable.Empty<double>().ToArray();",
"\n double[] PresentValue.Values => Enumerable.Empty<double>().ToArray();",
"\n}"
],
"metadata": {},
Expand Down Expand Up @@ -1014,9 +1014,9 @@
"\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray(); ",
"\n ",
"\n [NotVisible]",
"\n PvBase[] PresentValues => GetScope<ValidAmountType>(Identity.DataNode).BeAmountTypes",
"\n PresentValue[] PresentValues => GetScope<ValidAmountType>(Identity.DataNode).BeAmountTypes",
"\n .SelectMany(at => accidentYears",
"\n .Select(ay => GetScope<PvBase>((Identity, at, CalculationType, ay), o => o.WithContext(EconomicBasis))))",
"\n .Select(ay => GetScope<PresentValue>((Identity, at, CalculationType, ay), o => o.WithContext(EconomicBasis))))",
"\n .ToArray();",
"\n double Value => PresentValues.Aggregate().Value;",
"\n}",
Expand All @@ -1032,9 +1032,9 @@
"\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray();",
"\n ",
"\n [NotVisible]",
"\n PvBase[] PresentValues => GetScope<ValidAmountType>(Identity.DataNode).BeAmountTypes",
"\n PresentValue[] PresentValues => GetScope<ValidAmountType>(Identity.DataNode).BeAmountTypes",
"\n .SelectMany(at => accidentYears",
"\n .Select(ay => GetScope<PvBase>((Identity, at, CalculationType, ay), o => o.WithContext(EconomicBasis))))",
"\n .Select(ay => GetScope<PresentValue>((Identity, at, CalculationType, ay), o => o.WithContext(EconomicBasis))))",
"\n .ToArray();",
"\n ",
"\n double Value => PresentValues.Aggregate().Value;",
Expand Down Expand Up @@ -1079,7 +1079,7 @@
"\n ",
"\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray(); ",
"\n ",
"\n PvBase[] PresentValues => accidentYears.Select(ay => GetScope<PvBase>((Identity, (string)null, CalculationType, ay), o => o.WithContext(EconomicBasis))).ToArray();",
"\n PresentValue[] PresentValues => accidentYears.Select(ay => GetScope<PresentValue>((Identity, (string)null, CalculationType, ay), o => o.WithContext(EconomicBasis))).ToArray();",
"\n ",
"\n double Value => PresentValues.Aggregate().Value;",
"\n}",
Expand All @@ -1093,7 +1093,7 @@
"\n ",
"\n private int?[] accidentYears => GetStorage().GetAccidentYears(Identity.DataNode).ToArray(); ",
"\n ",
"\n PvBase[] PresentValues => accidentYears.Select(ay => GetScope<PvBase>((Identity, (string)null, CalculationType, ay), o => o.WithContext(EconomicBasis))).ToArray(); ",
"\n PresentValue[] PresentValues => accidentYears.Select(ay => GetScope<PresentValue>((Identity, (string)null, CalculationType, ay), o => o.WithContext(EconomicBasis))).ToArray(); ",
"\n ",
"\n double Value => PresentValues.Aggregate().Value;",
"\n}"
Expand Down Expand Up @@ -1580,12 +1580,12 @@
"\n string EstimateType => EstimateTypes.BEPA;",
"\n string EconomicBasis => EconomicBases.L;",
"\n ",
"\n PvBase[] ByAmountType => GetStorage().GetPremiums().Select(pr => GetStorage().GetPremiumAllocationFactor(Identity) * GetScope<PvBase>((Identity, pr, EstimateTypes.BE, (int?)null), o => o.WithContext(EconomicBasis))).ToArray(); ",
"\n PresentValue[] ByAmountType => GetStorage().GetPremiums().Select(pr => GetStorage().GetPremiumAllocationFactor(Identity) * GetScope<PresentValue>((Identity, pr, EstimateTypes.BE, (int?)null), o => o.WithContext(EconomicBasis))).ToArray(); ",
"\n}",
"\n",
"\npublic interface DefaultValueBeExperienceAdjustmentForPremium : BeExperienceAdjustmentForPremium",
"\n{",
"\n PvBase[] BeExperienceAdjustmentForPremium.ByAmountType => Enumerable.Empty<PvBase>().ToArray();",
"\n PresentValue[] BeExperienceAdjustmentForPremium.ByAmountType => Enumerable.Empty<PresentValue>().ToArray();",
"\n}"
],
"metadata": {},
Expand Down Expand Up @@ -1702,7 +1702,7 @@
"\n ",
"\n double Value => GetScope<ValidAmountType>(Identity.DataNode).BeAmountTypes",
"\n .Except(GetStorage().GetNonAttributableAmountType())",
"\n .Sum(at => GetScope<PvBase>((Identity, at, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) +",
"\n .Sum(at => GetScope<PresentValue>((Identity, at, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) +",
"\n GetScope<RaLocked>(Identity).Value;",
"\n ",
"\n double AggregatedValue => GetScope<PreviousAocSteps>((Identity, InputSource.Cashflow)).Values",
Expand Down Expand Up @@ -1755,12 +1755,12 @@
"\n ",
"\n private double attributableExpenseAndCommissions => GetStorage().GetAttributableExpenseAndCommissionAmountType().Sum(d =>",
"\n GetStorage().GetNovelties(referenceAocType, InputSource.Cashflow)",
"\n .Sum(n => GetScope<PvBase>((Identity with {AocType = referenceAocType, Novelty = n}, d, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) -",
"\n .Sum(n => GetScope<PresentValue>((Identity with {AocType = referenceAocType, Novelty = n}, d, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) -",
"\n GetScope<ActualBase>((Identity with {AocType = referenceAocType, Novelty = Novelties.C}, d, EstimateTypes.A, (int?)null)).Value);",
"\n",
"\n private double investmentClaims => GetStorage().GetInvestmentClaims().Sum(ic =>",
"\n GetStorage().GetNovelties(referenceAocType, InputSource.Cashflow)",
"\n .Sum(n => GetScope<PvBase>((Identity with {AocType = referenceAocType, Novelty = n}, ic, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) -",
"\n .Sum(n => GetScope<PresentValue>((Identity with {AocType = referenceAocType, Novelty = n}, ic, CalculationTypes.BE, (int?)null), o => o.WithContext(EconomicBasis)).Value) -",
"\n GetScope<ActualBase>((Identity with {AocType = referenceAocType, Novelty = Novelties.C}, ic, EstimateTypes.A, (int?)null)).Value - ",
"\n GetScope<ActualBase>((Identity with {AocType = referenceAocType, Novelty = Novelties.C}, ic, EstimateTypes.AA, (int?)null)).Value -",
"\n GetScope<ActualBase>((Identity with {AocType = referenceAocType, Novelty = Novelties.C}, ic, EstimateTypes.OA, (int?)null)).Value);",
Expand Down
Loading