From eab2ae1df34a0e9bcdbeb9464cf3350a78864c86 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Fri, 14 Oct 2022 18:18:43 +0200 Subject: [PATCH 01/19] Ifrs17ReportScopes --- .../Report/Ifrs17ReportScopes.ipynb | 278 ++++++++++++++++++ full-ifrs17-template/Report/Reports.ipynb | 6 + .../Report/ReportsNewWayBackup.ipynb | 252 ++++++++++++++++ 3 files changed, 536 insertions(+) create mode 100644 full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb create mode 100644 full-ifrs17-template/Report/ReportsNewWayBackup.ipynb diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb new file mode 100644 index 00000000..00850993 --- /dev/null +++ b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb @@ -0,0 +1,278 @@ +{ + "metadata": { + "authors": [], + "kernelspec": { + "display_name": "Formula Framework", + "language": "C#", + "name": "C#" + }, + "language_info": { + "file_extension": ".cs", + "mimetype": "text/plain", + "name": "C#" + }, + "toc-autonumbering": "True", + "toc-showcode": "False" + }, + "nbformat": 4, + "nbformat_minor": 5, + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Infrastructure and Configuration" + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Initialize data" + ] + }, + { + "cell_type": "code", + "source": [ + "/* Systemorph set of dimensions + mockdata are dispatched to the unconfigured in-memory DataSource */", + "\n#!eval-notebook \"../Initialization/InitSystemorphToMemory\"", + "\n/* DataSource is configured and connected to real database */", + "\n//#!eval-notebook \"../Database/Configure.ipynb\"" + ] + }, + { + "cell_type": "code", + "source": [ + "Workspace.InitializeFrom(DataSource);" + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Import Dependencies" + ] + }, + { + "cell_type": "code", + "source": [ + "//#!import \"ReportScopes.ipynb\"", + "\n//#!import \"ReportConfigurationAndUtils.ipynb\"" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Report Scope Proposal" + ] + }, + { + "cell_type": "code", + "source": [ + "public enum ReportNames { PvReport, FcfReport}", + "\n[InitializeScope(nameof(InitAsync))]", + "\npublic interface IIfrs17Report : IMutableScope {", + "\n // Some infrastructure", + "\n protected IWorkspace workspace => GetStorage().Workspace;", + "\n protected Systemorph.Vertex.Pivot.Reporting.IReportFactory report => GetStorage().Report;", + "\n", + "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>", + "\n builder.ForScope(s => s.WithApplicability(x => x.Identity == ReportNames.FcfReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.PvReport)", + "\n );", + "\n", + "\n ", + "\n // Basic mutable properties", + "\n (int Year, int Month) ReportingPeriod { get; set; }", + "\n int Year => ReportingPeriod.Year;", + "\n int Month => ReportingPeriod.Month;", + "\n string ReportingNode { get; set; }", + "\n string Scenario { get; set; }", + "\n CurrencyType CurrencyType { get; set; }", + "\n ", + "\n ((int Year, int Month) ReportingPeriod, string ReportingNode, string Scenario, CurrencyType) ShowSettings => (ReportingPeriod, ReportingNode, Scenario, CurrencyType);", + "\n ", + "\n // Slice and Dice", + "\n IEnumerable RowSlices { get; set; }", + "\n protected string[] defaultRowSlices => new string[] { };", + "\n protected string[] rowSlices => RowSlices is null ? defaultRowSlices : defaultRowSlices.Concat(RowSlices).ToArray();", + "\n", + "\n IEnumerable ColumnSlices { get; set; }", + "\n protected string[] defaultColumnSlices => new string[] { };", + "\n protected string[] columnSlices => ColumnSlices is null ? defaultColumnSlices : defaultColumnSlices.Concat(ColumnSlices).ToArray();", + "\n protected HashSet<(ReportIdentity, CurrencyType)> GetIdentities() => GetStorage().GetIdentities(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", + "\n ", + "\n // Filter", + "\n IEnumerable<(string filterName, string filterValue)> DataFilter { get; set; }", + "\n protected (string filterName, object filterValue)[] dataFilter => (DataFilter is null ? Enumerable.Empty<(string, object)>() : DataFilter.Select(x => (x.filterName, (object)x.filterValue))).ToArray();", + "\n ", + "\n // Scope Initialization", + "\n async Task InitAsync() {", + "\n var mostRecentPartition = (await workspace.Query().Where(x => x.Scenario == null).OrderBy(x => x.Year).ThenBy(x => x.Month).ToArrayAsync()).Last(); ", + "\n ", + "\n ReportingPeriod = (mostRecentPartition.Year, mostRecentPartition.Month);", + "\n ReportingNode = (await workspace.Query().Where(x => x.Parent == null).ToArrayAsync()).First().SystemName; // TODO: change once user permissions are available", + "\n Scenario = null;", + "\n CurrencyType = CurrencyType.Contractual;", + "\n ", + "\n ColumnSlices = \"EstimateType\".RepeatOnce();", + "\n", + "\n", + "\n await GetStorage().InitializeReportIndependentCacheAsync();", + "\n }", + "\n int GetNumber() => 10;", + "\n public IDataCube GetDataCube() => default;", + "\n ", + "\n //Needs to be copy pasted", + "\n private async Task GetReportTaskAsync() {", + "\n await GetStorage().InitializeAsync(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", + "\n ", + "\n ", + "\n return report.ForDataCube(GetDataCube())", + "\n .WithQuerySource(workspace)", + "\n .SliceRowsBy(rowSlices)", + "\n .SliceColumnsBy(columnSlices)", + "\n .ReportGridOptions()", + "\n .ToReport();", + "\n }", + "\n", + "\n Task ToReportAsync => GetReportTaskAsync();", + "\n", + "\n", + "\n", + "\n }", + "\npublic interface PvReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", + "\n", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", + "\n", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LockedBestEstimate.Filter(dataFilter) ;//+ GetScopes(identities).Aggregate().CurrentBestEstimateFcf.Filter(dataFilter);", + "\n ", + "\n }", + "\n", + "\n public interface FcfReport : IIfrs17Report {", + "\n", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\",\"VariableType\" };", + "\n", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType) };", + "\n", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Fcf.Filter(dataFilter);", + "\n", + "\n", + "\n }", + "\n " + ] + }, + { + "cell_type": "code", + "source": [ + "public class Ifrs17 ", + "\n{", + "\n private IWorkspace Workspace {get; init;}", + "\n private Systemorph.Vertex.Scopes.Proxy.IScopeFactory Scopes {get; init;}", + "\n private Systemorph.Vertex.Pivot.Reporting.IReportFactory Report {get; init;}", + "\n private ReportStorage Storage {get; set;}", + "\n public PvReport PresentValues {get{", + "\n Storage = new ReportStorage(Workspace,Report);", + "\n return Scopes.ForSingleton().WithStorage(Storage).ToScope();", + "\n }}", + "\n public Ifrs17 (IWorkspace ws, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Reporting.IReportFactory report)", + "\n {", + "\n Workspace = ws; ", + "\n Scopes = scopes; ", + "\n Report = report; ", + "\n }", + "\n}" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Playground" + ] + }, + { + "cell_type": "code", + "source": [ + " var reportStorage = new ReportStorage(Workspace, Report);", + "\n var ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", + "\n var reports = Scopes.ForIdentities(ids).WithStorage(reportStorage).ToScopes();", + "\nvar fcfReport = reports.Last();", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "source": [ + " fcfReport.ReportingNode = \"CH\";", + "\n fcfReport.ReportingPeriod = (2020, 12);", + "\n", + "\n (await fcfReport.ToReportAsync) with {Height = 250}", + "\n" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.Last().GetNumber()" + ] + }, + { + "cell_type": "code", + "source": [ + " var reportStorage = new ReportStorage(Workspace, Report);", + "\n var pvReport = Scopes.ForSingleton().WithStorage(reportStorage).ToScope();", + "\n pvReport.ReportingNode = \"CH\";", + "\n pvReport.ReportingPeriod = (2020, 12);", + "\n (await pvReport.ToReportAsync) with {Height = 250}", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "source": [ + "pvReport.GetNumber()" + ] + }, + { + "cell_type": "code", + "source": [ + "typeof(PvReport)" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport is PvReport" + ] + }, + { + "cell_type": "code", + "source": [ + "public interface Hello {", + "\n public int Number();", + "\n}", + "\npublic class Class1 : Hello {", + "\n public int Number() => 5;", + "\n}", + "\npublic class Class2 : Hello", + "\n{", + "\n public int Number() => 7;", + "\n}" + ] + }, + { + "cell_type": "code", + "source": [ + "var c1= new Class1();", + "\nvar c2 = new Class2();", + "\nc1 is Class2" + ] + }, + { + "cell_type": "code", + "source": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index 1dc742bd..3b99f720 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -50,6 +50,12 @@ "#!eval-notebook \"../Initialization/InitSystemorphToMemory\"" ] }, + { + "cell_type": "code", + "source": [ + "//#!import \"ReportsNewWay\"" + ] + }, { "cell_type": "code", "source": [ diff --git a/full-ifrs17-template/Report/ReportsNewWayBackup.ipynb b/full-ifrs17-template/Report/ReportsNewWayBackup.ipynb new file mode 100644 index 00000000..20e346ef --- /dev/null +++ b/full-ifrs17-template/Report/ReportsNewWayBackup.ipynb @@ -0,0 +1,252 @@ +{ + "metadata": { + "authors": [], + "kernelspec": { + "display_name": "Formula Framework", + "language": "C#", + "name": "C#" + }, + "language_info": { + "file_extension": ".cs", + "mimetype": "text/plain", + "name": "C#" + }, + "toc-autonumbering": "True", + "toc-showcode": "False" + }, + "nbformat": 4, + "nbformat_minor": 5, + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Infrastructure and Configuration" + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Initialize data" + ] + }, + { + "cell_type": "code", + "source": [ + "/* Systemorph set of dimensions + mockdata are dispatched to the unconfigured in-memory DataSource */", + "\n#!eval-notebook \"../Initialization/InitSystemorphToMemory\"", + "\n/* DataSource is configured and connected to real database */", + "\n//#!eval-notebook \"../Database/Configure\"" + ] + }, + { + "cell_type": "code", + "source": [ + "Workspace.InitializeFrom(DataSource);" + ] + }, + { + "cell_type": "markdown", + "source": [ + "## Import Dependencies" + ] + }, + { + "cell_type": "code", + "source": [ + "#!import \"ReportScopes\"", + "\n#!import \"ReportConfigurationAndUtils\"" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Report Scope Proposal" + ] + }, + { + "cell_type": "code", + "source": [ + "[InitializeScope(nameof(InitAsync))]", + "\npublic interface FcfReport : IMutableScopeWithStorage {", + "\n // Some infrastructure", + "\n private IWorkspace workspace => GetStorage().Workspace;", + "\n private Systemorph.Vertex.Pivot.Reporting.IReportFactory report => GetStorage().Report;", + "\n ", + "\n // Basic mutable properties", + "\n (int Year, int Month) ReportingPeriod { get; set; }", + "\n int Year => ReportingPeriod.Year;", + "\n int Month => ReportingPeriod.Month;", + "\n string ReportingNode { get; set; }", + "\n string Scenario { get; set; }", + "\n CurrencyType CurrencyType { get; set; }", + "\n ", + "\n ((int Year, int Month) ReportingPeriod, string ReportingNode, string Scenario, CurrencyType) ShowSettings => (ReportingPeriod, ReportingNode, Scenario, CurrencyType);", + "\n ", + "\n // Slice and Dice", + "\n IEnumerable RowSlices { get; set; }", + "\n private string[] defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", + "\n private string[] rowSlices => RowSlices is null ? defaultRowSlices : defaultRowSlices.Concat(RowSlices).ToArray();", + "\n ", + "\n IEnumerable ColumnSlices { get; set; }", + "\n private string[] defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType) };", + "\n private string[] columnSlices => ColumnSlices is null ? defaultColumnSlices : defaultColumnSlices.Concat(ColumnSlices).ToArray();", + "\n ", + "\n // Filter", + "\n IEnumerable<(string filterName, string filterValue)> DataFilter { get; set; }", + "\n private (string filterName, object filterValue)[] dataFilter => (DataFilter is null ? Enumerable.Empty<(string, object)>() : DataFilter.Select(x => (x.filterName, (object)x.filterValue))).ToArray();", + "\n ", + "\n // Scope Initialization", + "\n async Task InitAsync() {", + "\n var mostRecentPartition = (await workspace.Query().Where(x => x.Scenario == null).OrderBy(x => x.Year).ThenBy(x => x.Month).ToArrayAsync()).Last(); ", + "\n ", + "\n ReportingPeriod = (mostRecentPartition.Year, mostRecentPartition.Month);", + "\n ReportingNode = (await workspace.Query().Where(x => x.Parent == null).ToArrayAsync()).First().SystemName; // TODO: change once user permissions are available", + "\n Scenario = null;", + "\n CurrencyType = CurrencyType.Contractual;", + "\n ", + "\n ColumnSlices = \"EstimateType\".RepeatOnce();", + "\n", + "\n await GetStorage().InitializeReportIndependentCacheAsync();", + "\n }", + "\n ", + "\n // Data update in Storage and Report Generation", + "\n private async Task GetReportTaskAsync() {", + "\n await GetStorage().InitializeAsync(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", + "\n ", + "\n var identities = GetStorage().GetIdentities(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", + "\n var dataCube = GetScopes(identities).Aggregate().Fcf.Filter(dataFilter);", + "\n ", + "\n return report.ForDataCube(dataCube)", + "\n .WithQuerySource(workspace)", + "\n .SliceRowsBy(rowSlices)", + "\n .SliceColumnsBy(columnSlices)", + "\n .ReportGridOptions()", + "\n .ToReport();", + "\n }", + "\n", + "\n Task ToReportAsync => GetReportTaskAsync();", + "\n }" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Playground" + ] + }, + { + "cell_type": "code", + "source": [ + "var reportStorage = new ReportStorage(Workspace, Report);" + ] + }, + { + "cell_type": "code", + "source": [ + "var fcfReport = Scopes.ForSingleton().WithStorage(reportStorage).ToScope();" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ReportingNode = \"CH\";" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ShowSettings" + ] + }, + { + "cell_type": "code", + "source": [ + "(await fcfReport.ToReportAsync) with {Height = 250}" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ReportingPeriod = (2020, 12);" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ShowSettings" + ] + }, + { + "cell_type": "code", + "source": [ + "(await fcfReport.ToReportAsync) with {Height = 250}" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ReportingNode = \"G\";" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ShowSettings" + ] + }, + { + "cell_type": "code", + "source": [ + "(await fcfReport.ToReportAsync) with {Height = 250}" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ReportingPeriod = (2021, 3);" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ShowSettings" + ] + }, + { + "cell_type": "code", + "source": [ + "(await fcfReport.ToReportAsync) with {Height = 250}" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ReportingNode = \"CH\";" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.ColumnSlices = \"EconomicBasis\".RepeatOnce();" + ] + }, + { + "cell_type": "code", + "source": [ + "fcfReport.DataFilter = new [] {(\"VariableType\", \"!BOP\"), (\"VariableType\", \"!EOP\")};" + ] + }, + { + "cell_type": "code", + "source": [ + "(await fcfReport.ToReportAsync) with {Height = 500}" + ] + }, + { + "cell_type": "code", + "source": [ + "" + ] + } + ] +} \ No newline at end of file From 360bf096d8726dcb838296cb405b2b58d222fec0 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Tue, 18 Oct 2022 10:54:34 +0200 Subject: [PATCH 02/19] wip --- .../Report/Ifrs17ReportScopes.ipynb | 63 ++++++++++++------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb index 00850993..2d6b7430 100644 --- a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb +++ b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb @@ -67,6 +67,7 @@ "cell_type": "code", "source": [ "public enum ReportNames { PvReport, FcfReport}", + "\n", "\n[InitializeScope(nameof(InitAsync))]", "\npublic interface IIfrs17Report : IMutableScope {", "\n // Some infrastructure", @@ -111,13 +112,9 @@ "\n ReportingNode = (await workspace.Query().Where(x => x.Parent == null).ToArrayAsync()).First().SystemName; // TODO: change once user permissions are available", "\n Scenario = null;", "\n CurrencyType = CurrencyType.Contractual;", - "\n ", "\n ColumnSlices = \"EstimateType\".RepeatOnce();", - "\n", - "\n", "\n await GetStorage().InitializeReportIndependentCacheAsync();", "\n }", - "\n int GetNumber() => 10;", "\n public IDataCube GetDataCube() => default;", "\n ", "\n //Needs to be copy pasted", @@ -135,16 +132,14 @@ "\n", "\n Task ToReportAsync => GetReportTaskAsync();", "\n", - "\n", - "\n", "\n }", - "\npublic interface PvReport : IIfrs17Report {", + "\n public interface PvReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", "\n", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", "\n", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LockedBestEstimate.Filter(dataFilter) ;//+ GetScopes(identities).Aggregate().CurrentBestEstimateFcf.Filter(dataFilter);", - "\n ", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LockedBestEstimate.Filter(dataFilter) + GetScopes(GetIdentities()).Aggregate().CurrentBestEstimate.Filter(dataFilter);", + "\n", "\n }", "\n", "\n public interface FcfReport : IIfrs17Report {", @@ -157,7 +152,8 @@ "\n", "\n", "\n }", - "\n " + "\n ", + "\n" ] }, { @@ -169,15 +165,20 @@ "\n private Systemorph.Vertex.Scopes.Proxy.IScopeFactory Scopes {get; init;}", "\n private Systemorph.Vertex.Pivot.Reporting.IReportFactory Report {get; init;}", "\n private ReportStorage Storage {get; set;}", - "\n public PvReport PresentValues {get{", - "\n Storage = new ReportStorage(Workspace,Report);", - "\n return Scopes.ForSingleton().WithStorage(Storage).ToScope();", + "\n public Dictionary ReportsDictionary{get;init;}", + "\n public IIfrs17Report PresentValues {get{", + "\n return ReportsDictionary[ReportNames.PvReport];", + "\n }}", + "\n public IIfrs17Report Fcf {get{", + "\n return ReportsDictionary[ReportNames.FcfReport];", "\n }}", "\n public Ifrs17 (IWorkspace ws, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Reporting.IReportFactory report)", "\n {", "\n Workspace = ws; ", "\n Scopes = scopes; ", "\n Report = report; ", + "\n var ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", + "\n ReportsDictionary = Scopes.ForIdentities(ids).WithStorage(Storage).ToScopes().ToDictionary(x=>x.Identity, x => x);", "\n }", "\n}" ] @@ -191,10 +192,11 @@ { "cell_type": "code", "source": [ - " var reportStorage = new ReportStorage(Workspace, Report);", - "\n var ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", - "\n var reports = Scopes.ForIdentities(ids).WithStorage(reportStorage).ToScopes();", - "\nvar fcfReport = reports.Last();", + "var reportStorage = new ReportStorage(Workspace, Report);", + "\nvar ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", + "\nvar rd = Scopes.ForIdentities(ids).WithStorage(reportStorage).ToScopes();", + "\nrd", + "\n", "\n", "\n" ] @@ -202,13 +204,29 @@ { "cell_type": "code", "source": [ - " fcfReport.ReportingNode = \"CH\";", - "\n fcfReport.ReportingPeriod = (2020, 12);", - "\n", - "\n (await fcfReport.ToReportAsync) with {Height = 250}", + "var pvReport = rd.First();", + "\npvReport.ReportingNode = \"CH\";", + "\npvReport.ReportingPeriod = (2020, 12);", + "\n (await pvReport.ToReportAsync) with {Height = 250}", "\n" ] }, + { + "cell_type": "code", + "source": [ + "var ifrs17 = new Ifrs17(Workspace, Scopes, Report);", + "\nvar pvReport = ifrs17.PresentValues;", + "\n pvReport.ReportingNode = \"CH\";", + "\n pvReport.ReportingPeriod = (2020, 12);", + "\nifrs17.ReportsDictionary" + ] + }, + { + "cell_type": "code", + "source": [ + "pvReport" + ] + }, { "cell_type": "code", "source": [ @@ -220,9 +238,6 @@ "source": [ " var reportStorage = new ReportStorage(Workspace, Report);", "\n var pvReport = Scopes.ForSingleton().WithStorage(reportStorage).ToScope();", - "\n pvReport.ReportingNode = \"CH\";", - "\n pvReport.ReportingPeriod = (2020, 12);", - "\n (await pvReport.ToReportAsync) with {Height = 250}", "\n", "\n" ] From f7e71ba9d97ed20bb773d0f72fe4d9dd2dfba977 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Thu, 20 Oct 2022 14:03:45 +0200 Subject: [PATCH 03/19] latest --- .../Report/Ifrs17ReportScopes.ipynb | 48 ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb index 2d6b7430..da2effdd 100644 --- a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb +++ b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb @@ -195,22 +195,57 @@ "var reportStorage = new ReportStorage(Workspace, Report);", "\nvar ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", "\nvar rd = Scopes.ForIdentities(ids).WithStorage(reportStorage).ToScopes();", - "\nrd", - "\n", - "\n", + "\nvar pv = rd.First();", + "\npv.ReportingNode = \"CH\";", + "\npv.ReportingPeriod = (2020, 12);", + "\n (await pv.ToReportAsync) with {Height = 500}", "\n" ] }, { "cell_type": "code", "source": [ - "var pvReport = rd.First();", + "var fcf = rd.Last();", + "\nfcf.ReportingNode = \"CH\";", + "\nfcf.ReportingPeriod = (2020, 12);", + "\n (await fcf.ToReportAsync) with {Height = 500}", + "\n" + ] + }, + { + "cell_type": "code", + "source": [ + "var pvReport = rd.Last();", "\npvReport.ReportingNode = \"CH\";", "\npvReport.ReportingPeriod = (2020, 12);", "\n (await pvReport.ToReportAsync) with {Height = 250}", "\n" ] }, + { + "cell_type": "code", + "source": [ + "var reportStorage = new ReportStorage(Workspace, Report);", + "\nvar ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", + "\nvar rd = Scopes.ForIdentities(ids).WithStorage(reportStorage).ToScopes().ToDictionary(x=>x.Identity, x => x);", + "\nvar pv = rd[ReportNames.PvReport];", + "\npv.ReportingNode = \"CH\";", + "\npv.ReportingPeriod = (2020, 12);", + "\n (await pv.ToReportAsync) with {Height = 500}", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "source": [ + "var fcf = rd[ReportNames.FcfReport];", + "\nfcf.ReportingNode = \"CH\";", + "\nfcf.ReportingPeriod = (2020, 12);", + "\n (await fcf.ToReportAsync) with {Height = 500}", + "\n" + ] + }, { "cell_type": "code", "source": [ @@ -218,13 +253,14 @@ "\nvar pvReport = ifrs17.PresentValues;", "\n pvReport.ReportingNode = \"CH\";", "\n pvReport.ReportingPeriod = (2020, 12);", - "\nifrs17.ReportsDictionary" + "\n" ] }, { "cell_type": "code", "source": [ - "pvReport" + " (await pvReport.ToReportAsync) with {Height = 250}", + "\n" ] }, { From 1e279cd763f03afbae6d1394b4a2ec6b56b9536e Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Thu, 20 Oct 2022 18:34:54 +0200 Subject: [PATCH 04/19] add other reports --- .../Report/Ifrs17ReportScopes.ipynb | 332 ++++++++++-------- 1 file changed, 181 insertions(+), 151 deletions(-) diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb index da2effdd..5afea817 100644 --- a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb +++ b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb @@ -57,6 +57,12 @@ "\n//#!import \"ReportConfigurationAndUtils.ipynb\"" ] }, + { + "cell_type": "code", + "source": [ + "public enum ReportNames { PvReport, RaReport, WrittenReport, AccrualReport, DeferralReport, FcfReport, ExpAdjReport, TmReport, CsmReport, ActLrcReport, LrcReport, ActLicReport, LicReport, FpReport }" + ] + }, { "cell_type": "markdown", "source": [ @@ -66,17 +72,27 @@ { "cell_type": "code", "source": [ - "public enum ReportNames { PvReport, FcfReport}", - "\n", - "\n[InitializeScope(nameof(InitAsync))]", + "[InitializeScope(nameof(InitAsync))]", "\npublic interface IIfrs17Report : IMutableScope {", "\n // Some infrastructure", "\n protected IWorkspace workspace => GetStorage().Workspace;", "\n protected Systemorph.Vertex.Pivot.Reporting.IReportFactory report => GetStorage().Report;", "\n", "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>", - "\n builder.ForScope(s => s.WithApplicability(x => x.Identity == ReportNames.FcfReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.PvReport)", + "\n builder.ForScope(s => s.WithApplicability(x => x.Identity == ReportNames.PvReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.RaReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.WrittenReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.AccrualReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.DeferralReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.FcfReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.ExpAdjReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.TmReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.CsmReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.ActLrcReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.LrcReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.ActLicReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.LicReport)", + "\n .WithApplicability(x => x.Identity == ReportNames.FpReport)", "\n );", "\n", "\n ", @@ -97,10 +113,10 @@ "\n", "\n IEnumerable ColumnSlices { get; set; }", "\n protected string[] defaultColumnSlices => new string[] { };", - "\n protected string[] columnSlices => ColumnSlices is null ? defaultColumnSlices : defaultColumnSlices.Concat(ColumnSlices).ToArray();", + "\n protected string[] columnSlices => ColumnSlices is null ? defaultColumnSlices : defaultColumnSlices.Where(cs => !ColumnSlices.Contains(cs)).Concat(ColumnSlices).ToArray(); //I can't put a slice before defaultSlices !!!", "\n protected HashSet<(ReportIdentity, CurrencyType)> GetIdentities() => GetStorage().GetIdentities(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", "\n ", - "\n // Filter", + "\n // Filter - is there a problem with Filters?", "\n IEnumerable<(string filterName, string filterValue)> DataFilter { get; set; }", "\n protected (string filterName, object filterValue)[] dataFilter => (DataFilter is null ? Enumerable.Empty<(string, object)>() : DataFilter.Select(x => (x.filterName, (object)x.filterValue))).ToArray();", "\n ", @@ -112,12 +128,11 @@ "\n ReportingNode = (await workspace.Query().Where(x => x.Parent == null).ToArrayAsync()).First().SystemName; // TODO: change once user permissions are available", "\n Scenario = null;", "\n CurrencyType = CurrencyType.Contractual;", - "\n ColumnSlices = \"EstimateType\".RepeatOnce();", + "\n ColumnSlices = \"EstimateType\".RepeatOnce(); //Should this be here?", "\n await GetStorage().InitializeReportIndependentCacheAsync();", "\n }", "\n public IDataCube GetDataCube() => default;", "\n ", - "\n //Needs to be copy pasted", "\n private async Task GetReportTaskAsync() {", "\n await GetStorage().InitializeAsync(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", "\n ", @@ -131,55 +146,182 @@ "\n }", "\n", "\n Task ToReportAsync => GetReportTaskAsync();", + "\n}", "\n", - "\n }", - "\n public interface PvReport : IIfrs17Report {", + "\npublic interface PvReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LockedBestEstimate.Filter(dataFilter) + ", + "\n GetScopes(GetIdentities()).Aggregate().CurrentBestEstimate.Filter(dataFilter);", + "\n}", "\n", + "\npublic interface RaReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LockedRiskAdjustment.Filter(dataFilter) + ", + "\n GetScopes(GetIdentities()).Aggregate().CurrentRiskAdjustment.Filter(dataFilter);", + "\n}", "\n", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LockedBestEstimate.Filter(dataFilter) + GetScopes(GetIdentities()).Aggregate().CurrentBestEstimate.Filter(dataFilter);", + "\npublic interface WrittenReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"AmountType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\"};", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Written.Filter(dataFilter);", + "\n}", "\n", - "\n }", + "\npublic interface AccrualReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\"};", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Advance.Filter(dataFilter) + ", + "\n GetScopes(GetIdentities()).Aggregate().Overdue.Filter(dataFilter);", + "\n}", "\n", - "\n public interface FcfReport : IIfrs17Report {", + "\npublic interface DeferralReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Deferrals.Filter(dataFilter);", + "\n}", "\n", + "\npublic interface FcfReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\",\"VariableType\" };", - "\n", - "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType) };", - "\n", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Fcf.Filter(dataFilter);", + "\n}", "\n", - "\n", - "\n }", - "\n ", - "\n" + "\npublic interface ExpAdjReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"EstimateType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"AmountType\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().ActuarialExperienceAdjustment.Filter(dataFilter);", + "\n}", + "\npublic interface TmReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"Novelty\", \"VariableType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType) };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LrcTechnicalMargin.Filter(dataFilter);", + "\n}", + "\npublic interface CsmReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"Novelty\", \"VariableType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Csm.Filter(dataFilter) + ", + "\n GetScopes(GetIdentities()).Aggregate().Lc.Filter(dataFilter) + ", + "\n GetScopes(GetIdentities()).Aggregate().Loreco.Filter(dataFilter);", + "\n}", + "\npublic interface ActLrcReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"Novelty\",\"VariableType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LrcActuarial.Filter(dataFilter);", + "\n}", + "\npublic interface LrcReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Lrc.Filter(dataFilter);", + "\n}", + "\npublic interface ActLicReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"Novelty\",\"VariableType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LicActuarial.Filter(dataFilter);", + "\n}", + "\npublic interface LicReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Lic.Filter(dataFilter);", + "\n}", + "\npublic interface FpReport : IIfrs17Report {", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\", \"EstimateType\"};", + "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType),\"LiabilityType\" };", + "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().FinancialPerformance.Filter(dataFilter);", + "\n}" ] }, { "cell_type": "code", "source": [ - "public class Ifrs17 ", + "public class Ifrs17Reports", "\n{", "\n private IWorkspace Workspace {get; init;}", "\n private Systemorph.Vertex.Scopes.Proxy.IScopeFactory Scopes {get; init;}", "\n private Systemorph.Vertex.Pivot.Reporting.IReportFactory Report {get; init;}", "\n private ReportStorage Storage {get; set;}", - "\n public Dictionary ReportsDictionary{get;init;}", - "\n public IIfrs17Report PresentValues {get{", - "\n return ReportsDictionary[ReportNames.PvReport];", - "\n }}", - "\n public IIfrs17Report Fcf {get{", - "\n return ReportsDictionary[ReportNames.FcfReport];", - "\n }}", - "\n public Ifrs17 (IWorkspace ws, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Reporting.IReportFactory report)", + "\n ", + "\n //constructor", + "\n public Ifrs17Reports (IWorkspace ws, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Reporting.IReportFactory report)", "\n {", "\n Workspace = ws; ", "\n Scopes = scopes; ", "\n Report = report; ", - "\n var ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", - "\n ReportsDictionary = Scopes.ForIdentities(ids).WithStorage(Storage).ToScopes().ToDictionary(x=>x.Identity, x => x);", "\n }", + "\n", + "\n //public properties", + "\n //this should be BestEstimate", + "\n public IIfrs17Report PresentValues {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.PvReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report RiskAdjustments {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.RaReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report WrittenReport {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.WrittenReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report AccrualActuals {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.AccrualReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report DeferralActuals {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.DeferralReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report FulfillmentCashflows {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.FcfReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report ExperienceAdjustments {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.ExpAdjReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report TechnicalMargins {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.TmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n //What shoud this name be?", + "\n public IIfrs17Report AllocatedTechnicalMargins {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.CsmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report ActuarialLrc {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.ActLrcReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report Lrc {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.LrcReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report ActuarialLic {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.ActLicReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report Lic {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.LicReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", + "\n public IIfrs17Report FinancialPerformance {get{", + "\n Storage = new ReportStorage(Workspace, Report);", + "\n return Scopes.ForIdentities(ReportNames.FpReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n }}", + "\n", "\n}" ] }, @@ -190,133 +332,21 @@ ] }, { - "cell_type": "code", - "source": [ - "var reportStorage = new ReportStorage(Workspace, Report);", - "\nvar ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", - "\nvar rd = Scopes.ForIdentities(ids).WithStorage(reportStorage).ToScopes();", - "\nvar pv = rd.First();", - "\npv.ReportingNode = \"CH\";", - "\npv.ReportingPeriod = (2020, 12);", - "\n (await pv.ToReportAsync) with {Height = 500}", - "\n" - ] - }, - { - "cell_type": "code", + "cell_type": "markdown", "source": [ - "var fcf = rd.Last();", - "\nfcf.ReportingNode = \"CH\";", - "\nfcf.ReportingPeriod = (2020, 12);", - "\n (await fcf.ToReportAsync) with {Height = 500}", - "\n" + "## Class" ] }, { "cell_type": "code", "source": [ - "var pvReport = rd.Last();", + "var ifrs17class = new Ifrs17Reports(Workspace, Scopes, Report);", + "\nvar pvReport = ifrs17class.PresentValues;", "\npvReport.ReportingNode = \"CH\";", - "\npvReport.ReportingPeriod = (2020, 12);", - "\n (await pvReport.ToReportAsync) with {Height = 250}", - "\n" - ] - }, - { - "cell_type": "code", - "source": [ - "var reportStorage = new ReportStorage(Workspace, Report);", - "\nvar ids = new ReportNames[] {ReportNames.PvReport, ReportNames.FcfReport};", - "\nvar rd = Scopes.ForIdentities(ids).WithStorage(reportStorage).ToScopes().ToDictionary(x=>x.Identity, x => x);", - "\nvar pv = rd[ReportNames.PvReport];", - "\npv.ReportingNode = \"CH\";", - "\npv.ReportingPeriod = (2020, 12);", - "\n (await pv.ToReportAsync) with {Height = 500}", + "\npvReport.ReportingPeriod = (2021, 3);", + "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\"};", "\n", - "\n" - ] - }, - { - "cell_type": "code", - "source": [ - "var fcf = rd[ReportNames.FcfReport];", - "\nfcf.ReportingNode = \"CH\";", - "\nfcf.ReportingPeriod = (2020, 12);", - "\n (await fcf.ToReportAsync) with {Height = 500}", - "\n" - ] - }, - { - "cell_type": "code", - "source": [ - "var ifrs17 = new Ifrs17(Workspace, Scopes, Report);", - "\nvar pvReport = ifrs17.PresentValues;", - "\n pvReport.ReportingNode = \"CH\";", - "\n pvReport.ReportingPeriod = (2020, 12);", - "\n" - ] - }, - { - "cell_type": "code", - "source": [ - " (await pvReport.ToReportAsync) with {Height = 250}", - "\n" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.Last().GetNumber()" - ] - }, - { - "cell_type": "code", - "source": [ - " var reportStorage = new ReportStorage(Workspace, Report);", - "\n var pvReport = Scopes.ForSingleton().WithStorage(reportStorage).ToScope();", - "\n", - "\n" - ] - }, - { - "cell_type": "code", - "source": [ - "pvReport.GetNumber()" - ] - }, - { - "cell_type": "code", - "source": [ - "typeof(PvReport)" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport is PvReport" - ] - }, - { - "cell_type": "code", - "source": [ - "public interface Hello {", - "\n public int Number();", - "\n}", - "\npublic class Class1 : Hello {", - "\n public int Number() => 5;", - "\n}", - "\npublic class Class2 : Hello", - "\n{", - "\n public int Number() => 7;", - "\n}" - ] - }, - { - "cell_type": "code", - "source": [ - "var c1= new Class1();", - "\nvar c2 = new Class2();", - "\nc1 is Class2" + "\n(await pvReport.ToReportAsync) with {Height = 800}" ] }, { From db68f63f91d4c2d7891ee1cdb60949ade31688ba Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Fri, 21 Oct 2022 11:36:58 +0200 Subject: [PATCH 05/19] start with pv --- .../Report/Ifrs17ReportScopes.ipynb | 40 ++++++++++++++++++- full-ifrs17-template/Report/Reports.ipynb | 24 +++++++++-- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb index 5afea817..700855b7 100644 --- a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb +++ b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb @@ -331,6 +331,42 @@ "# Playground" ] }, + { + "cell_type": "code", + "source": [ + "var ifrs17 = new Ifrs17Reports(Workspace, Scopes, Report);", + "\nvar pv = ifrs17.PresentValues;", + "\npv.ReportingNode = \"CH\";", + "\npv.ReportingPeriod = (2021, 3);" + ] + }, + { + "cell_type": "code", + "source": [ + "(pv.ReportingPeriod, pv.ReportingNode, pv.Scenario, pv.CurrencyType)" + ] + }, + { + "cell_type": "code", + "source": [ + "var myStorage = new ReportStorage(Workspace, Report);", + "\nawait myStorage.InitializeReportIndependentCacheAsync();", + "\nawait myStorage.InitializeAsync((2021, 3), \"G\", null, CurrencyType.Contractual);" + ] + }, + { + "cell_type": "code", + "source": [ + "var identities = myStorage.GetIdentities((2021, 3), \"G\", null, CurrencyType.Contractual).ToArray();", + "\nidentities.First().GetType()" + ] + }, + { + "cell_type": "code", + "source": [ + "var lockedScope = (Scopes.ForIdentities(identities, myStorage).ToScope()).Aggregate.LockedBestEstimate;" + ] + }, { "cell_type": "markdown", "source": [ @@ -344,8 +380,8 @@ "\nvar pvReport = ifrs17class.PresentValues;", "\npvReport.ReportingNode = \"CH\";", "\npvReport.ReportingPeriod = (2021, 3);", - "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\"};", - "\n", + "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\", \"AmountType\"};", + "\npvReport.DataFilter = new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await pvReport.ToReportAsync) with {Height = 800}" ] }, diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index 3b99f720..c499880e 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -53,7 +53,7 @@ { "cell_type": "code", "source": [ - "//#!import \"ReportsNewWay\"" + "#!import \"Ifrs17ReportScopes\"" ] }, { @@ -111,6 +111,13 @@ "\nidentities = reportStorage.GetIdentities(Args.Period, Args.ReportingNode, Args.Scenario, Args.CurrencyType);" ] }, + { + "cell_type": "code", + "source": [ + "var ifrs17= new Ifrs17Reports(Workspace, Scopes, Report);", + "\n" + ] + }, { "cell_type": "markdown", "source": [ @@ -136,15 +143,26 @@ "\nAggregated values are displayed when the data has a finer granularity than the one selected by the report slice options." ] }, + { + "cell_type": "code", + "source": [ + "var pvReport = ifrs17.PresentValues;", + "\npvReport.ReportingNode = \"CH\";", + "\npvReport.ReportingPeriod = (2021, 3);", + "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\", \"AmountType\"};", + "\npvReport.DataFilter = new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await pvReport.ToReportAsync) with {Height = 800}" + ] + }, { "cell_type": "code", "source": [ "Report.ForDataCube((universe.GetScopes(identities).Aggregate().LockedBestEstimate + universe.GetScopes(identities).Aggregate().CurrentBestEstimate)", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", + "\n .Filter((\"GroupOfContract\", \"DT1.1\"))", "\n )", "\n .WithQuerySource(DataSource)", "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\", \"EconomicBasis\") //\"GroupOfContract\"", + "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\", \"EconomicBasis\", \"AmountType\") //\"GroupOfContract\"", "\n .ReportGridOptions()", "\n .ToReport()" ] From ad26ddd0703d7c4a2876396e464222f479265bdf Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Fri, 21 Oct 2022 18:51:39 +0200 Subject: [PATCH 06/19] filter does not work --- .../Report/Ifrs17ReportScopes.ipynb | 44 ++++----- full-ifrs17-template/Report/Reports.ipynb | 90 ++++++++++++++++++- 2 files changed, 101 insertions(+), 33 deletions(-) diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb index 700855b7..43674d0c 100644 --- a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb +++ b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb @@ -114,12 +114,12 @@ "\n IEnumerable ColumnSlices { get; set; }", "\n protected string[] defaultColumnSlices => new string[] { };", "\n protected string[] columnSlices => ColumnSlices is null ? defaultColumnSlices : defaultColumnSlices.Where(cs => !ColumnSlices.Contains(cs)).Concat(ColumnSlices).ToArray(); //I can't put a slice before defaultSlices !!!", - "\n protected HashSet<(ReportIdentity, CurrencyType)> GetIdentities() => GetStorage().GetIdentities(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", + "\n protected HashSet<(ReportIdentity, CurrencyType)> GetIdentities() => GetStorage().GetIdentities(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", "\n ", "\n // Filter - is there a problem with Filters?", "\n IEnumerable<(string filterName, string filterValue)> DataFilter { get; set; }", "\n protected (string filterName, object filterValue)[] dataFilter => (DataFilter is null ? Enumerable.Empty<(string, object)>() : DataFilter.Select(x => (x.filterName, (object)x.filterValue))).ToArray();", - "\n ", + "\n", "\n // Scope Initialization", "\n async Task InitAsync() {", "\n var mostRecentPartition = (await workspace.Query().Where(x => x.Scenario == null).OrderBy(x => x.Year).ThenBy(x => x.Month).ToArrayAsync()).Last(); ", @@ -151,8 +151,9 @@ "\npublic interface PvReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LockedBestEstimate.Filter(dataFilter) + ", - "\n GetScopes(GetIdentities()).Aggregate().CurrentBestEstimate.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? (GetScopes(GetIdentities()).Aggregate().LockedBestEstimate + GetScopes(GetIdentities()).Aggregate().CurrentBestEstimate)", + "\n : (GetScopes(GetIdentities()).Aggregate().LockedBestEstimate + GetScopes(GetIdentities()).Aggregate().CurrentBestEstimate).Filter(dataFilter);", "\n}", "\n", "\npublic interface RaReport : IIfrs17Report {", @@ -334,37 +335,22 @@ { "cell_type": "code", "source": [ - "var ifrs17 = new Ifrs17Reports(Workspace, Scopes, Report);", + "/*", + "\nvar ifrs17 = new Ifrs17Reports(Workspace, Scopes, Report);", "\nvar pv = ifrs17.PresentValues;", "\npv.ReportingNode = \"CH\";", - "\npv.ReportingPeriod = (2021, 3);" - ] - }, - { - "cell_type": "code", - "source": [ - "(pv.ReportingPeriod, pv.ReportingNode, pv.Scenario, pv.CurrencyType)" - ] - }, - { - "cell_type": "code", - "source": [ - "var myStorage = new ReportStorage(Workspace, Report);", + "\npv.ReportingPeriod = (2021, 3);", + "\nvar myStorage = new ReportStorage(Workspace, Report);", "\nawait myStorage.InitializeReportIndependentCacheAsync();", - "\nawait myStorage.InitializeAsync((2021, 3), \"G\", null, CurrencyType.Contractual);" - ] - }, - { - "cell_type": "code", - "source": [ - "var identities = myStorage.GetIdentities((2021, 3), \"G\", null, CurrencyType.Contractual).ToArray();", - "\nidentities.First().GetType()" + "\nawait myStorage.InitializeAsync((2021, 3), \"G\", null, CurrencyType.Contractual);", + "\nvar identities = myStorage.GetIdentities((2021, 3), \"G\", null, CurrencyType.Contractual).ToArray();", + "\nidentities.First().GetType()*/" ] }, { "cell_type": "code", "source": [ - "var lockedScope = (Scopes.ForIdentities(identities, myStorage).ToScope()).Aggregate.LockedBestEstimate;" + "////var lockedScope = (Scopes.ForIdentities(identities, myStorage).ToScope()).Aggregate.LockedBestEstimate;" ] }, { @@ -376,13 +362,13 @@ { "cell_type": "code", "source": [ - "var ifrs17class = new Ifrs17Reports(Workspace, Scopes, Report);", + "/*var ifrs17class = new Ifrs17Reports(Workspace, Scopes, Report);", "\nvar pvReport = ifrs17class.PresentValues;", "\npvReport.ReportingNode = \"CH\";", "\npvReport.ReportingPeriod = (2021, 3);", "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\", \"AmountType\"};", "\npvReport.DataFilter = new [] {(\"GroupOfContract\", \"DT1.1\")};", - "\n(await pvReport.ToReportAsync) with {Height = 800}" + "\n(await pvReport.ToReportAsync) with {Height = 800}*/" ] }, { diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index c499880e..a45eea4a 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -143,26 +143,51 @@ "\nAggregated values are displayed when the data has a finer granularity than the one selected by the report slice options." ] }, + { + "cell_type": "code", + "source": [ + "pvReport.GetDataCube().Where(x => x.GroupOfContract == \"DT1.2\" && x.EstimateType == \"BE\" &&", + "\nx.VariableType == \"BOP\" && x.Novelty == \"I\" && x.EconomicBasis == \"C\").Select(x => (x.ToIdentityString(), x.Value))" + ] + }, { "cell_type": "code", "source": [ "var pvReport = ifrs17.PresentValues;", "\npvReport.ReportingNode = \"CH\";", "\npvReport.ReportingPeriod = (2021, 3);", - "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\", \"AmountType\"};", - "\npvReport.DataFilter = new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\", \"AmountType\"};//\"GroupOfContract\", \"AmountType\"", + "\npvReport.DataFilter = new [] {(\"GroupOfContract\", \"DT1.2\"),(\"LiabilityType\", \"LIC\") };// new [] {(\"GroupOfContract\", \"DT1.2\")};// {(\"LiabilityType\", \"LIC\")};//{(\"GroupOfContract\", \"DT1.1\")};", + "\n//pvReport.DataFilter = null; ", "\n(await pvReport.ToReportAsync) with {Height = 800}" ] }, + { + "cell_type": "code", + "source": [ + "pvReport.DataFilter" + ] + }, + { + "cell_type": "code", + "source": [ + "(universe.GetScopes(identities).Aggregate().LockedBestEstimate + universe.GetScopes(identities).Aggregate().CurrentBestEstimate)", + "\n//.Where(x => x.GroupOfContract == \"DT1.2\" && x.EstimateType == \"BE\" &&", + "\n//x.VariableType == \"BOP\" && x.Novelty == \"I\" && x.EconomicBasis == \"C\")", + "\n//.ToDataCube()", + "\n.Filter(pvReport.DataFilter)", + "\n" + ] + }, { "cell_type": "code", "source": [ "Report.ForDataCube((universe.GetScopes(identities).Aggregate().LockedBestEstimate + universe.GetScopes(identities).Aggregate().CurrentBestEstimate)", - "\n .Filter((\"GroupOfContract\", \"DT1.1\"))", + "\n //.Filter((\"GroupOfContract\", \"DT1.2\"))", "\n )", "\n .WithQuerySource(DataSource)", "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\", \"EconomicBasis\", \"AmountType\") //\"GroupOfContract\"", + "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\", \"EconomicBasis\") //\"GroupOfContract\"", "\n .ReportGridOptions()", "\n .ToReport()" ] @@ -173,6 +198,52 @@ "# Risk Adjustment" ] }, + { + "cell_type": "code", + "source": [ + "var ifrsVariables = new []{new IfrsVariable{AocType = \"BOP\"},", + "\nnew IfrsVariable{AocType = \"EOP\"},", + "\n};", + "\n", + "\n", + "\nIEnumerable<(string filterName, string filterValue)> DataFilter = null;//new [] {(\"AocType\", \"EOP\")}; //null", + "\n(string filterName, object filterValue)[] dataFilter => (DataFilter is null ? Enumerable.Empty<(string, object)>() : DataFilter.Select(x => (x.filterName, (object)x.filterValue))).ToArray();", + "\n", + "\ndataFilter" + ] + }, + { + "cell_type": "code", + "source": [ + "ifrsVariables.ToDataCube().Filter(dataFilter)" + ] + }, + { + "cell_type": "code", + "source": [ + "raReport.GetDataCube().Where(x => x.GroupOfContract == \"DT1.2\" && x.EstimateType == \"RA\" &&", + "\nx.VariableType == \"BOP\" && x.Novelty == \"I\" && x.EconomicBasis == \"C\").Select(x => (x.ToIdentityString(), x.Value))" + ] + }, + { + "cell_type": "code", + "source": [ + "var raReport = ifrs17.RiskAdjustments;", + "\nraReport.ReportingNode = \"CH\";", + "\nraReport.ReportingPeriod = (2021, 3);", + "\nraReport.ColumnSlices = new string[]{\"GroupOfContract\"};//\"GroupOfContract\", \"AmountType\"", + "\nraReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.2\")};", + "\n(await raReport.ToReportAsync) with {Height = 800}" + ] + }, + { + "cell_type": "code", + "source": [ + "(universe.GetScopes(identities).Aggregate().LockedRiskAdjustment + universe.GetScopes(identities).Aggregate().CurrentRiskAdjustment)", + "\n.Where(x => x.GroupOfContract == \"DT1.2\" && x.EstimateType == \"RA\" &&", + "\nx.VariableType == \"BOP\" && x.Novelty == \"I\" && x.EconomicBasis == \"C\").Select(x => (x.ToIdentityString(), x.Value))" + ] + }, { "cell_type": "code", "source": [ @@ -192,6 +263,17 @@ "# Actuals" ] }, + { + "cell_type": "code", + "source": [ + "var raReport = ifrs17.RiskAdjustments;", + "\nraReport.ReportingNode = \"CH\";", + "\nraReport.ReportingPeriod = (2021, 3);", + "\nraReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nraReport.DataFilter = null;//new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await raReport.ToReportAsync) with {Height = 800}" + ] + }, { "cell_type": "code", "source": [ From 75f6dea8adf108458681273fb89d92ed0a2af12a Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Mon, 24 Oct 2022 10:07:05 +0200 Subject: [PATCH 07/19] clean up --- ifrs17/DataModel/DataStructure.ipynb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ifrs17/DataModel/DataStructure.ipynb b/ifrs17/DataModel/DataStructure.ipynb index f5fcf571..a6964f96 100644 --- a/ifrs17/DataModel/DataStructure.ipynb +++ b/ifrs17/DataModel/DataStructure.ipynb @@ -1055,15 +1055,6 @@ "\n- OCI Type" ] }, - { - "cell_type": "markdown", - "source": [ - "TODOs:", - "\n
    ", - "\n
  • Remove Scenario from Partition and include it as simple property (see Year, Month). Introduce concept of Priority in LoadCurrentAndPreviousParameterAsync query (see ParameterResultsEntityQueryExtensions in IfrsGeneric).
  • ", - "\n
" - ] - }, { "cell_type": "code", "source": [ From c87311955065d5c861441dd6810b0651980b2a2f Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Tue, 25 Oct 2022 16:02:53 +0200 Subject: [PATCH 08/19] clean up reports --- .../Files/DimensionsAndPartitions.csv | 3 - .../Report/Ifrs17ReportScopes.ipynb | 66 +++-- full-ifrs17-template/Report/Reports.ipynb | 253 ++++-------------- 3 files changed, 105 insertions(+), 217 deletions(-) diff --git a/full-ifrs17-template/Files/DimensionsAndPartitions.csv b/full-ifrs17-template/Files/DimensionsAndPartitions.csv index bcfe9d1d..4f648680 100644 --- a/full-ifrs17-template/Files/DimensionsAndPartitions.csv +++ b/full-ifrs17-template/Files/DimensionsAndPartitions.csv @@ -228,9 +228,6 @@ CH,00000000-0000-0000-0000-000000000001,,,,,,,,,, ReportingNode,Year,Month,Id,,,,,,,, CH,2020,12,10000000-0000-0000-0000-000000000000,,,,,,,, CH,2021,3,20000000-0000-0000-0000-000000000000,,,,,,,, -CH,2021,9,30000000-0000-0000-0000-000000000000,,,,,,,, -CH,2021,12,35000000-0000-0000-0000-000000000000,,,,,,,, -CH,2022,3,40000000-0000-0000-0000-000000000000,,,,,,,, ,,,,,,,,,,, @@ProjectionConfiguration,,,,,,,,,,, SystemName,DisplayName,Shift,TimeStep,,,,,,,, diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb index 43674d0c..52b140f8 100644 --- a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb +++ b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb @@ -116,7 +116,7 @@ "\n protected string[] columnSlices => ColumnSlices is null ? defaultColumnSlices : defaultColumnSlices.Where(cs => !ColumnSlices.Contains(cs)).Concat(ColumnSlices).ToArray(); //I can't put a slice before defaultSlices !!!", "\n protected HashSet<(ReportIdentity, CurrencyType)> GetIdentities() => GetStorage().GetIdentities(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", "\n ", - "\n // Filter - is there a problem with Filters?", + "\n // Filter", "\n IEnumerable<(string filterName, string filterValue)> DataFilter { get; set; }", "\n protected (string filterName, object filterValue)[] dataFilter => (DataFilter is null ? Enumerable.Empty<(string, object)>() : DataFilter.Select(x => (x.filterName, (object)x.filterValue))).ToArray();", "\n", @@ -128,7 +128,6 @@ "\n ReportingNode = (await workspace.Query().Where(x => x.Parent == null).ToArrayAsync()).First().SystemName; // TODO: change once user permissions are available", "\n Scenario = null;", "\n CurrencyType = CurrencyType.Contractual;", - "\n ColumnSlices = \"EstimateType\".RepeatOnce(); //Should this be here?", "\n await GetStorage().InitializeReportIndependentCacheAsync();", "\n }", "\n public IDataCube GetDataCube() => default;", @@ -136,7 +135,6 @@ "\n private async Task GetReportTaskAsync() {", "\n await GetStorage().InitializeAsync(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", "\n ", - "\n ", "\n return report.ForDataCube(GetDataCube())", "\n .WithQuerySource(workspace)", "\n .SliceRowsBy(rowSlices)", @@ -149,7 +147,7 @@ "\n}", "\n", "\npublic interface PvReport : IIfrs17Report {", - "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", "\n ? (GetScopes(GetIdentities()).Aggregate().LockedBestEstimate + GetScopes(GetIdentities()).Aggregate().CurrentBestEstimate)", @@ -157,78 +155,108 @@ "\n}", "\n", "\npublic interface RaReport : IIfrs17Report {", - "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", + "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LockedRiskAdjustment.Filter(dataFilter) + ", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().LockedRiskAdjustment + ", + "\n GetScopes(GetIdentities()).Aggregate().CurrentRiskAdjustment", + "\n : GetScopes(GetIdentities()).Aggregate().LockedRiskAdjustment.Filter(dataFilter) + ", "\n GetScopes(GetIdentities()).Aggregate().CurrentRiskAdjustment.Filter(dataFilter);", "\n}", "\n", "\npublic interface WrittenReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"AmountType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\"};", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Written.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().Written", + "\n : GetScopes(GetIdentities()).Aggregate().Written.Filter(dataFilter);", "\n}", "\n", "\npublic interface AccrualReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\"};", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Advance.Filter(dataFilter) + ", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().Advance + ", + "\n GetScopes(GetIdentities()).Aggregate().Overdue", + "\n : GetScopes(GetIdentities()).Aggregate().Advance.Filter(dataFilter) + ", "\n GetScopes(GetIdentities()).Aggregate().Overdue.Filter(dataFilter);", "\n}", "\n", "\npublic interface DeferralReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Deferrals.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().Deferrals", + "\n : GetScopes(GetIdentities()).Aggregate().Deferrals.Filter(dataFilter);", "\n}", "\n", "\npublic interface FcfReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] { \"Novelty\",\"VariableType\" };", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"LiabilityType\", \"EconomicBasis\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Fcf.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().Fcf", + "\n : GetScopes(GetIdentities()).Aggregate().Fcf.Filter(dataFilter);", "\n}", "\n", "\npublic interface ExpAdjReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"EstimateType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"AmountType\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().ActuarialExperienceAdjustment.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().ActuarialExperienceAdjustment", + "\n : GetScopes(GetIdentities()).Aggregate().ActuarialExperienceAdjustment.Filter(dataFilter);", "\n}", "\npublic interface TmReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"Novelty\", \"VariableType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType) };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LrcTechnicalMargin.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().LrcTechnicalMargin", + "\n : GetScopes(GetIdentities()).Aggregate().LrcTechnicalMargin.Filter(dataFilter);", "\n}", "\npublic interface CsmReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"Novelty\", \"VariableType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Csm.Filter(dataFilter) + ", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().Csm + ", + "\n GetScopes(GetIdentities()).Aggregate().Lc + ", + "\n GetScopes(GetIdentities()).Aggregate().Loreco", + "\n : GetScopes(GetIdentities()).Aggregate().Csm.Filter(dataFilter) + ", "\n GetScopes(GetIdentities()).Aggregate().Lc.Filter(dataFilter) + ", "\n GetScopes(GetIdentities()).Aggregate().Loreco.Filter(dataFilter);", "\n}", "\npublic interface ActLrcReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"Novelty\",\"VariableType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LrcActuarial.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().LrcActuarial", + "\n : GetScopes(GetIdentities()).Aggregate().LrcActuarial.Filter(dataFilter);", "\n}", "\npublic interface LrcReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Lrc.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().Lrc", + "\n : GetScopes(GetIdentities()).Aggregate().Lrc.Filter(dataFilter);", "\n}", "\npublic interface ActLicReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"Novelty\",\"VariableType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().LicActuarial.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().LicActuarial", + "\n : GetScopes(GetIdentities()).Aggregate().LicActuarial.Filter(dataFilter);", "\n}", "\npublic interface LicReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType), \"EstimateType\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().Lic.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().Lic", + "\n : GetScopes(GetIdentities()).Aggregate().Lic.Filter(dataFilter);", "\n}", "\npublic interface FpReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\", \"EstimateType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType),\"LiabilityType\" };", - "\n IDataCube IIfrs17Report.GetDataCube() => GetScopes(GetIdentities()).Aggregate().FinancialPerformance.Filter(dataFilter);", + "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", + "\n ? GetScopes(GetIdentities()).Aggregate().FinancialPerformance", + "\n : GetScopes(GetIdentities()).Aggregate().FinancialPerformance.Filter(dataFilter);", "\n}" ] }, @@ -262,7 +290,7 @@ "\n return Scopes.ForIdentities(ReportNames.RaReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", "\n }}", "\n", - "\n public IIfrs17Report WrittenReport {get{", + "\n public IIfrs17Report WrittenActuals {get{", "\n Storage = new ReportStorage(Workspace, Report);", "\n return Scopes.ForIdentities(ReportNames.WrittenReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", "\n }}", diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index a45eea4a..735b9b1c 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -114,8 +114,7 @@ { "cell_type": "code", "source": [ - "var ifrs17= new Ifrs17Reports(Workspace, Scopes, Report);", - "\n" + "var ifrs17 = new Ifrs17Reports(Workspace, Scopes, Report);" ] }, { @@ -143,120 +142,30 @@ "\nAggregated values are displayed when the data has a finer granularity than the one selected by the report slice options." ] }, - { - "cell_type": "code", - "source": [ - "pvReport.GetDataCube().Where(x => x.GroupOfContract == \"DT1.2\" && x.EstimateType == \"BE\" &&", - "\nx.VariableType == \"BOP\" && x.Novelty == \"I\" && x.EconomicBasis == \"C\").Select(x => (x.ToIdentityString(), x.Value))" - ] - }, { "cell_type": "code", "source": [ "var pvReport = ifrs17.PresentValues;", - "\npvReport.ReportingNode = \"CH\";", - "\npvReport.ReportingPeriod = (2021, 3);", - "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\", \"AmountType\"};//\"GroupOfContract\", \"AmountType\"", - "\npvReport.DataFilter = new [] {(\"GroupOfContract\", \"DT1.2\"),(\"LiabilityType\", \"LIC\") };// new [] {(\"GroupOfContract\", \"DT1.2\")};// {(\"LiabilityType\", \"LIC\")};//{(\"GroupOfContract\", \"DT1.1\")};", - "\n//pvReport.DataFilter = null; ", + "\npvReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\npvReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.2\"),(\"LiabilityType\", \"LIC\") }", "\n(await pvReport.ToReportAsync) with {Height = 800}" ] }, - { - "cell_type": "code", - "source": [ - "pvReport.DataFilter" - ] - }, - { - "cell_type": "code", - "source": [ - "(universe.GetScopes(identities).Aggregate().LockedBestEstimate + universe.GetScopes(identities).Aggregate().CurrentBestEstimate)", - "\n//.Where(x => x.GroupOfContract == \"DT1.2\" && x.EstimateType == \"BE\" &&", - "\n//x.VariableType == \"BOP\" && x.Novelty == \"I\" && x.EconomicBasis == \"C\")", - "\n//.ToDataCube()", - "\n.Filter(pvReport.DataFilter)", - "\n" - ] - }, - { - "cell_type": "code", - "source": [ - "Report.ForDataCube((universe.GetScopes(identities).Aggregate().LockedBestEstimate + universe.GetScopes(identities).Aggregate().CurrentBestEstimate)", - "\n //.Filter((\"GroupOfContract\", \"DT1.2\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\", \"EconomicBasis\") //\"GroupOfContract\"", - "\n .ReportGridOptions()", - "\n .ToReport()" - ] - }, { "cell_type": "markdown", "source": [ "# Risk Adjustment" ] }, - { - "cell_type": "code", - "source": [ - "var ifrsVariables = new []{new IfrsVariable{AocType = \"BOP\"},", - "\nnew IfrsVariable{AocType = \"EOP\"},", - "\n};", - "\n", - "\n", - "\nIEnumerable<(string filterName, string filterValue)> DataFilter = null;//new [] {(\"AocType\", \"EOP\")}; //null", - "\n(string filterName, object filterValue)[] dataFilter => (DataFilter is null ? Enumerable.Empty<(string, object)>() : DataFilter.Select(x => (x.filterName, (object)x.filterValue))).ToArray();", - "\n", - "\ndataFilter" - ] - }, - { - "cell_type": "code", - "source": [ - "ifrsVariables.ToDataCube().Filter(dataFilter)" - ] - }, - { - "cell_type": "code", - "source": [ - "raReport.GetDataCube().Where(x => x.GroupOfContract == \"DT1.2\" && x.EstimateType == \"RA\" &&", - "\nx.VariableType == \"BOP\" && x.Novelty == \"I\" && x.EconomicBasis == \"C\").Select(x => (x.ToIdentityString(), x.Value))" - ] - }, { "cell_type": "code", "source": [ "var raReport = ifrs17.RiskAdjustments;", - "\nraReport.ReportingNode = \"CH\";", - "\nraReport.ReportingPeriod = (2021, 3);", - "\nraReport.ColumnSlices = new string[]{\"GroupOfContract\"};//\"GroupOfContract\", \"AmountType\"", - "\nraReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.2\")};", + "\nraReport.ColumnSlices = new string[]{};//\"GroupOfContract\"", + "\nraReport.DataFilter = null;//new [] {(\"GroupOfContract\", \"DT1.2\")};", "\n(await raReport.ToReportAsync) with {Height = 800}" ] }, - { - "cell_type": "code", - "source": [ - "(universe.GetScopes(identities).Aggregate().LockedRiskAdjustment + universe.GetScopes(identities).Aggregate().CurrentRiskAdjustment)", - "\n.Where(x => x.GroupOfContract == \"DT1.2\" && x.EstimateType == \"RA\" &&", - "\nx.VariableType == \"BOP\" && x.Novelty == \"I\" && x.EconomicBasis == \"C\").Select(x => (x.ToIdentityString(), x.Value))" - ] - }, - { - "cell_type": "code", - "source": [ - "Report.ForDataCube((universe.GetScopes(identities).Aggregate().LockedRiskAdjustment + universe.GetScopes(identities).Aggregate().CurrentRiskAdjustment)", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"EconomicBasis\", \"LiabilityType\",\"GroupOfContract\")", - "\n .ReportGridOptions()", - "\n .ToReport()" - ] - }, { "cell_type": "markdown", "source": [ @@ -266,25 +175,10 @@ { "cell_type": "code", "source": [ - "var raReport = ifrs17.RiskAdjustments;", - "\nraReport.ReportingNode = \"CH\";", - "\nraReport.ReportingPeriod = (2021, 3);", - "\nraReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", - "\nraReport.DataFilter = null;//new [] {(\"GroupOfContract\", \"DT1.1\")};", - "\n(await raReport.ToReportAsync) with {Height = 800}" - ] - }, - { - "cell_type": "code", - "source": [ - "Report.ForDataCube(universe.GetScopes(identities).Aggregate().Written", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"AmountType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\",\"GroupOfContract\")", - "\n .ReportGridOptions(reportHeight: 450)", - "\n .ToReport()" + "var writtenActualReport = ifrs17.WrittenActuals;", + "\nwrittenActualReport.ColumnSlices = new string[]{};//\"GroupOfContract\"", + "\nwrittenActualReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await writtenActualReport.ToReportAsync) with {Height = 400}" ] }, { @@ -296,14 +190,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube((universe.GetScopes(identities).Aggregate().Advance + universe.GetScopes(identities).Aggregate().Overdue)", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\",\"GroupOfContract\", \"EstimateType\")", - "\n .ReportGridOptions(reportHeight: 400)", - "\n .ToReport()" + "var accrualActualReport = ifrs17.AccrualActuals;", + "\naccrualActualReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\naccrualActualReport.DataFilter = null;//new [] {(\"GroupOfContract\", \"DT2.1\")};", + "\n(await accrualActualReport.ToReportAsync) with {Height = 400}" ] }, { @@ -315,14 +205,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube(universe.GetScopes(identities).Aggregate().Deferrals", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\",\"GroupOfContract\")", - "\n .ReportGridOptions(reportHeight: 400)", - "\n .ToReport()" + "var deferrableActualReport = ifrs17.DeferralActuals;", + "\ndeferrableActualReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\ndeferrableActualReport.DataFilter = null;//new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await deferrableActualReport.ToReportAsync) with {Height = 400}" ] }, { @@ -334,14 +220,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube(universe.GetScopes(identities).Aggregate().Fcf ", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\",\"GroupOfContract\", \"EconomicBasis\")//, \"EstimateType\")//, \"AmountType\")", - "\n .ReportGridOptions()", - "\n .ToReport()" + "var fulfillmentCashflowsReport = ifrs17.FulfillmentCashflows;", + "\nfulfillmentCashflowsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nfulfillmentCashflowsReport.DataFilter = null;// new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await fulfillmentCashflowsReport.ToReportAsync) with {Height = 750}" ] }, { @@ -353,14 +235,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube(universe.GetScopes(identities).Aggregate().ActuarialExperienceAdjustment", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"EstimateType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"GroupOfContract\", \"AmountType\" )//\"LiabilityType\", \"EstimateType\")", - "\n .ReportGridOptions(reportHeight: 300, headerColumnWidth: 300)", - "\n .ToReport() " + "var experienceAdjustmentsReport = ifrs17.ExperienceAdjustments;", + "\nexperienceAdjustmentsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nexperienceAdjustmentsReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await experienceAdjustmentsReport.ToReportAsync) with {Height = 300}" ] }, { @@ -372,14 +250,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube(universe.GetScopes(identities).Aggregate().LrcTechnicalMargin", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"GroupOfContract\")", - "\n .ReportGridOptions(reportHeight: 600)", - "\n .ToReport()" + "var technicalMarginsReport = ifrs17.TechnicalMargins;", + "\ntechnicalMarginsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\ntechnicalMarginsReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await technicalMarginsReport.ToReportAsync) with {Height = 600}" ] }, { @@ -391,14 +265,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube((universe.GetScopes(identities).Aggregate().Csm + universe.GetScopes(identities).Aggregate().Lc + universe.GetScopes(identities).Aggregate().Loreco)", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"GroupOfContract\", \"EstimateType\")", - "\n .ReportGridOptions()", - "\n .ToReport()" + "var allocatedTechnicalMarginsReport = ifrs17.AllocatedTechnicalMargins;", + "\nallocatedTechnicalMarginsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nallocatedTechnicalMarginsReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await allocatedTechnicalMarginsReport.ToReportAsync) with {Height = 700}" ] }, { @@ -410,14 +280,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube((universe.GetScopes(identities).Aggregate().LrcActuarial)", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), /*\"LiabilityType\",\"GroupOfContract\",*/ \"EstimateType\")", - "\n .ReportGridOptions()", - "\n .ToReport()" + "var actuarialLrcReport = ifrs17.ActuarialLrc;", + "\nactuarialLrcReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nactuarialLrcReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await actuarialLrcReport.ToReportAsync) with {Height = 750}" ] }, { @@ -429,14 +295,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube((universe.GetScopes(identities).Aggregate().Lrc)", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType),\"GroupOfContract\", \"EstimateType\")", - "\n .ReportGridOptions(300)", - "\n .ToReport()" + "var lrcReport = ifrs17.Lrc;", + "\nlrcReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nlrcReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await lrcReport.ToReportAsync) with {Height = 250}" ] }, { @@ -448,14 +310,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube((universe.GetScopes(identities).Aggregate().LicActuarial)", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"Novelty\",\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), /*\"GroupOfContract\",*/ \"EstimateType\")", - "\n .ReportGridOptions()", - "\n .ToReport()" + "var actuarialLicReport = ifrs17.ActuarialLic;", + "\nactuarialLicReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nactuarialLicReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await actuarialLicReport.ToReportAsync) with {Height = 750}" ] }, { @@ -467,14 +325,10 @@ { "cell_type": "code", "source": [ - "Report.ForDataCube((universe.GetScopes(identities).Aggregate().Lic)", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"VariableType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), /*\"GroupOfContract\",*/ \"EstimateType\")", - "\n .ReportGridOptions(300)", - "\n .ToReport()" + "var licReport = ifrs17.Lic;", + "\nlicReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nlicReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await licReport.ToReportAsync) with {Height = 250}" ] }, { @@ -485,6 +339,15 @@ "\nUse the expand and collapse buttons in the report rows to change the granularity of the figures displayed." ] }, + { + "cell_type": "code", + "source": [ + "var financialPerformanceReport = ifrs17.FinancialPerformance;", + "\nfinancialPerformanceReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nfinancialPerformanceReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\n(await financialPerformanceReport.ToReportAsync) with { Height = 900, GroupDefaultExpanded = 3 }" + ] + }, { "cell_type": "code", "source": [ From 78154da99966b21d8e48e5cd7d7afd8e8973bdee Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Tue, 25 Oct 2022 16:54:34 +0200 Subject: [PATCH 09/19] clean up --- .../Report/Ifrs17ReportScopes.ipynb | 65 ++--------------- full-ifrs17-template/Report/Reports.ipynb | 71 ++----------------- 2 files changed, 8 insertions(+), 128 deletions(-) diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb index 52b140f8..4dc77d9a 100644 --- a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb +++ b/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb @@ -32,10 +32,7 @@ { "cell_type": "code", "source": [ - "/* Systemorph set of dimensions + mockdata are dispatched to the unconfigured in-memory DataSource */", - "\n#!eval-notebook \"../Initialization/InitSystemorphToMemory\"", - "\n/* DataSource is configured and connected to real database */", - "\n//#!eval-notebook \"../Database/Configure.ipynb\"" + "#!eval-notebook \"../Initialization/InitSystemorphToMemory\"" ] }, { @@ -50,13 +47,6 @@ "## Import Dependencies" ] }, - { - "cell_type": "code", - "source": [ - "//#!import \"ReportScopes.ipynb\"", - "\n//#!import \"ReportConfigurationAndUtils.ipynb\"" - ] - }, { "cell_type": "code", "source": [ @@ -131,7 +121,7 @@ "\n await GetStorage().InitializeReportIndependentCacheAsync();", "\n }", "\n public IDataCube GetDataCube() => default;", - "\n ", + "\n protected int headerColumnWidthValue => 200;", "\n private async Task GetReportTaskAsync() {", "\n await GetStorage().InitializeAsync(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", "\n ", @@ -139,7 +129,7 @@ "\n .WithQuerySource(workspace)", "\n .SliceRowsBy(rowSlices)", "\n .SliceColumnsBy(columnSlices)", - "\n .ReportGridOptions()", + "\n .ReportGridOptions(headerColumnWidth: headerColumnWidthValue)", "\n .ToReport();", "\n }", "\n", @@ -254,6 +244,7 @@ "\npublic interface FpReport : IIfrs17Report {", "\n string[] IIfrs17Report.defaultRowSlices => new string[] {\"VariableType\", \"EstimateType\"};", "\n string[] IIfrs17Report.defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType),\"LiabilityType\" };", + "\n int IIfrs17Report.headerColumnWidthValue => 500;", "\n IDataCube IIfrs17Report.GetDataCube() => DataFilter == null ", "\n ? GetScopes(GetIdentities()).Aggregate().FinancialPerformance", "\n : GetScopes(GetIdentities()).Aggregate().FinancialPerformance.Filter(dataFilter);", @@ -278,8 +269,6 @@ "\n Report = report; ", "\n }", "\n", - "\n //public properties", - "\n //this should be BestEstimate", "\n public IIfrs17Report PresentValues {get{", "\n Storage = new ReportStorage(Workspace, Report);", "\n return Scopes.ForIdentities(ReportNames.PvReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", @@ -320,7 +309,6 @@ "\n return Scopes.ForIdentities(ReportNames.TmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", "\n }}", "\n", - "\n //What shoud this name be?", "\n public IIfrs17Report AllocatedTechnicalMargins {get{", "\n Storage = new ReportStorage(Workspace, Report);", "\n return Scopes.ForIdentities(ReportNames.CsmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", @@ -354,51 +342,6 @@ "\n}" ] }, - { - "cell_type": "markdown", - "source": [ - "# Playground" - ] - }, - { - "cell_type": "code", - "source": [ - "/*", - "\nvar ifrs17 = new Ifrs17Reports(Workspace, Scopes, Report);", - "\nvar pv = ifrs17.PresentValues;", - "\npv.ReportingNode = \"CH\";", - "\npv.ReportingPeriod = (2021, 3);", - "\nvar myStorage = new ReportStorage(Workspace, Report);", - "\nawait myStorage.InitializeReportIndependentCacheAsync();", - "\nawait myStorage.InitializeAsync((2021, 3), \"G\", null, CurrencyType.Contractual);", - "\nvar identities = myStorage.GetIdentities((2021, 3), \"G\", null, CurrencyType.Contractual).ToArray();", - "\nidentities.First().GetType()*/" - ] - }, - { - "cell_type": "code", - "source": [ - "////var lockedScope = (Scopes.ForIdentities(identities, myStorage).ToScope()).Aggregate.LockedBestEstimate;" - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Class" - ] - }, - { - "cell_type": "code", - "source": [ - "/*var ifrs17class = new Ifrs17Reports(Workspace, Scopes, Report);", - "\nvar pvReport = ifrs17class.PresentValues;", - "\npvReport.ReportingNode = \"CH\";", - "\npvReport.ReportingPeriod = (2021, 3);", - "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\", \"AmountType\"};", - "\npvReport.DataFilter = new [] {(\"GroupOfContract\", \"DT1.1\")};", - "\n(await pvReport.ToReportAsync) with {Height = 800}*/" - ] - }, { "cell_type": "code", "source": [ diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index 735b9b1c..15d7779a 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -37,13 +37,6 @@ "## Initialize data" ] }, - { - "cell_type": "code", - "source": [ - "/* DataSource is configured and connected to real database */", - "\n//#!eval-notebook \"../Database/Configure\"" - ] - }, { "cell_type": "code", "source": [ @@ -62,55 +55,12 @@ "Workspace.InitializeFrom(DataSource);" ] }, - { - "cell_type": "markdown", - "source": [ - "## Imports and Configurations" - ] - }, - { - "cell_type": "code", - "source": [ - "var reportStorage = new ReportStorage(Workspace, Report);", - "\nawait reportStorage.InitializeReportIndependentCacheAsync();", - "\nvar mostRecentPartition = (await Workspace.Query().Where(x => x.Scenario == null).OrderBy(x => x.Year).ThenBy(x => x.Month).ToArrayAsync()).Last();", - "\nvar reportingNodeRoot = (await Workspace.Query().Where(x => x.Parent == null).ToArrayAsync()).First().SystemName;", - "\nawait reportStorage.InitializeAsync((mostRecentPartition.Year, mostRecentPartition.Month), reportingNodeRoot, null, CurrencyType.Contractual);", - "\nvar identities = reportStorage.GetIdentities((mostRecentPartition.Year, mostRecentPartition.Month), reportingNodeRoot, null, CurrencyType.Contractual);" - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Calling Scope" - ] - }, - { - "cell_type": "code", - "source": [ - "var universe = Scopes.ForSingleton().WithStorage(reportStorage).ToScope();" - ] - }, { "cell_type": "markdown", "source": [ "# Report Settings and Storage Update" ] }, - { - "cell_type": "code", - "source": [ - "((int Year, int Month) Period, string ReportingNode, string Scenario, CurrencyType CurrencyType) Args =", - "\n //((2020, 12), reportingNodeRoot, null,CurrencyType.Contractual)", - "\n ((2021, 3), reportingNodeRoot, null,CurrencyType.Contractual)", - "\n //((2021, 3), reportingNodeRoot, null,CurrencyType.Functional)", - "\n //((2021, 3), reportingNodeRoot, null,CurrencyType.Group)", - "\n ;", - "\n", - "\nawait reportStorage.InitializeAsync(Args.Period, Args.ReportingNode, Args.Scenario, Args.CurrencyType);", - "\nidentities = reportStorage.GetIdentities(Args.Period, Args.ReportingNode, Args.Scenario, Args.CurrencyType);" - ] - }, { "cell_type": "code", "source": [ @@ -146,9 +96,9 @@ "cell_type": "code", "source": [ "var pvReport = ifrs17.PresentValues;", - "\npvReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\"};//\"GroupOfContract\", \"AmountType\"", "\npvReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.2\"),(\"LiabilityType\", \"LIC\") }", - "\n(await pvReport.ToReportAsync) with {Height = 800}" + "\n(await pvReport.ToReportAsync) with {Height = 720}" ] }, { @@ -343,22 +293,9 @@ "cell_type": "code", "source": [ "var financialPerformanceReport = ifrs17.FinancialPerformance;", - "\nfinancialPerformanceReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nfinancialPerformanceReport.ColumnSlices = new string[]{};//\"GroupOfContract\"", "\nfinancialPerformanceReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", - "\n(await financialPerformanceReport.ToReportAsync) with { Height = 900, GroupDefaultExpanded = 3 }" - ] - }, - { - "cell_type": "code", - "source": [ - "Report.ForDataCube(universe.GetScopes(identities).Aggregate().FinancialPerformance", - "\n //.Filter((\"GroupOfContract\", \"DT1.1\"))", - "\n )", - "\n .WithQuerySource(DataSource)", - "\n .SliceRowsBy(\"VariableType\", \"EstimateType\")", - "\n .SliceColumnsBy(CurrencyGrouper(Args.CurrencyType), \"LiabilityType\",\"GroupOfContract\")", - "\n .ReportGridOptions(reportHeight: 900, headerColumnWidth: 500, groupDefaultExpanded: 3)", - "\n .ToReport()" + "\n(await financialPerformanceReport.ToReportAsync) with { Height = 900, GroupDefaultExpanded = 3}" ] }, { From 6773e20701e5cbbd7fb87326ebbf90798545ca46 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Tue, 25 Oct 2022 16:59:56 +0200 Subject: [PATCH 10/19] typo --- full-ifrs17-template/Test/SpecificationsSetup.ipynb | 2 +- .../Test/SpecificationsTechnicalMargin.ipynb | 10 +++++----- ifrs17/Import/ImportScopeCalculation.ipynb | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/full-ifrs17-template/Test/SpecificationsSetup.ipynb b/full-ifrs17-template/Test/SpecificationsSetup.ipynb index 335f1ca3..b9f1e2f4 100644 --- a/full-ifrs17-template/Test/SpecificationsSetup.ipynb +++ b/full-ifrs17-template/Test/SpecificationsSetup.ipynb @@ -90,7 +90,7 @@ "\n Value = scope.Value,", "\n Partition = scope.GetStorage().TargetPartition };", "\n", - "\npublic static IfrsVariable FromCsmToIfrsVariable(this ContractualServiceMaring scope)", + "\npublic static IfrsVariable FromCsmToIfrsVariable(this ContractualServiceMargin scope)", "\n => new IfrsVariable{ EstimateType = scope.EstimateType, ", "\n DataNode = scope.Identity.DataNode, ", "\n AocType = scope.Identity.AocType, ", diff --git a/full-ifrs17-template/Test/SpecificationsTechnicalMargin.ipynb b/full-ifrs17-template/Test/SpecificationsTechnicalMargin.ipynb index 43191eec..f8cc0f73 100644 --- a/full-ifrs17-template/Test/SpecificationsTechnicalMargin.ipynb +++ b/full-ifrs17-template/Test/SpecificationsTechnicalMargin.ipynb @@ -1121,7 +1121,7 @@ { "cell_type": "code", "source": [ - "var computedCSM_BoP_I = Test.GetScope(id_BoP_I).Value;", + "var computedCSM_BoP_I = Test.GetScope(id_BoP_I).Value;", "\nvar computedLC_BoP_I = Test.GetScope(id_BoP_I).Value;" ] }, @@ -1196,7 +1196,7 @@ { "cell_type": "code", "source": [ - "var computedCSM_MC_I = Test.GetScope(id_MC_I).Value;", + "var computedCSM_MC_I = Test.GetScope(id_MC_I).Value;", "\nvar computedLC_MC_I = Test.GetScope(id_MC_I).Value;" ] }, @@ -1447,7 +1447,7 @@ { "cell_type": "code", "source": [ - "var computedCSM_CL_C = Test.GetScope(id_CL_C).Value;", + "var computedCSM_CL_C = Test.GetScope(id_CL_C).Value;", "\nvar computedLC_CL_C = Test.GetScope(id_CL_C).Value;" ] }, @@ -1644,7 +1644,7 @@ { "cell_type": "code", "source": [ - "var computedCSM_EoP_C = Test.GetScope(id_EoP_C).Value;", + "var computedCSM_EoP_C = Test.GetScope(id_EoP_C).Value;", "\nvar computedLC_EoP_C = Test.GetScope(id_EoP_C).Value;" ] }, @@ -1694,7 +1694,7 @@ { "cell_type": "code", "source": [ - "var csm = allIdentitiesWoLic.SelectMany(id => Test.GetScope(id).RepeatOnce()", + "var csm = allIdentitiesWoLic.SelectMany(id => Test.GetScope(id).RepeatOnce()", "\n .Where(x => Math.Abs(x.Value) >= Precision)", "\n .Select(x => x.FromCsmToIfrsVariable())).ToArray();" ] diff --git a/ifrs17/Import/ImportScopeCalculation.ipynb b/ifrs17/Import/ImportScopeCalculation.ipynb index c5709d0a..73a7ec98 100644 --- a/ifrs17/Import/ImportScopeCalculation.ipynb +++ b/ifrs17/Import/ImportScopeCalculation.ipynb @@ -1783,7 +1783,7 @@ { "cell_type": "code", "source": [ - "public interface ContractualServiceMaring : IScope", + "public interface ContractualServiceMargin : IScope", "\n{", "\n [NotVisible]string EstimateType => EstimateTypes.C;", "\n ", @@ -1950,7 +1950,7 @@ "\n ", "\n IEnumerable Csms => GetStorage().DataNodeDataBySystemName[Identity.DataNode].LiabilityType == LiabilityTypes.LIC", "\n ? Enumerable.Empty()", - "\n : GetScope(Identity).RepeatOnce()", + "\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,", From df03588d6b84b8a14b2a42a9770f97ad39241482 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Tue, 25 Oct 2022 17:28:56 +0200 Subject: [PATCH 11/19] move it ce --- full-ifrs17-template/Report/Reports.ipynb | 31 +-- .../Report/ReportsNewWayBackup.ipynb | 252 ------------------ ifrs17/CalculationEngine.ipynb | 2 +- ifrs17/Constants/Enums.ipynb | 18 ++ .../Report/ReportConfigurationAndUtils.ipynb | 6 + .../Report/ReportMutableScopes.ipynb | 46 ++-- ifrs17/Report/ReportScopes.ipynb | 10 +- 7 files changed, 59 insertions(+), 306 deletions(-) delete mode 100644 full-ifrs17-template/Report/ReportsNewWayBackup.ipynb rename full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb => ifrs17/Report/ReportMutableScopes.ipynb (96%) diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index 15d7779a..b1edde49 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -28,37 +28,14 @@ { "cell_type": "markdown", "source": [ - "# Infrastructure and Configuration" - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Initialize data" - ] - }, - { - "cell_type": "code", - "source": [ - "#!eval-notebook \"../Initialization/InitSystemorphToMemory\"" + "# Set up data and configuration" ] }, { "cell_type": "code", "source": [ - "#!import \"Ifrs17ReportScopes\"" - ] - }, - { - "cell_type": "code", - "source": [ - "Workspace.InitializeFrom(DataSource);" - ] - }, - { - "cell_type": "markdown", - "source": [ - "# Report Settings and Storage Update" + "#!eval-notebook \"../Initialization/InitSystemorphToMemory\"", + "\nWorkspace.InitializeFrom(DataSource);" ] }, { @@ -96,7 +73,7 @@ "cell_type": "code", "source": [ "var pvReport = ifrs17.PresentValues;", - "\npvReport.ColumnSlices = new string[]{\"GroupOfContract\"};//\"GroupOfContract\", \"AmountType\"", + "\npvReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\npvReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.2\"),(\"LiabilityType\", \"LIC\") }", "\n(await pvReport.ToReportAsync) with {Height = 720}" ] diff --git a/full-ifrs17-template/Report/ReportsNewWayBackup.ipynb b/full-ifrs17-template/Report/ReportsNewWayBackup.ipynb deleted file mode 100644 index 20e346ef..00000000 --- a/full-ifrs17-template/Report/ReportsNewWayBackup.ipynb +++ /dev/null @@ -1,252 +0,0 @@ -{ - "metadata": { - "authors": [], - "kernelspec": { - "display_name": "Formula Framework", - "language": "C#", - "name": "C#" - }, - "language_info": { - "file_extension": ".cs", - "mimetype": "text/plain", - "name": "C#" - }, - "toc-autonumbering": "True", - "toc-showcode": "False" - }, - "nbformat": 4, - "nbformat_minor": 5, - "cells": [ - { - "cell_type": "markdown", - "source": [ - "# Infrastructure and Configuration" - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Initialize data" - ] - }, - { - "cell_type": "code", - "source": [ - "/* Systemorph set of dimensions + mockdata are dispatched to the unconfigured in-memory DataSource */", - "\n#!eval-notebook \"../Initialization/InitSystemorphToMemory\"", - "\n/* DataSource is configured and connected to real database */", - "\n//#!eval-notebook \"../Database/Configure\"" - ] - }, - { - "cell_type": "code", - "source": [ - "Workspace.InitializeFrom(DataSource);" - ] - }, - { - "cell_type": "markdown", - "source": [ - "## Import Dependencies" - ] - }, - { - "cell_type": "code", - "source": [ - "#!import \"ReportScopes\"", - "\n#!import \"ReportConfigurationAndUtils\"" - ] - }, - { - "cell_type": "markdown", - "source": [ - "# Report Scope Proposal" - ] - }, - { - "cell_type": "code", - "source": [ - "[InitializeScope(nameof(InitAsync))]", - "\npublic interface FcfReport : IMutableScopeWithStorage {", - "\n // Some infrastructure", - "\n private IWorkspace workspace => GetStorage().Workspace;", - "\n private Systemorph.Vertex.Pivot.Reporting.IReportFactory report => GetStorage().Report;", - "\n ", - "\n // Basic mutable properties", - "\n (int Year, int Month) ReportingPeriod { get; set; }", - "\n int Year => ReportingPeriod.Year;", - "\n int Month => ReportingPeriod.Month;", - "\n string ReportingNode { get; set; }", - "\n string Scenario { get; set; }", - "\n CurrencyType CurrencyType { get; set; }", - "\n ", - "\n ((int Year, int Month) ReportingPeriod, string ReportingNode, string Scenario, CurrencyType) ShowSettings => (ReportingPeriod, ReportingNode, Scenario, CurrencyType);", - "\n ", - "\n // Slice and Dice", - "\n IEnumerable RowSlices { get; set; }", - "\n private string[] defaultRowSlices => new string[] { \"Novelty\", \"VariableType\" };", - "\n private string[] rowSlices => RowSlices is null ? defaultRowSlices : defaultRowSlices.Concat(RowSlices).ToArray();", - "\n ", - "\n IEnumerable ColumnSlices { get; set; }", - "\n private string[] defaultColumnSlices => new string[] { CurrencyGrouper(CurrencyType) };", - "\n private string[] columnSlices => ColumnSlices is null ? defaultColumnSlices : defaultColumnSlices.Concat(ColumnSlices).ToArray();", - "\n ", - "\n // Filter", - "\n IEnumerable<(string filterName, string filterValue)> DataFilter { get; set; }", - "\n private (string filterName, object filterValue)[] dataFilter => (DataFilter is null ? Enumerable.Empty<(string, object)>() : DataFilter.Select(x => (x.filterName, (object)x.filterValue))).ToArray();", - "\n ", - "\n // Scope Initialization", - "\n async Task InitAsync() {", - "\n var mostRecentPartition = (await workspace.Query().Where(x => x.Scenario == null).OrderBy(x => x.Year).ThenBy(x => x.Month).ToArrayAsync()).Last(); ", - "\n ", - "\n ReportingPeriod = (mostRecentPartition.Year, mostRecentPartition.Month);", - "\n ReportingNode = (await workspace.Query().Where(x => x.Parent == null).ToArrayAsync()).First().SystemName; // TODO: change once user permissions are available", - "\n Scenario = null;", - "\n CurrencyType = CurrencyType.Contractual;", - "\n ", - "\n ColumnSlices = \"EstimateType\".RepeatOnce();", - "\n", - "\n await GetStorage().InitializeReportIndependentCacheAsync();", - "\n }", - "\n ", - "\n // Data update in Storage and Report Generation", - "\n private async Task GetReportTaskAsync() {", - "\n await GetStorage().InitializeAsync(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", - "\n ", - "\n var identities = GetStorage().GetIdentities(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", - "\n var dataCube = GetScopes(identities).Aggregate().Fcf.Filter(dataFilter);", - "\n ", - "\n return report.ForDataCube(dataCube)", - "\n .WithQuerySource(workspace)", - "\n .SliceRowsBy(rowSlices)", - "\n .SliceColumnsBy(columnSlices)", - "\n .ReportGridOptions()", - "\n .ToReport();", - "\n }", - "\n", - "\n Task ToReportAsync => GetReportTaskAsync();", - "\n }" - ] - }, - { - "cell_type": "markdown", - "source": [ - "# Playground" - ] - }, - { - "cell_type": "code", - "source": [ - "var reportStorage = new ReportStorage(Workspace, Report);" - ] - }, - { - "cell_type": "code", - "source": [ - "var fcfReport = Scopes.ForSingleton().WithStorage(reportStorage).ToScope();" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ReportingNode = \"CH\";" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ShowSettings" - ] - }, - { - "cell_type": "code", - "source": [ - "(await fcfReport.ToReportAsync) with {Height = 250}" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ReportingPeriod = (2020, 12);" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ShowSettings" - ] - }, - { - "cell_type": "code", - "source": [ - "(await fcfReport.ToReportAsync) with {Height = 250}" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ReportingNode = \"G\";" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ShowSettings" - ] - }, - { - "cell_type": "code", - "source": [ - "(await fcfReport.ToReportAsync) with {Height = 250}" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ReportingPeriod = (2021, 3);" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ShowSettings" - ] - }, - { - "cell_type": "code", - "source": [ - "(await fcfReport.ToReportAsync) with {Height = 250}" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ReportingNode = \"CH\";" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.ColumnSlices = \"EconomicBasis\".RepeatOnce();" - ] - }, - { - "cell_type": "code", - "source": [ - "fcfReport.DataFilter = new [] {(\"VariableType\", \"!BOP\"), (\"VariableType\", \"!EOP\")};" - ] - }, - { - "cell_type": "code", - "source": [ - "(await fcfReport.ToReportAsync) with {Height = 500}" - ] - }, - { - "cell_type": "code", - "source": [ - "" - ] - } - ] -} \ No newline at end of file diff --git a/ifrs17/CalculationEngine.ipynb b/ifrs17/CalculationEngine.ipynb index d6a34d5e..c3a80172 100644 --- a/ifrs17/CalculationEngine.ipynb +++ b/ifrs17/CalculationEngine.ipynb @@ -19,7 +19,7 @@ "cell_type": "code", "source": [ "#!import \"DataModel/DataStructure\"", - "\n#!import \"Report/ReportScopes\"", + "\n#!import \"Report/ReportMutableScopes\"", "\n#!import \"Import/Importers\"", "\n#!import \"Export/ExportConfiguration\"", "\n#!import \"Utils/TestHelper\"", diff --git a/ifrs17/Constants/Enums.ipynb b/ifrs17/Constants/Enums.ipynb index 04c87848..c396eddc 100644 --- a/ifrs17/Constants/Enums.ipynb +++ b/ifrs17/Constants/Enums.ipynb @@ -188,6 +188,24 @@ "source": [ "public enum ImportScope { Primary, Secondary }" ] + }, + { + "cell_type": "markdown", + "source": [ + "## Report Names" + ] + }, + { + "cell_type": "code", + "source": [ + "public enum ReportNames { PvReport, RaReport, WrittenReport, AccrualReport, DeferralReport, FcfReport, ExpAdjReport, TmReport, CsmReport, ActLrcReport, LrcReport, ActLicReport, LicReport, FpReport }" + ] + }, + { + "cell_type": "markdown", + "source": [ + "" + ] } ] } \ No newline at end of file diff --git a/ifrs17/Report/ReportConfigurationAndUtils.ipynb b/ifrs17/Report/ReportConfigurationAndUtils.ipynb index d482e339..32d1329d 100644 --- a/ifrs17/Report/ReportConfigurationAndUtils.ipynb +++ b/ifrs17/Report/ReportConfigurationAndUtils.ipynb @@ -145,6 +145,12 @@ "\n .ToArrayAsync();", "\n}" ] + }, + { + "cell_type": "code", + "source": [ + "" + ] } ] } \ No newline at end of file diff --git a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb b/ifrs17/Report/ReportMutableScopes.ipynb similarity index 96% rename from full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb rename to ifrs17/Report/ReportMutableScopes.ipynb index 4dc77d9a..1c6b7519 100644 --- a/full-ifrs17-template/Report/Ifrs17ReportScopes.ipynb +++ b/ifrs17/Report/ReportMutableScopes.ipynb @@ -10,9 +10,7 @@ "file_extension": ".cs", "mimetype": "text/plain", "name": "C#" - }, - "toc-autonumbering": "True", - "toc-showcode": "False" + } }, "nbformat": 4, "nbformat_minor": 5, @@ -20,43 +18,39 @@ { "cell_type": "markdown", "source": [ - "# Infrastructure and Configuration" + "", + "\n

Report Mutable Scopes

" ] }, { "cell_type": "markdown", "source": [ - "## Initialize data" + "This notebook contains the set up of mutable scopes used to achieve high interactivity with reports." ] }, { - "cell_type": "code", + "cell_type": "markdown", "source": [ - "#!eval-notebook \"../Initialization/InitSystemorphToMemory\"" + "# References", + "\nLibraries and other notebooks which are needed for this notebook are imported below." ] }, { "cell_type": "code", "source": [ - "Workspace.InitializeFrom(DataSource);" + "#!import \"ReportScopes\"" ] }, { "cell_type": "markdown", "source": [ - "## Import Dependencies" - ] - }, - { - "cell_type": "code", - "source": [ - "public enum ReportNames { PvReport, RaReport, WrittenReport, AccrualReport, DeferralReport, FcfReport, ExpAdjReport, TmReport, CsmReport, ActLrcReport, LrcReport, ActLicReport, LicReport, FpReport }" + "# Mutable Scope" ] }, { "cell_type": "markdown", "source": [ - "# Report Scope Proposal" + "The IIfrs17Report mutable scope is created with applicabilities to control how the data for each individual report is retrieved from the [report scopes](./ReportScopes)" ] }, { @@ -64,7 +58,7 @@ "source": [ "[InitializeScope(nameof(InitAsync))]", "\npublic interface IIfrs17Report : IMutableScope {", - "\n // Some infrastructure", + "\n // Infrastructure", "\n protected IWorkspace workspace => GetStorage().Workspace;", "\n protected Systemorph.Vertex.Pivot.Reporting.IReportFactory report => GetStorage().Report;", "\n", @@ -251,6 +245,18 @@ "\n}" ] }, + { + "cell_type": "markdown", + "source": [ + "# IFRS 17 Reports" + ] + }, + { + "cell_type": "markdown", + "source": [ + "This class is used to trigger the calculation of the reports and it is exposed to the end-user in the reports." + ] + }, { "cell_type": "code", "source": [ @@ -341,12 +347,6 @@ "\n", "\n}" ] - }, - { - "cell_type": "code", - "source": [ - "" - ] } ] } \ No newline at end of file diff --git a/ifrs17/Report/ReportScopes.ipynb b/ifrs17/Report/ReportScopes.ipynb index ae87b53d..37a69e3f 100644 --- a/ifrs17/Report/ReportScopes.ipynb +++ b/ifrs17/Report/ReportScopes.ipynb @@ -21,9 +21,13 @@ "cell_type": "markdown", "source": [ "", - "\n

Report Scopes (IFRS17 Methodology Business Logic)

", - "\n", - "\nThis notebook contains the logic used to perform calculations upon reporting of data." + "\n

Report Scopes (IFRS17 Methodology Business Logic)

" + ] + }, + { + "cell_type": "markdown", + "source": [ + "This notebook contains the logic used to perform calculations upon reporting of data." ] }, { From 3e042212fa08602eda1898055e9dafa471122aec Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Wed, 26 Oct 2022 14:14:18 +0200 Subject: [PATCH 12/19] remove partition set --- ifrs17/Report/ReportConfigurationAndUtils.ipynb | 1 - 1 file changed, 1 deletion(-) diff --git a/ifrs17/Report/ReportConfigurationAndUtils.ipynb b/ifrs17/Report/ReportConfigurationAndUtils.ipynb index 32d1329d..6325385e 100644 --- a/ifrs17/Report/ReportConfigurationAndUtils.ipynb +++ b/ifrs17/Report/ReportConfigurationAndUtils.ipynb @@ -101,7 +101,6 @@ "source": [ "public static async Task> QueryReportVariablesAsync(this IWorkspace workspace, (int Year, int Month, string ReportingNode, string Scenario) args ) {", "\n ", - "\n await workspace.Partition.SetAsync(new { ReportingNode = args.ReportingNode, Scenario = args.Scenario });", "\n await workspace.Partition.SetAsync(new { ReportingNode = args.ReportingNode, Scenario = args.Scenario, Year = args.Year, Month = args.Month });", "\n ", "\n return await workspace.Query()", From f67950ee417e779a0fbb8a81a235729420d45d5a Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Thu, 27 Oct 2022 16:10:57 +0200 Subject: [PATCH 13/19] adjust reporting --- ifrs17/Report/ReportMutableScopes.ipynb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ifrs17/Report/ReportMutableScopes.ipynb b/ifrs17/Report/ReportMutableScopes.ipynb index 1c6b7519..99297e78 100644 --- a/ifrs17/Report/ReportMutableScopes.ipynb +++ b/ifrs17/Report/ReportMutableScopes.ipynb @@ -60,7 +60,7 @@ "\npublic interface IIfrs17Report : IMutableScope {", "\n // Infrastructure", "\n protected IWorkspace workspace => GetStorage().Workspace;", - "\n protected Systemorph.Vertex.Pivot.Reporting.IReportFactory report => GetStorage().Report;", + "\n protected Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report => GetStorage().Report;", "\n", "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>", "\n builder.ForScope(s => s.WithApplicability(x => x.Identity == ReportNames.PvReport)", @@ -264,11 +264,11 @@ "\n{", "\n private IWorkspace Workspace {get; init;}", "\n private Systemorph.Vertex.Scopes.Proxy.IScopeFactory Scopes {get; init;}", - "\n private Systemorph.Vertex.Pivot.Reporting.IReportFactory Report {get; init;}", + "\n private Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory Report {get; init;}", "\n private ReportStorage Storage {get; set;}", "\n ", "\n //constructor", - "\n public Ifrs17Reports (IWorkspace ws, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Reporting.IReportFactory report)", + "\n public Ifrs17Reports (IWorkspace ws, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report)", "\n {", "\n Workspace = ws; ", "\n Scopes = scopes; ", @@ -347,6 +347,12 @@ "\n", "\n}" ] + }, + { + "cell_type": "code", + "source": [ + "" + ] } ] } \ No newline at end of file From b7e0577f5a3036d0155a55b448c0c6dd93f78fab Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Fri, 28 Oct 2022 12:28:04 +0200 Subject: [PATCH 14/19] test readme with relative path for image --- ifrs17/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17/README.md b/ifrs17/README.md index 9891b004..edb27c1e 100644 --- a/ifrs17/README.md +++ b/ifrs17/README.md @@ -1,4 +1,4 @@ -![Systemorph_logo.png](https://portal.systemorph.cloud/api/project/ifrs17ce/env/dev/file/download?path=Images/Systemorph_logo.png) +![Systemorph_logo.png](./Images/Systemorph_logo.png) **IFRS17 Calculation Engine** From e820fa03235dc854ac9a0439aa888a6ca9811b9f Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Fri, 28 Oct 2022 15:38:21 +0200 Subject: [PATCH 15/19] back to absolute path - bug in the portal - --- ifrs17/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17/README.md b/ifrs17/README.md index edb27c1e..9891b004 100644 --- a/ifrs17/README.md +++ b/ifrs17/README.md @@ -1,4 +1,4 @@ -![Systemorph_logo.png](./Images/Systemorph_logo.png) +![Systemorph_logo.png](https://portal.systemorph.cloud/api/project/ifrs17ce/env/dev/file/download?path=Images/Systemorph_logo.png) **IFRS17 Calculation Engine** From bf03f8ea00c178835d77e89d77ddc914de172e75 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Fri, 28 Oct 2022 15:48:46 +0200 Subject: [PATCH 16/19] wip --- ifrs17/CalculationEngine.ipynb | 6 ++ ifrs17/Report/ReportMutableScopes.ipynb | 121 ++++++++---------------- 2 files changed, 45 insertions(+), 82 deletions(-) diff --git a/ifrs17/CalculationEngine.ipynb b/ifrs17/CalculationEngine.ipynb index c3a80172..0936fa66 100644 --- a/ifrs17/CalculationEngine.ipynb +++ b/ifrs17/CalculationEngine.ipynb @@ -25,6 +25,12 @@ "\n#!import \"Utils/TestHelper\"", "\n#!import \"Utils/ImportCalculationMethods\"" ] + }, + { + "cell_type": "code", + "source": [ + "var ifrs17Report = new Ifrs17Reports(Workspace, Scopes, Report);" + ] } ] } \ No newline at end of file diff --git a/ifrs17/Report/ReportMutableScopes.ipynb b/ifrs17/Report/ReportMutableScopes.ipynb index 99297e78..224b12f3 100644 --- a/ifrs17/Report/ReportMutableScopes.ipynb +++ b/ifrs17/Report/ReportMutableScopes.ipynb @@ -53,6 +53,12 @@ "The IIfrs17Report mutable scope is created with applicabilities to control how the data for each individual report is retrieved from the [report scopes](./ReportScopes)" ] }, + { + "cell_type": "code", + "source": [ + "public interface ReportUniverse : IMutableScopeWithStorage{}" + ] + }, { "cell_type": "code", "source": [ @@ -79,8 +85,7 @@ "\n .WithApplicability(x => x.Identity == ReportNames.FpReport)", "\n );", "\n", - "\n ", - "\n // Basic mutable properties", + "\n // Basic mutable properties", "\n (int Year, int Month) ReportingPeriod { get; set; }", "\n int Year => ReportingPeriod.Year;", "\n int Month => ReportingPeriod.Month;", @@ -260,91 +265,43 @@ { "cell_type": "code", "source": [ - "public class Ifrs17Reports", + "public class Ifrs17Reports ", "\n{", - "\n private IWorkspace Workspace {get; init;}", - "\n private Systemorph.Vertex.Scopes.Proxy.IScopeFactory Scopes {get; init;}", - "\n private Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory Report {get; init;}", - "\n private ReportStorage Storage {get; set;}", - "\n ", + "\n private Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes;", + "\n private Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report;", + "\n private ReportStorage Storage;", + "\n private ReportUniverse reportUniverse;", + "\n ", + "\n //reset", + "\n public void Reset(IWorkspace workspace) => Storage = new ReportStorage(workspace, report);", + "\n", "\n //constructor", - "\n public Ifrs17Reports (IWorkspace ws, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report)", + "\n public Ifrs17Reports (IWorkspace workspace, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report)", "\n {", - "\n Workspace = ws; ", - "\n Scopes = scopes; ", - "\n Report = report; ", + "\n this.scopes = scopes; ", + "\n this.report = report; ", + "\n Storage = new ReportStorage(workspace, report);", + "\n reportUniverse = scopes.ForSingleton().WithStorage(Storage).ToScope();", "\n }", "\n", - "\n public IIfrs17Report PresentValues {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.PvReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report RiskAdjustments {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.RaReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report WrittenActuals {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.WrittenReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report AccrualActuals {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.AccrualReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report DeferralActuals {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.DeferralReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report FulfillmentCashflows {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.FcfReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report ExperienceAdjustments {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.ExpAdjReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report TechnicalMargins {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.TmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report AllocatedTechnicalMargins {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.CsmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report ActuarialLrc {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.ActLrcReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report Lrc {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.LrcReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report ActuarialLic {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.ActLicReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report Lic {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.LicReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", - "\n public IIfrs17Report FinancialPerformance {get{", - "\n Storage = new ReportStorage(Workspace, Report);", - "\n return Scopes.ForIdentities(ReportNames.FpReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n }}", - "\n", + "\n public IIfrs17Report PresentValues => reportUniverse.GetScope(ReportNames.PvReport);", + "\n public IIfrs17Report RiskAdjustments => reportUniverse.GetScope(ReportNames.RaReport);", + "\n /*", + "\n public IIfrs17Report PresentValues => Scopes.ForIdentities(ReportNames.PvReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report RiskAdjustments => Scopes.ForIdentities(ReportNames.RaReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report WrittenActuals => Scopes.ForIdentities(ReportNames.WrittenReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report AccrualActuals => Scopes.ForIdentities(ReportNames.AccrualReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report DeferralActuals => Scopes.ForIdentities(ReportNames.DeferralReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report FulfillmentCashflows => Scopes.ForIdentities(ReportNames.FcfReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report ExperienceAdjustments => Scopes.ForIdentities(ReportNames.ExpAdjReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report TechnicalMargins => Scopes.ForIdentities(ReportNames.TmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report AllocatedTechnicalMargins => Scopes.ForIdentities(ReportNames.CsmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report ActuarialLrc => Scopes.ForIdentities(ReportNames.ActLrcReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report Lrc => Scopes.ForIdentities(ReportNames.LrcReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report ActuarialLic => Scopes.ForIdentities(ReportNames.ActLicReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report Lic => Scopes.ForIdentities(ReportNames.LicReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n public IIfrs17Report FinancialPerformance => Scopes.ForIdentities(ReportNames.FpReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", + "\n */", "\n}" ] }, From 170bff0dc393901bc98d1a4feada097082f82fc4 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Fri, 28 Oct 2022 16:39:14 +0200 Subject: [PATCH 17/19] settle with identities --- full-ifrs17-template/Report/Reports.ipynb | 43 +++++++-------- ifrs17/Constants/Enums.ipynb | 18 ------- ifrs17/Report/ReportMutableScopes.ipynb | 64 +++++++++++------------ 3 files changed, 49 insertions(+), 76 deletions(-) diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index 16530946..314fbaec 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -31,22 +31,17 @@ "# Set up data and configuration" ] }, - { - "cell_type": "markdown", - "source": [ - ] - }, { "cell_type": "code", "source": [ - "#!eval-notebook \"../Initialization/InitSystemorphToMemory\"", - "\nWorkspace.InitializeFrom(DataSource);" + "#!eval-notebook \"../Initialization/InitSystemorphToMemory\"" ] }, { "cell_type": "code", "source": [ - "var ifrs17 = new Ifrs17Reports(Workspace, Scopes, Report);" + "Workspace.InitializeFrom(DataSource);", + "\nifrs17Report.Reset(Workspace)" ] }, { @@ -67,7 +62,7 @@ "\n", "\nPresent values of the best-estimate future cashflows are shown here in an Analysis of Change report.", "\n", - "\nThe report view can be modified with the Slice options for the columns by changing the SliceColumnBy inputs in the next command cell.", + "\nThe report view can be modified by changing the Column Slice options in the next command cell.", "\nFor example one can add \"GroupOfContract\" to separate the contributions of the individual Group of Contracts.", "\n
We suggest to add this slice between the \"LiabilityType\" and the \"EconomicBasis\" as the order of the inputs corresponds to the order of the columns shown in the report to expand the data.", "\n", @@ -77,7 +72,7 @@ { "cell_type": "code", "source": [ - "var pvReport = ifrs17.PresentValues;", + "var pvReport = ifrs17Report.PresentValues;", "\npvReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\npvReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.2\"),(\"LiabilityType\", \"LIC\") }", "\n(await pvReport.ToReportAsync) with {Height = 720}" @@ -92,7 +87,7 @@ { "cell_type": "code", "source": [ - "var raReport = ifrs17.RiskAdjustments;", + "var raReport = ifrs17Report.RiskAdjustments;", "\nraReport.ColumnSlices = new string[]{};//\"GroupOfContract\"", "\nraReport.DataFilter = null;//new [] {(\"GroupOfContract\", \"DT1.2\")};", "\n(await raReport.ToReportAsync) with {Height = 800}" @@ -107,9 +102,9 @@ { "cell_type": "code", "source": [ - "var writtenActualReport = ifrs17.WrittenActuals;", + "var writtenActualReport = ifrs17Report.WrittenActuals;", "\nwrittenActualReport.ColumnSlices = new string[]{};//\"GroupOfContract\"", - "\nwrittenActualReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", + "\nwrittenActualReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await writtenActualReport.ToReportAsync) with {Height = 400}" ] }, @@ -122,7 +117,7 @@ { "cell_type": "code", "source": [ - "var accrualActualReport = ifrs17.AccrualActuals;", + "var accrualActualReport = ifrs17Report.AccrualActuals;", "\naccrualActualReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\naccrualActualReport.DataFilter = null;//new [] {(\"GroupOfContract\", \"DT2.1\")};", "\n(await accrualActualReport.ToReportAsync) with {Height = 400}" @@ -137,7 +132,7 @@ { "cell_type": "code", "source": [ - "var deferrableActualReport = ifrs17.DeferralActuals;", + "var deferrableActualReport = ifrs17Report.DeferralActuals;", "\ndeferrableActualReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\ndeferrableActualReport.DataFilter = null;//new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await deferrableActualReport.ToReportAsync) with {Height = 400}" @@ -152,7 +147,7 @@ { "cell_type": "code", "source": [ - "var fulfillmentCashflowsReport = ifrs17.FulfillmentCashflows;", + "var fulfillmentCashflowsReport = ifrs17Report.FulfillmentCashflows;", "\nfulfillmentCashflowsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\nfulfillmentCashflowsReport.DataFilter = null;// new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await fulfillmentCashflowsReport.ToReportAsync) with {Height = 750}" @@ -167,7 +162,7 @@ { "cell_type": "code", "source": [ - "var experienceAdjustmentsReport = ifrs17.ExperienceAdjustments;", + "var experienceAdjustmentsReport = ifrs17Report.ExperienceAdjustments;", "\nexperienceAdjustmentsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\nexperienceAdjustmentsReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await experienceAdjustmentsReport.ToReportAsync) with {Height = 300}" @@ -182,7 +177,7 @@ { "cell_type": "code", "source": [ - "var technicalMarginsReport = ifrs17.TechnicalMargins;", + "var technicalMarginsReport = ifrs17Report.TechnicalMargins;", "\ntechnicalMarginsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\ntechnicalMarginsReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await technicalMarginsReport.ToReportAsync) with {Height = 600}" @@ -197,7 +192,7 @@ { "cell_type": "code", "source": [ - "var allocatedTechnicalMarginsReport = ifrs17.AllocatedTechnicalMargins;", + "var allocatedTechnicalMarginsReport = ifrs17Report.AllocatedTechnicalMargins;", "\nallocatedTechnicalMarginsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\nallocatedTechnicalMarginsReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await allocatedTechnicalMarginsReport.ToReportAsync) with {Height = 700}" @@ -212,7 +207,7 @@ { "cell_type": "code", "source": [ - "var actuarialLrcReport = ifrs17.ActuarialLrc;", + "var actuarialLrcReport = ifrs17Report.ActuarialLrc;", "\nactuarialLrcReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\nactuarialLrcReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await actuarialLrcReport.ToReportAsync) with {Height = 750}" @@ -227,7 +222,7 @@ { "cell_type": "code", "source": [ - "var lrcReport = ifrs17.Lrc;", + "var lrcReport = ifrs17Report.Lrc;", "\nlrcReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\nlrcReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await lrcReport.ToReportAsync) with {Height = 250}" @@ -242,7 +237,7 @@ { "cell_type": "code", "source": [ - "var actuarialLicReport = ifrs17.ActuarialLic;", + "var actuarialLicReport = ifrs17Report.ActuarialLic;", "\nactuarialLicReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\nactuarialLicReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await actuarialLicReport.ToReportAsync) with {Height = 750}" @@ -257,7 +252,7 @@ { "cell_type": "code", "source": [ - "var licReport = ifrs17.Lic;", + "var licReport = ifrs17Report.Lic;", "\nlicReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\nlicReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await licReport.ToReportAsync) with {Height = 250}" @@ -274,7 +269,7 @@ { "cell_type": "code", "source": [ - "var financialPerformanceReport = ifrs17.FinancialPerformance;", + "var financialPerformanceReport = ifrs17Report.FinancialPerformance;", "\nfinancialPerformanceReport.ColumnSlices = new string[]{};//\"GroupOfContract\"", "\nfinancialPerformanceReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await financialPerformanceReport.ToReportAsync) with { Height = 900, GroupDefaultExpanded = 3}" diff --git a/ifrs17/Constants/Enums.ipynb b/ifrs17/Constants/Enums.ipynb index c396eddc..04c87848 100644 --- a/ifrs17/Constants/Enums.ipynb +++ b/ifrs17/Constants/Enums.ipynb @@ -188,24 +188,6 @@ "source": [ "public enum ImportScope { Primary, Secondary }" ] - }, - { - "cell_type": "markdown", - "source": [ - "## Report Names" - ] - }, - { - "cell_type": "code", - "source": [ - "public enum ReportNames { PvReport, RaReport, WrittenReport, AccrualReport, DeferralReport, FcfReport, ExpAdjReport, TmReport, CsmReport, ActLrcReport, LrcReport, ActLicReport, LicReport, FpReport }" - ] - }, - { - "cell_type": "markdown", - "source": [ - "" - ] } ] } \ No newline at end of file diff --git a/ifrs17/Report/ReportMutableScopes.ipynb b/ifrs17/Report/ReportMutableScopes.ipynb index 224b12f3..2cd03b41 100644 --- a/ifrs17/Report/ReportMutableScopes.ipynb +++ b/ifrs17/Report/ReportMutableScopes.ipynb @@ -63,26 +63,26 @@ "cell_type": "code", "source": [ "[InitializeScope(nameof(InitAsync))]", - "\npublic interface IIfrs17Report : IMutableScope {", + "\npublic interface IIfrs17Report : IMutableScope {", "\n // Infrastructure", "\n protected IWorkspace workspace => GetStorage().Workspace;", "\n protected Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report => GetStorage().Report;", "\n", "\n static ApplicabilityBuilder ScopeApplicabilityBuilder(ApplicabilityBuilder builder) =>", - "\n builder.ForScope(s => s.WithApplicability(x => x.Identity == ReportNames.PvReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.RaReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.WrittenReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.AccrualReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.DeferralReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.FcfReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.ExpAdjReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.TmReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.CsmReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.ActLrcReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.LrcReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.ActLicReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.LicReport)", - "\n .WithApplicability(x => x.Identity == ReportNames.FpReport)", + "\n builder.ForScope(s => s.WithApplicability(x => x.Identity == nameof(PvReport))", + "\n .WithApplicability(x => x.Identity == nameof(RaReport))", + "\n .WithApplicability(x => x.Identity == nameof(WrittenReport))", + "\n .WithApplicability(x => x.Identity == nameof(AccrualReport))", + "\n .WithApplicability(x => x.Identity == nameof(DeferralReport))", + "\n .WithApplicability(x => x.Identity == nameof(FcfReport))", + "\n .WithApplicability(x => x.Identity == nameof(ExpAdjReport))", + "\n .WithApplicability(x => x.Identity == nameof(TmReport))", + "\n .WithApplicability(x => x.Identity == nameof(CsmReport))", + "\n .WithApplicability(x => x.Identity == nameof(ActLrcReport))", + "\n .WithApplicability(x => x.Identity == nameof(LrcReport))", + "\n .WithApplicability(x => x.Identity == nameof(ActLicReport))", + "\n .WithApplicability(x => x.Identity == nameof(LicReport))", + "\n .WithApplicability(x => x.Identity == nameof(FpReport))", "\n );", "\n", "\n // Basic mutable properties", @@ -120,7 +120,7 @@ "\n await GetStorage().InitializeReportIndependentCacheAsync();", "\n }", "\n public IDataCube GetDataCube() => default;", - "\n protected int headerColumnWidthValue => 200;", + "\n protected int headerColumnWidthValue => 250;", "\n private async Task GetReportTaskAsync() {", "\n await GetStorage().InitializeAsync(ReportingPeriod, ReportingNode, Scenario, CurrencyType);", "\n ", @@ -284,24 +284,20 @@ "\n reportUniverse = scopes.ForSingleton().WithStorage(Storage).ToScope();", "\n }", "\n", - "\n public IIfrs17Report PresentValues => reportUniverse.GetScope(ReportNames.PvReport);", - "\n public IIfrs17Report RiskAdjustments => reportUniverse.GetScope(ReportNames.RaReport);", - "\n /*", - "\n public IIfrs17Report PresentValues => Scopes.ForIdentities(ReportNames.PvReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report RiskAdjustments => Scopes.ForIdentities(ReportNames.RaReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report WrittenActuals => Scopes.ForIdentities(ReportNames.WrittenReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report AccrualActuals => Scopes.ForIdentities(ReportNames.AccrualReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report DeferralActuals => Scopes.ForIdentities(ReportNames.DeferralReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report FulfillmentCashflows => Scopes.ForIdentities(ReportNames.FcfReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report ExperienceAdjustments => Scopes.ForIdentities(ReportNames.ExpAdjReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report TechnicalMargins => Scopes.ForIdentities(ReportNames.TmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report AllocatedTechnicalMargins => Scopes.ForIdentities(ReportNames.CsmReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report ActuarialLrc => Scopes.ForIdentities(ReportNames.ActLrcReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report Lrc => Scopes.ForIdentities(ReportNames.LrcReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report ActuarialLic => Scopes.ForIdentities(ReportNames.ActLicReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report Lic => Scopes.ForIdentities(ReportNames.LicReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n public IIfrs17Report FinancialPerformance => Scopes.ForIdentities(ReportNames.FpReport.RepeatOnce()).WithStorage(Storage).ToScopes().First();", - "\n */", + "\n public IIfrs17Report PresentValues => reportUniverse.GetScope(nameof(PvReport));", + "\n public IIfrs17Report RiskAdjustments => reportUniverse.GetScope(nameof(RaReport));", + "\n public IIfrs17Report WrittenActuals => reportUniverse.GetScope(nameof(WrittenReport));", + "\n public IIfrs17Report AccrualActuals => reportUniverse.GetScope(nameof(AccrualReport));", + "\n public IIfrs17Report DeferralActuals => reportUniverse.GetScope(nameof(DeferralReport));", + "\n public IIfrs17Report FulfillmentCashflows => reportUniverse.GetScope(nameof(FcfReport));", + "\n public IIfrs17Report ExperienceAdjustments => reportUniverse.GetScope(nameof(ExpAdjReport));", + "\n public IIfrs17Report TechnicalMargins => reportUniverse.GetScope(nameof(TmReport));", + "\n public IIfrs17Report AllocatedTechnicalMargins => reportUniverse.GetScope(nameof(CsmReport));", + "\n public IIfrs17Report ActuarialLrc => reportUniverse.GetScope(nameof(ActLrcReport));", + "\n public IIfrs17Report Lrc => reportUniverse.GetScope(nameof(LrcReport));", + "\n public IIfrs17Report ActuarialLic => reportUniverse.GetScope(nameof(ActLicReport));", + "\n public IIfrs17Report Lic => reportUniverse.GetScope(nameof(LicReport));", + "\n public IIfrs17Report FinancialPerformance => reportUniverse.GetScope(nameof(FpReport));", "\n}" ] }, From 96f7b8d16e9e8db8447f92ad0ab5d710aca4e462 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Mon, 31 Oct 2022 14:35:13 +0100 Subject: [PATCH 18/19] some more docs --- full-ifrs17-template/Report/Reports.ipynb | 73 +++++++++++++++-------- 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index 314fbaec..71bbd50d 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -25,6 +25,17 @@ "\n" ] }, + { + "cell_type": "markdown", + "source": [ + "For demonstration purposes we import here data for 7 *Group of Insurance Contract* (GIC) and 4 *Group of Reinsurance Contract* (GRIC) - the import is triggered in the [Set up data and configuration](#set-up-data-and-configuration).", + "\n
The imported data set consists of cashflows, actuals, and parameters for two consecutive periods (Year 2020-Quarter 4 and Year 2021-Quarter 1)", + "\n
Input files can be found in the **File** directory. You are invited to change them or upload your own. ", + "\n
For simplicity, we import the same transactional data for all GICs and GRICs. Each *Group of Contracts* produces different figures due to differences in parameters such as *Liability Type*, *Oci type* or *Premium allocation factor* to Contractual Service Margin.", + "\n", + "\nFollow the instructions below for a guided interaction with the reports." + ] + }, { "cell_type": "markdown", "source": [ @@ -47,22 +58,11 @@ { "cell_type": "markdown", "source": [ - "# Use cases", - "\n", - "\nFor demonstration purposes we import data for 7 *Group of Insurance Contract* (GIC) and 4 *Group of Reinsurance Contract* (GRIC). ", - "\n
The data set consists of cashflows, actuals, and parameters.", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "source": [ - "# Present Value", + "# Best Estimate", "\n", - "\nPresent values of the best-estimate future cashflows are shown here in an Analysis of Change report.", + "\nPresent values of the [best-estimate](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#best-estimate) future cashflows are shown here in an Analysis of Change report.", "\n", - "\nThe report view can be modified by changing the Column Slice options in the next command cell.", + "\nThe granularity of the reported figures can be modified by changing the Column Slices options.", "\nFor example one can add \"GroupOfContract\" to separate the contributions of the individual Group of Contracts.", "\n
We suggest to add this slice between the \"LiabilityType\" and the \"EconomicBasis\" as the order of the inputs corresponds to the order of the columns shown in the report to expand the data.", "\n", @@ -81,7 +81,11 @@ { "cell_type": "markdown", "source": [ - "# Risk Adjustment" + "# Risk Adjustment", + "\n", + "\nPresent values of the [risk adjustment](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#risk-adjustment) future cashflows are shown here.", + "\n", + "\nFilters can be applied to report to isolate a sub-set of the data. They can be used in conjuction to the Slice options. For example, filtering **EconomicBasis** Locked-in together with a slice on the **GroupOfContract** allows to analyse the risk adjustment figures computed with the yield curve at inception for all Group of Contracts." ] }, { @@ -96,7 +100,11 @@ { "cell_type": "markdown", "source": [ - "# Actuals" + "# Written Actuals", + "\n", + "\n[Written Actuals](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#written-accrual-deferral) are shown here. ", + "\n", + "\nIn this case, the analysis of change view is replaced with a default slice by the **AmountTypes**. Only the amount type with non zero value are displayed. " ] }, { @@ -111,7 +119,10 @@ { "cell_type": "markdown", "source": [ - "## Advance, Overdue Actuals" + "## Advance, Overdue Actuals", + "\n", + "\nActuals payed in [Advance](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#written-accrual-deferral)", + "\nor [Overdue](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#written-accrual-deferral) are shown here together in a simplified Analysis of Change. " ] }, { @@ -126,7 +137,9 @@ { "cell_type": "markdown", "source": [ - "## Deferrable Actuals" + "## Deferrable Actuals", + "\n", + "\n[Deferrable Actuals](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#written-accrual-deferral) are shown here. Amortization of the deferrable amount is computed using the Coverage Unit pattern. " ] }, { @@ -141,14 +154,17 @@ { "cell_type": "markdown", "source": [ - "# Fulfilment Cashflow" + "# Fulfilment Cashflow", + "\n", + "\nPresent Value of the [Fulfilment Cashflow](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#fulfillment-cashflows) are shown here. ", + "\n
The individual contributions from Best Estimate and Risk Adjustment can be visualized slicing by **EstimateType**" ] }, { "cell_type": "code", "source": [ "var fulfillmentCashflowsReport = ifrs17Report.FulfillmentCashflows;", - "\nfulfillmentCashflowsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nfulfillmentCashflowsReport.ColumnSlices = new string[]{};//\"EstimateType\"", "\nfulfillmentCashflowsReport.DataFilter = null;// new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await fulfillmentCashflowsReport.ToReportAsync) with {Height = 750}" ] @@ -156,7 +172,9 @@ { "cell_type": "markdown", "source": [ - "# Actuarial Experience Adjustment" + "# Actuarial Experience Adjustment", + "\n", + "\nA comparison between [Written Actual](#written-actual) and the Releases of the [Best Estimate](#present-value) is reported in the [Actuarial Experience Adjustment](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#experience-adjustment)." ] }, { @@ -171,7 +189,10 @@ { "cell_type": "markdown", "source": [ - "# LRC Technical Margin" + "# LRC Technical Margin", + "\n", + "\nIn the [Technical Margin](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#technical-margin) report we present a unified view on the figures that are allocated to either Contractual Service Margin or to Loss Component. ", + "\n
The Analysis of Change is expanded with few more steps such as **Experience Adjustment** and **Amortization**." ] }, { @@ -186,14 +207,18 @@ { "cell_type": "markdown", "source": [ - "# Contractual Service Margin / Loss Component / Loss Recovery Component" + "# Contractual Service Margin / Loss Component / Loss Recovery Component", + "\n", + "\nThe Contractual Service Margin (CSM) / Loss Component (LC) / Loss Recovery Component (LR) [report](https://portal.systemorph.cloud/project/ifrs17ce/env/dev/Report/ReportScopes#technical-margin) are here shown side by side as the allocation to profit or loss is done at each step of the Analysis of Change. ", + "\n", + "\nA default slice by EstimateType - which distinguish between CSM, LC and LR contributions - is automatically enforced. " ] }, { "cell_type": "code", "source": [ "var allocatedTechnicalMarginsReport = ifrs17Report.AllocatedTechnicalMargins;", - "\nallocatedTechnicalMarginsReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", + "\nallocatedTechnicalMarginsReport.ColumnSlices = new string[]{\"GroupOfContract\", \"EstimateType\"};//\"GroupOfContract\", \"AmountType\"", "\nallocatedTechnicalMarginsReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.1\")};", "\n(await allocatedTechnicalMarginsReport.ToReportAsync) with {Height = 700}" ] From 2dc9876fbb69b6ba31e1169ab3b855c2330a5d9e Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Mon, 31 Oct 2022 14:38:26 +0100 Subject: [PATCH 19/19] adding rn and period selector --- full-ifrs17-template/Report/Reports.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/full-ifrs17-template/Report/Reports.ipynb b/full-ifrs17-template/Report/Reports.ipynb index 71bbd50d..23a3804b 100644 --- a/full-ifrs17-template/Report/Reports.ipynb +++ b/full-ifrs17-template/Report/Reports.ipynb @@ -73,6 +73,8 @@ "cell_type": "code", "source": [ "var pvReport = ifrs17Report.PresentValues;", + "\npvReport.ReportingNode = \"CH\";", + "\npvReport.ReportingPeriod = (2021, 3);", "\npvReport.ColumnSlices = new string[]{};//\"GroupOfContract\", \"AmountType\"", "\npvReport.DataFilter = null; //new [] {(\"GroupOfContract\", \"DT1.2\"),(\"LiabilityType\", \"LIC\") }", "\n(await pvReport.ToReportAsync) with {Height = 720}"