tricc-oo 1.5.26__py3-none-any.whl → 1.6.8__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.
- tests/build.py +1 -0
- tests/test_build.py +260 -0
- tricc_oo/converters/tricc_to_xls_form.py +15 -6
- tricc_oo/converters/xml_to_tricc.py +9 -8
- tricc_oo/models/base.py +4 -2
- tricc_oo/serializers/xls_form.py +34 -18
- tricc_oo/strategies/output/base_output_strategy.py +7 -0
- tricc_oo/strategies/output/dhis2_form.py +908 -0
- tricc_oo/strategies/output/openmrs_form.py +52 -5
- tricc_oo/strategies/output/xls_form.py +62 -32
- tricc_oo/strategies/output/xlsform_cht.py +107 -0
- tricc_oo/visitors/tricc.py +145 -71
- {tricc_oo-1.5.26.dist-info → tricc_oo-1.6.8.dist-info}/METADATA +2 -1
- {tricc_oo-1.5.26.dist-info → tricc_oo-1.6.8.dist-info}/RECORD +17 -15
- {tricc_oo-1.5.26.dist-info → tricc_oo-1.6.8.dist-info}/WHEEL +0 -0
- {tricc_oo-1.5.26.dist-info → tricc_oo-1.6.8.dist-info}/licenses/LICENSE +0 -0
- {tricc_oo-1.5.26.dist-info → tricc_oo-1.6.8.dist-info}/top_level.txt +0 -0
tricc_oo/visitors/tricc.py
CHANGED
|
@@ -28,6 +28,7 @@ from tricc_oo.models.calculate import (
|
|
|
28
28
|
TriccNodeActivityEnd,
|
|
29
29
|
TriccNodeActivityStart,
|
|
30
30
|
TriccNodeEnd,
|
|
31
|
+
TriccNodeDiagnosis,
|
|
31
32
|
get_node_from_id,
|
|
32
33
|
|
|
33
34
|
)
|
|
@@ -120,27 +121,16 @@ def get_last_version(name, processed_nodes, _list=None):
|
|
|
120
121
|
# node is the node to calculate
|
|
121
122
|
# processed_nodes are the list of processed nodes
|
|
122
123
|
def get_node_expressions(node, processed_nodes, process=None):
|
|
123
|
-
get_overall_exp = issubclass(
|
|
124
|
-
node.__class__,
|
|
125
|
-
|
|
124
|
+
get_overall_exp = issubclass(
|
|
125
|
+
node.__class__,
|
|
126
|
+
(TriccNodeDisplayCalculateBase, TriccNodeProposedDiagnosis, TriccNodeDiagnosis)
|
|
127
|
+
) and not isinstance(node, (TriccNodeDisplayBridge))
|
|
126
128
|
expression = None
|
|
127
129
|
# in case of recursive call processed_nodes will be None
|
|
128
130
|
if processed_nodes is None or is_ready_to_process(node, processed_nodes=processed_nodes):
|
|
129
131
|
expression = get_node_expression(
|
|
130
132
|
node, processed_nodes=processed_nodes, get_overall_exp=get_overall_exp, process=process
|
|
131
133
|
)
|
|
132
|
-
|
|
133
|
-
# if get_overall_exp:
|
|
134
|
-
# if expression and (not isinstance(expression, str) or expression != '')
|
|
135
|
-
# and expression is not TriccStatic(True) :
|
|
136
|
-
# num_expression = TriccOperation(
|
|
137
|
-
# TriccOperator.CAST_NUMBER,
|
|
138
|
-
# [expression]
|
|
139
|
-
# )
|
|
140
|
-
# elif expression is TriccStatic(True) or (not expression and get_overall_exp):
|
|
141
|
-
# expression = TriccStatic(True)
|
|
142
|
-
# else:
|
|
143
|
-
# expression = None
|
|
144
134
|
if (
|
|
145
135
|
issubclass(node.__class__, TriccNodeCalculateBase)
|
|
146
136
|
and not isinstance(expression, (TriccStatic, TriccReference, TriccOperation))
|
|
@@ -186,16 +176,22 @@ def get_version_inheritance(node, last_version, processed_nodes):
|
|
|
186
176
|
node.relevance = expression
|
|
187
177
|
else:
|
|
188
178
|
node.last = False
|
|
179
|
+
|
|
180
|
+
# Create a calculate node that coalesces the previous saved value with the current node value
|
|
181
|
+
calc_id = generate_id(f"save_{node.save}")
|
|
189
182
|
calc = TriccNodeCalculate(
|
|
190
|
-
id=
|
|
191
|
-
name=node.
|
|
183
|
+
id=calc_id,
|
|
184
|
+
name=node.save,
|
|
192
185
|
path_len=node.path_len + 1,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
186
|
+
expression_reference=TriccOperation(
|
|
187
|
+
TriccOperator.COALESCE,
|
|
188
|
+
[TriccReference(node.save), last_version],
|
|
189
|
+
),
|
|
190
|
+
reference=[TriccReference(node.name)],
|
|
197
191
|
activity=node.activity,
|
|
198
192
|
group=node.group,
|
|
193
|
+
label=f"Save calculation for {node.label}",
|
|
194
|
+
last=True,
|
|
199
195
|
)
|
|
200
196
|
node.activity.nodes[calc.id] = calc
|
|
201
197
|
node.activity.calculates.append(calc)
|
|
@@ -549,6 +545,32 @@ def generate_calculates(node, calculates, used_calculates, processed_nodes, proc
|
|
|
549
545
|
for calc in list_calc:
|
|
550
546
|
node.activity.nodes[calc.id] = calc
|
|
551
547
|
add_calculate(calculates, calc)
|
|
548
|
+
|
|
549
|
+
# Add CONTAINS calculations for each option in select multiple (except opt_none)
|
|
550
|
+
if isinstance(node, TriccNodeSelectMultiple):
|
|
551
|
+
for option in node.options.values():
|
|
552
|
+
if not option.name.startswith("opt_"):
|
|
553
|
+
calc_id = generate_id(f"contains_{node.id}_{option.name}")
|
|
554
|
+
expression = TriccOperation(TriccOperator.CONTAINS, [node, TriccStatic(option.name)])
|
|
555
|
+
calc_node = TriccNodeCalculate(
|
|
556
|
+
name=option.name,
|
|
557
|
+
id=calc_id,
|
|
558
|
+
group=node.group,
|
|
559
|
+
activity=node.activity,
|
|
560
|
+
label=f"contains: {node.get_name()} contains '{option.name}'",
|
|
561
|
+
path_len=node.path_len + 1,
|
|
562
|
+
last=True,
|
|
563
|
+
expression=expression,
|
|
564
|
+
)
|
|
565
|
+
node.activity.calculates.append(calc_node)
|
|
566
|
+
last_version = set_last_version_false(calc_node, processed_nodes)
|
|
567
|
+
if last_version:
|
|
568
|
+
calc_node.expression = merge_expression(calc_node.expression, last_version)
|
|
569
|
+
processed_nodes.add(calc_node)
|
|
570
|
+
list_calc.append(calc_node)
|
|
571
|
+
node.activity.nodes[calc_node.id] = calc_node
|
|
572
|
+
add_calculate(calculates, calc_node)
|
|
573
|
+
|
|
552
574
|
return list_calc
|
|
553
575
|
|
|
554
576
|
|
|
@@ -1564,7 +1586,12 @@ def set_prev_next_node(source_node, target_node, replaced_node=None, edge_only=F
|
|
|
1564
1586
|
set_next_node(source_node, target_node, replaced_node, edge_only)
|
|
1565
1587
|
|
|
1566
1588
|
if activity and not any([(e.source == source_id) and (e.target == target_id) for e in activity.edges]):
|
|
1567
|
-
|
|
1589
|
+
if issubclass(source_node.__class__, TriccNodeSelect):
|
|
1590
|
+
label = "continue"
|
|
1591
|
+
elif isinstance(source_node, TriccNodeRhombus):
|
|
1592
|
+
label = "yes"
|
|
1593
|
+
else:
|
|
1594
|
+
label = None
|
|
1568
1595
|
activity.edges.append(TriccEdge(id=generate_id(), source=source_id, target=target_id, value=label))
|
|
1569
1596
|
|
|
1570
1597
|
|
|
@@ -1713,6 +1740,7 @@ PARENT_GROUP_PRIORITY = 6000
|
|
|
1713
1740
|
ACTIVE_ACTIVITY_PRIORITY = 5000
|
|
1714
1741
|
NON_START_ACTIVITY_PRIORITY = 4000
|
|
1715
1742
|
ACTIVE_ACTIVITY_LOWER_PRIORITY = 3000
|
|
1743
|
+
FLOW_CALCULATE_NODE_PRIORITY = 6500
|
|
1716
1744
|
RHOMBUS_PRIORITY = 1000
|
|
1717
1745
|
DEFAULT_PRIORITY = 2000
|
|
1718
1746
|
|
|
@@ -1739,6 +1767,12 @@ def reorder_node_list(node_list, group, processed_nodes):
|
|
|
1739
1767
|
# Check for non main activities
|
|
1740
1768
|
elif activity and isinstance(activity.root, TriccNodeActivityStart):
|
|
1741
1769
|
priority += NON_START_ACTIVITY_PRIORITY
|
|
1770
|
+
# Check for display calculate and end nodes with prev_nodes
|
|
1771
|
+
elif (
|
|
1772
|
+
issubclass(node.__class__, TriccNodeDisplayCalculateBase) or
|
|
1773
|
+
isinstance(node, TriccNodeEnd)
|
|
1774
|
+
) and not isinstance(node, TriccNodeActivityEnd) and hasattr(node, 'prev_nodes') and len(node.prev_nodes) > 0:
|
|
1775
|
+
priority += FLOW_CALCULATE_NODE_PRIORITY
|
|
1742
1776
|
# Check for active activities (lower priority)
|
|
1743
1777
|
elif activity and activity in active_activities:
|
|
1744
1778
|
priority += ACTIVE_ACTIVITY_LOWER_PRIORITY
|
|
@@ -1848,6 +1882,16 @@ def get_node_expression(in_node, processed_nodes, get_overall_exp=False, is_prev
|
|
|
1848
1882
|
logger.critical(f"Rhombus without expression {node.get_name()}")
|
|
1849
1883
|
elif is_prev and issubclass(node.__class__, TriccNodeDisplayCalculateBase):
|
|
1850
1884
|
expression = TriccOperation(TriccOperator.ISTRUE, [node])
|
|
1885
|
+
prev_exp_overall = get_node_expression(
|
|
1886
|
+
node,
|
|
1887
|
+
processed_nodes=processed_nodes,
|
|
1888
|
+
get_overall_exp=False,
|
|
1889
|
+
is_prev=False,
|
|
1890
|
+
process=process,
|
|
1891
|
+
negate=negate
|
|
1892
|
+
)
|
|
1893
|
+
if prev_exp_overall in [TriccStatic(True), TriccStatic(False)]:
|
|
1894
|
+
expression = prev_exp_overall
|
|
1851
1895
|
elif hasattr(node, "expression_reference") and isinstance(node.expression_reference, TriccOperation):
|
|
1852
1896
|
# if issubclass(node.__class__, TriccNodeDisplayCalculateBase):
|
|
1853
1897
|
# expression = TriccOperation(
|
|
@@ -1925,7 +1969,6 @@ def get_prev_instance_skip_expression(node, processed_nodes, process, expression
|
|
|
1925
1969
|
),
|
|
1926
1970
|
)
|
|
1927
1971
|
if expression and expression_inputs:
|
|
1928
|
-
add_sub_expression(expression_inputs, expression)
|
|
1929
1972
|
expression = nand_join(expression, or_join(expression_inputs))
|
|
1930
1973
|
elif expression_inputs:
|
|
1931
1974
|
expression = negate_term(or_join(expression_inputs))
|
|
@@ -1991,7 +2034,7 @@ def get_accept_diagnostic_node(code, display, severity, priority, activity):
|
|
|
1991
2034
|
return node
|
|
1992
2035
|
|
|
1993
2036
|
|
|
1994
|
-
def get_diagnostic_node(code, display, severity, priority, activity):
|
|
2037
|
+
def get_diagnostic_node(code, display, severity, priority, activity, option):
|
|
1995
2038
|
node = TriccNodeCalculate(
|
|
1996
2039
|
id=generate_id("final." + code),
|
|
1997
2040
|
name="final." + code,
|
|
@@ -2002,7 +2045,7 @@ def get_diagnostic_node(code, display, severity, priority, activity):
|
|
|
2002
2045
|
expression_reference=or_join(
|
|
2003
2046
|
[
|
|
2004
2047
|
TriccOperation(TriccOperator.ISTRUE, [TriccReference("pre_final." + code)]),
|
|
2005
|
-
TriccOperation(TriccOperator.SELECTED, [TriccReference("tricc.manual.diag"), TriccStatic(
|
|
2048
|
+
TriccOperation(TriccOperator.SELECTED, [TriccReference("tricc.manual.diag"), TriccStatic(option)]),
|
|
2006
2049
|
]
|
|
2007
2050
|
),
|
|
2008
2051
|
)
|
|
@@ -2061,9 +2104,19 @@ def create_determine_diagnosis_activity(diags):
|
|
|
2061
2104
|
group=activity,
|
|
2062
2105
|
required=TriccStatic(False),
|
|
2063
2106
|
)
|
|
2107
|
+
options = []
|
|
2064
2108
|
for proposed in diags:
|
|
2109
|
+
option = TriccNodeSelectOption(
|
|
2110
|
+
id=generate_id(proposed.name),
|
|
2111
|
+
name=proposed.name,
|
|
2112
|
+
label=proposed.label,
|
|
2113
|
+
list_name=f.list_name,
|
|
2114
|
+
relevance=proposed.activity.applicability,
|
|
2115
|
+
select=f,
|
|
2116
|
+
)
|
|
2117
|
+
options.append(option)
|
|
2065
2118
|
d = get_accept_diagnostic_node(proposed.name, proposed.label, proposed.severity, proposed.priority, activity)
|
|
2066
|
-
c = get_diagnostic_node(proposed.name, proposed.label, proposed.severity, proposed.priority, activity)
|
|
2119
|
+
c = get_diagnostic_node(proposed.name, proposed.label, proposed.severity, proposed.priority, activity, option)
|
|
2067
2120
|
diags_conf.append(d)
|
|
2068
2121
|
r = TriccNodeRhombus(
|
|
2069
2122
|
path=start,
|
|
@@ -2088,17 +2141,6 @@ def create_determine_diagnosis_activity(diags):
|
|
|
2088
2141
|
activity.nodes[wait2.id] = wait2
|
|
2089
2142
|
# fallback
|
|
2090
2143
|
|
|
2091
|
-
options = [
|
|
2092
|
-
TriccNodeSelectOption(
|
|
2093
|
-
id=generate_id(d.name),
|
|
2094
|
-
name=d.name,
|
|
2095
|
-
label=d.label,
|
|
2096
|
-
list_name=f.list_name,
|
|
2097
|
-
relevance=d.activity.applicability,
|
|
2098
|
-
select=f,
|
|
2099
|
-
)
|
|
2100
|
-
for d in diags
|
|
2101
|
-
]
|
|
2102
2144
|
f.options = dict(zip(range(0, len(options)), options))
|
|
2103
2145
|
activity.nodes[f.id] = f
|
|
2104
2146
|
set_prev_next_node(f, end, edge_only=False)
|
|
@@ -2141,7 +2183,7 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
|
|
|
2141
2183
|
processed_nodes=processed_nodes,
|
|
2142
2184
|
get_overall_exp=get_overall_exp,
|
|
2143
2185
|
is_prev=True,
|
|
2144
|
-
process=
|
|
2186
|
+
process=get_overall_exp,
|
|
2145
2187
|
)
|
|
2146
2188
|
if isinstance(node, TriccNodeActivity) or get_overall_exp:
|
|
2147
2189
|
add_sub_expression(act_expression_inputs, sub)
|
|
@@ -2150,11 +2192,12 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
|
|
|
2150
2192
|
|
|
2151
2193
|
if act_expression_inputs:
|
|
2152
2194
|
act_sub = or_join(act_expression_inputs)
|
|
2195
|
+
# if there is condition fallback on the calling activity condition
|
|
2153
2196
|
if act_sub == TriccStatic(True):
|
|
2154
2197
|
act_sub = get_node_expression(
|
|
2155
2198
|
prev_node.activity,
|
|
2156
2199
|
processed_nodes=processed_nodes,
|
|
2157
|
-
get_overall_exp=
|
|
2200
|
+
get_overall_exp=get_overall_exp,
|
|
2158
2201
|
is_prev=True,
|
|
2159
2202
|
negate=False,
|
|
2160
2203
|
process=process,
|
|
@@ -2205,10 +2248,22 @@ def get_count_terms(node, processed_nodes, get_overall_exp, negate=False, proces
|
|
|
2205
2248
|
return TriccOperation(TriccOperator.PLUS, [TriccOperation(TriccOperator.CAST_NUMBER, [term]) for term in terms])
|
|
2206
2249
|
|
|
2207
2250
|
|
|
2251
|
+
def get_none_option(node):
|
|
2252
|
+
if hasattr(node, "options"):
|
|
2253
|
+
for opt in node.options.values():
|
|
2254
|
+
if opt.name == "opt_none":
|
|
2255
|
+
return opt
|
|
2256
|
+
return None
|
|
2257
|
+
|
|
2258
|
+
|
|
2208
2259
|
def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=False, process=None):
|
|
2209
|
-
|
|
2260
|
+
opt_none = get_none_option(prev_node)
|
|
2261
|
+
if opt_none:
|
|
2262
|
+
operation_none = TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(opt_none)])
|
|
2263
|
+
else:
|
|
2264
|
+
operation_none = TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic("opt_none")])
|
|
2210
2265
|
if isinstance(prev_node, TriccNodeSelectYesNo):
|
|
2211
|
-
return TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(prev_node.options[0]
|
|
2266
|
+
return TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(prev_node.options[0])])
|
|
2212
2267
|
elif issubclass(prev_node.__class__, TriccNodeSelect):
|
|
2213
2268
|
if negate:
|
|
2214
2269
|
return
|
|
@@ -2241,7 +2296,7 @@ def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=
|
|
|
2241
2296
|
get_node_expression(
|
|
2242
2297
|
prev_node,
|
|
2243
2298
|
processed_nodes=processed_nodes,
|
|
2244
|
-
get_overall_exp=
|
|
2299
|
+
get_overall_exp=get_overall_exp,
|
|
2245
2300
|
is_prev=True,
|
|
2246
2301
|
process=process,
|
|
2247
2302
|
)
|
|
@@ -2258,7 +2313,11 @@ def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=
|
|
|
2258
2313
|
TriccOperator.CAST_NUMBER,
|
|
2259
2314
|
[
|
|
2260
2315
|
get_node_expression(
|
|
2261
|
-
prev_node,
|
|
2316
|
+
prev_node,
|
|
2317
|
+
processed_nodes=processed_nodes,
|
|
2318
|
+
get_overall_exp=get_overall_exp,
|
|
2319
|
+
is_prev=True,
|
|
2320
|
+
process=process
|
|
2262
2321
|
)
|
|
2263
2322
|
],
|
|
2264
2323
|
)
|
|
@@ -2279,7 +2338,7 @@ def get_add_terms(node, processed_nodes, get_overall_exp=False, negate=False, pr
|
|
|
2279
2338
|
get_node_expression(
|
|
2280
2339
|
prev_node,
|
|
2281
2340
|
processed_nodes=processed_nodes,
|
|
2282
|
-
get_overall_exp=
|
|
2341
|
+
get_overall_exp=get_overall_exp,
|
|
2283
2342
|
is_prev=True,
|
|
2284
2343
|
process=process,
|
|
2285
2344
|
)
|
|
@@ -2352,7 +2411,11 @@ def get_rhombus_terms(node, processed_nodes, get_overall_exp=False, negate=False
|
|
|
2352
2411
|
TriccOperator.CAST_NUMBER,
|
|
2353
2412
|
[
|
|
2354
2413
|
get_node_expression(
|
|
2355
|
-
expression,
|
|
2414
|
+
expression,
|
|
2415
|
+
processed_nodes=processed_nodes,
|
|
2416
|
+
get_overall_exp=get_overall_exp,
|
|
2417
|
+
is_prev=True,
|
|
2418
|
+
process=process
|
|
2356
2419
|
)
|
|
2357
2420
|
],
|
|
2358
2421
|
)
|
|
@@ -2390,7 +2453,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
|
|
|
2390
2453
|
return get_count_terms(node, False, negate, process=process)
|
|
2391
2454
|
elif isinstance(node, TriccNodeRhombus):
|
|
2392
2455
|
return get_rhombus_terms(
|
|
2393
|
-
node, processed_nodes=processed_nodes, get_overall_exp=
|
|
2456
|
+
node, processed_nodes=processed_nodes, get_overall_exp=get_overall_exp, negate=negate, process=process
|
|
2394
2457
|
)
|
|
2395
2458
|
elif isinstance(node, (TriccNodeWait)):
|
|
2396
2459
|
# just use to force order of question
|
|
@@ -2407,7 +2470,6 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
|
|
|
2407
2470
|
)
|
|
2408
2471
|
elif isinstance(node, (TriccNodeActivityStart, TriccNodeActivityEnd)):
|
|
2409
2472
|
# the group have the relevance for the activity, not needed to replicate it
|
|
2410
|
-
# return get_prev_node_expression(node.activity, processed_nodes, get_overall_exp=False, excluded_name=None)
|
|
2411
2473
|
expression = None
|
|
2412
2474
|
elif isinstance(node, TriccNodeExclusive):
|
|
2413
2475
|
if len(node.prev_nodes) == 1:
|
|
@@ -2420,7 +2482,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
|
|
|
2420
2482
|
return get_node_expression(
|
|
2421
2483
|
node_to_negate,
|
|
2422
2484
|
processed_nodes=processed_nodes,
|
|
2423
|
-
get_overall_exp=
|
|
2485
|
+
get_overall_exp=get_overall_exp,
|
|
2424
2486
|
is_prev=True,
|
|
2425
2487
|
negate=True,
|
|
2426
2488
|
process=process,
|
|
@@ -2429,7 +2491,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
|
|
|
2429
2491
|
return get_node_expression(
|
|
2430
2492
|
node_to_negate,
|
|
2431
2493
|
processed_nodes=processed_nodes,
|
|
2432
|
-
get_overall_exp=
|
|
2494
|
+
get_overall_exp=get_overall_exp,
|
|
2433
2495
|
is_prev=True,
|
|
2434
2496
|
negate=True,
|
|
2435
2497
|
process=process,
|
|
@@ -2517,7 +2579,7 @@ def get_selected_option_expression_single(option_node, negate):
|
|
|
2517
2579
|
|
|
2518
2580
|
def get_selected_option_expression_multiple(option_node, negate):
|
|
2519
2581
|
|
|
2520
|
-
selected = TriccOperation(TriccOperator.SELECTED, [option_node.select, option_node])
|
|
2582
|
+
selected = TriccOperation(TriccOperator.SELECTED, [option_node.select, TriccStatic(option_node)])
|
|
2521
2583
|
|
|
2522
2584
|
if negate:
|
|
2523
2585
|
return TriccOperation(
|
|
@@ -2587,24 +2649,26 @@ def generate_base(node, processed_nodes, **kwargs):
|
|
|
2587
2649
|
# we don't overright if define in the diagram
|
|
2588
2650
|
if node.constraint is None:
|
|
2589
2651
|
if isinstance(node, TriccNodeSelectMultiple):
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2652
|
+
none_opt = get_none_option(node)
|
|
2653
|
+
if none_opt:
|
|
2654
|
+
node.constraint = or_join(
|
|
2655
|
+
[
|
|
2656
|
+
TriccOperation(
|
|
2657
|
+
TriccOperator.EQUAL,
|
|
2658
|
+
["$this", TriccStatic(none_opt)],
|
|
2659
|
+
),
|
|
2660
|
+
TriccOperation(
|
|
2661
|
+
TriccOperator.NOT,
|
|
2662
|
+
[
|
|
2663
|
+
TriccOperation(
|
|
2664
|
+
TriccOperator.SELECTED,
|
|
2665
|
+
["$this", TriccStatic(none_opt)],
|
|
2666
|
+
)
|
|
2667
|
+
],
|
|
2668
|
+
),
|
|
2669
|
+
]
|
|
2670
|
+
) # '.=\'opt_none\' or not(selected(.,\'opt_none\'))'
|
|
2671
|
+
node.constraint_message = "**None** cannot be selected together with choice."
|
|
2608
2672
|
elif node.tricc_type in (
|
|
2609
2673
|
TriccNodeType.integer,
|
|
2610
2674
|
TriccNodeType.decimal,
|
|
@@ -2613,10 +2677,20 @@ def generate_base(node, processed_nodes, **kwargs):
|
|
|
2613
2677
|
constraints_min = ""
|
|
2614
2678
|
constraints_max = ""
|
|
2615
2679
|
if node.min is not None and node.min != "":
|
|
2616
|
-
|
|
2617
|
-
|
|
2680
|
+
node.min = float(node.min)
|
|
2681
|
+
if int(node.min) == node.min:
|
|
2682
|
+
node.min = int(node.min)
|
|
2683
|
+
constraints.append(
|
|
2684
|
+
TriccOperation(TriccOperator.MORE_OR_EQUAL, ["$this", TriccStatic(node.min)])
|
|
2685
|
+
)
|
|
2686
|
+
constraints_min = "The minimum value is {0}.".format(node.min)
|
|
2618
2687
|
if node.max is not None and node.max != "":
|
|
2619
|
-
|
|
2688
|
+
node.max = float(node.max)
|
|
2689
|
+
if int(node.max) == node.max:
|
|
2690
|
+
node.max = int(node.max)
|
|
2691
|
+
constraints.append(
|
|
2692
|
+
TriccOperation(TriccOperator.LESS_OR_EQUAL, ["$this", TriccStatic(node.max)])
|
|
2693
|
+
)
|
|
2620
2694
|
constraints_max = "The maximum value is {0}.".format(node.max)
|
|
2621
2695
|
if len(constraints) > 1:
|
|
2622
2696
|
node.constraint = TriccOperation(TriccOperator.AND, constraints)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tricc-oo
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.8
|
|
4
4
|
Summary: Python library that converts CDSS L2 in L3
|
|
5
5
|
Project-URL: Homepage, https://github.com/SwissTPH/tricc
|
|
6
6
|
Project-URL: Issues, https://github.com/SwissTPH/tricc/issues
|
|
@@ -24,6 +24,7 @@ Requires-Dist: antlr4-python3-runtime==4.13.2
|
|
|
24
24
|
Requires-Dist: antlr4-tools==0.2.1
|
|
25
25
|
Requires-Dist: beautifulsoup4
|
|
26
26
|
Requires-Dist: ocldev
|
|
27
|
+
Requires-Dist: pyxform
|
|
27
28
|
Dynamic: license-file
|
|
28
29
|
|
|
29
30
|
# TRICC-OO
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
tests/build.py,sha256=
|
|
1
|
+
tests/build.py,sha256=Qbxvjkj_Wk2nQ-WjaMGiE1FIe3SRmJMRIgeoMoxqlfQ,6748
|
|
2
|
+
tests/test_build.py,sha256=5t8iliPe_0XwoZjSGkHxUbZaNOWBfc6SpIQijh9DLUA,10037
|
|
2
3
|
tests/test_cql.py,sha256=dAsLMqVaS6qxnq62fg5KqTFu6UG6pHO6Ab3NZ1c9T3Y,5248
|
|
3
4
|
tests/to_ocl.py,sha256=4e-i65K3UM6wHgdVcrZcM9AyL1bahIsXJiZTXhhHgQk,2048
|
|
4
5
|
tricc_oo/__init__.py,sha256=oWCE1ubmC_6iqaWOMgTei4eXVQgV202Ia-tXS1NnW_4,139
|
|
@@ -7,15 +8,15 @@ tricc_oo/converters/codesystem_to_ocl.py,sha256=Fh7Vk73OsxljZKu1k6H9uzYwz334tpQT
|
|
|
7
8
|
tricc_oo/converters/cql_to_operation.py,sha256=PUyV_YpUY98Ox0H_F_CN3UUf_I-BhFZVOcWWKTtwecM,14492
|
|
8
9
|
tricc_oo/converters/datadictionnary.py,sha256=T2HLCBo4Am1p0kFqSH1r0PqbD8AC2IGuWkbvMvSCru0,3658
|
|
9
10
|
tricc_oo/converters/drawio_type_map.py,sha256=UCPiGs7Lw0bigKScmZUnmOhACBz-FiDq92jHkI7RTSQ,9113
|
|
10
|
-
tricc_oo/converters/tricc_to_xls_form.py,sha256=
|
|
11
|
+
tricc_oo/converters/tricc_to_xls_form.py,sha256=wsWv4aA0QssY7ry9R7KsuuMzVfovj9fwE3i9AtCum0c,3842
|
|
11
12
|
tricc_oo/converters/utils.py,sha256=JZrtrvvOfXwdkw49pKauzinOcauWwsy-CVcw36TjyLo,1684
|
|
12
|
-
tricc_oo/converters/xml_to_tricc.py,sha256=
|
|
13
|
+
tricc_oo/converters/xml_to_tricc.py,sha256=PEBe8N-JIGJMVX2FO3UVxRcy5GrGsMvgcArEwUXmr6o,39572
|
|
13
14
|
tricc_oo/converters/cql/cqlLexer.py,sha256=8HArbRphcrpnAG4uogJ2rHv4tc1WLzjN0B1uFeYILAc,49141
|
|
14
15
|
tricc_oo/converters/cql/cqlListener.py,sha256=fA7-8DcS2Q69ckwjdg57-OfFHBxjTZFdoSKrtw7Hffc,57538
|
|
15
16
|
tricc_oo/converters/cql/cqlParser.py,sha256=x3KdrwX9nwENSEJ5Ex7_l5NMnu3kWBO0uLdYu4moTq0,414745
|
|
16
17
|
tricc_oo/converters/cql/cqlVisitor.py,sha256=iHuup2S7OGSVWLEcI4H3oecRqgXztC1sKnew_1P2iGY,33880
|
|
17
18
|
tricc_oo/models/__init__.py,sha256=CgS52LLqdDIaXHvZy08hhu_VaYw80OEdfL_llM9ICBA,108
|
|
18
|
-
tricc_oo/models/base.py,sha256=
|
|
19
|
+
tricc_oo/models/base.py,sha256=saMpSiXnvQe_xkQ4PKJbNLqPkzZaiEGwb42HJ1CtwfM,25937
|
|
19
20
|
tricc_oo/models/calculate.py,sha256=uNP0IDUqPQcJq9Co05H8eX5wbR_DikSxuOHxfVE5Dxg,8018
|
|
20
21
|
tricc_oo/models/lang.py,sha256=ZMRwdoPWe01wEDhOM0uRk-6rt3BkoAAZM8mZ61--s3A,2265
|
|
21
22
|
tricc_oo/models/ocl.py,sha256=MybSeB6fgCOUVJ4aektff0vrrTZsyfwZ2Gt_pPBu_FY,8728
|
|
@@ -25,26 +26,27 @@ tricc_oo/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
25
26
|
tricc_oo/parsers/xml.py,sha256=uzkb1y18MHfqVFmZqVh0sKT4cx6u0-NcAT_lV_gHBt8,4208
|
|
26
27
|
tricc_oo/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
28
|
tricc_oo/serializers/planuml.py,sha256=t57587-6L3aDncpHh58lS77Zft8yxDE9DPtXx2BeUSU,132
|
|
28
|
-
tricc_oo/serializers/xls_form.py,sha256=
|
|
29
|
+
tricc_oo/serializers/xls_form.py,sha256=L0WF774zFt6PbdqncJGeyZzM9NiLq9NY5vO98yGTLhM,22133
|
|
29
30
|
tricc_oo/strategies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
31
|
tricc_oo/strategies/input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
32
|
tricc_oo/strategies/input/base_input_strategy.py,sha256=BEODXS74na1QRRcJVQ4cxiD8F7uRqaLyhE3QzKpGVvk,3891
|
|
32
33
|
tricc_oo/strategies/input/drawio.py,sha256=uXAUPhXOeg0Uk_BNqlCqFBW4cWNox4VfH559bj1fhC0,12767
|
|
33
|
-
tricc_oo/strategies/output/base_output_strategy.py,sha256=
|
|
34
|
+
tricc_oo/strategies/output/base_output_strategy.py,sha256=i9L5CVUqkEAMNyBsdHJ4xA7Nptr3myHr_fHHveDX1cU,8928
|
|
35
|
+
tricc_oo/strategies/output/dhis2_form.py,sha256=jW9NW72_61ch1bHm8ShIH4xsJH-HMlZGPTT5txJxMUk,38278
|
|
34
36
|
tricc_oo/strategies/output/fhir_form.py,sha256=hbL921pe1Doun4IQrJuZ_Sq2fCh98G3grYie5olC4uc,15740
|
|
35
37
|
tricc_oo/strategies/output/html_form.py,sha256=qSleEZOMV_-Z04y-i-ucyd5rgAYWAyjPwMrw0IHtCRM,8604
|
|
36
|
-
tricc_oo/strategies/output/openmrs_form.py,sha256=
|
|
38
|
+
tricc_oo/strategies/output/openmrs_form.py,sha256=ne6TwAyhafR-WDs27QTKKFl85VD5sij_VEJtK6ZjOIE,28996
|
|
37
39
|
tricc_oo/strategies/output/spice.py,sha256=QMeoismVC3PdbvwTK0PtUjWX9jl9780fbQIXn76fMXw,10761
|
|
38
|
-
tricc_oo/strategies/output/xls_form.py,sha256=
|
|
40
|
+
tricc_oo/strategies/output/xls_form.py,sha256=_pNTND7n-55EjRphJ1hSVtRYa-UkXlmwpam2OKQ8o_w,30860
|
|
39
41
|
tricc_oo/strategies/output/xlsform_cdss.py,sha256=X00Lt5MzV8TX14dR4dFI1MqllI5S1e13bKbeysWM9uA,17435
|
|
40
|
-
tricc_oo/strategies/output/xlsform_cht.py,sha256=
|
|
42
|
+
tricc_oo/strategies/output/xlsform_cht.py,sha256=eKAc6LLDnvdZ5m8a2Vk6eAhvPbUvOfykgYr0ou3an9k,27164
|
|
41
43
|
tricc_oo/strategies/output/xlsform_cht_hf.py,sha256=xm6SKirV3nMZvM2w54_zJcXAeAgAkq-EEqGEjnOWv6c,988
|
|
42
44
|
tricc_oo/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
|
-
tricc_oo/visitors/tricc.py,sha256=
|
|
45
|
+
tricc_oo/visitors/tricc.py,sha256=8fULbAxKSeEtPyD5TYTaIG8-20Bjg2iZmzxcJM70n18,110295
|
|
44
46
|
tricc_oo/visitors/utils.py,sha256=j83aAq5s5atXi3OC0jc_uJd54a8XrHHmizeeEbWZQJg,421
|
|
45
47
|
tricc_oo/visitors/xform_pd.py,sha256=ryAnI3V9x3eTmJ2LNsUZfvl0_yfCqo6oBgeSu-WPqaE,9613
|
|
46
|
-
tricc_oo-1.
|
|
47
|
-
tricc_oo-1.
|
|
48
|
-
tricc_oo-1.
|
|
49
|
-
tricc_oo-1.
|
|
50
|
-
tricc_oo-1.
|
|
48
|
+
tricc_oo-1.6.8.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
|
|
49
|
+
tricc_oo-1.6.8.dist-info/METADATA,sha256=g9u0_NdvNT8FFgNB3LQzsUADmGqL1PBB1DPdnCBKVuI,8599
|
|
50
|
+
tricc_oo-1.6.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
51
|
+
tricc_oo-1.6.8.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
|
|
52
|
+
tricc_oo-1.6.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|