tricc-oo 1.5.26__py3-none-any.whl → 1.6.14__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.
@@ -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(node.__class__, TriccNodeCalculateBase) and not issubclass(
124
- node.__class__, (TriccNodeDisplayBridge, TriccNodeBridge)
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=generate_id(f"save{node.id}"),
191
- name=node.name,
183
+ id=calc_id,
184
+ name=node.save,
192
185
  path_len=node.path_len + 1,
193
- # version=get_next_version(node.name, processed_nodes, node.version+2),
194
- expression=merge_expression(node, last_version),
195
- label=f"merge{node.id}",
196
- last=True,
186
+ expression_reference=TriccOperation(
187
+ TriccOperator.COALESCE,
188
+ [node, last_version],
189
+ ),
190
+ reference=[node, last_version],
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
 
@@ -783,7 +805,7 @@ def process_operation_reference(
783
805
  operation,
784
806
  node,
785
807
  processed_nodes,
786
- calculates,
808
+ calculates=None,
787
809
  used_calculates=None,
788
810
  replace_reference=False,
789
811
  warn=False,
@@ -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
- label = "continue" if issubclass(source_node.__class__, TriccNodeSelect) else None
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
 
@@ -1708,28 +1735,33 @@ def replace_next_node(prev_node, next_node, old_node):
1708
1735
 
1709
1736
 
1710
1737
  # Priority constants
1711
- SAME_GROUP_PRIORITY = 7000
1712
- PARENT_GROUP_PRIORITY = 6000
1713
- ACTIVE_ACTIVITY_PRIORITY = 5000
1714
- NON_START_ACTIVITY_PRIORITY = 4000
1715
- ACTIVE_ACTIVITY_LOWER_PRIORITY = 3000
1716
- RHOMBUS_PRIORITY = 1000
1717
- DEFAULT_PRIORITY = 2000
1718
-
1719
-
1738
+ SAME_GROUP_PRIORITY = 70
1739
+ PARENT_GROUP_PRIORITY = 60
1740
+ ACTIVE_ACTIVITY_PRIORITY = 50
1741
+ NON_START_ACTIVITY_PRIORITY = 40
1742
+ ACTIVE_ACTIVITY_LOWER_PRIORITY = 30
1743
+ FLOW_CALCULATE_NODE_PRIORITY_TOP_UP = 3
1744
+ RHOMBUS_PRIORITY_TO_UP = 3
1745
+
1746
+
1720
1747
  def reorder_node_list(node_list, group, processed_nodes):
1721
1748
  # Cache active activities for O(1) lookup
1722
1749
  active_activities = {n.activity for n in processed_nodes}
1723
-
1750
+ MAP_PRIORITIES = {}
1724
1751
  def get_priority(node):
1752
+ if node.id in MAP_PRIORITIES:
1753
+ return MAP_PRIORITIES[node.id]
1754
+ if isinstance(node, (TriccNodeActivityStart, TriccNodeMainStart)):
1755
+ return get_priority(node.activity)
1756
+
1725
1757
  # Cache attributes to avoid repeated getattr calls
1726
- priority = int(getattr(node, "priority", 0) or 0)
1758
+ priority = int(getattr(node, "priority", 0) or 0)
1727
1759
  node_group = getattr(node, "group", None)
1728
1760
  activity = getattr(node, "activity", None)
1729
1761
 
1730
1762
  # Check for same group
1731
1763
  if group is not None and node_group and node_group.id == group.id:
1732
- priority += SAME_GROUP_PRIORITY
1764
+ priority += SAME_GROUP_PRIORITY
1733
1765
  # Check for parent group
1734
1766
  elif hasattr(group, "group") and group.group and node_group and node_group.id == group.group.id:
1735
1767
  priority += PARENT_GROUP_PRIORITY
@@ -1743,11 +1775,21 @@ def reorder_node_list(node_list, group, processed_nodes):
1743
1775
  elif activity and activity in active_activities:
1744
1776
  priority += ACTIVE_ACTIVITY_LOWER_PRIORITY
1745
1777
  # Check for rhombus nodes
1778
+
1779
+
1780
+ if (
1781
+ issubclass(node.__class__, TriccNodeDisplayCalculateBase) or
1782
+ isinstance(node, TriccNodeEnd)
1783
+ ) and not isinstance(node, TriccNodeActivityEnd) and hasattr(node, 'prev_nodes') and len(node.prev_nodes) > 0:
1784
+ priority += FLOW_CALCULATE_NODE_PRIORITY_TOP_UP
1746
1785
  elif issubclass(node.__class__, TriccRhombusMixIn):
1747
- priority += RHOMBUS_PRIORITY
1748
- else:
1749
- priority += DEFAULT_PRIORITY
1786
+ priority += RHOMBUS_PRIORITY_TO_UP
1750
1787
 
1788
+ if node.prev_nodes:
1789
+ priority = max(priority, *[get_priority(p) for p in node.prev_nodes])
1790
+
1791
+ MAP_PRIORITIES[node.id] = priority
1792
+
1751
1793
  return priority
1752
1794
 
1753
1795
  # Sort in place, highest priority first
@@ -1848,6 +1890,16 @@ def get_node_expression(in_node, processed_nodes, get_overall_exp=False, is_prev
1848
1890
  logger.critical(f"Rhombus without expression {node.get_name()}")
1849
1891
  elif is_prev and issubclass(node.__class__, TriccNodeDisplayCalculateBase):
1850
1892
  expression = TriccOperation(TriccOperator.ISTRUE, [node])
1893
+ prev_exp_overall = get_node_expression(
1894
+ node,
1895
+ processed_nodes=processed_nodes,
1896
+ get_overall_exp=False,
1897
+ is_prev=False,
1898
+ process=process,
1899
+ negate=negate
1900
+ )
1901
+ if prev_exp_overall in [TriccStatic(True), TriccStatic(False)]:
1902
+ expression = prev_exp_overall
1851
1903
  elif hasattr(node, "expression_reference") and isinstance(node.expression_reference, TriccOperation):
1852
1904
  # if issubclass(node.__class__, TriccNodeDisplayCalculateBase):
1853
1905
  # expression = TriccOperation(
@@ -1925,7 +1977,6 @@ def get_prev_instance_skip_expression(node, processed_nodes, process, expression
1925
1977
  ),
1926
1978
  )
1927
1979
  if expression and expression_inputs:
1928
- add_sub_expression(expression_inputs, expression)
1929
1980
  expression = nand_join(expression, or_join(expression_inputs))
1930
1981
  elif expression_inputs:
1931
1982
  expression = negate_term(or_join(expression_inputs))
@@ -1934,7 +1985,7 @@ def get_prev_instance_skip_expression(node, processed_nodes, process, expression
1934
1985
 
1935
1986
  # end def
1936
1987
  def get_process_skip_expression(node, processed_nodes, process, expression=None):
1937
- list_ends = OrderedSet(filter(lambda x: issubclass(x.__class__, TriccNodeEnd), processed_nodes))
1988
+ list_ends = [x for x in processed_nodes if isinstance(x, TriccNodeEnd)]
1938
1989
  if list_ends:
1939
1990
  end_expressions = []
1940
1991
  f_end_expression = get_end_expression(list_ends)
@@ -1943,8 +1994,11 @@ def get_process_skip_expression(node, processed_nodes, process, expression=None)
1943
1994
  b_end_expression = get_end_expression(list_ends, "pause")
1944
1995
  if b_end_expression:
1945
1996
  end_expressions.append(b_end_expression)
1946
- if process[0] in PROCESSES:
1947
- for p in PROCESSES[PROCESSES.index(process[0]) + 1:]:
1997
+ process_index = None
1998
+ if process and process[0] in PROCESSES:
1999
+ process_index = PROCESSES.index(process[0])
2000
+ if process_index is not None:
2001
+ for p in PROCESSES[process_index + 1:]:
1948
2002
  p_end_expression = get_end_expression(list_ends, p)
1949
2003
  if p_end_expression:
1950
2004
  end_expressions.append(p_end_expression)
@@ -1991,7 +2045,7 @@ def get_accept_diagnostic_node(code, display, severity, priority, activity):
1991
2045
  return node
1992
2046
 
1993
2047
 
1994
- def get_diagnostic_node(code, display, severity, priority, activity):
2048
+ def get_diagnostic_node(code, display, severity, priority, activity, option):
1995
2049
  node = TriccNodeCalculate(
1996
2050
  id=generate_id("final." + code),
1997
2051
  name="final." + code,
@@ -2002,7 +2056,7 @@ def get_diagnostic_node(code, display, severity, priority, activity):
2002
2056
  expression_reference=or_join(
2003
2057
  [
2004
2058
  TriccOperation(TriccOperator.ISTRUE, [TriccReference("pre_final." + code)]),
2005
- TriccOperation(TriccOperator.SELECTED, [TriccReference("tricc.manual.diag"), TriccStatic(code)]),
2059
+ TriccOperation(TriccOperator.SELECTED, [TriccReference("tricc.manual.diag"), TriccStatic(option)]),
2006
2060
  ]
2007
2061
  ),
2008
2062
  )
@@ -2061,9 +2115,19 @@ def create_determine_diagnosis_activity(diags):
2061
2115
  group=activity,
2062
2116
  required=TriccStatic(False),
2063
2117
  )
2118
+ options = []
2064
2119
  for proposed in diags:
2120
+ option = TriccNodeSelectOption(
2121
+ id=generate_id(proposed.name),
2122
+ name=proposed.name,
2123
+ label=proposed.label,
2124
+ list_name=f.list_name,
2125
+ relevance=proposed.activity.applicability,
2126
+ select=f,
2127
+ )
2128
+ options.append(option)
2065
2129
  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)
2130
+ c = get_diagnostic_node(proposed.name, proposed.label, proposed.severity, proposed.priority, activity, option)
2067
2131
  diags_conf.append(d)
2068
2132
  r = TriccNodeRhombus(
2069
2133
  path=start,
@@ -2088,17 +2152,6 @@ def create_determine_diagnosis_activity(diags):
2088
2152
  activity.nodes[wait2.id] = wait2
2089
2153
  # fallback
2090
2154
 
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
2155
  f.options = dict(zip(range(0, len(options)), options))
2103
2156
  activity.nodes[f.id] = f
2104
2157
  set_prev_next_node(f, end, edge_only=False)
@@ -2141,7 +2194,7 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
2141
2194
  processed_nodes=processed_nodes,
2142
2195
  get_overall_exp=get_overall_exp,
2143
2196
  is_prev=True,
2144
- process=process,
2197
+ process=get_overall_exp,
2145
2198
  )
2146
2199
  if isinstance(node, TriccNodeActivity) or get_overall_exp:
2147
2200
  add_sub_expression(act_expression_inputs, sub)
@@ -2150,11 +2203,12 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
2150
2203
 
2151
2204
  if act_expression_inputs:
2152
2205
  act_sub = or_join(act_expression_inputs)
2206
+ # if there is condition fallback on the calling activity condition
2153
2207
  if act_sub == TriccStatic(True):
2154
2208
  act_sub = get_node_expression(
2155
2209
  prev_node.activity,
2156
2210
  processed_nodes=processed_nodes,
2157
- get_overall_exp=True,
2211
+ get_overall_exp=get_overall_exp,
2158
2212
  is_prev=True,
2159
2213
  negate=False,
2160
2214
  process=process,
@@ -2205,10 +2259,27 @@ def get_count_terms(node, processed_nodes, get_overall_exp, negate=False, proces
2205
2259
  return TriccOperation(TriccOperator.PLUS, [TriccOperation(TriccOperator.CAST_NUMBER, [term]) for term in terms])
2206
2260
 
2207
2261
 
2262
+ def get_none_option(node):
2263
+ if hasattr(node, "options"):
2264
+ for opt in node.options.values():
2265
+ if opt.name == "opt_none":
2266
+ return opt
2267
+ return None
2268
+
2269
+
2208
2270
  def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=False, process=None):
2209
- operation_none = TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic("opt_none")])
2271
+ opt_none = get_none_option(prev_node)
2272
+ if opt_none:
2273
+ if isinstance(opt_none, str):
2274
+ operation_none = TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(opt_none)])
2275
+ elif issubclass(opt_none.__class__, TriccBaseModel):
2276
+ operation_none = TriccOperation(TriccOperator.SELECTED, [prev_node, opt_none])
2277
+ else:
2278
+ logger.critical(f"unexpected none option value {opt_none}")
2279
+ else:
2280
+ operation_none = TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic("opt_none")])
2210
2281
  if isinstance(prev_node, TriccNodeSelectYesNo):
