tricc-oo 1.4.8__tar.gz → 1.4.10__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.8 → tricc_oo-1.4.10}/PKG-INFO +1 -1
  2. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/pyproject.toml +1 -1
  3. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/utils.py +21 -1
  4. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/xml_to_tricc.py +5 -4
  5. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/models/base.py +3 -3
  6. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/models/calculate.py +1 -1
  7. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/models/tricc.py +1 -1
  8. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/input/base_input_strategy.py +2 -2
  9. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/visitors/tricc.py +16 -16
  10. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo.egg-info/PKG-INFO +1 -1
  11. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/LICENSE +0 -0
  12. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/README.md +0 -0
  13. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/setup.cfg +0 -0
  14. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tests/build.py +0 -0
  15. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tests/test_cql.py +0 -0
  16. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tests/to_ocl.py +0 -0
  17. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/__init__.py +0 -0
  18. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/__init__.py +0 -0
  19. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
  20. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/cql/cqlLexer.py +0 -0
  21. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/cql/cqlListener.py +0 -0
  22. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/cql/cqlParser.py +0 -0
  23. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
  24. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/cql_to_operation.py +0 -0
  25. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/datadictionnary.py +0 -0
  26. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/drawio_type_map.py +0 -0
  27. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/converters/tricc_to_xls_form.py +0 -0
  28. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/models/__init__.py +0 -0
  29. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/models/lang.py +0 -0
  30. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/models/ocl.py +0 -0
  31. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/models/ordered_set.py +0 -0
  32. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/parsers/__init__.py +0 -0
  33. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/parsers/xml.py +0 -0
  34. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/serializers/__init__.py +0 -0
  35. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/serializers/planuml.py +0 -0
  36. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/serializers/xls_form.py +0 -0
  37. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/__init__.py +0 -0
  38. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/input/__init__.py +0 -0
  39. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/input/drawio.py +0 -0
  40. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
  41. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/output/spice.py +0 -0
  42. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/output/xls_form.py +0 -0
  43. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
  44. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/output/xlsform_cht.py +0 -0
  45. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/strategies/output/xlsform_cht_hf.py +0 -0
  46. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/visitors/__init__.py +0 -0
  47. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo/visitors/xform_pd.py +0 -0
  48. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo.egg-info/SOURCES.txt +0 -0
  49. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo.egg-info/dependency_links.txt +0 -0
  50. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo.egg-info/requires.txt +0 -0
  51. {tricc_oo-1.4.8 → tricc_oo-1.4.10}/tricc_oo.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tricc-oo
3
- Version: 1.4.8
3
+ Version: 1.4.10
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.8"
7
+ version = "1.4.10"
8
8
  description = "Python library that converts CDSS L2 in L3"
9
9
  readme = "README.md"
10
10
  license-files = ["LICENSE"]
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ import re
2
3
  import random
3
4
  import string
4
5
  import hashlib
@@ -48,5 +49,24 @@ def get_rand_name(name=None, length=8):
48
49
 
49
50
  # the soup.text strips off the html formatting also
50
51
  def remove_html(string):
51
- text = md(string, strip=["img", "table", "a"])
52
+ placeholders = {}
53
+
54
+ def replace_placeholders(match):
55
+ key = f"__PLACEHOLDER_{len(placeholders)}__"
56
+ placeholders[key] = match.group(0)
57
+ return key
58
+
59
+ protected_text = re.sub(r"\${.*?\}", replace_placeholders, string)
60
+
61
+ text = md(
62
+ protected_text,
63
+ strip=["img", "table", "a"],
64
+ strong_em_symbol="*",
65
+ escape_underscores=False,
66
+ escape_asterisks=False,
67
+ bullets=["-", "*"],
68
+ )
69
+
70
+ for key, original in placeholders.items():
71
+ text = text.replace(key, original)
52
72
  return text
@@ -186,7 +186,7 @@ def process_edges(diagram, media_path, activity, nodes):
186
186
  if image is not None:
187
187
  images.append({"file_path": enriched, "image_content": image})
188
188
 
189
- elif isinstance(nodes[edge.target], (TriccNodeActivityEnd, TriccNodeEnd)):
189
+ elif isinstance(nodes[edge.target], (TriccNodeActivityEnd)) or (isinstance(nodes[edge.target], (TriccNodeEnd)) and isinstance(activity.root, TriccNodeMainStart )):
190
190
  end_found = True
191
191
  if (
192
192
  edge.target in nodes
@@ -240,7 +240,7 @@ def process_edges(diagram, media_path, activity, nodes):
240
240
  )
241
241
  )
242
242
  if not end_found:
