Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 206 additions & 0 deletions Export/Export.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
{
"metadata": {
"authors": [],
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
"name": "C#"
},
"language_info": {
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
},
"toc-autonumbering": "True",
"toc-showcode": "False"
},
"nbformat": 4,
"nbformat_minor": 5,
"cells": [
{
"cell_type": "code",
"source": [
"#!import \"../DataModel/DataStructure\""
]
},
{
"cell_type": "markdown",
"source": [
"# Main Tab"
]
},
{
"cell_type": "code",
"source": [
"public static IDocumentBuilder MainTabConfigurationWoScenario<T>(this IDocumentBuilder builder, T args) where T : IfrsPartition",
"\n => builder.WithTable<T>( config => config .AtBeginning() ",
"\n .WithName(Main) ",
"\n .WithSource(source => args.RepeatOnce().AsQueryable()) ",
"\n .WithColumn(x => x.Id, x => x.Delete())",
"\n .WithColumn(x => x.Scenario, x => x.Delete()));"
]
},
{
"cell_type": "code",
"source": [
"public static IDocumentBuilder MainTabConfiguration<T>(this IDocumentBuilder builder, T args) where T : IfrsPartition",
"\n => builder.WithTable<T>( config => config .AtBeginning() ",
"\n .WithName(Main) ",
"\n .WithSource(source => args.RepeatOnce().AsQueryable()) ",
"\n .WithColumn(x => x.Id, x => x.Delete()));"
]
},
{
"cell_type": "markdown",
"source": [
"# Porfolio"
]
},
{
"cell_type": "code",
"source": [
"public static IDocumentBuilder PortfolioConfiguration<T>(this IDocumentBuilder builder, Type DependsOnType = default) where T : Portfolio",
"\n => builder.WithTable<T>(config => { ",
"\n if(DependsOnType != default)",
"\n config = config.DependsOn(DependsOnType); ",
"\n return config .AtBeginning() ",
"\n .WithColumn(x => x.DisplayName, x => x.AtBeginning())",
"\n .WithColumn(x => x.SystemName, x => x.AtBeginning())",
"\n .WithColumn(x => x.Partition, x => x.Delete())",
"\n .WithColumn(x => x.FunctionalCurrency, x => x.Delete());",
"\n });"
]
},
{
"cell_type": "markdown",
"source": [
"# Group of Contract"
]
},
{
"cell_type": "code",
"source": [
"public static IDocumentBuilder GroupofContractConfiguration<T>(this IDocumentBuilder builder, Type DependsOnType = default) where T : GroupOfContract",
"\n => builder.WithTable<T>(config => { ",
"\n if(DependsOnType != default)",
"\n config = config.DependsOn(DependsOnType); ",
"\n if(typeof(T).Name == nameof(GroupOfInsuranceContract))",
"\n config = config.WithColumn(x => x.Partner, x => x.Delete());",
"\n return config .AtBeginning() ",
"\n .WithColumn(x => x.DisplayName, x => x.AtBeginning())",
"\n .WithColumn(x => x.SystemName, x => x.AtBeginning())",
"\n .WithColumn(x => x.Partition, x => x.Delete())",
"\n .WithColumn(x => x.ContractualCurrency, x => x.Delete())",
"\n .WithColumn(x => x.FunctionalCurrency, x => x.Delete())",
"\n .WithColumn(x => x.LineOfBusiness, x => x.Delete())",
"\n .WithColumn(x => x.OciType, x => x.Delete())",
"\n .WithColumn(x => x.ValuationApproach, x => x.Delete());",
"\n });"
]
},
{
"cell_type": "markdown",
"source": [
"# Data Node State"
]
},
{
"cell_type": "code",
"source": [
"using DocumentFormat.OpenXml.Spreadsheet;"
]
},
{
"cell_type": "code",
"source": [
"public record HelperState { public string State {get; init;} }"
]
},
{
"cell_type": "code",
"source": [
"public static IExcelDocumentBuilder DataNodeStateConfiguration (this IExcelDocumentBuilder builder, DataNodeState[] data)",
"\n => builder",
"\n .WithTable<LiabilityType>(x => x.Delete())",
"\n .WithTable<Profitability>(x => x.Delete())",
"\n .WithTable<Portfolio>(x => x.Delete())",
"\n .WithTable<Currency>(x => x.Delete())",
"\n .WithTable<LineOfBusiness>(x => x.Delete())",
"\n .WithTable<ValuationApproach>(x => x.Delete())",
"\n .WithTable<OciType>(x => x.Delete())",
"\n .WithTable<Partner>(x => x.Delete())",
"\n .WithTable<ReportingNode>(x => x.Delete())",
"\n .WithTable<Scenario>(x => x.Delete())",
"\n .WithTable<DataNodeState>(config => config ",
"\n .AtBeginning() ",
"\n .WithSource(source => data.AsQueryable())",
"\n .WithColumn(x => x.Partition, x => x.Delete())",
"\n .WithColumn(x => x.Month, x => x.Delete())",
"\n .WithColumn(x => x.Year, x => x.Delete())",
"\n .WithColumn(x => x.Id, x => x.Delete())",
"\n .WithColumn(x => x.State, y => y.WithDataValidation(z => z.WithReferenceTo<HelperState, string>(t => t.State)))",
"\n );"
]
},
{
"cell_type": "code",
"source": [
"public static IExcelDocumentBuilder StateEnumConfiguration (this IExcelDocumentBuilder builder)",
"\n{",
"\n var helperState = new[] {new HelperState {State = \"Active\"}, new HelperState {State = \"Inactive\"} }; ",
"\n return builder.WithTable<HelperState>( config => config .WithSheetVisibility(SheetStateValues.Hidden)",
"\n //.WithColumn(x => x.State, z => z.WithNamedRange(y => y.WithName(\"HelperState_State\")))",
"\n .WithColumn(x => x.State, z => z.WithDefaultNamedRange())",
"\n .WithSource(source => helperState.AsQueryable()) );",
"\n}"
]
},
{
"cell_type": "markdown",
"source": [
"# Data Node Parameter"
]
},
{
"cell_type": "code",
"source": [
"public static IExcelDocumentBuilder DataNodeParameterConfiguration (this IExcelDocumentBuilder builder, Dictionary<string, DataNodeParameter[]> data)",
"\n => builder",
"\n .WithTable<LiabilityType>(x => x.Delete())",
"\n .WithTable<Profitability>(x => x.Delete())",
"\n .WithTable<Portfolio>(x => x.Delete())",
"\n .WithTable<Currency>(x => x.Delete())",
"\n .WithTable<LineOfBusiness>(x => x.Delete())",
"\n .WithTable<ValuationApproach>(x => x.Delete())",
"\n .WithTable<OciType>(x => x.Delete())",
"\n .WithTable<Partner>(x => x.Delete())",
"\n .WithTable<ReportingNode>(x => x.Delete())",
"\n .WithTable<Scenario>(x => x.Delete())",
"\n .WithTable<InterDataNodeParameter>(config => config ",
"\n .AtBeginning() ",
"\n .WithSource(source => data[nameof(InterDataNodeParameter)].Cast<InterDataNodeParameter>().AsQueryable())",
"\n .WithColumn(x => x.Partition, x => x.Delete())",
"\n .WithColumn(x => x.Month, x => x.Delete())",
"\n .WithColumn(x => x.Id, x => x.Delete())",
"\n .WithColumn(x => x.Year, x => x.Delete())",
"\n )",
"\n .WithTable<SingleDataNodeParameter>(config => config ",
"\n .AtBeginning() ",
"\n .WithSource(source => data[nameof(SingleDataNodeParameter)].Cast<SingleDataNodeParameter>().AsQueryable())",
"\n .WithColumn(x => x.DataNode, x => x.WithHeader(\"DataNode\"))",
"\n .WithColumn(x => x.Partition, x => x.Delete())",
"\n .WithColumn(x => x.Month, x => x.Delete())",
"\n .WithColumn(x => x.Year, x => x.Delete())",
"\n .WithColumn(x => x.Year, x => x.Delete())",
"\n .WithColumn(x => x.Id, x => x.Delete())",
"\n );"
]
},
{
"cell_type": "code",
"source": [
""
]
}
]
}
20 changes: 10 additions & 10 deletions Export/MapTemplate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,34 @@
{
"cell_type": "markdown",
"source": [
"# Import dependencies"
"# Select Initialization"
]
},
{
"cell_type": "code",
"cell_type": "markdown",
"source": [
"#!import \"../Utils/UtilityMethods\""
"Choose to run the Map Template either with the set of Systemorph data in memory or with the data present in the Database. Uncomment the desired option."
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"source": [
"# Select Initialization"
"/* The DataSource is configured and connected to real database */",
"\n//#!eval-notebook \"../Database/Configure\"",
"\n/* The Systemorph set of dimensions + mockdata are dispatched to the unconfigured in-memory DataSource */",
"\n#!eval-notebook \"../Initialization/InitSystemorphBaseToMemory\""
]
},
{
"cell_type": "markdown",
"source": [
"Choose to run the Map Template either with the set of Systemorph data in memory or with the data present in the Database. Uncomment the desired option."
"# Import dependencies"
]
},
{
"cell_type": "code",
"source": [
"/* The DataSource is configured and connected to real database */",
"\n//#!eval-notebook \"Database/Configure\"",
"\n/* The Systemorph set of dimensions + mockdata are dispatched to the unconfigured in-memory DataSource */",
"\n#!eval-notebook \"../Initialization/InitSystemorphBaseToMemory\""
"#!import \"../Export/Export\""
]
},
{
Expand Down
Loading