2211
- return TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(prev_node.options[0].name)])
2282
+ return TriccOperation(TriccOperator.SELECTED, [prev_node, TriccStatic(prev_node.options[0])])
2212
2283
  elif issubclass(prev_node.__class__, TriccNodeSelect):
2213
2284
  if negate:
2214
2285
  return
@@ -2241,7 +2312,7 @@ def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=
2241
2312
  get_node_expression(
2242
2313
  prev_node,
2243
2314
  processed_nodes=processed_nodes,
2244
- get_overall_exp=True,
2315
+ get_overall_exp=get_overall_exp,
2245
2316
  is_prev=True,
2246
2317
  process=process,
2247
2318
  )
@@ -2258,7 +2329,11 @@ def get_count_terms_details(prev_node, processed_nodes, get_overall_exp, negate=
2258
2329
  TriccOperator.CAST_NUMBER,
2259
2330
  [
2260
2331
  get_node_expression(
2261
- prev_node, processed_nodes=processed_nodes, get_overall_exp=True, is_prev=True, process=process
2332
+ prev_node,
2333
+ processed_nodes=processed_nodes,
2334
+ get_overall_exp=get_overall_exp,
2335
+ is_prev=True,
2336
+ process=process
2262
2337
  )
2263
2338
  ],
2264
2339
  )