243
- fake_end = TriccNodeActivityEnd(id=generate_id(), activity=activity, group=activity)
243
+ fake_end = TriccNodeActivityEnd(id=generate_id(f"e{activity.name}"), activity=activity, group=activity)
244
244
  last_nodes = [
245
245
  n for n in list(activity.nodes.values())
246
246
  if (
@@ -490,8 +490,9 @@ def get_max_named_version(calculates, name):
490
490
 
491
491
 
492
492
  def inject_bridge_path(node, nodes):
493
- calc_id = generate_id()
494
- calc_name = "path_" + calc_id
493
+ calc_name = "p" + node.id
494
+ calc_id = generate_id(calc_name)
495
+
495
496
  data = {
496
497
  "id": calc_id,
497
498
  "group": node.group,
@@ -116,7 +116,7 @@ class TriccBaseModel(BaseModel):
116
116
  def make_instance(self, nb_instance, **kwargs):
117
117
  instance = self.copy()
118
118
  # change the id to avoid collision of name
119
- instance.id = generate_id()
119
+ instance.id = generate_id(f"{self.id}{nb_instance}")
120
120
  instance.instance = int(nb_instance)
121
121
  instance.base_instance = self
122
122
 
@@ -149,7 +149,7 @@ class TriccBaseModel(BaseModel):
149
149
 
150
150
  def __init__(self, **data):
151
151
  if 'id' not in data:
152
- data['id'] = generate_id()
152
+ data['id'] = generate_id(str(data))
153
153
  super().__init__(**data)
154
154
 
155
155
 
@@ -181,7 +181,7 @@ class TriccGroup(TriccBaseModel):
181
181
  def __init__(self, **data):
182
182
  super().__init__(**data)
183
183
  if self.name is None:
184
- self.name = generate_id()
184
+ self.name = generate_id(str(data))
185
185
 
186
186
  def get_name(self):
187
187
  result = str(super().get_name())
@@ -102,7 +102,7 @@ class TriccRhombusMixIn():
102
102
  exit(1)
103
103
  instance.reference = reference
104
104
  instance.expression_reference = expression_reference
105
- instance.name = get_rand_name()
105
+ instance.name = get_rand_name(self.id)
106
106
  return instance
107
107
 
108
108
 
@@ -224,7 +224,7 @@ class TriccNodeActivity(TriccNodeBaseModel):
224
224
  TriccNodeEnd,
225
225
  TriccNodeActivityEnd,
226
226
  )
227
- return list(filter(lambda x: issubclass(x.__class__, (TriccNodeEnd,TriccNodeActivityEnd)), self.nodes.values()))
227
+ return list(filter(lambda x: isinstance(x, (TriccNodeActivityEnd)) or (isinstance(x, (TriccNodeEnd)) and isinstance(self.root, TriccNodeMainStart )), self.nodes.values()))
228
228
 
229
229
 
230
230
 
@@ -53,14 +53,14 @@ class BaseInputStrategy:
53
53
  project.start_pages['determine-diagnosis'] = diags_activity
54
54
  root_process = sorted_pages[list(sorted_pages.keys())[0]][0].root
55
55
  root = TriccNodeMainStart(
56
- id=generate_id(),
56
+ id=generate_id('s-determine-diagnosis'),
57
57
  form_id=root_process.form_id,
58
58
  label=root_process.label
59
59
  )
60
60
  nodes = {}
61
61
  nodes[root.id] = root
62
62
  app = TriccNodeActivity(
63
- id=generate_id(),
63
+ id=generate_id('a-determine-diagnosis'),
64
64
  name=root_process.name,
65
65
  root=root,
66
66
  nodes=nodes
@@ -162,7 +162,7 @@ def process_calculate(node,processed_nodes, stashed_nodes, calculates, used_calc
162
162
 
163
163
 
164
164
  calc = TriccNodeCalculate(
165
- id=generate_id(),
165
+ id=generate_id(f"save{node.id}"),
166
166
  name=node.name,
167
167
  path_len=node.path_len+1,
168
168
  version=last_version.version + 2,
@@ -304,7 +304,7 @@ def get_max_named_version(calculates,name):
304
304
  return max
305
305
 
306
306
  def get_count_node(node):
307
- count_id = generate_id()
307
+ count_id = generate_id(f"count{node.id}")
308
308
  count_name = "cnt_"+count_id
309
309
  return TriccNodeCount(
310
310
  id = count_id,
@@ -331,7 +331,7 @@ def get_activity_wait(prev_nodes, nodes_to_wait, next_nodes, replaced_node = Non
331
331
 
332
332
  activity = activity or prev_node.activity
333
333
  calc_node = TriccNodeWait(
334
- id = "ar_"+generate_id(),
334
+ id = generate_id(f"ar{''.join([x.id for x in nodes_to_wait])}{activity.id}"),
335
335
  reference = nodes_to_wait,
336
336
  activity = activity,
337
337
  group = activity,
@@ -359,7 +359,7 @@ def get_bridge_path(prev_nodes, node=None,edge_only=False):
359
359
  p_p_node = next(iterator)
360
360
  if node is None:
361
361
  node = p_p_node
362
- calc_id = generate_id()
362
+ calc_id = generate_id(f"br{''.join([x.id for x in prev_nodes])}{node.id}")
363
363
  calc_name = "path_"+calc_id
364
364
  data = {
365
365
  'id': calc_id,
@@ -478,7 +478,7 @@ def generate_calculates(node,calculates, used_calculates,processed_nodes):
478
478
  calc_node.name=calculate_name
479
479
  calc_node.label = "save select: " +node.get_name()
480
480
  else:
481
- calc_id = generate_id()
481
+ calc_id = generate_id(f"autosave{node.id}")
482
482
  calc_node = TriccNodeCalculate(
483
483
  name=calculate_name,
484
484
  id = calc_id,
@@ -735,7 +735,7 @@ def add_used_calculate(node, prev_node, calculates, used_calculates, processed_n
735
735
 
736
736
  def get_select_not_available_options(node,group,label):
737
737
  return {0:TriccNodeSelectOption(
738
- id = generate_id(),
738
+ id = generate_id(f"notavaialble{node.id}"),
739
739
  name="1",
740
740
  label=label,
741
741
  select = node,
@@ -745,7 +745,7 @@ def get_select_not_available_options(node,group,label):
745
745
 
746
746
  def get_select_yes_no_options(node, group):
747
747
  yes = TriccNodeSelectOption(
748
- id = generate_id(),
748
+ id = generate_id(f'yes{node.id}'),
749
749
  name=f"{TRICC_TRUE_VALUE}",
750
750
  label="Yes",
751
751
  select = node,
@@ -753,7 +753,7 @@ def get_select_yes_no_options(node, group):
753
753
  list_name = node.list_name
754
754
  )
755
755
  no = TriccNodeSelectOption(
756
- id = generate_id(),
756
+ id = generate_id(f'no{node.id}'),
757
757
  name=f"{TRICC_FALSE_VALUE}",
758
758
  label="No",
759
759
  select = node,
@@ -1584,7 +1584,7 @@ def export_proposed_diags(activity, diags=None, **kwargs):
1584
1584
 
1585
1585
  def get_accept_diagnostic_node(code, display, severity, activity):
1586
1586
  node = TriccNodeAcceptDiagnostic(
1587
- id=generate_id(),
1587
+ id=generate_id("pre_final." + code),
1588
1588
  name="pre_final." + code,
1589
1589
  label=display,
1590
1590
  list_name="acc_rej",
@@ -1597,7 +1597,7 @@ def get_accept_diagnostic_node(code, display, severity, activity):
1597
1597
 
1598
1598
  def get_diagnostic_node(code, display, severity, activity):
1599
1599
  node = TriccNodeAcceptDiagnostic(
1600
- id=generate_id(),
1600
+ id=generate_id("final." + code),
1601
1601
  name="final." + code,
1602
1602
  label=display,
1603
1603
  list_name="acc_rej",
@@ -1610,7 +1610,7 @@ def get_diagnostic_node(code, display, severity, activity):
1610
1610
 
1611
1611
  def get_select_accept_reject_options(node, group):
1612
1612
  yes = TriccNodeSelectOption(
1613
- id = generate_id(),
1613
+ id = generate_id(f'accept{node.id}'),
1614
1614
  name=f"{TRICC_TRUE_VALUE}",
1615
1615
  label="Accept",
1616
1616
  select = node,
@@ -1618,7 +1618,7 @@ def get_select_accept_reject_options(node, group):
1618
1618
  list_name = node.list_name
1619
1619
  )
1620
1620
  no = TriccNodeSelectOption(
1621
- id = generate_id(),
1621
+ id = generate_id(f'reject{node.id}'),
1622
1622
  name=f"{TRICC_FALSE_VALUE}",
1623
1623
  label="Reject",
1624
1624
  select = node,
@@ -1629,13 +1629,13 @@ def get_select_accept_reject_options(node, group):
1629
1629
 
1630
1630
  def create_determine_diagnosis_activity(diags):
1631
1631
  start = TriccNodeActivityStart(
1632
- id=generate_id(),
1632
+ id=generate_id('start.determine-diagnosis'),
1633
1633
  name="start.determine-diagnosis"
1634
1634
  )
1635
1635
 
1636
1636
 
1637
1637
  activity = TriccNodeActivity(
1638
- id=generate_id(),
1638
+ id=generate_id('activity-determine-diagnosis'),
1639
1639
  name='determine-diagnosis',
1640
1640
  label='Diagnosis',
1641
1641
  root=start,
@@ -1647,7 +1647,7 @@ def create_determine_diagnosis_activity(diags):
1647
1647
  diags_conf = []
1648
1648
  r_diags_conf = []
1649
1649
  end = TriccNodeActivityEnd(
1650
- id=generate_id(),
1650
+ id=generate_id("end.determine-diagnosis"),
1651
1651
  name="end.determine-diagnosis",
1652
1652
  activity=activity,
1653
1653
  group=activity,
@@ -1657,7 +1657,7 @@ def create_determine_diagnosis_activity(diags):
1657
1657
  d = get_diagnostic_node(proposed.name, proposed.label, proposed.severity, activity)
1658
1658
  diags_conf.append(d)
1659
1659
  r = TriccNodeRhombus(
1660
- id=generate_id(),
1660
+ id=generate_id(f"proposed-rhombus{proposed.id}"),
1661
1661
  expression_reference=TriccOperation(
1662
1662
  TriccOperator.ISTRUE,
1663
1663
  [TriccReference(proposed.name)]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tricc-oo
3
- Version: 1.4.8
3
+ Version: 1.4.10
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
File without changes
File without changes