tricc-oo 1.6.16__tar.gz → 1.6.18__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.
- {tricc_oo-1.6.16/tricc_oo.egg-info → tricc_oo-1.6.18}/PKG-INFO +1 -1
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/pyproject.toml +1 -1
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tests/test_cql.py +9 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/cql_to_operation.py +1 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/models/base.py +5 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/xls_form.py +31 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18/tricc_oo.egg-info}/PKG-INFO +1 -1
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/LICENSE +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/README.md +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/setup.cfg +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tests/build.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tests/to_ocl.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/__init__.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/__init__.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/cql/cqlLexer.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/cql/cqlListener.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/cql/cqlParser.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/datadictionnary.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/drawio_type_map.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/tricc_to_xls_form.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/utils.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/converters/xml_to_tricc.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/models/__init__.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/models/calculate.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/models/lang.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/models/ocl.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/models/ordered_set.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/models/tricc.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/parsers/__init__.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/parsers/xml.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/serializers/__init__.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/serializers/planuml.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/serializers/xls_form.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/__init__.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/input/__init__.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/input/base_input_strategy.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/input/drawio.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/dhis2_form.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/fhir_form.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/html_form.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/openmrs_form.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/spice.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/xlsform_cht.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/strategies/output/xlsform_cht_hf.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/visitors/__init__.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/visitors/tricc.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/visitors/utils.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo/visitors/xform_pd.py +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo.egg-info/SOURCES.txt +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo.egg-info/dependency_links.txt +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo.egg-info/requires.txt +0 -0
- {tricc_oo-1.6.16 → tricc_oo-1.6.18}/tricc_oo.egg-info/top_level.txt +0 -0
|
@@ -26,6 +26,15 @@ class TestCql(unittest.TestCase):
|
|
|
26
26
|
)
|
|
27
27
|
self.assertEqual(str(dg_operation), str(dg_expected))
|
|
28
28
|
|
|
29
|
+
def test_diagnosis_list(self):
|
|
30
|
+
if_cql = 'DiagnosisList("final.TRIAGE_YELLOW", "triage_RED")'
|
|
31
|
+
dg_operation = transform_cql_to_operation(if_cql)
|
|
32
|
+
dg_expected = TriccOperation(
|
|
33
|
+
operator=TriccOperator.DIAGNOSIS_LIST,
|
|
34
|
+
reference=[TriccReference(value="final.TRIAGE_YELLOW"), TriccReference(value="triage_RED")],
|
|
35
|
+
)
|
|
36
|
+
self.assertEqual(str(dg_operation), str(dg_expected))
|
|
37
|
+
|
|
29
38
|
def test_implied_concat(self):
|
|
30
39
|
if_cql = "'A' & \"B\" & 'C'"
|
|
31
40
|
cc_operation = transform_cql_to_operation(if_cql)
|
|
@@ -377,6 +377,7 @@ class TriccOperator(StrEnum):
|
|
|
377
377
|
PARENTHESIS = "parenthesis"
|
|
378
378
|
CONCATENATE = "concatenate"
|
|
379
379
|
DATETIME_TO_DECIMAL = "datetime_to_decimal"
|
|
380
|
+
DIAGNOSIS_LIST = "diagnosis_list"
|
|
380
381
|
|
|
381
382
|
|
|
382
383
|
RETURNS_BOOLEAN = [
|
|
@@ -423,6 +424,8 @@ RETURNS_NUMBER = [
|
|
|
423
424
|
|
|
424
425
|
RETURNS_DATE = [TriccOperator.CAST_DATE]
|
|
425
426
|
|
|
427
|
+
RETURNS_STRING = [TriccOperator.DIAGNOSIS_LIST]
|
|
428
|
+
|
|
426
429
|
OPERATION_LIST = {
|
|
427
430
|
">=": TriccOperator.MORE_OR_EQUAL,
|
|
428
431
|
"<=": TriccOperator.LESS_OR_EQUAL,
|
|
@@ -480,6 +483,8 @@ class TriccOperation(BaseModel):
|
|
|
480
483
|
return "number"
|
|
481
484
|
elif self.operator in RETURNS_DATE:
|
|
482
485
|
return "date"
|
|
486
|
+
elif self.operator in RETURNS_STRING:
|
|
487
|
+
return "string"
|
|
483
488
|
elif self.operator == TriccOperator.CONCATENATE:
|
|
484
489
|
return "string"
|
|
485
490
|
elif self.operator == TriccOperator.PARENTHESIS:
|
|
@@ -694,6 +694,7 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
694
694
|
# @param left part
|
|
695
695
|
# @param right part
|
|
696
696
|
def generate_xls_form_calculate(self, node, processed_nodes, stashed_nodes, calculates, **kwargs):
|
|
697
|
+
self.codesystems = kwargs.get("codesystems", {})
|
|
697
698
|
if is_ready_to_process(node, processed_nodes, strict=False) and process_reference(
|
|
698
699
|
node,
|
|
699
700
|
processed_nodes,
|
|
@@ -749,6 +750,36 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
749
750
|
def tricc_operation_concatenate(self, ref_expressions):
|
|
750
751
|
return f"concat({','.join(map(str, ref_expressions))})"
|
|
751
752
|
|
|
753
|
+
def tricc_operation_diagnosis_list(self, ref_expressions):
|
|
754
|
+
from tricc_oo.converters.datadictionnary import lookup_codesystems_code
|
|
755
|
+
parts = []
|
|
756
|
+
for expr in ref_expressions:
|
|
757
|
+
if isinstance(expr, str):
|
|
758
|
+
# expr is the variable reference like "final.TRIAGE_YELLOW" or "${var}"
|
|
759
|
+
if expr.startswith("${") and expr.endswith("}"):
|
|
760
|
+
var_path = expr[2:-1]
|
|
761
|
+
else:
|
|
762
|
+
var_path = expr
|
|
763
|
+
# Handle final. prefix
|
|
764
|
+
code = var_path[6:] if var_path.startswith("final.") else var_path
|
|
765
|
+
concept = lookup_codesystems_code(self.codesystems, code)
|
|
766
|
+
if concept:
|
|
767
|
+
display = concept.get("display", code)
|
|
768
|
+
else:
|
|
769
|
+
logger.warning(f"Diagnosis code '{code}' not found in codesystems")
|
|
770
|
+
display = code
|
|
771
|
+
if expr.startswith("${"):
|
|
772
|
+
condition = f"{expr} = 1"
|
|
773
|
+
else:
|
|
774
|
+
condition = f"${{{expr}}} = 1"
|
|
775
|
+
# Always include comma after diagnosis name
|
|
776
|
+
parts.append(f"if({condition}, '{display},', '')")
|
|
777
|
+
else:
|
|
778
|
+
logger.warning(f"Unexpected expression type: {type(expr)}, value: {expr}")
|
|
779
|
+
if parts:
|
|
780
|
+
return f"concat({','.join(parts)})"
|
|
781
|
+
return "''"
|
|
782
|
+
|
|
752
783
|
def validate(self):
|
|
753
784
|
"""Validate the generated XLS form using pyxform."""
|
|
754
785
|
try:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|