algomancy-quickstart 0.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. algomancy_quickstart/__init__.py +2 -0
  2. algomancy_quickstart/asset_manager.py +202 -0
  3. algomancy_quickstart/data_inference.py +517 -0
  4. algomancy_quickstart/main.py +62 -0
  5. algomancy_quickstart/quickstart.py +683 -0
  6. algomancy_quickstart/styling_wizard.py +347 -0
  7. algomancy_quickstart/templates/__init__.py +0 -0
  8. algomancy_quickstart/templates/algorithm.py.jinja +104 -0
  9. algomancy_quickstart/templates/assets/CQM-logo-white.png +0 -0
  10. algomancy_quickstart/templates/assets/cqm-button-white.png +0 -0
  11. algomancy_quickstart/templates/assets/cqm-button.png +0 -0
  12. algomancy_quickstart/templates/assets/cqm-logo.png +0 -0
  13. algomancy_quickstart/templates/assets/css/button_colors.css +285 -0
  14. algomancy_quickstart/templates/assets/css/cqm_loader.css +47 -0
  15. algomancy_quickstart/templates/assets/css/sidebar_layout.css +189 -0
  16. algomancy_quickstart/templates/assets/css/theme_colors.css +90 -0
  17. algomancy_quickstart/templates/assets/letter-c.svg +4 -0
  18. algomancy_quickstart/templates/assets/letter-m.svg +4 -0
  19. algomancy_quickstart/templates/assets/letter-q.svg +4 -0
  20. algomancy_quickstart/templates/assets/letters/letter-c.png +0 -0
  21. algomancy_quickstart/templates/assets/letters/letter-m.png +0 -0
  22. algomancy_quickstart/templates/assets/letters/letter-q.png +0 -0
  23. algomancy_quickstart/templates/assets/pepsi_girl.jpeg +0 -0
  24. algomancy_quickstart/templates/assets/style.css +421 -0
  25. algomancy_quickstart/templates/compare_page.py.jinja +133 -0
  26. algomancy_quickstart/templates/data_page.py.jinja +94 -0
  27. algomancy_quickstart/templates/etl_factory.py.jinja +108 -0
  28. algomancy_quickstart/templates/etl_factory_generated.py.jinja +82 -0
  29. algomancy_quickstart/templates/generated_schemas.py.jinja +55 -0
  30. algomancy_quickstart/templates/home_page.py.jinja +65 -0
  31. algomancy_quickstart/templates/kpi.py.jinja +76 -0
  32. algomancy_quickstart/templates/main.py.jinja +42 -0
  33. algomancy_quickstart/templates/main_custom.py.jinja +55 -0
  34. algomancy_quickstart/templates/main_generated_etl.py.jinja +72 -0
  35. algomancy_quickstart/templates/main_with_styling.py.jinja +83 -0
  36. algomancy_quickstart/templates/overview_page.py.jinja +98 -0
  37. algomancy_quickstart/templates/scenario_page.py.jinja +77 -0
  38. algomancy_quickstart/templates/schema.py.jinja +58 -0
  39. algomancy_quickstart/templates/styling_config.py.jinja +53 -0
  40. algomancy_quickstart-0.7.0.dist-info/METADATA +29 -0
  41. algomancy_quickstart-0.7.0.dist-info/RECORD +42 -0
  42. algomancy_quickstart-0.7.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,108 @@
