tricc-oo 1.6.24__tar.gz → 1.6.26__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 (56) hide show
  1. {tricc_oo-1.6.24/tricc_oo.egg-info → tricc_oo-1.6.26}/PKG-INFO +1 -1
  2. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/pyproject.toml +1 -1
  3. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/models/tricc.py +3 -1
  4. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/serializers/xls_form.py +2 -3
  5. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/visitors/tricc.py +21 -41
  6. {tricc_oo-1.6.24 → tricc_oo-1.6.26/tricc_oo.egg-info}/PKG-INFO +1 -1
  7. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo.egg-info/SOURCES.txt +1 -1
  8. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/LICENSE +0 -0
  9. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/README.md +0 -0
  10. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/setup.cfg +0 -0
  11. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tests/build.py +0 -0
  12. {tricc_oo-1.6.24/tests/data → tricc_oo-1.6.26/tests}/test_cql.py +0 -0
  13. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tests/to_ocl.py +0 -0
  14. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/__init__.py +0 -0
  15. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/__init__.py +0 -0
  16. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
  17. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/cql/cqlLexer.py +0 -0
  18. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/cql/cqlListener.py +0 -0
  19. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/cql/cqlParser.py +0 -0
  20. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
  21. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/cql_to_operation.py +0 -0
  22. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/datadictionnary.py +0 -0
  23. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/drawio_type_map.py +0 -0
  24. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/tricc_to_xls_form.py +0 -0
  25. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/utils.py +0 -0
  26. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/converters/xml_to_tricc.py +0 -0
  27. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/models/__init__.py +0 -0
  28. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/models/base.py +0 -0
  29. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/models/calculate.py +0 -0
  30. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/models/lang.py +0 -0
  31. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/models/ocl.py +0 -0
  32. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/models/ordered_set.py +0 -0
  33. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/parsers/__init__.py +0 -0
  34. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/parsers/xml.py +0 -0
  35. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/serializers/__init__.py +0 -0
  36. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/serializers/planuml.py +0 -0
  37. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/__init__.py +0 -0
  38. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/input/__init__.py +0 -0
  39. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/input/base_input_strategy.py +0 -0
  40. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/input/drawio.py +0 -0
  41. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
  42. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/dhis2_form.py +0 -0
  43. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/fhir_form.py +0 -0
  44. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/html_form.py +0 -0
  45. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/openmrs_form.py +0 -0
  46. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/spice.py +0 -0
  47. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/xls_form.py +0 -0
  48. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
  49. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/xlsform_cht.py +0 -0
  50. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/strategies/output/xlsform_cht_hf.py +0 -0
  51. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/visitors/__init__.py +0 -0
  52. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/visitors/utils.py +0 -0
  53. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo/visitors/xform_pd.py +0 -0
  54. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo.egg-info/dependency_links.txt +0 -0
  55. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/tricc_oo.egg-info/requires.txt +0 -0
  56. {tricc_oo-1.6.24 → tricc_oo-1.6.26}/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.6.24
3
+ Version: 1.6.26
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.6.24"
7
+ version = "1.6.26"
8
8
  description = "Python library that converts CDSS L2 in L3"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -99,6 +99,7 @@ class TriccNodeActivity(TriccNodeBaseModel):
99
99
  # - case definition
100
100
  calculates: List[TriccNodeCalculateBase] = []
101
101
  applicability: Optional[Union[Expression, TriccOperation]] = None
102
+ is_sequence_defined: bool = False
102
103
 
103
104
  # redefine
104
105
  def make_instance(self, instance_nb=None, **kwargs):
@@ -294,7 +295,8 @@ class TriccNodeDisplayModel(TriccNodeBaseModel):
294
295
  default: Optional[Union[Expression, TriccOperation, TriccReference, TriccStatic]] = None
295
296
  trigger: Optional[Union[Expression, TriccOperation, TriccReference]] = None
296
297
  priority: Union[float, int, None] = None
297
-
298
+ concept_type: str = None
299
+ datatype: str = None
298
300
  # to use the enum value of the TriccNodeType
