Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,6 @@ BE,Best Estimate,,,,,,,,,,
SystemName,DisplayName,,,,,,,,,,
BBA,Building Block Approach,,,,,,,,,,
,,,,,,,,,,,
@@PartitionByReportingNode,,,,,,,,,,,
ReportingNode,Id,,,,,,,,,,
CH,00000000-0000-0000-0000-000000000001,,,,,,,,,,
,,,,,,,,,,,
@@PartitionByReportingNodeAndPeriod,,,,,,,,,,,
ReportingNode,Year,Month,Id,,,,,,,,
CH,2020,12,10000000-0000-0000-0000-000000000000,,,,,,,,
CH,2021,3,20000000-0000-0000-0000-000000000000,,,,,,,,
,,,,,,,,,,,
@@ProjectionConfiguration,,,,,,,,,,,
SystemName,DisplayName,Shift,TimeStep,,,,,,,,
P0,End of January,0,1,,,,,,,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
{
"cell_type": "code",
"source": [
"await Import.FromFile(\"../Files/DimensionsAndPartitions.csv\")",
"await Import.FromFile(\"../Files/Dimensions.csv\")",
"\n .WithType<Novelty>()",
"\n .WithType<AocType>()",
"\n .WithType<PnlVariableType>()",
Expand All @@ -100,7 +100,7 @@
{
"cell_type": "code",
"source": [
"await Import.FromFile(\"../Files/DimensionsAndPartitions.csv\").WithFormat(ImportFormats.AocConfiguration).WithTarget(DataSource).ExecuteAsync()"
"await Import.FromFile(\"../Files/Dimensions.csv\").WithFormat(ImportFormats.AocConfiguration).WithTarget(DataSource).ExecuteAsync()"
]
},
{
Expand All @@ -109,16 +109,6 @@
"await Import.FromFile(\"../Files/300.ReportingNodes/ReportingNodes.csv\").WithType<ReportingNode>().WithTarget(DataSource).ExecuteAsync()"
]
},
{
"cell_type": "code",
"source": [
"await Import.FromFile(\"../Files/DimensionsAndPartitions.csv\")",
"\n .WithType<PartitionByReportingNode>()",
"\n .WithType<PartitionByReportingNodeAndPeriod>()",
"\n .WithTarget(DataSource)",
"\n .ExecuteAsync()"
]
},
{
"cell_type": "markdown",
"source": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
{
"cell_type": "code",
"source": [
"await Import.FromFile(\"../Files/DimensionsAndPartitions.csv\")",
"await Import.FromFile(\"../Files/Dimensions.csv\")",
"\n .WithType<Novelty>()",
"\n .WithType<AocType>()",
"\n .WithType<PnlVariableType>()",
Expand Down Expand Up @@ -87,16 +87,6 @@
"await Import.FromFile(\"../Files/300.ReportingNodes/ReportingNodes.csv\").WithType<ReportingNode>().WithTarget(DataSource).ExecuteAsync()"
]
},
{
"cell_type": "code",
"source": [
"await Import.FromFile(\"../Files/DimensionsAndPartitions.csv\")",
"\n .WithType<PartitionByReportingNode>()",
"\n .WithType<PartitionByReportingNodeAndPeriod>()",
"\n .WithTarget(DataSource)",
"\n .ExecuteAsync()"
]
},
{
"cell_type": "markdown",
"source": [
Expand Down
25 changes: 19 additions & 6 deletions full-ifrs17-template/Test/AocStructureTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
{
"cell_type": "code",
"source": [
"Workspace.InitializeFrom(DataSource);"
"Workspace.Initialize(x => x.FromSource(DataSource)",
"\n .DisableInitialization<RawVariable>()",
"\n .DisableInitialization<IfrsVariable>());"
]
},
{
Expand All @@ -50,10 +52,22 @@
{
"cell_type": "code",
"source": [
"var args = new ImportArgs(\"CH\", 2021, 3, Periodicity.Quarterly, null, ImportFormats.Cashflow);",
"\nvar partition = Workspace.Query<PartitionByReportingNodeAndPeriod>().FirstOrDefault(x => x.ReportingNode == args.ReportingNode && x.Year == args.Year && ",
"\n x.Month == args.Month && x.Scenario == args.Scenario);",
"\nif(partition == null) ApplicationMessage.Log(Error.PartitionNotFound);"
"var reportingNode = \"CH\";",
"\nvar scenario = (string)null;"
]
},
{
"cell_type": "code",
"source": [
"//Define partition",
"\nvar args = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenario, ImportFormats.Actual);",
"\nvar partition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync<PartitionByReportingNode>(args)),",
"\n ReportingNode = reportingNode, ",
"\n Scenario = scenario, ",
"\n Year = args.Year,",
"\n Month = args.Month };",
"\nawait DataSource.UpdateAsync(new[]{partition});",
"\nawait DataSource.CommitAsync();"
]
},
{
Expand Down Expand Up @@ -296,7 +310,6 @@
"\n new AocStep(\"EA\",\"C\"), new AocStep(\"AM\",\"C\"), new AocStep(\"CL\",\"C\"),",
"\n }},",
"\n //{new AocStep(\"CF\",\"C\"), Enumerable.Empty<AocStep>()},",
"\n ",
"\n };"
]
},
Expand Down
30 changes: 19 additions & 11 deletions full-ifrs17-template/Test/ImportStorageTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"cell_type": "code",
"source": [
"Workspace.Initialize(x => x.FromSource(DataSource)",
"\n .DisableInitialization<RawVariable>()",
"\n .DisableInitialization<IfrsVariable>());"
"\n .DisableInitialization<RawVariable>()",
"\n .DisableInitialization<IfrsVariable>());"
]
},
{
Expand All @@ -53,21 +53,29 @@
"cell_type": "code",
"source": [
"var gic = \"DT1.1\";",
"\nvar gric = \"DTR1.1\";"
"\nvar gric = \"DTR1.1\";",
"\nvar reportingNode = \"CH\";",
"\nvar scenario = (string)null;"
]
},
{
"cell_type": "code",
"source": [
"//Define partition",
"\nvar args = new ImportArgs(\"CH\", 2021, 3, Periodicity.Quarterly, null, ImportFormats.Actual);",
"\nvar partition = DataSource.Query<PartitionByReportingNodeAndPeriod>().FirstOrDefault(x => x.ReportingNode == args.ReportingNode && x.Year == args.Year && ",
"\n x.Month == args.Month && x.Scenario == args.Scenario);",
"\nif(partition == null) ApplicationMessage.Log(Error.PartitionNotFound);",
"\n",
"\nvar previousPeriodPartition = Workspace.Query<PartitionByReportingNodeAndPeriod>().FirstOrDefault(x => x.ReportingNode == args.ReportingNode && x.Year == args.Year - 1 && ",
"\n x.Month == MonthInAYear && x.Scenario == args.Scenario);",
"\nif(previousPeriodPartition == null) ApplicationMessage.Log(Error.PartitionNotFound);"
"\nvar args = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenario, ImportFormats.Actual);",
"\nvar previousArgs = new ImportArgs(reportingNode, 2020, 12, Periodicity.Quarterly, scenario, ImportFormats.Actual);",
"\nvar partition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync<PartitionByReportingNode>(args)),",
"\n ReportingNode = reportingNode, ",
"\n Scenario = scenario, ",
"\n Year = args.Year,",
"\n Month = args.Month };",
"\nvar previousPeriodPartition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync<PartitionByReportingNode>(previousArgs)),",
"\n ReportingNode = reportingNode, ",
"\n Scenario = scenario, ",
"\n Year = args.Year,",
"\n Month = args.Month };",
"\nawait DataSource.UpdateAsync(new[]{partition, previousPeriodPartition});",
"\nawait DataSource.CommitAsync();"
]
},
{
Expand Down
19 changes: 3 additions & 16 deletions full-ifrs17-template/Test/MapTemplateAndImportTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,7 @@
"\ngricCols.Intersect(tables.Tables[nameof(GroupOfReinsuranceContract)].Columns.Select(x => x.ColumnName).ToArray()).Count().Should().Be(gricCols.Length); ",
"\n",
"\n// check that imported data matches the exported data",
"\nvar args = await GetArgsFromMainAsync<PartitionByReportingNode>(filename+\".xlsx\");",
"\nvar storage = new ParsingStorage(args, DataSource, Workspace);",
"\nawait storage.InitializeAsync();",
"\n",
"\nawait UploadDataNodesToWorkspaceAsync(filename+\".xlsx\");",
"\nawait Import.FromFile(filename+\".xlsx\").WithFormat(ImportFormats.DataNode).WithTarget(Workspace).ExecuteAsync();",
"\nUtils.EqualityComparer<InsurancePortfolio>(ips, Workspace.Query<InsurancePortfolio>().ToArray());",
"\nUtils.EqualityComparer<ReinsurancePortfolio>(rps, Workspace.Query<ReinsurancePortfolio>().ToArray());",
"\nUtils.EqualityComparer<GroupOfInsuranceContract>(gics, Workspace.Query<GroupOfInsuranceContract>().ToArray());",
Expand Down Expand Up @@ -245,12 +241,7 @@
"\ndataNodeStateCols.Intersect(tables.Tables[\"DataNodeState\"].Columns.Select(x => x.ColumnName).ToArray()).Count().Should().Be(dataNodeStateCols.Length);",
"\n",
"\n// check that imported data matches the exported data ",
"\nvar args = await GetArgsFromMainAsync<PartitionByReportingNode>(filename+\".xlsx\");",
"\nvar storage = new ParsingStorage(args, DataSource, Workspace);",
"\nawait storage.InitializeAsync();",
"\n",
"\nawait UploadDataNodeStateToWorkspaceAsync(filename+\".xlsx\");",
"\n",
"\nawait Import.FromFile(filename+\".xlsx\").WithFormat(ImportFormats.DataNodeState).WithTarget(Workspace).ExecuteAsync();",
"\n// Workspace is empty because ValidateDataNodeStatesAsync removes the entry, since this is already present in the DataSource.",
"\nWorkspace.Query<DataNodeState>().ToArray().Should().BeEmpty();",
"\n*/"
Expand Down Expand Up @@ -330,11 +321,7 @@
"\nsingleDataNodeParamCols.Intersect(tables.Tables[nameof(SingleDataNodeParameter)].Columns.Select(x => x.ColumnName).ToArray()).Count().Should().Be(singleDataNodeParamCols.Length);",
"\ninterDataNodeParamCols.Intersect(tables.Tables[nameof(InterDataNodeParameter)].Columns.Select(x => x.ColumnName).ToArray()).Count().Should().Be(interDataNodeParamCols.Length);",
"\n// check that imported data matches the exported data ",
"\nvar args = await GetArgsFromMainAsync<PartitionByReportingNode>(filename+\".xlsx\");",
"\nvar storage = new ParsingStorage(args, DataSource, Workspace);",
"\nvar targetPartitionByReportingNodeId = new Guid();",
"\nawait storage.InitializeAsync();",
"\nawait UploadDataNodeParameterToWorkspaceAsync(filename+\".xlsx\", targetPartitionByReportingNodeId);",
"\nawait Import.FromFile(filename+\".xlsx\").WithFormat(ImportFormats.DataNodeParameter).WithTarget(Workspace).ExecuteAsync();",
"\nvar expectedSingleDataNodeParamBm = Workspace.Query<SingleDataNodeParameter>().Where(x => x.Year == partition.Year && x.Month == partition.Month).ToArray();",
"\nvar expectedInterDataNodeParamBm = Workspace.Query<InterDataNodeParameter>().ToArray();",
"\nUtils.EqualityComparer<SingleDataNodeParameter>(singleDataNodeParamBm, expectedSingleDataNodeParamBm);",
Expand Down
4 changes: 4 additions & 0 deletions ifrs17/Constants/Validations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"public enum Error { ",
"\n // Import",
"\n NoMainTab, IncompleteMainTab, ParsingScientificNotation, ValueTypeNotFound, ValueTypeNotValid, ",
"\n ReportingNodeInMainNotFound, YearInMainNotFound, MonthInMainNotFound,",
"\n AocTypeNotValid, AocTypeCompulsoryNotFound, AocTypePositionNotSupported, AocConfigurationOrderNotUnique,",
"\n // Partition",
"\n PartitionNotFound, ParsedPartitionNotFound, PartititionNameNotFound, PartitionTypeNotFound,",
Expand Down Expand Up @@ -95,6 +96,9 @@
"\n (Error.ParsingScientificNotation , 1) => $\"While parsing found real number in scientific notation: {s[0]}.\",",
"\n (Error.ValueTypeNotFound , _) => $\"Value Type not found.\",",
"\n (Error.ValueTypeNotValid , 1) => $\"The Value Type {s[0]} is invalid.\",",
"\n (Error.ReportingNodeInMainNotFound , _) => $\"Reporting Node missing from the Main tab.\",",
"\n (Error.YearInMainNotFound , _) => $\"Year missing from the Main tab.\",",
"\n (Error.MonthInMainNotFound , _) => $\"Month missing from the Main tab.\",",
"\n (Error.AocTypeNotValid , 1) => $\"The parsed AocType {s[0]} is invalid.\",",
"\n (Error.AocTypeCompulsoryNotFound , _) => $\"Not all compulsory AocTypes have been imported.\",",
"\n (Error.AocTypePositionNotSupported , 1) => $\"The position of the AocType {s[0]} is not supported.\",",
Expand Down
Loading