tricc-oo 1.0.1__py3-none-any.whl → 1.4.15__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.
Files changed (66) hide show
  1. tests/build.py +213 -0
  2. tests/test_cql.py +197 -0
  3. tests/to_ocl.py +51 -0
  4. {tricc → tricc_oo}/__init__.py +3 -1
  5. tricc_oo/converters/codesystem_to_ocl.py +169 -0
  6. tricc_oo/converters/cql/cqlLexer.py +822 -0
  7. tricc_oo/converters/cql/cqlListener.py +1632 -0
  8. tricc_oo/converters/cql/cqlParser.py +11204 -0
  9. tricc_oo/converters/cql/cqlVisitor.py +913 -0
  10. tricc_oo/converters/cql_to_operation.py +402 -0
  11. tricc_oo/converters/datadictionnary.py +115 -0
  12. tricc_oo/converters/drawio_type_map.py +222 -0
  13. tricc_oo/converters/tricc_to_xls_form.py +61 -0
  14. tricc_oo/converters/utils.py +65 -0
  15. tricc_oo/converters/xml_to_tricc.py +1003 -0
  16. tricc_oo/models/__init__.py +4 -0
  17. tricc_oo/models/base.py +732 -0
  18. tricc_oo/models/calculate.py +216 -0
  19. tricc_oo/models/ocl.py +281 -0
  20. tricc_oo/models/ordered_set.py +125 -0
  21. tricc_oo/models/tricc.py +418 -0
  22. tricc_oo/parsers/xml.py +138 -0
  23. tricc_oo/serializers/__init__.py +0 -0
  24. tricc_oo/serializers/xls_form.py +745 -0
  25. tricc_oo/strategies/__init__.py +0 -0
  26. tricc_oo/strategies/input/__init__.py +0 -0
  27. tricc_oo/strategies/input/base_input_strategy.py +111 -0
  28. tricc_oo/strategies/input/drawio.py +317 -0
  29. tricc_oo/strategies/output/base_output_strategy.py +148 -0
  30. tricc_oo/strategies/output/spice.py +365 -0
  31. tricc_oo/strategies/output/xls_form.py +697 -0
  32. tricc_oo/strategies/output/xlsform_cdss.py +189 -0
  33. tricc_oo/strategies/output/xlsform_cht.py +200 -0
  34. tricc_oo/strategies/output/xlsform_cht_hf.py +334 -0
  35. tricc_oo/visitors/__init__.py +0 -0
  36. tricc_oo/visitors/tricc.py +2198 -0
  37. tricc_oo/visitors/utils.py +17 -0
  38. tricc_oo/visitors/xform_pd.py +264 -0
  39. tricc_oo-1.4.15.dist-info/METADATA +219 -0
  40. tricc_oo-1.4.15.dist-info/RECORD +46 -0
  41. {tricc_oo-1.0.1.dist-info → tricc_oo-1.4.15.dist-info}/WHEEL +1 -1
  42. tricc_oo-1.4.15.dist-info/top_level.txt +2 -0
  43. tricc/converters/mc_to_tricc.py +0 -542
  44. tricc/converters/tricc_to_xls_form.py +0 -553
  45. tricc/converters/utils.py +0 -44
  46. tricc/converters/xml_to_tricc.py +0 -740
  47. tricc/models/tricc.py +0 -1093
  48. tricc/parsers/xml.py +0 -81
  49. tricc/serializers/xls_form.py +0 -364
  50. tricc/strategies/input/base_input_strategy.py +0 -80
  51. tricc/strategies/input/drawio.py +0 -246
  52. tricc/strategies/input/medalcreator.py +0 -168
  53. tricc/strategies/output/base_output_strategy.py +0 -92
  54. tricc/strategies/output/xls_form.py +0 -194
  55. tricc/strategies/output/xlsform_cdss.py +0 -46
  56. tricc/strategies/output/xlsform_cht.py +0 -106
  57. tricc/visitors/tricc.py +0 -375
  58. tricc_oo-1.0.1.dist-info/LICENSE +0 -78
  59. tricc_oo-1.0.1.dist-info/METADATA +0 -229
  60. tricc_oo-1.0.1.dist-info/RECORD +0 -26
  61. tricc_oo-1.0.1.dist-info/top_level.txt +0 -2
  62. venv/bin/vba_extract.py +0 -78
  63. {tricc → tricc_oo}/converters/__init__.py +0 -0
  64. {tricc → tricc_oo}/models/lang.py +0 -0
  65. {tricc/serializers → tricc_oo/parsers}/__init__.py +0 -0
  66. {tricc → tricc_oo}/serializers/planuml.py +0 -0