299
301
 
300
302
 
@@ -357,8 +357,7 @@ def generate_choice_filter(strategy, node):
357
357
  choice_filter = TriccOperation(TriccOperator.OR, [basic])
358
358
  for k, op in relevances.items():
359
359
  choice_filter.append(
360
- TriccOperation(
361
- TriccOperator.AND,
360
+ and_join(
362
361
  [
363
362
  TriccOperation(
364
363
  TriccOperator.EQUAL,
@@ -368,7 +367,7 @@ def generate_choice_filter(strategy, node):
368
367
  ],
369
368
  ),
370
369
  op,
371
- ],
370
+ ]
372
371
  )
373
372
  )
374
373
  return strategy.get_tricc_operation_expression(choice_filter)
@@ -176,7 +176,7 @@ def get_version_inheritance(node, all_prev_versions, processed_nodes):
176
176
  expression = node.expression or node.expression_reference or getattr(node, "relevance", None)
177
177
  # Merge with ALL previous versions, not just the last one
178
178
  if all_prev_versions:
179
- expression = merge_all_expressions(expression, all_prev_versions)
179
+ expression = merge_expressions(expression, *all_prev_versions)
180
180
  if node.expression:
181
181
  node.expression = expression
182
182
  elif node.expression_reference:
@@ -216,39 +216,15 @@ def get_version_inheritance(node, all_prev_versions, processed_nodes):
216
216
  node.expression = TriccOperation(TriccOperator.COALESCE, coalesce_operands)
217
217
 
218
218
 
219
- def merge_expression(expression, last_version):
219
+ def merge_expressions(expression, last_version, *argv):
220
220
  datatype = expression.get_datatype()
221
221
  if datatype == "boolean":
222
- expression = or_join([TriccOperation(TriccOperator.ISTRUE, [last_version]), expression])
222
+ expression = or_join([TriccOperation(TriccOperator.ISTRUE, [last_version, *argv]), expression])
223
223
 
224
224
  elif datatype == "number":
225
- expression = TriccOperation(TriccOperator.PLUS, [last_version, expression])
225
+ expression = TriccOperation(TriccOperator.PLUS, [last_version, *argv, expression])
226
226
  else:
227
- expression = TriccOperation(TriccOperator.COALESCE, [last_version, expression])
228
- return expression
229
-
230
-
231
- def merge_all_expressions(expression, all_versions):
232
- """
233
- Merge an expression with ALL previous versions, not just the last one.
234
- This ensures inheritance works even when intermediate versions weren't evaluated
235
- due to activity relevance conditions.
236
- """
237
- if not all_versions:
238
- return expression
239
-
240
- datatype = expression.get_datatype() if expression else "unknown"
241
-
242
- if datatype == "boolean":
243
- expression = or_join([expression, *all_versions])
244
-
245
- else:
246
- # COALESCE through all previous versions, then the current expression
247
- coalesce_operands = list(all_versions)
248
- if expression:
249
- coalesce_operands.append(expression)
250
- expression = TriccOperation(TriccOperator.COALESCE, coalesce_operands)
251
-
227
+ expression = TriccOperation(TriccOperator.COALESCE, [expression, last_version, *argv])
252
228
  return expression
253
229
 
254
230
 
