vtlengine 1.0.0__py3-none-any.whl → 1.0.1__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.

Potentially problematic release.


This version of vtlengine might be problematic. Click here for more details.

Files changed (54) hide show
  1. vtlengine/API/_InternalApi.py +153 -100
  2. vtlengine/API/__init__.py +109 -67
  3. vtlengine/AST/ASTConstructor.py +188 -98
  4. vtlengine/AST/ASTConstructorModules/Expr.py +306 -200
  5. vtlengine/AST/ASTConstructorModules/ExprComponents.py +172 -102
  6. vtlengine/AST/ASTConstructorModules/Terminals.py +158 -95
  7. vtlengine/AST/ASTEncoders.py +1 -1
  8. vtlengine/AST/ASTTemplate.py +8 -9
  9. vtlengine/AST/ASTVisitor.py +8 -12
  10. vtlengine/AST/DAG/__init__.py +43 -35
  11. vtlengine/AST/DAG/_words.py +4 -4
  12. vtlengine/AST/Grammar/lexer.py +732 -142
  13. vtlengine/AST/Grammar/parser.py +2188 -826
  14. vtlengine/AST/Grammar/tokens.py +128 -128
  15. vtlengine/AST/VtlVisitor.py +7 -4
  16. vtlengine/AST/__init__.py +22 -11
  17. vtlengine/DataTypes/NumericTypesHandling.py +5 -4
  18. vtlengine/DataTypes/TimeHandling.py +194 -301
  19. vtlengine/DataTypes/__init__.py +304 -218
  20. vtlengine/Exceptions/__init__.py +52 -27
  21. vtlengine/Exceptions/messages.py +134 -62
  22. vtlengine/Interpreter/__init__.py +781 -487
  23. vtlengine/Model/__init__.py +165 -121
  24. vtlengine/Operators/Aggregation.py +156 -95
  25. vtlengine/Operators/Analytic.py +115 -59
  26. vtlengine/Operators/Assignment.py +7 -4
  27. vtlengine/Operators/Boolean.py +27 -32
  28. vtlengine/Operators/CastOperator.py +177 -131
  29. vtlengine/Operators/Clause.py +137 -99
  30. vtlengine/Operators/Comparison.py +148 -117
  31. vtlengine/Operators/Conditional.py +149 -98
  32. vtlengine/Operators/General.py +68 -47
  33. vtlengine/Operators/HROperators.py +91 -72
  34. vtlengine/Operators/Join.py +217 -118
  35. vtlengine/Operators/Numeric.py +89 -44
  36. vtlengine/Operators/RoleSetter.py +16 -15
  37. vtlengine/Operators/Set.py +61 -36
  38. vtlengine/Operators/String.py +213 -139
  39. vtlengine/Operators/Time.py +334 -216
  40. vtlengine/Operators/Validation.py +117 -76
  41. vtlengine/Operators/__init__.py +340 -213
  42. vtlengine/Utils/__init__.py +195 -40
  43. vtlengine/__init__.py +1 -1
  44. vtlengine/files/output/__init__.py +15 -6
  45. vtlengine/files/output/_time_period_representation.py +10 -9
  46. vtlengine/files/parser/__init__.py +77 -52
  47. vtlengine/files/parser/_rfc_dialect.py +6 -5
  48. vtlengine/files/parser/_time_checking.py +46 -37
  49. vtlengine-1.0.1.dist-info/METADATA +236 -0
  50. vtlengine-1.0.1.dist-info/RECORD +58 -0
  51. {vtlengine-1.0.dist-info → vtlengine-1.0.1.dist-info}/WHEEL +1 -1
  52. vtlengine-1.0.dist-info/METADATA +0 -104
  53. vtlengine-1.0.dist-info/RECORD +0 -58
  54. {vtlengine-1.0.dist-info → vtlengine-1.0.1.dist-info}/LICENSE.md +0 -0
@@ -7,83 +7,92 @@ from vtlengine.DataTypes.TimeHandling import TimePeriodHandler
7
7
  from vtlengine.Exceptions import InputValidationException
8
8
 
9
9
 
10
- def check_date(value: str):
10
+ def check_date(value: str) -> str:
11
11
  """
12
12
  Check if the date is in the correct format.
13
13
  """
14
14
  # Remove all whitespaces
15
15
  value = value.replace(" ", "")
16
16
  try:
17
- if len(value) == 9 and value[7] == '-':
18
- value = value[:-1] + '0' + value[-1]
17
+ if len(value) == 9 and value[7] == "-":
18
+ value = value[:-1] + "0" + value[-1]
19
19
  date_value = date.fromisoformat(value)
20
20
  except ValueError as e:
21
- if 'is out of range' in str(e):
21
+ if "is out of range" in str(e):
22
22
  raise InputValidationException(f"Date {value} is out of range for the month.")
23
- if 'month must be in 1..12' in str(e):
24
- raise InputValidationException(f"Date {value} is invalid. "
25
- f"Month must be between 1 and 12.")
26
- raise InputValidationException(f"Date {value} is not in the correct format. "
27
- f"Use YYYY-MM-DD.")
23
+ if "month must be in 1..12" in str(e):
24
+ raise InputValidationException(
25
+ f"Date {value} is invalid. " f"Month must be between 1 and 12."
26
+ )
27
+ raise InputValidationException(
28
+ f"Date {value} is not in the correct format. " f"Use YYYY-MM-DD."
29
+ )
28
30
 
29
31
  # Check date is between 1900 and 9999
30
32
  if not 1800 <= date_value.year <= 9999:
31
- raise InputValidationException(f"Date {value} is invalid. "
32
- f"Year must be between 1900 and 9999.")
33
+ raise InputValidationException(
34
+ f"Date {value} is invalid. " f"Year must be between 1900 and 9999."
35
+ )
33
36
 
34
37
  return date_value.isoformat()
35
38
 
36
39
 
37
- def dates_to_string(date1, date2):
38
- date1_str = date1.strftime('%Y-%m-%d')
39
- date2_str = date2.strftime('%Y-%m-%d')
40
+ def dates_to_string(date1: date, date2: date) -> str:
41
+ date1_str = date1.strftime("%Y-%m-%d")
42
+ date2_str = date2.strftime("%Y-%m-%d")
40
43
  return f"{date1_str}/{date2_str}"
41
44
 
42
45
 
43
- date_pattern = r'\d{4}[-][0-1]?\d[-][0-3]?\d'
44
- year_pattern = r'\d{4}'
45
- month_pattern = r'\d{4}[-][0-1]?\d'
46
- time_pattern = r'^' + date_pattern + r'/' + date_pattern + r'$'
46
+ date_pattern = r"\d{4}[-][0-1]?\d[-][0-3]?\d"
47
+ year_pattern = r"\d{4}"
48
+ month_pattern = r"\d{4}[-][0-1]?\d"
49
+ time_pattern = r"^" + date_pattern + r"/" + date_pattern + r"$"
47
50
 
48
51
 
49
- def check_time(value: str):
52
+ def check_time(value: str) -> str:
50
53
  value = value.replace(" ", "")
51
54
  year_result = re.fullmatch(year_pattern, value)
52
55
  if year_result is not None:
53
- date1_time = datetime.strptime(value, '%Y')
56
+ date1_time = datetime.strptime(value, "%Y")
54
57
  date2_time = date1_time.replace(day=31, month=12)
55
58
  return dates_to_string(date1_time, date2_time)
56
59
  month_result = re.fullmatch(month_pattern, value)
57
60
  if month_result is not None:
58
- date1_time = datetime.strptime(value, '%Y-%m')
61
+ date1_time = datetime.strptime(value, "%Y-%m")
59
62
  last_month_day = calendar.monthrange(date1_time.year, date1_time.month)[1]
60
63
  date2_time = date1_time.replace(day=last_month_day)
61
64
  return dates_to_string(date1_time, date2_time)
62
65
  time_result = re.fullmatch(time_pattern, value)
63
66
  if time_result is not None:
64
- time_list = value.split('/')
67
+ time_list = value.split("/")
65
68
  if time_list[0] > time_list[1]:
66
69
  raise ValueError("Start date is greater than end date.")
67
70
  return value
68
- raise ValueError("Time is not in the correct format. "
69
- "Use YYYY-MM-DD/YYYY-MM-DD or YYYY or YYYY-MM.")
71
+ raise ValueError(
72
+ "Time is not in the correct format. " "Use YYYY-MM-DD/YYYY-MM-DD or YYYY or YYYY-MM."
73
+ )
70
74
 
71
75
 
72
- day_period_pattern = r'^\d{4}[-][0-1]?\d[-][0-3]?\d$'
73
- month_period_pattern = r'^\d{4}[-][0-1]?\d$'
74
- year_period_pattern = r'^\d{4}$'
75
- period_pattern = r'^\d{4}[A]$|^\d{4}[S][1-2]$|^\d{4}[Q][1-4]$|^\d{4}[M][0-1]?\d$|^\d{4}[W][0-5]?\d$|^\d{4}[D][0-3]?[0-9]?\d$'
76
+ day_period_pattern = r"^\d{4}[-][0-1]?\d[-][0-3]?\d$"
77
+ month_period_pattern = r"^\d{4}[-][0-1]?\d$"
78
+ year_period_pattern = r"^\d{4}$"
79
+ period_pattern = (
80
+ r"^\d{4}[A]$|^\d{4}[S][1-2]$|^\d{4}[Q][1-4]$|^\d{4}[M]"
81
+ r"[0-1]?\d$|^\d{4}[W][0-5]?\d$|^\d{4}[D][0-3]?[0-9]?\d$"
82
+ )
76
83
 
77
84
  # Related with gitlab issue #440, we can say that period pattern
78
85
  # matches with our internal representation (or vtl user manual)
79
86
  # and further_options_period_pattern matches
80
87
  # with other kinds of inputs that we have to accept for the period.
81
- further_options_period_pattern = (r'\d{4}-\d{2}-\d{2}|^\d{4}-D[0-3]\d\d$|^\d{4}-W([0-4]'
82
- r'\d|5[0-3])|^\d{4}-(0[1-9]|1[0-2]|M(0[1-9]|1[0-2]|[1-9]))$|^'
83
- r'\d{4}-Q[1-4]$|^\d{4}-S[1-2]$|^\d{4}-A1$')
88
+ further_options_period_pattern = (
89
+ r"\d{4}-\d{2}-\d{2}|^\d{4}-D[0-3]\d\d$|^\d{4}-W([0-4]"
90
+ r"\d|5[0-3])|^\d{4}-(0[1-9]|1[0-2]|M(0[1-9]|1[0-2]|[1-9]))$|^"
91
+ r"\d{4}-Q[1-4]$|^\d{4}-S[1-2]$|^\d{4}-A1$"
92
+ )
84
93
 
85
94
 
86
- def check_time_period(value: str):
95
+ def check_time_period(value: str) -> str:
87
96
  value = value.replace(" ", "")
88
97
  period_result = re.fullmatch(period_pattern, value)
89
98
  if period_result is not None:
@@ -99,22 +108,22 @@ def check_time_period(value: str):
99
108
 
