Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
98df032
first report with projections
andrey-katz-systemorph Apr 26, 2023
112f80b
error fixed + foundation for reports
andrey-katz-systemorph Apr 27, 2023
6e65882
order the projection configurations. Still wrong: must have a single …
andrey-katz-systemorph Apr 27, 2023
477c7fd
Merge remote-tracking branch 'origin/develop' into ReportsWithProject…
andrey-katz-systemorph Apr 27, 2023
61deebd
Merge remote-tracking branch 'origin/develop' into ReportsWithProject…
andrey-katz-systemorph May 2, 2023
005c649
ordered projections are the attributes of the report storage
andrey-katz-systemorph May 2, 2023
bf8960c
slicing of columns
andrey-katz-systemorph May 2, 2023
c2bfc79
working version
andrey-katz-systemorph May 2, 2023
0fe60ed
cleanup
andrey-katz-systemorph May 3, 2023
867c127
periodicity moved to const. Filter and Order as Utils method
andrey-katz-systemorph May 4, 2023
d5d7cca
cleanup
andrey-katz-systemorph May 4, 2023
6321606
report storage reorganization and cleanup
andrey-katz-systemorph May 4, 2023
539152e
more adjustments
andrey-katz-systemorph May 4, 2023
66a5a52
Projection first in slice
andrey-katz-systemorph May 4, 2023
6bf1672
rename SelectProjections -> filterProjections and optimize
andrey-katz-systemorph May 4, 2023
72003b7
rename SortRelevantProjections
andrey-katz-systemorph May 4, 2023
2eb5efb
Relocate sort relevant projection into extensions
andrey-katz-systemorph May 4, 2023
f86db0a
const fixed
andrey-katz-systemorph May 4, 2023
6d588de
Update Consts.ipynb
andrey-katz-systemorph May 4, 2023
af26298
Update Consts.ipynb
andrey-katz-systemorph May 4, 2023
88c33c7
cleanup
andrey-katz-systemorph May 4, 2023
7e93bb1
filter directly
andrey-katz-systemorph May 4, 2023
3aa1f35
more cleanup
andrey-katz-systemorph May 4, 2023
a014fc1
typo fixed
andrey-katz-systemorph May 4, 2023
d7d01ec
typo fixed
andrey-katz-systemorph May 4, 2023
8bd4f05
Merge remote-tracking branch 'origin/develop' into ReportsWithProject…
andrey-katz-systemorph May 8, 2023
e77fe65
ordered dimension + cleanup
dcolleoni May 8, 2023
2ea08d3
typo: restore month
dcolleoni May 9, 2023
14e8ef9
remove FilterProjections and filter identites
dcolleoni May 9, 2023
feba1ee
update bms
dcolleoni May 9, 2023
635c4cf
rename
dcolleoni May 9, 2023
c3e9351
fix test
dcolleoni May 9, 2023
8e0a786
Merge branch 'develop' into ReportsWithProjections
dcolleoni May 10, 2023
b26e874
merge conflict
dcolleoni May 10, 2023
6af6aca
resolve merge conflicts and update bm
dcolleoni May 10, 2023
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
42 changes: 21 additions & 21 deletions ifrs17-template/Files/Dimensions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,24 @@ BBA,Building Block Approach,,,,,,,,,,
PAA,Premium Allocation Approach,,,,,,,,,,
,,,,,,,,,,,
@@ProjectionConfiguration,,,,,,,,,,,
SystemName,DisplayName,Shift,TimeStep,,,,,,,,
P0,End of January,0,1,,,,,,,,
P1,End of February,0,2,,,,,,,,
P2,End of March,0,3,,,,,,,,
P3,End of April,0,4,,,,,,,,
P4,End of May,0,5,,,,,,,,
P5,End of June,0,6,,,,,,,,
P6,End of July,0,7,,,,,,,,
P7,End of August,0,8,,,,,,,,
P8,End of September,0,9,,,,,,,,
P9,End of October,0,10,,,,,,,,
P10,End of November,0,11,,,,,,,,
P11,End of December,0,12,,,,,,,,
P12,End of Year+1,12,12,,,,,,,,
P13,End of Year+2,24,12,,,,,,,,
P14,End of Year+3,36,12,,,,,,,,
P15,End of Year+4,48,12,,,,,,,,
P16,Year+5 to Year+10,60,60,,,,,,,,
P17,Year+10 to Year+15,120,60,,,,,,,,
P18,Year+15 to Year+20,180,60,,,,,,,,
P19,Years Over +20,240,9999,,,,,,,,
SystemName,DisplayName,Shift,TimeStep,Order,,,,,,,
P0,End of January,0,1,10,,,,,,,
P1,End of February,0,2,20,,,,,,,
P2,End of March,0,3,30,,,,,,,
P3,End of April,0,4,40,,,,,,,
P4,End of May,0,5,50,,,,,,,
P5,End of June,0,6,60,,,,,,,
P6,End of July,0,7,70,,,,,,,,
P7,End of August,0,8,80,,,,,,,,
P8,End of September,0,9,90,,,,,,,,
P9,End of October,0,10,100,,,,,,,
P10,End of November,0,11,110,,,,,,,
P11,End of December,0,12,120,,,,,,,
P12,End of Year+1,12,12,130,,,,,,,
P13,End of Year+2,24,12,140,,,,,,,
P14,End of Year+3,36,12,150,,,,,,,
P15,End of Year+4,48,12,160,,,,,,,
P16,Year+5 to Year+10,60,60,170,,,,,,,
P17,Year+10 to Year+15,120,60,180,,,,,,,
P18,Year+15 to Year+20,180,60,190,,,,,,,
P19,Years Over +20,240,9999,200,,,,,,,

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion ifrs17/Constants/Consts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"public const int MonthInAQuarter = 3;"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
Expand Down Expand Up @@ -473,4 +482,4 @@
"outputs": []
}
]
}
}
2 changes: 1 addition & 1 deletion ifrs17/DataModel/DataStructure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@
{
"cell_type": "code",
"source": [
"public record ProjectionConfiguration : KeyedDimension",
"public record ProjectionConfiguration : KeyedOrderedDimension",
"\n{",
"\n [IdentityProperty]",
"\n public int Shift { get; init; }",
Expand Down
7 changes: 1 addition & 6 deletions ifrs17/Import/ImportStorage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@
"\n private readonly Systemorph.Vertex.Hierarchies.IHierarchicalDimensionCache hierarchyCache;",
"\n private readonly ImportArgs args;",
"\n ",
"\n // Constants",
"\n private static int periodicityInMonths => 3; // Revisit",
"\n ",
"\n //Format",
"\n public string ImportFormat => args.ImportFormat; ",
"\n ",
Expand Down Expand Up @@ -163,9 +160,7 @@
"\n .ToHashSet());",
"\n ",
"\n //ProjectionConfiguration : Current Period + projection for every Quarter End for current Year and next Years as in projectionConfiguration.csv",
"\n ProjectionConfiguration = (await workspace.Query<ProjectionConfiguration>()",
"\n .Where(x => x.Shift > 0 || x.TimeStep == args.Month || (x.TimeStep > args.Month && x.TimeStep % periodicityInMonths == 0))",
"\n .OrderBy(x => x.Shift).ThenBy(x => x.TimeStep).ToArrayAsync());",
"\n ProjectionConfiguration = (await workspace.Query<ProjectionConfiguration>().ToArrayAsync()).SortRelevantProjections(args.Month);",
"\n ",
"\n //Get Partitions",
"\n PartitionByRn = (await querySource.Query<PartitionByReportingNode>().Where(p => p.ReportingNode == args.ReportingNode).ToArrayAsync()).Single().Id;",
Expand Down
89 changes: 45 additions & 44 deletions ifrs17/Report/ReportConfigurationAndUtils.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -114,54 +114,55 @@
{
"cell_type": "code",
"source": [
"public static async Task<ReportVariable[]> QueryReportVariablesSingleScenarioAsync(this IWorkspace workspace, (int Year, int Month, string ReportingNode, string Scenario) args ) {",
"public static IEnumerable<ReportVariable> GetReportVariable(GroupOfContract goc, ",
"\n IfrsVariable iv, ",
"\n (int Year, int Month, string ReportingNode, string Scenario) args, ",
"\n ProjectionConfiguration[] orderedProjectionConfigurations) => ",
"\n iv.Values.Select((val, ind) => new ReportVariable {",
"\n ReportingNode = args.ReportingNode, ",
"\n Scenario = args.Scenario, ",
"\n Portfolio = goc.Portfolio, ",
"\n GroupOfContract = goc.SystemName, ",
"\n FunctionalCurrency = goc.FunctionalCurrency, ",
"\n ContractualCurrency = goc.ContractualCurrency, ",
"\n ValuationApproach = goc.ValuationApproach, ",
"\n OciType = goc.OciType, ",
"\n InitialProfitability = goc.Profitability, ",
"\n LiabilityType = goc.LiabilityType, ",
"\n AnnualCohort = goc.AnnualCohort, ",
"\n LineOfBusiness = goc.LineOfBusiness,",
"\n IsReinsurance = goc is GroupOfReinsuranceContract, ",
"\n Partner = goc.Partner, ",
"\n EstimateType = iv.EstimateType, ",
"\n VariableType = iv.AocType, ",
"\n Novelty = iv.Novelty, ",
"\n AmountType = iv.AmountType, ",
"\n EconomicBasis = iv.EconomicBasis, ",
"\n AccidentYear = iv.AccidentYear == null ? default : (int)iv.AccidentYear,",
"\n ServicePeriod = goc.LiabilityType == LiabilityTypes.LIC",
"\n ? iv.AccidentYear == args.Year ? ServicePeriod.CurrentService : ServicePeriod.PastService",
"\n\t\t\t\t : ServicePeriod.NotApplicable,",
"\n Projection = orderedProjectionConfigurations.ElementAtOrDefault(ind).SystemName,",
"\n Value = val});"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"public static async Task<ReportVariable[]> QueryReportVariablesSingleScenarioAsync(this IWorkspace workspace, (int Year, int Month, string ReportingNode, string Scenario) args, ",
"\n ProjectionConfiguration[] orderedProjectionConfigurations) {",
"\n",
"\n await workspace.Partition.SetAsync<PartitionByReportingNode>(new { ReportingNode = args.ReportingNode, Scenario = (string)null});",
"\n await workspace.Partition.SetAsync<PartitionByReportingNodeAndPeriod>(new { ReportingNode = args.ReportingNode, Scenario = args.Scenario, Year = args.Year, Month = args.Month });",
"\n ",
"\n var reportVariables = await workspace.Query<GroupOfContract>()",
"\n .Join(workspace.Query<IfrsVariable>(),",
"\n dn => dn.SystemName,",
"\n iv => iv.DataNode,",
"\n (dn, iv) => new ReportVariable {",
"\n // From Args/Inputs",
"\n ReportingNode = args.ReportingNode,",
"\n Scenario = args.Scenario,",
"\n ",
"\n // From Data Node",
"\n Portfolio = dn.Portfolio,",
"\n GroupOfContract = dn.SystemName,",
"\n ",
"\n FunctionalCurrency = dn.FunctionalCurrency,",
"\n ContractualCurrency = dn.ContractualCurrency,",
"\n ",
"\n ValuationApproach = dn.ValuationApproach,",
"\n OciType = dn.OciType,",
"\n InitialProfitability = dn.Profitability,",
"\n LiabilityType = dn.LiabilityType,",
"\n AnnualCohort = dn.AnnualCohort,",
"\n LineOfBusiness = dn.LineOfBusiness,",
"\n ",
"\n // Reinsurance",
"\n IsReinsurance = dn is GroupOfReinsuranceContract, ",
"\n Partner = dn.Partner,",
"\n ",
"\n // From Variable",
"\n EstimateType = iv.EstimateType,",
"\n VariableType = iv.AocType,",
"\n Novelty = iv.Novelty,",
"\n AmountType = iv.AmountType,",
"\n EconomicBasis = iv.EconomicBasis,",
"\n ",
"\n //LIC",
"\n AccidentYear = iv.AccidentYear == null ? default : (int)iv.AccidentYear,",
"\n ServicePeriod = ",
"\n dn.LiabilityType == LiabilityTypes.LIC",
"\n ? iv.AccidentYear == args.Year ? ServicePeriod.CurrentService : ServicePeriod.PastService",
"\n : ServicePeriod.NotApplicable,",
"\n ",
"\n Projection = \"P0\",//Assign the correct value for each projection (check ProjectionConfiguration values)",
"\n Value = iv.Values.ElementAtOrDefault(0) })",
"\n (dn, iv) => GetReportVariable(dn, iv, args, orderedProjectionConfigurations)",
"\n ).SelectMany(rv => rv) ",
"\n .ToArrayAsync();",
"\n",
"\n await workspace.Partition.SetAsync<PartitionByReportingNode>(null);",
Expand All @@ -176,11 +177,11 @@
{
"cell_type": "code",
"source": [
"public static async Task<ICollection<ReportVariable>> QueryReportVariablesAsync(this IWorkspace workspace, (int Year, int Month, string ReportingNode, string Scenario) args ) {",
"\n var bestEstimate = (await workspace.QueryReportVariablesSingleScenarioAsync((args.Year, args.Month, args.ReportingNode, null)));",
"public static async Task<ICollection<ReportVariable>> QueryReportVariablesAsync(this IWorkspace workspace, (int Year, int Month, string ReportingNode, string Scenario) args, ProjectionConfiguration[] orderedProjectionConfigurations) {",
"\n var bestEstimate = (await workspace.QueryReportVariablesSingleScenarioAsync((args.Year, args.Month, args.ReportingNode, null), orderedProjectionConfigurations));",
"\n return (args.Scenario == null) ",
"\n ? bestEstimate",
"\n : (await workspace.QueryReportVariablesSingleScenarioAsync((args.Year, args.Month, args.ReportingNode, args.Scenario)))",
"\n : (await workspace.QueryReportVariablesSingleScenarioAsync((args.Year, args.Month, args.ReportingNode, args.Scenario), orderedProjectionConfigurations))",
"\n .Union(bestEstimate.Select(x => x with {Scenario = args.Scenario}), EqualityComparer<ReportVariable>.Instance).ToArray();",
"\n}"
],
Expand Down
Loading