@@ -582,7 +558,7 @@ def generate_calculates(node, calculates, used_calculates, processed_nodes, proc
582
558
  node.activity.calculates.append(calc_node)
583
559
  last_version = set_last_version_false(calc_node, processed_nodes)
584
560
  if last_version:
585
- calc_node.expression = merge_expression(calc_node.expression, last_version)
561
+ calc_node.expression = merge_expressions(calc_node.expression, last_version)
586
562
  processed_nodes.add(calc_node)
587
563
  logger.debug(
588
564
  "generate_save_calculate:{}:{} as {}".format(
@@ -615,7 +591,7 @@ def generate_calculates(node, calculates, used_calculates, processed_nodes, proc
615
591
  node.activity.calculates.append(calc_node)
616
592
  last_version = set_last_version_false(calc_node, processed_nodes)
617
593
  if last_version:
618
- calc_node.expression = merge_expression(calc_node.expression, last_version)
594
+ calc_node.expression = merge_expressions(calc_node.expression, last_version)
619
595
  processed_nodes.add(calc_node)
620
596
  list_calc.append(calc_node)
621
597
  node.activity.nodes[calc_node.id] = calc_node
@@ -2265,8 +2241,7 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
2265
2241
  if act_expression_inputs:
2266
2242
  act_sub = or_join(act_expression_inputs)
2267
2243
  # if there is condition fallback on the calling activity condition
2268
- if act_sub == TriccStatic(True):
2269
- act_sub = get_node_expression(
2244
+ act_relevance = get_node_expression(
2270
2245
  prev_node.activity,
2271
2246
  processed_nodes=processed_nodes,
2272
2247
  get_overall_exp=get_overall_exp,
@@ -2274,7 +2249,9 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
2274
2249
  negate=False,
2275
2250
  process=process,
2276
2251
  )
2277
- elif none_sequence_defined_prev_node:
2252
+ if act_sub == TriccStatic(True):
2253
+ act_sub = act_relevance
2254
+ elif act_relevance != TriccStatic(True) and none_sequence_defined_prev_node:
2278
2255
  # For nodes with is_sequence_defined = False, AND the activity relevance with the prev expression
2279
2256
  # activity_relevance = get_node_expression(
2280
2257
  # prev_node.activity,
@@ -2284,7 +2261,13 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
2284
2261
  # negate=False,
2285
2262
  # process=process,
2286
2263
  # )
2287
- act_sub = and_join([ prev_node.activity.root, act_sub])
2264
+ act_sub = and_join([
2265
+ TriccOperation(
2266
+ TriccOperator.ISTRUE,
2267
+ [prev_node.activity.root]
2268
+ ),
2269
+ act_sub
2270
+ ])
2288
2271
  add_sub_expression(expression_inputs, act_sub)
2289
2272
  # avoid void is there is not conditions to avoid looping too much itme
2290
2273
  # expression_inputs = clean_or_list(
@@ -2661,13 +2644,10 @@ def get_selected_option_expression_multiple(option_node, negate):
2661
2644
  selected = TriccOperation(TriccOperator.SELECTED, [option_node.select, TriccStatic(option_node)])
2662
2645
 
2663
2646
  if negate:
2664
- return TriccOperation(
2665
- operator=TriccOperator.AND,
2666
- resource=[
2647
+ return and_join([
2667
2648
  TriccOperation(operator=TriccOperator.NOT, resource=[selected]),
2668
2649
  TriccOperation(operator=TriccOperator.ISNOTNULL, resource=[option_node.select]),
2669
- ],
2670
- )
2650
+ ])
2671
2651
 
2672
2652
  else:
2673
2653
  return selected
@@ -2778,7 +2758,7 @@ def generate_base(node, processed_nodes, **kwargs):
2778
2758
  )
2779
2759
  constraints_max = "The maximum value is {0}.".format(node.max)
2780
2760
  if len(constraints) > 1:
2781
- node.constraint = TriccOperation(TriccOperator.AND, constraints)
2761
+ node.constraint = and_join(constraints)
2782
2762
  node.constraint_message = (constraints_min + " " + constraints_max).strip()
2783
2763
  elif len(constraints) == 1:
2784
2764
  node.constraint = constraints[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tricc-oo
3
- Version: 1.6.24
3
+ Version: 1.6.26
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
@@ -2,8 +2,8 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  tests/build.py
5
+ tests/test_cql.py
5
6
  tests/to_ocl.py
6
- tests/data/test_cql.py
7
7
  tricc_oo/__init__.py
8
8
  tricc_oo.egg-info/PKG-INFO
9
9
  tricc_oo.egg-info/SOURCES.txt
File without changes
File without changes
File without changes
File without changes
File without changes