From 4696aa2d4b949c9b3ddb424e3f1908ad38a627f0 Mon Sep 17 00:00:00 2001 From: Andrea Muolo Date: Mon, 13 Feb 2023 15:44:52 +0100 Subject: [PATCH 1/5] new scenario data queries tests --- .../Report/ReportConfigurationAndUtils.ipynb | 2 +- ifrs17/Test/QueriesScenarioDataTest.ipynb | 411 ++++++++++++++++++ ifrs17/Test/TestData.ipynb | 39 +- ifrs17/Test/Tests.ipynb | 9 + ifrs17/Utils/Queries.ipynb | 2 +- 5 files changed, 453 insertions(+), 10 deletions(-) create mode 100644 ifrs17/Test/QueriesScenarioDataTest.ipynb diff --git a/ifrs17/Report/ReportConfigurationAndUtils.ipynb b/ifrs17/Report/ReportConfigurationAndUtils.ipynb index 5d077303..c175259f 100644 --- a/ifrs17/Report/ReportConfigurationAndUtils.ipynb +++ b/ifrs17/Report/ReportConfigurationAndUtils.ipynb @@ -116,7 +116,7 @@ "source": [ "public static async Task QueryReportVariablesSingleScenarioAsync(this IWorkspace workspace, (int Year, int Month, string ReportingNode, string Scenario) args ) {", "\n", - "\n await workspace.Partition.SetAsync(new { ReportingNode = args.ReportingNode, Scenario = (string)null}); // TODO: Scenario from args + relaxed query ", + "\n await workspace.Partition.SetAsync(new { ReportingNode = args.ReportingNode, Scenario = (string)null});", "\n await workspace.Partition.SetAsync(new { ReportingNode = args.ReportingNode, Scenario = args.Scenario, Year = args.Year, Month = args.Month });", "\n ", "\n var reportVariables = await workspace.Query()", diff --git a/ifrs17/Test/QueriesScenarioDataTest.ipynb b/ifrs17/Test/QueriesScenarioDataTest.ipynb new file mode 100644 index 00000000..d50167fa --- /dev/null +++ b/ifrs17/Test/QueriesScenarioDataTest.ipynb @@ -0,0 +1,411 @@ +{ + "metadata": { + "authors": [], + "kernelspec": { + "display_name": "Formula Framework", + "language": "C#", + "name": "C#" + }, + "language_info": { + "file_extension": ".cs", + "mimetype": "text/plain", + "name": "C#" + } + }, + "nbformat": 4, + "nbformat_minor": 5, + "cells": [ + { + "cell_type": "code", + "source": [ + "#!import \"TestData\"" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "# Initialization" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.UpdateAsync( new[] { partitionReportingNode } );", + "\nawait DataSource.UpdateAsync( new[] { partition, previousPeriodPartition, partitionScenarioMTUP } );", + "\nawait DataSource.UpdateAsync( new[] { dt11 } );" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "# Import" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Data" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var bestEstimateRawVars = new[] { new RawVariable { AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = partition.Id, Values = new[] {1.0} }, ", + "\n new RawVariable { AmountType = \"PR\", AocType = \"AU\", Novelty = \"I\", Partition = partition.Id, Values = new[] {2.0} },", + "\n new RawVariable { AmountType = \"PR\", AocType = \"EV\", Novelty = \"I\", Partition = partition.Id, Values = new[] {3.0} },", + "\n new RawVariable { AmountType = \"CL\", AocType = \"CL\", Novelty = \"I\", Partition = partition.Id, Values = new[] {4.0} },", + "\n new RawVariable { AmountType = \"CL\", AocType = \"AU\", Novelty = \"I\", Partition = partition.Id, Values = new[] {5.0} },", + "\n new RawVariable { AmountType = \"CL\", AocType = \"EV\", Novelty = \"I\", Partition = partition.Id, Values = new[] {6.0} } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var scenarioRawVars = new[] { new RawVariable { AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Values = new[] {1.1} }, ", + "\n new RawVariable { AmountType = \"PR\", AocType = \"AU\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Values = new[] {2.1} } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var newScenarioRawVars = new[] { new RawVariable { AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Values = new[] {11.0} }, ", + "\n new RawVariable { AmountType = \"CL\", AocType = \"CL\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Values = new[] {41.0} } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario Query and Workspace with scenario data" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateRawVars.Concat(scenarioRawVars).ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await ws.UpdateAsync(newScenarioRawVars);", + "\nvar queriedRawVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Cashflow);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedRawVars.SelectMany(x => x.Values).Sum().Should().Be(52.0);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query, Workspace with no new scenario data, mismatching import format" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateRawVars.Concat(scenarioRawVars).ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var queriedRawVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Actual);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedRawVars.SelectMany(x => x.Values).Sum().Should().Be(0);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query, Workspace with no new scenario data and DataSource with scenario data" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateRawVars.Concat(scenarioRawVars).ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var queriedRawVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Cashflow);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedRawVars.SelectMany(x => x.Values).Sum().Should().Be(3.2);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query, Workspace with no new scenario data and DataSource with only Best Estimate data" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateRawVars.ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var queriedRawVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Cashflow);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedRawVars.SelectMany(x => x.Values).Sum().Should().Be(21);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "# Report" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Data" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var bestEstimateIfrsVars = new[] { new IfrsVariable { DataNode = \"DT1.1\", AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = partition.Id, Value = 1.0 }, ", + "\n new IfrsVariable { DataNode = \"DT1.1\", AmountType = \"PR\", AocType = \"AU\", Novelty = \"I\", Partition = partition.Id, Value = 2.0 },", + "\n new IfrsVariable { DataNode = \"DT1.1\", AmountType = \"PR\", AocType = \"EV\", Novelty = \"I\", Partition = partition.Id, Value = 3.0 },", + "\n new IfrsVariable { DataNode = \"DT1.1\", AmountType = \"CL\", AocType = \"CL\", Novelty = \"I\", Partition = partition.Id, Value = 4.0 },", + "\n new IfrsVariable { DataNode = \"DT1.1\", AmountType = \"CL\", AocType = \"AU\", Novelty = \"I\", Partition = partition.Id, Value = 5.0 },", + "\n new IfrsVariable { DataNode = \"DT1.1\", AmountType = \"CL\", AocType = \"EV\", Novelty = \"I\", Partition = partition.Id, Value = 6.0 } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var scenarioIfrsVars = new[] { new IfrsVariable { DataNode = \"DT1.1\", AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Value = 1.1 }, ", + "\n new IfrsVariable { DataNode = \"DT1.1\", AmountType = \"PR\", AocType = \"AU\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Value = 2.1 } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Best estimate query" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await ws.UpdateAsync(bestEstimateIfrsVars);", + "\nawait ws.UpdateAsync(scenarioIfrsVars);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "(await ws.QueryReportVariablesAsync((args.Year, args.Month, args.ReportingNode, args.Scenario))).Select(x => x.Value).Sum().Should().Be(21);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await ws.UpdateAsync(bestEstimateIfrsVars);", + "\nawait ws.UpdateAsync(scenarioIfrsVars);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "(await ws.QueryReportVariablesAsync((args.Year, args.Month, args.ReportingNode, argsScenarioMTUP.Scenario))).Select(x => x.Value).Sum().Should().Be(21.2);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + } + ] +} \ No newline at end of file diff --git a/ifrs17/Test/TestData.ipynb b/ifrs17/Test/TestData.ipynb index 1326997d..f99634a7 100644 --- a/ifrs17/Test/TestData.ipynb +++ b/ifrs17/Test/TestData.ipynb @@ -15,6 +15,15 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ + { + "cell_type": "code", + "source": [ + "#!import \"../CalculationEngine\"" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [ @@ -221,7 +230,8 @@ "var groupOfInsuranceContracts = \"DT1.1\";", "\nvar groupOfReinsuranceContracts = \"DTR1.1\";", "\nvar reportingNode = \"CH\";", - "\nvar scenario = (string)null;" + "\nvar scenarioBestEstimate = (string)null;", + "\nvar scenarioMortalityUp = \"MTUP\";" ], "metadata": {}, "execution_count": 0, @@ -230,8 +240,9 @@ { "cell_type": "code", "source": [ - "var args = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenario, ImportFormats.Actual);", - "\nvar previousArgs = new ImportArgs(reportingNode, 2020, 12, Periodicity.Quarterly, scenario, ImportFormats.Actual);" + "var args = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenarioBestEstimate, ImportFormats.Actual);", + "\nvar previousArgs = new ImportArgs(reportingNode, 2020, 12, Periodicity.Quarterly, scenarioBestEstimate, ImportFormats.Actual);", + "\nvar argsScenarioMTUP = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenarioMortalityUp, ImportFormats.Actual);" ], "metadata": {}, "execution_count": 0, @@ -246,22 +257,34 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "var partitionReportingNode = new PartitionByReportingNode { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(args)),", + "\n ReportingNode = args.ReportingNode};" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ "var partition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(args)),", "\n ReportingNode = reportingNode, ", - "\n Scenario = scenario, ", + "\n Scenario = scenarioBestEstimate, ", "\n Year = args.Year,", "\n Month = args.Month };", "\nvar previousPeriodPartition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(previousArgs)),", "\n ReportingNode = reportingNode, ", - "\n Scenario = scenario, ", + "\n Scenario = scenarioBestEstimate, ", "\n Year = previousArgs.Year,", "\n Month = previousArgs.Month };", - "\nvar partitionReportingNode = new PartitionByReportingNode { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(args)),", - "\n ReportingNode = args.ReportingNode};", - "\n" + "\nvar partitionScenarioMTUP = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(argsScenarioMTUP)),", + "\n ReportingNode = reportingNode, ", + "\n Scenario = scenarioMortalityUp, ", + "\n Year = args.Year,", + "\n Month = args.Month };" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17/Test/Tests.ipynb b/ifrs17/Test/Tests.ipynb index a52dc9e6..ebe4b816 100644 --- a/ifrs17/Test/Tests.ipynb +++ b/ifrs17/Test/Tests.ipynb @@ -42,6 +42,15 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "#!eval-notebook \"QueriesScenarioDataTest\"" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ diff --git a/ifrs17/Utils/Queries.ipynb b/ifrs17/Utils/Queries.ipynb index e82f52b9..80031993 100644 --- a/ifrs17/Utils/Queries.ipynb +++ b/ifrs17/Utils/Queries.ipynb @@ -437,7 +437,7 @@ "\n where T : IPartitioned", "\n where P : IPartition", "\n{", - "\n var partitionBackup = (Guid)querySource.Partition.GetCurrent(typeof(P).Name);", + "\n var partitionBackup = (Guid)(querySource.Partition.GetCurrent(typeof(P).Name)?? default(Guid));", "\n await querySource.Partition.SetAsync

(partition);", "\n // Temporary workaround for physical database: where clause is necessary", "\n var data = await querySource.Query().Where(x => x.Partition == partition).ToArrayAsync();", From 9a89c98678ce041be54a1b651fd0572a0c342480 Mon Sep 17 00:00:00 2001 From: Andrea Muolo Date: Mon, 13 Feb 2023 16:33:37 +0100 Subject: [PATCH 2/5] add yield curve for scenarios test --- ifrs17/Test/QueriesTest.ipynb | 89 +++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 5 deletions(-) diff --git a/ifrs17/Test/QueriesTest.ipynb b/ifrs17/Test/QueriesTest.ipynb index 7e87e8b6..1f2ad527 100644 --- a/ifrs17/Test/QueriesTest.ipynb +++ b/ifrs17/Test/QueriesTest.ipynb @@ -589,6 +589,15 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ @@ -608,6 +617,15 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ @@ -746,7 +764,6 @@ "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"B\", Values = new double[]{6.1,6.2,6.3,6.4,6.5,6.6} }};", "\n", "\n(int year , int month, string yieldCurveName, string valuationApproach) dataNodeTestData = (2016, 2, \"A\", \"BBA\");", - "\n", "\nvar activity = await CheckLoadYieldCurveAsync(args, testData, dataNodeTestData, 10.1, 10.1);", "\nactivity" ], @@ -769,7 +786,7 @@ "source": [ "var expectedErrorMessage = Get(Error.YieldCurveNotFound, \"EUR\",\"2016\",\"12\",\"Best Estimate\",\"A\");", "\nvar errorMessage = activity.Errors.First().ToString();", - "\nerrorMessage.Contains(expectedErrorMessage).Should().Be(true)" + "\nerrorMessage.Contains(expectedErrorMessage).Should().Be(true);" ], "metadata": {}, "execution_count": 0, @@ -786,7 +803,6 @@ "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"B\", Values = new double[]{6.1,6.2,6.3,6.4,6.5,6.6} }};", "\n", "\n(int year , int month, string yieldCurveName, string valuationApproach) dataNodeTestData = (2016, 2, \"A\", \"BBA\");", - "\n", "\nvar activity = await CheckLoadYieldCurveAsync(args, testData, dataNodeTestData, 10.1, 10.1);", "\nactivity" ], @@ -798,7 +814,7 @@ "cell_type": "code", "source": [ "activity.Status.Should().Be(ActivityLogStatus.Failed);", - "\nactivity.Errors.Count().Should().Be(1)" + "\nactivity.Errors.Count().Should().Be(1);" ], "metadata": {}, "execution_count": 0, @@ -809,7 +825,70 @@ "source": [ "var expectedErrorMessage = Get(Error.YieldCurveNotFound, \"EUR\",\"2016\",\"9\",\"Best Estimate\",\"A\");", "\nvar errorMessage = activity.Errors.First().ToString();", - "\nerrorMessage.Contains(expectedErrorMessage).Should().Be(true)" + "\nerrorMessage.Contains(expectedErrorMessage).Should().Be(true);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,\"MTUP\");", + "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Name = \"A\", Values = new double[]{0.1,0.2,0.3,0.4,0.5,0.6} }, ", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Values = new double[]{1.1,1.2,1.3,1.4,1.5,1.6} }, ", + "\n new YieldCurve{ Currency = \"CHF\", Year = 2020, Month = 6, Name = \"A\", Values = new double[]{3.1,3.2,3.3,3.4,3.5,3.6} }, ", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Name = \"B\", Values = new double[]{2.1,2.2,2.3,2.4,2.5,2.6} }, ", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"A\", Values = new double[]{6.1,6.2,6.3,6.4,6.5,6.6} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Values = new double[]{9.1,9.2,9.3,9.4,9.5,9.6} },", + "\n new YieldCurve{ Currency = \"CHF\", Year = 2016, Month = 3, Name = \"A\", Values = new double[]{8.1,8.2,8.3,8.4,8.5,8.6} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"B\", Values = new double[]{7.1,7.2,7.3,7.4,7.5,7.6} }};", + "\n", + "\n(int year , int month, string yieldCurveName, string valuationApproach) dataNodeTestData = (2016, 6, \"A\", \"BBA\");", + "\nvar activity = await CheckLoadYieldCurveAsync(args, testData, dataNodeTestData, 9.1, 1.1, 6.1);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,\"MTUP\");", + "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Name = \"A\", Values = new double[]{0.1,0.2,0.3,0.4,0.5,0.6} }, ", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Values = new double[]{1.1,1.2,1.3,1.4,1.5,1.6} }, ", + "\n new YieldCurve{ Currency = \"CHF\", Year = 2020, Month = 6, Name = \"A\", Values = new double[]{3.1,3.2,3.3,3.4,3.5,3.6} }, ", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Name = \"B\", Values = new double[]{2.1,2.2,2.3,2.4,2.5,2.6} }, ", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"A\", Values = new double[]{6.1,6.2,6.3,6.4,6.5,6.6} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Values = new double[]{9.1,9.2,9.3,9.4,9.5,9.6} },", + "\n new YieldCurve{ Currency = \"CHF\", Year = 2016, Month = 3, Name = \"A\", Values = new double[]{8.1,8.2,8.3,8.4,8.5,8.6} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"B\", Values = new double[]{7.1,7.2,7.3,7.4,7.5,7.6} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Scenario = \"MTUP\", Values = new double[]{90.1,9.2,9.3} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Scenario = \"MTUP\", Values = new double[]{10.1,1.2,1.3} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"A\", Scenario = \"MTUP\", Values = new double[]{60.1,6.2,6.3} }, };", + "\n", + "\n(int year , int month, string yieldCurveName, string valuationApproach) dataNodeTestData = (2016, 6, \"A\", \"BBA\");", + "\nvar activity = await CheckLoadYieldCurveAsync(args, testData, dataNodeTestData, 9.1, 10.1, 60.1);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, From c63c4a066acd2a56e00909695edda15e84478ff1 Mon Sep 17 00:00:00 2001 From: Andrea Muolo Date: Tue, 14 Feb 2023 16:20:04 +0100 Subject: [PATCH 3/5] implement Davide feedback --- ifrs17/Test/ImportStorageTest.ipynb | 55 +++++++++++++++++++---- ifrs17/Test/QueriesScenarioDataTest.ipynb | 33 ++------------ ifrs17/Test/QueriesTest.ipynb | 12 ++--- ifrs17/Test/TestData.ipynb | 11 +---- 4 files changed, 58 insertions(+), 53 deletions(-) diff --git a/ifrs17/Test/ImportStorageTest.ipynb b/ifrs17/Test/ImportStorageTest.ipynb index 67a9871f..4de746ee 100644 --- a/ifrs17/Test/ImportStorageTest.ipynb +++ b/ifrs17/Test/ImportStorageTest.ipynb @@ -108,7 +108,7 @@ { "cell_type": "code", "source": [ - "await DataSource.UpdateAsync(new[]{partition, previousPeriodPartition});", + "await DataSource.UpdateAsync(new[]{partition, previousPeriodPartition, partitionScenarioMTUP});", "\nawait DataSource.UpdateAsync(new[]{partitionReportingNode});" ], "metadata": {}, @@ -127,7 +127,7 @@ { "cell_type": "code", "source": [ - "public async Task CheckIfrsVariablesFromImportStorageAsync(string importFormat, IEnumerable inputDataSetForWorkspace, IEnumerable inputDataSetForDataSource, IEnumerable ivsBenchmark)", + "public async Task CheckIfrsVariablesFromImportStorageAsync(string importFormat, IEnumerable inputDataSetForWorkspace, IEnumerable inputDataSetForDataSource, IEnumerable ivsBenchmark, ImportArgs args)", "\n{", "\n Activity.Start();", "\n //Prepare Workspace and DataSource", @@ -186,7 +186,7 @@ "\n basicIfrsVariable with {AocType = AocTypes.CF, Value = -10.0},", "\n basicIfrsVariable with {AocType = AocTypes.WO, Value = 15.0},", "\n };", - "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark, args);", "\nactivity" ], "metadata": {}, @@ -229,7 +229,7 @@ "\n basicIfrsVariable with {AocType = AocTypes.WO, Value = -20.0},", "\n };", "\n", - "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark, args);", "\nactivity" ], "metadata": {}, @@ -274,7 +274,7 @@ "\n basicIfrsVariable with {AocType = AocTypes.WO, EstimateType = EstimateTypes.AA, Novelty = Novelties.C, Value = -20.0},", "\n };", "\n", - "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark, args);", "\nactivity" ], "metadata": {}, @@ -327,7 +327,7 @@ "\n basicAdvanceActualIfrsVariable with {AocType = AocTypes.WO, Value = -20.0},", "\n };", "\n", - "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark, args);", "\nactivity" ], "metadata": {}, @@ -390,7 +390,46 @@ "\n basicIfrsVariable with {AocType = AocTypes.WO, Value = 15.0},", "\n };", "\n", - "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark, args);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "//There is a previous year, and for the current year Actuals are imported for a given Scenario", + "\nvar basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "\nvar inputDataSetForDataSource = new IfrsVariable[]{", + "\n basicIfrsVariable with {AocType = AocTypes.BOP, EstimateType = EstimateTypes.DA, Value = 1000.0},", + "\n basicIfrsVariable with {AocType = AocTypes.BOP, Value = 100.0},", + "\n basicIfrsVariable with {AocType = AocTypes.CL, Value = 150.0},", + "\n };", + "\n", + "\nvar inputDataSetForWorkspace = new IfrsVariable[]{", + "\n basicIfrsVariable with {Partition = partitionScenarioMTUP.Id, AocType = AocTypes.CL, Value = -15.0},", + "\n basicIfrsVariable with {Partition = partitionScenarioMTUP.Id, AmountType = AmountTypes.CL, AocType = AocTypes.CL, Value = -99.0},", + "\n };", + "\n", + "\nvar ivsBenchmark = new IfrsVariable[]{", + "\n basicIfrsVariable with {Partition = partition.Id, AocType = AocTypes.BOP, EstimateType = EstimateTypes.DA, Value = 1000.0},", + "\n basicIfrsVariable with {Partition = partition.Id, AocType = AocTypes.BOP, Value = 100.0},", + "\n basicIfrsVariable with {Partition = partitionScenarioMTUP.Id, AocType = AocTypes.CL, Value = -15.0},", + "\n basicIfrsVariable with {Partition = partitionScenarioMTUP.Id, AmountType = AmountTypes.CL, AocType = AocTypes.CL, Value = -99.0},", + "\n };", + "\n", + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark, argsScenarioMTUP);", "\nactivity" ], "metadata": {}, @@ -838,4 +877,4 @@ "outputs": [] } ] -} \ No newline at end of file +} diff --git a/ifrs17/Test/QueriesScenarioDataTest.ipynb b/ifrs17/Test/QueriesScenarioDataTest.ipynb index d50167fa..c14e9a7e 100644 --- a/ifrs17/Test/QueriesScenarioDataTest.ipynb +++ b/ifrs17/Test/QueriesScenarioDataTest.ipynb @@ -18,7 +18,9 @@ { "cell_type": "code", "source": [ - "#!import \"TestData\"" + "#!import \"../Utils/Queries\"", + "\n#!import \"../Report/ReportConfigurationAndUtils\"", + "\n#!import \"TestData\"" ], "metadata": {}, "execution_count": 0, @@ -371,33 +373,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "code", "source": [ @@ -408,4 +383,4 @@ "outputs": [] } ] -} \ No newline at end of file +} diff --git a/ifrs17/Test/QueriesTest.ipynb b/ifrs17/Test/QueriesTest.ipynb index 1f2ad527..e858f375 100644 --- a/ifrs17/Test/QueriesTest.ipynb +++ b/ifrs17/Test/QueriesTest.ipynb @@ -834,7 +834,7 @@ { "cell_type": "code", "source": [ - "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,\"MTUP\");", + "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,\"YCUP\");", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Name = \"A\", Values = new double[]{0.1,0.2,0.3,0.4,0.5,0.6} }, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Values = new double[]{1.1,1.2,1.3,1.4,1.5,1.6} }, ", "\n new YieldCurve{ Currency = \"CHF\", Year = 2020, Month = 6, Name = \"A\", Values = new double[]{3.1,3.2,3.3,3.4,3.5,3.6} }, ", @@ -864,7 +864,7 @@ { "cell_type": "code", "source": [ - "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,\"MTUP\");", + "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,\"YCUP\");", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Name = \"A\", Values = new double[]{0.1,0.2,0.3,0.4,0.5,0.6} }, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Values = new double[]{1.1,1.2,1.3,1.4,1.5,1.6} }, ", "\n new YieldCurve{ Currency = \"CHF\", Year = 2020, Month = 6, Name = \"A\", Values = new double[]{3.1,3.2,3.3,3.4,3.5,3.6} }, ", @@ -873,9 +873,9 @@ "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Values = new double[]{9.1,9.2,9.3,9.4,9.5,9.6} },", "\n new YieldCurve{ Currency = \"CHF\", Year = 2016, Month = 3, Name = \"A\", Values = new double[]{8.1,8.2,8.3,8.4,8.5,8.6} },", "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"B\", Values = new double[]{7.1,7.2,7.3,7.4,7.5,7.6} },", - "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Scenario = \"MTUP\", Values = new double[]{90.1,9.2,9.3} },", - "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Scenario = \"MTUP\", Values = new double[]{10.1,1.2,1.3} },", - "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"A\", Scenario = \"MTUP\", Values = new double[]{60.1,6.2,6.3} }, };", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Scenario = \"YCUP\", Values = new double[]{90.1,9.2,9.3} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Scenario = \"YCUP\", Values = new double[]{10.1,1.2,1.3} },", + "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Name = \"A\", Scenario = \"YCUP\", Values = new double[]{60.1,6.2,6.3} }, };", "\n", "\n(int year , int month, string yieldCurveName, string valuationApproach) dataNodeTestData = (2016, 6, \"A\", \"BBA\");", "\nvar activity = await CheckLoadYieldCurveAsync(args, testData, dataNodeTestData, 9.1, 10.1, 60.1);", @@ -1132,4 +1132,4 @@ "outputs": [] } ] -} \ No newline at end of file +} diff --git a/ifrs17/Test/TestData.ipynb b/ifrs17/Test/TestData.ipynb index f99634a7..5f2ef22b 100644 --- a/ifrs17/Test/TestData.ipynb +++ b/ifrs17/Test/TestData.ipynb @@ -15,15 +15,6 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ - { - "cell_type": "code", - "source": [ - "#!import \"../CalculationEngine\"" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "markdown", "source": [ @@ -418,4 +409,4 @@ "outputs": [] } ] -} \ No newline at end of file +} From c80e8e7c32c1b7d4110cd454ca3f9e6c54c11b7f Mon Sep 17 00:00:00 2001 From: Andrea Muolo Date: Fri, 17 Mar 2023 16:28:10 +0100 Subject: [PATCH 4/5] more tests --- ifrs17/Test/ImportStorageTest.ipynb | 194 +++++++++++-- ifrs17/Test/QueriesScenarioDataTest.ipynb | 324 +++++++++++++++++++++- ifrs17/Test/TestData.ipynb | 12 +- 3 files changed, 495 insertions(+), 35 deletions(-) diff --git a/ifrs17/Test/ImportStorageTest.ipynb b/ifrs17/Test/ImportStorageTest.ipynb index d7bf5c67..b6827a63 100644 --- a/ifrs17/Test/ImportStorageTest.ipynb +++ b/ifrs17/Test/ImportStorageTest.ipynb @@ -38,7 +38,17 @@ { "cell_type": "markdown", "source": [ - "# Workspace Initialization " + "# Initialization " + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.SetAsync();", + "\nDataSource.Reset(x => x.ResetCurrentPartitions());" ], "metadata": {}, "execution_count": 0, @@ -58,10 +68,10 @@ { "cell_type": "code", "source": [ - "await DataSource.UpdateAsync(dt1.RepeatOnce());", - "\nawait DataSource.UpdateAsync(dtr1.RepeatOnce());", - "\nawait DataSource.UpdateAsync(new [] {dt11});", - "\nawait DataSource.UpdateAsync(new [] {dtr11});" + "await DataSource.UpdateAsync(new[]{ dt1 });", + "\nawait DataSource.UpdateAsync(new[]{ dtr1 });", + "\nawait DataSource.UpdateAsync(new[]{ dt11 });", + "\nawait DataSource.UpdateAsync(new[]{ dtr11 });" ], "metadata": {}, "execution_count": 0, @@ -70,8 +80,8 @@ { "cell_type": "code", "source": [ - "await DataSource.UpdateAsync(new [ ] {dt11State, dtr11State});", - "\nawait DataSource.UpdateAsync(new [ ] {dt11Inter});" + "await DataSource.UpdateAsync(new[]{ dt11State, dtr11State });", + "\nawait DataSource.UpdateAsync(new[]{ dt11Inter });" ], "metadata": {}, "execution_count": 0, @@ -80,7 +90,7 @@ { "cell_type": "code", "source": [ - "await DataSource.UpdateAsync(new [ ] {yieldCurve, yieldCurvePrevious});" + "await DataSource.UpdateAsync(new[]{ yieldCurve, yieldCurvePrevious });" ], "metadata": {}, "execution_count": 0, @@ -117,7 +127,7 @@ { "cell_type": "markdown", "source": [ - "# Test" + "# Check method" ], "metadata": {}, "execution_count": 0, @@ -164,11 +174,31 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "# Test Best Estimate" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## A", + "\n", + "\nThere is a previous year, and it's the first time Actuals are imported for the current year." + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ - "//There is a previous year, and it's the first time Actuals are imported for the current year", - "\nvar basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "var basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "\n", "\nvar inputDataSetForDataSource = new IfrsVariable[]{", "\n basicIfrsVariable with {Partition = previousPeriodPartition.Id, AocType = AocTypes.EOP, Value = 100.0},", "\n basicIfrsVariable with {Partition = previousPeriodPartition.Id, AocType = AocTypes.EOP, EstimateType = EstimateTypes.DA, Value = 1000.0},", @@ -201,11 +231,22 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "## B", + "\n", + "\nThere is a previous year, and it's the second time Actuals are imported for the current year (reimport)." + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ - "//There is a previous year, and it's the second time Actuals are imported for the current year (reimport)", - "\nvar basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "var basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "\n", "\nvar inputDataSetForDataSource = new IfrsVariable[]{", "\n basicIfrsVariable with {Partition = previousPeriodPartition.Id, AocType = AocTypes.EOP, Value = 100.0},", "\n basicIfrsVariable with {Partition = previousPeriodPartition.Id, AocType = AocTypes.EOP, EstimateType = EstimateTypes.DA, Value = 1000.0},", @@ -244,11 +285,22 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "## C", + "\n", + "\nThere is a previous year, cash flow were already imported and actuals are imported for the first time." + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ - "//There is a previous year, Cash flows were already imported and Actuals are imported for the first time", - "\nvar basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.I, EstimateType = EstimateTypes.BE};", + "var basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.I, EstimateType = EstimateTypes.BE};", + "\n", "\nvar inputDataSetForDataSource = new IfrsVariable[]{", "\n basicIfrsVariable with {Partition = previousPeriodPartition.Id, AocType = AocTypes.EOP, EstimateType = EstimateTypes.AA, Novelty = Novelties.C, Value = 100.0},", "\n basicIfrsVariable with {Partition = previousPeriodPartition.Id, AocType = AocTypes.EOP, Value = 1000.0},", @@ -289,12 +341,23 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "## D", + "\n", + "\nThere is a previous year, Cash flows and Actuals were already imported and Actuals are imported again." + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ - "//There is a previous year, Cash flows and Actuals were already imported and Actuals are imported again", - "\nvar basicAdvanceActualIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "var basicAdvanceActualIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", "\nvar basicBeIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.I, EstimateType = EstimateTypes.BE};", + "\n", "\nvar inputDataSetForDataSource = new IfrsVariable[]{", "\n basicBeIfrsVariable with {Partition = previousPeriodPartition.Id, AocType = AocTypes.EOP, Value = 1000.0},", "\n basicBeIfrsVariable with {AocType = AocTypes.BOP, Novelty = Novelties.I, Value = 1000.0},", @@ -342,14 +405,26 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "## E", + "\n", + "\nThere is a previous year for Primary Scope (GRIC10) ", + "\n", + "\nThere is a previous and current year for Secondary Scope (GIC10), ", + "\n", + "\nIt's the first time Actuals are imported for the current year" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ - "//There is a previous year for Primary Scope (GRIC10) ", - "\n//There is a previous and current year for Secondary Scope (GIC10), ", - "\n//It's the first time Actuals are imported for the current year", + "var basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfReinsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", "\n", - "\nvar basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfReinsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", "\nvar inputDataSetForDataSource = new IfrsVariable[]{", "\n //Year", "\n basicIfrsVariable with {Partition = previousPeriodPartition.Id, AocType = AocTypes.EOP, Value = 100.0},", @@ -405,11 +480,31 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "# Test Scenario" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## A", + "\n", + "\nFor the current year Actuals are imported for Best Estimate and a given Scenario. The Relaxed query should return the union of the 2 giving priority to scenario data. " + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ - "//There is a previous year, and for the current year Actuals are imported for a given Scenario", - "\nvar basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "var basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "\n", "\nvar inputDataSetForDataSource = new IfrsVariable[]{", "\n basicIfrsVariable with {AocType = AocTypes.BOP, EstimateType = EstimateTypes.DA, Value = 1000.0},", "\n basicIfrsVariable with {AocType = AocTypes.BOP, Value = 100.0},", @@ -444,6 +539,57 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "## B", + "\n", + "\nThe primary scope is a GRIC scenario while the underlying GIC is Best Estimate." + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var basicIfrsVariable = new IfrsVariable{Partition = partition.Id, DataNode = groupOfInsuranceContracts, AccidentYear = null, AmountType = AmountTypes.PR, Novelty = Novelties.C, EstimateType = EstimateTypes.AA};", + "\n", + "\nvar inputDataSetForDataSource = new IfrsVariable[]{", + "\n basicIfrsVariable with {AocType = AocTypes.BOP, EstimateType = EstimateTypes.DA, Value = 1000.0},", + "\n basicIfrsVariable with {AocType = AocTypes.BOP, Value = 100.0},", + "\n basicIfrsVariable with {AocType = AocTypes.CL, Value = 150.0},", + "\n};", + "\n", + "\nvar inputDataSetForWorkspace = new IfrsVariable[]{", + "\n basicIfrsVariable with {Partition = partitionScenarioMTUP.Id, DataNode = groupOfReinsuranceContracts, AocType = AocTypes.CL, Value = -15.0},", + "\n basicIfrsVariable with {Partition = partitionScenarioMTUP.Id, DataNode = groupOfReinsuranceContracts, AmountType = AmountTypes.CL, AocType = AocTypes.CL, Value = -99.0},", + "\n};", + "\n", + "\nvar ivsBenchmark = new IfrsVariable[]{", + "\n basicIfrsVariable with {Partition = partition.Id, AocType = AocTypes.BOP, EstimateType = EstimateTypes.DA, Value = 1000.0},", + "\n basicIfrsVariable with {Partition = partition.Id, AocType = AocTypes.BOP, Value = 100.0},", + "\n basicIfrsVariable with {Partition = partition.Id, AocType = AocTypes.CL, Value = 150.0},", + "\n basicIfrsVariable with {Partition = partitionScenarioMTUP.Id, DataNode = groupOfReinsuranceContracts, AocType = AocTypes.CL, Value = -15.0},", + "\n basicIfrsVariable with {Partition = partitionScenarioMTUP.Id, DataNode = groupOfReinsuranceContracts, AmountType = AmountTypes.CL, AocType = AocTypes.CL, Value = -99.0},", + "\n};", + "\n", + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark, argsScenarioMTUP);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [ @@ -876,4 +1022,4 @@ "outputs": [] } ] -} +} \ No newline at end of file diff --git a/ifrs17/Test/QueriesScenarioDataTest.ipynb b/ifrs17/Test/QueriesScenarioDataTest.ipynb index c14e9a7e..a230e4f4 100644 --- a/ifrs17/Test/QueriesScenarioDataTest.ipynb +++ b/ifrs17/Test/QueriesScenarioDataTest.ipynb @@ -1,6 +1,7 @@ { "metadata": { "authors": [], + "id": "rHk2-5mImky-sdiEfRUCdw", "kernelspec": { "display_name": "Formula Framework", "language": "C#", @@ -39,7 +40,7 @@ "cell_type": "code", "source": [ "await DataSource.UpdateAsync( new[] { partitionReportingNode } );", - "\nawait DataSource.UpdateAsync( new[] { partition, previousPeriodPartition, partitionScenarioMTUP } );", + "\nawait DataSource.UpdateAsync( new[] { partition, previousPeriodPartition, partitionScenarioMTUP, previousPeriodPartitionScenarioMTUP } );", "\nawait DataSource.UpdateAsync( new[] { dt11 } );" ], "metadata": {}, @@ -49,7 +50,7 @@ { "cell_type": "markdown", "source": [ - "# Import" + "# Import Queries: Raw Variables" ], "metadata": {}, "execution_count": 0, @@ -58,7 +59,7 @@ { "cell_type": "markdown", "source": [ - "## Data" + "## Data definition" ], "metadata": {}, "execution_count": 0, @@ -78,6 +79,16 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "var previousScenarioRawVars = new[] { new RawVariable { AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = previousPeriodPartitionScenarioMTUP.Id, Values = new[] {3.15} }, ", + "\n new RawVariable { AmountType = \"PR\", AocType = \"AU\", Novelty = \"I\", Partition = previousPeriodPartitionScenarioMTUP.Id, Values = new[] {7.17} } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ @@ -101,7 +112,7 @@ { "cell_type": "markdown", "source": [ - "## Scenario Query and Workspace with scenario data" + "## Scenario Query and Workspace with new scenario" ], "metadata": {}, "execution_count": 0, @@ -141,7 +152,7 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no new scenario data, mismatching import format" + "## Scenario query, Workspace with no scenario, mismatching format" ], "metadata": {}, "execution_count": 0, @@ -180,7 +191,7 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no new scenario data and DataSource with scenario data" + "## Scenario query, Workspace with no scenario and DataSource with scenario" ], "metadata": {}, "execution_count": 0, @@ -219,7 +230,7 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no new scenario data and DataSource with only Best Estimate data" + "## Scenario query, Workspace with no scenario and DataSource with only Best Estimate" ], "metadata": {}, "execution_count": 0, @@ -255,6 +266,303 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query, Workspace with no scenario and DataSource with Best Estimate and previous period scenario" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateRawVars.Concat(previousScenarioRawVars).ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var queriedRawVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Cashflow);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedRawVars.SelectMany(x => x.Values).Sum().Should().Be(21);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "# Import Queries: Ifrs Variables" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Data definition" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var bestEstimateIfrsVars = new[] { new IfrsVariable { AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = partition.Id, Value = 1.0 }, ", + "\n new IfrsVariable { AmountType = \"PR\", AocType = \"AU\", Novelty = \"I\", Partition = partition.Id, Value = 2.0 },", + "\n new IfrsVariable { AmountType = \"PR\", AocType = \"EV\", Novelty = \"I\", Partition = partition.Id, Value = 3.0 },", + "\n new IfrsVariable { AmountType = \"CL\", AocType = \"CL\", Novelty = \"I\", Partition = partition.Id, Value = 4.0 },", + "\n new IfrsVariable { AmountType = \"CL\", AocType = \"AU\", Novelty = \"I\", Partition = partition.Id, Value = 5.0 },", + "\n new IfrsVariable { AmountType = \"CL\", AocType = \"EV\", Novelty = \"I\", Partition = partition.Id, Value = 6.0 } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var previousScenarioIfrsVars = new[] { new IfrsVariable { AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = previousPeriodPartitionScenarioMTUP.Id, Value = 3.15 }, ", + "\n new IfrsVariable { AmountType = \"PR\", AocType = \"AU\", Novelty = \"I\", Partition = previousPeriodPartitionScenarioMTUP.Id, Value = 7.17 } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var scenarioIfrsVars = new[] { new IfrsVariable { AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Value = 1.1 }, ", + "\n new IfrsVariable { AmountType = \"PR\", AocType = \"AU\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Value = 2.1 } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var newScenarioIfrsVars = new[] { new IfrsVariable { AmountType = \"PR\", AocType = \"CL\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Value = 11.0 }, ", + "\n new IfrsVariable { AmountType = \"CL\", AocType = \"CL\", Novelty = \"I\", Partition = partitionScenarioMTUP.Id, Value = 41.0 } };" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario Query and Workspace with new scenario" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateIfrsVars.Concat(scenarioIfrsVars).ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await ws.UpdateAsync(newScenarioIfrsVars);", + "\nvar queriedIfrsVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Actual);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedIfrsVars.Select(x => x.Value).Sum().Should().Be(52.0);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query, Workspace with no scenario, mismatching format" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateIfrsVars.Concat(scenarioIfrsVars).ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var queriedIfrsVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Cashflow);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedIfrsVars.Select(x => x.Value).Sum().Should().Be(0);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query, Workspace with no scenario and DataSource with scenario" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateIfrsVars.Concat(scenarioIfrsVars).ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var queriedIfrsVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Actual);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedIfrsVars.Select(x => x.Value).Sum().Should().Be(3.2);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query, Workspace with no new scenario and DataSource with only Best Estimate" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateIfrsVars.ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var queriedIfrsVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Actual);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedIfrsVars.Select(x => x.Value).Sum().Should().Be(21);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Scenario query, Workspace with no scenario and DataSource with Best Estimate and previous period scenario" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", + "\nawait DataSource.UpdateAsync( bestEstimateIfrsVars.Concat(previousScenarioIfrsVars).ToArray() );", + "\nvar ws = Workspace.CreateNew();", + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var queriedIfrsVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Actual);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "queriedIfrsVars.Select(x => x.Value).Sum().Should().Be(21);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [ @@ -383,4 +691,4 @@ "outputs": [] } ] -} +} \ No newline at end of file diff --git a/ifrs17/Test/TestData.ipynb b/ifrs17/Test/TestData.ipynb index 4949baa1..e660e2a6 100644 --- a/ifrs17/Test/TestData.ipynb +++ b/ifrs17/Test/TestData.ipynb @@ -234,7 +234,8 @@ "source": [ "var args = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenarioBestEstimate, ImportFormats.Actual);", "\nvar previousArgs = new ImportArgs(reportingNode, 2020, 12, Periodicity.Quarterly, scenarioBestEstimate, ImportFormats.Actual);", - "\nvar argsScenarioMTUP = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenarioMortalityUp, ImportFormats.Actual);" + "\nvar argsScenarioMTUP = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenarioMortalityUp, ImportFormats.Actual);", + "\nvar previousScenarioArgsMTUP = new ImportArgs(reportingNode, 2020, 12, Periodicity.Quarterly, scenarioMortalityUp, ImportFormats.Actual);" ], "metadata": {}, "execution_count": 0, @@ -276,7 +277,12 @@ "\n ReportingNode = reportingNode, ", "\n Scenario = scenarioMortalityUp, ", "\n Year = args.Year,", - "\n Month = args.Month };" + "\n Month = args.Month };", + "\nvar previousPeriodPartitionScenarioMTUP = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(previousScenarioArgsMTUP)),", + "\n ReportingNode = reportingNode, ", + "\n Scenario = scenarioMortalityUp, ", + "\n Year = previousScenarioArgsMTUP.Year,", + "\n Month = previousScenarioArgsMTUP.Month };" ], "metadata": {}, "execution_count": 0, @@ -410,4 +416,4 @@ "outputs": [] } ] -} +} \ No newline at end of file From 527b2b90fd6893946e178237f9894ec3e336b4c3 Mon Sep 17 00:00:00 2001 From: Davide Colleoni Date: Fri, 24 Mar 2023 12:19:19 +0100 Subject: [PATCH 5/5] add small description to use cases --- ifrs17/Test/QueriesScenarioDataTest.ipynb | 85 ++++++++++++++++++----- 1 file changed, 67 insertions(+), 18 deletions(-) diff --git a/ifrs17/Test/QueriesScenarioDataTest.ipynb b/ifrs17/Test/QueriesScenarioDataTest.ipynb index a230e4f4..6caa9e49 100644 --- a/ifrs17/Test/QueriesScenarioDataTest.ipynb +++ b/ifrs17/Test/QueriesScenarioDataTest.ipynb @@ -112,7 +112,12 @@ { "cell_type": "markdown", "source": [ - "## Scenario Query and Workspace with new scenario" + "## Scenario Query and Workspace with new scenario", + "\n", + "\nRaw variable query test.
", + "\nScenario cashflow re-import.
", + "\nDataSource with BestEstimate and Scenario raw variable, Workspace with new raw variable for Scenario.
", + "\n " ], "metadata": {}, "execution_count": 0, @@ -124,7 +129,8 @@ "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", "\nawait DataSource.UpdateAsync( bestEstimateRawVars.Concat(scenarioRawVars).ToArray() );", "\nvar ws = Workspace.CreateNew();", - "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());", + "\nawait ws.UpdateAsync(newScenarioRawVars);" ], "metadata": {}, "execution_count": 0, @@ -133,8 +139,7 @@ { "cell_type": "code", "source": [ - "await ws.UpdateAsync(newScenarioRawVars);", - "\nvar queriedRawVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Cashflow);" + "var queriedRawVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Cashflow);" ], "metadata": {}, "execution_count": 0, @@ -152,7 +157,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no scenario, mismatching format" + "## Scenario query, Workspace with no scenario, mismatching format", + "\n", + "\nRaw variable query test.
", + "\nScenario Actual import.
", + "\nDataSource with BestEstimate and Scenario raw variable.
" ], "metadata": {}, "execution_count": 0, @@ -191,7 +200,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no scenario and DataSource with scenario" + "## Scenario query, Workspace with no scenario and DataSource with scenario", + "\n", + "\nRaw variable query test.
", + "\nScenario parameter (re-)import.
", + "\nDataSource with BestEstimate and Scenario raw variable, Workspace without any raw variable.
" ], "metadata": {}, "execution_count": 0, @@ -230,7 +243,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no scenario and DataSource with only Best Estimate" + "## Scenario query, Workspace with no scenario and DataSource with only Best Estimate", + "\n", + "\nRaw variable query test.
", + "\nScenario parameter (re-)import.
", + "\nDataSource with BestEstimate raw variable, Workspace without any raw variable.
" ], "metadata": {}, "execution_count": 0, @@ -269,7 +286,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no scenario and DataSource with Best Estimate and previous period scenario" + "## Scenario query, Workspace with no scenario and DataSource with Best Estimate and previous period scenario", + "\n", + "\nRaw variable query test.
", + "\nScenario parameter (re-)import.
", + "\nDataSource with BestEstimate and previous period Scenario raw variable, Workspace without any raw variable.
" ], "metadata": {}, "execution_count": 0, @@ -370,7 +391,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario Query and Workspace with new scenario" + "## Scenario Query and Workspace with new scenario", + "\n", + "\nIfrs variable query test.
", + "\nScenario Actual re-import.
", + "\nDataSource with BestEstimate and Scenario ifrs variable, Workspace with new ifrs variable for Scenario.
" ], "metadata": {}, "execution_count": 0, @@ -382,7 +407,8 @@ "await DataSource.DeleteAsync( await DataSource.Query().ToArrayAsync() );", "\nawait DataSource.UpdateAsync( bestEstimateIfrsVars.Concat(scenarioIfrsVars).ToArray() );", "\nvar ws = Workspace.CreateNew();", - "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());" + "\nws.Initialize(x => x.FromSource(DataSource).DisableInitialization().DisableInitialization());", + "\nawait ws.UpdateAsync(newScenarioIfrsVars);" ], "metadata": {}, "execution_count": 0, @@ -391,8 +417,7 @@ { "cell_type": "code", "source": [ - "await ws.UpdateAsync(newScenarioIfrsVars);", - "\nvar queriedIfrsVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Actual);" + "var queriedIfrsVars = await ws.QueryPartitionedDataAsync(DataSource, partitionScenarioMTUP.Id, partition.Id, ImportFormats.Actual);" ], "metadata": {}, "execution_count": 0, @@ -410,7 +435,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no scenario, mismatching format" + "## Scenario query, Workspace with no scenario, mismatching format", + "\n", + "\nIfrs variable query test.
", + "\nScenario parameter (re-)import.
", + "\nDataSource with BestEstimate and Scenario ifrs variable, Workspace without any ifrs variable.
" ], "metadata": {}, "execution_count": 0, @@ -449,7 +478,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no scenario and DataSource with scenario" + "## Scenario query, Workspace with no scenario and DataSource with scenario", + "\n", + "\nIfrs variable query test.
", + "\nScenario Actual import of an empty file.
", + "\nDataSource with BestEstimate and Scenario ifrs variable, Workspace without any ifrs variable.
" ], "metadata": {}, "execution_count": 0, @@ -488,7 +521,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no new scenario and DataSource with only Best Estimate" + "## Scenario query, Workspace with no new scenario and DataSource with only Best Estimate", + "\n", + "\nIfrs variable query test.
", + "\nScenario Actual import of an empty file.
", + "\nDataSource with BestEstimate ifrs variable, Workspace without any ifrs variable.
" ], "metadata": {}, "execution_count": 0, @@ -527,7 +564,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query, Workspace with no scenario and DataSource with Best Estimate and previous period scenario" + "## Scenario query, Workspace with no scenario and DataSource with Best Estimate and previous period scenario", + "\n", + "\nIfrs variable query test.
", + "\nScenario Actual import of an empty file.
", + "\nDataSource with BestEstimate and previous period Scenario ifrs variable, Workspace without any ifrs variable.
" ], "metadata": {}, "execution_count": 0, @@ -608,7 +649,11 @@ { "cell_type": "markdown", "source": [ - "## Best estimate query" + "## Best estimate query", + "\n", + "\nReport variable query test.
", + "\nReport for Best Estimate ( or Scenario Delta and Scenario All).
", + "\nDataSource and Workspace with BestEstimate and Scenario ifrs variable.
" ], "metadata": {}, "execution_count": 0, @@ -646,7 +691,11 @@ { "cell_type": "markdown", "source": [ - "## Scenario query" + "## Scenario query", + "\n", + "\nReport variable query test.
", + "\nReport for Scenario.
", + "\nDataSource and Workspace with BestEstimate and Scenario ifrs variable.
" ], "metadata": {}, "execution_count": 0,