(AmountTypes.CDR).Descendants(includeSelf: true).Select(x => x.SystemName);",
"\n}"
],
"metadata": {},
diff --git a/ifrs17/README.md b/ifrs17/README.md
index f3229e57..f2d16ff3 100644
--- a/ifrs17/README.md
+++ b/ifrs17/README.md
@@ -18,7 +18,7 @@ Open our [**IFRS 17 Template**](https://portal.systemorph.cloud/project/ifrs17-t
If you want to know more about the Calculation Engine than just its standard technical use, you are recommended to look at [Overview Calculation Engine](./OverviewCalculationEngine) notebook.
You will be introduced to:
- [DataModel](./DataModel/DataStructure) with links to detailed description of individual data types, dimensions and partitions employed
-- [Import Calculation](./Import/ImportScopeCalculation) with in detail description using mathematical formulas and links to supporting material
+- [Import Calculation](./Import/1ImportScope-Identities) with in detail description using mathematical formulas and links to supporting material
diff --git a/ifrs17/Report/ParameterReportMutableScopeInteractive.ipynb b/ifrs17/Report/ParameterReportMutableScopeInteractive.ipynb
index 199e3776..6f252599 100644
--- a/ifrs17/Report/ParameterReportMutableScopeInteractive.ipynb
+++ b/ifrs17/Report/ParameterReportMutableScopeInteractive.ipynb
@@ -154,7 +154,7 @@
"\n async Task GetPartnerRatingReport()",
"\n {",
"\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
- "\n var data = await workspace.GetPartnerRatingsReportParametersAsync(GetArgs());",
+ "\n var data = await workspace.GetCurrentPartnerRatingsReportParametersAsync(GetArgs());",
"\n return await report.ForObjects(data)",
"\n .WithQuerySource(workspace)",
"\n .GroupRowsBy(x => x.Partner)",
@@ -166,7 +166,7 @@
"\n async Task GetDefaultRatesReport()",
"\n {",
"\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
- "\n var data = await workspace.GetCreditDefaultRatesReportParametersAsync(GetArgs());",
+ "\n var data = await workspace.GetCurrentCreditDefaultRatesReportParametersAsync(GetArgs());",
"\n return await report.ForObjects(data)",
"\n .WithQuerySource(workspace)",
"\n .GroupRowsBy(x => x.CreditRiskRating)",
diff --git a/ifrs17/Report/ParameterReportsQueries.ipynb b/ifrs17/Report/ParameterReportsQueries.ipynb
index 13a2b8cb..81f6690a 100644
--- a/ifrs17/Report/ParameterReportsQueries.ipynb
+++ b/ifrs17/Report/ParameterReportsQueries.ipynb
@@ -163,6 +163,16 @@
"source": [
"public record PartnerRatingsReportParameter : ReportParameter {",
"\n [IdentityProperty]",
+ "\n [NotAggregated]",
+ "\n [Dimension(typeof(int), nameof(InitialYear))]",
+ "\n [NotVisible]",
+ "\n public int InitialYear { get; init; }",
+ "\n",
+ "\n [IdentityProperty]",
+ "\n [NotVisible]",
+ "\n public string PartnerRatingType { get; init; }",
+ "\n",
+ "\n [IdentityProperty]",
"\n [NotVisible]",
"\n [Dimension(typeof(Partner))]",
"\n public string Partner { get; init; }",
@@ -172,6 +182,16 @@
"\n}",
"\npublic record CreditDefaultRatesReportParameter : ReportParameter {",
"\n [IdentityProperty]",
+ "\n [NotAggregated]",
+ "\n [Dimension(typeof(int), nameof(InitialYear))]",
+ "\n [NotVisible]",
+ "\n public int InitialYear { get; init; }",
+ "\n ",
+ "\n [IdentityProperty]",
+ "\n [NotVisible]",
+ "\n public string CreditDefaultRatesType { get; init; }",
+ "\n",
+ "\n [IdentityProperty]",
"\n [Dimension(typeof(CreditRiskRating))]",
"\n [NotVisible]",
"\n public string CreditRiskRating { get; init; }",
@@ -367,8 +387,8 @@
{
"cell_type": "code",
"source": [
- "public static async Task GetPartnerRatingsReportParametersAsync(this IWorkspace workspace, ImportArgs args) =>",
- "\n (await workspace.LoadCurrentAndPreviousParameterAsync(args, x => x.Partner))",
+ "public static async Task GetCurrentPartnerRatingsReportParametersAsync(this IWorkspace workspace, ImportArgs args) {",
+ "\n var currentPartnerRating = (await workspace.LoadCurrentAndPreviousParameterAsync(args, x => x.Partner))",
"\n .Values",
"\n .SelectMany(x => x.Select(y => ",
"\n new PartnerRatingsReportParameter { ",
@@ -380,7 +400,39 @@
"\n CreditRiskRating = y.Value.CreditRiskRating",
"\n }",
"\n ))",
- "\n .ToArray();"
+ "\n .ToArray();",
+ "\n ",
+ "\n return currentPartnerRating;",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public static async Task GetLockedInPartnerRatingsReportParametersAsync(this IWorkspace workspace, ImportArgs args) {",
+ "\n var initialYears = (await workspace.LoadDataNodesAsync(args)).Values.Select(dn => dn.Year).ToHashSet();",
+ "\n var lockedPartnerRating = Enumerable.Empty();",
+ "\n foreach (var y in initialYears) { ",
+ "\n var loadedPartnerRatingData = await workspace.LoadCurrentParameterAsync(args with { Year = y, Month = args.Year == y ? args.Month : MonthInAYear }, y => y.Partner);",
+ "\n lockedPartnerRating = lockedPartnerRating.Concat(loadedPartnerRatingData.Select(x => ",
+ "\n new PartnerRatingsReportParameter {",
+ "\n InitialYear = y,",
+ "\n PartnerRatingType = \"Locked-In Rating\",",
+ "\n Partner = x.Value.Partner,",
+ "\n Year = x.Value.Year,",
+ "\n Month = x.Value.Month,",
+ "\n Scenario = x.Value.Scenario,",
+ "\n CreditRiskRating = x.Value.CreditRiskRating",
+ "\n }",
+ "\n ));",
+ "\n ",
+ "\n }",
+ "\n ",
+ "\n return lockedPartnerRating.ToArray();",
+ "\n}"
],
"metadata": {},
"execution_count": 0,
@@ -389,22 +441,22 @@
{
"cell_type": "code",
"source": [
- "public static async Task GetCreditDefaultRatesReportParametersAsync(this IWorkspace workspace, ImportArgs args) {",
- "\n var partnerRatings = await workspace.GetPartnerRatingsReportParametersAsync(args);",
+ "public static async Task GetCurrentCreditDefaultRatesReportParametersAsync(this IWorkspace workspace, ImportArgs args) {",
+ "\n var partnerRatings = await workspace.GetCurrentPartnerRatingsReportParametersAsync(args);",
"\n ",
- "\n var creditDefaultRates = (await workspace.LoadCurrentAndPreviousParameterAsync(args, x => x.CreditRiskRating))",
+ "\n var currentCreditDefaultRates = (await workspace.LoadCurrentAndPreviousParameterAsync(args, x => x.CreditRiskRating))",
"\n .Values",
"\n .SelectMany(x => x.Select(y =>",
- "\n new {",
+ "\n new CreditDefaultRatesReportParameter{",
"\n Period = ((Period)y.Key),",
"\n CreditRiskRating = y.Value.CreditRiskRating,",
"\n Year = y.Value.Year,",
"\n Month = y.Value.Month,",
"\n Scenario = y.Value.Scenario}",
- "\n ));",
- "\n ",
+ "\n )).ToArray();",
+ "\n",
"\n var partnerDefaultRates = partnerRatings.Join(",
- "\n creditDefaultRates,",
+ "\n currentCreditDefaultRates,",
"\n pr => new {pr.Period, pr.CreditRiskRating},",
"\n cdr => new {cdr.Period, cdr.CreditRiskRating},",
"\n (pr, cdr) => ",
@@ -424,6 +476,42 @@
"metadata": {},
"execution_count": 0,
"outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public static async Task GetLockedInCreditDefaultRatesReportParametersAsync(this IWorkspace workspace, ImportArgs args) {",
+ "\n var initialYears = (await workspace.LoadDataNodesAsync(args)).Values.Select(dn => dn.Year).ToHashSet();",
+ "\n var lockedCreditDefaultRate = Enumerable.Empty();",
+ "\n foreach (var y in initialYears) { ",
+ "\n var loadedCreditDefaultRateData = await workspace.LoadCurrentParameterAsync(args with { Year = y, Month = args.Year == y ? args.Month : MonthInAYear }, y => y.CreditRiskRating);",
+ "\n lockedCreditDefaultRate = lockedCreditDefaultRate.Concat(loadedCreditDefaultRateData.Select(x => ",
+ "\n new CreditDefaultRatesReportParameter {",
+ "\n InitialYear = y,",
+ "\n CreditDefaultRatesType = \"Locked-In Rates\",",
+ "\n CreditRiskRating = x.Value.CreditRiskRating,",
+ "\n Year = x.Value.Year,",
+ "\n Month = x.Value.Month,",
+ "\n Scenario = x.Value.Scenario}",
+ "\n ));",
+ "\n ",
+ "\n }",
+ "\n",
+ "\n return lockedCreditDefaultRate.ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
}
]
}
\ No newline at end of file
diff --git a/ifrs17/Report/ReportScopes.ipynb b/ifrs17/Report/ReportScopes.ipynb
index 6d4c0434..45db589a 100644
--- a/ifrs17/Report/ReportScopes.ipynb
+++ b/ifrs17/Report/ReportScopes.ipynb
@@ -275,12 +275,12 @@
"\n",
"\npublic interface LockedBestEstimate: IScope<(ReportIdentity Id, CurrencyType CurrencyType), ReportStorage>, IDataCube {",
"\n IDataCube LockedBestEstimate => GetScope((Identity.Id, Identity.CurrencyType, EstimateTypes.BE)).FxData",
- "\n .Filter((\"LiabilityType\", Identity.Id.LiabilityType), (\"EconomicBasis\", EconomicBases.L));",
+ "\n .Filter((\"LiabilityType\", Identity.Id.LiabilityType), (\"EconomicBasis\", EconomicBases.L), (\"AmountType\", \"!CDRI\"));",
"\n}",
"\n",
"\npublic interface CurrentBestEstimate: IScope<(ReportIdentity Id, CurrencyType CurrencyType), ReportStorage>, IDataCube {",
"\n IDataCube CurrentBestEstimate => GetScope((Identity.Id, Identity.CurrencyType, EstimateTypes.BE)).FxData",
- "\n .Filter((\"LiabilityType\", Identity.Id.LiabilityType), (\"EconomicBasis\", EconomicBases.C));",
+ "\n .Filter((\"LiabilityType\", Identity.Id.LiabilityType), (\"EconomicBasis\", EconomicBases.C), (\"AmountType\", \"!CDRI\"));",
"\n}"
],
"metadata": {},