tricc-oo 1.6.5.dev2__tar.gz → 1.6.7__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.6.5.dev2/tricc_oo.egg-info → tricc_oo-1.6.7}/PKG-INFO +1 -1
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/pyproject.toml +1 -1
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/tricc_to_xls_form.py +2 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/models/base.py +1 -1
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/xls_form.py +9 -3
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/visitors/tricc.py +52 -35
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7/tricc_oo.egg-info}/PKG-INFO +1 -1
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/LICENSE +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/README.md +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/setup.cfg +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tests/build.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tests/test_build.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tests/test_cql.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tests/to_ocl.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/__init__.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/__init__.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/cql/cqlLexer.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/cql/cqlListener.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/cql/cqlParser.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/cql_to_operation.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/datadictionnary.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/drawio_type_map.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/utils.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/converters/xml_to_tricc.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/models/__init__.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/models/calculate.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/models/lang.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/models/ocl.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/models/ordered_set.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/models/tricc.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/parsers/__init__.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/parsers/xml.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/serializers/__init__.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/serializers/planuml.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/serializers/xls_form.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/__init__.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/input/__init__.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/input/base_input_strategy.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/input/drawio.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/dhis2_form.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/fhir_form.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/html_form.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/openmrs_form.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/spice.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/xlsform_cht.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/strategies/output/xlsform_cht_hf.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/visitors/__init__.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/visitors/utils.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo/visitors/xform_pd.py +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo.egg-info/SOURCES.txt +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo.egg-info/dependency_links.txt +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo.egg-info/requires.txt +0 -0
- {tricc_oo-1.6.5.dev2 → tricc_oo-1.6.7}/tricc_oo.egg-info/top_level.txt +0 -0
|
@@ -43,6 +43,8 @@ def get_export_name(node, replace_dots=True):
|
|
|
43
43
|
value = node.name
|
|
44
44
|
elif isinstance(node, TriccStatic):
|
|
45
45
|
value = node.value
|
|
46
|
+
if isinstance(value, TriccNodeSelectOption):
|
|
47
|
+
value = value.name
|
|
46
48
|
else:
|
|
47
49
|
value = node
|
|
48
50
|
if isinstance(value, bool): # or r.value in ('true', 'false')
|
|
@@ -274,7 +274,7 @@ class TriccNodeBaseModel(TriccBaseModel):
|
|
|
274
274
|
|
|
275
275
|
|
|
276
276
|
class TriccStatic(BaseModel):
|
|
277
|
-
value: Union[str, float, int, bool]
|
|
277
|
+
value: Union[str, float, int, bool, TriccNodeBaseModel]
|
|
278
278
|
|
|
279
279
|
def __init__(self, value):
|
|
280
280
|
super().__init__(value=value)
|
|
@@ -495,7 +495,12 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
495
495
|
parts = []
|
|
496
496
|
for s in ref_expressions[1:]:
|
|
497
497
|
# for option with numeric value
|
|
498
|
-
|
|
498
|
+
if isinstance(s, str):
|
|
499
|
+
cleaned_s = s
|
|
500
|
+
elif isinstance(s, TriccNodeSelectOption):
|
|
501
|
+
cleaned_s = s.name
|
|
502
|
+
else:
|
|
503
|
+
cleaned_s = "'" + str(s) + "'"
|
|
499
504
|
parts.append(f"selected({self.clean_coalesce(ref_expressions[0])}, {cleaned_s})")
|
|
500
505
|
if len(parts) == 1:
|
|
501
506
|
return parts[0]
|
|
@@ -724,11 +729,12 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
724
729
|
# @param r reference to be translated
|
|
725
730
|
if isinstance(r, TriccOperation):
|
|
726
731
|
return self.get_tricc_operation_expression(r)
|
|
732
|
+
elif isinstance(r, (TriccStatic, str, int, float)):
|
|
733
|
+
return get_export_name(r)
|
|
727
734
|
elif isinstance(r, TriccReference):
|
|
728
735
|
logger.warning(f"reference `{r.value}` still used in a calculate")
|
|
729
736
|
return f"${{{get_export_name(r.value)}}}"
|
|
730
|
-
|
|
731
|
-
return get_export_name(r)
|
|
737
|
+
|
|
732
738
|
elif isinstance(r, TriccNodeSelectOption):
|
|
733
739
|
logger.debug(f"select option {r.get_name()} from {r.select.get_name()} was used as a reference")
|
|
734
740
|
return get_export_name(r)
|
|
@@ -1737,6 +1737,7 @@ PARENT_GROUP_PRIORITY = 6000
|
|
|
1737
1737
|
ACTIVE_ACTIVITY_PRIORITY = 5000
|
|
1738
1738
|
NON_START_ACTIVITY_PRIORITY = 4000
|
|
1739
1739
|
ACTIVE_ACTIVITY_LOWER_PRIORITY = 3000
|
|
1740
|
+
FLOW_CALCULATE_NODE_PRIORITY = 8000
|
|
1740
1741
|
RHOMBUS_PRIORITY = 1000
|
|
1741
1742
|
DEFAULT_PRIORITY = 2000
|
|
1742
1743
|
|
|
@@ -1763,6 +1764,9 @@ def reorder_node_list(node_list, group, processed_nodes):
|
|
|
1763
1764
|
# Check for non main activities
|
|
1764
1765
|
elif activity and isinstance(activity.root, TriccNodeActivityStart):
|
|
1765
1766
|
priority += NON_START_ACTIVITY_PRIORITY
|
|
1767
|
+
# Check for display calculate and end nodes with prev_nodes
|
|
1768
|
+
elif (issubclass(node.__class__, TriccNodeDisplayCalculateBase) or isinstance(node, TriccNodeEnd)) and not isinstance(node, TriccNodeActivityEnd) and hasattr(node, 'prev_nodes') and len(node.prev_nodes) > 0:
|
|
1769
|
+
priority += FLOW_CALCULATE_NODE_PRIORITY
|
|
1766
1770
|
# Check for active activities (lower priority)
|
|
1767
1771
|
elif activity and activity in active_activities:
|
|
1768
1772
|
priority += ACTIVE_ACTIVITY_LOWER_PRIORITY
|
|
@@ -2024,7 +2028,7 @@ def get_accept_diagnostic_node(code, display, severity, priority, activity):
|
|
|
2024
2028
|
return node
|
|
2025
2029
|
|
|
2026
2030
|
|
|
2027
|
-
def get_diagnostic_node(code, display, severity, priority, activity):
|
|
2031
|
+
def get_diagnostic_node(code, display, severity, priority, activity, option):
|
|
2028
2032
|
node = TriccNodeCalculate(
|
|
2029
2033
|
id=generate_id("final." + code),
|
|
2030
2034
|
name="final." + code,
|
|
@@ -2035,7 +2039,7 @@ def get_diagnostic_node(code, display, severity, priority, activity):
|
|
|
2035
2039
|
expression_reference=or_join(
|
|
2036
2040
|
[
|
|
2037
2041
|
TriccOperation(TriccOperator.ISTRUE, [TriccReference("pre_final." + code)]),
|
|
2038
|
-
TriccOperation(TriccOperator.SELECTED, [TriccReference("tricc.manual.diag"), TriccStatic(
|
|
2042
|
+
TriccOperation(TriccOperator.SELECTED, [TriccReference("tricc.manual.diag"), TriccStatic(option)]),
|
|
2039
2043
|
]
|
|
2040
2044
|
),
|
|
2041
2045
|
)
|
|
@@ -2094,9 +2098,18 @@ def create_determine_diagnosis_activity(diags):
|
|
|
2094
2098
|
group=activity,
|
|
2095
2099
|
required=TriccStatic(False),
|
|
2096
2100
|
)
|
|
2101
|
+
options = []
|
|
2097
2102
|
for proposed in diags:
|
|
2103
|
+
option = TriccNodeSelectOption(
|
|
2104
|
+
id=generate_id(proposed.name),
|
|
2105
|
+
name=proposed.name,
|
|
2106
|
+
label=proposed.label,
|
|
2107
|
+
list_name=f.list_name,
|
|
2108
|
+
relevance=proposed.activity.applicability,
|
|
2109
|
+
select=f,
|
|
2110
|
+
)
|
|
2098
2111
|
d = get_accept_diagnostic_node(proposed.name, proposed.label, proposed.severity, proposed.priority, activity)
|
|
2099
|
-
c = get_diagnostic_node(proposed.name, proposed.label, proposed.severity, proposed.priority, activity)
|
|
2112
|
+
c = get_diagnostic_node(proposed.name, proposed.label, proposed.severity, proposed.priority, activity, option)
|
|
2100
2113
|
diags_conf.append(d)
|
|
2101
2114
|
r = TriccNodeRhombus(
|
|
2102
2115
|
path=start,
|
|
@@ -2121,17 +2134,7 @@ def create_determine_diagnosis_activity(diags):
|
|
|
2121
2134
|
activity.nodes[wait2.id] = wait2
|
|
2122
2135
|
# fallback
|
|
2123
2136
|
|
|
2124
|
-
|
|
2125
|
-
TriccNodeSelectOption(
|
|
2126
|
-
id=generate_id(d.name),
|
|
2127
|
-
name=d.name,
|
|
2128
|
-
label=d.label,
|
|
2129
|
-
list_name=f.list_name,
|
|
2130
|
-
relevance=d.activity.applicability,
|
|
2131
|
-
select=f,
|
|
2132
|
-
)
|
|
2133
|
-
for d in diags
|
|
2134
|
-
]
|
|
2137
|
+
|
|
2135
2138
|
f.options = dict(zip(range(0, len(options)), options))
|
|
2136
2139
|
activity.nodes[f.id] = f
|
|
2137
2140
|
set_prev_next_node(f, end, edge_only=False)
|
|
@@ -2239,10 +2242,22 @@ def get_count_terms(node, processed_nodes, get_overall_exp, negate=False, proces
|
|
|
2239
2242
|
return TriccOperation(TriccOperator.PLUS, [TriccOperation(TriccOperator.CAST_NUMBER, [term]) for term in terms])
|
|
2240
2243
|
|
|
2241
2244
|
|
|
2245
|
+
def get_none_option(node):
|
|
2246
|
+
if hasattr(node, "options"):
|
|
2247
|
+
for opt in node.options.values():
|
|
2248
|
+
if opt.name == "opt_none":
|
|
2249
|
+
return opt
|
|
2250
|
+
return None
|
|
2251
|
+
|
|
2252
|
+
|
|
2242
2253
|
def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=False, process=None):
|
|
2243
|
-
|
|
2254
|
+
opt_none = get_none_option(prev_node)
|
|
2255
|
+
if opt_none:
|
|
2256
|
+
operation_none = TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(opt_none)])
|
|
2257
|
+
else:
|
|
2258
|
+
operation_none = TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic("opt_none")])
|
|
2244
2259
|
if isinstance(prev_node, TriccNodeSelectYesNo):
|
|
2245
|
-
return TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(prev_node.options[0]
|
|
2260
|
+
return TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(prev_node.options[0])])
|
|
2246
2261
|
elif issubclass(prev_node.__class__, TriccNodeSelect):
|
|
2247
2262
|
if negate:
|
|
2248
2263
|
return
|
|
@@ -2554,7 +2569,7 @@ def get_selected_option_expression_single(option_node, negate):
|
|
|
2554
2569
|
|
|
2555
2570
|
def get_selected_option_expression_multiple(option_node, negate):
|
|
2556
2571
|
|
|
2557
|
-
selected = TriccOperation(TriccOperator.SELECTED, [option_node.select, option_node])
|
|
2572
|
+
selected = TriccOperation(TriccOperator.SELECTED, [option_node.select, TriccStatic(option_node)])
|
|
2558
2573
|
|
|
2559
2574
|
if negate:
|
|
2560
2575
|
return TriccOperation(
|
|
@@ -2624,24 +2639,26 @@ def generate_base(node, processed_nodes, **kwargs):
|
|
|
2624
2639
|
# we don't overright if define in the diagram
|
|
2625
2640
|
if node.constraint is None:
|
|
2626
2641
|
if isinstance(node, TriccNodeSelectMultiple):
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2642
|
+
none_opt = get_none_option(node)
|
|
2643
|
+
if none_opt:
|
|
2644
|
+
node.constraint = or_join(
|
|
2645
|
+
[
|
|
2646
|
+
TriccOperation(
|
|
2647
|
+
TriccOperator.EQUAL,
|
|
2648
|
+
["$this", TriccStatic(none_opt)],
|
|
2649
|
+
),
|
|
2650
|
+
TriccOperation(
|
|
2651
|
+
TriccOperator.NOT,
|
|
2652
|
+
[
|
|
2653
|
+
TriccOperation(
|
|
2654
|
+
TriccOperator.SELECTED,
|
|
2655
|
+
["$this", TriccStatic(none_opt)],
|
|
2656
|
+
)
|
|
2657
|
+
],
|
|
2658
|
+
),
|
|
2659
|
+
]
|
|
2660
|
+
) # '.=\'opt_none\' or not(selected(.,\'opt_none\'))'
|
|
2661
|
+
node.constraint_message = "**None** cannot be selected together with choice."
|
|
2645
2662
|
elif node.tricc_type in (
|
|
2646
2663
|
TriccNodeType.integer,
|
|
2647
2664
|
TriccNodeType.decimal,
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|