1
+ """
2
+ ETL (Extract, Transform, Load) Factory for {{ project_name }}.
3
+
4
+ This module wires the data-processing pipeline:
5
+
6
+ 1. **Extract** — read data from files (defaults are picked from the schema
7
+ registry based on ``(extension, schema_type)``; hand-wire only when a
8
+ file needs non-default arguments, e.g. a custom CSV separator).
9
+ 2. **Validate** — schema, required-columns, and primary-key checks are
10
+ included by default. Override and call ``super()`` to add extras.
11
+ 3. **Transform** — clean / join / cascade-drop as needed.
12
+ 4. **Load** — :class:`DataSourceLoader` is the inherited default; only
13
+ override if you need a custom container.
14
+ """
15
+
16
+ from typing import Dict
17
+
18
+ from algomancy_data import ETLFactory, File, ValidationSequence
19
+ from algomancy_data.extractor import ExtractionSequence
20
+
21
+ # Uncomment the imports you actually use below.
22
+ # from algomancy_data import (
23
+ # MissingValueValidator,
24
+ # UniqueValueValidator,
25
+ # ValidationSeverity,
26
+ # )
27
+ # from algomancy_data.extractor import CSVSingleExtractor
28
+ # from algomancy_data.transformer import (
29
+ # CascadeDropTransformer,
30
+ # CleanTransformer,
31
+ # TransformationSequence,
32
+ # )
33
+
34
+
35
+ class {{ class_name }}ETLFactory(ETLFactory):
36
+ """
37
+ Factory for the {{ project_name }} ETL pipeline.
38
+
39
+ Demonstrates the post-M4 minimal pattern: call ``super()`` for each
40
+ stage to inherit the framework defaults, and only customise the bits
41
+ that are specific to this project.
42
+
43
+ TODO: Adapt each stage to your data.
44
+ """
45
+
46
+ def create_extraction_sequence(
47
+ self, files: Dict[str, File]
48
+ ) -> ExtractionSequence:
49
+ """
50
+ Default extraction defers to the schema registry: each registered
51
+ ``(extension, schema_type)`` pair maps to an extractor class, and
52
+ ``super()`` builds them straight from your schemas.
53
+
54
+ Override only for files that need non-default extractor parameters
55
+ (custom CSV separator, explicit XLSX sheet, …):
56
+
57
+ sequence = super().create_extraction_sequence(default_files)
58
+ sequence.add_extractor(
59
+ CSVSingleExtractor(
60
+ file=files["my_file"],
61
+ schema=self.get_schema("my_file"),
62
+ separator=";",
63
+ logger=self.logger,
64
+ )
65
+ )
66
+ return sequence
67
+ """
68
+ return super().create_extraction_sequence(files)
69
+
70
+ def create_validation_sequence(self) -> ValidationSequence:
71
+ """
72
+ ``super()`` already adds ``RequiredColumnsValidator`` +
73
+ ``SchemaValidator`` (+ ``PrimaryKeyValidator`` when any schema
74
+ declares a primary key). Add project-specific validators here.
75
+
76
+ Example:
77
+
78
+ sequence = super().create_validation_sequence()
79
+ sequence.add_validator(
80
+ MissingValueValidator(
81
+ table="my_table",
82
+ columns=["name", "email"],
83
+ severity=ValidationSeverity.ERROR,
84
+ )
85
+ )
86
+ return sequence
87
+ """
88
+ return super().create_validation_sequence()
89
+
90
+ # def create_transformation_sequence(self) -> TransformationSequence:
91
+ # """Default is a single ``NoopTransformer``. Override to add
92
+ # project-specific transformations.
93
+ #
94
+ # Example with the M7 cascade-drop transformer (use together with
95
+ # ``foreign_key=("parent", "id")`` on the child schema column —
96
+ # orphan child rows and, with ``parent_requires_child=True``,
97
+ # childless parent rows are dropped):
98
+ #
99
+ # sequence = TransformationSequence(logger=self.logger)
100
+ # sequence.add_transformer(CleanTransformer(self.logger))
101
+ # sequence.add_transformer(
102
+ # CascadeDropTransformer(
103
+ # schemas=self.schemas, logger=self.logger
104
+ # )
105
+ # )
106
+ # return sequence
107
+ # """
108
+ # return super().create_transformation_sequence()
@@ -0,0 +1,82 @@
1
+ """
2
+ ETL Factory for {{ project_name }} with auto-generated extractors.
3
+
4
+ This file was generated by algomancy-quickstart based on detected data files.
5
+ Files that work with the schema registry's default extractors are wired
6
+ via ``super().create_extraction_sequence(...)``; files needing custom
7
+ extractor parameters (CSV separator, XLSX sheet name) are hand-wired.
8
+ """
9
+
10
+ from typing import Dict
11
+
12
+ from algomancy_data import (
13
+ ETLFactory,
14
+ File,
15
+ ValidationSequence,
16
+ )
17
+ from algomancy_data.extractor import (
18
+ ExtractionSequence,
19
+ {% if needs_csv_extractor %} CSVSingleExtractor,
20
+ {% endif %}{% if needs_xlsx_single_extractor %} XLSXSingleExtractor,
21
+ {% endif %})
22
+
23
+ # Import generated schemas
24
+ from src.data_handling.generated_schemas import all_schemas # noqa: F401
25
+
26
+
27
+ class {{ class_name }}ETLFactory(ETLFactory):
28
+ """
29
+ ETL Factory with auto-generated extractors for detected data files.
30
+
31
+ Detected {{ file_count }} data file(s):
32
+ {% for file_info in files %}
33
+ - {{ file_info.file_name }} ({{ file_info.extension.value }})
34
+ {% endfor %}
35
+ """
36
+
37
+ def create_extraction_sequence(
38
+ self, files: Dict[str, File]
39
+ ) -> ExtractionSequence:
40
+ """Wire extractors for every detected file.
41
+
42
+ Files that match the registry's default ``(extension, schema_type)``
43
+ extractor are delegated to ``super()``; the rest are hand-wired.
44
+ """
45
+ # Registry-default extractors handle these files via ``super()``.
46
+ default_files = {
47
+ {% for file_info in default_files %}
48
+ "{{ file_info.file_name }}": files["{{ file_info.file_name }}"],
49
+ {% endfor %}
50
+ }
51
+ sequence = super().create_extraction_sequence(default_files)
52
+ {% for file_info in custom_files %}
53
+
54
+ # {{ file_info.file_name }} — non-default extractor parameters.
55
+ {% if file_info.extension.name == 'CSV' %}
56
+ sequence.add_extractor(
57
+ CSVSingleExtractor(
58
+ file=files["{{ file_info.file_name }}"],
59
+ schema=self.get_schema("{{ file_info.file_name }}"),
60
+ separator="{{ file_info.csv_separator }}",
61
+ logger=self.logger,
62
+ )
63
+ )
64
+ {% elif file_info.extension.name == 'XLSX' %}
65
+ sequence.add_extractor(
66
+ XLSXSingleExtractor(
67
+ file=files["{{ file_info.file_name }}"],
68
+ schema=self.get_schema("{{ file_info.file_name }}"),
69
+ sheet_name="{{ file_info.sheets_to_extract[0] }}",
70
+ logger=self.logger,
71
+ )
72
+ )
73
+ {% endif %}
74
+ {% endfor %}
75
+ return sequence
76
+
77
+ def create_validation_sequence(self) -> ValidationSequence:
78
+ """Inherit ``RequiredColumnsValidator + SchemaValidator
79
+ (+ PrimaryKeyValidator``) from the base class. Add custom validators
80
+ here, e.g. ``MissingValueValidator`` or ``UniqueValueValidator``.
81
+ """
82
+ return super().create_validation_sequence()
@@ -0,0 +1,55 @@
1
+ """
2
+ Auto-generated schema definitions for {{ project_name }}.
3
+
4
+ This file was generated by algomancy-quickstart based on detected data files.
5
+ Edit freely — columns are declared with :class:`Column` (and
6
+ :class:`ColumnGroup` for multi-sheet files), so adding ``optional=True``,
7
+ ``nullable=True``, ``unique=True``, or ``foreign_key=("table", "col")``
8
+ to any column works out of the box.
9
+ """
10
+
11
+ from algomancy_data import Column, ColumnGroup, DataType, FileExtension, Schema
12
+ from algomancy_data.schema import SchemaType
13
+
14
+ {% for file_info in files %}
15
+
16
+ class {{ file_info.class_name }}Schema(Schema):
17
+ """
18
+ Schema for {{ file_info.file_name }} data file.
19
+
20
+ File: {{ file_info.file_path.name }}
21
+ Type: {{ file_info.extension.value }}
22
+ {% if file_info.is_multi_sheet %}Sheets: {{ file_info.sheet_names|join(', ') }}{% endif %}
23
+
24
+ Detected {{ file_info.total_columns }} column(s).
25
+ """
26
+
27
+ _FILENAME = "{{ file_info.file_name }}"
28
+ _EXTENSION = FileExtension.{{ file_info.extension.name }}
29
+ _SCHEMA_TYPE = SchemaType.{{ 'MULTI' if file_info.is_multi_sheet else 'SINGLE' }}
30
+
31
+ {% if file_info.is_multi_sheet %}
32
+ {% for sheet_name, columns in file_info.inferred_schemas.items() %}
33
+ {{ sheet_name|upper|replace(' ', '_')|replace('-', '_')|replace('.', '_') }} = ColumnGroup(
34
+ "{{ sheet_name }}",
35
+ [
36
+ {% for column_name, data_type in columns.items() %}
37
+ Column("{{ column_name }}", dtype=DataType.{{ data_type.name }}{% if column_name in file_info.primary_key_columns.get(sheet_name, []) %}, primary_key=True{% endif %}),
38
+ {% endfor %}
39
+ ],
40
+ )
41
+ {% endfor %}
42
+ {% else %}
43
+ {% for column_name, data_type in file_info.inferred_schemas['default'].items() %}
44
+ {{ column_name|upper|replace(' ', '_')|replace('-', '_')|replace('.', '_') }} = Column("{{ column_name }}", dtype=DataType.{{ data_type.name }}{% if column_name in file_info.primary_key_columns.get('default', []) %}, primary_key=True{% endif %})
45
+ {% endfor %}
46
+ {% endif %}
47
+
48
+ {% endfor %}
49
+
50
+ # All generated schemas — passed to ``CoreConfig(schemas=...)``.
51
+ all_schemas = [
52
+ {% for file_info in files %}
53
+ {{ file_info.class_name }}Schema,
54
+ {% endfor %}
55
+ ]
@@ -0,0 +1,65 @@
1
+ """
2
+ Custom home page template for {{ project_name }}.
3
+
4
+ This module defines a custom home page that can be tailored to provide
5
+ a project-specific landing experience.
6
+ """
7
+
8
+ from dash import html
9
+ from algomancy_content import BaseHomePage
10
+
11
+
12
+ class {{ class_name }}HomePage(BaseHomePage):
13
+ """
14
+ Custom home page implementation for {{ project_name }}.
15
+
16
+ TODO: Customize the home page layout and content.
17
+ """
18
+
19
+ @staticmethod
20
+ def create_content() -> html.Div:
21
+ """
22
+ Define the layout and static content of the home page.
23
+
24
+ Returns:
25
+ A Dash html.Div containing the page content.
26
+
27
+ TODO: Implement your custom landing page layout.
28
+ """
29
+ return html.Div(
30
+ [
31
+ html.H1("Welcome to {{ project_name }} Dashboard"),
32
+ html.P(
33
+ "This is a custom home page generated by the Algomancy Quickstart."
34
+ ),
35
+ html.Hr(),
36
+ html.Div(
37
+ [
38
+ html.H3("Getting Started"),
39
+ html.Ul(
40
+ [
41
+ html.Li("Customize this page in src/pages/home_page.py"),
42
+ html.Li("Define your data schemas in src/data_handling/schemas.py"),
43
+ html.Li("Implement your algorithm in src/templates/algorithm/"),
44
+ html.Li("Configure KPIs in src/templates/kpi/"),
45
+ ]
46
+ ),
47
+ ]
48
+ ),
49
+ # TODO: Add more components like graphs, summary statistics, or navigation links
50
+ ],
51
+ style={"padding": "20px"},
52
+ )
53
+
54
+ @staticmethod
55
+ def register_callbacks() -> None:
56
+ """
57
+ Register Dash callbacks for this page if needed.
58
+
59
+ TODO: Add any interactive behavior for the home page.
60
+ """
61
+ # Example:
62
+ # @app.callback(...)
63
+ # def update_something(...):
64
+ # pass
65
+ pass
@@ -0,0 +1,76 @@
1
+ """
2
+ KPI (Key Performance Indicator) definitions for {{ project_name }}.
3
+
4
+ This module defines the metrics used to evaluate algorithm performance.
5
+ """
6
+
7
+ from algomancy_scenario import (
8
+ ImprovementDirection,
9
+ BaseKPI,
10
+ ScenarioResult,
11
+ )
12
+ from algomancy_utils import QUANTITIES, BaseMeasurement
13
+
14
+
15
+ # Define measurement units
16
+ # Available units: percentage, currency, dimensionless, time, etc.
17
+ percent = QUANTITIES["percentage"]
18
+ percent_measurement = BaseMeasurement(
19
+ percent["%"],
20
+ min_digits=1,
21
+ max_digits=3,
22
+ decimals=1
23
+ )
24
+
25
+
26
+ class {{ class_name }}KPI(BaseKPI):
27
+ """
28
+ KPI implementation for {{ project_name }}.
29
+
30
+ This class calculates a key performance metric from scenario results.
31
+
32
+ TODO: Customize the KPI calculation logic.
33
+ """
34
+
35
+ def __init__(self):
36
+ """
37
+ Initialize the KPI.
38
+
39
+ Args (passed to parent):
40
+ name: Display name for this KPI
41
+ direction: ImprovementDirection.HIGHER or ImprovementDirection.LOWER
42
+ measurement: BaseMeasurement defining the unit and format
43
+
44
+ TODO: Customize the name, direction, and measurement unit.
45
+ """
46
+ super().__init__(
47
+ "{{ class_name }} Metric", # TODO: Set your KPI name
48
+ ImprovementDirection.HIGHER, # TODO: Set HIGHER or LOWER
49
+ percent_measurement # TODO: Choose appropriate measurement unit
50
+ )
51
+
52
+ def compute(self, result: ScenarioResult) -> float:
53
+ """
54
+ Calculate the KPI value from a scenario result.
55
+
56
+ Args:
57
+ result: The result object from an algorithm run.
58
+
59
+ Returns:
60
+ The computed KPI value as a float.
61
+
62
+ TODO: Implement your KPI calculation logic here.
63
+
64
+ Tips:
65
+ - Access result data via result.data_id
66
+ - You can load the data source if needed
67
+ - Return a single numeric value
68
+
69
+ Example:
70
+ data = DataSource.load(result.data_id)
71
+ # Calculate something from the data
72
+ return calculated_value
73
+ """
74
+ # TODO: Replace this with your actual KPI calculation
75
+ # Placeholder implementation:
76
+ return 50.0 # Return a dummy value
@@ -0,0 +1,42 @@
1
+ from algomancy_data import DataSource
2
+ from algomancy_gui.configuration.appconfig import AppConfig
3
+ from algomancy_gui.configuration.comparepageconfig import ComparePageConfig
4
+ from algomancy_gui.configuration.featureconfig import FeatureConfig
5
+ from algomancy_gui.configuration.pageconfig import PageConfig
6
+ from algomancy_gui.configuration.serverconfig import ServerConfig
7
+ from algomancy_gui.configuration.stylingconfig import StylingConfig
8
+ from algomancy_gui.gui_launcher import GuiLauncher
9
+ from algomancy_scenario.core_configuration import CoreConfig
10
+ from algomancy_content import (
11
+ PlaceholderETLFactory,
12
+ PlaceholderAlgorithm,
13
+ PlaceholderKPI,
14
+ PlaceholderSchema,
15
+ )
16
+
17
+
18
+ def main() -> None:
19
+ app_cfg = AppConfig(
20
+ core_config=CoreConfig(
21
+ etl_factory=PlaceholderETLFactory,
22
+ schemas=[PlaceholderSchema()],
23
+ kpi_templates={"placeholder": PlaceholderKPI},
24
+ algo_templates={"placeholder": PlaceholderAlgorithm},
25
+ data_object_type=DataSource,
26
+ autocreate=False,
27
+ autorun=False,
28
+ title="{{ title }}",
29
+ ),
30
+ server_config=ServerConfig(host="{{ host }}", port={{ port }}),
31
+ page_config=PageConfig(),
32
+ compare_page_config=ComparePageConfig(),
33
+ styling_config=StylingConfig(assets_path="assets"),
34
+ feature_config=FeatureConfig(),
35
+ )
36
+
37
+ app = GuiLauncher.build(app_cfg)
38
+ GuiLauncher.run(app=app, host=app_cfg.server.host, port=app_cfg.server.port)
39
+
40
+
41
+ if __name__ == "__main__":
42
+ main()
@@ -0,0 +1,55 @@
1
+ from algomancy_data import DataSource
2
+ from algomancy_gui.configuration.appconfig import AppConfig
3
+ from algomancy_gui.configuration.comparepageconfig import ComparePageConfig
4
+ from algomancy_gui.configuration.featureconfig import FeatureConfig
5
+ from algomancy_gui.configuration.pageconfig import PageConfig
6
+ from algomancy_gui.configuration.serverconfig import ServerConfig
7
+ from algomancy_gui.configuration.stylingconfig import StylingConfig
8
+ from algomancy_gui.gui_launcher import GuiLauncher
9
+ from algomancy_scenario.core_configuration import CoreConfig
10
+
11
+ # Import custom implementations
12
+ from src.data_handling.etl_factory import {{ class_name }}ETLFactory
13
+ from src.data_handling.schemas import all_schemas
14
+ from src.templates.algorithm.{{ filename }}_algorithm import {{ class_name }}Algorithm
15
+ from src.templates.kpi.{{ filename }}_kpi import {{ class_name }}KPI
16
+ from src.pages.home_page import {{ class_name }}HomePage
17
+ from src.pages.data_page import {{ class_name }}DataPage
18
+ from src.pages.scenario_page import {{ class_name }}ScenarioPage
19
+ from src.pages.compare_page import {{ class_name }}ComparePage
20
+ from src.pages.overview_page import {{ class_name }}OverviewPage
21
+
22
+
23
+ def main() -> None:
24
+ """Main entry point for the {{ title }} application."""
25
+
26
+ app_cfg = AppConfig(
27
+ core_config=CoreConfig(
28
+ etl_factory={{ class_name }}ETLFactory,
29
+ kpi_templates={"{{ filename }}": {{ class_name }}KPI},
30
+ algo_templates={"{{ class_name }}": {{ class_name }}Algorithm},
31
+ schemas=all_schemas,
32
+ data_object_type=DataSource,
33
+ autocreate=False,
34
+ autorun=False,
35
+ title="{{ title }}",
36
+ ),
37
+ server_config=ServerConfig(host="{{ host }}", port={{ port }}),
38
+ page_config=PageConfig(
39
+ home_page={{ class_name }}HomePage(),
40
+ data_page={{ class_name }}DataPage(),
41
+ scenario_page={{ class_name }}ScenarioPage(),
42
+ compare_page={{ class_name }}ComparePage(),
43
+ # overview_page={{ class_name }}OverviewPage(), # uncomment to use {{ class_name }}OverviewPage
44
+ ),
45
+ compare_page_config=ComparePageConfig(),
46
+ styling_config=StylingConfig(assets_path="assets"),
47
+ feature_config=FeatureConfig(),
48
+ )
49
+
50
+ app = GuiLauncher.build(app_cfg)
51
+ GuiLauncher.run(app=app, host=app_cfg.server.host, port=app_cfg.server.port)
52
+
53
+
54
+ if __name__ == "__main__":
55
+ main()
@@ -0,0 +1,72 @@
1
+ from algomancy_data import DataSource
2
+ from algomancy_gui.configuration.appconfig import AppConfig
3
+ from algomancy_gui.configuration.comparepageconfig import ComparePageConfig
4
+ from algomancy_gui.configuration.featureconfig import FeatureConfig
5
+ from algomancy_gui.configuration.pageconfig import PageConfig
6
+ from algomancy_gui.configuration.serverconfig import ServerConfig
7
+ from algomancy_gui.configuration.stylingconfig import StylingConfig
8
+ from algomancy_gui.gui_launcher import GuiLauncher
9
+ from algomancy_scenario.core_configuration import CoreConfig
10
+
11
+ # Import generated ETL factory and schemas
12
+ from src.data_handling.etl_factory import {{ class_name }}ETLFactory
13
+ from src.data_handling.generated_schemas import all_schemas
14
+
15
+ {% if has_custom_implementations %}
16
+ # Import custom implementations
17
+ from src.templates.algorithm.{{ filename }}_algorithm import {{ class_name }}Algorithm
18
+ from src.templates.kpi.{{ filename }}_kpi import {{ class_name }}KPI
19
+ from src.pages.home_page import {{ class_name }}HomePage
20
+ from src.pages.data_page import {{ class_name }}DataPage
21
+ from src.pages.scenario_page import {{ class_name }}ScenarioPage
22
+ from src.pages.compare_page import {{ class_name }}ComparePage
23
+ from src.pages.overview_page import {{ class_name }}OverviewPage
24
+ {% else %}
25
+ # Import placeholder KPI and Algorithm
26
+ # TODO: Update these imports when you create custom implementations
27
+ from algomancy_content import PlaceholderKPI, PlaceholderAlgorithm
28
+ {% endif %}
29
+
30
+
31
+ def main() -> None:
32
+ """Main entry point for the {{ title }} application."""
33
+
34
+ app_cfg = AppConfig(
35
+ core_config=CoreConfig(
36
+ etl_factory={{ class_name }}ETLFactory,
37
+ schemas=all_schemas,
38
+ {% if has_custom_implementations %}
39
+ kpi_templates={"{{ filename }}": {{ class_name }}KPI},
40
+ algo_templates={"{{ class_name }}": {{ class_name }}Algorithm},
41
+ {% else %}
42
+ kpi_templates={"placeholder": PlaceholderKPI},
43
+ algo_templates={"placeholder": PlaceholderAlgorithm},
44
+ {% endif %}
45
+ data_object_type=DataSource,
46
+ autocreate=False,
47
+ autorun=False,
48
+ title="{{ title }}",
49
+ ),
50
+ server_config=ServerConfig(host="{{ host }}", port={{ port }}),
51
+ {% if has_custom_implementations %}
52
+ page_config=PageConfig(
53
+ home_page={{ class_name }}HomePage(),
54
+ data_page={{ class_name }}DataPage(),
55
+ scenario_page={{ class_name }}ScenarioPage(),
56
+ compare_page={{ class_name }}ComparePage(),
57
+ # overview_page={{ class_name }}OverviewPage(), # uncomment to use {{ class_name }}OverviewPage
58
+ ),
59
+ {% else %}
60
+ page_config=PageConfig(),
61
+ {% endif %}
62
+ compare_page_config=ComparePageConfig(),
63
+ styling_config=StylingConfig(assets_path="assets"),
64
+ feature_config=FeatureConfig(),
65
+ )
66
+
67
+ app = GuiLauncher.build(app_cfg)
68
+ GuiLauncher.run(app=app, host=app_cfg.server.host, port=app_cfg.server.port)
69
+
70
+
71
+ if __name__ == "__main__":
72
+ main()
@@ -0,0 +1,83 @@
1
+ from algomancy_data import DataSource
2
+ from algomancy_gui.configuration.appconfig import AppConfig
3
+ from algomancy_gui.configuration.comparepageconfig import ComparePageConfig
4
+ from algomancy_gui.configuration.featureconfig import FeatureConfig
5
+ from algomancy_gui.configuration.pageconfig import PageConfig
6
+ from algomancy_gui.configuration.serverconfig import ServerConfig
7
+ from algomancy_gui.gui_launcher import GuiLauncher
8
+ from algomancy_scenario.core_configuration import CoreConfig
9
+
10
+ {% if has_generated_etl %}
11
+ # Import generated ETL factory and schemas
12
+ from src.data_handling.etl_factory import {{ class_name }}ETLFactory
13
+ from src.data_handling.generated_schemas import all_schemas
14
+ {% else %}
15
+ # Import placeholder implementations
16
+ from algomancy_content import PlaceholderETLFactory, PlaceholderSchema
17
+ {% endif %}
18
+
19
+ {% if has_custom_implementations %}
20
+ # Import custom implementations
21
+ from src.templates.algorithm.{{ filename }}_algorithm import {{ class_name }}Algorithm
22
+ from src.templates.kpi.{{ filename }}_kpi import {{ class_name }}KPI
23
+ from src.pages.home_page import {{ class_name }}HomePage
24
+ from src.pages.data_page import {{ class_name }}DataPage
25
+ from src.pages.scenario_page import {{ class_name }}ScenarioPage
26
+ from src.pages.compare_page import {{ class_name }}ComparePage
27
+ from src.pages.overview_page import {{ class_name }}OverviewPage
28
+ {% else %}
29
+ # Import placeholder KPI and Algorithm
30
+ from algomancy_content import PlaceholderKPI, PlaceholderAlgorithm
31
+ {% endif %}
32
+
33
+ # Import styling configuration
34
+ from src.styling_config import app_styling
35
+
36
+
37
+ def main() -> None:
38
+ """Main entry point for the {{ title }} application."""
39
+
40
+ app_cfg = AppConfig(
41
+ core_config=CoreConfig(
42
+ {% if has_generated_etl %}
43
+ etl_factory={{ class_name }}ETLFactory,
44
+ schemas=all_schemas,
45
+ {% else %}
46
+ etl_factory=PlaceholderETLFactory,
47
+ schemas=[PlaceholderSchema()],
48
+ {% endif %}
49
+ {% if has_custom_implementations %}
50
+ kpi_templates={"{{ filename }}": {{ class_name }}KPI},
51
+ algo_templates={"{{ class_name }}": {{ class_name }}Algorithm},
52
+ {% else %}
53
+ kpi_templates={"placeholder": PlaceholderKPI},
54
+ algo_templates={"placeholder": PlaceholderAlgorithm},
55
+ {% endif %}
56
+ data_object_type=DataSource,
57
+ autocreate=False,
58
+ autorun=False,
59
+ title="{{ title }}",
60
+ ),
61
+ server_config=ServerConfig(host="{{ host }}", port={{ port }}),
62
+ {% if has_custom_implementations %}
63
+ page_config=PageConfig(
64
+ home_page={{ class_name }}HomePage(),
65
+ data_page={{ class_name }}DataPage(),
66
+ scenario_page={{ class_name }}ScenarioPage(),
67
+ compare_page={{ class_name }}ComparePage(),
68
+ # overview_page={{ class_name }}OverviewPage(), # uncomment to use {{ class_name }}OverviewPage
69
+ ),
70
+ {% else %}
71
+ page_config=PageConfig(),
72
+ {% endif %}
73
+ compare_page_config=ComparePageConfig(),
74
+ styling_config=app_styling,
75
+ feature_config=FeatureConfig(),
76
+ )
77
+
78
+ app = GuiLauncher.build(app_cfg)
79
+ GuiLauncher.run(app=app, host=app_cfg.server.host, port=app_cfg.server.port)
80
+
81
+
82
+ if __name__ == "__main__":
83
+ main()