tricc-oo 1.4.25__tar.gz → 1.4.27__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.
Files changed (51) hide show
  1. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/PKG-INFO +1 -1
  2. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/pyproject.toml +1 -1
  3. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/models/base.py +3 -1
  4. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/models/ordered_set.py +1 -1
  5. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/serializers/xls_form.py +0 -2
  6. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/output/xls_form.py +1 -2
  7. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/visitors/tricc.py +13 -12
  8. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/visitors/xform_pd.py +11 -6
  9. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo.egg-info/PKG-INFO +1 -1
  10. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/README.md +0 -0
  11. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/setup.cfg +0 -0
  12. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tests/build.py +0 -0
  13. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tests/test_cql.py +0 -0
  14. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tests/to_ocl.py +0 -0
  15. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/__init__.py +0 -0
  16. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/__init__.py +0 -0
  17. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
  18. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/cql/cqlLexer.py +0 -0
  19. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/cql/cqlListener.py +0 -0
  20. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/cql/cqlParser.py +0 -0
  21. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
  22. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/cql_to_operation.py +0 -0
  23. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/datadictionnary.py +0 -0
  24. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/drawio_type_map.py +0 -0
  25. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/tricc_to_xls_form.py +0 -0
  26. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/utils.py +0 -0
  27. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/converters/xml_to_tricc.py +0 -0
  28. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/models/__init__.py +0 -0
  29. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/models/calculate.py +0 -0
  30. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/models/lang.py +0 -0
  31. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/models/ocl.py +0 -0
  32. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/models/tricc.py +0 -0
  33. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/parsers/__init__.py +0 -0
  34. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/parsers/xml.py +0 -0
  35. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/serializers/__init__.py +0 -0
  36. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/serializers/planuml.py +0 -0
  37. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/__init__.py +0 -0
  38. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/input/__init__.py +0 -0
  39. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/input/base_input_strategy.py +0 -0
  40. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/input/drawio.py +0 -0
  41. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
  42. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/output/spice.py +0 -0
  43. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
  44. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/output/xlsform_cht.py +0 -0
  45. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/strategies/output/xlsform_cht_hf.py +0 -0
  46. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/visitors/__init__.py +0 -0
  47. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo/visitors/utils.py +0 -0
  48. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo.egg-info/SOURCES.txt +0 -0
  49. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo.egg-info/dependency_links.txt +0 -0
  50. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo.egg-info/requires.txt +0 -0
  51. {tricc_oo-1.4.25 → tricc_oo-1.4.27}/tricc_oo.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tricc-oo
3
- Version: 1.4.25
3
+ Version: 1.4.27
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "tricc-oo"
7
- version = "1.4.25"
7
+ version = "1.4.27"
8
8
  description = "Python library that converts CDSS L2 in L3"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -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:
@@ -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) - 1
109
+ start_index = len(keys)
110
110
  else:
111
111
  # Find the index of the given object
112
112
  start_index = keys.index(obj)
@@ -21,8 +21,6 @@ from tricc_oo.visitors.tricc import (
21
21
  get_applicability_expression,
22
22
  get_prev_instance_skip_expression,
23
23
  get_process_skip_expression,
24
- get_next_version,
25
- set_last_version_false,
26
24
  )
27
25
 
28
26
  logger = logging.getLogger("default")
@@ -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 = TriccOperation(
637
- TriccOperator.OR,
636
+ node.constraint = or_join(
638
637
  [
639
638
  TriccOperation(TriccOperator.EQUAL, ['$this', TriccStatic('opt_none')]),
640
639
  TriccOperation(TriccOperator.NOT, [
@@ -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 == node.name and issubclass(node.__class__, (TriccNodeDisplayModel, TriccNodeDisplayCalculateBase, TriccNodeEnd)) and not isinstance(node, TriccNodeSelectOption))
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 = TriccOperation(
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 None
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 = TriccOperation(
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) or sub:
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
 
@@ -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}_{calculate_name}"
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'); -> isFormArrayHasSourceId was missing from the imports
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}_{calculate_name}';
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}_TASK_FORMS);
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, }} = require('./{task_name}');
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',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tricc-oo
3
- Version: 1.4.25
3
+ Version: 1.4.27
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
File without changes
File without changes
File without changes
File without changes
File without changes