Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop to main #115

Merged
merged 44 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e1f4622
Merge pull request #29 from Systemorph/importCeProject
dcolleoni Sep 28, 2022
4abedf9
Merge pull request #31 from Systemorph/OpeningImporterBug
sbusato Sep 29, 2022
0c3428a
Rename "PvBase" to "PresentValue" (#32)
nnikolopoulos Sep 30, 2022
2b320ea
Merge pull request #36 from Systemorph/CleanUpNotebooksSpaces
sbusato Oct 5, 2022
f9dd259
Merge pull request #37 from Systemorph/ReorderGlobalMetadata
sbusato Oct 6, 2022
e07f578
Break utils nb (#33)
dcolleoni Oct 6, 2022
5c0d5d3
Merge pull request #38 from Systemorph/FXinPl
dcolleoni Oct 7, 2022
76a9c82
Rename calculation type with estimate type (#34)
nnikolopoulos Oct 7, 2022
23591f3
Merge pull request #40 from Systemorph/defaultsStateParameters
amuolo Oct 10, 2022
08a2bc5
Merge pull request #42 from Systemorph/ExtractDataProject
dcolleoni Oct 12, 2022
3974104
Merge pull request #44 from Systemorph/UpdatePackageAndFixCsm
dcolleoni Oct 14, 2022
1573f47
Merge pull request #43 from Systemorph/defaultAocConfig
amuolo Oct 17, 2022
f57be90
Update links (#51)
dcolleoni Oct 20, 2022
8ec67f6
Simple value test data (#54)
dtrzesniak Oct 24, 2022
f7eb0c6
Overview texts (#53)
UMueller1 Oct 26, 2022
459b088
Merge pull request #55 from Systemorph/removalArithmetic
amuolo Oct 27, 2022
0c8614d
Interactive reports (#58)
dcolleoni Oct 31, 2022
a2496c1
New format design in importers (#62)
nnikolopoulos Nov 2, 2022
75c5f79
Package update (#65)
dcolleoni Nov 3, 2022
64e2243
Fixing AA and OA opening and benchmark simple importer (#57)
dtrzesniak Nov 4, 2022
02d0676
Aggregate by in report variable (#67)
sbusato Nov 7, 2022
1bf5c06
Clean up doc (#71)
dcolleoni Nov 7, 2022
0458d87
Update issue templates (#69)
dcolleoni Nov 7, 2022
a9a30ce
Merge pull request #72 from Systemorph/NoMorePartitions
amuolo Nov 7, 2022
a96e79e
Doc cleanup2 (#76)
dcolleoni Nov 9, 2022
5ec6d03
Merge pull request #45 from Systemorph/Multiple_Scenario_Implementation
amuolo Nov 9, 2022
e915152
packages + withGridOption + await HierarchyCache init (#83)
dcolleoni Nov 14, 2022
2af3dd3
Change in ReportMutableScopes NB (#85)
nnikolopoulos Nov 14, 2022
6f61f26
New metadata (#87)
nnikolopoulos Nov 15, 2022
b6bb12b
Rename pv amount type (#88)
nnikolopoulos Nov 15, 2022
810f68b
New metadatax2 (#91)
nnikolopoulos Nov 16, 2022
4ca49d0
Signs and actuals (#77)
dtrzesniak Nov 16, 2022
23c4cf2
Present value series (#70)
tkukuljan Nov 18, 2022
7e2499f
Update Reports.ipynb (#96)
amuolo Nov 18, 2022
1266829
New packages, tested at *STAGE* (17/11/2022) (#93)
nnikolopoulos Nov 21, 2022
5783224
Add a comma (#97)
nnikolopoulos Nov 21, 2022
713036b
Improve doc (#92)
dcolleoni Nov 22, 2022
d4fcdee
updated links (#101)
amuolo Nov 24, 2022
1561c6b
Implement Disposable Workspace in all Importers (#100)
tkukuljan Nov 25, 2022
8d0ea41
Reorganising importers (#104)
tkukuljan Nov 25, 2022
c62435a
Final refinements (#113)
dcolleoni Nov 30, 2022
488870c
Merge branch 'develop' into developToMain
dcolleoni Nov 30, 2022
e8db491
delete full template dir
dcolleoni Nov 30, 2022
3b8acd0
remove images
dcolleoni Nov 30, 2022
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
Prev Previous commit
Next Next commit
Merge pull request #43 from Systemorph/defaultAocConfig
Default aoc configuration with format
  • Loading branch information
amuolo authored and dtrzesniak committed Nov 23, 2022
commit 1573f4743f7eee9eeb9abecb7a98a898dfa4f282
28 changes: 28 additions & 0 deletions full-ifrs17-template/Constants/Consts.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"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": [
"var projectName = \"ifrs17ce\";",
"\nvar environmentName = \"dev\";",
"\nvar notebookName = \"CalculationEngine\";",
"\nvar calculationEngine = $\"#!import \\\"//{projectName}/{environmentName}/{notebookName}\\\"\";"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
{
"cell_type": "code",
"source": [
"#!import \"//ifrs17ce/dev/CalculationEngine\""
"#!import \"../Constants/Consts\"",
"\n#!eval calculationEngine"
]
},
{
Expand Down Expand Up @@ -77,7 +78,6 @@
"\n .WithType<AocType>()",
"\n .WithType<PnlVariableType>()",
"\n .WithType<BsVariableType>()",
"\n .WithType<AocConfiguration>()",
"\n .WithType<PvAmountType>()",
"\n .WithType<DeferrableAmountType>()",
"\n .WithType<RiskDriver>()",
Expand All @@ -97,6 +97,12 @@
"\n .ExecuteAsync()"
]
},
{
"cell_type": "code",
"source": [
"await Import.FromFile(\"../Files/DimensionsAndPartitions.csv\").WithFormat(\"AocConfiguration\").WithTarget(DataSource).ExecuteAsync()"
]
},
{
"cell_type": "code",
"source": [
Expand Down
6 changes: 0 additions & 6 deletions full-ifrs17-template/Test/Tests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
"#!eval-notebook \"ReportStorageTest\""
]
},
{
"cell_type": "code",
"source": [
"#!eval-notebook \"QueriesTest\""
]
},
{
"cell_type": "code",
"source": [
Expand Down
3 changes: 3 additions & 0 deletions ifrs17/Constants/Consts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,12 @@
"public static class AocTypes{",
"\n public const string BOP = nameof(BOP);",
"\n public const string MC = nameof(MC);",
"\n public const string PC = nameof(PC);",
"\n public const string RCU = nameof(RCU);",
"\n public const string CF = nameof(CF);",
"\n public const string IA = nameof(IA);",
"\n public const string AU = nameof(AU);",
"\n public const string FAU = nameof(FAU);",
"\n public const string YCU = nameof(YCU);",
"\n public const string CRU = nameof(CRU);",
"\n public const string WO = nameof(WO);",
Expand Down
6 changes: 5 additions & 1 deletion ifrs17/Constants/Validations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"source": [
"public enum Error { ",
"\n // Import",
"\n NoMainTab, IncompleteMainTab, ParsingScientificNotation, ValueTypeNotFound, ValueTypeNotValid, AocTypeNotValid,",
"\n NoMainTab, IncompleteMainTab, ParsingScientificNotation, ValueTypeNotFound, ValueTypeNotValid, ",
"\n AocTypeNotValid, AocTypeCompulsoryNotFound, AocTypePositionNotSupported, AocConfigurationOrderNotUnique,",
"\n // Partition",
"\n PartitionNotFound, ParsedPartitionNotFound, PartititionNameNotFound, PartitionTypeNotFound,",
"\n // Dimensions",
Expand Down Expand Up @@ -95,6 +96,9 @@
"\n (Error.ValueTypeNotFound , _) => $\"Value Type not found.\",",
"\n (Error.ValueTypeNotValid , 1) => $\"The Value Type {s[0]} is invalid.\",",
"\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.\",",
"\n (Error.AocConfigurationOrderNotUnique , _) => $\"Two or more Aoc Configurations have the same Order.\",",
"\n // Partition",
"\n (Error.PartitionNotFound , _) => $\"Partition do not found.\",",
"\n (Error.ParsedPartitionNotFound , 1) => $\"Parsed partition not available: ReportingNode {s[0]}.\",",
Expand Down
111 changes: 106 additions & 5 deletions ifrs17/Import/Importers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -266,21 +266,20 @@
{
"cell_type": "code",
"source": [
"public async Task DataNodeFactoryAsync (string file, string tab, ImportArgs args)",
"public async Task DataNodeFactoryAsync(string file, string tab, ImportArgs args)",
"\n{",
"\n var partition = (await DataSource.Query<PartitionByReportingNode>().Where(p => p.ReportingNode == args.ReportingNode && p.Scenario == null).ToArrayAsync()).SingleOrDefault();",
"\n if(partition == null) { ApplicationMessage.Log(Error.ParsedPartitionNotFound); return; }",
"\n",
"\n var extension = System.IO.Path.GetExtension(file);",
"\n var stream = await Project.FileStorage.ReadAsync(file);",
"\n var target = (await DataSetReader.ReadFromStream(stream).WithContentType(extension).ExecuteAsync()).DataSet.Tables[tab];",
"\n ",
"\n",
"\n var dataNodesImported = target.Rows.Select(x => x.Field<string>(nameof(RawVariable.DataNode))).ToHashSet();",
"\n var dataNodesDefined = await DataSource.Query<GroupOfContract>().Where(x => dataNodesImported.Contains(x.SystemName)).ToArrayAsync();",
"\n var dataNodeStatesDefined = await DataSource.Query<DataNodeState>().Select(x => x.DataNode).ToArrayAsync();",
"\n var dataNodeParametersDefined = await DataSource.Query<SingleDataNodeParameter>().Select(x => x.DataNode).ToArrayAsync(); ",
"\n ",
"\n",
"\n var dataNodeStatesUndefined = dataNodesImported.Where(x => x != null && !dataNodeStatesDefined.Contains(x)).ToHashSet();",
"\n var dataNodeSingleParametersUndefined = dataNodesImported.Where(x => x != null &&",
"\n !dataNodeParametersDefined.Contains(x) && ",
Expand All @@ -291,7 +290,7 @@
"\n",
"\n await DataSource.UpdateAsync( dataNodeSingleParametersUndefined.Select(x => ",
"\n new SingleDataNodeParameter {DataNode = x, Year = args.Year, Month = DefaultDataNodeActivationMonth, PremiumAllocation = DefaultPremiumExperienceAdjustmentFactor, Partition = partition.Id}).ToArray() );",
"\n ",
"\n",
"\n await DataSource.CommitAsync();",
"\n}"
]
Expand Down Expand Up @@ -319,6 +318,109 @@
"\n}"
]
},
{
"cell_type": "markdown",
"source": [
"### Analysis of Change Configuration"
]
},
{
"cell_type": "markdown",
"source": [
"The Analysis of Change configuration is parsed from the input file and complemented with defaults to allow for an easy insertion of new AOC steps. ",
"\n",
"\nAfter having checked that the AocTypes loaded in the target DataSource are including all the compulsory ones, default configurations are generated on the basis of the AocTypes ordering. ",
"\n",
"\nThe following categories have been identified based on the *Order* of the novel AOC step:",
"\n",
"\n| Category | Default added with same configuration of |",
"\n| --------------------- | ----------------------------------------------------- |",
"\n| Order < RCU | MC with Novelty I |",
"\n| RCU < Order < CF | RCU with Novelty I |",
"\n| IA < Order < YCU | AU with both Novelty I and N |",
"\n| CRU < Order < WO | EV with Novelty I and N |",
"\n| WO < Order < CL | WO with Novelty C (only for Import Source = Actual) |",
"\n",
"\nThe new Aoc Configurations are created with the same order of the Aoc Types. "
]
},
{
"cell_type": "code",
"source": [
"Import.DefineFormat(\"AocConfiguration\", async (options, dataSet) => {",
"\n Activity.Start();",
"\n var workspace = Workspace.CreateNew();",
"\n workspace.InitializeFrom(options.TargetDataSource);",
"\n",
"\n var aocTypes = await options.TargetDataSource.Query<AocType>().OrderBy(x => x.Order).ToArrayAsync();",
"\n var aocTypesCompulsory = typeof(AocTypes).GetFields().Select(x => (string)x.Name);",
"\n if(aocTypesCompulsory.Where(x => !aocTypes.Select(x => x.SystemName).Contains(x)).Any()) {",
"\n ApplicationMessage.Log(Error.AocTypeCompulsoryNotFound);",
"\n return Activity.Finish().RepeatOnce();",
"\n }",
"\n ",
"\n var logConfig = await Import.FromDataSet(dataSet).WithType<AocConfiguration>().WithTarget(workspace).ExecuteAsync();",
"\n if(logConfig.Errors.Any()) return logConfig.RepeatOnce(); ",
"\n",
"\n var orderByName = aocTypes.ToDictionary(x => x.SystemName, x => x.Order);",
"\n var aocConfigs = (await workspace.Query<AocConfiguration>().ToArrayAsync())",
"\n .GroupBy(x => (x.AocType, x.Novelty))",
"\n .Select(y => y.OrderByDescending(x => x.Year).ThenByDescending(x => x.Month).FirstOrDefault())",
"\n .ToDictionary(x => (x.AocType, x.Novelty));",
"\n var aocOrder = aocConfigs.ToDictionary(x => x.Key, x => x.Value.Order);",
"\n var newAocTypes = orderByName.Keys.Where(x => !aocConfigs.Keys.Contains((x, Novelties.I)) && ",
"\n !aocConfigs.Keys.Contains((x, Novelties.N)) && ",
"\n !aocConfigs.Keys.Contains((x, Novelties.C)) && ",
"\n !aocTypes.Any(y => y.Parent == x) &&",
"\n !aocTypesCompulsory.Contains(x)).ToArray();",
"\n",
"\n foreach(var newAocType in newAocTypes) {",
"\n if(orderByName[newAocType] < orderByName[AocTypes.RCU])",
"\n {",
"\n var step = (AocTypes.MC, Novelties.I);",
"\n await workspace.UpdateAsync( aocConfigs[step] with { AocType = newAocType, DataType = DataType.Optional, Order = ++aocOrder[step] }); ",
"\n }",
"\n else if(orderByName[newAocType] > orderByName[AocTypes.RCU] && orderByName[newAocType] < orderByName[AocTypes.CF]) ",
"\n {",
"\n var step = (AocTypes.RCU, Novelties.I);",
"\n await workspace.UpdateAsync( aocConfigs[step] with { AocType = newAocType, DataType = DataType.Optional, Order = ++aocOrder[step] });",
"\n }",
"\n else if(orderByName[newAocType] > orderByName[AocTypes.IA] && orderByName[newAocType] < orderByName[AocTypes.YCU]) ",
"\n {",
"\n foreach (var novelty in new[]{Novelties.I, Novelties.N}) {",
"\n var step = (AocTypes.AU, novelty);",
"\n var order = orderByName[newAocType] < orderByName[AocTypes.AU]? ++aocOrder[(AocTypes.IA, novelty)] : ++aocOrder[(AocTypes.AU, novelty)];",
"\n await workspace.UpdateAsync( aocConfigs[step] with { AocType = newAocType, DataType = DataType.Optional, Order = order } );",
"\n }",
"\n }",
"\n else if(orderByName[newAocType] > orderByName[AocTypes.CRU] && orderByName[newAocType] < orderByName[AocTypes.WO])",
"\n {",
"\n var stepI = (AocTypes.EV, Novelties.I);",
"\n var orderI = orderByName[newAocType] < orderByName[AocTypes.EV]? ++aocOrder[(AocTypes.CRU, Novelties.I)] : ++aocOrder[(AocTypes.EV, Novelties.I)];",
"\n await workspace.UpdateAsync( aocConfigs[stepI] with { AocType = newAocType, DataType = DataType.Optional, Order = orderI } );",
"\n",
"\n var stepN = (AocTypes.EV, Novelties.N);",
"\n var orderN = orderByName[newAocType] < orderByName[AocTypes.EV]? ++aocOrder[(AocTypes.AU, Novelties.N)] : ++aocOrder[(AocTypes.EV, Novelties.N)];",
"\n await workspace.UpdateAsync( aocConfigs[stepN] with { AocType = newAocType, DataType = DataType.Optional, Order = orderN } );",
"\n }",
"\n else if(orderByName[newAocType] > orderByName[AocTypes.WO] && orderByName[newAocType] < orderByName[AocTypes.CL])",
"\n {",
"\n var step = (AocTypes.WO, Novelties.C);",
"\n await workspace.UpdateAsync( aocConfigs[step] with { AocType = newAocType, DataType = DataType.Optional, Order = ++aocOrder[step] } );",
"\n }",
"\n else",
"\n ApplicationMessage.Log(Error.AocTypePositionNotSupported);",
"\n };",
"\n",
"\n var aocConfigsFinal = await workspace.Query<AocConfiguration>().ToArrayAsync();",
"\n if(aocConfigsFinal.GroupBy(x => x.Order).Any(x => x.Count() > 1))",
"\n ApplicationMessage.Log(Error.AocConfigurationOrderNotUnique);",
"\n",
"\n await workspace.CommitToTargetAsync(options.TargetDataSource);",
"\n return new[] {Activity.Finish(),logConfig}; ",
"\n});"
]
},
{
"cell_type": "markdown",
"source": [
Expand Down Expand Up @@ -492,7 +594,6 @@
"\n await CommitToDatabase<ReinsurancePortfolio>(partition);",
"\n await CommitToDatabase<GroupOfInsuranceContract>(partition);",
"\n await CommitToDatabase<GroupOfReinsuranceContract>(partition);",
"\n ",
"\n return log;",
"\n}"
]
Expand Down
Loading