tricc-oo 1.6.23__tar.gz → 1.6.24__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.23/tricc_oo.egg-info → tricc_oo-1.6.24}/PKG-INFO +1 -1
  2. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/pyproject.toml +1 -1
  3. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/serializers/xls_form.py +3 -2
  4. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/xls_form.py +11 -1
  5. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/xlsform_cht.py +0 -7
  6. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/visitors/tricc.py +10 -10
  7. {tricc_oo-1.6.23 → tricc_oo-1.6.24/tricc_oo.egg-info}/PKG-INFO +1 -1
  8. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo.egg-info/SOURCES.txt +1 -1
  9. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/LICENSE +0 -0
  10. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/README.md +0 -0
  11. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/setup.cfg +0 -0
  12. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tests/build.py +0 -0
  13. {tricc_oo-1.6.23/tests → tricc_oo-1.6.24/tests/data}/test_cql.py +0 -0
  14. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tests/to_ocl.py +0 -0
  15. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/__init__.py +0 -0
  16. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/__init__.py +0 -0
  17. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
  18. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/cql/cqlLexer.py +0 -0
  19. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/cql/cqlListener.py +0 -0
  20. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/cql/cqlParser.py +0 -0
  21. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
  22. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/cql_to_operation.py +0 -0
  23. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/datadictionnary.py +0 -0
  24. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/drawio_type_map.py +0 -0
  25. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/tricc_to_xls_form.py +0 -0
  26. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/utils.py +0 -0
  27. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/converters/xml_to_tricc.py +0 -0
  28. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/models/__init__.py +0 -0
  29. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/models/base.py +0 -0
  30. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/models/calculate.py +0 -0
  31. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/models/lang.py +0 -0
  32. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/models/ocl.py +0 -0
  33. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/models/ordered_set.py +0 -0
  34. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/models/tricc.py +0 -0
  35. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/parsers/__init__.py +0 -0
  36. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/parsers/xml.py +0 -0
  37. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/serializers/__init__.py +0 -0
  38. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/serializers/planuml.py +0 -0
  39. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/__init__.py +0 -0
  40. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/input/__init__.py +0 -0
  41. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/input/base_input_strategy.py +0 -0
  42. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/input/drawio.py +0 -0
  43. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
  44. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/dhis2_form.py +0 -0
  45. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/fhir_form.py +0 -0
  46. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/html_form.py +0 -0
  47. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/openmrs_form.py +0 -0
  48. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/spice.py +0 -0
  49. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
  50. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/strategies/output/xlsform_cht_hf.py +0 -0
  51. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/visitors/__init__.py +0 -0
  52. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/visitors/utils.py +0 -0
  53. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo/visitors/xform_pd.py +0 -0
  54. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo.egg-info/dependency_links.txt +0 -0
  55. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/tricc_oo.egg-info/requires.txt +0 -0
  56. {tricc_oo-1.6.23 → tricc_oo-1.6.24}/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.23
3
+ Version: 1.6.24
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.23"
7
+ version = "1.6.24"
8
8
  description = "Python library that converts CDSS L2 in L3"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -43,6 +43,7 @@ TRICC_CALC_EXPRESSION = "${{{0}}}>0"
43
43
 
44
44
  def get_export_group_name(in_node): return f"gcalc_{get_export_name(in_node)}"
45
45
 
46
+ def get_export_group_required(in_node): return in_node.relevance and in_node.relevance != TriccStatic(True)
46
47
 