@@ -0,0 +1,334 @@
1
+ import datetime
2
+ import logging
3
+ import os
4
+ import shutil
5
+
6
+ import pandas as pd
7
+
8
+ from tricc_oo.models.lang import SingletonLangClass
9
+ from tricc_oo.serializers.xls_form import SURVEY_MAP,get_input_line, get_input_calc_line
10
+ from tricc_oo.strategies.output.xlsform_cht import XLSFormCHTStrategy
11
+ from tricc_oo.visitors.xform_pd import make_breakpoints, get_tasksstrings
12
+
13
+ langs = SingletonLangClass()
14
+ logger = logging.getLogger("default")
15
+
16
+ class XLSFormCHTHFStrategy(XLSFormCHTStrategy):
17
+
18
+ def get_cht_input(self, start_pages, **kwargs):
19
+ empty = langs.get_trads('', force_dict =True)
20
+ df_input = pd.DataFrame(columns=SURVEY_MAP.keys())
21
+ #[ #type, '',#name ''#label, '',#hint '',#help '',#default '',#'appearance', '',#'constraint', '',#'constraint_message' '',#'relevance' '',#'disabled' '',#'required' '',#'required message' '',#'read only' '',#'expression' '',#'repeat_count' ''#'image' ],
22
+ df_input.loc[len(df_input)] = [
23
+ 'begin_group', 'inputs',
24
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
25
+ *list(empty.values()),
26
+ *list(empty.values()),
27
+ '', 'field-list', '',
28
+ *list(empty.values()),
29
+ './source = "user"', '','',
30
+ *list(empty.values())
31
+ ,'', '', '', '' ,''
32
+ ]
33
+ df_input.loc[len(df_input)] = [
34
+ 'hidden', 'source',
35
+ *list(langs.get_trads('Source', force_dict = True).values()),
36
+ *list(empty.values()),
37
+ *list(empty.values()),
38
+ 'user', 'hidden', '',
39
+ *list(empty.values()),
40
+ '', '','',
41
+ *list(empty.values())
42
+ ,'', '', '', '' ,''
43
+ ]
44
+ df_input.loc[len(df_input)] = [
45
+ 'hidden', 'source_id',
46
+ *list(langs.get_trads('Source ID', force_dict = True).values()),
47
+ *list(empty.values()),
48
+ *list(empty.values()),
49
+ '', 'hidden', '',
50
+ *list(empty.values()),
51
+ '', '','',
52
+ *list(empty.values())
53
+ ,'', '', '', '' ,''
54
+ ]
55
+
56
+
57
+ df_input.loc[len(df_input)] = [
58
+ 'begin_group', 'user',
59
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
60
+ *list(empty.values()),
61
+ *list(empty.values()),
62
+ '', 'field-list', '',
63
+ *list(empty.values()),
64
+ '', '','',
65
+ *list(empty.values())
66
+ ,'', '', '', '' ,''
67
+ ]
68
+ df_input.loc[len(df_input)] = [
69
+ 'string', 'contact_id',
70
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
71
+ *list(empty.values()),
72
+ *list(empty.values()),
73
+ '', 'hidden', '',
74
+ *list(empty.values()),
75
+ '', '','',
76
+ *list(empty.values())
77
+ ,'', '', '', '' ,''
78
+ ]
79
+ df_input.loc[len(df_input)] = [
80
+ 'string', 'facility_id',
81
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
82
+ *list(empty.values()),
83
+ *list(empty.values()),
84
+ '', 'hidden', '',
85
+ *list(empty.values()),
86
+ '', '','',
87
+ *list(empty.values())
88
+ ,'', '', '', '' ,''
89
+ ]
90
+ df_input.loc[len(df_input)] = [
91
+ 'string', 'name',
92
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
93
+ *list(empty.values()),
94
+ *list(empty.values()),
95
+ '', 'hidden', '',
96
+ *list(empty.values()),
97
+ '', '','',
98
+ *list(empty.values())
99
+ ,'', '', '', '' ,''
100
+ ]
101
+ df_input.loc[len(df_input)] = [
102
+ 'end_group', 'user end' ,
103
+ *list(empty.values()),
104
+ *list(empty.values()),
105
+ *list(empty.values()),
106
+ '', '', '',
107
+ *list(empty.values()),
108
+ '', '', '',
109
+ *list(empty.values()),
110
+ '', '', '', '',''
111
+ ]
112
+ df_input.loc[len(df_input)] = [
113
+ 'begin_group', 'contact',
114
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
115
+ *list(empty.values()),
116
+ *list(empty.values()),
117
+ '', 'field-list', '',
118
+ *list(empty.values()),
119
+ '', '','',
120
+ *list(empty.values())
121
+ ,'', '', '', '' ,''
122
+ ]
123
+ inputs = self.export_inputs( start_pages[self.processes[0]], **kwargs)
124
+ for input in inputs:
125
+ df_input.loc[len(df_input)] = get_input_line(input)
126
+ df_input.loc[len(df_input)] = [
127
+ 'hidden', 'external_id',
128
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
129
+ *list(empty.values()),
130
+ *list(empty.values()),
131
+ '', 'hidden', '',
132
+ *list(empty.values()),
133
+ '', '','',
134
+ *list(empty.values())
135
+ ,'', '', '', '' ,''
136
+ ]
137
+
138
+ df_input.loc[len(df_input)] = [
139
+ 'string', '_id',
140
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
141
+ *list(empty.values()),
142
+ *list(empty.values()),
143
+ '', 'hidden', '',
144
+ *list(empty.values()),
145
+ '', '','',
146
+ *list(empty.values())
147
+ ,'', '', '', '' ,''
148
+ ]
149
+
150
+ df_input.loc[len(df_input)] = [
151
+ 'end_group', 'contact end' ,
152
+ *list(empty.values()),
153
+ *list(empty.values()),
154
+ *list(empty.values()),
155
+ '', '', '',
156
+ *list(empty.values()),
157
+ '', '', '',
158
+ *list(empty.values()),
159
+ '', '', '', '',''
160
+ ]
161
+
162
+ df_input.loc[len(df_input)] = [
163
+ 'end_group', 'input end' ,
164
+ *list(empty.values()),
165
+ *list(empty.values()),
166
+ *list(empty.values()),
167
+ '', '', '',
168
+ *list(empty.values()),
169
+ '', '', '',
170
+ *list(empty.values()),
171
+ '', '', '', '',''
172
+ ]
173
+ df_input.loc[len(df_input)] = [
174
+ 'calculate',
175
+ 'created_by_person_uuid',
176
+ *list(empty.values()) ,
177
+ *list(empty.values()) ,#hint
178
+ *list(empty.values()) ,#help
179
+ '',#default
180
+ '',#'appearance', clean_name
181
+ '',#'constraint',
182
+ *list(empty.values()) ,#'constraint_message'
183
+ '',#'relevance'
184
+ '',#'disabled'
185
+ '',#'required'
186
+ *list(empty.values()) ,#'required message'
187
+ '',#'read only'
188
+ '../inputs/user/contact_id',#'expression'
189
+ '',#'repeat_count'
190
+ '',#'image'
191
+ '' # choice filter
192
+ ]
193
+ df_input.loc[len(df_input)] = [
194
+ 'calculate',
195
+ 'created_by_place_uuid_user',
196
+ *list(empty.values()) ,
197
+ *list(empty.values()) ,#hint
198
+ *list(empty.values()) ,#help
199
+ '',#default
200
+ '',#'appearance', clean_name
201
+ '',#'constraint',
202
+ *list(empty.values()) ,#'constraint_message'
203
+ '',#'relevance'
204
+ '',#'disabled'
205
+ '',#'required'
206
+ *list(empty.values()) ,#'required message'
207
+ '',#'read only'
208
+ '../inputs/user/facility_id',#'expression'
209
+ '',#'repeat_count'
210
+ '',#'image'
211
+ '' # choice filter
212
+ ]
213
+ df_input.loc[len(df_input)] = [
214
+ 'calculate',
215
+ 'created_by',
216
+ *list(empty.values()) ,
217
+ *list(empty.values()) ,#hint
218
+ *list(empty.values()) ,#help
219
+ '',#default
220
+ '',#'appearance', clean_name
221
+ '',#'constraint',
222
+ *list(empty.values()) ,#'constraint_message'
223
+ '',#'relevance'
224
+ '',#'disabled'
225
+ '',#'required'
226
+ *list(empty.values()) ,#'required message'
227
+ '',#'read only'
228
+ '../inputs/user/name',#'expression'
229
+ '',#'repeat_count'
230
+ '',#'image'
231
+ '' # choice filter
232
+ ]
233
+ df_input.loc[len(df_input)] = [
234
+ 'calculate',
235
+ 'created_by_place_uuid',
236
+ *list(empty.values()) ,
237
+ *list(empty.values()) ,#hint
238
+ *list(empty.values()) ,#help
239
+ '',#default
240
+ '',#'appearance', clean_name
241
+ '',#'constraint',
242
+ *list(empty.values()) ,#'constraint_message'
243
+ '',#'relevance'
244
+ '',#'disabled'
245
+ '',#'required'
246
+ *list(empty.values()) ,#'required message'
247
+ '',#'read only'
248
+ '../inputs/contact/_id',#'expression'
249
+ '',#'repeat_count'
250
+ '',#'image'
251
+ '' # choice filter
252
+ ]
253
+
254
+ df_input.loc[len(df_input)] = [
255
+ 'calculate',
256
+ 'source_id',
257
+ *list(empty.values()) ,
258
+ *list(empty.values()) ,#hint
259
+ *list(empty.values()) ,#help
260
+ '',#default
261
+ '',#'appearance', clean_name
262
+ '',#'constraint',
263
+ *list(empty.values()) ,#'constraint_message'
264
+ '',#'relevance'
265
+ '',#'disabled'
266
+ '',#'required'
267
+ *list(empty.values()) ,#'required message'
268
+ '',#'read only'
269
+ '../inputs/source_id',#'expression'
270
+ '',#'repeat_count'
271
+ '',#'image'
272
+ '' # choice filter
273
+ ]
274
+ df_input.loc[len(df_input)] = [
275
+ 'calculate',
276
+ 'patient_uuid',
277
+ *list(empty.values()) ,
278
+ *list(empty.values()) ,#hint
279
+ *list(empty.values()) ,#help
280
+ '',#default
281
+ '',#'appearance', clean_name
282
+ '',#'constraint',
283
+ *list(empty.values()) ,#'constraint_message'
284
+ '',#'relevance'
285
+ '',#'disabled'
286
+ '',#'required'
287
+ *list(empty.values()) ,#'required message'
288
+ '',#'read only'
289
+ '../inputs/user/facility_id',#'expression'
290
+ '',#'repeat_count'
291
+ '',#'image'
292
+ '' # choice filter
293
+ ]
294
+ df_input.loc[len(df_input)] = [
295
+ 'string', 'data_load',
296
+ *list(langs.get_trads('NO_LABEL', force_dict = True).values()),
297
+ *list(empty.values()),
298
+ *list(empty.values()),
299
+ '', 'hidden', '',
300
+ *list(empty.values()),
301
+ '', '','',
302
+ *list(empty.values())
303
+ ,'', '', '', '' ,''
304
+ ]
305
+
306
+ for input in inputs:
307
+ df_input.loc[len(df_input)] = get_input_calc_line(input)
308
+
309
+
310
+
311
+ return df_input
312
+
313
+ def get_cht_summary(self):
314
+
315
+ df_summary = pd.DataFrame(columns=SURVEY_MAP.keys())
316
+ #[ #type, '',#name ''#label, '',#hint '',#help '',#default '',#'appearance', '',#'constraint', '',#'constraint_message' '',#'relevance' '',#'disabled' '',#'required' '',#'required message' '',#'read only' '',#'expression' '',#'repeat_count' ''#'image' ],
317
+ #df_summary.loc[len(df_summary)] = [ 'begin_group', 'group_summary' , 'Summary', '', '', '', 'field-list summary', '', '', '', '', '', '', '', '', '', '' ]
318
+ #df_summary.loc[len(df_summary)] = [ 'note', 'r_patient_info', '**${patient_name}** ID: ${patient_id}', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ]
319
+ #df_summary.loc[len(df_summary)] = [ 'note', 'r_followup', 'Follow Up <i class=“fa fa-flag”></i>', '', '', '', '', '', '','', '', '', '', '', '', '', '' ]
320
+ #df_summary.loc[len(df_summary)] = [ 'note', 'r_followup_note' ,'FOLLOWUP instruction', '', '', '', '', '', '', '','', '', '', '', '', '', '' ]
321
+ #df_summary.loc[len(df_summary)] = [ 'end_group', '' ,'', '', '', '', '', '', '', '', '', '', '', '', '','', '' ]
322
+ return df_summary
323
+
324
+ def tricc_operation_age_day(self, exps):
325
+ raise NotImplemented("AgeInDays Not compatible with this strategy")
326
+
327
+ def tricc_operation_age_year(self, exps):
328
+ raise NotImplemented("AgeInYears Not compatible with this strategy")
329
+
330
+ def tricc_operation_age_month(self, exps):
331
+ raise NotImplemented("AgeInMonths Not compatible with this strategy")
332
+
333
+
334
+
File without changes