tricc-oo 1.5.11__tar.gz → 1.5.13__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.5.11 → tricc_oo-1.5.13}/PKG-INFO +1 -1
  2. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/pyproject.toml +1 -1
  3. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/xml_to_tricc.py +5 -4
  4. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/models/base.py +2 -0
  5. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/models/tricc.py +1 -1
  6. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/serializers/xls_form.py +1 -1
  7. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/input/drawio.py +1 -5
  8. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/output/xls_form.py +1 -1
  9. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/output/xlsform_cht.py +49 -1
  10. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/output/xlsform_cht_hf.py +4 -1
  11. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/visitors/tricc.py +10 -3
  12. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo.egg-info/PKG-INFO +1 -1
  13. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/README.md +0 -0
  14. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/setup.cfg +0 -0
  15. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tests/build.py +0 -0
  16. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tests/test_cql.py +0 -0
  17. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tests/to_ocl.py +0 -0
  18. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/__init__.py +0 -0
  19. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/__init__.py +0 -0
  20. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
  21. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/cql/cqlLexer.py +0 -0
  22. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/cql/cqlListener.py +0 -0
  23. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/cql/cqlParser.py +0 -0
  24. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
  25. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/cql_to_operation.py +0 -0
  26. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/datadictionnary.py +0 -0
  27. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/drawio_type_map.py +0 -0
  28. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/tricc_to_xls_form.py +0 -0
  29. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/converters/utils.py +0 -0
  30. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/models/__init__.py +0 -0
  31. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/models/calculate.py +0 -0
  32. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/models/lang.py +0 -0
  33. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/models/ocl.py +0 -0
  34. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/models/ordered_set.py +0 -0
  35. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/parsers/__init__.py +0 -0
  36. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/parsers/xml.py +0 -0
  37. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/serializers/__init__.py +0 -0
  38. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/serializers/planuml.py +0 -0
  39. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/__init__.py +0 -0
  40. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/input/__init__.py +0 -0
  41. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/input/base_input_strategy.py +0 -0
  42. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
  43. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/output/spice.py +0 -0
  44. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
  45. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/visitors/__init__.py +0 -0
  46. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/visitors/utils.py +0 -0
  47. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo/visitors/xform_pd.py +0 -0
  48. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo.egg-info/SOURCES.txt +0 -0
  49. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo.egg-info/dependency_links.txt +0 -0
  50. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/tricc_oo.egg-info/requires.txt +0 -0
  51. {tricc_oo-1.5.11 → tricc_oo-1.5.13}/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.5.11
3
+ Version: 1.5.13
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.5.11"
7
+ version = "1.5.13"
8
8
  description = "Python library that converts CDSS L2 in L3"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -905,12 +905,13 @@ def get_edges(diagram):
905
905
  def process_factor_edge(edge, nodes):
906
906
  factor = edge.value.strip()
907
907
  if factor != 1:
908
+ source = nodes[edge.source]
908
909
  return TriccNodeCalculate(
909
910
  id=edge.id,
910
- expression_reference=TriccOperation(TriccOperator.MULTIPLIED, [nodes[edge.source],TriccStatic(factor)]),
911
- reference=[nodes[edge.source]],
912
- activity=nodes[edge.source].activity,
913
- group=nodes[edge.source].group,
911
+ expression_reference=TriccOperation(TriccOperator.MULTIPLIED, [TriccReference(nodes[edge.source].name),TriccStatic(float(factor))]),
912
+ reference=[TriccReference(source.name)],
913
+ activity=source.activity,
914
+ group=source.group,
914
915
  label="factor {}".format(factor),
915
916
  )
916
917
  return None
@@ -142,6 +142,8 @@ class TriccBaseModel(BaseModel):
142
142
  instance.id = generate_id(f"{self.id}{nb_instance}")
143
143
  instance.instance = int(nb_instance)
144
144
  instance.base_instance = self
145
+ if hasattr(self, 'instances'):
146
+ self.instances[nb_instance] = instance
145
147
 
146
148
 
147
149
  # assign the defualt group
@@ -98,7 +98,6 @@ class TriccNodeActivity(TriccNodeBaseModel):
98
98
  else:
99
99
  instance = super().make_instance(instance_nb, activity=None)
100
100
  base_instance = (self.base_instance or self)
101
- base_instance.instances[instance_nb] = instance
102
101
  instance.base_instance = base_instance
103
102
  # instance.base_instance = self
104
103
  # we duplicate all the related nodes (not the calculate, duplication is manage in calculate version code)
@@ -283,6 +282,7 @@ class TriccNodeGoTo(TriccNodeBaseModel):
283
282
  tricc_type: TriccNodeType = TriccNodeType.goto
284
283
  link: Union[TriccNodeActivity, triccId]
285
284
  datatype: str = 'n/a'
285
+ instance: int = 1
286
286
 
287
287
  # no need ot copy
288
288
  def make_instance(self, instance_nb, activity, **kwargs):
@@ -275,7 +275,7 @@ def get_xfrom_trad(strategy, node, column, mapping, clean_html=False):
275
275
  elif column == "appearance":
276
276
  if (
277
277
  isinstance(node, TriccNodeSelect)
278
- and len(node.options) > 9
278
+ and len(node.options) > 13
279
279
  and not any(o.image or o.hint for o in node.options.values())
280
280
  ):
281
281
  value = "autocomplete"
@@ -226,11 +226,7 @@ class DrawioStrategy(BaseInputStrategy):
226
226
  # walk thought the next page
227
227
  max_instance = 1
228
228
  if node.instance == 0 or next_page.root.instance == 0:
229
- for other_page in next_page.instances.values():
230
- if int(other_page.instance) > int(max_instance):
231
- max_instance = other_page.instance
232
- # auto instance starts at 101
233
- next_page = next_page.make_instance()
229
+ next_page = next_page.make_instance((1000+node.activity.instance) if node.activity.instance>1 else None)
234
230
  else:
235
231
  # return existing instance if any
236
232
  next_page = next_page.make_instance(node.instance)
@@ -390,7 +390,7 @@ class XLSFormStrategy(BaseOutPutStrategy):
390
390
  return f"{ref_expressions[0]} mod {ref_expressions[1]}"
391
391
  def tricc_operation_minus(self, ref_expressions):
392
392
  if len(ref_expressions)>1:
393
- return ' - '.join(ref_expressions)
393
+ return ' - '.join(map(str,ref_expressions))
394
394
  elif len(ref_expressions)==1:
395
395
  return f'-{ref_expressions[0]}'
396
396
  def tricc_operation_plus(self, ref_expressions):
@@ -223,10 +223,10 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
223
223
  "",
224
224
  "",
225
225
  ]
226
- self.get_contact_inputs(df_input)
227
226
  inputs = self.export_inputs(start_pages[self.processes[0]], **kwargs)
228
227
  for input in inputs:
229
228
  df_input.loc[len(df_input)] = get_input_line(input)
229
+ self.get_contact_inputs(df_input)
230
230
  df_input.loc[len(df_input)] = [
231
231
  "hidden",
232
232
  "external_id",
@@ -310,6 +310,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
310
310
  "",
311
311
  "",
312
312
  ]
313
+ self.get_contact_inputs_calculate(df_input)
313
314
  df_input.loc[len(df_input)] = [
314
315
  "calculate",
315
316
  "created_by_person_uuid",
@@ -459,7 +460,54 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
459
460
 
460
461
  def get_contact_inputs(self, df_input):
461
462
  empty = langs.get_trads("", force_dict=True)
463
+ if not len(df_input[df_input['name'] == 'sex']):
464
+ df_input.loc[len(df_input)] = [
465
+ "hidden",
466
+ "sex",
467
+ *list(langs.get_trads("Sex", force_dict=True).values()),
468
+ *list(empty.values()),
469
+ *list(empty.values()),
470
+ "",
471
+ "hidden",
472
+ "",
473
+ *list(empty.values()),
474
+ "",
475
+ "",
476
+ "",
477
+ *list(empty.values()),
478
+ "",
479
+ "",
480
+ "",
481
+ "",
482
+ "",
483
+ ]
484
+ if not len(df_input[df_input['name'] == 'date_of_birth']):
485
+ df_input.loc[len(df_input)] = [
486
+ "hidden",
487
+ "date_of_birth",
488
+ *list(langs.get_trads("Date of birth", force_dict=True).values()),
489
+ *list(empty.values()),
490
+ *list(empty.values()),
491
+ "",
492
+ "hidden",
493
+ "",
494
+ *list(empty.values()),
495
+ "",
496
+ "",
497
+ "",
498
+ *list(empty.values()),
499
+ "",
500
+ "",
501
+ "",
502
+ "",
503
+ "",
504
+ ]
462
505
 
506
+ return df_input
507
+
508
+
509
+ def get_contact_inputs_calculate(self, df_input):
510
+ empty = langs.get_trads("", force_dict=True)
463
511
  df_input.loc[len(df_input)] = [
464
512
  "calculate",
465
513
  "patient_sex",
@@ -18,7 +18,10 @@ class XLSFormCHTHFStrategy(XLSFormCHTStrategy):
18
18
 
19
19
  def get_contact_inputs(self, df_inputs):
20
20
  return None
21
-
21
+
22
+ def get_contact_inputs_calculate(self, df_inputs):
23
+ return None
24
+
22
25
  def get_cht_summary(self):
23
26
 
24
27
  df_summary = pd.DataFrame(columns=SURVEY_MAP.keys())
@@ -494,6 +494,7 @@ def generate_calculates(node,calculates, used_calculates,processed_nodes, proces
494
494
  #add_save_calculate(calc_node, calculates, used_calculates,processed_nodes)
495
495
  for calc in list_calc:
496
496
  node.activity.nodes[calc.id] = calc
497
+ add_calculate(calculates, calc)
497
498
  return list_calc
498
499
 
499
500
 
@@ -679,6 +680,8 @@ def process_operation_reference(operation, node, processed_nodes, calculates, us
679
680
  node_reference.append(last_found)
680
681
  reference.append(TriccReference(ref))
681
682
  if replace_reference:
683
+ if not issubclass(last_found.__class__, (TriccNodeDisplayModel, TriccNodeDisplayCalculateBase, TriccNodeInput)):
684
+ last_found = get_node_expression(last_found, processed_nodes, is_prev=True)
682
685
  if isinstance(operation, (TriccOperation)):
683
686
  if modified_operation is None:
684
687
  modified_operation = operation.copy(keep_node=True)
@@ -694,9 +697,13 @@ def process_operation_reference(operation, node, processed_nodes, calculates, us
694
697
  if warn:
695
698
  logger.warning(f"Could not resolve label '{option_label}' for reference {ref}")
696
699
  return False
697
-
698
-
699
- node.path_len = max(node.path_len, last_found.path_len)
700
+ if hasattr(last_found, 'path_len'):
701
+ path_len = last_found.path_len
702
+ elif isinstance(last_found, TriccOperation):
703
+ path_len = max(getattr(n, 'path_len', 0) for n in last_found.get_references())
704
+ else:
705
+ path_len = 0
706
+ node.path_len = max(node.path_len, path_len)
700
707
  for ref in real_ref_list:
701
708
  if is_prev_processed(ref, node, processed_nodes=processed_nodes, local=False) is False:
702
709
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tricc-oo
3
- Version: 1.5.11
3
+ Version: 1.5.13
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