diff --git a/ifrs17-template/Report/InteractiveParameterReport.ipynb b/ifrs17-template/Report/InteractiveParameterReport.ipynb
new file mode 100644
index 00000000..82c1d443
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveParameterReport.ipynb
@@ -0,0 +1,106 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "SB2KH3IeJ0ayzI-af7eReA",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n
Interactive Parameter Reports
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "This notebook is the interactive version of [Parameter Reports](./ParameterReports). For demonstration purposes we import here data for some *Group of Insurance Contract* (GIC) and *Group of Reinsurance Contract* (GRIC) - the import is triggered in the [Set up data and configuration](#set-up-data-and-configuration) section.",
+ "\n
The imported data set consists of cash flows, actuals, and parameters.",
+ "\n
Input files can be found in the **File** directory. You are invited to change them or upload your own or add new data in the [CloseImportTemplate](../Import/CloseImportTemplate) notebook. ",
+ "\n",
+ "\nIn this notebook we show the parameters (provided to the calculation engine as inputs) used to performe the calculation of the reports shown in [Reports](Reports) notebook.",
+ "\n",
+ "\nSelect from the dropdown which *Report Type* you are interested in and the report adjust to the desired selection. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Set up data and configuration",
+ "\n",
+ "\nChoose to run the Reports notebook either with the set of Systemorph data in memory or with the data present in the Database: ",
+ "\n- #!eval-notebook \"../Database/Configure\" : connects to a physical Database",
+ "\n- #!eval-notebook \"../Import/CloseImportTemplate\" : uses the in-memory set up",
+ "\n",
+ "\nWe use here the in-memory set up."
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!eval-notebook \"../Import/CloseImportTemplate\"",
+ "\nWorkspace.InitializeFrom(DataSource);"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "parameterInteractive.Reset(Workspace);"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive view"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "parameterInteractive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "parameterInteractive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/Accruals.ipynb b/ifrs17-template/Report/InteractiveReports/Accruals.ipynb
new file mode 100644
index 00000000..c2b3eb39
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/Accruals.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "oKYWmrRFfU2e9YTd1Vj9iw",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Accruals
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"Accruals\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/Csm-Lc-LoReCo.ipynb b/ifrs17-template/Report/InteractiveReports/Csm-Lc-LoReCo.ipynb
new file mode 100644
index 00000000..605fccf9
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/Csm-Lc-LoReCo.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "YfxenPHy6ky0dq9nEONroA",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Contractual Service Margin / Loss Component / Loss Recovery Component
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"CsmLcLorecoReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/Deferrals.ipynb b/ifrs17-template/Report/InteractiveReports/Deferrals.ipynb
new file mode 100644
index 00000000..74ed4bbe
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/Deferrals.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "T4bL4ggXtUu8qf7OrBY7lg",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Deferrals
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"DeferralsReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/ExperienceAdjustment.ipynb b/ifrs17-template/Report/InteractiveReports/ExperienceAdjustment.ipynb
new file mode 100644
index 00000000..bca1a5d0
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/ExperienceAdjustment.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "AXPivUdMuE-lUwK-q-qUPg",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Experience Adjustment
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"ExpAdjReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/FinancialPerformance.ipynb b/ifrs17-template/Report/InteractiveReports/FinancialPerformance.ipynb
new file mode 100644
index 00000000..f6d93cd9
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/FinancialPerformance.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "AmrSZNq9YUqkLnbEjLUpkw",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Financial Performance
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"FpReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/FulfilmentCashflow.ipynb b/ifrs17-template/Report/InteractiveReports/FulfilmentCashflow.ipynb
new file mode 100644
index 00000000..e9eb2257
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/FulfilmentCashflow.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "SJ5ZNXF0EkSstU_pWIG2Kg",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Fulfilment Cash flow
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"FcfReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/LIC.ipynb b/ifrs17-template/Report/InteractiveReports/LIC.ipynb
new file mode 100644
index 00000000..e7080f53
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/LIC.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "qorXFtJ_gE2BGWjTnWDHAg",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " LIC
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"LicReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/LRC.ipynb b/ifrs17-template/Report/InteractiveReports/LRC.ipynb
new file mode 100644
index 00000000..b33382f5
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/LRC.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "e-MbqoKGUEaq_uBz7npwPQ",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " LRC
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"LrcReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/LicActuarial.ipynb b/ifrs17-template/Report/InteractiveReports/LicActuarial.ipynb
new file mode 100644
index 00000000..a7ceb1a8
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/LicActuarial.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "dVthm2DPB0qGOEC02sxPsA",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " LIC Actuarial
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"LicActualReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/LoadData.ipynb b/ifrs17-template/Report/InteractiveReports/LoadData.ipynb
new file mode 100644
index 00000000..0b97f90a
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/LoadData.ipynb
@@ -0,0 +1,65 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "HX-3ABD14UaeXjlLLekeNw",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Set up and configurations
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Choose to run the Report notebooks either with the set of Systemorph data in memory or with the data present in the Database:",
+ "\n",
+ "\n- #!eval-notebook \"../Database/Configure\" : connects to a physical Database",
+ "\n- #!eval-notebook \"../Import/CloseImportTemplate\" : uses the in-memory set up",
+ "\n",
+ "\nWe use here the in-memory set up.",
+ "\n",
+ "\nThe current notebook is used by all interactive reports and any change made here is going to affect all interactive reports.",
+ "\n"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"../../Import/CloseImportTemplate\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "Workspace.InitializeFrom(DataSource);",
+ "\nifrs17Interactive.Reset(Workspace)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/LrcActuarial.ipynb b/ifrs17-template/Report/InteractiveReports/LrcActuarial.ipynb
new file mode 100644
index 00000000..760172db
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/LrcActuarial.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "6W4aDEXW4kGr7_GR8uVx6g",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " LRC Actuarial
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"LrcActualReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/PresentValue.ipynb b/ifrs17-template/Report/InteractiveReports/PresentValue.ipynb
new file mode 100644
index 00000000..8695c9e8
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/PresentValue.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "PTEWug2t60Cim-6iwrIVGg",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Present Value of Best Estimate
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"PvReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/RiskAdjustment.ipynb b/ifrs17-template/Report/InteractiveReports/RiskAdjustment.ipynb
new file mode 100644
index 00000000..c34ad162
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/RiskAdjustment.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "BBEqtQSGT0CHl8YpJC18hw",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Risk Adjustment
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"RiskAdjReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/TechnicalMargin.ipynb b/ifrs17-template/Report/InteractiveReports/TechnicalMargin.ipynb
new file mode 100644
index 00000000..62b7e671
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/TechnicalMargin.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "c9ui1BTJv0-wnUoEiBU1pw",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Technical Margin
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"TmReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Report/InteractiveReports/WrittenActual.ipynb b/ifrs17-template/Report/InteractiveReports/WrittenActual.ipynb
new file mode 100644
index 00000000..b03d6226
--- /dev/null
+++ b/ifrs17-template/Report/InteractiveReports/WrittenActual.ipynb
@@ -0,0 +1,92 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "WzfGMeugkEGQTanwpQJcTg",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Written Actuarial
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Load Data"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"LoadData\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive report and export"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetFormsEntity()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "ifrs17Interactive.GetReport()"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Export the report to excel format using the next cell. Change the file name using the input string and disable appending UTC export time by chaging true to false. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await ifrs17Interactive.ExportToExcelAsync(\"WrittenReport\", addDateTime : true)"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Test/ReportVariablesTest.ipynb b/ifrs17-template/Test/ReportVariablesTest.ipynb
index f447c1d4..2d6351fe 100644
--- a/ifrs17-template/Test/ReportVariablesTest.ipynb
+++ b/ifrs17-template/Test/ReportVariablesTest.ipynb
@@ -91,7 +91,7 @@
{
"cell_type": "code",
"source": [
- "var reportStorage = new ReportStorage(Workspace, Report);",
+ "var reportStorage = new ReportStorage(Workspace, Report, Export);",
"\nawait reportStorage.InitializeReportIndependentCacheAsync();"
],
"metadata": {},
diff --git a/ifrs17-template/Test/Tests.ipynb b/ifrs17-template/Test/Tests.ipynb
index c70f9674..0e535198 100644
--- a/ifrs17-template/Test/Tests.ipynb
+++ b/ifrs17-template/Test/Tests.ipynb
@@ -29,7 +29,7 @@
"cell_type": "markdown",
"source": [
"Comprehensive collection of tests executed on top of the Systemorph use cases (initialization).",
- "\n
Execute this Notebook using at least 14Gb RAM."
+ "\n
Execute this Notebook using at least 18Gb RAM."
],
"metadata": {},
"execution_count": 0,
@@ -144,4 +144,4 @@
"outputs": []
}
]
-}
+}
\ No newline at end of file
diff --git a/ifrs17/CalculationEngine.ipynb b/ifrs17/CalculationEngine.ipynb
index 92b9ee6a..1a320c63 100644
--- a/ifrs17/CalculationEngine.ipynb
+++ b/ifrs17/CalculationEngine.ipynb
@@ -21,6 +21,8 @@
"source": [
"#!import \"DataModel/DataStructure\"",
"\n#!import \"Report/ReportMutableScopes\"",
+ "\n#!import \"Report/ReportMutableScopesInteractive\"",
+ "\n#!import \"Report/ParameterReportMutableScopeInteractive\"",
"\n#!import \"Import/Importers\"",
"\n#!import \"Export/ExportConfiguration\"",
"\n#!import \"Utils/TestHelper\"",
@@ -34,7 +36,34 @@
{
"cell_type": "code",
"source": [
- "var ifrs17 = new Ifrs17(Workspace, Scopes, Report);"
+ "var ifrs17 = new Ifrs17(Workspace, Scopes, Report, Export);"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "var ifrs17Interactive = new Ifrs17Interactive(Workspace, Report, Export, InteractiveObject);"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "var parameterInteractive = new InteractiveParameterReports(Workspace, Report, Export, InteractiveObject);"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ ""
],
"metadata": {},
"execution_count": 0,
diff --git a/ifrs17/Constants/Consts.ipynb b/ifrs17/Constants/Consts.ipynb
index d3077e10..42f05dcd 100644
--- a/ifrs17/Constants/Consts.ipynb
+++ b/ifrs17/Constants/Consts.ipynb
@@ -217,6 +217,28 @@
"execution_count": 0,
"outputs": []
},
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Import Types"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public static class ImportTypes{",
+ "\n public const string ExchangeRate = nameof(ExchangeRate);",
+ "\n public const string PartnerRating = nameof(PartnerRating);",
+ "\n public const string CreditDefaultRate = nameof(CreditDefaultRate);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
{
"cell_type": "markdown",
"source": [
@@ -393,6 +415,32 @@
"metadata": {},
"execution_count": 0,
"outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Parameter Reports"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public static class ParameterReportType{",
+ "\n public const string DataNodeReport = nameof(DataNodeReport);",
+ "\n public const string DataNodeStateReport = nameof(DataNodeStateReport);",
+ "\n public const string YieldCurves = nameof(YieldCurves);",
+ "\n public const string SingleDataNodeReport = nameof(SingleDataNodeReport);",
+ "\n public const string InterDataNodeParameters = nameof(InterDataNodeParameters);",
+ "\n public const string PartnerRating = nameof(PartnerRating);",
+ "\n public const string PartnerDefaultRates = nameof(PartnerDefaultRates);",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
}
]
}
\ No newline at end of file
diff --git a/ifrs17/DataModel/DataStructure.ipynb b/ifrs17/DataModel/DataStructure.ipynb
index 6c4ba188..87a2a4a0 100644
--- a/ifrs17/DataModel/DataStructure.ipynb
+++ b/ifrs17/DataModel/DataStructure.ipynb
@@ -50,22 +50,22 @@
{
"cell_type": "code",
"source": [
- "#r \"nuget:Systemorph.Activities,1.6.2\"",
- "\n#r \"nuget:Systemorph.Arithmetics,1.6.2\"",
- "\n#r \"nuget:Systemorph.Workspace,1.6.3\"",
- "\n#r \"nuget:Systemorph.InteractiveObjects,1.6.2\"",
- "\n#r \"nuget:Systemorph.SharePoint,1.6.2\"",
- "\n#r \"nuget:Systemorph.OneDrive,1.6.2\"",
- "\n#r \"nuget:Systemorph.Scopes,1.6.2\"",
- "\n#r \"nuget:Systemorph.Import,1.6.6\"",
- "\n#r \"nuget:Systemorph.Test,1.6.2\"",
- "\n#r \"nuget:Systemorph.Export,1.6.6\"",
+ "#r \"nuget:Systemorph.Activities,1.6.5\"",
+ "\n#r \"nuget:Systemorph.Arithmetics,1.6.5\"",
+ "\n#r \"nuget:Systemorph.Workspace,1.6.4\"",
+ "\n#r \"nuget:Systemorph.InteractiveObjects,1.6.5\"",
+ "\n#r \"nuget:Systemorph.SharePoint,1.6.5\"",
+ "\n#r \"nuget:Systemorph.OneDrive,1.6.5\"",
+ "\n#r \"nuget:Systemorph.Scopes,1.6.5\"",
+ "\n#r \"nuget:Systemorph.Import,1.6.7\"",
+ "\n#r \"nuget:Systemorph.Test,1.6.5\"",
+ "\n#r \"nuget:Systemorph.Export,1.6.7\"",
"\n#r \"nuget:Systemorph.DataSetReader,1.6.6\"",
- "\n#r \"nuget:Systemorph.DataSource,1.6.3\"",
- "\n#r \"nuget:Systemorph.DataSource.Conversions,1.6.3\"",
- "\n#r \"nuget:Systemorph.Reporting,1.6.2\"",
- "\n#r \"nuget:Systemorph.Charting,1.6.2\"",
- "\n#r \"nuget:Systemorph.SchemaMigrations,1.6.3\""
+ "\n#r \"nuget:Systemorph.DataSource,1.6.4\"",
+ "\n#r \"nuget:Systemorph.DataSource.Conversions,1.6.4\"",
+ "\n#r \"nuget:Systemorph.Reporting,1.6.5\"",
+ "\n#r \"nuget:Systemorph.Charting,1.6.5\"",
+ "\n#r \"nuget:Systemorph.SchemaMigrations,1.6.4\""
],
"metadata": {},
"execution_count": 0,
diff --git a/ifrs17/Report/ParameterReportMutableScopeInteractive.ipynb b/ifrs17/Report/ParameterReportMutableScopeInteractive.ipynb
new file mode 100644
index 00000000..199703ff
--- /dev/null
+++ b/ifrs17/Report/ParameterReportMutableScopeInteractive.ipynb
@@ -0,0 +1,281 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "XdWtZAfDUkKgJxSlrhCSSw",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Import References"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"ReportMutableScopesInteractive\"",
+ "\n#!import \"ParameterReportsQueries\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Parameter Forms Entity"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public interface ParameterReportFormsEntity : MutableScopeWithWorkspace",
+ "\nwhere TStorage : ReportStorage",
+ "\n{",
+ "\n [DropdownMethod(nameof(GetParameterReportTypes))]",
+ "\n string ReportType{get; set;}",
+ "\n",
+ "\n string[] GetParameterReportTypes() => typeof(ParameterReportType).GetAllPublicConstantValues();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Parameter Report Scope"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface ParameterReportScope: IMutableScope, ",
+ "\n ReportingNodeFormsEntity, ",
+ "\n MonthlyPeriodFormsEntity, ",
+ "\n ScenarioParameterFormsEntity,",
+ "\n CurrencyFormsEntity, ",
+ "\n ParameterReportFormsEntity",
+ "\n{",
+ "\n protected IPivotFactory report => GetStorage().Report;",
+ "\n protected IExportVariable export => GetStorage().Export;",
+ "\n protected int headerColumnWidthValue => 250;",
+ "\n",
+ "\n HashSet<(ReportIdentity, CurrencyType)> GetDataIdentities() => GetStorage().GetIdentities((Year, Month), ReportingNode, Scenario, CurrencyType); ",
+ "\n",
+ "\n",
+ "\n ImportArgs GetArgs() => new ImportArgs(ReportingNode, Year, Month, default, Scenario, default); ",
+ "\n",
+ "\n async Task GetDataNodeReport()",
+ "\n {",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var data = await workspace.GetDataNodeDataReportParametersAsync(GetArgs());",
+ "\n return await report.ForObjects(data)",
+ "\n .WithQuerySource(workspace)",
+ "\n .GroupRowsBy(x => x.Portfolio)",
+ "\n .GroupRowsBy(x => x.DataNode)",
+ "\n .ToTable()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n async Task GetDataNodeStatesReport()",
+ "\n {",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var data = await workspace.GetDataNodeStateReportParametersAsync(GetArgs());",
+ "\n return await report.ForObjects(data)",
+ "\n .WithQuerySource(workspace)",
+ "\n .GroupRowsBy(x => x.GroupOfContract)",
+ "\n .GroupColumnsBy(x => x.Period)",
+ "\n .ToTable()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n async Task GetYieldCurvesReport()",
+ "\n {",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var data = await workspace.GetYieldCurveReportParametersAsync(GetArgs());",
+ "\n return await report.ForObjects(data)",
+ "\n .WithQuerySource(workspace)",
+ "\n .GroupRowsBy(x => x.GroupOfContract)",
+ "\n .GroupColumnsBy(x => x.YieldCurveType)",
+ "\n .GroupColumnsBy(x => x.Period)",
+ "\n .ToTable()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n async Task GetSingleDataNodeReport()",
+ "\n {",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var data = await workspace.GetSingleDataNodeReportParametersAsync(GetArgs());",
+ "\n return await report.ForObjects(data)",
+ "\n .WithQuerySource(workspace)",
+ "\n .GroupRowsBy(x => x.GroupOfContract)",
+ "\n .GroupColumnsBy(x => x.Period)",
+ "\n .ToTable()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n async Task GetInterDataNodeParametersReport()",
+ "\n {",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var data = await workspace.GetInterDataNodeParametersAsync(GetArgs());",
+ "\n return await report.ForObjects(data)",
+ "\n .WithQuerySource(workspace)",
+ "\n .GroupRowsBy(x => x.GroupOfContract)",
+ "\n .GroupRowsBy(x => x.LinkedDataNode)",
+ "\n .GroupColumnsBy(x => x.Period)",
+ "\n .ToTable()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n async Task GetPartnerRatingReport()",
+ "\n {",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var data = await workspace.GetPartnerRatingsReportParametersAsync(GetArgs());",
+ "\n return await report.ForObjects(data)",
+ "\n .WithQuerySource(workspace)",
+ "\n .GroupRowsBy(x => x.Partner)",
+ "\n .GroupColumnsBy(x => x.Period)",
+ "\n .ToTable()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n async Task GetDefaultRatesReport()",
+ "\n {",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var data = await workspace.GetCreditDefaultRatesReportParametersAsync(GetArgs());",
+ "\n return await report.ForObjects(data)",
+ "\n .WithQuerySource(workspace)",
+ "\n .GroupRowsBy(x => x.CreditRiskRating)",
+ "\n .GroupColumnsBy(x => x.Period)",
+ "\n .ToTable()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n async Task ToReport() => ReportType switch",
+ "\n {",
+ "\n ParameterReportType.DataNodeReport => await GetDataNodeReport(), ",
+ "\n ParameterReportType.DataNodeStateReport => await GetDataNodeStatesReport(), ",
+ "\n ParameterReportType.YieldCurves => await GetYieldCurvesReport(), ",
+ "\n ParameterReportType.SingleDataNodeReport => await GetSingleDataNodeReport(), ",
+ "\n ParameterReportType.InterDataNodeParameters => await GetInterDataNodeParametersReport(), ",
+ "\n ParameterReportType.PartnerRating => await GetPartnerRatingReport(), ",
+ "\n ParameterReportType.PartnerDefaultRates => await GetDefaultRatesReport(),",
+ "\n _ => null",
+ "\n };",
+ "\n",
+ "\n void Init(){",
+ "\n var task = InitReportStorageScopeAsync();",
+ "\n task.Wait();",
+ "\n }",
+ "\n",
+ "\n async Task InitReportStorageScopeAsync() { ",
+ "\n await GetStorage().InitializeReportIndependentCacheAsync();",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Interactive Parameter "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "class InteractiveParameterReports",
+ "\n{",
+ "\n private IPivotFactory report;",
+ "\n private IExportVariable export;",
+ "\n private InteractiveObjectVariable interactiveObject;",
+ "\n public ReportStorage storage;",
+ "\n",
+ "\n private IDictionary interactiveObjectCache = new Dictionary();",
+ "\n ",
+ "\n public InteractiveParameterReports(IWorkspace workspace, ",
+ "\n IPivotFactory report, ",
+ "\n IExportVariable export, ",
+ "\n InteractiveObjectVariable interactiveObject)",
+ "\n {",
+ "\n this.report = report;",
+ "\n this.export = export;",
+ "\n this.interactiveObject = interactiveObject;",
+ "\n this.storage = new ReportStorage(workspace, report, export);",
+ "\n }",
+ "\n",
+ "\n public void Reset(IWorkspace workspace)",
+ "\n {",
+ "\n storage = new ReportStorage(workspace, report, export);",
+ "\n interactiveObjectCache = new Dictionary() {};",
+ "\n }",
+ "\n",
+ "\n public ParameterReportScope GetReportScope(string name = null) where T : ParameterReportScope => ",
+ "\n interactiveObject.State.GetScope(name ?? typeof(T).Name, o => o.WithStorage(storage));",
+ "\n",
+ "\n public InteractiveObjectView GetFormsEntity(string name = null)",
+ "\n where T : ParameterReportScope",
+ "\n {",
+ "\n var key = name ?? typeof(T).Name;",
+ "\n if (!interactiveObjectCache.TryGetValue($\"{key}FormsEntity\", out var ret))",
+ "\n ret = interactiveObjectCache[$\"{key}FormsEntity\"] = interactiveObject.CreateView($\"{key}FormsEntity\", ",
+ "\n _ => GetReportScope(name : \"ParameterReports\"));",
+ "\n return ret;",
+ "\n }",
+ "\n",
+ "\n public InteractiveObjectView GetReport(string name = null)",
+ "\n where T : ParameterReportScope",
+ "\n {",
+ "\n var key = name ?? typeof(T).Name;",
+ "\n if (!interactiveObjectCache.TryGetValue(key, out var ret))",
+ "\n ret = interactiveObjectCache[key] = interactiveObject.CreateView(key, ",
+ "\n _ => GetReportScope(name : \"ParameterReports\").ToReport());",
+ "\n return ret;",
+ "\n }",
+ "\n",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17/Report/ReportConfigurationAndUtils.ipynb b/ifrs17/Report/ReportConfigurationAndUtils.ipynb
index 5920a2cb..2a93bd7a 100644
--- a/ifrs17/Report/ReportConfigurationAndUtils.ipynb
+++ b/ifrs17/Report/ReportConfigurationAndUtils.ipynb
@@ -29,7 +29,8 @@
"cell_type": "code",
"source": [
"#!import \"../Utils/EqualityComparers\"",
- "\n#!import \"../Utils/Queries\""
+ "\n#!import \"../Utils/Queries\"",
+ "\n#!import \"../Utils/ActivityLog\""
],
"metadata": {},
"execution_count": 0,
@@ -182,6 +183,47 @@
"execution_count": 0,
"outputs": []
},
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Mutable Reporting Scopes"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public static string ParseReportingPeriodToDisplayString(int year, int periodOfYear, char separator) => $\"{year} {separator}{periodOfYear}\";"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public static string ParseDimensionToDisplayString(string systemName, string displayName) => $\"{displayName} ({systemName})\";"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public static async Task<(IDictionary, IReadOnlyCollection)> GetAutocompleteMappings (this IQuerySource querySource, bool hasNullAsFirstValue = default) where T : KeyedDimension {",
+ "\n var query = await querySource.Query().Select(x => new { x.SystemName, GuiName = ParseDimensionToDisplayString(x.SystemName, x.DisplayName), Order = 0 }).ToArrayAsync(); //TODO extentions: populate order if type T is an orderedDimension. If it is a Hierarchical dimension then the order ",
+ "\n var mappingDictionary = query.SelectMany(x => new [] { new {GuiName = x.SystemName, x.SystemName}, new {GuiName = x.GuiName, x.SystemName} }).ToDictionary(x => x.GuiName, x => x.SystemName);",
+ "\n var orderedDropDownValues = query.OrderBy(x => x.Order).ThenBy(x => x.GuiName).Select(x => x.GuiName);",
+ "\n return (mappingDictionary, (hasNullAsFirstValue ? new string[]{ null }.Concat(orderedDropDownValues) : orderedDropDownValues).ToArray());",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
{
"cell_type": "markdown",
"source": [
diff --git a/ifrs17/Report/ReportMutableScopes.ipynb b/ifrs17/Report/ReportMutableScopes.ipynb
index d77923d7..54f8d8f3 100644
--- a/ifrs17/Report/ReportMutableScopes.ipynb
+++ b/ifrs17/Report/ReportMutableScopes.ipynb
@@ -332,18 +332,23 @@
"\n{",
"\n private Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes;",
"\n private Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report;",
+ "\n private IExportVariable export;",
"\n private ReportStorage Storage;",
"\n private ReportUniverse reportUniverse;",
"\n ",
"\n //reset",
- "\n public void Reset(IWorkspace workspace) => Storage = new ReportStorage(workspace, report);",
+ "\n public void Reset(IWorkspace workspace) => Storage = new ReportStorage(workspace, report, export);",
"\n",
"\n //constructor",
- "\n public Ifrs17 (IWorkspace workspace, Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report)",
+ "\n public Ifrs17 (IWorkspace workspace, ",
+ "\n Systemorph.Vertex.Scopes.Proxy.IScopeFactory scopes, ",
+ "\n Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory report,",
+ "\n IExportVariable export)",
"\n {",
"\n this.scopes = scopes; ",
- "\n this.report = report; ",
- "\n Storage = new ReportStorage(workspace, report);",
+ "\n this.report = report;",
+ "\n this.export = export;",
+ "\n Storage = new ReportStorage(workspace, report, export);",
"\n reportUniverse = scopes.ForSingleton().WithStorage(Storage).ToScope();",
"\n }",
"\n",
diff --git a/ifrs17/Report/ReportMutableScopesInteractive.ipynb b/ifrs17/Report/ReportMutableScopesInteractive.ipynb
new file mode 100644
index 00000000..26fb0f69
--- /dev/null
+++ b/ifrs17/Report/ReportMutableScopesInteractive.ipynb
@@ -0,0 +1,1104 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "SuppWclYnkyuC51Dlg-6Rg",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ "",
+ "\n Report Mutable Scopes
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "This notebook contains the set up of mutable scopes used to achieve high interactivity with reports."
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# References",
+ "\nLibraries and other notebooks which are needed for this notebook are imported below."
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"ReportScopes\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "using Systemorph.Vertex.Pivot.Builder.Interfaces;",
+ "\nusing Systemorph.InteractiveObjects;",
+ "\nusing Systemorph.Vertex.Session;",
+ "\nusing Systemorph.Vertex.Export;",
+ "\nusing Systemorph.Vertex.Export.Factory;",
+ "\nusing Systemorph.Vertex.InteractiveObjects;"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Form Entity Scopes"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Helper Scopes"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public interface MutableScopeWithWorkspace : IMutableScopeWithStorage ",
+ "\nwhere TStorage : ReportStorage",
+ "\n{",
+ "\n protected IWorkspace workspace => GetStorage().Workspace; ",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Currency Type"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public interface CurrencyFormsEntity : IMutableScope {",
+ "\n [DropdownEnum(typeof(CurrencyType))]",
+ "\n CurrencyType CurrencyType { get; set; } ",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Scenario"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public interface ScenarioFormsEntity : MutableScopeWithWorkspace ",
+ "\nwhere TStorage : ReportStorage ",
+ "\n{",
+ "\n [DropdownMethod(nameof(GetScenarioAutocompleteAsync))]",
+ "\n [Display(Name = \"Scenario\")]",
+ "\n string ScenarioControl { get; set; }",
+ "\n",
+ "\n [NotVisible] IDictionary ScenarioMapping { get; set; }",
+ "\n protected string Scenario => !string.IsNullOrWhiteSpace(ScenarioControl) && ",
+ "\n ScenarioMapping is not null && ",
+ "\n ScenarioMapping.TryGetValue(ScenarioControl, out var value) ",
+ "\n ? value ",
+ "\n : null;",
+ "\n ",
+ "\n async Task> GetScenarioAutocompleteAsync(string userInput, int page, int pageSize) {",
+ "\n (ScenarioMapping, var orderedDropDownValues) = await workspace.GetAutocompleteMappings(true);",
+ "\n ScenarioMapping[Scenarios.Delta] = Scenarios.Delta; //TODO this behavior needs to be updated. PR#217",
+ "\n ScenarioMapping[Scenarios.All] = Scenarios.All;",
+ "\n return orderedDropDownValues.Concat(new string[] {Scenarios.Delta, Scenarios.All})",
+ "\n .Where(x => userInput == null || x.Contains(userInput, StringComparison.OrdinalIgnoreCase))",
+ "\n .ToArray(); ",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public interface ScenarioParameterFormsEntity : ScenarioFormsEntity",
+ "\nwhere TStorage : ReportStorage ",
+ "\n{",
+ "\n async Task> GetScenarioAutocompleteAsync(string userInput, int page, int pageSize) {",
+ "\n (ScenarioMapping, var orderedDropDownValues) = await workspace.GetAutocompleteMappings(true);",
+ "\n return orderedDropDownValues.Where(x => userInput == null || x.Contains(userInput, StringComparison.OrdinalIgnoreCase))",
+ "\n .ToArray(); ",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Reporting Node"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(InitReportingNode))]",
+ "\npublic interface ReportingNodeFormsEntity : MutableScopeWithWorkspace ",
+ "\nwhere TStorage : ReportStorage",
+ "\n{",
+ "\n [DropdownMethod(nameof(GetReportingNodeAutocompleteAsync))]",
+ "\n [Display(Name = \"ReportingNode\")]",
+ "\n string ReportingNodeControl { get; set; }",
+ "\n",
+ "\n [NotVisible] IDictionary ReportingNodeMapping { get; set; }",
+ "\n protected string ReportingNode => !string.IsNullOrWhiteSpace(ReportingNodeControl) && ",
+ "\n ReportingNodeMapping is not null && ",
+ "\n ReportingNodeMapping.TryGetValue(ReportingNodeControl, out var value)",
+ "\n ? value",
+ "\n : GetStorage().InitialReportingNode.SystemName; // Maybe these cases can be more specific",
+ "\n",
+ "\n async Task> GetReportingNodeAutocompleteAsync(string userInput, int page, int pageSize) {",
+ "\n (ReportingNodeMapping, var orderedDropDownValues) = await workspace.GetAutocompleteMappings();",
+ "\n return orderedDropDownValues.Where(x => userInput == null || x.Contains(userInput, StringComparison.OrdinalIgnoreCase)).ToArray(); ",
+ "\n }",
+ "\n",
+ "\n void InitReportingNode() {",
+ "\n ReportingNodeControl = ParseDimensionToDisplayString(GetStorage().InitialReportingNode.SystemName, GetStorage().InitialReportingNode.DisplayName);",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Reporting Period"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### Monthly Period"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(InitReportingPeriod))]",
+ "\npublic interface MonthlyPeriodFormsEntity : MutableScopeWithWorkspace ",
+ "\nwhere TStorage : ReportStorage",
+ "\n{",
+ "\n [DropdownMethod(nameof(GetReportingPeriodAutocompleteAsync))]",
+ "\n string ReportingPeriod { get; set; }",
+ "\n",
+ "\n private char separator => 'M';",
+ "\n private string[] ReportingPeriodSplit => ReportingPeriod.Split(separator);",
+ "\n private int ParseReportingPeriod(int index) => !string.IsNullOrWhiteSpace(ReportingPeriod) && ReportingPeriodSplit is not null && Int32.TryParse(ReportingPeriodSplit.ElementAtOrDefault(index), out int value)",
+ "\n ? value",
+ "\n : default;",
+ "\n",
+ "\n protected int Year => ParseReportingPeriod(0);",
+ "\n protected int Month => ParseReportingPeriod(1);",
+ "\n",
+ "\n async Task> GetReportingPeriodAutocompleteAsync(string userInput, int page, int pageSize) => ",
+ "\n await workspace.Query()",
+ "\n .Where(x => x.Scenario == null)",
+ "\n .OrderByDescending(x => x.Year)",
+ "\n .ThenByDescending(x => x.Month)",
+ "\n .Select(x => ParseReportingPeriodToDisplayString(x.Year, x.Month, separator))",
+ "\n .Where(x => userInput == null || x.Contains(userInput, StringComparison.OrdinalIgnoreCase))",
+ "\n .ToArrayAsync();",
+ "\n",
+ "\n void InitReportingPeriod() {",
+ "\n ReportingPeriod = ParseReportingPeriodToDisplayString(GetStorage().InitialReportingPeriod.Year, GetStorage().InitialReportingPeriod.Month, separator);",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Filters"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(InitFilters))]",
+ "\npublic interface BasicFilterFormsEntity : MutableScopeWithWorkspace",
+ "\nwhere TStorage : ReportStorage",
+ "\n{",
+ "\n [DropdownMethod(nameof(GetFilterName))]",
+ "\n string FilterName { get; set; }",
+ "\n",
+ "\n [DropdownMethod(nameof(GetBasicFilterAsync))]",
+ "\n [Display(Name = \"Filter Value\")]",
+ "\n string FilterValueControl { get; set; }",
+ "\n",
+ "\n [DropdownValues(\"\", \"Add\", \"Remove\")]",
+ "\n string FilterAction { get; set; }",
+ "\n",
+ "\n protected string[] defaultFilters => new string[] {",
+ "\n \"\",",
+ "\n nameof(ReportVariable.GroupOfContract),",
+ "\n nameof(ReportVariable.Portfolio),",
+ "\n nameof(ReportVariable.LineOfBusiness),",
+ "\n //nameof(ReportVariable.AnnualCohort),",
+ "\n nameof(ReportVariable.LiabilityType),",
+ "\n nameof(ReportVariable.ValuationApproach),",
+ "\n nameof(ReportVariable.OciType),",
+ "\n nameof(ReportVariable.InitialProfitability), //(\\\"Profitability\\\")",
+ "\n };",
+ "\n",
+ "\n [NotVisible] IReadOnlyCollection specificFilters { get; set; }",
+ "\n IReadOnlyCollection GetFilterName() => defaultFilters.Union(specificFilters).ToArray();",
+ "\n",
+ "\n [NotVisible] IDictionary> FilterMapping { get; set; }",
+ "\n protected string FilterValue => !string.IsNullOrWhiteSpace(FilterName) && !string.IsNullOrWhiteSpace(FilterValueControl) && ",
+ "\n FilterMapping is not null && FilterMapping.TryGetValue(FilterName, out var inner) &&",
+ "\n inner.TryGetValue(FilterValueControl, out var value)",
+ "\n ? value",
+ "\n : null;",
+ "\n",
+ "\n async Task> GetFilterAutocompleteAsync() where T : KeyedDimension {",
+ "\n (var filterMapping, var orderedDropDownValues) = await workspace.GetAutocompleteMappings();",
+ "\n FilterMapping[typeof(T).Name] = filterMapping;",
+ "\n return orderedDropDownValues;",
+ "\n }",
+ "\n",
+ "\n async Task> GetBasicFilterAsync(string userInput, int page, int pageSize) =>",
+ "\n new string[]{ null }.Concat(",
+ "\n (FilterName switch",
+ "\n {",
+ "\n //GetAutocompleteMappings",
+ "\n nameof(ReportVariable.Portfolio) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.GroupOfContract) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.LineOfBusiness) => await GetFilterAutocompleteAsync(),",
+ "\n //nameof(ReportVariable.AnnualCohort) => //TODO the filter is not applied because the prop is an Int",
+ "\n nameof(ReportVariable.LiabilityType) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.ValuationApproach) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.OciType) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.InitialProfitability) => await GetFilterAutocompleteAsync(),",
+ "\n",
+ "\n nameof(ReportVariable.Novelty) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.VariableType) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.EconomicBasis) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.AmountType) => await GetFilterAutocompleteAsync(),",
+ "\n nameof(ReportVariable.EstimateType) => await GetFilterAutocompleteAsync(),",
+ "\n _ => Enumerable.Empty().ToArray()",
+ "\n }).Where(x => userInput == null || x.Contains(userInput, StringComparison.OrdinalIgnoreCase)).OrderBy(x => x)).ToArray();",
+ "\n ",
+ "\n [NotVisible] IReadOnlyCollection<(string filterName, string filterValue)> InputDataFilter { get; set; }",
+ "\n ",
+ "\n protected (string fileName, object filterValue)[] dataFilter => InputDataFilter.Select(x => (x.filterName, (object)x.filterValue)).ToArray(); //TODO this cast is needed by the Filter func",
+ "\n",
+ "\n IReadOnlyCollection<(string filterName, string filterValue)> GetFilters()",
+ "\n {",
+ "\n if(FilterAction == \"Add\")",
+ "\n AddFilter(FilterName, FilterValue);",
+ "\n if(FilterAction == \"Remove\")",
+ "\n RemoveFilter(FilterName, FilterValue);",
+ "\n return InputDataFilter;",
+ "\n }",
+ "\n",
+ "\n private void AddFilter(string filterName, string filterValue)",
+ "\n {",
+ "\n if(!InputDataFilter.Contains((filterName, filterValue)))",
+ "\n InputDataFilter = InputDataFilter.Append((filterName, filterValue)).ToArray();",
+ "\n }",
+ "\n ",
+ "\n private void RemoveFilter(string filterName, string filterValue)",
+ "\n {",
+ "\n if(InputDataFilter.Contains((filterName, filterValue)))",
+ "\n { var f = InputDataFilter.ToList();",
+ "\n f.Remove((filterName, filterValue));",
+ "\n InputDataFilter = f.ToArray();",
+ "\n }",
+ "\n }",
+ "\n",
+ "\n void InitFilters() {",
+ "\n FilterMapping = new Dictionary>() ;",
+ "\n InputDataFilter = Enumerable.Empty<(string, string)>().ToArray();",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Slice and Dice"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public interface BasicSliceAndDiceRowsFormsEntity : MutableScopeWithWorkspace ",
+ "\nwhere TStorage : ReportStorage",
+ "\n{",
+ "\n [NotVisible] string SliceRowName { get; set; }",
+ "\n",
+ "\n protected IReadOnlyCollection InputRowSlices => (SliceRowName is null ? Enumerable.Empty() : SliceRowName.RepeatOnce()).ToArray();",
+ "\n [NotVisible] IReadOnlyCollection defaultRowSlices { get; set; }",
+ "\n protected string[] rowSlices => defaultRowSlices.Union(InputRowSlices).ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public interface BasicSliceAndDiceColumnsFormsEntity : MutableScopeWithWorkspace ",
+ "\nwhere TStorage : ReportStorage",
+ "\n{",
+ "\n [DropdownMethod(nameof(GetSliceColumnNameAutocomplete))]",
+ "\n string SliceColumnName { get; set; }",
+ "\n",
+ "\n protected IReadOnlyCollection InputColumnSlices => (SliceColumnName is null ? Enumerable.Empty() : SliceColumnName.RepeatOnce()).ToArray();",
+ "\n [NotVisible] IReadOnlyCollection defaultColumnSlices { get; set; }",
+ "\n protected string[] columnSlices => defaultColumnSlices.Union(InputColumnSlices).ToArray();",
+ "\n",
+ "\n IReadOnlyCollection GetSliceColumnNameAutocomplete() => new [] {\"\", ",
+ "\n nameof(ReportVariable.ReportingNode), ",
+ "\n nameof(ReportVariable.Scenario),",
+ "\n nameof(ReportVariable.Portfolio), ",
+ "\n nameof(ReportVariable.GroupOfContract), ",
+ "\n nameof(ReportVariable.LineOfBusiness),",
+ "\n nameof(ReportVariable.LiabilityType),",
+ "\n nameof(ReportVariable.InitialProfitability),",
+ "\n nameof(ReportVariable.ValuationApproach),",
+ "\n nameof(ReportVariable.AnnualCohort),",
+ "\n nameof(ReportVariable.OciType),",
+ "\n nameof(ReportVariable.IsReinsurance),",
+ "\n nameof(ReportVariable.AccidentYear),",
+ "\n ",
+ "\n nameof(ReportVariable.AmountType),",
+ "\n nameof(ReportVariable.EstimateType),",
+ "\n nameof(ReportVariable.EconomicBasis)};",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Generic Report Scope and Data Scope"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "public interface Data : IMutableScope<((int year, int month) reportingPeriod, string reportingNode, string scenario, CurrencyType currencyType, (string filterName, object filterValue)[] dataFilter)> {",
+ "\n IDataCube InputDataCube { get; set; }",
+ "\n IDataCube DataCube { get {",
+ "\n if(InputDataCube is null) return Enumerable.Empty().ToDataCube();",
+ "\n var filteredDataCube = (Identity.dataFilter is null || Identity.dataFilter.Length == 0) ",
+ "\n ? InputDataCube ",
+ "\n : InputDataCube.Filter(Identity.dataFilter); ",
+ "\n switch (Identity.scenario)",
+ "\n {",
+ "\n case null : return filteredDataCube.Where(x => x.Scenario == null).ToDataCube();",
+ "\n case Scenarios.All : return filteredDataCube.Select(x => x.Scenario == null ? x with {Scenario = Scenarios.Default } : x).ToDataCube();",
+ "\n case Scenarios.Delta : ",
+ "\n var bestEstimateById = filteredDataCube.Where(x => x.Scenario == null).ToDictionary(x => x.ToIdentityString());",
+ "\n return filteredDataCube.Select(x => x.Scenario == null ",
+ "\n ? x with { Scenario = Scenarios.Default } ",
+ "\n : x with { Value = x.Value - (bestEstimateById.TryGetValue((x with {Scenario = null}).ToIdentityString(), out var be)? be.Value : 0.0) }).ToDataCube(); ",
+ "\n default : return filteredDataCube.Filter((nameof(ReportVariable.Scenario), Identity.scenario));",
+ "\n }",
+ "\n }}",
+ "\n} "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface ReportScope : IMutableScope, ",
+ "\n ReportingNodeFormsEntity, ",
+ "\n MonthlyPeriodFormsEntity, ",
+ "\n ScenarioFormsEntity, ",
+ "\n CurrencyFormsEntity, ",
+ "\n BasicSliceAndDiceRowsFormsEntity, ",
+ "\n BasicSliceAndDiceColumnsFormsEntity, ",
+ "\n BasicFilterFormsEntity {",
+ "\n protected IPivotFactory report => GetStorage().Report;",
+ "\n protected IExportVariable export => GetStorage().Export;",
+ "\n protected int headerColumnWidthValue => 250;",
+ "\n",
+ "\n HashSet<(ReportIdentity, CurrencyType)> GetDataIdentities() => GetStorage().GetIdentities((Year, Month), ReportingNode, Scenario, CurrencyType); // TODO, add filter for identities, if the property is exposed at this level",
+ "\n",
+ "\n IDataCube GetData() => default;",
+ "\n",
+ "\n async Task ToReportAsync() {",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var dataScope = GetScope(((Year, Month), ReportingNode, Scenario, CurrencyType, dataFilter));",
+ "\n var dataCube = GetData();",
+ "\n // This is a temporary solution to avoid an error from the empty report",
+ "\n // Remove when the issue is solved on the platform - A.K.",
+ "\n if (!dataCube.ToArray().Any()) return null;",
+ "\n dataScope.InputDataCube = dataCube;",
+ "\n return await GetReportTaskAsync(dataScope.DataCube);",
+ "\n }",
+ "\n",
+ "\n // Using this routine is highly discouraged due to the mutlithreading issue -A.K.",
+ "\n // Avoid using these methods if working with the DB -- it will trigger synchronization error in access to the DB",
+ "\n async Task ToCsvAsync(string fileName){",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var dataScope = GetScope(((Year, Month), ReportingNode, Scenario, CurrencyType, dataFilter));",
+ "\n dataScope.InputDataCube = GetData();",
+ "\n return await export.ToCsv(fileName)",
+ "\n .ForDataCube(dataScope.DataCube, config => config.WithQuerySource(workspace)",
+ "\n .SliceRowsBy(rowSlices)",
+ "\n .SliceColumnsBy(columnSlices))",
+ "\n .WithActivityLog()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n async Task ToExcelAsync(string fileName){",
+ "\n await GetStorage().InitializeAsync((Year, Month), ReportingNode, Scenario, CurrencyType);",
+ "\n var dataScope = GetScope(((Year, Month), ReportingNode, Scenario, CurrencyType, dataFilter));",
+ "\n dataScope.InputDataCube = GetData();",
+ "\n return await export.ToExcel(fileName)",
+ "\n .ForDataCube(dataScope.DataCube, config => config.WithQuerySource(workspace) ",
+ "\n .SliceRowsBy(rowSlices)",
+ "\n .SliceColumnsBy(columnSlices))",
+ "\n .WithActivityLog()",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n ",
+ "\n async Task GetReportTaskAsync(IDataCube data) {",
+ "\n return await report.ForDataCube(data)",
+ "\n .WithQuerySource(workspace)",
+ "\n .SliceRowsBy(rowSlices)",
+ "\n .SliceColumnsBy(columnSlices)",
+ "\n .ReportGridOptions(headerColumnWidth: headerColumnWidthValue)",
+ "\n .ExecuteAsync();",
+ "\n }",
+ "\n",
+ "\n void Init(){",
+ "\n var task = InitReportStorageScopeAsync();",
+ "\n task.Wait();",
+ "\n }",
+ "\n",
+ "\n async Task InitReportStorageScopeAsync() { // This has the Async issue, but imo it should come in the future",
+ "\n await GetStorage().InitializeReportIndependentCacheAsync();",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Report Scopes"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Best Estimate PV"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface PvReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().LockedBestEstimate + GetScopes(GetDataIdentities()).Aggregate().CurrentBestEstimate;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.Novelty), nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.EconomicBasis) };",
+ "\n // SpecificFiltersFormEntity",
+ "\n specificFilters = new string[] {nameof(ReportVariable.AmountType)};",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Risk Adjustment PV"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface RaReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().LockedRiskAdjustment + GetScopes(GetDataIdentities()).Aggregate().CurrentRiskAdjustment;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.Novelty), nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.EconomicBasis) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## FCF PV"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface FcfReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().Fcf;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.Novelty), nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.EconomicBasis) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Written"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface WrittenReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().Written;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.AmountType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Accruals"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface AccrualReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().Advance + GetScopes(GetDataIdentities()).Aggregate().Overdue;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency) };",
+ "\n // SpecificFiltersFormEntity",
+ "\n specificFilters = new string[] {nameof(ReportVariable.AmountType)};",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Deferrals"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface DeferralReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().Deferrals;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Experience Adjustment"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface ExpAdjReport: ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().ActuarialExperienceAdjustment;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.EstimateType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.AmountType) };",
+ "\n // SpecificFiltersFormEntity",
+ "\n specificFilters = new string[] {nameof(ReportVariable.AmountType)};",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Technical Margin"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface TmReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().LrcTechnicalMargin;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.Novelty), nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## CSM"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface CsmReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().Csm + GetScopes(GetDataIdentities()).Aggregate().Lc + GetScopes(GetDataIdentities()).Aggregate().Loreco;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.Novelty), nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.EstimateType) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## LRC"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface ActLrcReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().LrcActuarial;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.Novelty), nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.EstimateType) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface LrcReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() =>GetScopes(GetDataIdentities()).Aggregate().Lrc;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.EstimateType) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## LIC"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface ActLicReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().LicActuarial;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.Novelty), nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.EstimateType) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface LicReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().Lic;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.VariableType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency), nameof(ReportVariable.EstimateType) };",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Financial Performance"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[InitializeScope(nameof(Init))]",
+ "\npublic interface FpReport : ReportScope {",
+ "\n ",
+ "\n IDataCube ReportScope.GetData() => GetScopes(GetDataIdentities()).Aggregate().FinancialPerformance;",
+ "\n",
+ "\n void Init() {",
+ "\n // BasicSliceAndDiceFormsEntity",
+ "\n defaultRowSlices = new string[] { nameof(ReportVariable.VariableType), nameof(ReportVariable.EstimateType) };",
+ "\n defaultColumnSlices = new string[] { nameof(ReportVariable.Currency)};",
+ "\n }",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# IFRS 17 Interactive "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "This class is used to trigger the calculation of the reports and it is exposed to the end-user in the reports."
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "using Systemorph.Vertex.Pivot.Builder.Interfaces;",
+ "\nusing Systemorph.InteractiveObjects;",
+ "\nusing Systemorph.Vertex.Session;",
+ "\npublic class Ifrs17Interactive {",
+ "\n private IPivotFactory report;",
+ "\n private IExportVariable export;",
+ "\n private InteractiveObjectVariable interactiveObject;",
+ "\n private ReportStorage storage;",
+ "\n",
+ "\n private IDictionary interactiveObjectCache = new Dictionary();",
+ "\n",
+ "\n public Ifrs17Interactive (IWorkspace workspace, ",
+ "\n IPivotFactory report, ",
+ "\n IExportVariable export,",
+ "\n InteractiveObjectVariable interactiveObject)",
+ "\n {",
+ "\n this.report = report;",
+ "\n this.export = export;",
+ "\n this.interactiveObject = interactiveObject;",
+ "\n storage = new ReportStorage(workspace, report, export);",
+ "\n }",
+ "\n",
+ "\n public void Reset(IWorkspace workspace) {",
+ "\n storage = new ReportStorage(workspace, report, export);",
+ "\n interactiveObjectCache = new Dictionary();",
+ "\n }",
+ "\n",
+ "\n public InteractiveObjectView GetFormsEntity(string name = null) where T : ReportScope {",
+ "\n var key = name ?? typeof(T).Name;",
+ "\n if(!interactiveObjectCache.TryGetValue($\"{key}FormsEntity\", out var ret))",
+ "\n ret = interactiveObjectCache[$\"{key}FormsEntity\"] = interactiveObject.CreateView($\"{key}FormsEntity\", _ => GetReportScope(key));",
+ "\n return ret;",
+ "\n }",
+ "\n",
+ "\n public InteractiveObjectView GetReport(string name = null) where T : ReportScope {",
+ "\n var key = name ?? typeof(T).Name;",
+ "\n if(!interactiveObjectCache.TryGetValue(key, out var ret)){",
+ "\n ret = interactiveObjectCache[key] = interactiveObject.CreateView(key,",
+ "\n _ => {",
+ "\n var scope = GetReportScope(key);",
+ "\n var filters = scope.GetFilters(); // Not used and should be improved",
+ "\n return scope.ToReportAsync(); ",
+ "\n }); ",
+ "\n }",
+ "\n return ret;",
+ "\n }",
+ "\n",
+ "\n public async Task ExportToCsvAsync(string fileName, bool addDateTime = false)",
+ "\n where T : ReportScope",
+ "\n {",
+ "\n var fullFileName = addDateTime ? AttachDateTime(fileName) : fileName; ",
+ "\n var scope = GetReportScope();",
+ "\n var _ = scope.GetFilters();",
+ "\n return await scope.ToCsvAsync(fullFileName);",
+ "\n } ",
+ "\n",
+ "\n",
+ "\n public async Task ExportToExcelAsync(string fileName, bool addDateTime = false)",
+ "\n where T : ReportScope",
+ "\n {",
+ "\n var fullFileName = addDateTime ? AttachDateTime(fileName) : fileName;",
+ "\n var scope = GetReportScope();",
+ "\n var _ = scope.GetFilters();",
+ "\n return await scope.ToExcelAsync(fullFileName);",
+ "\n }",
+ "\n",
+ "\n private string ToTwoDigitString(int number ) => number.ToString().Length == 1 ? \"0\" + number.ToString() : number.ToString();",
+ "\n",
+ "\n private string AttachDateTime(string fileName)",
+ "\n {",
+ "\n DateTime creationTime = DateTime.UtcNow;",
+ "\n return fileName + \"_\" + creationTime.Year.ToString() + ToTwoDigitString(creationTime.Month) + ToTwoDigitString(creationTime.Day) +",
+ "\n ToTwoDigitString(creationTime.Hour) + ToTwoDigitString(creationTime.Minute) + ToTwoDigitString(creationTime.Second);",
+ "\n }",
+ "\n",
+ "\n // This routine is still buggy, triggering an infinite loop. -- A.K.",
+ "\n // public InteractiveObjectView ToExcelInteractive(string fileName, bool addDateTime = false, string name = null)",
+ "\n // where T : ReportScope",
+ "\n // {",
+ "\n // var key = name ?? typeof(T).Name;",
+ "\n // var fullFileName = addDateTime ? AttachDateTime(fileName) : fileName; ",
+ "\n // if (!interactiveObjectCache.TryGetValue($\"{key}.xlsx\", out var ret))",
+ "\n // ret = interactiveObjectCache[$\"{key}.xlsx\"] = interactiveObject.CreateView($\"{key}.xlsx\", _ => ",
+ "\n // {",
+ "\n // var scope = GetReportScope();",
+ "\n // var filters = scope.GetFilters();",
+ "\n // return scope.ToExcelAsync(fullFileName);",
+ "\n // });",
+ "\n // return ret;",
+ "\n // }",
+ "\n ",
+ "\n ",
+ "\n public ReportScope GetReportScope(string name = null) where T : ReportScope => interactiveObject.State.GetScope(name ?? typeof(T).Name, o => o.WithStorage(storage));",
+ "\n",
+ "\n // Keeping the old API",
+ "\n public ReportScope PresentValues => GetReportScope();",
+ "\n public ReportScope RiskAdjustments => GetReportScope();",
+ "\n public ReportScope FulfillmentCashflows => GetReportScope();",
+ "\n public ReportScope WrittenActuals => GetReportScope();",
+ "\n public ReportScope AccrualActuals => GetReportScope();",
+ "\n public ReportScope DeferralActuals => GetReportScope();",
+ "\n public ReportScope ExperienceAdjustments => GetReportScope();",
+ "\n public ReportScope TechnicalMargins => GetReportScope();",
+ "\n public ReportScope AllocatedTechnicalMargins => GetReportScope();",
+ "\n public ReportScope ActuarialLrc => GetReportScope();",
+ "\n public ReportScope Lrc => GetReportScope();",
+ "\n public ReportScope ActuarialLic => GetReportScope();",
+ "\n public ReportScope Lic => GetReportScope();",
+ "\n public ReportScope FinancialPerformance => GetReportScope(); ",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17/Report/ReportScopes.ipynb b/ifrs17/Report/ReportScopes.ipynb
index af7efdf7..525773c1 100644
--- a/ifrs17/Report/ReportScopes.ipynb
+++ b/ifrs17/Report/ReportScopes.ipynb
@@ -212,6 +212,37 @@
"execution_count": 0,
"outputs": []
},
+ {
+ "cell_type": "markdown",
+ "source": [
+ "### Retrieve constant elements from a class"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "using System.Reflection;",
+ "\npublic static T[] GetAllPublicConstantValues(this Type type, ",
+ "\n IList excludedTerms = null)",
+ "\n{",
+ "\n var selection = type",
+ "\n .GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)",
+ "\n .Where(fi => fi.IsLiteral && !fi.IsInitOnly && fi.FieldType == typeof(T))",
+ "\n .Select(x => (T)x.GetRawConstantValue())",
+ "\n .ToArray();",
+ "\n if (excludedTerms == null)",
+ "\n return selection;",
+ "\n else ",
+ "\n return selection.Where(x => !excludedTerms.Contains(x)).ToArray();",
+ "\n}"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
{
"cell_type": "markdown",
"source": [
diff --git a/ifrs17/Report/ReportStorage.ipynb b/ifrs17/Report/ReportStorage.ipynb
index 7b381acd..3af872a6 100644
--- a/ifrs17/Report/ReportStorage.ipynb
+++ b/ifrs17/Report/ReportStorage.ipynb
@@ -105,14 +105,20 @@
{
"cell_type": "code",
"source": [
- "public class ReportStorage {",
+ "using Systemorph.Vertex.Export.Factory;",
+ "\npublic class ReportStorage {",
"\n protected readonly IWorkspace workspace;",
+ "\n protected readonly IExportVariable export;",
"\n private readonly Systemorph.Vertex.Hierarchies.IHierarchicalDimensionCache hierarchicalDimensionCache;",
"\n private readonly Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory reportFactory;",
"\n ",
"\n // Current Storage Settings",
"\n public ((int Year, int Month) Period, string ReportingNode, string Scenario, CurrencyType CurrencyType) Args {get; private set;}",
"\n ",
+ "\n // Initial Values for Scopes DropDowns",
+ "\n public (string DisplayName, string SystemName) InitialReportingNode {get; private set;}",
+ "\n public (int Year, int Month) InitialReportingPeriod {get; private set;}",
+ "\n",
"\n // Aux Data",
"\n private Dictionary<(int year, int month), Dictionary>> exchangeRatesByCurrencyByFxTypeAndPeriod = new(); // Fx Rates",
"\n private Dictionary<(int year, int month), Dictionary> fxPeriodsByAocStepAndPeriod = new(); // FxParameter",
@@ -125,10 +131,13 @@
"\n private Dictionary<((int year, int month) period, string reportingNode, string scenario), Dictionary>>> variablesDictionary = new();",
"\n ",
"\n // Constructor",
- "\n public ReportStorage(IWorkspace workspace, Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory reportFactory) {",
+ "\n public ReportStorage(IWorkspace workspace, ",
+ "\n Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory reportFactory, ",
+ "\n IExportVariable export) {",
"\n this.workspace = workspace;",
"\n this.hierarchicalDimensionCache = workspace.ToHierarchicalDimensionCache();",
"\n this.reportFactory = reportFactory;",
+ "\n this.export = export;",
"\n }",
"\n ",
"\n // Initializers",
@@ -138,6 +147,12 @@
"\n await hierarchicalDimensionCache.InitializeAsync(); ",
"\n await hierarchicalDimensionCache.InitializeAsync();",
"\n await hierarchicalDimensionCache.InitializeAsync();",
+ "\n",
+ "\n // Initial Values",
+ "\n var mostRecentPartition = (await workspace.Query().Where(x => x.Scenario == null).OrderBy(x => x.Year).ThenBy(x => x.Month).ToArrayAsync()).LastOrDefault();",
+ "\n InitialReportingPeriod = (mostRecentPartition.Year, mostRecentPartition.Month);",
+ "\n var rootReportingNode = (await workspace.Query().Where(x => x.Parent == null).ToArrayAsync()).FirstOrDefault();",
+ "\n InitialReportingNode = (rootReportingNode.DisplayName, rootReportingNode.SystemName);",
"\n }",
"\n ",
"\n public async Task InitializeAsync((int year, int month) period, string reportingNode, string scenario, CurrencyType currencyType) {",
@@ -201,6 +216,7 @@
"\n // Other getters",
"\n public IWorkspace Workspace => workspace;",
"\n public Systemorph.Vertex.Pivot.Builder.Interfaces.IPivotFactory Report => reportFactory;",
+ "\n public IExportVariable Export => export;",
"\n",
"\n public Systemorph.Vertex.Hierarchies.IHierarchy GetHierarchy() where T : class, IHierarchicalDimension => hierarchicalDimensionCache.Get();",
"\n ",
diff --git a/ifrs17/Test/ReportStorageTest.ipynb b/ifrs17/Test/ReportStorageTest.ipynb
index c27442c0..8d2c9414 100644
--- a/ifrs17/Test/ReportStorageTest.ipynb
+++ b/ifrs17/Test/ReportStorageTest.ipynb
@@ -72,7 +72,7 @@
"\n ",
"\n //Create report storage",
"\n var period = (year, month);",
- "\n var reportStorage = new ReportStorage(Workspace, Report);",
+ "\n var reportStorage = new ReportStorage(Workspace, Report, Export);",
"\n await reportStorage.InitializeReportIndependentCacheAsync();",
"\n await reportStorage.InitializeAsync(period, \"G\", null, CurrencyType.Contractual);",
"\n ",