@@ -2279,7 +2354,7 @@ def get_add_terms(node, processed_nodes, get_overall_exp=False, negate=False, pr
2279
2354
  get_node_expression(
2280
2355
  prev_node,
2281
2356
  processed_nodes=processed_nodes,
2282
- get_overall_exp=True,
2357
+ get_overall_exp=get_overall_exp,
2283
2358
  is_prev=True,
2284
2359
  process=process,
2285
2360
  )
@@ -2352,7 +2427,11 @@ def get_rhombus_terms(node, processed_nodes, get_overall_exp=False, negate=False
2352
2427
  TriccOperator.CAST_NUMBER,
2353
2428
  [
2354
2429
  get_node_expression(
2355
- expression, processed_nodes=processed_nodes, get_overall_exp=True, is_prev=True, process=process
2430
+ expression,
2431
+ processed_nodes=processed_nodes,
2432
+ get_overall_exp=get_overall_exp,
2433
+ is_prev=True,
2434
+ process=process
2356
2435
  )
2357
2436
  ],
2358
2437
  )
@@ -2390,7 +2469,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
2390
2469
  return get_count_terms(node, False, negate, process=process)
2391
2470
  elif isinstance(node, TriccNodeRhombus):
2392
2471
  return get_rhombus_terms(
2393
- node, processed_nodes=processed_nodes, get_overall_exp=False, negate=negate, process=process
2472
+ node, processed_nodes=processed_nodes, get_overall_exp=get_overall_exp, negate=negate, process=process
2394
2473
  )
2395
2474
  elif isinstance(node, (TriccNodeWait)):
2396
2475
  # just use to force order of question
@@ -2407,7 +2486,6 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
2407
2486
  )