47
48
  def start_group(
48
49
  strategy,
@@ -65,9 +66,9 @@ def start_group(
65
66
  groups[name] = 0
66
67
  relevance = relevance and cur_group.relevance is not None and cur_group.relevance != ""
67
68
  past_instances = len(getattr(cur_group.base_instance, "instances", []))
68
- group_calc_required = relevance is not None and (len(str(relevance)) > 100 or past_instances > 1)
69
+ group_calc_required = get_export_group_required(cur_group)
69
70
  calc = None
70
- if group_calc_required and getattr(cur_group.relevance, 'operator', None) != TriccOperator.ISTRUE:
71
+ if group_calc_required and len(df_calculate[df_calculate["name"] == get_export_group_name(cur_group)]) == 0:
71
72
 
72
73
  calc = TriccNodeCalculate(
73
74
  id=generate_id(get_export_group_name(name)),
@@ -19,7 +19,7 @@ from tricc_oo.models.ordered_set import OrderedSet
19
19
  from tricc_oo.models.calculate import (
20
20
  TriccNodeEnd,
21
21
  TriccNodeDisplayCalculateBase,
22
-
22
+ TriccNodeActivityStart,
23
23
  )
24
24
  from tricc_oo.models.tricc import (
25
25
  TriccNodeCalculateBase,
@@ -28,6 +28,7 @@ from tricc_oo.models.tricc import (
28
28
  TriccNodeSelect,
29
29
  TriccNodeInputModel,
30
30
  TriccNodeDisplayModel,
31
+ TriccNodeMainStart,
31
32
  TRICC_FALSE_VALUE,
32
33
  TRICC_TRUE_VALUE,
33
34
  )
@@ -50,6 +51,8 @@ from tricc_oo.serializers.xls_form import (
50
51
  SURVEY_MAP,
51
52
  end_group,
52
53
  generate_xls_form_export,
54
+ get_export_group_name,
55
+ get_export_group_required,
53
56
  start_group,
54
57
  )
55
58
  from tricc_oo.strategies.output.base_output_strategy import BaseOutPutStrategy
@@ -745,6 +748,13 @@ class XLSFormStrategy(BaseOutPutStrategy):
745
748
  elif isinstance(r, TriccNodeSelectOption):
746
749
  logger.debug(f"select option {r.get_name()} from {r.select.get_name()} was used as a reference")
747
750
  return get_export_name(r)
751
+ elif isinstance(r, TriccNodeActivityStart):
752
+ if get_export_group_required(r.activity):
753
+ return f"${{{get_export_group_name(r.activity)}}}"
754
+ else:
755
+ return f"({self.get_tricc_operation_expression(r.relevance)})"
756
+ elif isinstance(r, TriccNodeMainStart):
757
+ return "1"
748
758
  elif issubclass(r.__class__, (TriccNodeInputModel, TriccNodeSelect)):
749
759
  return f"coalesce(${{{get_export_name(r)}}},{coalesce_fallback})"
750
760
  elif issubclass(r.__class__, TriccNodeBaseModel):
@@ -811,13 +811,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
811
811
  logger.error(f"CHT XLSForm validation error for {os.path.basename(xls_file)}: {str(e)}")
812
812
  all_valid = False
813
813
 
814
- jar_in_zip = "site-packages/pyxform/validators/odk_validate/bin/ODK_Validate.jar"
815
- zip_ref.extract(jar_in_zip, os.path.dirname(__file__))
816
-
817
- # Move to final location
818
- extracted_jar = os.path.join(os.path.dirname(__file__), jar_in_zip)
819
- shutil.move(extracted_jar, jar_path)
820
-
821
814
  logger.info(f"Extracted ODK Validate JAR to {jar_path}")
822
815
  return jar_path
823
816
 
@@ -240,7 +240,7 @@ def merge_all_expressions(expression, all_versions):
240
240
  datatype = expression.get_datatype() if expression else "unknown"
241
241
 
242
242
  if datatype == "boolean":
243
- expression = or_join(all_versions)
243
+ expression = or_join([expression, *all_versions])
244
244
 
245
245
  else:
246
246
  # COALESCE through all previous versions, then the current expression
@@ -2276,15 +2276,15 @@ def get_prev_node_expression(node, processed_nodes, get_overall_exp=False, exclu
2276
2276
  )
2277
2277
  elif none_sequence_defined_prev_node:
2278
2278
  # For nodes with is_sequence_defined = False, AND the activity relevance with the prev expression
2279
- activity_relevance = get_node_expression(
2280
- prev_node.activity,
2281
- processed_nodes=processed_nodes,
2282
- get_overall_exp=get_overall_exp,
2283
- is_prev=True,
2284
- negate=False,
2285
- process=process,
2286
- )
2287
- act_sub = and_join([activity_relevance, act_sub])
2279
+ # activity_relevance = get_node_expression(
2280
+ # prev_node.activity,
2281
+ # processed_nodes=processed_nodes,
2282
+ # get_overall_exp=get_overall_exp,
2283
+ # is_prev=True,
2284
+ # negate=False,
2285
+ # process=process,
2286
+ # )
2287
+ act_sub = and_join([ prev_node.activity.root, act_sub])
2288
2288
  add_sub_expression(expression_inputs, act_sub)
2289
2289
  # avoid void is there is not conditions to avoid looping too much itme
2290
2290
  # expression_inputs = clean_or_list(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tricc-oo
3
- Version: 1.6.23
3
+ Version: 1.6.24
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
6
5
  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