From a4defea07e1ea3ea698f2cf56fc5ab883650efcc Mon Sep 17 00:00:00 2001 From: akatz Date: Mon, 23 Jan 2023 12:04:25 +0100 Subject: [PATCH 01/23] generalization --- ifrs17/Utils/ActivityLog.ipynb | 142 +++++++++++++++++++++------------ 1 file changed, 89 insertions(+), 53 deletions(-) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index e0e951ca..b772cd2e 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -157,6 +157,11 @@ "\n public string Format {get; init;}", "\n protected IDataSetImportVariable DataSetReader {get; set;}", "\n protected ISessionVariable Session {get; set;}", + "\n", + "\n public KeyedImportExport() ", + "\n { ", + "\n Id = Guid.NewGuid();", + "\n }", "\n}" ], "metadata": {}, @@ -220,6 +225,14 @@ "\n{", "\n protected ImportOptions Options {get; set;}", "\n", + "\n public KeyedImport() {Id = Guid.NewGuid();}", + "\n", + "\n public abstract KeyedImport WithOptions(ImportOptions options);", + "\n", + "\n public KeyedImport WithSession(ISessionVariable session) => this with {Session = session};", + "\n", + "\n public KeyedImport WithDataSetReader(IDataSetImportVariable importVariable) => this with {DataSetReader = importVariable};", + "\n", "\n public async Task InitializeImportDataAsync()", "\n {", "\n var stream = await GenerateStreamWrapperAsync();", @@ -287,6 +300,8 @@ "\n", "\n public string Source {get; init;}", "\n", + "\n public ImportFile() : base(){;}", + "\n", "\n public ImportFile(FileImportOptions options, IDataSetImportVariable importVariable, ISessionVariable session)", "\n {", "\n Options = options;", @@ -302,6 +317,25 @@ "\n // Andrey Katz: Options.TargetDataSource.Partion.GetCurrent(?? What do we put here, different classes might posess various partitions, e.g. Yield Curve has none ??)", "\n }", "\n", + "\n public override ImportFile WithOptions(ImportOptions options)", + "\n {", + "\n if (options is FileImportOptions fio)", + "\n {", + "\n string fileName = fio.FileName;", + "\n return this with{Options = fio,", + "\n Name = Path.GetFileName(fileName),", + "\n Directory = Path.GetDirectoryName(fileName),", + "\n ContentType = Path.GetExtension(fileName),", + "\n Source = options.Storage.GetType().Name,", + "\n Partition = GetInvolvedPartitions(options)", + "\n };", + "\n }", + "\n else", + "\n {", + "\n throw new Exception(\"The import options must be of file import options type\");", + "\n }", + "\n }", + "\n", "\n public ImportFile(Guid id)", "\n {", "\n Id = id;", @@ -329,6 +363,8 @@ "\n{", "\n public string Content {get; init;}", "\n", + "\n public ImportString() : base(){;}", + "\n", "\n public ImportString(StringImportOptions options, IDataSetImportVariable importVariable, ISessionVariable session)", "\n {", "\n Options = options;", @@ -338,6 +374,13 @@ "\n Content = options.Content;", "\n }", "\n", + "\n public override ImportString WithOptions(ImportOptions options)", + "\n {", + "\n if (options is StringImportOptions sgio) return this with {Options = sgio, ", + "\n Content = sgio.Content};", + "\n else throw new Exception(\"The import options must be of string import options type\");", + "\n }", + "\n", "\n public ImportString(Guid id)", "\n {", "\n Id = id;", @@ -364,6 +407,14 @@ "\n Id = Guid.NewGuid();", "\n }", "\n", + "\n public ImportDataSet() : base() {;}", + "\n", + "\n public override ImportDataSet WithOptions(ImportOptions options)", + "\n {", + "\n if (options is DataSetImportOptions dsio) return this with {Options = dsio};", + "\n else throw new Exception(\"The import options must be of data set import options type\");", + "\n }", + "\n", "\n public ImportDataSet(Guid id)", "\n {", "\n Id = id;", @@ -390,6 +441,14 @@ "\n Id = Guid.NewGuid();", "\n }", "\n", + "\n public ImportStream() : base() {;}", + "\n", + "\n public override ImportStream WithOptions(ImportOptions options)", + "\n {", + "\n if (options is StreamImportOptions smio) return this with {Options = smio};", + "\n else throw new Exception(\"The import options must be of stream import options type\");", + "\n }", + "\n", "\n public ImportStream(Guid id)", "\n {", "\n Id = id;", @@ -425,71 +484,23 @@ "\n var log = await Builder.ExecuteAsync();", "\n var options = Builder.GetImportOptions();", "\n var activity = new ImportExportActivity(log, Session);", - "\n bool importSucceeded = true;", + "\n var importSucceeded = true;", "\n switch(options)", "\n {", "\n case FileImportOptions fio:", - "\n var importFile = new ImportFile(Guid.NewGuid());", - "\n try", - "\n {", - "\n importFile = await (new ImportFile(fio, ImportVariable, Session)).InitializeImportDataAsync() as ImportFile;", - "\n activity = activity with {SourceId = importFile.Id};", - "\n }", - "\n catch (Exception e)", - "\n {", - "\n importSucceeded = false;", - "\n activity = activity with {SourceId = null, ExceptionMessage = e.Message};", - "\n }", - "\n activity = activity with {Category = \"Import from File\"};", - "\n if (importSucceeded) await DataSource.UpdateAsync(importFile.RepeatOnce());", + "\n activity = await ReportInputAndUpdateActivityAsync(activity, fio);", "\n break;", "\n", "\n case StringImportOptions sgio:", - "\n var importString = new ImportString(Guid.NewGuid());", - "\n try", - "\n {", - "\n importString = await (new ImportString(sgio, ImportVariable, Session)).InitializeImportDataAsync() as ImportString;", - "\n activity = activity with {SourceId = importString.Id};", - "\n }", - "\n catch (Exception e)", - "\n {", - "\n importSucceeded = false;", - "\n activity = activity with {SourceId = null, ExceptionMessage = e.Message};", - "\n }", - "\n activity = activity with {Category = \"Import from String\"};", - "\n if (importSucceeded) await DataSource.UpdateAsync(importString.RepeatOnce());", + "\n activity = await ReportInputAndUpdateActivityAsync(activity, sgio);", "\n break;", "\n ", "\n case StreamImportOptions smio:", - "\n var importStream = new ImportStream(Guid.NewGuid());", - "\n try", - "\n {", - "\n importStream = await (new ImportStream(smio, ImportVariable, Session)).InitializeImportDataAsync() as ImportStream;", - "\n activity = activity with {SourceId = importStream.Id};", - "\n }", - "\n catch (Exception e)", - "\n {", - "\n importSucceeded = false;", - "\n activity = activity with {SourceId = null, ExceptionMessage = e.Message};", - "\n }", - "\n activity = activity with {Category = \"Import from Stream\"};", - "\n if (importSucceeded) await DataSource.UpdateAsync(importStream.RepeatOnce());", + "\n activity = await ReportInputAndUpdateActivityAsync(activity, smio);", "\n break;", "\n", "\n case DataSetImportOptions dsio:", - "\n var importDataSet = new ImportDataSet(Guid.NewGuid());", - "\n try", - "\n {", - "\n importDataSet = await (new ImportDataSet(dsio, ImportVariable, Session)).InitializeImportDataAsync() as ImportDataSet;", - "\n activity = activity with {SourceId = importDataSet.Id};", - "\n }", - "\n catch (Exception e)", - "\n {", - "\n importSucceeded = false;", - "\n activity = activity with {SourceId = null, ExceptionMessage = e.Message};", - "\n }", - "\n activity = activity with {Category = \"Import from Data Set\"};", - "\n if (importSucceeded) await DataSource.UpdateAsync(importDataSet.RepeatOnce());", + "\n activity = await ReportInputAndUpdateActivityAsync(activity, dsio);", "\n break;", "\n", "\n default:", @@ -500,6 +511,31 @@ "\n await DataSource.CommitAsync();", "\n return log;", "\n }", + "\n", + "\n private async Task ReportInputAndUpdateActivityAsync(ImportExportActivity activity, ", + "\n TOptions options)", + "\n where TOptions: ImportOptions", + "\n where TImport: KeyedImport, new()", + "\n {", + "\n try", + "\n {", + "\n var import = new TImport();", + "\n import = await import.WithSession(Session)", + "\n .WithDataSetReader(ImportVariable)", + "\n .WithOptions(options)", + "\n .InitializeImportDataAsync() as TImport;", + "\n activity = activity with {SourceId = import.Id, ", + "\n Category = \"Import from File\"};", + "\n await DataSource.UpdateAsync(import.RepeatOnce());", + "\n }", + "\n catch (Exception e)", + "\n {", + "\n activity = activity with {SourceId = null, ", + "\n\t\t\t\t\t\t\t\t\tCategory = \"Import from File\",", + "\n ExceptionMessage = e.Message};", + "\n }", + "\n return activity;", + "\n }", "\n}" ], "metadata": {}, From d4d17062fffeb3ecc1285df32791a73764153891 Mon Sep 17 00:00:00 2001 From: akatz Date: Mon, 23 Jan 2023 13:43:15 +0100 Subject: [PATCH 02/23] more concise switch --- ifrs17/Utils/ActivityLog.ipynb | 38 +++++++++++----------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index ee3d17cf..45ca471c 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -79,7 +79,7 @@ "cell_type": "markdown", "source": [ "## Import Export Activity ", - "\nEvery activity to and from (import or export) the DataSource is tracked by recording an ImportExportActivity. Among other information this record tracks the user who performs the action, the timestamp, the activity log, and a unique identifier which can be used to retrieve the data subject of the activity. " + "\nEvery activity to and from (import or export) the DataSource is tracked by recording an ImportExportActivity. Among other information this record tracks the user who performe the action, the timestamp, the activity log, and a unique identifier which can be used to retrieve the data subject of the activity. " ], "metadata": {}, "execution_count": 0, @@ -483,40 +483,26 @@ "\n {", "\n var log = await Builder.ExecuteAsync();", "\n var options = Builder.GetImportOptions();", - "\n var activity = new ImportExportActivity(log, Session);", - "\n var importSucceeded = true;", - "\n switch(options)", + "\n var activity = options switch", "\n {", - "\n case FileImportOptions fio:", - "\n activity = await ReportInputAndUpdateActivityAsync(activity, fio);", - "\n break;", - "\n", - "\n case StringImportOptions sgio:", - "\n activity = await ReportInputAndUpdateActivityAsync(activity, sgio);", - "\n break;", - "\n ", - "\n case StreamImportOptions smio:", - "\n activity = await ReportInputAndUpdateActivityAsync(activity, smio);", - "\n break;", - "\n", - "\n case DataSetImportOptions dsio:", - "\n activity = await ReportInputAndUpdateActivityAsync(activity, dsio);", - "\n break;", - "\n", - "\n default:", - "\n throw new Exception(\"Import Options object is not an instance of an appropriate class.\");", - "\n break;", - "\n }", + "\n FileImportOptions fio => await ReportInputAndUpdateActivityAsync(log, fio),", + "\n StringImportOptions sgio => await ReportInputAndUpdateActivityAsync(log, sgio),", + "\n StreamImportOptions smio => await ReportInputAndUpdateActivityAsync(log, smio),", + "\n DataSetImportOptions dsio => await ReportInputAndUpdateActivityAsync(log, dsio),", + "\n _ => null,", + "\n };", + "\n if (activity is null) throw new Exception(\"Import Options object is not an instance of an appropriate class.\");", "\n await DataSource.UpdateAsync(activity.RepeatOnce());", "\n await DataSource.CommitAsync();", "\n return log;", "\n }", "\n", - "\n private async Task ReportInputAndUpdateActivityAsync(ImportExportActivity activity, ", - "\n TOptions options)", + "\n private async Task ReportInputAndUpdateActivityAsync(ActivityLog log, ", + "\n TOptions options)", "\n where TOptions: ImportOptions", "\n where TImport: KeyedImport, new()", "\n {", + "\n var activity = new ImportExportActivity(log, Session);", "\n try", "\n {", "\n var import = new TImport();", From 031d4aa560a4180704ada1ce604f6ec8299806bb Mon Sep 17 00:00:00 2001 From: akatz Date: Mon, 23 Jan 2023 13:48:27 +0100 Subject: [PATCH 03/23] typo --- ifrs17/Utils/ActivityLog.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index 45ca471c..2a3e0353 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -79,7 +79,7 @@ "cell_type": "markdown", "source": [ "## Import Export Activity ", - "\nEvery activity to and from (import or export) the DataSource is tracked by recording an ImportExportActivity. Among other information this record tracks the user who performe the action, the timestamp, the activity log, and a unique identifier which can be used to retrieve the data subject of the activity. " + "\nEvery activity to and from (import or export) the DataSource is tracked by recording an ImportExportActivity. Among other information this record tracks the user who performs the action, the timestamp, the activity log, and the unique identifier which can be used to retrieve the data subject of the activity. " ], "metadata": {}, "execution_count": 0, From ab444ace888fa074b3fe433c8ba3f1bec44d8a2b Mon Sep 17 00:00:00 2001 From: akatz Date: Mon, 23 Jan 2023 14:10:38 +0100 Subject: [PATCH 04/23] messages fixed --- ifrs17/Utils/ActivityLog.ipynb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index 2a3e0353..eef17b64 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -485,10 +485,10 @@ "\n var options = Builder.GetImportOptions();", "\n var activity = options switch", "\n {", - "\n FileImportOptions fio => await ReportInputAndUpdateActivityAsync(log, fio),", - "\n StringImportOptions sgio => await ReportInputAndUpdateActivityAsync(log, sgio),", - "\n StreamImportOptions smio => await ReportInputAndUpdateActivityAsync(log, smio),", - "\n DataSetImportOptions dsio => await ReportInputAndUpdateActivityAsync(log, dsio),", + "\n FileImportOptions fio => await ReportInputAndUpdateActivityAsync(log, fio, \"Import from File \"),", + "\n StringImportOptions sgio => await ReportInputAndUpdateActivityAsync(log, sgio, \"Import from String\"),", + "\n StreamImportOptions smio => await ReportInputAndUpdateActivityAsync(log, smio, \"Import from Stream\"),", + "\n DataSetImportOptions dsio => await ReportInputAndUpdateActivityAsync(log, dsio, \"Import fro Data Set\"),", "\n _ => null,", "\n };", "\n if (activity is null) throw new Exception(\"Import Options object is not an instance of an appropriate class.\");", @@ -498,7 +498,8 @@ "\n }", "\n", "\n private async Task ReportInputAndUpdateActivityAsync(ActivityLog log, ", - "\n TOptions options)", + "\n TOptions options, ", + "\n string categoryMessage)", "\n where TOptions: ImportOptions", "\n where TImport: KeyedImport, new()", "\n {", @@ -511,13 +512,13 @@ "\n .WithOptions(options)", "\n .InitializeImportDataAsync() as TImport;", "\n activity = activity with {SourceId = import.Id, ", - "\n Category = \"Import from File\"};", + "\n Category = categoryMessage};", "\n await DataSource.UpdateAsync(import.RepeatOnce());", "\n }", "\n catch (Exception e)", "\n {", "\n activity = activity with {SourceId = null, ", - "\n\t\t\t\t\t\t\t\t\tCategory = \"Import from File\",", + "\n\t\t\t\t\t\t\t\t\tCategory = categoryMessage,", "\n ExceptionMessage = e.Message};", "\n }", "\n return activity;", From c1fc09a7c92c503ff030f95baf6004ca0291c278 Mon Sep 17 00:00:00 2001 From: akatz Date: Wed, 25 Jan 2023 15:43:04 +0100 Subject: [PATCH 05/23] changed api one again --- ifrs17/Utils/ActivityLog.ipynb | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index eef17b64..5c89d920 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -314,7 +314,7 @@ "\n ContentType = Path.GetExtension(fileName);", "\n Source = options.Storage.GetType().Name; ", "\n Partition = GetInvolvedPartitions(options);", - "\n // Andrey Katz: Options.TargetDataSource.Partion.GetCurrent(?? What do we put here, different classes might posess various partitions, e.g. Yield Curve has none ??)", + "\n // Andrey Katz: Options.TargetDataSource.Partion.GetCurrentPartitions(?? What do we put here, different classes might posess various partitions, e.g. Yield Curve has none ??)", "\n }", "\n", "\n public override ImportFile WithOptions(ImportOptions options)", @@ -474,11 +474,12 @@ { "cell_type": "code", "source": [ - "public record ImportBuilderWriter(ImportOptionsBuilder Builder, ", - "\n ISessionVariable Session, ", - "\n IDataSource DataSource, ", - "\n IDataSetImportVariable ImportVariable)", + "public record ImportBuilderWriter(ImportOptionsBuilder Builder) ", "\n{", + "\n public static ISessionVariable Session {get; set;}", + "\n public static IDataSource DataSource {get; set;}", + "\n public static IDataSetImportVariable ImportVariable {get; set;}", + "\n", "\n public async Task ExecuteAsync()", "\n {", "\n var log = await Builder.ExecuteAsync();", @@ -523,7 +524,11 @@ "\n }", "\n return activity;", "\n }", - "\n}" + "\n}", + "\n", + "\nImportBuilderWriter.Session = Session;", + "\nImportBuilderWriter.DataSource = DataSource;", + "\nImportBuilderWriter.ImportVariable = DataSetReader;" ], "metadata": {}, "execution_count": 0, @@ -532,11 +537,11 @@ { "cell_type": "code", "source": [ - "public record ExportBuilderWriter(DocumentBuilder Builder, ", - "\n ISessionVariable Session, ", - "\n IDataSource DataSource, ", - "\n IDataSetImportVariable ImportVariable)", + "public record ExportBuilderWriter(DocumentBuilder Builder)", "\n{", + "\n public static ISessionVariable Session {get; set;}", + "\n public static IDataSetImportVariable ImportVariable {get; set;}", + "\n public static IDataSource DataSource {get; set;}", "\n public async Task ExecuteAsync()", "\n {", "\n var exportResult = await Builder.ExecuteAsync();", @@ -548,7 +553,10 @@ "\n await DataSource.CommitAsync();", "\n return exportResult;", "\n }", - "\n}" + "\n}", + "\nExportBuilderWriter.Session = Session;", + "\nExportBuilderWriter.DataSource = DataSource;", + "\nExportBuilderWriter.ImportVariable = DataSetReader;" ], "metadata": {}, "execution_count": 0, @@ -557,11 +565,7 @@ { "cell_type": "code", "source": [ - "public static ImportBuilderWriter WithActivityLog(this ImportOptionsBuilder builder, ", - "\n ISessionVariable session, ", - "\n IDataSource dataSource, ", - "\n IDataSetImportVariable importVariable) => ", - "\n new ImportBuilderWriter(builder, session, dataSource, importVariable);" + "public static ImportBuilderWriter WithActivityLog(this ImportOptionsBuilder builder) => new ImportBuilderWriter(builder);" ], "metadata": {}, "execution_count": 0, @@ -570,11 +574,7 @@ { "cell_type": "code", "source": [ - "public static ExportBuilderWriter WithActivityLog(this IDocumentBuilder builder, ", - "\n ISessionVariable session, ", - "\n IDataSource dataSource, ", - "\n IDataSetImportVariable importVariable) =>", - "\n new ExportBuilderWriter(builder as DocumentBuilder, session, dataSource, importVariable);" + "public static ExportBuilderWriter WithActivityLog(this IDocumentBuilder builder) => new ExportBuilderWriter(builder as DocumentBuilder);" ], "metadata": {}, "execution_count": 0, From 85e4b85101878a18d15d75078044a51f04ffed0c Mon Sep 17 00:00:00 2001 From: akatz Date: Wed, 25 Jan 2023 17:04:15 +0100 Subject: [PATCH 06/23] api update --- .../InitSystemorphBaseToMemory.ipynb | 6 +-- .../InitSystemorphRefDataToMemory.ipynb | 26 +++++------ .../InitSystemorphToDatabase.ipynb | 44 +++++++++---------- .../InitSystemorphToMemory.ipynb | 14 +++--- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/ifrs17-template/Initialization/InitSystemorphBaseToMemory.ipynb b/ifrs17-template/Initialization/InitSystemorphBaseToMemory.ipynb index 412f644a..de4c15af 100644 --- a/ifrs17-template/Initialization/InitSystemorphBaseToMemory.ipynb +++ b/ifrs17-template/Initialization/InitSystemorphBaseToMemory.ipynb @@ -80,7 +80,7 @@ "await Import.FromFile(\"../Files/DataNodes/DataNodes_CH.csv\")", "\n .WithFormat(ImportFormats.DataNode)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -93,7 +93,7 @@ "await Import.FromFile(\"../Files/DataNodes/DataNodeStates_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.DataNodeState)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -106,7 +106,7 @@ "await Import.FromFile(\"../Files/DataNodes/DataNodeParameters_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.DataNodeParameter)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, diff --git a/ifrs17-template/Initialization/InitSystemorphRefDataToMemory.ipynb b/ifrs17-template/Initialization/InitSystemorphRefDataToMemory.ipynb index d406a80d..29276b04 100644 --- a/ifrs17-template/Initialization/InitSystemorphRefDataToMemory.ipynb +++ b/ifrs17-template/Initialization/InitSystemorphRefDataToMemory.ipynb @@ -118,7 +118,7 @@ "\n .WithType()", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -131,7 +131,7 @@ "await Import.FromFile(\"../Files/Dimensions.csv\")", "\n .WithFormat(ImportFormats.AocConfiguration)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -144,7 +144,7 @@ "await Import.FromFile(\"../Files/ReportingNodes/ReportingNodes.csv\")", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -166,42 +166,42 @@ "var log = await Import.FromFile(\"../Files/Parameters/YieldCurve_2019_12.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync();", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2020_1.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2020_3.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2020_12.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2021_3.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2021_6.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2021_12.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync());", "\nlog" ], @@ -215,7 +215,7 @@ "await Import.FromFile(\"../Files/Parameters/ExchangeRate.csv\")", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -228,7 +228,7 @@ "await Import.FromFile(\"../Files/Parameters/PartnerRating.csv\")", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -241,7 +241,7 @@ "await Import.FromFile(\"../Files/Parameters/CreditDefaultRate.csv\")", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, diff --git a/ifrs17-template/Initialization/InitSystemorphToDatabase.ipynb b/ifrs17-template/Initialization/InitSystemorphToDatabase.ipynb index ecb29f00..e8bec1bd 100644 --- a/ifrs17-template/Initialization/InitSystemorphToDatabase.ipynb +++ b/ifrs17-template/Initialization/InitSystemorphToDatabase.ipynb @@ -96,7 +96,7 @@ "\n .WithType()", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -109,7 +109,7 @@ "await Import.FromFile(\"../Files/ReportingNodes/ReportingNodes.csv\")", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -131,42 +131,42 @@ "var log = await Import.FromFile(\"../Files/Parameters/YieldCurve_2019_12.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync();", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2020_1.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2020_3.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2020_12.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2021_3.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2021_6.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog.Merge(await Import.FromFile(\"../Files/Parameters/YieldCurve_2021_12.csv\")", "\n .WithFormat(ImportFormats.YieldCurve)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()", "\n );", "\nlog" @@ -181,7 +181,7 @@ "await Import.FromFile(\"../Files/Parameters/ExchangeRate.csv\")", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -194,7 +194,7 @@ "await Import.FromFile(\"../Files/Parameters/PartnerRating.csv\")", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -207,7 +207,7 @@ "await Import.FromFile(\"../Files/Parameters/CreditDefaultRate.csv\")", "\n .WithType()", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -229,7 +229,7 @@ "await Import.FromFile(\"../Files/DataNodes/DataNodes_CH.csv\")", "\n .WithFormat(ImportFormats.DataNode)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -242,7 +242,7 @@ "await Import.FromFile(\"../Files/DataNodes/DataNodeStates_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.DataNodeState)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -255,7 +255,7 @@ "await Import.FromFile(\"../Files/DataNodes/DataNodeParameters_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.DataNodeParameter)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -277,7 +277,7 @@ "await Import.FromFile(\"../Files/TransactionalData/Openings_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Opening)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -290,7 +290,7 @@ "await Import.FromFile(\"../Files/TransactionalData/NominalCashflows_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -303,7 +303,7 @@ "await Import.FromFile(\"../Files/TransactionalData/Actuals_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -316,7 +316,7 @@ "await Import.FromFile(\"../Files/TransactionalData/NominalCashflows_CH_2021_3.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -329,7 +329,7 @@ "await Import.FromFile(\"../Files/TransactionalData/Actuals_CH_2021_3.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -342,7 +342,7 @@ "await Import.FromFile(\"../Files/TransactionalData/SimpleValue_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.SimpleValue )", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -355,7 +355,7 @@ "await Import.FromFile(\"../Files/TransactionalData/NominalCashflows_CH_2020_12_MTUP10pct.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, diff --git a/ifrs17-template/Initialization/InitSystemorphToMemory.ipynb b/ifrs17-template/Initialization/InitSystemorphToMemory.ipynb index f5a7d4bc..cb39d2f2 100644 --- a/ifrs17-template/Initialization/InitSystemorphToMemory.ipynb +++ b/ifrs17-template/Initialization/InitSystemorphToMemory.ipynb @@ -70,7 +70,7 @@ "await Import.FromFile(\"../Files/TransactionalData/Openings_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Opening)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -83,7 +83,7 @@ "await Import.FromFile(\"../Files/TransactionalData/NominalCashflows_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -96,7 +96,7 @@ "await Import.FromFile(\"../Files/TransactionalData/Actuals_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -109,7 +109,7 @@ "await Import.FromFile(\"../Files/TransactionalData/NominalCashflows_CH_2021_3.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -122,7 +122,7 @@ "await Import.FromFile(\"../Files/TransactionalData/Actuals_CH_2021_3.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -135,7 +135,7 @@ "await Import.FromFile(\"../Files/TransactionalData/SimpleValue_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.SimpleValue )", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -148,7 +148,7 @@ "await Import.FromFile(\"../Files/TransactionalData/NominalCashflows_CH_2020_12_MTUP10pct.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, From c365e9885a07649126302c0d7e8b3c037e1abaf3 Mon Sep 17 00:00:00 2001 From: akatz Date: Wed, 25 Jan 2023 17:09:12 +0100 Subject: [PATCH 07/23] new api --- ifrs17-template/Import/CloseImportTemplate.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17-template/Import/CloseImportTemplate.ipynb b/ifrs17-template/Import/CloseImportTemplate.ipynb index fc78fc44..9b1a2624 100644 --- a/ifrs17-template/Import/CloseImportTemplate.ipynb +++ b/ifrs17-template/Import/CloseImportTemplate.ipynb @@ -121,7 +121,7 @@ "await Import.FromFile(pathToFile)", "\n .WithFormat(format)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -170,7 +170,7 @@ "await Import.FromFile(pathToFile)", "\n .WithFormat(format)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, From e4928e8c4acdab7631e07c271bb6a5fa89b71821 Mon Sep 17 00:00:00 2001 From: akatz Date: Wed, 25 Jan 2023 17:16:37 +0100 Subject: [PATCH 08/23] full update --- ifrs17-template/Export/MapTemplate.ipynb | 6 +++--- .../ActualsUseCaseDataImport.ipynb | 18 +++++++++--------- .../CsmSwitchDataImport.ipynb | 18 +++++++++--------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ifrs17-template/Export/MapTemplate.ipynb b/ifrs17-template/Export/MapTemplate.ipynb index dc792dba..ca2f80c7 100644 --- a/ifrs17-template/Export/MapTemplate.ipynb +++ b/ifrs17-template/Export/MapTemplate.ipynb @@ -155,7 +155,7 @@ "\n .GroupofContractConfiguration(typeof(ReinsurancePortfolio))", "\n .GroupofContractConfiguration(typeof(InsurancePortfolio))", "\n .MainTabConfiguration(partition)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -241,7 +241,7 @@ "\n .StateEnumConfiguration() ", "\n .DataNodeStateConfiguration(dataNodeStates)", "\n .MainTabConfiguration(partition)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -328,7 +328,7 @@ "\n .WithSource(Workspace)", "\n .DataNodeParameterConfiguration(dataNodeParameters)", "\n .MainTabConfiguration(partition)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, diff --git a/ifrs17-template/PracticalUseCases/ActualsOutsideThePeriod/ActualsUseCaseDataImport.ipynb b/ifrs17-template/PracticalUseCases/ActualsOutsideThePeriod/ActualsUseCaseDataImport.ipynb index f3066174..e71da8f0 100644 --- a/ifrs17-template/PracticalUseCases/ActualsOutsideThePeriod/ActualsUseCaseDataImport.ipynb +++ b/ifrs17-template/PracticalUseCases/ActualsOutsideThePeriod/ActualsUseCaseDataImport.ipynb @@ -77,7 +77,7 @@ "await Import.FromFile(\"DataNodes_ActualsCase_CH.csv\")", "\n .WithFormat(ImportFormats.DataNode)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -90,7 +90,7 @@ "await Import.FromFile(\"DataNodeStates_ActualsCase_CH_2020_1.csv\")", "\n .WithFormat(ImportFormats.DataNodeState)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -103,7 +103,7 @@ "await Import.FromFile(\"DataNodeParameters_ActualsCase_CH_2020_1.csv\")", "\n .WithFormat(ImportFormats.DataNodeParameter)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -134,7 +134,7 @@ "await Import.FromFile(\"NominalCashflows_ActualsCase_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -147,7 +147,7 @@ "await Import.FromFile(\"Actuals_ActualsCase_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -169,7 +169,7 @@ "await Import.FromFile(\"NominalCashflows_ActualsCase_CH_2021_6.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -182,7 +182,7 @@ "await Import.FromFile(\"Actuals_ActualsCase_CH_2021_6.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -204,7 +204,7 @@ "await Import.FromFile(\"NominalCashflows_ActualsCase_CH_2021_12.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -217,7 +217,7 @@ "await Import.FromFile(\"Actuals_ActualsCase_CH_2021_12.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, diff --git a/ifrs17-template/PracticalUseCases/SingleVsMultipleCsmSwitch/CsmSwitchDataImport.ipynb b/ifrs17-template/PracticalUseCases/SingleVsMultipleCsmSwitch/CsmSwitchDataImport.ipynb index a0d0556a..7f14af98 100644 --- a/ifrs17-template/PracticalUseCases/SingleVsMultipleCsmSwitch/CsmSwitchDataImport.ipynb +++ b/ifrs17-template/PracticalUseCases/SingleVsMultipleCsmSwitch/CsmSwitchDataImport.ipynb @@ -76,7 +76,7 @@ "await Import.FromFile(\"DataNodes_CsmSwitch_CH.csv\")", "\n .WithFormat(ImportFormats.DataNode)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -89,7 +89,7 @@ "await Import.FromFile(\"DataNodeStates_CsmSwitch_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.DataNodeState)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -102,7 +102,7 @@ "await Import.FromFile(\"DataNodeParameters_CsmSwitch_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.DataNodeParameter)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -133,7 +133,7 @@ "await Import.FromFile(\"NominalCashflows_CsmSwitch_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -146,7 +146,7 @@ "await Import.FromFile(\"Actuals_CsmSwitch_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -159,7 +159,7 @@ "await Import.FromFile(\"NominalCashflows_CsmSwitch_CH_2021_3.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -172,7 +172,7 @@ "await Import.FromFile(\"Actuals_CsmSwitch_CH_2021_3.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -194,7 +194,7 @@ "await Import.FromFile(\"SimpleValue_CsmSwitch_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.SimpleValue)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -207,7 +207,7 @@ "await Import.FromFile(\"SimpleValue_CsmSwitch_CH_2021_3.csv\")", "\n .WithFormat(ImportFormats.SimpleValue)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, From c804607ab356414b6406ab09fb0d679ec732910d Mon Sep 17 00:00:00 2001 From: akatz Date: Wed, 25 Jan 2023 17:21:50 +0100 Subject: [PATCH 09/23] start debugging --- .../Import/CloseImportTemplate.ipynb | 216 +++++++++++++++++- 1 file changed, 215 insertions(+), 1 deletion(-) diff --git a/ifrs17-template/Import/CloseImportTemplate.ipynb b/ifrs17-template/Import/CloseImportTemplate.ipynb index 9b1a2624..55c0c9ef 100644 --- a/ifrs17-template/Import/CloseImportTemplate.ipynb +++ b/ifrs17-template/Import/CloseImportTemplate.ipynb @@ -115,13 +115,22 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "format" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ "await Import.FromFile(pathToFile)", "\n .WithFormat(format)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog()", + "\n .WithActivityLog(Session, DataSource, DataSetReader)", "\n .ExecuteAsync()" ], "metadata": {}, @@ -177,6 +186,42 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "var io1 = Import.FromFile(pathToFile)", + "\n .WithFormat(format)", + "\n .WithTarget(DataSource)", + "\n .GetImportOptions();" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "Import.FromFile(pathToFile)", + "\n .WithFormat(format)", + "\n .WithTarget(DataSource)", + "\n .GetImportOptions()", + "\n .TargetDataSource", + "\n .Partition", + "\n .GetCurrentPartitions()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "io1.TargetDataSource.Partition.GetCurrentPartitions()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [ @@ -196,6 +241,175 @@ "metadata": {}, "execution_count": 0, "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "DataSource.Partition.GetCurrent()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "DataSource.Partition.GetCurrentPartitions()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "await Import.FromFile(pathToFile)", + "\n .WithFormat(format)", + "\n .WithTarget(DataSource)", + "\n .WithActivityLog()", + "\n .ExecuteAsync()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var io2 = Import.FromFile(pathToFile)", + "\n .WithFormat(format)", + "\n .WithTarget(DataSource)", + "\n .GetImportOptions();" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "io1" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "io2" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "io1.TargetDataSource.Partition.GetCurrentPartitions()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "io2.TargetDataSource.Partition.GetCurrentPartitions()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "Import.FromFile(pathToFile)", + "\n .WithFormat(format)", + "\n .WithTarget(DataSource)", + "\n .GetType()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "io1.TargetDataSource.Partition.GetAssociatedPartition(typeof(DataNode))" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "io2.TargetDataSource.Partition.GetAssociatedPartition(typeof(DataNode))" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "DataSource.Partition.GetAssociatedPartition(typeof(DataNode))" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "#!import \"../Constants/CalculationEngine\"", + "\n#!eval calculationEngine" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var stream = await Project.FileStorage.ReadAsync(pathToFile);", + "\nvar dataSet = await DataSetReader.ReadFromStream(stream).ExecuteAsync();" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "/*await Import.FromFile(pathToFile)", + "\n .WithFormat(format)", + "\n .WithTarget(DataSource)", + "\n .WithActivityLog()", + "\n .ExecuteAsync() */", + "\n var workspace = Workspace.CreateNew();", + "\n var log = await UploadDataNodesToWorkspaceAsync(dataSet.DataSet, workspace);", + "\n var partition = (Guid)workspace.Partition.GetCurrent(nameof(PartitionByReportingNode));", + "\n await workspace.CommitToAsync(DataSource, partition);", + "\n /*await workspace.CommitToAsync(DataSource, partition);", + "\n await workspace.CommitToAsync(DataSource, partition);", + "\n await workspace.CommitToAsync(DataSource, partition);", + "\n log;*/", + "\npartition" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] } ] } \ No newline at end of file From a708514b871c294d7b3dbd6596121875a573333d Mon Sep 17 00:00:00 2001 From: akatz Date: Thu, 26 Jan 2023 17:00:49 +0100 Subject: [PATCH 10/23] first attempt to fix the opening format. Not yet sure if it works. The changes in the DataNode format must be reset --- ifrs17/Import/Importers.ipynb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 5d680c6c..608f4270 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -925,7 +925,7 @@ "\n var partition = (Guid)workspace.Partition.GetCurrent(nameof(PartitionByReportingNode));", "\n await workspace.CommitToAsync(DataSource, partition);", "\n await workspace.CommitToAsync(DataSource, partition);", - "\n await workspace.CommitToAsync(DataSource, partition);", + "\n await workspace.CommitToAsync(options.TargetDataSource, partition);", "\n await workspace.CommitToAsync(DataSource, partition);", "\n return log;", "\n});" @@ -1471,22 +1471,24 @@ "cell_type": "code", "source": [ "Import.DefineFormat(ImportFormats.Opening, async (options, dataSet) => {", + "\n var workspace = Workspace.CreateNew();", + "\n var partition = (Guid)workspace.Partition.GetCurrent(nameof(PartitionByReportingNodeAndPeriod));", "\n Activity.Start();", "\n var args = await GetArgsAndCommitPartitionAsync(dataSet) with {ImportFormat = ImportFormats.Opening};", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n await DataNodeFactoryAsync(dataSet, ImportFormats.Opening, args);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n", - "\n Guid partitionId = new Guid();", - "\n var workspace = Workspace.CreateNew();", - "\n var parsingLog = await ParseSimpleValueToWorkspaceAsync(dataSet, args, partitionId, workspace);", + "\n //Guid partitionId = new Guid();", + "\n //var workspace = Workspace.CreateNew();", + "\n var parsingLog = await ParseSimpleValueToWorkspaceAsync(dataSet, args, partition, workspace);", "\n if(parsingLog.Errors.Any()) return Activity.Finish().Merge(parsingLog);", "\n", "\n var workspaceToCompute = Workspace.CreateNew();", "\n workspaceToCompute.Initialize(x => x.FromSource(DataSource));", "\n var calculationLog = await ComputeAsync(args, workspace, workspaceToCompute, false); ", "\n if(calculationLog.Errors.Any()) return Activity.Finish().Merge(calculationLog);", - "\n await workspaceToCompute.CommitToAsync(DataSource, partitionId);", + "\n await workspaceToCompute.CommitToAsync(DataSource, partition);", "\n return Activity.Finish().Merge(parsingLog).Merge(calculationLog);", "\n});" ], From d0cb5966360aa7e1f409962404d2d1f9ef76cdbc Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 14:02:55 +0100 Subject: [PATCH 11/23] bug fix --- ifrs17/Import/Importers.ipynb | 39 ++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 608f4270..1949517f 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -460,10 +460,22 @@ "\n var dataNodeSingleParametersUndefined = dataNodesImported.Where(x => x != null &&", "\n !dataNodeParametersDefined.Contains(x) && ", "\n dataNodesDefined.SingleOrDefault(y => y.SystemName == x) is GroupOfInsuranceContract).ToHashSet();", - "\n await DataSource.UpdateAsync( dataNodeStatesUndefined.Select(x => ", - "\n new DataNodeState {DataNode = x, Year = args.Year, Month = DefaultDataNodeActivationMonth, State = State.Active, Partition = partition.Id}).ToArray() );", - "\n await DataSource.UpdateAsync( dataNodeSingleParametersUndefined.Select(x => ", - "\n new SingleDataNodeParameter {DataNode = x, Year = args.Year, Month = DefaultDataNodeActivationMonth, PremiumAllocation = DefaultPremiumExperienceAdjustmentFactor, Partition = partition.Id}).ToArray() );", + "\n if ((dataNodeStatesUndefined?.Count ?? 0) > 0)", + "\n await DataSource.UpdateAsync( dataNodeStatesUndefined.Select(x => ", + "\n new DataNodeState {DataNode = x, ", + "\n Year = args.Year, ", + "\n Month = DefaultDataNodeActivationMonth, ", + "\n State = State.Active, ", + "\n Partition = partition.Id})", + "\n .ToArray() );", + "\n if ((dataNodeSingleParametersUndefined?.Count ?? 0) > 0)", + "\n await DataSource.UpdateAsync( dataNodeSingleParametersUndefined.Select(x => ", + "\n new SingleDataNodeParameter {DataNode = x, ", + "\n Year = args.Year, ", + "\n Month = DefaultDataNodeActivationMonth, ", + "\n PremiumAllocation = DefaultPremiumExperienceAdjustmentFactor, ", + "\n Partition = partition.Id})", + "\n .ToArray() );", "\n await DataSource.CommitAsync();", "\n}" ], @@ -1222,6 +1234,7 @@ "cell_type": "code", "source": [ "Import.DefineFormat(ImportFormats.Cashflow, async (options, dataSet) => {", + "\n var workspace = Workspace.CreateNew();", "\n Activity.Start();", "\n var primaryArgs = await GetArgsAndCommitPartitionAsync(dataSet) with {ImportFormat = ImportFormats.Cashflow};", "\n if(Activity.HasErrors()) return Activity.Finish();", @@ -1230,7 +1243,6 @@ "\n await DataNodeFactoryAsync(dataSet, ImportFormats.Cashflow, primaryArgs);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n ", - "\n var workspace = Workspace.CreateNew();", "\n var log = await ParseCashflowsToWorkspaceAsync(dataSet, primaryArgs, workspace);", "\n if(log.Errors.Any()) return Activity.Finish().Merge(log);", "\n", @@ -1472,29 +1484,36 @@ "source": [ "Import.DefineFormat(ImportFormats.Opening, async (options, dataSet) => {", "\n var workspace = Workspace.CreateNew();", - "\n var partition = (Guid)workspace.Partition.GetCurrent(nameof(PartitionByReportingNodeAndPeriod));", "\n Activity.Start();", "\n var args = await GetArgsAndCommitPartitionAsync(dataSet) with {ImportFormat = ImportFormats.Opening};", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n await DataNodeFactoryAsync(dataSet, ImportFormats.Opening, args);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n", - "\n //Guid partitionId = new Guid();", - "\n //var workspace = Workspace.CreateNew();", - "\n var parsingLog = await ParseSimpleValueToWorkspaceAsync(dataSet, args, partition, workspace);", + "\n Guid partitionId = new Guid();", + "\n var parsingLog = await ParseSimpleValueToWorkspaceAsync(dataSet, args, partitionId, workspace);", "\n if(parsingLog.Errors.Any()) return Activity.Finish().Merge(parsingLog);", "\n", "\n var workspaceToCompute = Workspace.CreateNew();", "\n workspaceToCompute.Initialize(x => x.FromSource(DataSource));", "\n var calculationLog = await ComputeAsync(args, workspace, workspaceToCompute, false); ", "\n if(calculationLog.Errors.Any()) return Activity.Finish().Merge(calculationLog);", - "\n await workspaceToCompute.CommitToAsync(DataSource, partition);", + "\n await workspaceToCompute.CommitToAsync(DataSource, partitionId);", "\n return Activity.Finish().Merge(parsingLog).Merge(calculationLog);", "\n});" ], "metadata": {}, "execution_count": 0, "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] } ] } \ No newline at end of file From 3b83f5775166e26fb1b79e89fbe99b0968b397cd Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 14:04:39 +0100 Subject: [PATCH 12/23] fix --- .../Import/CloseImportTemplate.ipynb | 184 +----------------- 1 file changed, 5 insertions(+), 179 deletions(-) diff --git a/ifrs17-template/Import/CloseImportTemplate.ipynb b/ifrs17-template/Import/CloseImportTemplate.ipynb index 55c0c9ef..34650589 100644 --- a/ifrs17-template/Import/CloseImportTemplate.ipynb +++ b/ifrs17-template/Import/CloseImportTemplate.ipynb @@ -130,7 +130,7 @@ "await Import.FromFile(pathToFile)", "\n .WithFormat(format)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -186,42 +186,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "var io1 = Import.FromFile(pathToFile)", - "\n .WithFormat(format)", - "\n .WithTarget(DataSource)", - "\n .GetImportOptions();" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "Import.FromFile(pathToFile)", - "\n .WithFormat(format)", - "\n .WithTarget(DataSource)", - "\n .GetImportOptions()", - "\n .TargetDataSource", - "\n .Partition", - "\n .GetCurrentPartitions()" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "io1.TargetDataSource.Partition.GetCurrentPartitions()" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "markdown", "source": [ @@ -243,18 +207,9 @@ "outputs": [] }, { - "cell_type": "code", - "source": [ - "DataSource.Partition.GetCurrent()" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", + "cell_type": "markdown", "source": [ - "DataSource.Partition.GetCurrentPartitions()" + "# Start debugging" ], "metadata": {}, "execution_count": 0, @@ -263,8 +218,8 @@ { "cell_type": "code", "source": [ - "await Import.FromFile(pathToFile)", - "\n .WithFormat(format)", + "await Import.FromFile(\"../Files/TransactionalData/Openings_CH_2020_12.csv\")", + "\n .WithFormat(ImportFormats.Opening)", "\n .WithTarget(DataSource)", "\n .WithActivityLog()", "\n .ExecuteAsync()" @@ -273,135 +228,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "var io2 = Import.FromFile(pathToFile)", - "\n .WithFormat(format)", - "\n .WithTarget(DataSource)", - "\n .GetImportOptions();" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "io1" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "io2" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "io1.TargetDataSource.Partition.GetCurrentPartitions()" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "io2.TargetDataSource.Partition.GetCurrentPartitions()" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "Import.FromFile(pathToFile)", - "\n .WithFormat(format)", - "\n .WithTarget(DataSource)", - "\n .GetType()" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "io1.TargetDataSource.Partition.GetAssociatedPartition(typeof(DataNode))" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "io2.TargetDataSource.Partition.GetAssociatedPartition(typeof(DataNode))" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "DataSource.Partition.GetAssociatedPartition(typeof(DataNode))" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "#!import \"../Constants/CalculationEngine\"", - "\n#!eval calculationEngine" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "var stream = await Project.FileStorage.ReadAsync(pathToFile);", - "\nvar dataSet = await DataSetReader.ReadFromStream(stream).ExecuteAsync();" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "/*await Import.FromFile(pathToFile)", - "\n .WithFormat(format)", - "\n .WithTarget(DataSource)", - "\n .WithActivityLog()", - "\n .ExecuteAsync() */", - "\n var workspace = Workspace.CreateNew();", - "\n var log = await UploadDataNodesToWorkspaceAsync(dataSet.DataSet, workspace);", - "\n var partition = (Guid)workspace.Partition.GetCurrent(nameof(PartitionByReportingNode));", - "\n await workspace.CommitToAsync(DataSource, partition);", - "\n /*await workspace.CommitToAsync(DataSource, partition);", - "\n await workspace.CommitToAsync(DataSource, partition);", - "\n await workspace.CommitToAsync(DataSource, partition);", - "\n log;*/", - "\npartition" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "code", "source": [ From 2c5e28f109f5637162ab253feac5456b8e698b75 Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 14:15:01 +0100 Subject: [PATCH 13/23] restore unnecessary changes --- ifrs17/Import/Importers.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index 1949517f..e0aec272 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -937,7 +937,7 @@ "\n var partition = (Guid)workspace.Partition.GetCurrent(nameof(PartitionByReportingNode));", "\n await workspace.CommitToAsync(DataSource, partition);", "\n await workspace.CommitToAsync(DataSource, partition);", - "\n await workspace.CommitToAsync(options.TargetDataSource, partition);", + "\n await workspace.CommitToAsync(DataSource, partition);", "\n await workspace.CommitToAsync(DataSource, partition);", "\n return log;", "\n});" @@ -1234,7 +1234,6 @@ "cell_type": "code", "source": [ "Import.DefineFormat(ImportFormats.Cashflow, async (options, dataSet) => {", - "\n var workspace = Workspace.CreateNew();", "\n Activity.Start();", "\n var primaryArgs = await GetArgsAndCommitPartitionAsync(dataSet) with {ImportFormat = ImportFormats.Cashflow};", "\n if(Activity.HasErrors()) return Activity.Finish();", @@ -1243,6 +1242,7 @@ "\n await DataNodeFactoryAsync(dataSet, ImportFormats.Cashflow, primaryArgs);", "\n if(Activity.HasErrors()) return Activity.Finish();", "\n ", + "\n var workspace = Workspace.CreateNew();", "\n var log = await ParseCashflowsToWorkspaceAsync(dataSet, primaryArgs, workspace);", "\n if(log.Errors.Any()) return Activity.Finish().Merge(log);", "\n", From 6c13b65a61a22a51171991553f2a1de692831157 Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 14:22:29 +0100 Subject: [PATCH 14/23] reset unnecessary changes --- .../Import/CloseImportTemplate.ipynb | 22 ------------------- ifrs17/Import/Importers.ipynb | 9 -------- 2 files changed, 31 deletions(-) diff --git a/ifrs17-template/Import/CloseImportTemplate.ipynb b/ifrs17-template/Import/CloseImportTemplate.ipynb index 34650589..ebef70cd 100644 --- a/ifrs17-template/Import/CloseImportTemplate.ipynb +++ b/ifrs17-template/Import/CloseImportTemplate.ipynb @@ -206,28 +206,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "markdown", - "source": [ - "# Start debugging" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "await Import.FromFile(\"../Files/TransactionalData/Openings_CH_2020_12.csv\")", - "\n .WithFormat(ImportFormats.Opening)", - "\n .WithTarget(DataSource)", - "\n .WithActivityLog()", - "\n .ExecuteAsync()" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "code", "source": [ diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index e0aec272..3b633323 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -1505,15 +1505,6 @@ "metadata": {}, "execution_count": 0, "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] } ] } \ No newline at end of file From bfae4b41c0843dd2214b2a164f0ac0ad4b59feb3 Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 14:25:32 +0100 Subject: [PATCH 15/23] reset --- .../Import/CloseImportTemplate.ipynb | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/ifrs17-template/Import/CloseImportTemplate.ipynb b/ifrs17-template/Import/CloseImportTemplate.ipynb index ebef70cd..9b1a2624 100644 --- a/ifrs17-template/Import/CloseImportTemplate.ipynb +++ b/ifrs17-template/Import/CloseImportTemplate.ipynb @@ -115,15 +115,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "format" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "code", "source": [ @@ -205,15 +196,6 @@ "metadata": {}, "execution_count": 0, "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] } ] } \ No newline at end of file From 12a7a9777fa7f0d5883ce48ebdf49b212f4b6cfc Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 14:28:20 +0100 Subject: [PATCH 16/23] reset --- 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 3b633323..bcbb99dc 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -1483,7 +1483,6 @@ "cell_type": "code", "source": [ "Import.DefineFormat(ImportFormats.Opening, async (options, dataSet) => {", - "\n var workspace = Workspace.CreateNew();", "\n Activity.Start();", "\n var args = await GetArgsAndCommitPartitionAsync(dataSet) with {ImportFormat = ImportFormats.Opening};", "\n if(Activity.HasErrors()) return Activity.Finish();", @@ -1491,6 +1490,7 @@ "\n if(Activity.HasErrors()) return Activity.Finish();", "\n", "\n Guid partitionId = new Guid();", + "\n var workspace = Workspace.CreateNew();", "\n var parsingLog = await ParseSimpleValueToWorkspaceAsync(dataSet, args, partitionId, workspace);", "\n if(parsingLog.Errors.Any()) return Activity.Finish().Merge(parsingLog);", "\n", From 23cc11f360eaa0c5caeb91083abc10fa4e665c57 Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 15:28:49 +0100 Subject: [PATCH 17/23] new api --- .../Test/Data/InitSystemorphToMemoryForTesting.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17-template/Test/Data/InitSystemorphToMemoryForTesting.ipynb b/ifrs17-template/Test/Data/InitSystemorphToMemoryForTesting.ipynb index 36b1ed2a..47edc4ec 100644 --- a/ifrs17-template/Test/Data/InitSystemorphToMemoryForTesting.ipynb +++ b/ifrs17-template/Test/Data/InitSystemorphToMemoryForTesting.ipynb @@ -30,7 +30,7 @@ "await Import.FromFile(\"Actuals_CH_2020_12_MTUP10pct.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(DataSource)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, From 4fd3a16d545ccd6111bbe42829148393b03aeab9 Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 15:32:12 +0100 Subject: [PATCH 18/23] new API in tests --- ifrs17-template/Test/SequenceImportTest.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ifrs17-template/Test/SequenceImportTest.ipynb b/ifrs17-template/Test/SequenceImportTest.ipynb index fec21ac1..754e3954 100644 --- a/ifrs17-template/Test/SequenceImportTest.ipynb +++ b/ifrs17-template/Test/SequenceImportTest.ipynb @@ -58,7 +58,7 @@ "await Import.FromFile(\"../Files/TransactionalData/NominalCashflows_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(ws1)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -71,7 +71,7 @@ "await Import.FromFile(\"../Files/TransactionalData/Actuals_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(ws1)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -132,7 +132,7 @@ "await Import.FromFile(\"../Files/TransactionalData/Actuals_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Actual)", "\n .WithTarget(ws2)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, @@ -145,7 +145,7 @@ "await Import.FromFile(\"../Files/TransactionalData/NominalCashflows_CH_2020_12.csv\")", "\n .WithFormat(ImportFormats.Cashflow)", "\n .WithTarget(ws2)", - "\n .WithActivityLog(Session, DataSource, DataSetReader)", + "\n .WithActivityLog()", "\n .ExecuteAsync()" ], "metadata": {}, From 098d9ddf789c856622d8a8ee5a321b41dd4144f8 Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 27 Jan 2023 19:02:27 +0100 Subject: [PATCH 19/23] identation --- ifrs17/Utils/ActivityLog.ipynb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index 5c89d920..8cec2e11 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -498,9 +498,7 @@ "\n return log;", "\n }", "\n", - "\n private async Task ReportInputAndUpdateActivityAsync(ActivityLog log, ", - "\n TOptions options, ", - "\n string categoryMessage)", + "\n private async Task ReportInputAndUpdateActivityAsync(ActivityLog log, TOptions options, string categoryMessage)", "\n where TOptions: ImportOptions", "\n where TImport: KeyedImport, new()", "\n {", From b07578f1344d79783fb650354f7033745cb7b090 Mon Sep 17 00:00:00 2001 From: akatz Date: Thu, 9 Feb 2023 16:55:00 +0100 Subject: [PATCH 20/23] syntax change --- ifrs17/Import/Importers.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17/Import/Importers.ipynb b/ifrs17/Import/Importers.ipynb index a820daea..eafdf00c 100644 --- a/ifrs17/Import/Importers.ipynb +++ b/ifrs17/Import/Importers.ipynb @@ -464,7 +464,7 @@ "\n var dataNodeSingleParametersUndefined = dataNodesImported.Where(x => x != null &&", "\n !dataNodeParametersDefined.Contains(x) && ", "\n dataNodesDefined.SingleOrDefault(y => y.SystemName == x) is GroupOfInsuranceContract).ToHashSet();", - "\n if ((dataNodeStatesUndefined?.Count ?? 0) > 0)", + "\n if ((dataNodeStatesUndefined?.Any() ?? false))", "\n await DataSource.UpdateAsync( dataNodeStatesUndefined.Select(x => ", "\n new DataNodeState {DataNode = x, ", "\n Year = args.Year, ", @@ -472,7 +472,7 @@ "\n State = State.Active, ", "\n Partition = partition.Id})", "\n .ToArray() );", - "\n if ((dataNodeSingleParametersUndefined?.Count ?? 0) > 0)", + "\n if ((dataNodeSingleParametersUndefined?.Any() ?? false))", "\n await DataSource.UpdateAsync( dataNodeSingleParametersUndefined.Select(x => ", "\n new SingleDataNodeParameter {DataNode = x, ", "\n Year = args.Year, ", From 394a489c5496316b5588cc528330a3a0d58baf3c Mon Sep 17 00:00:00 2001 From: Andrey Katz <118806207+andrey-katz-systemorph@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:41:07 +0100 Subject: [PATCH 21/23] Update ActivityLog.ipynb typo fixed --- ifrs17/Utils/ActivityLog.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index 8cec2e11..771ddfa9 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -489,7 +489,7 @@ "\n FileImportOptions fio => await ReportInputAndUpdateActivityAsync(log, fio, \"Import from File \"),", "\n StringImportOptions sgio => await ReportInputAndUpdateActivityAsync(log, sgio, \"Import from String\"),", "\n StreamImportOptions smio => await ReportInputAndUpdateActivityAsync(log, smio, \"Import from Stream\"),", - "\n DataSetImportOptions dsio => await ReportInputAndUpdateActivityAsync(log, dsio, \"Import fro Data Set\"),", + "\n DataSetImportOptions dsio => await ReportInputAndUpdateActivityAsync(log, dsio, \"Import from Data Set\"),", "\n _ => null,", "\n };", "\n if (activity is null) throw new Exception(\"Import Options object is not an instance of an appropriate class.\");", @@ -588,4 +588,4 @@ "outputs": [] } ] -} \ No newline at end of file +} From 3b0b38b87950090269d04465d2b50665a7bc6eff Mon Sep 17 00:00:00 2001 From: akatz Date: Fri, 10 Feb 2023 08:51:18 +0100 Subject: [PATCH 22/23] idents fixed --- ifrs17/Utils/ActivityLog.ipynb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index 771ddfa9..03176664 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -510,15 +510,14 @@ "\n .WithDataSetReader(ImportVariable)", "\n .WithOptions(options)", "\n .InitializeImportDataAsync() as TImport;", - "\n activity = activity with {SourceId = import.Id, ", - "\n Category = categoryMessage};", + "\n activity = activity with {SourceId = import.Id, Category = categoryMessage};", "\n await DataSource.UpdateAsync(import.RepeatOnce());", "\n }", "\n catch (Exception e)", "\n {", "\n activity = activity with {SourceId = null, ", - "\n\t\t\t\t\t\t\t\t\tCategory = categoryMessage,", - "\n ExceptionMessage = e.Message};", + "\n Category = categoryMessage, ", + "\n ExceptionMessage = e.Message};", "\n }", "\n return activity;", "\n }", @@ -588,4 +587,4 @@ "outputs": [] } ] -} +} \ No newline at end of file From f67a09254a61076285f6feac28b51aa5a5714cf5 Mon Sep 17 00:00:00 2001 From: Andrey Katz <118806207+andrey-katz-systemorph@users.noreply.github.com> Date: Fri, 10 Feb 2023 11:54:40 +0100 Subject: [PATCH 23/23] Update ActivityLog.ipynb restore the rows that were removed by mistake in the merger --- ifrs17/Utils/ActivityLog.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ifrs17/Utils/ActivityLog.ipynb b/ifrs17/Utils/ActivityLog.ipynb index 841cf70b..1342eb57 100644 --- a/ifrs17/Utils/ActivityLog.ipynb +++ b/ifrs17/Utils/ActivityLog.ipynb @@ -300,6 +300,8 @@ "\n", "\n public string Source {get; init;}", "\n", + "\n public ImportFile() : base(){;}", + "\n", "\n public ImportFile(FileImportOptions options, IDataSetImportVariable importVariable, ISessionVariable session)", "\n {", "\n Options = options;",