pydpm_xl 0.2.2__tar.gz → 0.2.3__tar.gz

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 (109) hide show
  1. {pydpm_xl-0.2.2/pydpm_xl.egg-info → pydpm_xl-0.2.3}/PKG-INFO +1 -1
  2. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/__init__.py +1 -1
  3. pydpm_xl-0.2.3/py_dpm/api/__init__.py +50 -0
  4. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/api/dpm/__init__.py +2 -2
  5. pydpm_xl-0.2.3/py_dpm/api/dpm/instance.py +111 -0
  6. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/api/dpm_xl/__init__.py +10 -2
  7. pydpm_xl-0.2.3/py_dpm/api/dpm_xl/ast_generator.py +1121 -0
  8. pydpm_xl-0.2.3/py_dpm/api/dpm_xl/complete_ast.py +199 -0
  9. {pydpm_xl-0.2.2/py_dpm/api/dpm → pydpm_xl-0.2.3/py_dpm/api/dpm_xl}/operation_scopes.py +2 -2
  10. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/cli/main.py +1 -1
  11. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/models.py +5 -1
  12. pydpm_xl-0.2.3/py_dpm/instance/__init__.py +0 -0
  13. pydpm_xl-0.2.3/py_dpm/instance/instance.py +265 -0
  14. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3/pydpm_xl.egg-info}/PKG-INFO +1 -1
  15. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/pydpm_xl.egg-info/SOURCES.txt +4 -8
  16. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/pyproject.toml +2 -2
  17. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_db_connection_handling.py +21 -3
  18. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_semantic_release.py +1 -1
  19. pydpm_xl-0.2.2/py_dpm/api/__init__.py +0 -78
  20. pydpm_xl-0.2.2/py_dpm/api/dpm_xl/ast_generator.py +0 -441
  21. pydpm_xl-0.2.2/py_dpm/api/dpm_xl/complete_ast.py +0 -710
  22. pydpm_xl-0.2.2/py_dpm/api/explorer.py +0 -4
  23. pydpm_xl-0.2.2/py_dpm/api/semantic.py +0 -56
  24. pydpm_xl-0.2.2/py_dpm/dpm_xl/validation/__init__.py +0 -12
  25. pydpm_xl-0.2.2/py_dpm/dpm_xl/validation/generation_utils.py +0 -428
  26. pydpm_xl-0.2.2/py_dpm/dpm_xl/validation/property_constraints.py +0 -225
  27. pydpm_xl-0.2.2/py_dpm/dpm_xl/validation/utils.py +0 -98
  28. pydpm_xl-0.2.2/py_dpm/dpm_xl/validation/variants.py +0 -359
  29. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/LICENSE +0 -0
  30. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/README.md +0 -0
  31. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/api/dpm/data_dictionary.py +0 -0
  32. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/api/dpm/explorer.py +0 -0
  33. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/api/dpm/hierarchical_queries.py +0 -0
  34. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/api/dpm/migration.py +0 -0
  35. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/api/dpm_xl/semantic.py +0 -0
  36. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/api/dpm_xl/syntax.py +0 -0
  37. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/cli/__init__.py +0 -0
  38. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/cli/commands/__init__.py +0 -0
  39. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/__init__.py +0 -0
  40. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/migration.py +0 -0
  41. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/queries/base.py +0 -0
  42. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/queries/basic_objects.py +0 -0
  43. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/queries/explorer_queries.py +0 -0
  44. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/queries/filters.py +0 -0
  45. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/queries/glossary.py +0 -0
  46. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/queries/hierarchical_queries.py +0 -0
  47. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/queries/tables.py +0 -0
  48. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm/utils.py +0 -0
  49. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/__init__.py +0 -0
  50. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/__init__.py +0 -0
  51. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/constructor.py +0 -0
  52. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/ml_generation.py +0 -0
  53. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/module_analyzer.py +0 -0
  54. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/module_dependencies.py +0 -0
  55. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/nodes.py +0 -0
  56. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/operands.py +0 -0
  57. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/template.py +0 -0
  58. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/visitor.py +0 -0
  59. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/ast/where_clause.py +0 -0
  60. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/__init__.py +0 -0
  61. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/__init__.py +0 -0
  62. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/dpm_xlLexer.interp +0 -0
  63. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/dpm_xlLexer.py +0 -0
  64. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/dpm_xlLexer.tokens +0 -0
  65. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/dpm_xlParser.interp +0 -0
  66. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/dpm_xlParser.py +0 -0
  67. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/dpm_xlParser.tokens +0 -0
  68. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/dpm_xlParserListener.py +0 -0
  69. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/dpm_xlParserVisitor.py +0 -0
  70. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/grammar/generated/listeners.py +0 -0
  71. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/__init__.py +0 -0
  72. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/aggregate.py +0 -0
  73. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/arithmetic.py +0 -0
  74. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/base.py +0 -0
  75. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/boolean.py +0 -0
  76. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/clause.py +0 -0
  77. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/comparison.py +0 -0
  78. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/conditional.py +0 -0
  79. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/string.py +0 -0
  80. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/operators/time.py +0 -0
  81. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/semantic_analyzer.py +0 -0
  82. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/symbols.py +0 -0
  83. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/types/__init__.py +0 -0
  84. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/types/promotion.py +0 -0
  85. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/types/scalar.py +0 -0
  86. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/types/time.py +0 -0
  87. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/utils/__init__.py +0 -0
  88. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/utils/data_handlers.py +0 -0
  89. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/utils/operands_mapping.py +0 -0
  90. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/utils/operator_mapping.py +0 -0
  91. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/utils/scopes_calculator.py +0 -0
  92. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/utils/serialization.py +0 -0
  93. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/dpm_xl/utils/tokens.py +0 -0
  94. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/exceptions/__init__.py +0 -0
  95. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/exceptions/exceptions.py +0 -0
  96. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/py_dpm/exceptions/messages.py +0 -0
  97. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/pydpm_xl.egg-info/dependency_links.txt +0 -0
  98. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/pydpm_xl.egg-info/entry_points.txt +0 -0
  99. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/pydpm_xl.egg-info/requires.txt +0 -0
  100. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/pydpm_xl.egg-info/top_level.txt +0 -0
  101. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/setup.cfg +0 -0
  102. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_cli_semantic.py +0 -0
  103. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_data_dictionary_releases.py +0 -0
  104. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_get_table_details.py +0 -0
  105. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_get_tables_date_filter.py +0 -0
  106. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_get_tables_release_code.py +0 -0
  107. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_hierarchical_query.py +0 -0
  108. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_query_refactor.py +0 -0
  109. {pydpm_xl-0.2.2 → pydpm_xl-0.2.3}/tests/test_release_filters_semantic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydpm_xl
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Python library for DPM-XL data processing and analysis
5
5
  Author-email: "MeaningfulData S.L." <info@meaningfuldata.eu>
