tricc-oo 1.5.29__py3-none-any.whl → 1.6.0__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.
- tricc_oo/converters/tricc_to_xls_form.py +2 -2
- tricc_oo/converters/xml_to_tricc.py +8 -7
- tricc_oo/strategies/output/openmrs_form.py +6 -3
- tricc_oo/visitors/tricc.py +12 -31
- {tricc_oo-1.5.29.dist-info → tricc_oo-1.6.0.dist-info}/METADATA +1 -1
- {tricc_oo-1.5.29.dist-info → tricc_oo-1.6.0.dist-info}/RECORD +9 -9
- {tricc_oo-1.5.29.dist-info → tricc_oo-1.6.0.dist-info}/WHEEL +0 -0
- {tricc_oo-1.5.29.dist-info → tricc_oo-1.6.0.dist-info}/licenses/LICENSE +0 -0
- {tricc_oo-1.5.29.dist-info → tricc_oo-1.6.0.dist-info}/top_level.txt +0 -0
|
@@ -53,8 +53,8 @@ def get_export_name(node, replace_dots=True):
|
|
|
53
53
|
export_name = BOOLEAN_MAP[str(TRICC_FALSE_VALUE)]
|
|
54
54
|
elif value == '$this':
|
|
55
55
|
export_name = '.'
|
|
56
|
-
elif isinstance(value, str):
|
|
57
|
-
export_name = f"'{
|
|
56
|
+
elif isinstance(value, str) and not isinstance(node, str):
|
|
57
|
+
export_name = f"'{value}'"
|
|
58
58
|
else:
|
|
59
59
|
export_name = value
|
|
60
60
|
if hasattr(node, 'export_name'):
|
|
@@ -101,16 +101,16 @@ def create_activity(diagram, media_path, project):
|
|
|
101
101
|
|
|
102
102
|
external_id = diagram.attrib.get("id")
|
|
103
103
|
id = get_id(external_id, diagram.attrib.get("id"))
|
|
104
|
-
root = create_root_node(diagram)
|
|
105
|
-
|
|
104
|
+
root, name = create_root_node(diagram)
|
|
105
|
+
label = diagram.attrib.get("name")
|
|
106
106
|
form_id = diagram.attrib.get("name", None)
|
|
107
107
|
if root is not None:
|
|
108
108
|
activity = TriccNodeActivity(
|
|
109
109
|
root=root,
|
|
110
|
-
name=
|
|
110
|
+
name=name, # start node 'name' is saved in label
|
|
111
111
|
id=id,
|
|
112
112
|
external_id=external_id,
|
|
113
|
-
label=
|
|
113
|
+
label=label,
|
|
114
114
|
form_id=form_id,
|
|
115
115
|
)
|
|
116
116
|
if root.relevance is not None:
|
|
@@ -130,7 +130,7 @@ def create_activity(diagram, media_path, project):
|
|
|
130
130
|
if (
|
|
131
131
|
issubclass(n.__class__, (TriccNodeDisplayModel, TriccNodeDisplayCalculateBase))
|
|
132
132
|
and not isinstance(n, (TriccRhombusMixIn, TriccNodeRhombus, TriccNodeDisplayBridge))
|
|
133
|
-
and not n.name.startswith("label_")
|
|
133
|
+
and not n.name.startswith("label_") # FIXME
|
|
134
134
|
):
|
|
135
135
|
system = n.name.split(".")[0] if "." in n.name else "tricc"
|
|
136
136
|
if isinstance(n, TriccNodeSelectOption) and isinstance(n.select, TriccNodeSelectNotAvailable):
|
|
@@ -444,17 +444,18 @@ def create_root_node(diagram):
|
|
|
444
444
|
if elm is not None:
|
|
445
445
|
external_id = elm.attrib.get("id")
|
|
446
446
|
id = get_id(external_id, diagram.attrib.get("id"))
|
|
447
|
+
name = generate_id("start"+external_id)
|
|
447
448
|
node = TriccNodeActivityStart(
|
|
448
449
|
id=id,
|
|
449
450
|
external_id=external_id,
|
|
450
451
|
# parent=elm.attrib.get("parent"),
|
|
451
|
-
name=
|
|
452
|
+
name=name,
|
|
452
453
|
label=diagram.attrib.get("name"),
|
|
453
454
|
relevance=elm.attrib.get("relevance"),
|
|
454
455
|
instance=int(elm.attrib.get("instance") if elm.attrib.get("instance") is not None else 1),
|
|
455
456
|
)
|
|
456
457
|
load_expressions(node)
|
|
457
|
-
return node
|
|
458
|
+
return node, elm.attrib.get("name", generate_id("act"+external_id))
|
|
458
459
|
|
|
459
460
|
|
|
460
461
|
# converter XML item to object
|
|
@@ -21,6 +21,7 @@ from tricc_oo.models.tricc import (
|
|
|
21
21
|
TriccNodeSelectOption,
|
|
22
22
|
TriccNodeInputModel,
|
|
23
23
|
TriccNodeBaseModel,
|
|
24
|
+
TriccNodeSelect,
|
|
24
25
|
TriccNodeDisplayModel,
|
|
25
26
|
)
|
|
26
27
|
|
|
@@ -166,7 +167,7 @@ class OpenMRSStrategy(BaseOutPutStrategy):
|
|
|
166
167
|
'select_multiple': 'multiCheckbox',
|
|
167
168
|
'select_yesno': 'select',
|
|
168
169
|
'not_available': 'checkbox',
|
|
169
|
-
'note': '
|
|
170
|
+
'note': 'markdown'
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
# if issubclass(node.__class__, TriccNodeSelectYesNo):
|
|
@@ -408,6 +409,8 @@ class OpenMRSStrategy(BaseOutPutStrategy):
|
|
|
408
409
|
return f"'{option}'"
|
|
409
410
|
elif issubclass(r.__class__, TriccNodeInputModel):
|
|
410
411
|
return self.get_export_name(r)
|
|
412
|
+
elif issubclass(r.__class__, TriccNodeSelect):
|
|
413
|
+
return "(" + self.get_export_name(r) + " ?? [])"
|
|
411
414
|
elif issubclass(r.__class__, TriccNodeBaseModel):
|
|
412
415
|
return self.get_export_name(r)
|
|
413
416
|
else:
|
|
@@ -455,7 +458,7 @@ class OpenMRSStrategy(BaseOutPutStrategy):
|
|
|
455
458
|
return f"!({ref_expressions[0]})"
|
|
456
459
|
|
|
457
460
|
def tricc_operation_plus(self, ref_expressions):
|
|
458
|
-
return " + ".join(ref_expressions)
|
|
461
|
+
return "(" + " + ".join(ref_expressions) +")"
|
|
459
462
|
|
|
460
463
|
def tricc_operation_minus(self, ref_expressions):
|
|
461
464
|
if len(ref_expressions) > 1:
|
|
@@ -480,7 +483,7 @@ class OpenMRSStrategy(BaseOutPutStrategy):
|
|
|
480
483
|
return f"({ref_expressions[0]}.includes({ref_expressions[1]}))"
|
|
481
484
|
|
|
482
485
|
def tricc_operation_count(self, ref_expressions):
|
|
483
|
-
return f"
|
|
486
|
+
return f"{ref_expressions[0]}.length"
|
|
484
487
|
|
|
485
488
|
def tricc_operation_multiplied(self, ref_expressions):
|
|
486
489
|
return "*".join(ref_expressions)
|
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,13 @@ 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(node.__class__,
|
|
124
|
-
node.__class__, (TriccNodeDisplayBridge, TriccNodeBridge)
|
|
125
|
-
)
|
|
124
|
+
get_overall_exp = issubclass(node.__class__, (TriccNodeDisplayCalculateBase, TriccNodeProposedDiagnosis, TriccNodeDiagnosis)) and not isinstance(node, (TriccNodeDisplayBridge))
|
|
126
125
|
expression = None
|
|
127
126
|
# in case of recursive call processed_nodes will be None
|
|
128
127
|
if processed_nodes is None or is_ready_to_process(node, processed_nodes=processed_nodes):
|
|
129
128
|
expression = get_node_expression(
|
|
130
129
|
node, processed_nodes=processed_nodes, get_overall_exp=get_overall_exp, process=process
|
|
131
130
|
)
|
|
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
131
|
if (
|
|
145
132
|
issubclass(node.__class__, TriccNodeCalculateBase)
|
|
146
133
|
and not isinstance(expression, (TriccStatic, TriccReference, TriccOperation))
|
|
@@ -2156,7 +2143,7 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
|
|
|
2156
2143
|
processed_nodes=processed_nodes,
|
|
2157
2144
|
get_overall_exp=get_overall_exp,
|
|
2158
2145
|
is_prev=True,
|
|
2159
|
-
process=
|
|
2146
|
+
process=get_overall_exp,
|
|
2160
2147
|
)
|
|
2161
2148
|
if isinstance(node, TriccNodeActivity) or get_overall_exp:
|
|
2162
2149
|
add_sub_expression(act_expression_inputs, sub)
|
|
@@ -2165,11 +2152,12 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
|
|
|
2165
2152
|
|
|
2166
2153
|
if act_expression_inputs:
|
|
2167
2154
|
act_sub = or_join(act_expression_inputs)
|
|
2155
|
+
# if there is condition fallback on the calling activity condition
|
|
2168
2156
|
if act_sub == TriccStatic(True):
|
|
2169
2157
|
act_sub = get_node_expression(
|
|
2170
2158
|
prev_node.activity,
|
|
2171
2159
|
processed_nodes=processed_nodes,
|
|
2172
|
-
get_overall_exp=
|
|
2160
|
+
get_overall_exp=get_overall_exp,
|
|
2173
2161
|
is_prev=True,
|
|
2174
2162
|
negate=False,
|
|
2175
2163
|
process=process,
|
|
@@ -2256,10 +2244,7 @@ def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=
|
|
|
2256
2244
|
get_node_expression(
|
|
2257
2245
|
prev_node,
|
|
2258
2246
|
processed_nodes=processed_nodes,
|
|
2259
|
-
get_overall_exp=
|
|
2260
|
-
prev_node.__class__,
|
|
2261
|
-
(TriccNodeBridge, TriccNodeDisplayBridge)
|
|
2262
|
-
),
|
|
2247
|
+
get_overall_exp=get_overall_exp,
|
|
2263
2248
|
is_prev=True,
|
|
2264
2249
|
process=process,
|
|
2265
2250
|
)
|
|
@@ -2276,7 +2261,7 @@ def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=
|
|
|
2276
2261
|
TriccOperator.CAST_NUMBER,
|
|
2277
2262
|
[
|
|
2278
2263
|
get_node_expression(
|
|
2279
|
-
prev_node, processed_nodes=processed_nodes, get_overall_exp=
|
|
2264
|
+
prev_node, processed_nodes=processed_nodes, get_overall_exp=get_overall_exp, is_prev=True, process=process
|
|
2280
2265
|
)
|
|
2281
2266
|
],
|
|
2282
2267
|
)
|
|
@@ -2297,10 +2282,7 @@ def get_add_terms(node, processed_nodes, get_overall_exp=False, negate=False, pr
|
|
|
2297
2282
|
get_node_expression(
|
|
2298
2283
|
prev_node,
|
|
2299
2284
|
processed_nodes=processed_nodes,
|
|
2300
|
-
get_overall_exp=
|
|
2301
|
-
prev_node.__class__,
|
|
2302
|
-
(TriccNodeBridge, TriccNodeDisplayBridge)
|
|
2303
|
-
),
|
|
2285
|
+
get_overall_exp=get_overall_exp,
|
|
2304
2286
|
is_prev=True,
|
|
2305
2287
|
process=process,
|
|
2306
2288
|
)
|
|
@@ -2375,7 +2357,7 @@ def get_rhombus_terms(node, processed_nodes, get_overall_exp=False, negate=False
|
|
|
2375
2357
|
get_node_expression(
|
|
2376
2358
|
expression,
|
|
2377
2359
|
processed_nodes=processed_nodes,
|
|
2378
|
-
get_overall_exp=
|
|
2360
|
+
get_overall_exp=get_overall_exp,
|
|
2379
2361
|
is_prev=True,
|
|
2380
2362
|
process=process
|
|
2381
2363
|
)
|
|
@@ -2415,7 +2397,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
|
|
|
2415
2397
|
return get_count_terms(node, False, negate, process=process)
|
|
2416
2398
|
elif isinstance(node, TriccNodeRhombus):
|
|
2417
2399
|
return get_rhombus_terms(
|
|
2418
|
-
node, processed_nodes=processed_nodes, get_overall_exp=
|
|
2400
|
+
node, processed_nodes=processed_nodes, get_overall_exp=get_overall_exp, negate=negate, process=process
|
|
2419
2401
|
)
|
|
2420
2402
|
elif isinstance(node, (TriccNodeWait)):
|
|
2421
2403
|
# just use to force order of question
|
|
@@ -2432,7 +2414,6 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
|
|
|
2432
2414
|
)
|
|
2433
2415
|
elif isinstance(node, (TriccNodeActivityStart, TriccNodeActivityEnd)):
|
|
2434
2416
|
# the group have the relevance for the activity, not needed to replicate it
|
|
2435
|
-
# return get_prev_node_expression(node.activity, processed_nodes, get_overall_exp=False, excluded_name=None)
|
|
2436
2417
|
expression = None
|
|
2437
2418
|
elif isinstance(node, TriccNodeExclusive):
|
|
2438
2419
|
if len(node.prev_nodes) == 1:
|
|
@@ -2445,7 +2426,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
|
|
|
2445
2426
|
return get_node_expression(
|
|
2446
2427
|
node_to_negate,
|
|
2447
2428
|
processed_nodes=processed_nodes,
|
|
2448
|
-
get_overall_exp=
|
|
2429
|
+
get_overall_exp=get_overall_exp,
|
|
2449
2430
|
is_prev=True,
|
|
2450
2431
|
negate=True,
|
|
2451
2432
|
process=process,
|
|
@@ -2454,7 +2435,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
|
|
|
2454
2435
|
return get_node_expression(
|
|
2455
2436
|
node_to_negate,
|
|
2456
2437
|
processed_nodes=processed_nodes,
|
|
2457
|
-
get_overall_exp=
|
|
2438
|
+
get_overall_exp=get_overall_exp,
|
|
2458
2439
|
is_prev=True,
|
|
2459
2440
|
negate=True,
|
|
2460
2441
|
process=process,
|
|
@@ -7,9 +7,9 @@ tricc_oo/converters/codesystem_to_ocl.py,sha256=Fh7Vk73OsxljZKu1k6H9uzYwz334tpQT
|
|
|
7
7
|
tricc_oo/converters/cql_to_operation.py,sha256=PUyV_YpUY98Ox0H_F_CN3UUf_I-BhFZVOcWWKTtwecM,14492
|
|
8
8
|
tricc_oo/converters/datadictionnary.py,sha256=T2HLCBo4Am1p0kFqSH1r0PqbD8AC2IGuWkbvMvSCru0,3658
|
|
9
9
|
tricc_oo/converters/drawio_type_map.py,sha256=UCPiGs7Lw0bigKScmZUnmOhACBz-FiDq92jHkI7RTSQ,9113
|
|
10
|
-
tricc_oo/converters/tricc_to_xls_form.py,sha256=
|
|
10
|
+
tricc_oo/converters/tricc_to_xls_form.py,sha256=HZh0tQoKfRMPshJvEBwCOGqYGA1ZJLJ67bwV79qtlwk,3486
|
|
11
11
|
tricc_oo/converters/utils.py,sha256=JZrtrvvOfXwdkw49pKauzinOcauWwsy-CVcw36TjyLo,1684
|
|
12
|
-
tricc_oo/converters/xml_to_tricc.py,sha256=
|
|
12
|
+
tricc_oo/converters/xml_to_tricc.py,sha256=YltAT2wo6bPDMLRuKitqStjWW_OmSJhMpAwv2IAscfs,39544
|
|
13
13
|
tricc_oo/converters/cql/cqlLexer.py,sha256=8HArbRphcrpnAG4uogJ2rHv4tc1WLzjN0B1uFeYILAc,49141
|
|
14
14
|
tricc_oo/converters/cql/cqlListener.py,sha256=fA7-8DcS2Q69ckwjdg57-OfFHBxjTZFdoSKrtw7Hffc,57538
|
|
15
15
|
tricc_oo/converters/cql/cqlParser.py,sha256=x3KdrwX9nwENSEJ5Ex7_l5NMnu3kWBO0uLdYu4moTq0,414745
|
|
@@ -34,18 +34,18 @@ tricc_oo/strategies/output/base_output_strategy.py,sha256=M9UFR67-_CFoW681bPAeBS
|
|
|
34
34
|
tricc_oo/strategies/output/dhis2_form.py,sha256=m23EeZB7uXkNCFJr9hNGevgsA1dQqBrtX5uoy_22QRI,36500
|
|
35
35
|
tricc_oo/strategies/output/fhir_form.py,sha256=hbL921pe1Doun4IQrJuZ_Sq2fCh98G3grYie5olC4uc,15740
|
|
36
36
|
tricc_oo/strategies/output/html_form.py,sha256=qSleEZOMV_-Z04y-i-ucyd5rgAYWAyjPwMrw0IHtCRM,8604
|
|
37
|
-
tricc_oo/strategies/output/openmrs_form.py,sha256=
|
|
37
|
+
tricc_oo/strategies/output/openmrs_form.py,sha256=zAmDGMmZdIGNpil5MD-huiUvt_Dbhc2vt5qsGaCS2_k,29003
|
|
38
38
|
tricc_oo/strategies/output/spice.py,sha256=QMeoismVC3PdbvwTK0PtUjWX9jl9780fbQIXn76fMXw,10761
|
|
39
39
|
tricc_oo/strategies/output/xls_form.py,sha256=26pEea0I_owpsz9S8hoHJNzChA5b2Th8KPRIeTEMfqo,29323
|
|
40
40
|
tricc_oo/strategies/output/xlsform_cdss.py,sha256=X00Lt5MzV8TX14dR4dFI1MqllI5S1e13bKbeysWM9uA,17435
|
|
41
41
|
tricc_oo/strategies/output/xlsform_cht.py,sha256=RY_mre9j6w2vVnRFSGn5R3CuTWFjIbQyl1uWwz9Ay5E,22965
|
|
42
42
|
tricc_oo/strategies/output/xlsform_cht_hf.py,sha256=xm6SKirV3nMZvM2w54_zJcXAeAgAkq-EEqGEjnOWv6c,988
|
|
43
43
|
tricc_oo/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
-
tricc_oo/visitors/tricc.py,sha256=
|
|
44
|
+
tricc_oo/visitors/tricc.py,sha256=cgmiT26pgkmmocqi7vVMtyo9WyvYyR1nMg-cPjmUawQ,107724
|
|
45
45
|
tricc_oo/visitors/utils.py,sha256=j83aAq5s5atXi3OC0jc_uJd54a8XrHHmizeeEbWZQJg,421
|
|
46
46
|
tricc_oo/visitors/xform_pd.py,sha256=ryAnI3V9x3eTmJ2LNsUZfvl0_yfCqo6oBgeSu-WPqaE,9613
|
|
47
|
-
tricc_oo-1.
|
|
48
|
-
tricc_oo-1.
|
|
49
|
-
tricc_oo-1.
|
|
50
|
-
tricc_oo-1.
|
|
51
|
-
tricc_oo-1.
|
|
47
|
+
tricc_oo-1.6.0.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
|
|
48
|
+
tricc_oo-1.6.0.dist-info/METADATA,sha256=xhuGPgAE0OqK6f_UXRhxWsV2E5PZupPkLQ7QJzGD18k,8576
|
|
49
|
+
tricc_oo-1.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
50
|
+
tricc_oo-1.6.0.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
|
|
51
|
+
tricc_oo-1.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|