100
109
  year_result = re.fullmatch(year_period_pattern, value)
101
110
  if year_result is not None:
102
- year = datetime.strptime(value, '%Y')
111
+ year = datetime.strptime(value, "%Y")
103
112
  year_period_wo_A = str(year.year)
104
113
  return year_period_wo_A
105
114
  # return year_period
106
115
 
107
116
  month_result = re.fullmatch(month_period_pattern, value)
108
117
  if month_result is not None:
109
- month = datetime.strptime(value, '%Y-%m')
110
- month_period = month.strftime('%YM%m')
118
+ month = datetime.strptime(value, "%Y-%m")
119
+ month_period = month.strftime("%YM%m")
111
120
  result = TimePeriodHandler(month_period)
112
121
  return str(result)
113
122
 
114
123
  # TODO: Do we use this?
115
124
  day_result = re.fullmatch(day_period_pattern, value)
116
125
  if day_result is not None:
117
- day = datetime.strptime(value, '%Y-%m-%d')
118
- day_period = day.strftime('%YD%-j')
126
+ day = datetime.strptime(value, "%Y-%m-%d")
127
+ day_period = day.strftime("%YD%-j")
119
128
  return day_period
120
129
  raise ValueError
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.1
2
+ Name: vtlengine
3
+ Version: 1.0.1
4
+ Summary: Run and Validate VTL Scripts
5
+ License: AGPL-3.0
6
+ Author: MeaningfulData
7
+ Author-email: info@meaningfuldata.eu
8
+ Requires-Python: >=3.10,<4.0
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Information Technology
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Dist: antlr4-python3-runtime (==4.9.2)
20
+ Requires-Dist: bottleneck (>=1.3.4,<2.0.0)
21
+ Requires-Dist: duckdb (>=1.1.1,<2.0.0)
22
+ Requires-Dist: networkx (>=2.8.8,<3.0.0)
23
+ Requires-Dist: numba (>=0.60.0,<0.61.0)
24
+ Requires-Dist: numexpr (>=2.9.0,<3.0.0)
25
+ Requires-Dist: pandas (>=2.1.4,<3.0.0)
26
+ Requires-Dist: pyarrow (>=17.0.0,<18.0.0)
27
+ Requires-Dist: s3fs (>=2024.9.0,<2025.0.0)
28
+ Requires-Dist: sqlglot (>=22.2.0,<23.0.0)
29
+ Description-Content-Type: text/markdown
30
+
31
+ # VTL Engine
32
+
33
+ ## Introduction
34
+
35
+ The VTL Engine is a Python library for validating and running VTL scripts.
36
+
37
+ It is a Python-based library around the [VTL Language](http://sdmx.org/?page_id=5096).
38
+
39
+ ## Installation
40
+
41
+ ### Requirements
42
+
43
+ The VTL Engine requires Python 3.10 or higher.
44
+
45
+ ### Install with pip
46
+
47
+ To install the VTL Engine on any Operating System, you can use pip:
48
+
49
+ ```bash
50
+
51
+ pip install vtlengine
52
+
53
+ ```
54
+
55
+ *Note: it is recommended to install the VTL Engine in a virtual environment.*
56
+
57
+ ## Usage
58
+
59
+ The VTL Engine API implements two basic methods:
60
+
61
+ * **Semantic Analysis**: aimed at validating the correctness of a script and computing the data
62
+ structures of the data sets created in the script.
63
+ * **Run**: aimed at executing the provided input on the provided input datasets.
64
+
65
+ Any action with VTL requires the following elements as input:
66
+
67
+ * **VTL Script**: Is the VTL to be executed, which includes the transformation scheme, as well as de
68
+ User Defined Operators, Hierarchical Rulesets and Datapoint Rulesets. It is provided as a string
69
+ or as a Path object to a vtl file.
70
+ * **Data structures** : Provides the structure of the input artifacts of the VTL script, according to
71
+ the VTL Information model. Given that the current version doesn't prescribe a standard format for
72
+ providing the information, the VTL Engine is implementing a JSON format that can be found here.
73
+ Data Structures can be provided as Dictionaries or as Paths to JSON files. It is possible to have
74
+ * **External routines**: The VTL Engine allows using SQL (SQLite) with the eval operator. Can be
75
+ provided as a string with the SQL or as a path object to an SQL file. Its default value is `None`,
76
+ which shall be used if external routines are not applicable to the VTL script.
77
+ * **Value domains**: Provides the value domains that are used in the VTL script, normally with an in
78
+ operator. Can be provided as a dictionary or as a path to a JSON file. Its default value
79
+ is `None`, which shall be used if value domains are not applicable to the VTL script.
80
+
81
+ ### Semantic Analysis
82
+
83
+ The `semantic_analysis` method serves to validate the correctness of a VTL script, as well as to
84
+ calculate the data structures of the datasets generated by the VTL script itself (that calculation
85
+ is a pre-requisite for the semantic analysis).
86
+
87
+ * If the VTL script is correct, the method returns a dictionary with the data structures of all the
88
+ datasets generated by the script.
89
+ * If the VTL script is incorrect, raises a VTL Engine custom error Explaining the error.
90
+
91
+ #### Example 1: Correct VTL
92
+
93
+ ```python
94
+ from vtlengine import semantic_analysis
95
+
96
+ script = """
97
+ DS_A := DS_1 * 10;
98
+ """
99
+
100
+ data_structures = {
101
+ 'datasets': [
102
+ {'name': 'DS_1',
103
+ 'DataStructure': [
104
+ {'name': 'Id_1',
105
+ 'type':
106
+ 'Integer',
107
+ 'role': 'Identifier',
108
+ 'nullable': False},
109
+ {'name': 'Me_1',
110
+ 'type': 'Number',
111
+ 'role': 'Measure',
112
+ 'nullable': True}
113
+ ]
114
+ }
115
+ ]
116
+ }
117
+
118
+ sa_result = semantic_analysis(script=script, data_structures=data_structures)
119
+
120
+ print(sa_result)
121
+
122
+ ```
123
+
124
+ Returns:
125
+
126
+ ```
127
+ {'DS_A': Dataset(name='DS_A', components={'Id_1': Component(name='Id_1', data_type=<class 'vtlengine.DataTypes.Integer'>, role=<Role.IDENTIFIER: 'Identifier'>, nullable=False), 'Me_1': Component(name='Me_1', data_type=<class 'vtlengine.DataTypes.Number'>, role=<Role.MEASURE: 'Measure'>, nullable=True)}, data=None)}
128
+ ```
129
+
130
+ #### Example 2: Incorrect VTL
131
+
132
+ Note that, as compared to Example 1, the only change is that Me_1 is of the String data type,
133
+ instead of Number.
134
+
135
+ ```python
136
+ from vtlengine import semantic_analysis
137
+
138
+ script = """
139
+ DS_A := DS_1 * 10;
140
+ """
141
+
142
+ data_structures = {
143
+ 'datasets': [
144
+ {'name': 'DS_1',
145
+ 'DataStructure': [
146
+ {'name': 'Id_1',
147
+ 'type':
148
+ 'Integer',
149
+ 'role': 'Identifier',
150
+ 'nullable': False},
151
+ {'name': 'Me_1',
152
+ 'type': 'String',
153
+ 'role': 'Measure',
154
+ 'nullable': True}
155
+ ]
156
+ }
157
+ ]
158
+ }
159
+
160
+ sa_result = semantic_analysis(script=script, data_structures=data_structures)
161
+
162
+ print(sa_result)
163
+
164
+ ```
165
+
166
+ Will raise the following Error:
167
+
168
+ ``` python
169
+ raise SemanticError(code="1-1-1-2",
170
+ vtlengine.Exceptions.SemanticError: ('Invalid implicit cast from String and Integer to Number.', '1-1-1-2')
171
+ ```
172
+
173
+ ### Run VTL Scripts
174
+
175
+ The `run` method serves to execute a VTL script with input datapoints.
176
+
177
+ Returns a dictionary with all the generated Datasets.
178
+ When the output parameter is set, the engine will write the result of the computation to the output
179
+ folder, else it will include the data in the dictionary of the computed datasets.
180
+
181
+ Two validations are performed before running, which can raise errors:
182
+
183
+ * Semantic analysis: Equivalent to running the `semantic_analysis` method
184
+ * Data load analysis: Basic check of the data structure (names and types)
185
+
186
+ #### Example 3: Simple run
187
+
188
+ ```python
189
+ from vtlengine import run
190
+ import pandas as pd
191
+
192
+ script = """
193
+ DS_A := DS_1 * 10;
194
+ """
195
+
196
+ data_structures = {
197
+ 'datasets': [
198
+ {'name': 'DS_1',
199
+ 'DataStructure': [
200
+ {'name': 'Id_1',
201
+ 'type':
202
+ 'Integer',
203
+ 'role': 'Identifier',
204
+ 'nullable': False},
205
+ {'name': 'Me_1',
206
+ 'type': 'Number',
207
+ 'role': 'Measure',
208
+ 'nullable': True}
209
+ ]
210
+ }
211
+ ]
212
+ }
213
+
214
+ data_df = pd.DataFrame(
215
+ {"Id_1": [1, 2, 3],
216
+ "Me_1": [10, 20, 30]})
217
+
218
+ datapoints = {"DS_1": data_df}
219
+
220
+ run_result = run(script=script, data_structures=data_structures,
221
+ datapoints=datapoints)
222
+
223
+ print(run_result)
224
+ ```
225
+
226
+ returns:
227
+
228
+ ``` python
229
+ {'DS_A': Dataset(name='DS_A', components={'Id_1': Component(name='Id_1', data_type=<class 'vtlengine.DataTypes.Integer'>, role=<Role.IDENTIFIER: 'Identifier'>, nullable=False), 'Me_1': Component(name='Me_1', data_type=<class 'vtlengine.DataTypes.Number'>, role=<Role.MEASURE: 'Measure'>, nullable=True)}, data= Id_1 Me_1
230
+ 0 1 100.0
231
+ 1 2 200.0
232
+ 2 3 300.0)}
233
+ ```
234
+
235
+ For more information on usage, please refer to
236
+ the [API documentation](https://docs.vtlengine.meaningfuldata.eu/api.html).
@@ -0,0 +1,58 @@
1
+ vtlengine/API/_InternalApi.py,sha256=emAbB-cOtThxcgYgFUmgQB_oxiBWSrAgSGOiqFKwlEo,14177
2
+ vtlengine/API/__init__.py,sha256=gR3ZUmBJDOzPSO21b213u0xAR_OID7rzY0qs7oT04nc,10982
3
+ vtlengine/AST/ASTConstructor.py,sha256=qmHkfiVmGGAYD7NeNJz_zyGxU3t0hY-kDdkzWjCyuVw,19976
4
+ vtlengine/AST/ASTConstructorModules/Expr.py,sha256=hjPvuldphvIFM5wPTGHGRJESET24KwQGVuKHrnR6DPU,63190
5
+ vtlengine/AST/ASTConstructorModules/ExprComponents.py,sha256=tH3GESt1UJ7zfGqHSzlkbtzNDUYQKeUL6E1rMhXE_cY,33779
6
+ vtlengine/AST/ASTConstructorModules/Terminals.py,sha256=hcvgMzhWEAT1AsBZNrx80UYMf0nhcA4mbXDrcXAKQvc,25387
7
+ vtlengine/AST/ASTConstructorModules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ vtlengine/AST/ASTDataExchange.py,sha256=kPSz21DGbEv-2bZowObseqf2d2_iQj1VnrqWuD9ZwtA,140
9
+ vtlengine/AST/ASTEncoders.py,sha256=0RxSQ-4SFTOhFtQFntNeo8VT_gq4qCi92ZK7EWWqOCM,758
10
+ vtlengine/AST/ASTTemplate.py,sha256=_tpxlRoVTWK4YIODRUbxpZBzvYzLtt9Je47YsVmcyWQ,11923
11
+ vtlengine/AST/ASTVisitor.py,sha256=3QQTudBpbR4pPQdH7y07EgwuzhoGzNQ59qox8R-E3fM,500
12
+ vtlengine/AST/DAG/__init__.py,sha256=KAE0yz-kB6cBTJVBvOGcVT-fVStofDdCutjMsbITqNw,14714
13
+ vtlengine/AST/DAG/_words.py,sha256=lEuBQ_w-KoKGna-x3gFGfbX1KP4Ez5EgdomH2LOeodk,170
14
+ vtlengine/AST/Grammar/Vtl.g4,sha256=uxDPfJ14lMfxB5PyLf0f8Vb07T2z3JboU2FB22WMVz4,23776
15
+ vtlengine/AST/Grammar/VtlTokens.g4,sha256=s4NtuaC9FcXNzUEAhy-HPQozfqSkoIaluHbzk9RKYkk,9570
16
+ vtlengine/AST/Grammar/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ vtlengine/AST/Grammar/lexer.py,sha256=MzmwQbpxXPb6AlVPIZrBxKVW7YuPGTbofM3aYN_AHbo,99945
18
+ vtlengine/AST/Grammar/parser.py,sha256=3_3zhVGh7Pigt48efV_kv0fme3zifx8-6RW051u2DhY,562035
19
+ vtlengine/AST/Grammar/tokens.py,sha256=BHXadghMsT3S8mSQANtaRXDdrlFk8988Qmu-dxlTERU,2884
20
+ vtlengine/AST/VtlVisitor.py,sha256=BJMULkRXVxFEpyT3M6_t6vemVQIHeBIQlW-UuVkKbJE,35015
21
+ vtlengine/AST/__init__.py,sha256=h-66EkZH5C08sBxYBa_n7BWLfQsTKgIkm6FQTbb54cY,9528
22
+ vtlengine/DataTypes/NumericTypesHandling.py,sha256=eeSUhnRkAlcYjwbLZcuuUuJUNFWR3tVWQj8DfEHythk,1230
23
+ vtlengine/DataTypes/TimeHandling.py,sha256=BE1axi7YkR0FRa6RyXxhMjTFFPaltYrdxA3eNGBkqNY,18783
24
+ vtlengine/DataTypes/__init__.py,sha256=tAm7U383MWckZCCqoh2327XaU44qap_l8nGkmmQlh_o,21607
25
+ vtlengine/Exceptions/__init__.py,sha256=pBn8yKbZfMtawJcso5Q0B-3vgFILxuLwB91tuYrTXwE,3507
26
+ vtlengine/Exceptions/messages.py,sha256=pYS4s9ytHz0yMk6vtYEjgAs7r80c4NRIr5FMuQrN8A8,19850
27
+ vtlengine/Interpreter/__init__.py,sha256=isF1NBPdhbjzyMx9cWF_WE2C7-TrKrUNMhLDwu8Cwcs,79725
28
+ vtlengine/Model/__init__.py,sha256=4CT_kMfJOLdcRxQvvdzUxVxN1-J2LW1IIPjnewImL68,15486
29
+ vtlengine/Operators/Aggregation.py,sha256=PyJqyOHfZ6o12w5FS-y9-5zfOdNmVjq1cXtn41rtD-E,11629
30
+ vtlengine/Operators/Analytic.py,sha256=k0r1SPgSRH1tdJvG0X0suDdAxT2Wo23ZnnImpptXEO0,9993
31
+ vtlengine/Operators/Assignment.py,sha256=xCL9OocHqXvfwMLm33aM8moRoZtgwNxd6OnmVVwbP0Q,795
32
+ vtlengine/Operators/Boolean.py,sha256=9FFdmSlQLlR7cSXswQUlkD_WyFcQWqfGY5VtYwqpKb4,2890
33
+ vtlengine/Operators/CastOperator.py,sha256=yPadG3PJ6h3G0TMvt1EOZWjEFilMmkvQsnKZLorzpys,16743
34
+ vtlengine/Operators/Clause.py,sha256=GoE1CgXStq59MxbnIiMJfhPNsWtWZP7R4MTQaVzCPfA,14815
35
+ vtlengine/Operators/Comparison.py,sha256=5Efnl4fCt0hWRn1iukkSOG7s6NWB9u3I5fEsGCVvkYw,16513
36
+ vtlengine/Operators/Conditional.py,sha256=jCWXRJltdx6Tl4CWyK9HYZkcUeXeLEJHk-UX7y2vKoA,13067
37
+ vtlengine/Operators/General.py,sha256=K6fxp-IbFTDGiZrm0A194bnQo7j0IcPyu5Y4Jq-91Hk,6652
38
+ vtlengine/Operators/HROperators.py,sha256=jr6Wz-c9szhZ9luKAj3Bg1CwWbzauwlPOChzknvaBi0,8553
39
+ vtlengine/Operators/Join.py,sha256=VwYCtzqlPT75iVctomp8NPAaKi3HiCQ1Pc_K7IPhZCU,18065
40
+ vtlengine/Operators/Numeric.py,sha256=0dR_0HZymPk86jl0uD12HdFilS4xlMOlN9ffGELVElo,10801
41
+ vtlengine/Operators/RoleSetter.py,sha256=vjFmZnKPONmR2ztBbi4om7DQZkK6t2joDxMg9v_JPBA,2247
42
+ vtlengine/Operators/Set.py,sha256=7KnHUZaswz3TRcIeE1FwnI_TYR4LP4ZqbMN-bgPQU_g,7041
43
+ vtlengine/Operators/String.py,sha256=hd9bVHqCAQVrXtBNN-oJlWZRONSfeVWRpIL654GvMr8,20315
44
+ vtlengine/Operators/Time.py,sha256=5srrGi_QBSopJm2bfZAwokw94pnGjZngkMTJfBVNRUM,31815
45
+ vtlengine/Operators/Validation.py,sha256=C7w1bvc8j-dYshPNvtpN_oCGMkbsoGoyv4WBCh9o2pg,10000
46
+ vtlengine/Operators/__init__.py,sha256=CJEwWUlz827yp4lyuXPSsMCMd4IWqCOw0yYvqpB76CI,36993
47
+ vtlengine/Utils/__init__.py,sha256=Plrr6nCPPUJ2PApbqsj0GAYF4Q7GBjLufv3-vCsJB6k,6458
48
+ vtlengine/__init__.py,sha256=qmLklaVsS-yHG4QeSzGDYln49PLhFaIjBatYNwAm2Ug,89
49
+ vtlengine/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
+ vtlengine/files/output/__init__.py,sha256=X1gmR7Hwp1wKuVTEYPxJRg1cCH-9rYdJk5Ma4_iQc8o,1170
51
+ vtlengine/files/output/_time_period_representation.py,sha256=3uSMK_tHXigsKNFt5-U75ZI9pIRVi6WERFwAG6jEBz0,1580
52
+ vtlengine/files/parser/__init__.py,sha256=TT8MTquqppKxNXq0mgj0nA4jSN8ibufxaqxnofnUeqQ,8754
53
+ vtlengine/files/parser/_rfc_dialect.py,sha256=Y8kAYBxH_t9AieN_tYg7QRh5A4DgvabKarx9Ko3QeCQ,462
54
+ vtlengine/files/parser/_time_checking.py,sha256=SW89OWAnlTfzBYQDXk0GplImxZlN8XmvvGapJqQQ9Xs,4683
55
+ vtlengine-1.0.1.dist-info/LICENSE.md,sha256=2xqHuoHohba7gpcZZKtOICRjzeKsQANXG8WoV9V35KM,33893
56
+ vtlengine-1.0.1.dist-info/METADATA,sha256=aCPKAQRRY0okW85Lkw4Sx9MO1EAu_1pYJsg-dRVWVN0,7430
57
+ vtlengine-1.0.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
58
+ vtlengine-1.0.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 1.9.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,104 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: vtlengine
3
- Version: 1.0
4
- Summary: Run and Validate VTL Scripts
5
- License: AGPL-3.0
6
- Author: MeaningfulData
7
- Author-email: info@meaningfuldata.eu
8
- Requires-Python: >=3.10,<4.0
9
- Classifier: Development Status :: 4 - Beta
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Intended Audience :: Information Technology
12
- Classifier: Intended Audience :: Science/Research
13
- Classifier: License :: OSI Approved :: GNU Affero General Public License v3
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Requires-Dist: antlr4-python3-runtime (==4.9.2)
19
- Requires-Dist: bottleneck (>=1.3.4,<2.0.0)
20
- Requires-Dist: duckdb (>=1.1.1,<2.0.0)
21
- Requires-Dist: networkx (>=2.8.8,<3.0.0)
22
- Requires-Dist: numba (>=0.60.0,<0.61.0)
23
- Requires-Dist: numexpr (>=2.9.0,<3.0.0)
24
- Requires-Dist: pandas (>=2.1.4,<3.0.0)
25
- Requires-Dist: pyarrow (>=17.0.0,<18.0.0)
26
- Requires-Dist: s3fs (>=2024.9.0,<2025.0.0)
27
- Requires-Dist: sqlglot (>=22.2.0,<23.0.0)
28
- Description-Content-Type: text/markdown
29
-
30
- # VTL Engine
31
-
32
- ## Introduction
33
-
34
- The VTL Engine is a Python library that allows you to validate and run VTL scripts.
35
- It is a Python-based library around the [VTL Language](http://sdmx.org/?page_id=5096).
36
-
37
- ## Installation
38
-
39
- ### Requirements
40
-
41
- The VTL Engine requires Python 3.10 or higher.
42
-
43
- ### Install with pip
44
- To install the VTL Engine on any Operating System, you can use pip:
45
-
46
- ```bash
47
- pip install vtlengine
48
- ```
49
-
50
- *Note: it is recommended to install the VTL Engine in a virtual environment.*
51
-
52
-
53
- ## Usage
54
-
55
- ### Semantic Analysis
56
- To perform the validation of a VTL script, please use the semantic_analysis function.
57
- Here is an example:
58
-
59
- ```python
60
-
61
- from API import semantic_analysis
62
- from pathlib import Path
63
-
64
- base_path = Path(__file__).parent / "testSuite/API/data/"
65
- script = base_path / Path("vtl/1.vtl")
66
- datastructures = base_path / Path("DataStructure/input")
67
- value_domains = base_path / Path("ValueDomain/VD_1.json")
68
- external_routines = base_path / Path("sql/1.sql")
69
-
70
- semantic_analysis(script=script, data_structures=datastructures,
71
- value_domains=value_domains, external_routines=external_routines)
72
- ```
73
-
74
- The semantic analysis function will return a dictionary of the computed datasets and their structure.
75
-
76
- ### Run VTL Scripts
77
-
78
- To execute a VTL script, please use the run function. Here is an example:
79
-
80
- ```python
81
-
82
- from API import run
83
- from pathlib import Path
84
-
85
- base_path = Path(__file__).parent / "testSuite/API/data/"
86
- script = base_path / Path("vtl/1.vtl")
87
- datastructures = base_path / Path("DataStructure/input")
88
- datapoints = base_path / Path("DataSet/input")
89
- output_folder = base_path / Path("DataSet/output")
90
-
91
- value_domains = None
92
- external_routines = None
93
-
94
- run(script=script, data_structures=datastructures, datapoints=datapoints,
95
- value_domains=value_domains, external_routines=external_routines,
96
- output_path=output_folder, return_only_persistent=True
97
- )
98
- ```
99
- The VTL engine will load each datapoints file as being needed, reducing the memory footprint.
100
- When the output parameter is set, the engine will write the result of the computation
101
- to the output folder, else it will include the data in the dictionary of the computed datasets.
102
-
103
- For more information on usage, please refer to the [API documentation](https://docs.vtlengine.meaningfuldata.eu/api.html).
104
-
@@ -1,58 +0,0 @@
1
- vtlengine/API/_InternalApi.py,sha256=dYR42DbyY_umGfRXQOiz_-wGB9_jcx9Q3ooiWo--hbg,12526
2
- vtlengine/API/__init__.py,sha256=2uknCsuffQ8Mj01ETYW2esM0nhZyw_Qu2Vu5IOxuaec,10168
3
- vtlengine/AST/ASTConstructor.py,sha256=UyW_0lraVH8RZ2MmAfHt445nqDY1woc0GKEyUht4bSQ,19406
4
- vtlengine/AST/ASTConstructorModules/Expr.py,sha256=GdRbg1erybHIZEKDL26jErxjKB7_0meGZKXrUCBHHNA,62808
5
- vtlengine/AST/ASTConstructorModules/ExprComponents.py,sha256=8tVFR-gLDnqJV1lCrGf0-YH-KqydVHfzCVmya6c1-Tk,33581
6
- vtlengine/AST/ASTConstructorModules/Terminals.py,sha256=AC81AaQnM47EZtK40R9XexLqZCrJAmYd_aodwxQ5NXU,24889
7
- vtlengine/AST/ASTConstructorModules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- vtlengine/AST/ASTDataExchange.py,sha256=kPSz21DGbEv-2bZowObseqf2d2_iQj1VnrqWuD9ZwtA,140
9
- vtlengine/AST/ASTEncoders.py,sha256=a_NhyUfUEVfSFyArb-nXIM2wvQZX96OBloJy1hGF12Q,758
10
- vtlengine/AST/ASTTemplate.py,sha256=h61kxO_yfvDO3LnEhSavvN3eV8sAyffRV85GEKu-brc,11942
11
- vtlengine/AST/ASTVisitor.py,sha256=ovGXIfdCcY8ukUE5hiPbdxmAPPdHOzcS-dL-CsgwEDY,494
12
- vtlengine/AST/DAG/__init__.py,sha256=ErxDIxBY6W8d9Ed9J1fYS8Jmlv6c0RX_B0Ktt6Su8yo,14709
13
- vtlengine/AST/DAG/_words.py,sha256=b7Mgp4dL1Wd4uMDdtEmF_esxn2GR8C3mqEKO9ysuhrg,170
14
- vtlengine/AST/Grammar/Vtl.g4,sha256=uxDPfJ14lMfxB5PyLf0f8Vb07T2z3JboU2FB22WMVz4,23776
15
- vtlengine/AST/Grammar/VtlTokens.g4,sha256=s4NtuaC9FcXNzUEAhy-HPQozfqSkoIaluHbzk9RKYkk,9570
16
- vtlengine/AST/Grammar/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- vtlengine/AST/Grammar/lexer.py,sha256=2_nnGDCc6P2i0VDVfKI0Db61PWYBEuylVs50ph5F1CM,96642
18
- vtlengine/AST/Grammar/parser.py,sha256=kU7FYalgvS4IiEETlmqje4kd8BawJsrCGiPiEc6j9Zw,545780
19
- vtlengine/AST/Grammar/tokens.py,sha256=Dq4OD3kYyc6EH4wQ0JoC04KHn2gazoVEgzl7__Jrqpg,2884
20
- vtlengine/AST/VtlVisitor.py,sha256=t59fHL-gYjZSIRgE2h9R8aVLA2CVHSJ3WbHIddswX_U,35077
21
- vtlengine/AST/__init__.py,sha256=GmUtsS8J9-4k1MZifQg1ZgM_0iJaA-39h99nh4Hhiyk,9516
22
- vtlengine/DataTypes/NumericTypesHandling.py,sha256=CuQtCFHKS1voMwjk-jHZM4hD2XN4l1wJxeD3e-bGHaQ,1017
23
- vtlengine/DataTypes/TimeHandling.py,sha256=irH2wHU4luB0dVdTh-5id-rgoNlW-WnBdkH1-gbc7vM,20478
24
- vtlengine/DataTypes/__init__.py,sha256=QkkPZRzxTXGhI_GV3gFErGlNYeoDUv3qBSYxv8XnMe8,20762
25
- vtlengine/Exceptions/__init__.py,sha256=WBRLEjb0lIRO1oeqUg245MZj_fFNMsq6leZvq66lyaM,2851
26
- vtlengine/Exceptions/messages.py,sha256=LSERRfUOgXsPwVkd_1L6tJGL6AFvtuZ6MqOhb4J09uw,18655
27
- vtlengine/Interpreter/__init__.py,sha256=UK4btF5D4hJtOgXgeN7YVgiZfOFIJG0hAlX44wNqqFw,73817
28
- vtlengine/Model/__init__.py,sha256=NHVWPqlw3CuGjujo5hfsKez2Vf1EmtuRzxSiQ1w0oNQ,14778
29
- vtlengine/Operators/Aggregation.py,sha256=3COPPQT2I4Is_Dz5kwgmLn88Oine0FeN_dRH-LSZ70A,11166
30
- vtlengine/Operators/Analytic.py,sha256=Y4wI14Bclxd2CpI45UF16QbvowfUJcgva0dcBz3JoRY,9658
31
- vtlengine/Operators/Assignment.py,sha256=JA8TtcwhKNwLIEIitzEM3PTUy700Ls8iZ7tDXVQIxbo,768
32
- vtlengine/Operators/Boolean.py,sha256=itItNmFuZg9iVPpTYIQJ3xCZ83WYq5QQKT_keKb1h3Y,2973
33
- vtlengine/Operators/CastOperator.py,sha256=3JlzQNHDPkMimffV34QEdwE1p0YJgsAQoP36xfboYJI,16611
34
- vtlengine/Operators/Clause.py,sha256=hPPV0oZ1V_ExR-hLV1WJyvrbOERy22BLFizd7sd_gZc,13748
35
- vtlengine/Operators/Comparison.py,sha256=WRllEMPZyaSMMm8-4s8muWeZ3QLc9qC9Xs1X1ibSLRM,16522
36
- vtlengine/Operators/Conditional.py,sha256=g7dON5TWxO6yOMhCa_EgfYE5bHqlfjof7PEFBqVcp7E,12417
37
- vtlengine/Operators/General.py,sha256=hf9a3Vjq_S1z5Fj3Q3lykXzwmsLKlJ1Mkg7M74df9kA,6546
38
- vtlengine/Operators/HROperators.py,sha256=6k8rya5bkxR09sZm_vI9GIDWjYCZi05P_6nAzC404YE,8614
39
- vtlengine/Operators/Join.py,sha256=o1MRZ5sMiujstQrAYS57BE_SnW__6ogIVJD1LC6CKzA,15570
40
- vtlengine/Operators/Numeric.py,sha256=Sk2eXmHmnL1NPZK0UvSUMTKNYGt0anXImCor1DbH3Go,10292
41
- vtlengine/Operators/RoleSetter.py,sha256=MQQBkpfJAQ5mTvAET5hs21kxoESof_aTQNSUzvRMgcg,2075
42
- vtlengine/Operators/Set.py,sha256=14-QmJ6jM-asCf-of0zxmK-sXhMUB11N_7NCH2p6nvU,6343
43
- vtlengine/Operators/String.py,sha256=5Urz2t7bPeMXxtvA-p_WCZKhdTpk1rWl3yboNOscQI8,20069
44
- vtlengine/Operators/Time.py,sha256=2TXhkrZDdQFNOX-2juLNZhlgu0eDCmmDavqN41kAZ9U,29708
45
- vtlengine/Operators/Validation.py,sha256=0Fxxbf2SUHHOSBuqjsY6seSIuf7RPvED3RlzCCcoxHs,10052
46
- vtlengine/Operators/__init__.py,sha256=AhsShQhr0wblRXpDTAk_DYj6RUF8wKC_71DY7mav9eA,36387
47
- vtlengine/Utils/__init__.py,sha256=ePVlQjwmAyPfdiLx2zjfttHXcpYdVVxOOJfqmTVLDug,5427
48
- vtlengine/__init__.py,sha256=yQTWCUMo6A1ym0Gz8hTDzY8e9-2HIEkWT_dZsmEQscI,88
49
- vtlengine/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- vtlengine/files/output/__init__.py,sha256=AJjDcpHJOqqQTTFVlKkhKnaDqLD6ujfnVO7amViKavk,1045
51
- vtlengine/files/output/_time_period_representation.py,sha256=6jIRRjd900aay7ZtKe7S02gwV51K7_8SrIO8qW9kn4w,1579
52
- vtlengine/files/parser/__init__.py,sha256=6OIgKXQ_r4lnm6Ch2THmcUGRwywxyAdgUZmpxdfR3IQ,8492
53
- vtlengine/files/parser/_rfc_dialect.py,sha256=FGAMgp5GhovpIU-cMa1Nmwz2kbcIQPym7tmgxWzDUfk,455
54
- vtlengine/files/parser/_time_checking.py,sha256=zhq0tWAj7IFp1FdwxfFLlJ-W69VbbnUNO4slZTIC2HM,4735
55
- vtlengine-1.0.dist-info/LICENSE.md,sha256=2xqHuoHohba7gpcZZKtOICRjzeKsQANXG8WoV9V35KM,33893
56
- vtlengine-1.0.dist-info/METADATA,sha256=Ql6Lr12GZmtbE86ytN81UG2yE00iEn6vh_xEZEswkU0,3416
57
- vtlengine-1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
58
- vtlengine-1.0.dist-info/RECORD,,