tricc-oo 1.4.25__py3-none-any.whl → 1.4.27__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/models/base.py +3 -1
- tricc_oo/models/ordered_set.py +1 -1
- tricc_oo/serializers/xls_form.py +0 -2
- tricc_oo/strategies/output/xls_form.py +1 -2
- tricc_oo/visitors/tricc.py +13 -12
- tricc_oo/visitors/xform_pd.py +11 -6
- {tricc_oo-1.4.25.dist-info → tricc_oo-1.4.27.dist-info}/METADATA +1 -1
- {tricc_oo-1.4.25.dist-info → tricc_oo-1.4.27.dist-info}/RECORD +10 -10
- {tricc_oo-1.4.25.dist-info → tricc_oo-1.4.27.dist-info}/WHEEL +1 -1
- {tricc_oo-1.4.25.dist-info → tricc_oo-1.4.27.dist-info}/top_level.txt +0 -0
tricc_oo/models/base.py
CHANGED
|
@@ -630,6 +630,8 @@ def not_clean(a):
|
|
|
630
630
|
# @param list_or
|
|
631
631
|
# @param and elm use upstream
|
|
632
632
|
def clean_or_list(list_or, elm_and=None):
|
|
633
|
+
if TriccStatic(True) in list_or:
|
|
634
|
+
return [TriccStatic(True)]
|
|
633
635
|
for a in list(list_or):
|
|
634
636
|
if isinstance(a, TriccOperation) and a.operator == TriccOperator.OR:
|
|
635
637
|
list_or.remove(a)
|
|
@@ -694,7 +696,7 @@ def simple_and_join(left, right):
|
|
|
694
696
|
)
|
|
695
697
|
|
|
696
698
|
def or_join(list_or, elm_and=None):
|
|
697
|
-
cleaned_list = clean_or_list(list_or, elm_and)
|
|
699
|
+
cleaned_list = clean_or_list(set(list_or), elm_and)
|
|
698
700
|
if len(cleaned_list) == 1:
|
|
699
701
|
return cleaned_list[0]
|
|
700
702
|
elif len(cleaned_list)>1:
|
tricc_oo/models/ordered_set.py
CHANGED
|
@@ -106,7 +106,7 @@ class OrderedSet(Sequence):
|
|
|
106
106
|
|
|
107
107
|
# If the object is not in the OrderedSet, start from the end
|
|
108
108
|
if obj not in self._od:
|
|
109
|
-
start_index = len(keys)
|
|
109
|
+
start_index = len(keys)
|
|
110
110
|
else:
|
|
111
111
|
# Find the index of the given object
|
|
112
112
|
start_index = keys.index(obj)
|
tricc_oo/serializers/xls_form.py
CHANGED
|
@@ -633,8 +633,7 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
633
633
|
# we don't overright if define in the diagram
|
|
634
634
|
if node.constraint is None:
|
|
635
635
|
if isinstance(node, TriccNodeSelectMultiple):
|
|
636
|
-
node.constraint =
|
|
637
|
-
TriccOperator.OR,
|
|
636
|
+
node.constraint = or_join(
|
|
638
637
|
[
|
|
639
638
|
TriccOperation(TriccOperator.EQUAL, ['$this', TriccStatic('opt_none')]),
|
|
640
639
|
TriccOperation(TriccOperator.NOT, [
|
tricc_oo/visitors/tricc.py
CHANGED
|
@@ -74,7 +74,7 @@ def get_node_expressions(node, processed_nodes, process=None):
|
|
|
74
74
|
expression = get_node_expression(node, processed_nodes=processed_nodes, is_calculate=is_calculate, process=process)
|
|
75
75
|
|
|
76
76
|
if is_calculate:
|
|
77
|
-
if expression and (not isinstance(expression, str) or expression != '') and expression is not True
|
|
77
|
+
if expression and (not isinstance(expression, str) or expression != '') and expression is not True :
|
|
78
78
|
num_expression = TriccOperation(
|
|
79
79
|
TriccOperator.CAST_NUMBER,
|
|
80
80
|
[expression]
|
|
@@ -96,7 +96,7 @@ def get_node_expressions(node, processed_nodes, process=None):
|
|
|
96
96
|
def set_last_version_false(node, processed_nodes):
|
|
97
97
|
node_name = node.name if not isinstance(node, TriccNodeEnd) else node.get_reference()
|
|
98
98
|
#last_version = get_last_version(node_name, processed_nodes) if issubclass(node.__class__, (TriccNodeDisplayModel, TriccNodeDisplayCalculateBase, TriccNodeEnd)) and not isinstance(node, TriccNodeSelectOption) else None
|
|
99
|
-
last_version = processed_nodes.find_prev(node, lambda item: item.id != node.id and hasattr(item, 'name') and item.name ==
|
|
99
|
+
last_version = processed_nodes.find_prev(node, lambda item: item.id != node.id and hasattr(item, 'name') and item.name == node_name and issubclass(item.__class__, (TriccNodeDisplayModel, TriccNodeDisplayCalculateBase, TriccNodeEnd)) and not isinstance(item, TriccNodeSelectOption))
|
|
100
100
|
if last_version and getattr(node, 'process', '') != 'pause':
|
|
101
101
|
# 0-100 for manually specified instance. 100-200 for auto instance
|
|
102
102
|
node.version = get_next_version(node.name, processed_nodes, last_version.version + 1, 0)
|
|
@@ -152,8 +152,7 @@ def get_version_inheritance(node, last_version, processed_nodes):
|
|
|
152
152
|
def merge_expression(expression, last_version):
|
|
153
153
|
datatype = expression.get_datatype()
|
|
154
154
|
if datatype == 'boolean':
|
|
155
|
-
expression =
|
|
156
|
-
TriccOperator.OR,
|
|
155
|
+
expression = or_join(
|
|
157
156
|
[TriccOperation(TriccOperator.ISTRUE, [last_version]), expression]
|
|
158
157
|
)
|
|
159
158
|
|
|
@@ -1498,7 +1497,7 @@ def get_node_expression( in_node, processed_nodes, is_calculate=False, is_prev=F
|
|
|
1498
1497
|
if isinstance(node, TriccNodeMainStart):
|
|
1499
1498
|
expression = get_applicability_expression(node.activity, processed_nodes, process, expression )
|
|
1500
1499
|
elif isinstance(node, (TriccNodeActivityStart)):
|
|
1501
|
-
return
|
|
1500
|
+
return TriccStatic(True)
|
|
1502
1501
|
|
|
1503
1502
|
elif isinstance(node, TriccNodeWait):
|
|
1504
1503
|
if is_prev:
|
|
@@ -1557,9 +1556,7 @@ def get_node_expression( in_node, processed_nodes, is_calculate=False, is_prev=F
|
|
|
1557
1556
|
# TriccOperator.CAST_NUMBER,
|
|
1558
1557
|
# [node.expression_reference])
|
|
1559
1558
|
# else:
|
|
1560
|
-
expression = node.expression_reference
|
|
1561
|
-
elif not is_prev and hasattr(node, 'relevance') and isinstance(node.relevance, TriccOperation):
|
|
1562
|
-
expression = node.relevance
|
|
1559
|
+
expression = node.expression_reference
|
|
1563
1560
|
elif is_prev and isinstance(node, TriccNodeSelectOption):
|
|
1564
1561
|
if negate:
|
|
1565
1562
|
negate_expression = get_selected_option_expression(node, negate)
|
|
@@ -1579,9 +1576,12 @@ def get_node_expression( in_node, processed_nodes, is_calculate=False, is_prev=F
|
|
|
1579
1576
|
negate_expression = get_calculation_terms(node, processed_nodes=processed_nodes, is_calculate=is_calculate, negate=True, process=process)
|
|
1580
1577
|
else:
|
|
1581
1578
|
expression = get_calculation_terms(node, processed_nodes=processed_nodes, is_calculate=is_calculate, process=process)
|
|
1579
|
+
|
|
1580
|
+
elif (not is_prev or not ONE_QUESTION_AT_A_TIME) and hasattr(node, 'relevance') and isinstance(node.relevance, (TriccOperation, TriccStatic)):
|
|
1581
|
+
expression = node.relevance
|
|
1582
1582
|
elif ONE_QUESTION_AT_A_TIME and is_prev and not is_calculate and hasattr(node, 'required') and node.required:
|
|
1583
1583
|
expression = get_required_node_expression(node)
|
|
1584
|
-
|
|
1584
|
+
|
|
1585
1585
|
if expression is None:
|
|
1586
1586
|
expression = get_prev_node_expression(node, processed_nodes=processed_nodes, is_calculate=is_calculate, process=process)
|
|
1587
1587
|
# in_node not in processed_nodes is need for calculates that can but run after the end of the activity
|
|
@@ -1841,8 +1841,7 @@ def get_prev_node_expression( node, processed_nodes, is_calculate=False, exclude
|
|
|
1841
1841
|
expression = expression_inputs[0]
|
|
1842
1842
|
|
|
1843
1843
|
elif expression_inputs:
|
|
1844
|
-
expression =
|
|
1845
|
-
TriccOperator.OR,
|
|
1844
|
+
expression = or_join(
|
|
1846
1845
|
expression_inputs
|
|
1847
1846
|
)
|
|
1848
1847
|
# if isinstance(node, TriccNodeExclusive):
|
|
@@ -2188,7 +2187,7 @@ def get_calculation_terms( node, processed_nodes, is_calculate=False, negate=Fal
|
|
|
2188
2187
|
|
|
2189
2188
|
# Function that add element to array is not None or ''
|
|
2190
2189
|
def add_sub_expression(array, sub):
|
|
2191
|
-
if isinstance(sub, TriccOperation)
|
|
2190
|
+
if isinstance(sub, (TriccOperation, TriccStatic)):
|
|
2192
2191
|
not_sub = negate_term(sub)
|
|
2193
2192
|
if not_sub in array:
|
|
2194
2193
|
# avoid having 2 conditions that are complete opposites
|
|
@@ -2196,6 +2195,8 @@ def add_sub_expression(array, sub):
|
|
|
2196
2195
|
array.append(TriccStatic(True))
|
|
2197
2196
|
else:
|
|
2198
2197
|
array.append(sub)
|
|
2198
|
+
else:
|
|
2199
|
+
pass
|
|
2199
2200
|
# elif sub is None:
|
|
2200
2201
|
# array.append(TriccStatic(True))
|
|
2201
2202
|
|
tricc_oo/visitors/xform_pd.py
CHANGED
|
@@ -173,7 +173,7 @@ def get_tasksstrings(hidden_names, df_survey):
|
|
|
173
173
|
|
|
174
174
|
|
|
175
175
|
def get_task_js(form_id, calculate_name, title, form_types, hidden_names, df_survey, repalce_dots=False, task_title="'id: '+getField(report, 'g_registration.p_id')+'; age: '+getField(report, 'p_age')+getField(report, 'g_registration.p_gender')+' months; '+getField(report, 'p_weight') + 'kg; ' + getField(report, 'g_fever.p_temp')+'°'"):
|
|
176
|
-
task_name = f"{form_id}
|
|
176
|
+
task_name = f"{form_id}"
|
|
177
177
|
task_name_upper = task_name.upper()
|
|
178
178
|
|
|
179
179
|
|
|
@@ -181,17 +181,16 @@ def get_task_js(form_id, calculate_name, title, form_types, hidden_names, df_sur
|
|
|
181
181
|
/* eslint-disable no-use-before-define */
|
|
182
182
|
/* eslint-disable */
|
|
183
183
|
|
|
184
|
-
const {{injectDataFromForm, isFormArrayHasSourceId}} = require('./stph-extras');
|
|
184
|
+
const {{injectDataFromForm, isFormArrayHasSourceId}} = require('./stph-extras');
|
|
185
185
|
|
|
186
186
|
const CASE_DATA = ['{"','".join(hidden_names)}'];
|
|
187
187
|
|
|
188
|
-
const {{injectDataFromForm}} = require('./stph-extras');
|
|
189
188
|
|
|
190
189
|
const {task_name_upper}_FORMS = ['{"','".join(form_types)}'];
|
|
191
190
|
|
|
192
191
|
var task_title = "{task_title}"
|
|
193
192
|
|
|
194
|
-
const {task_name_upper}_TASK_FORM = '{form_id}
|
|
193
|
+
const {task_name_upper}_TASK_FORM = '{form_id}';
|
|
195
194
|
|
|
196
195
|
const {task_name}Content = function (content, contact, report){{
|
|
197
196
|
|
|
@@ -213,9 +212,12 @@ function {task_name}ContactLabel (){{
|
|
|
213
212
|
|
|
214
213
|
|
|
215
214
|
function {task_name}ResolveIf(contact, report, event, dueDate) {{
|
|
216
|
-
return isFormArrayHasSourceId( report, contact.reports, event, dueDate, {task_name_upper}
|
|
215
|
+
return isFormArrayHasSourceId( report, contact.reports, event, dueDate, {task_name_upper}_TASK_FORM);
|
|
217
216
|
}}
|
|
218
217
|
|
|
218
|
+
function {task_name}AppliesIf(contact, report, event, dueDate) {{
|
|
219
|
+
return report.{calculate_name};
|
|
220
|
+
}}
|
|
219
221
|
|
|
220
222
|
module.exports = {{
|
|
221
223
|
{task_name_upper}_TASK_FORM,
|
|
@@ -223,6 +225,7 @@ module.exports = {{
|
|
|
223
225
|
{task_name}Content,
|
|
224
226
|
{task_name}ContactLabel,
|
|
225
227
|
{task_name}ResolveIf,
|
|
228
|
+
{task_name}AppliesIf,
|
|
226
229
|
}}
|
|
227
230
|
//
|
|
228
231
|
//// to be copied in task
|
|
@@ -232,7 +235,8 @@ module.exports = {{
|
|
|
232
235
|
// {task_name_upper}_FORMS,
|
|
233
236
|
// {task_name}Content,
|
|
234
237
|
// {task_name}ContactLabel,
|
|
235
|
-
// {task_name}ResolveIf,
|
|
238
|
+
// {task_name}ResolveIf,
|
|
239
|
+
// {task_name}AppliesIf, }} = require('./{task_name}');
|
|
236
240
|
//
|
|
237
241
|
//module.exports = [
|
|
238
242
|
//
|
|
@@ -242,6 +246,7 @@ module.exports = {{
|
|
|
242
246
|
// title: 'diagnostic',
|
|
243
247
|
// appliesTo: 'reports',
|
|
244
248
|
// appliesToType: {task_name_upper}_FORMS,
|
|
249
|
+
// appliesIf: {task_name}AppliesIf,
|
|
245
250
|
// actions: [
|
|
246
251
|
// {{
|
|
247
252
|
// type: 'report',
|
|
@@ -15,32 +15,32 @@ tricc_oo/converters/cql/cqlListener.py,sha256=ketvj7XvO7t047S6A3_gTPvp2MlYk1bojm
|
|
|
15
15
|
tricc_oo/converters/cql/cqlParser.py,sha256=hIUdR907WX24P2Jlrxk-H0IT94n51yh_ZsCmwQhnFas,414730
|
|
16
16
|
tricc_oo/converters/cql/cqlVisitor.py,sha256=SWSDIqVYBhucR4VgLn_EPNs7LV9yCqsOmzFZ0bmRSGc,33865
|
|
17
17
|
tricc_oo/models/__init__.py,sha256=Rdk1fsNXHrbmXTQD1O7i0NC_A6os648Ap6CtWRliOg8,92
|
|
18
|
-
tricc_oo/models/base.py,sha256=
|
|
18
|
+
tricc_oo/models/base.py,sha256=6YU4FrUT4gE6WlERR1OPvQpq3bBKzG38I68_SZmaAao,24386
|
|
19
19
|
tricc_oo/models/calculate.py,sha256=Bw7OGa4OYxHP529wA23CZftMYDL_CA0SPQ0j1IFyTNA,7456
|
|
20
20
|
tricc_oo/models/lang.py,sha256=SwKaoxyRhE7gH_ZlYyFXzGuTQ5RE19y47LWAA35zYxg,2338
|
|
21
21
|
tricc_oo/models/ocl.py,sha256=ol35Gl1jCBp0Ven0yxOKzDIZkVL5Kx9uwaR_64pjxKI,8931
|
|
22
|
-
tricc_oo/models/ordered_set.py,sha256=
|
|
22
|
+
tricc_oo/models/ordered_set.py,sha256=wbbmppjgKy0xcKD9kIAbT4kgNkuwTILPxRw_KAAoPEY,4178
|
|
23
23
|
tricc_oo/models/tricc.py,sha256=32WvBVBShODBlszdXSoCjisd5gpt6CM_TNabJap1Zfs,16509
|
|
24
24
|
tricc_oo/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
tricc_oo/parsers/xml.py,sha256=vq9PA5Zt4G3QMtZ1zgyN8110O1w19Jqt6JClJYhHJlU,4410
|
|
26
26
|
tricc_oo/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
tricc_oo/serializers/planuml.py,sha256=a81YKsjgng-h2H_rmFE2J5FeBBUaH8kRGT8YrvzpEKE,455
|
|
28
|
-
tricc_oo/serializers/xls_form.py,sha256=
|
|
28
|
+
tricc_oo/serializers/xls_form.py,sha256=oaBfHGJ_I_7qAPuxdG361PCaEKo1TD1LUvHJvo0kYlk,22707
|
|
29
29
|
tricc_oo/strategies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
tricc_oo/strategies/input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
31
|
tricc_oo/strategies/input/base_input_strategy.py,sha256=-GQ_xRvJXzn-q_eT8R-wtFOTWzPtdNj79zjmsH6x070,4065
|
|
32
32
|
tricc_oo/strategies/input/drawio.py,sha256=glLts9whixJM4HOV_GAWAK8az_H-eo9aeFAQbn99-4c,13362
|
|
33
33
|
tricc_oo/strategies/output/base_output_strategy.py,sha256=WiJwqm4g_x-rbksrjoE0ABhNMtM0_fAMoPH34RKZdc0,7173
|
|
34
34
|
tricc_oo/strategies/output/spice.py,sha256=s_COahyYCoc4Xv5TGh_AW9evDOW6GOex0Xwa_JWeLsI,11280
|
|
35
|
-
tricc_oo/strategies/output/xls_form.py,sha256=
|
|
35
|
+
tricc_oo/strategies/output/xls_form.py,sha256=nUK_eAzlHDLliq2lIkFhOkn1zVTPGTUElfuN9FB9Yrc,31005
|
|
36
36
|
tricc_oo/strategies/output/xlsform_cdss.py,sha256=8oLlgS1Hr6IVvI0O71kIk5oIKXbt2lPVc1SZIjzcSTc,9452
|
|
37
37
|
tricc_oo/strategies/output/xlsform_cht.py,sha256=SWu1GKI5PScSX420RiVVaCNCTINeTeLpCoX-zXQIhUE,19486
|
|
38
38
|
tricc_oo/strategies/output/xlsform_cht_hf.py,sha256=0D_H68a2S7oLKJENEePaRGIocrRIF45BofHlLOtGsKo,2206
|
|
39
39
|
tricc_oo/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
tricc_oo/visitors/tricc.py,sha256=
|
|
40
|
+
tricc_oo/visitors/tricc.py,sha256=uhOrvms76JIF7EFOzse68IaE6zz4JexeYECML3-eUaA,98055
|
|
41
41
|
tricc_oo/visitors/utils.py,sha256=Gol4JNozPEd30Q1l8IPIPhx5fqVyy9R81GofGVebgD8,484
|
|
42
|
-
tricc_oo/visitors/xform_pd.py,sha256=
|
|
43
|
-
tricc_oo-1.4.
|
|
44
|
-
tricc_oo-1.4.
|
|
45
|
-
tricc_oo-1.4.
|
|
46
|
-
tricc_oo-1.4.
|
|
42
|
+
tricc_oo/visitors/xform_pd.py,sha256=HfcpbeeW--Q1wrRrF_uMoPATkzUxMGO5KvXtlPMG31o,9474
|
|
43
|
+
tricc_oo-1.4.27.dist-info/METADATA,sha256=4F4fGRYQGhEdNNu3vbhm1L39-cfWaSAZYkk5V1Ciykk,7878
|
|
44
|
+
tricc_oo-1.4.27.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
45
|
+
tricc_oo-1.4.27.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
|
|
46
|
+
tricc_oo-1.4.27.dist-info/RECORD,,
|
|
File without changes
|