tricc-oo 1.5.15__py3-none-any.whl → 1.5.18__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.
- tricc_oo/converters/cql_to_operation.py +2 -0
- tricc_oo/converters/drawio_type_map.py +2 -3
- tricc_oo/converters/xml_to_tricc.py +4 -3
- tricc_oo/models/base.py +8 -3
- tricc_oo/serializers/xls_form.py +1 -1
- tricc_oo/strategies/output/base_output_strategy.py +4 -0
- tricc_oo/strategies/output/xls_form.py +8 -1
- tricc_oo/visitors/tricc.py +41 -20
- {tricc_oo-1.5.15.dist-info → tricc_oo-1.5.18.dist-info}/METADATA +1 -1
- {tricc_oo-1.5.15.dist-info → tricc_oo-1.5.18.dist-info}/RECORD +12 -12
- {tricc_oo-1.5.15.dist-info → tricc_oo-1.5.18.dist-info}/WHEEL +0 -0
- {tricc_oo-1.5.15.dist-info → tricc_oo-1.5.18.dist-info}/top_level.txt +0 -0
|
@@ -21,8 +21,10 @@ FUNCTION_MAP = {
|
|
|
21
21
|
'Concatenate': TriccOperator.CONCATENATE,
|
|
22
22
|
'Izscore': TriccOperator.IZSCORE,
|
|
23
23
|
'Zscore': TriccOperator.ZSCORE,
|
|
24
|
+
'Round': TriccOperator.ROUND,
|
|
24
25
|
'DrugDosage': TriccOperator.DRUG_DOSAGE,
|
|
25
26
|
'HasQualifier': TriccOperator.HAS_QUALIFIER,
|
|
27
|
+
'DateTimeToDecimal' : TriccOperator.DATETIME_TO_DECIMAL
|
|
26
28
|
}
|
|
27
29
|
# TODO
|
|
28
30
|
# Min
|
|
@@ -45,7 +45,6 @@ TYPE_MAP = {
|
|
|
45
45
|
"constraint_message",
|
|
46
46
|
"relevance",
|
|
47
47
|
"priority", "trigger", "default"
|
|
48
|
-
|
|
49
48
|
],
|
|
50
49
|
"mandatory_attributes": ["label", "name", "list_name"],
|
|
51
50
|
"model": TriccNodeSelectOne
|
|
@@ -99,13 +98,13 @@ TYPE_MAP = {
|
|
|
99
98
|
|
|
100
99
|
TriccNodeType.text: {
|
|
101
100
|
"objects": ["UserObject", "object"],
|
|
102
|
-
"attributes": ["save", "relevance","priority", "trigger", "default"],
|
|
101
|
+
"attributes": ["save", "relevance","priority", "trigger", "default", "constraint", "constraint_message"],
|
|
103
102
|
"mandatory_attributes": ["label", 'name'],
|
|
104
103
|
"model": TriccNodeText
|
|
105
104
|
},
|
|
106
105
|
TriccNodeType.date: {
|
|
107
106
|
"objects": ["UserObject", "object"],
|
|
108
|
-
"attributes": ["save", "relevance","priority", "trigger", "default"],
|
|
107
|
+
"attributes": ["save", "relevance","priority", "trigger", "default", "constraint", "constraint_message"],
|
|
109
108
|
"mandatory_attributes": ["label", "name"],
|
|
110
109
|
"model": TriccNodeDate
|
|
111
110
|
},
|
|
@@ -774,15 +774,15 @@ def clean_link(link):
|
|
|
774
774
|
return link_parts[1]
|
|
775
775
|
|
|
776
776
|
|
|
777
|
-
def get_groups(diagram, nodes,
|
|
777
|
+
def get_groups(diagram, nodes, activity):
|
|
778
778
|
groups = {}
|
|
779
779
|
list = get_tricc_type_list(diagram, "object", TriccNodeType.page)
|
|
780
780
|
for elm in list:
|
|
781
|
-
add_group(elm, diagram, nodes, groups,
|
|
781
|
+
add_group(elm, diagram, nodes, groups, activity, activity)
|
|
782
782
|
return groups
|
|
783
783
|
|
|
784
784
|
|
|
785
|
-
def add_group(elm, diagram, nodes, groups, parent_group):
|
|
785
|
+
def add_group(elm, diagram, nodes, groups, parent_group, activity):
|
|
786
786
|
external_id = elm.attrib.get("id")
|
|
787
787
|
id = get_id(external_id, diagram.attrib.get("id"))
|
|
788
788
|
if id not in groups:
|
|
@@ -792,6 +792,7 @@ def add_group(elm, diagram, nodes, groups, parent_group):
|
|
|
792
792
|
id=id,
|
|
793
793
|
external_id=external_id,
|
|
794
794
|
group=parent_group,
|
|
795
|
+
activity=activity
|
|
795
796
|
)
|
|
796
797
|
# get elememt witn parent = id and tricc_type defiend
|
|
797
798
|
list_child = get_tricc_type_list(
|
tricc_oo/models/base.py
CHANGED
|
@@ -192,6 +192,7 @@ class TriccEdge(TriccBaseModel):
|
|
|
192
192
|
class TriccGroup(TriccBaseModel):
|
|
193
193
|
tricc_type: TriccNodeType = TriccNodeType.page
|
|
194
194
|
group: Optional[TriccBaseModel] = None
|
|
195
|
+
activity: TriccBaseModel
|
|
195
196
|
name: Optional[str] = None
|
|
196
197
|
export_name:Optional[str] = None
|
|
197
198
|
label: Optional[Union[str, Dict[str,str]]] = None
|
|
@@ -356,6 +357,7 @@ class TriccOperator(StrEnum):
|
|
|
356
357
|
NOT = 'not'
|
|
357
358
|
ISNULL = 'isnull'
|
|
358
359
|
ISNOTNULL= 'isnotnull'
|
|
360
|
+
ROUND = 'round'
|
|
359
361
|
|
|
360
362
|
CASE = 'case' # ref (equal value, res), (equal value,res)
|
|
361
363
|
IFS = 'ifs' #(cond, res), (cond,res)
|
|
@@ -363,7 +365,6 @@ class TriccOperator(StrEnum):
|
|
|
363
365
|
|
|
364
366
|
# CDSS Specific
|
|
365
367
|
HAS_QUALIFIER = 'has_qualifier'
|
|
366
|
-
|
|
367
368
|
ZSCORE = 'zscore' # left table_name, right Y, gender give Z
|
|
368
369
|
IZSCORE = 'izscore' #left table_name, right Z, gender give Y
|
|
369
370
|
AGE_DAY = 'age_day' # age from dob
|
|
@@ -382,6 +383,7 @@ class TriccOperator(StrEnum):
|
|
|
382
383
|
CAST_DATE = 'cast_date'
|
|
383
384
|
PARENTHESIS = 'parenthesis'
|
|
384
385
|
CONCATENATE = 'concatenate'
|
|
386
|
+
DATETIME_TO_DECIMAL = 'datetime_to_decimal'
|
|
385
387
|
|
|
386
388
|
RETURNS_BOOLEAN =[
|
|
387
389
|
TriccOperator.ADD_OR,
|
|
@@ -413,6 +415,8 @@ RETURNS_NUMBER = [
|
|
|
413
415
|
TriccOperator.AGE_YEAR,
|
|
414
416
|
TriccOperator.ZSCORE,
|
|
415
417
|
TriccOperator.IZSCORE,
|
|
418
|
+
TriccOperator.ROUND,
|
|
419
|
+
TriccOperator.DATETIME_TO_DECIMAL,
|
|
416
420
|
TriccOperator.PLUS,
|
|
417
421
|
TriccOperator.MINUS,
|
|
418
422
|
TriccOperator.DIVIDED,
|
|
@@ -455,7 +459,8 @@ class TriccOperation(BaseModel):
|
|
|
455
459
|
return hash(self.__repr__())
|
|
456
460
|
|
|
457
461
|
def __repr__(self):
|
|
458
|
-
|
|
462
|
+
str_ref = map(repr, self.reference)
|
|
463
|
+
return f"TriccOperation:{self.operator}({', '.join(map(str, str_ref))})"
|
|
459
464
|
|
|
460
465
|
def __eq__(self, other):
|
|
461
466
|
return self.__str__() == str(other)
|
|
@@ -657,7 +662,7 @@ def clean_or_list(list_or, elm_and=None):
|
|
|
657
662
|
if len(list_or) == 0:
|
|
658
663
|
return []
|
|
659
664
|
|
|
660
|
-
return sorted(list(set(list_or)), key=
|
|
665
|
+
return sorted(list(set(list_or)), key=repr)
|
|
661
666
|
|
|
662
667
|
def and_join(argv):
|
|
663
668
|
argv=clean_and_list(argv)
|
tricc_oo/serializers/xls_form.py
CHANGED
|
@@ -264,7 +264,7 @@ def get_xfrom_trad(strategy, node, column, mapping, clean_html=False):
|
|
|
264
264
|
issubclass(node.__class__, TriccNodeDisplayCalculateBase)
|
|
265
265
|
and column == "calculation"
|
|
266
266
|
and isinstance(value, str)
|
|
267
|
-
and not value.startswith("number")
|
|
267
|
+
and not (value.startswith("number") or value.startswith("round"))
|
|
268
268
|
and getattr(node, "expression", None)
|
|
269
269
|
and node.expression.get_datatype() in ("number", "boolean")
|
|
270
270
|
):
|
|
@@ -131,6 +131,10 @@ class BaseOutPutStrategy:
|
|
|
131
131
|
raise NotImplementedError(f"This type of opreration is not supported in this strategy")
|
|
132
132
|
def tricc_operation_zscore(self, ref_expressions):
|
|
133
133
|
raise NotImplementedError(f"This type of opreration is not supported in this strategy")
|
|
134
|
+
def tricc_operation_datetime_to_decimal(self, ref_expressions):
|
|
135
|
+
raise NotImplementedError(f"This type of opreration is not supported in this strategy")
|
|
136
|
+
def tricc_operation_round(self, ref_expressions):
|
|
137
|
+
raise NotImplementedError(f"This type of opreration is not supported in this strategy")
|
|
134
138
|
def tricc_operation_izscore(self, ref_expressions):
|
|
135
139
|
raise NotImplementedError(f"This type of opreration is not supported in this strategy")
|
|
136
140
|
def tricc_operation_age_day(self, ref_expressions):
|
|
@@ -569,6 +569,13 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
569
569
|
# return ((Math.pow((y / m), l) - 1) / (s * l));
|
|
570
570
|
return f"(pow({y} div ({m}), {ll}) -1) div (({s}) div ({ll}))"
|
|
571
571
|
|
|
572
|
+
def tricc_operation_datetime_to_decimal(self, ref_expressions):
|
|
573
|
+
return f"decimal-date-time({ref_expressions[0]})"
|
|
574
|
+
|
|
575
|
+
def tricc_operation_round(self, ref_expressions):
|
|
576
|
+
return f"round({ref_expressions[0]})"
|
|
577
|
+
|
|
578
|
+
|
|
572
579
|
|
|
573
580
|
def tricc_operation_izscore(self, ref_expressions):
|
|
574
581
|
z, ll, m, s = self.get_zscore_params(ref_expressions)
|
|
@@ -671,7 +678,7 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
671
678
|
if isinstance(r, TriccOperation):
|
|
672
679
|
return self.get_tricc_operation_expression(r)
|
|
673
680
|
elif isinstance(r, TriccReference):
|
|
674
|
-
logger.warning(f"reference still used in
|
|
681
|
+
logger.warning(f"reference `{r.value}` still used in a calculate")
|
|
675
682
|
return f"${{{get_export_name(r.value)}}}"
|
|
676
683
|
elif isinstance(r, TriccStatic):
|
|
677
684
|
if isinstance(r.value, bool) :#or r.value in ('true', 'false')
|
tricc_oo/visitors/tricc.py
CHANGED
|
@@ -607,6 +607,21 @@ def process_reference(node, processed_nodes, calculates, used_calculates=None,
|
|
|
607
607
|
return False
|
|
608
608
|
elif modified_expression and replace_reference:
|
|
609
609
|
node.trigger = modified_expression
|
|
610
|
+
if isinstance(getattr(node, 'constraint', None), (TriccOperation, TriccReference)):
|
|
611
|
+
modified_expression = process_operation_reference(
|
|
612
|
+
node.constraint,
|
|
613
|
+
node,
|
|
614
|
+
processed_nodes=processed_nodes,
|
|
615
|
+
calculates=calculates,
|
|
616
|
+
used_calculates=used_calculates,
|
|
617
|
+
replace_reference=replace_reference,
|
|
618
|
+
warn=warn,
|
|
619
|
+
codesystems=codesystems
|
|
620
|
+
)
|
|
621
|
+
if modified_expression is False:
|
|
622
|
+
return False
|
|
623
|
+
elif modified_expression and replace_reference:
|
|
624
|
+
node.constraint = modified_expression
|
|
610
625
|
|
|
611
626
|
if isinstance(getattr(node, 'default', None), (TriccOperation, TriccReference)):
|
|
612
627
|
modified_expression = process_operation_reference(
|
|
@@ -1675,26 +1690,32 @@ def get_prev_instance_skip_expression(node, processed_nodes, process, expression
|
|
|
1675
1690
|
|
|
1676
1691
|
# end def
|
|
1677
1692
|
def get_process_skip_expression(node, processed_nodes, process, expression=None):
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
if
|
|
1685
|
-
end_expressions
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
if
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1693
|
+
list_ends = OrderedSet(
|
|
1694
|
+
filter(
|
|
1695
|
+
lambda x: issubclass(x.__class__, TriccNodeEnd),
|
|
1696
|
+
processed_nodes
|
|
1697
|
+
)
|
|
1698
|
+
)
|
|
1699
|
+
if list_ends:
|
|
1700
|
+
end_expressions = []
|
|
1701
|
+
f_end_expression = get_end_expression(list_ends)
|
|
1702
|
+
if f_end_expression:
|
|
1703
|
+
end_expressions.append(f_end_expression)
|
|
1704
|
+
b_end_expression = get_end_expression(list_ends, 'pause')
|
|
1705
|
+
if b_end_expression:
|
|
1706
|
+
end_expressions.append(b_end_expression)
|
|
1707
|
+
if process[0] in PROCESSES:
|
|
1708
|
+
for p in PROCESSES[PROCESSES.index(process[0])+1:]:
|
|
1709
|
+
p_end_expression = get_end_expression(list_ends, p)
|
|
1710
|
+
if p_end_expression:
|
|
1711
|
+
end_expressions.append(p_end_expression)
|
|
1712
|
+
if end_expressions:
|
|
1713
|
+
if expression:
|
|
1714
|
+
end_expressions.append(expression)
|
|
1715
|
+
if len(end_expressions) == 1:
|
|
1716
|
+
expression = end_expressions[0]
|
|
1717
|
+
else:
|
|
1718
|
+
expression = and_join(end_expressions)
|
|
1698
1719
|
return expression
|
|
1699
1720
|
|
|
1700
1721
|
def get_end_expression(processed_nodes, process=None):
|
|
@@ -4,18 +4,18 @@ tests/to_ocl.py,sha256=f_KeKF7N1tri9ChbtH1OShgHskt_T9Wj1IfaT6qJNGY,2247
|
|
|
4
4
|
tricc_oo/__init__.py,sha256=Els6sDXpOJiGU1zp45rTXZgEKceq_XhRZDfrx1mIMGc,255
|
|
5
5
|
tricc_oo/converters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
tricc_oo/converters/codesystem_to_ocl.py,sha256=-ZKMBeIvzgqmhJfnn6ptuwpnHQtuE-fCDDfKpfGvUSU,6066
|
|
7
|
-
tricc_oo/converters/cql_to_operation.py,sha256=
|
|
7
|
+
tricc_oo/converters/cql_to_operation.py,sha256=geAAS2KPA_eax30lKh56m5Lu9MTkvTUK8x9FAnWU3no,14424
|
|
8
8
|
tricc_oo/converters/datadictionnary.py,sha256=WWKcTtKLfc4aduHcDBhr4JSfU2NqRMaslwX-wdZPIAw,3968
|
|
9
|
-
tricc_oo/converters/drawio_type_map.py,sha256=
|
|
9
|
+
tricc_oo/converters/drawio_type_map.py,sha256=I-UN-O1OKmNFnkHAJMEbPrew7r3K2_x5mKPUVM98F24,7545
|
|
10
10
|
tricc_oo/converters/tricc_to_xls_form.py,sha256=bJVd-FLrivrCxGI6mO2i0V7GVVuJZdaDuwcEf3gHNR8,2327
|
|
11
11
|
tricc_oo/converters/utils.py,sha256=UyndDORsDbRV5-gYW-yInK5ztjtYdeCw6K-mrYr1Emk,1688
|
|
12
|
-
tricc_oo/converters/xml_to_tricc.py,sha256=
|
|
12
|
+
tricc_oo/converters/xml_to_tricc.py,sha256=rpqBX4wHYo3ZNEHynk-vlwritRN4FeQ7etmdShIefX4,37411
|
|
13
13
|
tricc_oo/converters/cql/cqlLexer.py,sha256=t0-QvDv5kxCiBZJ9SfDumFOgnRSry_HJpakBZV224Ig,49126
|
|
14
14
|
tricc_oo/converters/cql/cqlListener.py,sha256=ketvj7XvO7t047S6A3_gTPvp2MlYk1bojmkl10v5E6Y,57523
|
|
15
15
|
tricc_oo/converters/cql/cqlParser.py,sha256=hIUdR907WX24P2Jlrxk-H0IT94n51yh_ZsCmwQhnFas,414730
|
|
16
16
|
tricc_oo/converters/cql/cqlVisitor.py,sha256=SWSDIqVYBhucR4VgLn_EPNs7LV9yCqsOmzFZ0bmRSGc,33865
|
|
17
17
|
tricc_oo/models/__init__.py,sha256=Rdk1fsNXHrbmXTQD1O7i0NC_A6os648Ap6CtWRliOg8,92
|
|
18
|
-
tricc_oo/models/base.py,sha256=
|
|
18
|
+
tricc_oo/models/base.py,sha256=hPY7w7ur-UTS9OvZb-xmvpjRF6mha_E0K4A9X1_eHKQ,24871
|
|
19
19
|
tricc_oo/models/calculate.py,sha256=60jSL8gbcTxqGYsZe1LoGZAdScIp6_suC88XlE0xg-c,7640
|
|
20
20
|
tricc_oo/models/lang.py,sha256=SwKaoxyRhE7gH_ZlYyFXzGuTQ5RE19y47LWAA35zYxg,2338
|
|
21
21
|
tricc_oo/models/ocl.py,sha256=ol35Gl1jCBp0Ven0yxOKzDIZkVL5Kx9uwaR_64pjxKI,8931
|
|
@@ -25,22 +25,22 @@ tricc_oo/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
25
25
|
tricc_oo/parsers/xml.py,sha256=vq9PA5Zt4G3QMtZ1zgyN8110O1w19Jqt6JClJYhHJlU,4410
|
|
26
26
|
tricc_oo/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
27
|
tricc_oo/serializers/planuml.py,sha256=a81YKsjgng-h2H_rmFE2J5FeBBUaH8kRGT8YrvzpEKE,455
|
|
28
|
-
tricc_oo/serializers/xls_form.py,sha256=
|
|
28
|
+
tricc_oo/serializers/xls_form.py,sha256=mA7GbF1pVH06thJofyXHxzHH-9bCVHBx_ec-G7g0SbM,22866
|
|
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=-GQ_xRvJXzn-q_eT8R-wtFOTWzPtdNj79zjmsH6x070,4065
|
|
32
32
|
tricc_oo/strategies/input/drawio.py,sha256=qVX4-roFhnsgQSBA9gD9upz18FnBFs7-UeyHaZ_pNU4,13165
|
|
33
|
-
tricc_oo/strategies/output/base_output_strategy.py,sha256=
|
|
33
|
+
tricc_oo/strategies/output/base_output_strategy.py,sha256=YVQTgisOsbm3h2xWwXKQQPc6fIBBt98k2b8l8ivZfAA,7489
|
|
34
34
|
tricc_oo/strategies/output/spice.py,sha256=s_COahyYCoc4Xv5TGh_AW9evDOW6GOex0Xwa_JWeLsI,11280
|
|
35
|
-
tricc_oo/strategies/output/xls_form.py,sha256=
|
|
35
|
+
tricc_oo/strategies/output/xls_form.py,sha256=nJqMVI9Y8LF1MxG9-0cJK8g1Ag8iKqFPkjYVsG_UJ2M,31289
|
|
36
36
|
tricc_oo/strategies/output/xlsform_cdss.py,sha256=8ghPYH8K2DSzPY1jrJMQzrFmkvzu75jM0B1LpSS-y1E,9516
|
|
37
37
|
tricc_oo/strategies/output/xlsform_cht.py,sha256=2GeQCmuoFo2CbKGuMIwr8Iq78edKMDb3AAsm6UVTHMU,24216
|
|
38
38
|
tricc_oo/strategies/output/xlsform_cht_hf.py,sha256=VPx5_wLXLacJFTgVcwOJ7LVd77fmOrL_ZAycNZLxC6o,2281
|
|
39
39
|
tricc_oo/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
tricc_oo/visitors/tricc.py,sha256=
|
|
40
|
+
tricc_oo/visitors/tricc.py,sha256=e_6itYSgtc6EF2sOCKFvP3nri1NuELzRah_mBJdRVik,101851
|
|
41
41
|
tricc_oo/visitors/utils.py,sha256=Gol4JNozPEd30Q1l8IPIPhx5fqVyy9R81GofGVebgD8,484
|
|
42
42
|
tricc_oo/visitors/xform_pd.py,sha256=jgjBLbfElVdi0NmClhw6NK6qNcIgWYm4KMXfVwiQwXM,9705
|
|
43
|
-
tricc_oo-1.5.
|
|
44
|
-
tricc_oo-1.5.
|
|
45
|
-
tricc_oo-1.5.
|
|
46
|
-
tricc_oo-1.5.
|
|
43
|
+
tricc_oo-1.5.18.dist-info/METADATA,sha256=plF1mcu4Jthpk6S9eD5qZv3BPXsEnnoeFJb77nBONh8,7878
|
|
44
|
+
tricc_oo-1.5.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
45
|
+
tricc_oo-1.5.18.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
|
|
46
|
+
tricc_oo-1.5.18.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|