From 2bd1fcf1c55cacadaa84bb82d1d2c9b4f954a4a1 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Thu, 25 May 2023 10:17:42 +0200 Subject: [PATCH 1/6] Log an error for invalid AY types --- ifrs17/Constants/Validations.ipynb | 2 ++ ifrs17/Import/Importers.ipynb | 26 +++++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 0152a7e0..11960738 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -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", @@ -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 type {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]}.\",", diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 7e899cdb..a0b89845 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -884,13 +884,12 @@ "\n (dataset, datarow) => {", "\n var values = datarow.Table.Columns.Where(c => c.ColumnName.StartsWith(nameof(YieldCurve.Values))).OrderBy(c => c.ColumnName.Length).ThenBy(c => c.ColumnName)", "\n .Select(x => datarow.Field(x.ColumnName).CheckStringForExponentialAndConvertToDouble()).ToArray().Prune();", - "\n if (!values.Any()) return null;", "\n return new YieldCurve {", "\n Currency = datarow.Field(nameof(YieldCurve.Currency)),", "\n Year = primaryArgs.Year,", "\n Month = primaryArgs.Month, ", "\n Scenario = primaryArgs.Scenario,", - "\n Values = values,", + "\n Values = !values.Any() ? new [] {0d} : values,", "\n Name = hasNameColumn ? datarow.Field(nameof(YieldCurve.Name)) : default(string)", "\n };", "\n }", @@ -1369,13 +1368,20 @@ "\n if(values.Length == 0 && !parsingStorage.MandatoryAocSteps.Contains(new AocStep(aocType, novelty))) return null;", "\n }", "\n ", + "\n var accidentYearInput = (datarow.Field(nameof(RawVariable.AccidentYear)));", + "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var accidentYear);", + "\n if(hasAccidentYearColumn)", + "\n { ", + "\n if(!(isAccidentYearInt || accidentYearInput == null)) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\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(nameof(RawVariable.AccidentYear))), out var accidentYear)", + "\n AccidentYear = hasAccidentYearColumn && isAccidentYearInt", "\n ? accidentYear", "\n : (int?)null,", "\n Partition = parsingStorage.TargetPartitionByReportingNodeAndPeriod.Id,", @@ -1487,11 +1493,16 @@ "\n var currentPeriodValue = GetSign(ImportFormats.Actual, ", "\n (aocType, valueType.AmountType, valueType.EstimateType, dataNodeData.IsReinsurance), ", "\n parsingStorage.HierarchyCache) * datarow.Field(\"Value\").CheckStringForExponentialAndConvertToDouble();", + "\n ", + "\n var accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", + "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var tempAccYear);", + "\n if(!(isAccidentYearInt || accidentYearInput == null)) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n ", "\n var item = new IfrsVariable {", "\n DataNode = dataNode,", "\n AocType = aocType,", "\n Novelty = Novelties.C,", - "\n AccidentYear = Int32.TryParse((datarow.Field(nameof(IfrsVariable.AccidentYear))), out var tempAccYear)? tempAccYear : (int?)null,", + "\n AccidentYear = isAccidentYearInt? tempAccYear : (int?)null,", "\n AmountType = valueType.AmountType,", "\n EstimateType = valueType.EstimateType,", "\n Partition = parsingStorage.TargetPartitionByReportingNodeAndPeriod.Id,", @@ -1593,11 +1604,16 @@ "\n (aocStep.AocType, amountType, estimateType, parsingStorage.IsDataNodeReinsurance(dataNode)), ", "\n parsingStorage.HierarchyCache) * datarow.Field(\"Value\")", "\n .CheckStringForExponentialAndConvertToDouble();", + "\n", + "\n var accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", + "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var accidentYear);", + "\n if(!(isAccidentYearInt || accidentYearInput == null)) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n", "\n var iv = new IfrsVariable {", "\n DataNode = dataNode,", "\n AocType = aocStep.AocType,", "\n Novelty = aocStep.Novelty,", - "\n AccidentYear = Int32.TryParse((datarow.Field(nameof(IfrsVariable.AccidentYear))), out var accidentYear) ? accidentYear : (int?)null,", + "\n AccidentYear = isAccidentYearInt ? accidentYear : (int?)null,", "\n AmountType = amountType,", "\n EstimateType = estimateType,", "\n EconomicBasis = economicBasis,", From aff6e317933f4e9835fe111f38dc571bc1a16b99 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Thu, 25 May 2023 10:57:40 +0200 Subject: [PATCH 2/6] Undo some changes in Importers --- ifrs17/Import/Importers.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index a0b89845..84d7419d 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -884,12 +884,13 @@ "\n (dataset, datarow) => {", "\n var values = datarow.Table.Columns.Where(c => c.ColumnName.StartsWith(nameof(YieldCurve.Values))).OrderBy(c => c.ColumnName.Length).ThenBy(c => c.ColumnName)", "\n .Select(x => datarow.Field(x.ColumnName).CheckStringForExponentialAndConvertToDouble()).ToArray().Prune();", + "\n if (!values.Any()) return null;", "\n return new YieldCurve {", "\n Currency = datarow.Field(nameof(YieldCurve.Currency)),", "\n Year = primaryArgs.Year,", "\n Month = primaryArgs.Month, ", "\n Scenario = primaryArgs.Scenario,", - "\n Values = !values.Any() ? new [] {0d} : values,", + "\n Values = values,", "\n Name = hasNameColumn ? datarow.Field(nameof(YieldCurve.Name)) : default(string)", "\n };", "\n }", From 27c1bcae6e863f8357ae90da4206e520e7ba3fbe Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Thu, 25 May 2023 10:59:39 +0200 Subject: [PATCH 3/6] Undo --- ifrs17/Import/Importers.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 84d7419d..677cbf56 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -884,7 +884,7 @@ "\n (dataset, datarow) => {", "\n var values = datarow.Table.Columns.Where(c => c.ColumnName.StartsWith(nameof(YieldCurve.Values))).OrderBy(c => c.ColumnName.Length).ThenBy(c => c.ColumnName)", "\n .Select(x => datarow.Field(x.ColumnName).CheckStringForExponentialAndConvertToDouble()).ToArray().Prune();", - "\n if (!values.Any()) return null;", + "\n if (!values.Any()) return null;", "\n return new YieldCurve {", "\n Currency = datarow.Field(nameof(YieldCurve.Currency)),", "\n Year = primaryArgs.Year,", From ee2dabababf945fdd3e2673c284eaa5df1a37ecf Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Fri, 26 May 2023 18:15:23 +0200 Subject: [PATCH 4/6] Feedback --- ifrs17/Constants/Validations.ipynb | 2 +- ifrs17/Import/Importers.ipynb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ifrs17/Constants/Validations.ipynb b/ifrs17/Constants/Validations.ipynb index 11960738..c49884e8 100644 --- a/ifrs17/Constants/Validations.ipynb +++ b/ifrs17/Constants/Validations.ipynb @@ -123,7 +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 type {s[0]} is invalid. Expected Accident Year input of type int.\",", + "\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]}.\",", diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 677cbf56..de56d195 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -1373,7 +1373,7 @@ "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var accidentYear);", "\n if(hasAccidentYearColumn)", "\n { ", - "\n if(!(isAccidentYearInt || accidentYearInput == null)) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n if(!isAccidentYearInt && accidentYearInput != null) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", "\n }", "\n", "\n var item = new RawVariable {", @@ -1497,7 +1497,7 @@ "\n ", "\n var accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var tempAccYear);", - "\n if(!(isAccidentYearInt || accidentYearInput == null)) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n if(!isAccidentYearInt && accidentYearInput != null) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", "\n ", "\n var item = new IfrsVariable {", "\n DataNode = dataNode,", @@ -1608,7 +1608,7 @@ "\n", "\n var accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var accidentYear);", - "\n if(!(isAccidentYearInt || accidentYearInput == null)) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n if(!isAccidentYearInt && accidentYearInput != null) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", "\n", "\n var iv = new IfrsVariable {", "\n DataNode = dataNode,", From 4c571a85755b4f49326eab7c10ef84025b402833 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Mon, 19 Jun 2023 15:45:58 +0200 Subject: [PATCH 5/6] Implement feedback --- ifrs17/Import/Importers.ipynb | 50 ++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index de56d195..30f5b8fc 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -1369,11 +1369,15 @@ "\n if(values.Length == 0 && !parsingStorage.MandatoryAocSteps.Contains(new AocStep(aocType, novelty))) return null;", "\n }", "\n ", - "\n var accidentYearInput = (datarow.Field(nameof(RawVariable.AccidentYear)));", - "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var accidentYear);", + "\n var accidentYearInput = default(string);", "\n if(hasAccidentYearColumn)", - "\n { ", - "\n if(!isAccidentYearInt && accidentYearInput != null) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n {", + "\n accidentYearInput = (datarow.Field(nameof(RawVariable.AccidentYear)));", + "\n if(!Int32.TryParse(accidentYearInput, out _) && accidentYearInput != null) ", + "\n {", + "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n return null;", + "\n }", "\n }", "\n", "\n var item = new RawVariable {", @@ -1382,7 +1386,7 @@ "\n Novelty = novelty,", "\n AmountType = valueType.AmountType,", "\n EstimateType = valueType.EstimateType,", - "\n AccidentYear = hasAccidentYearColumn && isAccidentYearInt", + "\n AccidentYear = hasAccidentYearColumn && Int32.TryParse(accidentYearInput, out var accidentYear)", "\n ? accidentYear", "\n : (int?)null,", "\n Partition = parsingStorage.TargetPartitionByReportingNodeAndPeriod.Id,", @@ -1474,6 +1478,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 ( (dataset, datarow) => {", "\n var dataNode = datarow.Field(nameof(DataNode));", @@ -1495,15 +1501,23 @@ "\n (aocType, valueType.AmountType, valueType.EstimateType, dataNodeData.IsReinsurance), ", "\n parsingStorage.HierarchyCache) * datarow.Field(\"Value\").CheckStringForExponentialAndConvertToDouble();", "\n ", - "\n var accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", - "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var tempAccYear);", - "\n if(!isAccidentYearInt && accidentYearInput != null) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n var accidentYearInput = default(string);", + "\n if(hasAccidentYearColumn)", + "\n {", + "\n accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", + "\n if(!Int32.TryParse(accidentYearInput, out _) && accidentYearInput != default(string))", + "\n {", + "\n accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", + "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n return null;", + "\n }", + "\n }", "\n ", "\n var item = new IfrsVariable {", "\n DataNode = dataNode,", "\n AocType = aocType,", "\n Novelty = Novelties.C,", - "\n AccidentYear = isAccidentYearInt? tempAccYear : (int?)null,", + "\n AccidentYear = Int32.TryParse(accidentYearInput, out var tempAccYear)? tempAccYear : (int?)null,", "\n AmountType = valueType.AmountType,", "\n EstimateType = valueType.EstimateType,", "\n Partition = parsingStorage.TargetPartitionByReportingNodeAndPeriod.Id,", @@ -1586,6 +1600,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 ( (dataset, datarow) => {", "\n var dataNode = parsingStorage.ValidateDataNode(datarow.Field(nameof(DataNode)),importFormat);", @@ -1606,15 +1622,23 @@ "\n parsingStorage.HierarchyCache) * datarow.Field(\"Value\")", "\n .CheckStringForExponentialAndConvertToDouble();", "\n", - "\n var accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", - "\n var isAccidentYearInt = Int32.TryParse(accidentYearInput, out var accidentYear);", - "\n if(!isAccidentYearInt && accidentYearInput != null) ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n var accidentYearInput = default(string);", + "\n if(hasAccidentYearColumn)", + "\n {", + "\n accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", + "\n if(!Int32.TryParse(accidentYearInput, out _) && accidentYearInput != default(string))", + "\n {", + "\n accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", + "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", + "\n return null;", + "\n }", + "\n }", "\n", "\n var iv = new IfrsVariable {", "\n DataNode = dataNode,", "\n AocType = aocStep.AocType,", "\n Novelty = aocStep.Novelty,", - "\n AccidentYear = isAccidentYearInt ? accidentYear : (int?)null,", + "\n AccidentYear = Int32.TryParse(accidentYearInput, out var accidentYear) ? accidentYear : (int?)null,", "\n AmountType = amountType,", "\n EstimateType = estimateType,", "\n EconomicBasis = economicBasis,", From aa31438c4d5c94b8b634d2b4dfeee253cc84c6a4 Mon Sep 17 00:00:00 2001 From: nnikolopoulos Date: Tue, 20 Jun 2023 17:37:44 +0200 Subject: [PATCH 6/6] Optimize --- ifrs17/Import/Importers.ipynb | 51 +++++++++++++---------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 30f5b8fc..7b063015 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -1369,26 +1369,21 @@ "\n if(values.Length == 0 && !parsingStorage.MandatoryAocSteps.Contains(new AocStep(aocType, novelty))) return null;", "\n }", "\n ", - "\n var accidentYearInput = default(string);", - "\n if(hasAccidentYearColumn)", - "\n {", - "\n accidentYearInput = (datarow.Field(nameof(RawVariable.AccidentYear)));", - "\n if(!Int32.TryParse(accidentYearInput, out _) && accidentYearInput != null) ", - "\n {", - "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", - "\n return null;", + "\n int? accidentYear = default;", + "\n if(hasAccidentYearColumn && datarow.Field(nameof(RawVariable.AccidentYear)) != null) {", + "\n if(!Int32.TryParse(datarow.Field(nameof(RawVariable.AccidentYear)), out var parsedAccidentYear)) { ", + "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, datarow.Field(nameof(RawVariable.AccidentYear))); return null;", "\n }", + "\n else accidentYear = (int?)parsedAccidentYear;", "\n }", - "\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(accidentYearInput, 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))", @@ -1501,23 +1496,19 @@ "\n (aocType, valueType.AmountType, valueType.EstimateType, dataNodeData.IsReinsurance), ", "\n parsingStorage.HierarchyCache) * datarow.Field(\"Value\").CheckStringForExponentialAndConvertToDouble();", "\n ", - "\n var accidentYearInput = default(string);", - "\n if(hasAccidentYearColumn)", - "\n {", - "\n accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", - "\n if(!Int32.TryParse(accidentYearInput, out _) && accidentYearInput != default(string))", - "\n {", - "\n accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", - "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", - "\n return null;", + "\n int? accidentYear = default;", + "\n if(hasAccidentYearColumn && datarow.Field(nameof(RawVariable.AccidentYear)) != null) {", + "\n if(!Int32.TryParse(datarow.Field(nameof(RawVariable.AccidentYear)), out var parsedAccidentYear)) { ", + "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, datarow.Field(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(accidentYearInput, out var tempAccYear)? tempAccYear : (int?)null,", + "\n AccidentYear = accidentYear,", "\n AmountType = valueType.AmountType,", "\n EstimateType = valueType.EstimateType,", "\n Partition = parsingStorage.TargetPartitionByReportingNodeAndPeriod.Id,", @@ -1622,23 +1613,19 @@ "\n parsingStorage.HierarchyCache) * datarow.Field(\"Value\")", "\n .CheckStringForExponentialAndConvertToDouble();", "\n", - "\n var accidentYearInput = default(string);", - "\n if(hasAccidentYearColumn)", - "\n {", - "\n accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", - "\n if(!Int32.TryParse(accidentYearInput, out _) && accidentYearInput != default(string))", - "\n {", - "\n accidentYearInput = (datarow.Field(nameof(IfrsVariable.AccidentYear)));", - "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, accidentYearInput);", - "\n return null;", + "\n int? accidentYear = default;", + "\n if(hasAccidentYearColumn && datarow.Field(nameof(RawVariable.AccidentYear)) != null) {", + "\n if(!Int32.TryParse(datarow.Field(nameof(RawVariable.AccidentYear)), out var parsedAccidentYear)) { ", + "\n ApplicationMessage.Log(Error.AccidentYearTypeNotValid, datarow.Field(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(accidentYearInput, out var accidentYear) ? accidentYear : (int?)null,", + "\n AccidentYear = accidentYear,", "\n AmountType = amountType,", "\n EstimateType = estimateType,", "\n EconomicBasis = economicBasis,",