tricc-oo 1.4.18__tar.gz → 1.4.19__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.
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/PKG-INFO +1 -1
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/pyproject.toml +1 -1
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/cql_to_operation.py +17 -4
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/models/base.py +1 -1
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/serializers/xls_form.py +2 -3
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/output/xlsform_cht.py +1 -1
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/visitors/tricc.py +15 -7
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo.egg-info/PKG-INFO +1 -1
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/README.md +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/setup.cfg +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tests/build.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tests/test_cql.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tests/to_ocl.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/__init__.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/__init__.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/cql/cqlLexer.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/cql/cqlListener.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/cql/cqlParser.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/datadictionnary.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/drawio_type_map.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/tricc_to_xls_form.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/utils.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/converters/xml_to_tricc.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/models/__init__.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/models/calculate.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/models/lang.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/models/ocl.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/models/ordered_set.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/models/tricc.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/parsers/__init__.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/parsers/xml.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/serializers/__init__.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/serializers/planuml.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/__init__.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/input/__init__.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/input/base_input_strategy.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/input/drawio.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/output/spice.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/output/xls_form.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/strategies/output/xlsform_cht_hf.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/visitors/__init__.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/visitors/utils.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo/visitors/xform_pd.py +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo.egg-info/SOURCES.txt +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo.egg-info/dependency_links.txt +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo.egg-info/requires.txt +0 -0
- {tricc_oo-1.4.18 → tricc_oo-1.4.19}/tricc_oo.egg-info/top_level.txt +0 -0
|
@@ -33,6 +33,7 @@ FUNCTION_MAP = {
|
|
|
33
33
|
class cqlToXlsFormVisitor(cqlVisitor):
|
|
34
34
|
def __init__(self):
|
|
35
35
|
self.xlsform_rows = []
|
|
36
|
+
self.errors= []
|
|
36
37
|
|
|
37
38
|
def resolve_scv(self, arg):
|
|
38
39
|
|
|
@@ -42,9 +43,15 @@ class cqlToXlsFormVisitor(cqlVisitor):
|
|
|
42
43
|
# if no code or not found return None
|
|
43
44
|
if arg.startswith('"') and arg.endswith('"'):
|
|
44
45
|
return TriccReference(arg[1:-1])
|
|
45
|
-
|
|
46
|
+
elif arg.lower() in ['true', 'false']:
|
|
47
|
+
return TriccStatic(arg.lower() == 'true')
|
|
48
|
+
elif arg != 'runner':
|
|
49
|
+
self.errors.append(f"'{arg}' will be poccessed as reference ")
|
|
46
50
|
return TriccReference(arg)
|
|
47
51
|
|
|
52
|
+
else:
|
|
53
|
+
return 'runner'
|
|
54
|
+
|
|
48
55
|
def translate(self, arg, type=ANY):
|
|
49
56
|
return self.resolve_scv(arg) or str(arg)
|
|
50
57
|
|
|
@@ -368,13 +375,13 @@ class CQLErrorListener(ErrorListener):
|
|
|
368
375
|
self.errors.append(error)
|
|
369
376
|
|
|
370
377
|
def transform_cql_to_operation(cql_input, context=None):
|
|
371
|
-
|
|
378
|
+
lib_input = f"""
|
|
372
379
|
library runner
|
|
373
380
|
|
|
374
381
|
define "calc":
|
|
375
382
|
{cql_input.replace('−', '-')}
|
|
376
383
|
"""
|
|
377
|
-
input_stream = InputStream(chr(10).join(
|
|
384
|
+
input_stream = InputStream(chr(10).join(lib_input.split('\n')))
|
|
378
385
|
lexer = cqlLexer(input_stream)
|
|
379
386
|
stream = CommonTokenStream(lexer)
|
|
380
387
|
parser = cqlParser(stream)
|
|
@@ -390,12 +397,18 @@ def transform_cql_to_operation(cql_input, context=None):
|
|
|
390
397
|
# Check for errors
|
|
391
398
|
if error_listener.errors:
|
|
392
399
|
for error in error_listener.errors:
|
|
393
|
-
print(f"CQL Grammar Error: {error}")
|
|
400
|
+
print(f"CQL Grammar Error: {error} \n in:\n {cql_input}")
|
|
394
401
|
return None # Or handle errors as appropriate for your use case
|
|
395
402
|
|
|
396
403
|
# If no errors, proceed with visitor
|
|
397
404
|
visitor = cqlToXlsFormVisitor()
|
|
405
|
+
|
|
398
406
|
visitor.visit(tree)
|
|
407
|
+
if visitor.errors:
|
|
408
|
+
logger.warning(f"while visiting cql: \n{cql_input}")
|
|
409
|
+
for e in visitor.errors:
|
|
410
|
+
logger.warning(e)
|
|
411
|
+
|
|
399
412
|
return visitor.xlsform_rows[0]['calculation']
|
|
400
413
|
|
|
401
414
|
def transform_cql_lib_to_operations(cql_input):
|
|
@@ -305,7 +305,7 @@ class TriccStatic(BaseModel):
|
|
|
305
305
|
return str(self.value)
|
|
306
306
|
|
|
307
307
|
def __repr__(self):
|
|
308
|
-
return "
|
|
308
|
+
return self.__class__.__name__+":"+str(type(self.value))+':' +str(self.value)
|
|
309
309
|
|
|
310
310
|
def get_references(self):
|
|
311
311
|
return OrderedSet()
|
|
@@ -62,12 +62,11 @@ def start_group(
|
|
|
62
62
|
|
|
63
63
|
if not relevance:
|
|
64
64
|
relevance_expression = ""
|
|
65
|
-
elif isinstance(relevance_expression, TriccOperation):
|
|
65
|
+
elif isinstance(relevance_expression, (TriccOperation, TriccStatic)):
|
|
66
66
|
relevance_expression = strategy.get_tricc_operation_expression(
|
|
67
67
|
relevance_expression
|
|
68
68
|
)
|
|
69
|
-
|
|
70
|
-
relevance_expression = str(relevance_expression.value)
|
|
69
|
+
|
|
71
70
|
|
|
72
71
|
# elif is_activity:
|
|
73
72
|
# relevance_expression = TRICC_CALC_EXPRESSION.format(get_export_name(cur_group.root))
|
|
@@ -117,7 +117,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
117
117
|
# pause
|
|
118
118
|
ends = []
|
|
119
119
|
for p in self.project.pages.values():
|
|
120
|
-
p_ends = list(filter(lambda x: issubclass(x.__class__, TriccNodeEnd) and getattr(x, '
|
|
120
|
+
p_ends = list(filter(lambda x: issubclass(x.__class__, TriccNodeEnd) and getattr(x, 'process', '') == 'pause', p.nodes.values() ))
|
|
121
121
|
if p_ends:
|
|
122
122
|
ends += p_ends
|
|
123
123
|
if ends:
|
|
@@ -120,7 +120,7 @@ def process_calculate(node,processed_nodes, stashed_nodes, calculates, used_calc
|
|
|
120
120
|
node_name = node.name if not isinstance(node, TriccNodeEnd) else node.get_reference()
|
|
121
121
|
last_version = get_last_version(node_name, processed_nodes) if issubclass(node.__class__, (TriccNodeDisplayModel, TriccNodeDisplayCalculateBase, TriccNodeEnd)) and not isinstance(node, TriccNodeSelectOption) else None
|
|
122
122
|
#last_version = processed_nodes.find_prev(node, lambda item: hasattr(item, 'name') and item.name == node.name)
|
|
123
|
-
if last_version:
|
|
123
|
+
if last_version and getattr(node, 'process', '') != 'pause':
|
|
124
124
|
# 0-100 for manually specified instance. 100-200 for auto instance
|
|
125
125
|
node.version = last_version.version + 1
|
|
126
126
|
last_version.last = False
|
|
@@ -526,12 +526,15 @@ def process_reference(node, processed_nodes, calculates, used_calculates=None,
|
|
|
526
526
|
node.reference = list(modified_expression.get_references())
|
|
527
527
|
node.expression_reference = modified_expression
|
|
528
528
|
elif getattr(node, 'reference', None):
|
|
529
|
-
|
|
529
|
+
reference = node.reference
|
|
530
|
+
if isinstance(reference, list):
|
|
531
|
+
if isinstance(node, TriccNodeWait):
|
|
532
|
+
reference = [TriccOperation(TriccOperator.ISTRUE,[n]) for n in reference]
|
|
530
533
|
if len(node.reference) == 1 :
|
|
531
|
-
operation =
|
|
534
|
+
operation = reference[0]
|
|
532
535
|
else:
|
|
533
536
|
operation = and_join(
|
|
534
|
-
|
|
537
|
+
reference
|
|
535
538
|
)
|
|
536
539
|
modified_expression = process_operation_reference(
|
|
537
540
|
operation,
|
|
@@ -1468,7 +1471,7 @@ def get_node_expression( in_node, processed_nodes, is_calculate=False, is_prev=F
|
|
|
1468
1471
|
expression = None
|
|
1469
1472
|
negate_expression = None
|
|
1470
1473
|
node = in_node
|
|
1471
|
-
if isinstance(node, (TriccNodeActivityStart,TriccNodeMainStart
|
|
1474
|
+
if isinstance(node, (TriccNodeActivityStart,TriccNodeMainStart)):
|
|
1472
1475
|
if is_prev and is_calculate:
|
|
1473
1476
|
expression = get_node_expression(
|
|
1474
1477
|
node.activity,
|
|
@@ -1478,7 +1481,9 @@ def get_node_expression( in_node, processed_nodes, is_calculate=False, is_prev=F
|
|
|
1478
1481
|
negate=negate,
|
|
1479
1482
|
process=process
|
|
1480
1483
|
)
|
|
1481
|
-
|
|
1484
|
+
if isinstance(node, TriccNodeMainStart):
|
|
1485
|
+
expression = get_applicability_expression(node.activity, processed_nodes, process, expression )
|
|
1486
|
+
elif isinstance(node, (TriccNodeActivityStart)):
|
|
1482
1487
|
return None
|
|
1483
1488
|
|
|
1484
1489
|
elif isinstance(node, TriccNodeWait):
|
|
@@ -1538,7 +1543,7 @@ def get_node_expression( in_node, processed_nodes, is_calculate=False, is_prev=F
|
|
|
1538
1543
|
# else:
|
|
1539
1544
|
expression = node.expression_reference
|
|
1540
1545
|
elif not is_prev and hasattr(node, 'relevance') and isinstance(node.relevance, TriccOperation):
|
|
1541
|
-
expression = node.relevance
|
|
1546
|
+
expression = node.relevance
|
|
1542
1547
|
elif is_prev and isinstance(node, TriccNodeSelectOption):
|
|
1543
1548
|
if negate:
|
|
1544
1549
|
negate_expression = get_selected_option_expression(node, negate)
|
|
@@ -1625,6 +1630,9 @@ def get_process_skip_expression(node, processed_nodes, process, expression=None)
|
|
|
1625
1630
|
f_end_expression = get_end_expression(processed_nodes)
|
|
1626
1631
|
if f_end_expression:
|
|
1627
1632
|
end_expressions.append(f_end_expression)
|
|
1633
|
+
b_end_expression = get_end_expression(processed_nodes, 'pause')
|
|
1634
|
+
if b_end_expression:
|
|
1635
|
+
end_expressions.append(b_end_expression)
|
|
1628
1636
|
if process[0] in PROCESSES:
|
|
1629
1637
|
for p in PROCESSES[PROCESSES.index(process[0])+1:]:
|
|
1630
1638
|
p_end_expression = get_end_expression(processed_nodes, p)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|