2408
2487
  elif isinstance(node, (TriccNodeActivityStart, TriccNodeActivityEnd)):
2409
2488
  # 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
2489
  expression = None
2412
2490
  elif isinstance(node, TriccNodeExclusive):
2413
2491
  if len(node.prev_nodes) == 1:
@@ -2420,7 +2498,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
2420
2498
  return get_node_expression(
2421
2499
  node_to_negate,
2422
2500
  processed_nodes=processed_nodes,
2423
- get_overall_exp=True,
2501
+ get_overall_exp=get_overall_exp,
2424
2502
  is_prev=True,
2425
2503
  negate=True,
2426
2504
  process=process,
@@ -2429,7 +2507,7 @@ def get_calculation_terms(node, processed_nodes, get_overall_exp=False, negate=F
2429
2507
  return get_node_expression(
2430
2508
  node_to_negate,
2431
2509
  processed_nodes=processed_nodes,
2432
- get_overall_exp=True,
2510
+ get_overall_exp=get_overall_exp,
2433
2511
  is_prev=True,
2434
2512
  negate=True,
2435
2513
  process=process,
@@ -2517,7 +2595,7 @@ def get_selected_option_expression_single(option_node, negate):
2517
2595
 
2518
2596
  def get_selected_option_expression_multiple(option_node, negate):
2519
2597
 
2520
- selected = TriccOperation(TriccOperator.SELECTED, [option_node.select, option_node])
2598
+ selected = TriccOperation(TriccOperator.SELECTED, [option_node.select, TriccStatic(option_node)])
2521
2599
 
2522
2600
  if negate:
2523
2601
  return TriccOperation(
@@ -2587,24 +2665,26 @@ def generate_base(node, processed_nodes, **kwargs):
2587
2665
  # we don't overright if define in the diagram
2588
2666
  if node.constraint is None:
2589
2667
  if isinstance(node, TriccNodeSelectMultiple):
2590
- node.constraint = or_join(
2591
- [
2592
- TriccOperation(
2593
- TriccOperator.EQUAL,
2594
- ["$this", TriccStatic("opt_none")],
2595
- ),
2596
- TriccOperation(
2597
- TriccOperator.NOT,
2598
- [
2599
- TriccOperation(
2600
- TriccOperator.SELECTED,
2601
- ["$this", TriccStatic("opt_none")],
2602
- )
2603
- ],
2604
- ),
2605
- ]
2606
- ) # '.=\'opt_none\' or not(selected(.,\'opt_none\'))'
2607
- node.constraint_message = "**None** cannot be selected together with choice."
2668
+ none_opt = get_none_option(node)
2669
+ if none_opt:
2670
+ node.constraint = or_join(
2671
+ [
2672
+ TriccOperation(
2673
+ TriccOperator.EQUAL,
2674
+ ["$this", TriccStatic(none_opt)],
2675
+ ),
2676
+ TriccOperation(
2677
+ TriccOperator.NOT,
2678
+ [
2679
+ TriccOperation(
2680
+ TriccOperator.SELECTED,
2681
+ ["$this", TriccStatic(none_opt)],
2682
+ )
2683
+ ],
2684
+ ),
2685
+ ]
2686
+ ) # '.=\'opt_none\' or not(selected(.,\'opt_none\'))'
2687
+ node.constraint_message = "**None** cannot be selected together with choice."
2608
2688
  elif node.tricc_type in (
2609
2689
  TriccNodeType.integer,
2610
2690
  TriccNodeType.decimal,
@@ -2613,10 +2693,20 @@ def generate_base(node, processed_nodes, **kwargs):
2613
2693
  constraints_min = ""
2614
2694
  constraints_max = ""
2615
2695
  if node.min is not None and node.min != "":
2616
- constraints.append(TriccOperation(TriccOperator.MORE_OR_EQUAL, ["$this", node.min]))
2617
- constraints_min = "The minimun value is {0}.".format(node.min)
2696
+ node.min = float(node.min)
2697
+ if int(node.min) == node.min:
2698
+ node.min = int(node.min)
2699
+ constraints.append(
2700
+ TriccOperation(TriccOperator.MORE_OR_EQUAL, ["$this", TriccStatic(node.min)])
2701
+ )
2702
+ constraints_min = "The minimum value is {0}.".format(node.min)
2618
2703
  if node.max is not None and node.max != "":
2619
- constraints.append(TriccOperation(TriccOperator.LESS_OR_EQUAL, ["$this", node.max]))
2704
+ node.max = float(node.max)
2705
+ if int(node.max) == node.max:
2706
+ node.max = int(node.max)
2707
+ constraints.append(
2708
+ TriccOperation(TriccOperator.LESS_OR_EQUAL, ["$this", TriccStatic(node.max)])
2709
+ )
2620
2710
  constraints_max = "The maximum value is {0}.".format(node.max)
2621
2711
  if len(constraints) > 1:
2622
2712
  node.constraint = TriccOperation(TriccOperator.AND, constraints)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tricc-oo
3
- Version: 1.5.26
3
+ Version: 1.6.14
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,21 +1,21 @@
1
- tests/build.py,sha256=rAYR6cSsNtQLH5vvrh_FNSBwWh_AynF3jG28jC-tiGs,6670
1
+ tests/build.py,sha256=Qbxvjkj_Wk2nQ-WjaMGiE1FIe3SRmJMRIgeoMoxqlfQ,6748
2
2
  tests/test_cql.py,sha256=dAsLMqVaS6qxnq62fg5KqTFu6UG6pHO6Ab3NZ1c9T3Y,5248
3
3
  tests/to_ocl.py,sha256=4e-i65K3UM6wHgdVcrZcM9AyL1bahIsXJiZTXhhHgQk,2048
4
4
  tricc_oo/__init__.py,sha256=oWCE1ubmC_6iqaWOMgTei4eXVQgV202Ia-tXS1NnW_4,139
5
5
  tricc_oo/converters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- tricc_oo/converters/codesystem_to_ocl.py,sha256=Fh7Vk73OsxljZKu1k6H9uzYwz334tpQTMZBjWWbamYE,6151
6
+ tricc_oo/converters/codesystem_to_ocl.py,sha256=V_oZNVUVaYHgzJtDiBMSrvIJnBWmDNFBDTTHEkOfpXk,6151
7
7
  tricc_oo/converters/cql_to_operation.py,sha256=PUyV_YpUY98Ox0H_F_CN3UUf_I-BhFZVOcWWKTtwecM,14492
8
- tricc_oo/converters/datadictionnary.py,sha256=T2HLCBo4Am1p0kFqSH1r0PqbD8AC2IGuWkbvMvSCru0,3658
9
- tricc_oo/converters/drawio_type_map.py,sha256=UCPiGs7Lw0bigKScmZUnmOhACBz-FiDq92jHkI7RTSQ,9113
10
- tricc_oo/converters/tricc_to_xls_form.py,sha256=Aor4Tfnz_Q-qUM9QVR2gzQln0zRoMfD1eHK7YkO-a9Y,3438
8
+ tricc_oo/converters/datadictionnary.py,sha256=JasqlLKiZzKdidsA1xc2SJ_Af1Xr6A3sKfzDynto8Ho,3686
9
+ tricc_oo/converters/drawio_type_map.py,sha256=Zp8J9iHNSJkIVrmRSM0_d4vA1X8wFPLKb8nCMPUMXKU,9114
10
+ tricc_oo/converters/tricc_to_xls_form.py,sha256=39hwWgYNitGE-AuKtjUwNLz39tEpwc7nd9gT_gw5wjc,3842
11
11
  tricc_oo/converters/utils.py,sha256=JZrtrvvOfXwdkw49pKauzinOcauWwsy-CVcw36TjyLo,1684
12
- tricc_oo/converters/xml_to_tricc.py,sha256=cDoLTwIMHIqyyNqZGwQte9YdX4y5j1Ac6r7M-zuKWZc,39403
12
+ tricc_oo/converters/xml_to_tricc.py,sha256=ea8LNEPDe32q74AJCbEjxaLt_Po47oH45K_G8fo7TzE,40388
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
16
16
  tricc_oo/converters/cql/cqlVisitor.py,sha256=iHuup2S7OGSVWLEcI4H3oecRqgXztC1sKnew_1P2iGY,33880
17
17
  tricc_oo/models/__init__.py,sha256=CgS52LLqdDIaXHvZy08hhu_VaYw80OEdfL_llM9ICBA,108
18
- tricc_oo/models/base.py,sha256=4mkAYAfvtdnTiLpUrttqQgIgfw1q_GkEgbVDKP8Txno,25849
18
+ tricc_oo/models/base.py,sha256=saMpSiXnvQe_xkQ4PKJbNLqPkzZaiEGwb42HJ1CtwfM,25937
19
19
  tricc_oo/models/calculate.py,sha256=uNP0IDUqPQcJq9Co05H8eX5wbR_DikSxuOHxfVE5Dxg,8018
20
20
  tricc_oo/models/lang.py,sha256=ZMRwdoPWe01wEDhOM0uRk-6rt3BkoAAZM8mZ61--s3A,2265
21
21
  tricc_oo/models/ocl.py,sha256=MybSeB6fgCOUVJ4aektff0vrrTZsyfwZ2Gt_pPBu_FY,8728
@@ -25,26 +25,27 @@ tricc_oo/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
25
25
  tricc_oo/parsers/xml.py,sha256=uzkb1y18MHfqVFmZqVh0sKT4cx6u0-NcAT_lV_gHBt8,4208
26
26
  tricc_oo/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  tricc_oo/serializers/planuml.py,sha256=t57587-6L3aDncpHh58lS77Zft8yxDE9DPtXx2BeUSU,132
28
- tricc_oo/serializers/xls_form.py,sha256=9nUcdT2YVzJ2Hu7WLNmphxpXg3GU-yvY6j4ua3i_FCo,21636
28
+ tricc_oo/serializers/xls_form.py,sha256=ydaD5l_CsMEhJlSO0XvXPdxrwsDw4HiRjTOPHogTQdw,23071
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=BEODXS74na1QRRcJVQ4cxiD8F7uRqaLyhE3QzKpGVvk,3891
32
32
  tricc_oo/strategies/input/drawio.py,sha256=uXAUPhXOeg0Uk_BNqlCqFBW4cWNox4VfH559bj1fhC0,12767
33
- tricc_oo/strategies/output/base_output_strategy.py,sha256=M9UFR67-_CFoW681bPAeBS1OUGuFtmUbM_rltACI0hk,8798
33
+ tricc_oo/strategies/output/base_output_strategy.py,sha256=i9L5CVUqkEAMNyBsdHJ4xA7Nptr3myHr_fHHveDX1cU,8928
34
+ tricc_oo/strategies/output/dhis2_form.py,sha256=jW9NW72_61ch1bHm8ShIH4xsJH-HMlZGPTT5txJxMUk,38278
34
35
  tricc_oo/strategies/output/fhir_form.py,sha256=hbL921pe1Doun4IQrJuZ_Sq2fCh98G3grYie5olC4uc,15740
35
36
  tricc_oo/strategies/output/html_form.py,sha256=qSleEZOMV_-Z04y-i-ucyd5rgAYWAyjPwMrw0IHtCRM,8604
36
- tricc_oo/strategies/output/openmrs_form.py,sha256=aiHUi_lDm48yaKqZGWyFMVPIj6OhQGcAADFDoYJteW0,27175
37
+ tricc_oo/strategies/output/openmrs_form.py,sha256=ne6TwAyhafR-WDs27QTKKFl85VD5sij_VEJtK6ZjOIE,28996
37
38
  tricc_oo/strategies/output/spice.py,sha256=QMeoismVC3PdbvwTK0PtUjWX9jl9780fbQIXn76fMXw,10761
38
- tricc_oo/strategies/output/xls_form.py,sha256=Qu6PSXHmtbCM8D0jB_hPZPW0Q5PUEMzsCvUcxzu7DuU,29711
39
+ tricc_oo/strategies/output/xls_form.py,sha256=_pNTND7n-55EjRphJ1hSVtRYa-UkXlmwpam2OKQ8o_w,30860
39
40
  tricc_oo/strategies/output/xlsform_cdss.py,sha256=X00Lt5MzV8TX14dR4dFI1MqllI5S1e13bKbeysWM9uA,17435
40
- tricc_oo/strategies/output/xlsform_cht.py,sha256=RY_mre9j6w2vVnRFSGn5R3CuTWFjIbQyl1uWwz9Ay5E,22965
41
+ tricc_oo/strategies/output/xlsform_cht.py,sha256=Zy8aggR1sTBP0b33RGbfUpk8pRppI1LGQEif4E1l49A,28523
41
42
  tricc_oo/strategies/output/xlsform_cht_hf.py,sha256=xm6SKirV3nMZvM2w54_zJcXAeAgAkq-EEqGEjnOWv6c,988
42
43
  tricc_oo/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
- tricc_oo/visitors/tricc.py,sha256=RtE1oY6pWBasOmx_njexBg4qlHwPZd08QR45St5fPW0,107095
44
+ tricc_oo/visitors/tricc.py,sha256=QkVZpmDvSrMbMQeCxVn15zSk3iH-3-e-udMys96JkXE,110923
44
45
  tricc_oo/visitors/utils.py,sha256=j83aAq5s5atXi3OC0jc_uJd54a8XrHHmizeeEbWZQJg,421
45
46
  tricc_oo/visitors/xform_pd.py,sha256=ryAnI3V9x3eTmJ2LNsUZfvl0_yfCqo6oBgeSu-WPqaE,9613
46
- tricc_oo-1.5.26.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
47
- tricc_oo-1.5.26.dist-info/METADATA,sha256=6Mtk7f-ZpVaQdjAga1goridnvVfVg-qvorJ4PcjcqXg,8577
48
- tricc_oo-1.5.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
- tricc_oo-1.5.26.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
50
- tricc_oo-1.5.26.dist-info/RECORD,,
47
+ tricc_oo-1.6.14.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
48
+ tricc_oo-1.6.14.dist-info/METADATA,sha256=_WkaLTsN1Yj8koCLVrOmdY9egk06du90gsMqRCcQ0Js,8600
49
+ tricc_oo-1.6.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
50
+ tricc_oo-1.6.14.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
51
+ tricc_oo-1.6.14.dist-info/RECORD,,