6
6
  License: GPL-3.0-or-later
@@ -41,7 +41,7 @@ Available packages:
41
41
  - pydpm.api: Main APIs for migration, syntax, and semantic analysis
42
42
  """
43
43
 
44
- __version__ = "0.2.2"
44
+ __version__ = "0.2.3"
45
45
  __author__ = "MeaningfulData S.L."
46
46
  __email__ = "info@meaningfuldata.eu"
47
47
  __license__ = "GPL-3.0-or-later"
@@ -0,0 +1,50 @@
1
+ """
2
+ PyDPM Public API
3
+
4
+ Main entry point for the PyDPM library.
5
+ Provides both DPM-XL specific and general DPM functionality.
6
+ """
7
+
8
+ # Import from DPM-XL API
9
+ from py_dpm.api.dpm_xl import (
10
+ SyntaxAPI,
11
+ SemanticAPI,
12
+ ASTGeneratorAPI,
13
+ OperationScopesAPI,
14
+ generate_complete_ast,
15
+ generate_complete_batch,
16
+ generate_enriched_ast,
17
+ enrich_ast_with_metadata,
18
+ parse_with_data_fields,
19
+ )
20
+
21
+ # Import from general DPM API
22
+ from py_dpm.api.dpm import (
23
+ MigrationAPI,
24
+ DataDictionaryAPI,
25
+ ExplorerQueryAPI,
26
+ HierarchicalQueryAPI,
27
+ InstanceAPI,
28
+ )
29
+
30
+
31
+ # Export the main API classes and functions
32
+ __all__ = [
33
+ # General DPM APIs
34
+ "MigrationAPI",
35
+ "DataDictionaryAPI",
36
+ "ExplorerQueryAPI",
37
+ "HierarchicalQueryAPI",
38
+ "InstanceAPI",
39
+ # DPM-XL APIs
40
+ "SyntaxAPI",
41
+ "SemanticAPI",
42
+ "ASTGeneratorAPI",
43
+ "OperationScopesAPI",
44
+ # Complete AST functions (backwards compatibility)
45
+ "generate_complete_ast",
46
+ "generate_complete_batch",
47
+ "generate_enriched_ast",
48
+ "enrich_ast_with_metadata",
49
+ "parse_with_data_fields",
50
+ ]
@@ -6,15 +6,15 @@ Public APIs for general DPM functionality (database, exploration, scopes).
6
6
 
7
7
  from py_dpm.api.dpm.data_dictionary import DataDictionaryAPI
8
8
  from py_dpm.api.dpm.explorer import ExplorerQueryAPI
9
- from py_dpm.api.dpm.operation_scopes import OperationScopesAPI
10
9
  from py_dpm.api.dpm.migration import MigrationAPI
11
10
  from py_dpm.api.dpm.hierarchical_queries import HierarchicalQueryAPI
11
+ from py_dpm.api.dpm.instance import InstanceAPI
12
12
 
13
13
 
14
14
  __all__ = [
15
15
  "DataDictionaryAPI",
16
16
  "ExplorerQueryAPI",
17
- "OperationScopesAPI",
18
17
  "MigrationAPI",
19
18
  "HierarchicalQueryAPI",
19
+ "InstanceAPI",
20
20
  ]
@@ -0,0 +1,111 @@
1
+ """
2
+ Instance API
3
+
4
+ Public API for building XBRL-CSV report packages from instance data.
5
+ """
6
+
7
+ from pathlib import Path
8
+ from typing import Union, Dict, Any, TYPE_CHECKING
9
+
10
+ if TYPE_CHECKING:
11
+ from py_dpm.instance.instance import Instance
12
+
13
+
14
+ class InstanceAPI:
15
+ """
16
+ API for working with Instance data and building XBRL-CSV report packages.
17
+
18
+ This API provides methods to create instances from JSON files or dictionaries
19
+ and build XBRL-CSV packages from them.
20
+ """
21
+
22
+ @staticmethod
23
+ def build_package_from_dict(
24
+ instance_data: Dict[str, Any],
25
+ output_folder: Union[Path, str],
26
+ file_prefix: str = None,
27
+ ) -> Path:
28
+ """
29
+ Build an XBRL-CSV package from a dictionary containing instance data.
30
+
31
+ Args:
32
+ instance_data: Dictionary with the instance configuration.
33
+ Must contain: module_code, parameters (with refPeriod),
34
+ and operands (list of facts)
35
+ output_folder: Directory where the output ZIP file will be created
36
+ file_prefix: Optional prefix for the output filename
37
+
38
+ Returns:
39
+ Path to the created ZIP file
40
+
41
+ Raises:
42
+ ValueError: If required keys are missing or invalid
43
+ TypeError: If data types are incorrect
44
+
45
+ Example:
46
+ >>> api = InstanceAPI()
47
+ >>> data = {
48
+ ... "module_code": "F_01.01",
49
+ ... "parameters": {
50
+ ... "refPeriod": "2024-12-31"
51
+ ... },
52
+ ... "operands": [
53
+ ... {
54
+ ... "table_code": "t001",
55
+ ... "row_code": "r010",
56
+ ... "column_code": "c010",
57
+ ... "value": 1000000
58
+ ... }
59
+ ... ]
60
+ ... }
61
+ >>> output_path = api.build_package_from_dict(data, "/tmp/output")
62
+ """
63
+ # Import here to avoid circular import
64
+ from py_dpm.instance.instance import Instance
65
+
66
+ instance = Instance.from_dict(instance_data)
67
+ return instance.build_package(output_folder=output_folder, file_prefix=file_prefix)
68
+
69
+ @staticmethod
70
+ def build_package_from_json(
71
+ json_file: Union[Path, str],
72
+ output_folder: Union[Path, str],
73
+ file_prefix: str = None,
74
+ ) -> Path:
75
+ """
76
+ Build an XBRL-CSV package from a JSON file containing instance data.
77
+
78
+ Args:
79
+ json_file: Path to JSON file with instance configuration.
80
+ Must contain: module_code, parameters (with refPeriod),
81
+ and operands (list of facts)
82
+ output_folder: Directory where the output ZIP file will be created
83
+ file_prefix: Optional prefix for the output filename
84
+
85
+ Returns:
86
+ Path to the created ZIP file
87
+
88
+ Raises:
89
+ FileNotFoundError: If the JSON file doesn't exist
90
+ ValueError: If required keys are missing or invalid
91
+ TypeError: If data types are incorrect
92
+ json.JSONDecodeError: If the file contains invalid JSON
93
+
94
+ Example:
95
+ >>> api = InstanceAPI()
96
+ >>> output_path = api.build_package_from_json(
97
+ ... "/path/to/instance.json",
98
+ ... "/tmp/output"
99
+ ... )
100
+ """
101
+ # Import here to avoid circular import
102
+ from py_dpm.instance.instance import Instance
103
+
104
+ if isinstance(json_file, str):
105
+ json_file = Path(json_file)
106
+
107
+ if not json_file.exists():
108
+ raise FileNotFoundError(f"JSON file not found: {json_file}")
109
+
110
+ instance = Instance.from_json_file(json_file)
111
+ return instance.build_package(output_folder=output_folder, file_prefix=file_prefix)
@@ -6,20 +6,28 @@ Public APIs for DPM-XL expression parsing, validation, and AST generation.
6
6
 
7
7
  from py_dpm.api.dpm_xl.syntax import SyntaxAPI
8
8
  from py_dpm.api.dpm_xl.semantic import SemanticAPI
9
- from py_dpm.api.dpm_xl.ast_generator import ASTGenerator
9
+ from py_dpm.api.dpm_xl.ast_generator import ASTGeneratorAPI
10
+ from py_dpm.api.dpm_xl.operation_scopes import OperationScopesAPI
11
+
12
+ # Backwards-compatible standalone functions (delegate to ASTGeneratorAPI)
10
13
  from py_dpm.api.dpm_xl.complete_ast import (
11
14
  generate_complete_ast,
12
15
  generate_complete_batch,
13
16
  generate_enriched_ast,
14
17
  enrich_ast_with_metadata,
18
+ parse_with_data_fields,
15
19
  )
16
20
 
17
21
  __all__ = [
22
+ # Class-based APIs
18
23
  "SyntaxAPI",
19
24
  "SemanticAPI",
20
- "ASTGenerator",
25
+ "ASTGeneratorAPI",
26
+ "OperationScopesAPI",
27
+ # Standalone functions (backwards compatibility)
21
28
  "generate_complete_ast",
22
29
  "generate_complete_batch",
23
30
  "generate_enriched_ast",
24
31
  "enrich_ast_with_metadata",
32
+ "parse_with_data_fields",
25
33
  ]