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
2 changes: 2 additions & 0 deletions ifrs17/Constants/Validations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"\n NoMainTab, IncompleteMainTab, ParsingScientificNotation, ValueTypeNotFound, ValueTypeNotValid, ",
"\n ReportingNodeInMainNotFound, YearInMainNotFound, MonthInMainNotFound, ScenarioInMainNotAvailable,",
"\n AocTypeNotValid, AocTypeCompulsoryNotFound, AocTypePositionNotSupported, AocConfigurationOrderNotUnique,",
"\n AccidentYearTypeNotValid,",
"\n // Partition",
"\n PartitionNotFound, ParsedPartitionNotFound, PartititionNameNotFound, PartitionTypeNotFound,",
"\n // Dimensions",
Expand Down Expand Up @@ -122,6 +123,7 @@
"\n (Error.AocTypeCompulsoryNotFound , _) => $\"Not all compulsory AoC Types have been imported.\",",
"\n (Error.AocTypePositionNotSupported , 1) => $\"The position of the AoC Type {s[0]} is not supported.\",",
"\n (Error.AocConfigurationOrderNotUnique , _) => $\"Two or more AoC Configurations have the same Order.\",",
"\n (Error.AccidentYearTypeNotValid , 1) => $\"The parsed AccidentYear {s[0]} is invalid. Expected Accident Year input of type int.\",",
"\n // Partition",
"\n (Error.PartitionNotFound , _) => $\"Partition do not found.\",",
"\n (Error.ParsedPartitionNotFound , 1) => $\"Parsed partition not available: ReportingNode {s[0]}.\",",
Expand Down
38 changes: 33 additions & 5 deletions ifrs17/Import/Importers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1369,15 +1369,21 @@
"\n if(values.Length == 0 && !parsingStorage.MandatoryAocSteps.Contains(new AocStep(aocType, novelty))) return null;",
"\n }",
"\n ",
"\n int? accidentYear = default;",
"\n if(hasAccidentYearColumn && datarow.Field<string>(nameof(RawVariable.AccidentYear)) != null) {",
"\n if(!Int32.TryParse(datarow.Field<string>(nameof(RawVariable.AccidentYear)), out var parsedAccidentYear)) { ",
"\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, datarow.Field<string>(nameof(RawVariable.AccidentYear))); return null;",
"\n }",
"\n else accidentYear = (int?)parsedAccidentYear;",
"\n }",
"\n ",
"\n var item = new RawVariable {",
"\n DataNode = dataNode,",
"\n AocType = aocType,",
"\n Novelty = novelty,",
"\n AmountType = valueType.AmountType,",
"\n EstimateType = valueType.EstimateType,",
"\n AccidentYear = hasAccidentYearColumn && Int32.TryParse((datarow.Field<string>(nameof(RawVariable.AccidentYear))), out var accidentYear)",
"\n ? accidentYear",
"\n : (int?)null,",
"\n AccidentYear = accidentYear,",
"\n Partition = parsingStorage.TargetPartitionByReportingNodeAndPeriod.Id,",
"\n Values = Multiply(GetSign(ImportFormats.Cashflow, (aocType, valueType.AmountType, valueType.EstimateType, dataNodeData.IsReinsurance), parsingStorage.HierarchyCache), values)",
"\n .Interpolate(parsingStorage.GetCashFlowPeriodicity(dataNode), parsingStorage.GetInterpolationMethod(dataNode))",
Expand Down Expand Up @@ -1467,6 +1473,8 @@
"\n await parsingStorage.InitializeAsync();",
"\n if(Activity.HasErrors()) return Activity.Finish();",
"\n",
"\n var hasAccidentYearColumn = dataSet.Tables[ImportFormats.Actual].Columns.Any(x => x.ColumnName == nameof(IfrsVariable.AccidentYear));",
"\n",
"\n var importLog = await Import.FromDataSet(dataSet)",
"\n .WithType<IfrsVariable> ( (dataset, datarow) => {",
"\n var dataNode = datarow.Field<string>(nameof(DataNode));",
Expand All @@ -1487,11 +1495,20 @@
"\n var currentPeriodValue = GetSign(ImportFormats.Actual, ",
"\n (aocType, valueType.AmountType, valueType.EstimateType, dataNodeData.IsReinsurance), ",
"\n parsingStorage.HierarchyCache) * datarow.Field<string>(\"Value\").CheckStringForExponentialAndConvertToDouble();",
"\n ",
"\n int? accidentYear = default;",
"\n if(hasAccidentYearColumn && datarow.Field<string>(nameof(RawVariable.AccidentYear)) != null) {",
"\n if(!Int32.TryParse(datarow.Field<string>(nameof(RawVariable.AccidentYear)), out var parsedAccidentYear)) { ",
"\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, datarow.Field<string>(nameof(RawVariable.AccidentYear))); return null;",
"\n }",
"\n else accidentYear = (int?)parsedAccidentYear;",
"\n }",
"\n ",
"\n var item = new IfrsVariable {",
"\n DataNode = dataNode,",
"\n AocType = aocType,",
"\n Novelty = Novelties.C,",
"\n AccidentYear = Int32.TryParse((datarow.Field<string>(nameof(IfrsVariable.AccidentYear))), out var tempAccYear)? tempAccYear : (int?)null,",
"\n AccidentYear = accidentYear,",
"\n AmountType = valueType.AmountType,",
"\n EstimateType = valueType.EstimateType,",
"\n Partition = parsingStorage.TargetPartitionByReportingNodeAndPeriod.Id,",
Expand Down Expand Up @@ -1574,6 +1591,8 @@
"\n await parsingStorage.InitializeAsync();",
"\n if(Activity.HasErrors()) return Activity.Finish(); ",
"\n",
"\n var hasAccidentYearColumn = dataSet.Tables[importFormat].Columns.Any(x => x.ColumnName == nameof(IfrsVariable.AccidentYear));",
"\n",
"\n var importLog = await Import.FromDataSet(dataSet)",
"\n .WithType<IfrsVariable> ( (dataset, datarow) => {",
"\n var dataNode = parsingStorage.ValidateDataNode(datarow.Field<string>(nameof(DataNode)),importFormat);",
Expand All @@ -1593,11 +1612,20 @@
"\n (aocStep.AocType, amountType, estimateType, parsingStorage.IsDataNodeReinsurance(dataNode)), ",
"\n parsingStorage.HierarchyCache) * datarow.Field<string>(\"Value\")",
"\n .CheckStringForExponentialAndConvertToDouble();",
"\n",
"\n int? accidentYear = default;",
"\n if(hasAccidentYearColumn && datarow.Field<string>(nameof(RawVariable.AccidentYear)) != null) {",
"\n if(!Int32.TryParse(datarow.Field<string>(nameof(RawVariable.AccidentYear)), out var parsedAccidentYear)) { ",
"\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, datarow.Field<string>(nameof(RawVariable.AccidentYear))); return null;",
"\n }",
"\n else accidentYear = (int?)parsedAccidentYear;",
"\n }",
"\n",
"\n var iv = new IfrsVariable {",
"\n DataNode = dataNode,",
"\n AocType = aocStep.AocType,",
"\n Novelty = aocStep.Novelty,",
"\n AccidentYear = Int32.TryParse((datarow.Field<string>(nameof(IfrsVariable.AccidentYear))), out var accidentYear) ? accidentYear : (int?)null,",
"\n AccidentYear = accidentYear,",
"\n AmountType = amountType,",
"\n EstimateType = estimateType,",
"\n EconomicBasis = economicBasis,",
Expand Down