tricc-oo 1.4.19__tar.gz → 1.4.20__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.4.19 → tricc_oo-1.4.20}/PKG-INFO +1 -1
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/pyproject.toml +1 -1
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/drawio_type_map.py +2 -2
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/models/base.py +13 -6
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/visitors/tricc.py +97 -76
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo.egg-info/PKG-INFO +1 -1
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/README.md +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/setup.cfg +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tests/build.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tests/test_cql.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tests/to_ocl.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/__init__.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/__init__.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/codesystem_to_ocl.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/cql/cqlLexer.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/cql/cqlListener.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/cql/cqlParser.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/cql/cqlVisitor.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/cql_to_operation.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/datadictionnary.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/tricc_to_xls_form.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/utils.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/converters/xml_to_tricc.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/models/__init__.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/models/calculate.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/models/lang.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/models/ocl.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/models/ordered_set.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/models/tricc.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/parsers/__init__.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/parsers/xml.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/serializers/__init__.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/serializers/planuml.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/serializers/xls_form.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/__init__.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/input/__init__.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/input/base_input_strategy.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/input/drawio.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/output/base_output_strategy.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/output/spice.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/output/xls_form.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/output/xlsform_cdss.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/output/xlsform_cht.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/strategies/output/xlsform_cht_hf.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/visitors/__init__.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/visitors/utils.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo/visitors/xform_pd.py +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo.egg-info/SOURCES.txt +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo.egg-info/dependency_links.txt +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo.egg-info/requires.txt +0 -0
- {tricc_oo-1.4.19 → tricc_oo-1.4.20}/tricc_oo.egg-info/top_level.txt +0 -0
|
@@ -94,13 +94,13 @@ TYPE_MAP = {
|
|
|
94
94
|
|
|
95
95
|
TriccNodeType.text: {
|
|
96
96
|
"objects": ["UserObject", "object"],
|
|
97
|
-
"attributes": ["relevance"],
|
|
97
|
+
"attributes": ["save", "relevance"],
|
|
98
98
|
"mandatory_attributes": ["label", 'name'],
|
|
99
99
|
"model": TriccNodeText
|
|
100
100
|
},
|
|
101
101
|
TriccNodeType.date: {
|
|
102
102
|
"objects": ["UserObject", "object"],
|
|
103
|
-
"attributes": ["relevance"],
|
|
103
|
+
"attributes": ["save", "relevance"],
|
|
104
104
|
"mandatory_attributes": ["label", "name"],
|
|
105
105
|
"model": TriccNodeDate
|
|
106
106
|
},
|
|
@@ -112,7 +112,14 @@ class TriccBaseModel(BaseModel):
|
|
|
112
112
|
version: int = 1
|
|
113
113
|
def get_datatype(self):
|
|
114
114
|
return self.datatype or self.tricc_type
|
|
115
|
-
|
|
115
|
+
|
|
116
|
+
def get_next_instance(self):
|
|
117
|
+
if getattr(self, 'instances', None):
|
|
118
|
+
return max(100, *[n.instance for n in self.instances.values()]) + 1
|
|
119
|
+
if getattr(self, 'base_instance', None) and getattr(self.base_instance, 'instances', None):
|
|
120
|
+
return max(100, *[n.instance for n in self.base_instance.instances.values()]) + 1
|
|
121
|
+
return max(100,self.instance) + 1
|
|
122
|
+
|
|
116
123
|
def to_dict(self):
|
|
117
124
|
return {key: value for key, value in vars(self).items() if not key.startswith('_')}
|
|
118
125
|
|
|
@@ -233,20 +240,20 @@ class TriccNodeBaseModel(TriccBaseModel):
|
|
|
233
240
|
# to be updated while processing because final expression will be possible to build$
|
|
234
241
|
# #only the last time the script will go through the node (all prev node expression would be created
|
|
235
242
|
def get_name(self):
|
|
236
|
-
result = str(super().get_name())
|
|
243
|
+
result = self.__class__.__name__[9:]# str(super().get_name())
|
|
237
244
|
name = getattr(self, 'name', None)
|
|
238
245
|
label = getattr(self, 'label', None)
|
|
239
246
|
|
|
240
247
|
if name:
|
|
241
|
-
result
|
|
248
|
+
result += name
|
|
242
249
|
if label:
|
|
243
|
-
result
|
|
250
|
+
result += "::" + (
|
|
244
251
|
next(iter(self.label.values())) if isinstance(self.label, Dict) else self.label
|
|
245
252
|
)
|
|
246
|
-
if len(result) <
|
|
253
|
+
if len(result) < 80:
|
|
247
254
|
return result
|
|
248
255
|
else:
|
|
249
|
-
return result[:
|
|
256
|
+
return result[:80]
|
|
250
257
|
|
|
251
258
|
|
|
252
259
|
|
|
@@ -93,6 +93,81 @@ def get_node_expressions(node, processed_nodes, process=None):
|
|
|
93
93
|
expression = TriccStatic(True)
|
|
94
94
|
return expression
|
|
95
95
|
|
|
96
|
+
def set_last_version_false(node, processed_nodes):
|
|
97
|
+
node_name = node.name if not isinstance(node, TriccNodeEnd) else node.get_reference()
|
|
98
|
+
last_version = get_last_version(node_name, processed_nodes) if issubclass(node.__class__, (TriccNodeDisplayModel, TriccNodeDisplayCalculateBase, TriccNodeEnd)) and not isinstance(node, TriccNodeSelectOption) else None
|
|
99
|
+
#last_version = processed_nodes.find_prev(node, lambda item: hasattr(item, 'name') and item.name == node.name)
|
|
100
|
+
if last_version and getattr(node, 'process', '') != 'pause':
|
|
101
|
+
# 0-100 for manually specified instance. 100-200 for auto instance
|
|
102
|
+
node.version = last_version.version + 1
|
|
103
|
+
last_version.last = False
|
|
104
|
+
node.path_len = max(node.path_len, last_version.path_len + 1)
|
|
105
|
+
return last_version
|
|
106
|
+
|
|
107
|
+
def get_version_inheritance(node, last_version, processed_nodes):
|
|
108
|
+
# FIXME this is for XLS form where only calculate are evaluated for a activity that is not triggered
|
|
109
|
+
if not issubclass(node.__class__, (TriccNodeInputModel)):
|
|
110
|
+
node.last = True
|
|
111
|
+
if (
|
|
112
|
+
issubclass(node.__class__, (TriccNodeDisplayCalculateBase, TriccNodeEnd)) and node.name is not None
|
|
113
|
+
):
|
|
114
|
+
#logger.debug("set last to false for node {} and add its link it to next one".format(last_used_calc.get_name()))
|
|
115
|
+
if node.prev_nodes:
|
|
116
|
+
set_prev_next_node(last_version, node)
|
|
117
|
+
else:
|
|
118
|
+
expression = node.expression or node.expression_reference or getattr(node, 'relevance', None)
|
|
119
|
+
datatype = expression.get_datatype()
|
|
120
|
+
if datatype == 'boolean':
|
|
121
|
+
expression_reference = TriccOperation(
|
|
122
|
+
TriccOperator.OR,
|
|
123
|
+
[TriccOperation(TriccOperator.ISTRUE, [last_version]), expression]
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
elif datatype == 'number':
|
|
127
|
+
expression = TriccOperation(
|
|
128
|
+
TriccOperator.PLUS,
|
|
129
|
+
[last_version, expression]
|
|
130
|
+
)
|
|
131
|
+
else:
|
|
132
|
+
expression = TriccOperation(
|
|
133
|
+
TriccOperator.COALESCE,
|
|
134
|
+
[last_version, expression]
|
|
135
|
+
)
|
|
136
|
+
if node.expression:
|
|
137
|
+
node.expression = expression
|
|
138
|
+
elif node.expression_reference:
|
|
139
|
+
node.expression_reference = expression
|
|
140
|
+
elif node.relevance:
|
|
141
|
+
node.relevance = expression
|
|
142
|
+
else:
|
|
143
|
+
node.last = False
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
calc = TriccNodeCalculate(
|
|
147
|
+
id=generate_id(f"save{node.id}"),
|
|
148
|
+
name=node.name,
|
|
149
|
+
path_len=node.path_len+1,
|
|
150
|
+
version=get_next_version(node.name, processed_nodes, node.version+2),
|
|
151
|
+
expression=TriccOperation(
|
|
152
|
+
TriccOperator.COALESCE,
|
|
153
|
+
[node, last_version, TriccStatic("''")]
|
|
154
|
+
),
|
|
155
|
+
last=True,
|
|
156
|
+
activity=node.activity,
|
|
157
|
+
group=node.group
|
|
158
|
+
)
|
|
159
|
+
node.activity.nodes[calc.id]=calc
|
|
160
|
+
node.activity.calculates.append(calc)
|
|
161
|
+
set_last_version_false(calc, processed_nodes)
|
|
162
|
+
processed_nodes.add(calc)
|
|
163
|
+
if issubclass(node.__class__, TriccNodeInputModel):
|
|
164
|
+
node.expression = TriccOperation(
|
|
165
|
+
TriccOperator.COALESCE,
|
|
166
|
+
[
|
|
167
|
+
'$this',
|
|
168
|
+
last_version
|
|
169
|
+
]
|
|
170
|
+
)
|
|
96
171
|
|
|
97
172
|
def process_calculate(node,processed_nodes, stashed_nodes, calculates, used_calculates,
|
|
98
173
|
warn = False, process=None, **kwargs ):
|
|
@@ -117,76 +192,11 @@ def process_calculate(node,processed_nodes, stashed_nodes, calculates, used_calc
|
|
|
117
192
|
):
|
|
118
193
|
if kwargs.get('warn', True):
|
|
119
194
|
logger.debug('Processing relevance for node {0}'.format(node.get_name()))
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
node.version = last_version.version + 1
|
|
126
|
-
last_version.last = False
|
|
127
|
-
node.path_len = max(node.path_len, last_version.path_len + 1)
|
|
128
|
-
# FIXME this is for XLS form where only calculate are evaluated for a activity that is not triggered
|
|
129
|
-
if not issubclass(node.__class__, (TriccNodeInputModel)):
|
|
130
|
-
node.last = True
|
|
131
|
-
if (
|
|
132
|
-
issubclass(node.__class__, (TriccNodeDisplayCalculateBase, TriccNodeEnd)) and node.name is not None
|
|
133
|
-
):
|
|
134
|
-
#logger.debug("set last to false for node {} and add its link it to next one".format(last_used_calc.get_name()))
|
|
135
|
-
if node.prev_nodes:
|
|
136
|
-
set_prev_next_node(last_version, node)
|
|
137
|
-
else:
|
|
138
|
-
expression = node.expression or node.expression_reference or node.relevance
|
|
139
|
-
datatype = expression.get_datatype()
|
|
140
|
-
if datatype == 'boolean':
|
|
141
|
-
expression_reference = TriccOperation(
|
|
142
|
-
TriccOperator.OR,
|
|
143
|
-
[TriccOperation(TriccOperator.ISTRUE, [last_version]), expression]
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
elif datatype == 'number':
|
|
147
|
-
expression = TriccOperation(
|
|
148
|
-
TriccOperator.PLUS,
|
|
149
|
-
[last_version, expression]
|
|
150
|
-
)
|
|
151
|
-
else:
|
|
152
|
-
expression = TriccOperation(
|
|
153
|
-
TriccOperator.COALESCE,
|
|
154
|
-
[last_version, expression]
|
|
155
|
-
)
|
|
156
|
-
if node.expression:
|
|
157
|
-
node.expression = expression
|
|
158
|
-
elif node.expression_reference:
|
|
159
|
-
node.expression_reference = expression
|
|
160
|
-
elif node.relevance:
|
|
161
|
-
node.relevance = expression
|
|
162
|
-
else:
|
|
163
|
-
node.last = False
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
calc = TriccNodeCalculate(
|
|
167
|
-
id=generate_id(f"save{node.id}"),
|
|
168
|
-
name=node.name,
|
|
169
|
-
path_len=node.path_len+1,
|
|
170
|
-
version=last_version.version + 2,
|
|
171
|
-
expression=TriccOperation(
|
|
172
|
-
TriccOperator.COALESCE,
|
|
173
|
-
[node, last_version, TriccStatic("''")]
|
|
174
|
-
),
|
|
175
|
-
last=True,
|
|
176
|
-
activity=node.activity,
|
|
177
|
-
group=node.group
|
|
178
|
-
)
|
|
179
|
-
node.activity.nodes[calc.id]=calc
|
|
180
|
-
node.activity.calculates.append(calc)
|
|
181
|
-
if issubclass(node.__class__, TriccNodeInputModel):
|
|
182
|
-
node.expression = TriccOperation(
|
|
183
|
-
TriccOperator.COALESCE,
|
|
184
|
-
[
|
|
185
|
-
'$this',
|
|
186
|
-
last_version
|
|
187
|
-
]
|
|
188
|
-
)
|
|
189
|
-
|
|
195
|
+
last_version = set_last_version_false(node, processed_nodes)
|
|
196
|
+
if last_version:
|
|
197
|
+
last_version = get_version_inheritance(node, last_version, processed_nodes)
|
|
198
|
+
generate_calculates(node,calculates, used_calculates,processed_nodes=processed_nodes)
|
|
199
|
+
|
|
190
200
|
|
|
191
201
|
|
|
192
202
|
# if has prev, create condition
|
|
@@ -218,7 +228,6 @@ def process_calculate(node,processed_nodes, stashed_nodes, calculates, used_calc
|
|
|
218
228
|
if issubclass(r.__class__, (TriccNodeDisplayCalculateBase )):
|
|
219
229
|
add_used_calculate(node, r, calculates, used_calculates, processed_nodes)
|
|
220
230
|
|
|
221
|
-
generate_calculates(node,calculates, used_calculates,processed_nodes=processed_nodes)
|
|
222
231
|
if last_version and hasattr(node, 'relevance'):
|
|
223
232
|
if isinstance(node, TriccNodeInputModel):
|
|
224
233
|
version_relevance = TriccOperation(
|
|
@@ -468,16 +477,23 @@ def generate_calculates(node,calculates, used_calculates,processed_nodes):
|
|
|
468
477
|
calc_node.path_len += 1
|
|
469
478
|
calc_node.name=calculate_name
|
|
470
479
|
calc_node.label = "save select: " +node.get_name()
|
|
471
|
-
|
|
480
|
+
elif node.name != calculate_name:
|
|
472
481
|
calc_id = generate_id(f"autosave{node.id}")
|
|
482
|
+
|
|
473
483
|
calc_node = TriccNodeCalculate(
|
|
474
484
|
name=calculate_name,
|
|
475
485
|
id = calc_id,
|
|
476
486
|
group = node.group,
|
|
487
|
+
version=get_next_version(calculate_name, processed_nodes, node.version+2),
|
|
477
488
|
activity = node.activity,
|
|
478
489
|
label = "save: " +node.get_name(),
|
|
479
|
-
path_len=node.path_len+ 1
|
|
490
|
+
path_len=node.path_len+ 1,
|
|
491
|
+
last=True
|
|
480
492
|
)
|
|
493
|
+
node.activity.nodes[calc_node.id]=calc_node
|
|
494
|
+
node.activity.calculates.append(calc_node)
|
|
495
|
+
set_last_version_false(calc_node, processed_nodes)
|
|
496
|
+
processed_nodes.add(calc_node)
|
|
481
497
|
logger.debug("generate_save_calculate:{}:{} as {}".format(calc_node.tricc_type, node.name if hasattr(node,'name') else node.id, calculate_name))
|
|
482
498
|
if isinstance(node, TriccNodeSelectYesNo):
|
|
483
499
|
yesNode = node.options[0]
|
|
@@ -948,6 +964,9 @@ def walkthrough_tricc_option(node, callback, processed_nodes, stashed_nodes, pat
|
|
|
948
964
|
warn = warn,
|
|
949
965
|
node_path = node_path.copy(), **kwargs)
|
|
950
966
|
|
|
967
|
+
def get_next_version(name, processed_nodes, version=0,):
|
|
968
|
+
return max(version, 100,*[(getattr(n,'version',0) or getattr(n,'instance',0) or 0) for n in get_versions(name, processed_nodes)])
|
|
969
|
+
|
|
951
970
|
|
|
952
971
|
def get_data_for_log(node):
|
|
953
972
|
return "{}:{}|{} {}:{}".format(
|
|
@@ -1207,6 +1226,7 @@ def get_all_dependant(loop, stashed_nodes, processed_nodes, depth=0, waited=None
|
|
|
1207
1226
|
looped = {}
|
|
1208
1227
|
if waited is None:
|
|
1209
1228
|
waited = {}
|
|
1229
|
+
all_dependant = OrderedSet()
|
|
1210
1230
|
for n in loop:
|
|
1211
1231
|
cur_path = path.copy()
|
|
1212
1232
|
cur_path.append(n)
|
|
@@ -1222,7 +1242,7 @@ def get_all_dependant(loop, stashed_nodes, processed_nodes, depth=0, waited=None
|
|
|
1222
1242
|
pass
|
|
1223
1243
|
for d in dependant:
|
|
1224
1244
|
if d in path:
|
|
1225
|
-
logger.warning(f"loop {str(d)} already in path {'::'.join(map(
|
|
1245
|
+
logger.warning(f"loop {str(d)} already in path {'::'.join(map(str, path))} ")
|
|
1226
1246
|
if isinstance(d, TriccNodeSelectOption):
|
|
1227
1247
|
d = d.select
|
|
1228
1248
|
|
|
@@ -1238,9 +1258,10 @@ def get_all_dependant(loop, stashed_nodes, processed_nodes, depth=0, waited=None
|
|
|
1238
1258
|
looped = add_to_tree(looped, n, d)
|
|
1239
1259
|
else :
|
|
1240
1260
|
waited = add_to_tree(waited, n, d)
|
|
1261
|
+
all_dependant = all_dependant.union(dependant)
|
|
1241
1262
|
if depth < MAX_DRILL:
|
|
1242
|
-
|
|
1243
|
-
|
|
1263
|
+
waited, looped = get_all_dependant(all_dependant, stashed_nodes, processed_nodes, depth+1, waited , looped, path=cur_path)
|
|
1264
|
+
|
|
1244
1265
|
return waited, looped
|
|
1245
1266
|
|
|
1246
1267
|
|
|
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
|