tricc-oo 1.0.2__py3-none-any.whl → 1.4.16__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.
- tests/build.py +213 -0
- tests/test_cql.py +197 -0
- tests/to_ocl.py +51 -0
- {tricc → tricc_oo}/__init__.py +3 -1
- tricc_oo/converters/codesystem_to_ocl.py +169 -0
- tricc_oo/converters/cql/cqlLexer.py +822 -0
- tricc_oo/converters/cql/cqlListener.py +1632 -0
- tricc_oo/converters/cql/cqlParser.py +11204 -0
- tricc_oo/converters/cql/cqlVisitor.py +913 -0
- tricc_oo/converters/cql_to_operation.py +402 -0
- tricc_oo/converters/datadictionnary.py +115 -0
- tricc_oo/converters/drawio_type_map.py +222 -0
- tricc_oo/converters/tricc_to_xls_form.py +61 -0
- tricc_oo/converters/utils.py +65 -0
- tricc_oo/converters/xml_to_tricc.py +1003 -0
- tricc_oo/models/__init__.py +4 -0
- tricc_oo/models/base.py +732 -0
- tricc_oo/models/calculate.py +216 -0
- tricc_oo/models/ocl.py +281 -0
- tricc_oo/models/ordered_set.py +125 -0
- tricc_oo/models/tricc.py +418 -0
- tricc_oo/parsers/xml.py +138 -0
- tricc_oo/serializers/__init__.py +0 -0
- tricc_oo/serializers/xls_form.py +745 -0
- tricc_oo/strategies/__init__.py +0 -0
- tricc_oo/strategies/input/__init__.py +0 -0
- tricc_oo/strategies/input/base_input_strategy.py +111 -0
- tricc_oo/strategies/input/drawio.py +317 -0
- tricc_oo/strategies/output/base_output_strategy.py +148 -0
- tricc_oo/strategies/output/spice.py +365 -0
- tricc_oo/strategies/output/xls_form.py +697 -0
- tricc_oo/strategies/output/xlsform_cdss.py +189 -0
- tricc_oo/strategies/output/xlsform_cht.py +200 -0
- tricc_oo/strategies/output/xlsform_cht_hf.py +334 -0
- tricc_oo/visitors/__init__.py +0 -0
- tricc_oo/visitors/tricc.py +2199 -0
- tricc_oo/visitors/utils.py +17 -0
- tricc_oo/visitors/xform_pd.py +264 -0
- tricc_oo-1.4.16.dist-info/METADATA +219 -0
- tricc_oo-1.4.16.dist-info/RECORD +46 -0
- {tricc_oo-1.0.2.dist-info → tricc_oo-1.4.16.dist-info}/WHEEL +1 -1
- tricc_oo-1.4.16.dist-info/top_level.txt +2 -0
- tricc/converters/mc_to_tricc.py +0 -542
- tricc/converters/tricc_to_xls_form.py +0 -553
- tricc/converters/utils.py +0 -44
- tricc/converters/xml_to_tricc.py +0 -740
- tricc/models/tricc.py +0 -1093
- tricc/parsers/xml.py +0 -81
- tricc/serializers/xls_form.py +0 -364
- tricc/strategies/input/base_input_strategy.py +0 -80
- tricc/strategies/input/drawio.py +0 -246
- tricc/strategies/input/medalcreator.py +0 -168
- tricc/strategies/output/base_output_strategy.py +0 -92
- tricc/strategies/output/xls_form.py +0 -308
- tricc/strategies/output/xlsform_cdss.py +0 -46
- tricc/strategies/output/xlsform_cht.py +0 -106
- tricc/visitors/tricc.py +0 -375
- tricc_oo-1.0.2.dist-info/LICENSE +0 -78
- tricc_oo-1.0.2.dist-info/METADATA +0 -229
- tricc_oo-1.0.2.dist-info/RECORD +0 -26
- tricc_oo-1.0.2.dist-info/top_level.txt +0 -2
- venv/bin/vba_extract.py +0 -78
- {tricc → tricc_oo}/converters/__init__.py +0 -0
- {tricc → tricc_oo}/models/lang.py +0 -0
- {tricc/serializers → tricc_oo/parsers}/__init__.py +0 -0
- {tricc → tricc_oo}/serializers/planuml.py +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
PROCESSES = [
|
|
2
|
+
"triage",
|
|
3
|
+
"emergency-care",
|
|
4
|
+
"registration",
|
|
5
|
+
"history-and-physical",
|
|
6
|
+
"local-urgent-care",
|
|
7
|
+
"acute-tertiary-care",
|
|
8
|
+
"diagnostic-testing",
|
|
9
|
+
"determine-diagnosis",
|
|
10
|
+
"provide-counseling",
|
|
11
|
+
"dispense-medications",
|
|
12
|
+
"monitor-and-follow-up-of-patient",
|
|
13
|
+
"alerts-reminders-education",
|
|
14
|
+
"discharge-referral-of-patient",
|
|
15
|
+
"charge-for-service",
|
|
16
|
+
"record-and-report",
|
|
17
|
+
]
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Thu Sep 1 11:21:39 2022
|
|
4
|
+
|
|
5
|
+
@author: kluera
|
|
6
|
+
|
|
7
|
+
Make subforms that allow to be releoaded seperately as a 'task' in CHT,
|
|
8
|
+
allowing to simulate a pause functionality.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import pandas as pd
|
|
12
|
+
import json
|
|
13
|
+
|
|
14
|
+
def remove_dots(s):
|
|
15
|
+
return s.replace('.','_')
|
|
16
|
+
|
|
17
|
+
def chf_clean_name(s, remove_dots=False):
|
|
18
|
+
# Check if there is a dot in the string
|
|
19
|
+
if remove_dots:
|
|
20
|
+
return remove_dots(s)
|
|
21
|
+
elif "." in s:
|
|
22
|
+
return f'["{s}"]'
|
|
23
|
+
else:
|
|
24
|
+
# If no dot is present, return None or handle it as needed
|
|
25
|
+
return s
|
|
26
|
+
|
|
27
|
+
# df is the dataframe to be split
|
|
28
|
+
# pausepoint is the index of the row after which the form should pause
|
|
29
|
+
def make_breakpoints(df, pausepoint, calculate_name=None, replace_dots=False):
|
|
30
|
+
"""
|
|
31
|
+
Creates a dataframe for a follow-up questionnaire while preserving previous inputs.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
df: Input dataframe containing the questionnaire
|
|
35
|
+
pausepoint: Point where the questionnaire should pause
|
|
36
|
+
calculate_name: Optional name for calculation fields
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
# Get data points collected before break
|
|
40
|
+
if 'input end' not in df['name'].values:
|
|
41
|
+
raise ValueError("input end field not found in input dataframe")
|
|
42
|
+
end_inputs_loc = df.index[df['name'] == 'input end'][0]
|
|
43
|
+
next_begin_group_loc = min([i for i in df.index[df['type'] == 'begin group'] if i > end_inputs_loc])
|
|
44
|
+
|
|
45
|
+
df_input = df.loc[next_begin_group_loc:pausepoint]
|
|
46
|
+
|
|
47
|
+
# Define field types to handle
|
|
48
|
+
typesconvert = ['integer', 'decimal', 'select_', 'text']
|
|
49
|
+
typeskeep = ['hidden', 'calculate', 'string']
|
|
50
|
+
|
|
51
|
+
# Create masks for filtering
|
|
52
|
+
type_mask = df_input['type'].str.contains('|'.join(typeskeep + typesconvert))
|
|
53
|
+
optin_mask = ~df_input['name'].str.contains('more_info_optin', na=False)
|
|
54
|
+
|
|
55
|
+
# Filter dataframe keeping important fields
|
|
56
|
+
df_input = df_input.loc[type_mask & optin_mask]
|
|
57
|
+
|
|
58
|
+
# Preserve existing hidden fields and their calculations
|
|
59
|
+
existing_hidden = df_input[df_input['type'] == 'hidden'].copy()
|
|
60
|
+
|
|
61
|
+
# Convert specified types to hidden while preserving their data
|
|
62
|
+
mask_indices = df_input.index[df_input['type'].str.contains('|'.join(typesconvert))]
|
|
63
|
+
# Get hidden field names
|
|
64
|
+
|
|
65
|
+
df_input.loc[mask_indices, 'type'] = 'hidden'
|
|
66
|
+
df_input.loc[mask_indices, 'appearance'] = 'hidden'
|
|
67
|
+
|
|
68
|
+
# Handle label columns while preserving existing labels where needed
|
|
69
|
+
label_cols = [col for col in df.columns if 'label' in col]
|
|
70
|
+
df_input.loc[mask_indices, label_cols] = 'NO_LABEL'
|
|
71
|
+
|
|
72
|
+
# Clear non-essential columns while preserving crucial data
|
|
73
|
+
essential_cols = ['name', 'type', 'calculation'] + label_cols
|
|
74
|
+
other_cols = df_input.columns.drop(essential_cols)
|
|
75
|
+
df_input[other_cols] = ''
|
|
76
|
+
|
|
77
|
+
# Preserve calculations for existing hidden fields
|
|
78
|
+
df_input.update(existing_hidden[['calculation']])
|
|
79
|
+
# SAVE THE INPUT NAMES
|
|
80
|
+
hidden_names = list(df_input.loc[df_input['type']=='hidden', 'name'])
|
|
81
|
+
if replace_dots:
|
|
82
|
+
df_input['name'] = df_input['name'].map(remove_dots)
|
|
83
|
+
# Handle indexing and grouping
|
|
84
|
+
df_input.index = df_input.index.map(str)
|
|
85
|
+
hidden_ids = df_input.loc[df_input['type']=='hidden'].index
|
|
86
|
+
inputs_group_index = '0'
|
|
87
|
+
new_hidden_ids = inputs_group_index + '.' + hidden_ids
|
|
88
|
+
|
|
89
|
+
# Update indices
|
|
90
|
+
index_map = dict(zip(hidden_ids, new_hidden_ids))
|
|
91
|
+
df_input.rename(index=index_map, inplace=True)
|
|
92
|
+
df_input.sort_index(inplace=True)
|
|
93
|
+
df_input.reset_index(drop=True, inplace=True)
|
|
94
|
+
|
|
95
|
+
if remove_dots:
|
|
96
|
+
# Precompute replacement dictionary
|
|
97
|
+
replacement_dict = {f'${old_name}': f'${remove_dots(old_name)}' for old_name in hidden_names if '.' in old_name}
|
|
98
|
+
|
|
99
|
+
# Apply replacements to entire DataFrame
|
|
100
|
+
df_input = df_input.astype(str).replace(replacement_dict, regex=False)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# put all together
|
|
107
|
+
if 'data_load' not in df['name'].values:
|
|
108
|
+
raise ValueError("data_load field not found in input dataframe")
|
|
109
|
+
data_load_loc = df.index[df['name'] == 'data_load'][0]
|
|
110
|
+
|
|
111
|
+
# Split the dataframe into three parts
|
|
112
|
+
df_before_data_load = df.loc[:data_load_loc] # Everything up to data_load
|
|
113
|
+
df_until_begin_group = df.loc[data_load_loc+1:next_begin_group_loc-1] # From data_load to next begin_group
|
|
114
|
+
|
|
115
|
+
# Reset indices for proper concatenation
|
|
116
|
+
df_input = df_input.reset_index(drop=True)
|
|
117
|
+
df_before_data_load = df_before_data_load.reset_index(drop=True)
|
|
118
|
+
df_until_begin_group = df_until_begin_group.reset_index(drop=True)
|
|
119
|
+
|
|
120
|
+
# Concatenate in the correct order
|
|
121
|
+
df_combined = pd.concat([
|
|
122
|
+
df_before_data_load, # First part until data_load
|
|
123
|
+
df_input, # Injected converted fields
|
|
124
|
+
df_until_begin_group # Remaining part until next begin_group
|
|
125
|
+
]).reset_index(drop=True)
|
|
126
|
+
|
|
127
|
+
# Handle post-break section
|
|
128
|
+
df_after = df.loc[pausepoint+1:].reset_index(drop=True)
|
|
129
|
+
if df_after.iloc[0,0] == 'end group':
|
|
130
|
+
df_after = df_after.iloc[1:]
|
|
131
|
+
|
|
132
|
+
# Final concatenation
|
|
133
|
+
final_df = pd.concat([df_combined, df_after])
|
|
134
|
+
if calculate_name:
|
|
135
|
+
final_df.loc[final_df['name']=='hidden','calculation']='0'
|
|
136
|
+
|
|
137
|
+
final_df.fillna('', inplace=True)
|
|
138
|
+
final_df.reset_index(inplace=True, drop=True)
|
|
139
|
+
|
|
140
|
+
return final_df, hidden_names
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def get_tasksstrings(hidden_names, df_survey):
|
|
145
|
+
'''This function makes a list of strings of hidden fields that will be loaded into a form that continues the consultation.
|
|
146
|
+
This is very handy as this string must be pasted into the tasks.js file in CHT.
|
|
147
|
+
@hidden_names: are the names of the 'hidden' fields in the input group of the follow up form
|
|
148
|
+
@df_survey: is the survey tab of the complete (original) form without breaks, going from A to Z
|
|
149
|
+
@tasks_strings: is the string that has to be pasted into tasks.js'''
|
|
150
|
+
|
|
151
|
+
task_string_template = "content['{variableName}'] = getField(report, '{full_path}')"
|
|
152
|
+
task_strings = {}
|
|
153
|
+
for s in hidden_names:
|
|
154
|
+
df_above_s = df_survey.iloc[:df_survey.loc[df_survey['name']==s].index[0]]
|
|
155
|
+
df_above_s_groups = df_above_s.loc[df_above_s['type'].isin(['begin group', 'end group'])]
|
|
156
|
+
above_s_grouprows = df_above_s_groups.index
|
|
157
|
+
fullpath = []
|
|
158
|
+
for i in above_s_grouprows:
|
|
159
|
+
if df_above_s.iloc[i]['type']=='begin group':
|
|
160
|
+
fullpath.append(df_above_s.iloc[i]['name'])
|
|
161
|
+
else:
|
|
162
|
+
fullpath = fullpath[:-1]
|
|
163
|
+
if len(fullpath)>0:
|
|
164
|
+
line = task_string_template.format(
|
|
165
|
+
variableName=s, full_path='.'.join(fullpath) + chf_clean_name(s)
|
|
166
|
+
)
|
|
167
|
+
else:
|
|
168
|
+
line = task_string_template.format(
|
|
169
|
+
variableName=s, full_path=chf_clean_name(s)
|
|
170
|
+
)
|
|
171
|
+
task_strings[s]=line
|
|
172
|
+
return list(task_strings.values())
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def get_task_js(form_id, calculate_name, title, form_types, hidden_names, df_survey, repalce_dots=False, task_title="'id: '+getField(report, 'g_registration.p_id')+'; age: '+getField(report, 'p_age')+getField(report, 'g_registration.p_gender')+' months; '+getField(report, 'p_weight') + 'kg; ' + getField(report, 'g_fever.p_temp')+'°'"):
|
|
176
|
+
task_name = f"{form_id}_{calculate_name}"
|
|
177
|
+
task_name_upper = task_name.upper()
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
return f"""
|
|
181
|
+
/* eslint-disable no-use-before-define */
|
|
182
|
+
/* eslint-disable */
|
|
183
|
+
|
|
184
|
+
const {{injectDataFromForm, isFormArrayHasSourceId}} = require('./stph-extras'); -> isFormArrayHasSourceId was missing from the imports
|
|
185
|
+
|
|
186
|
+
const CASE_DATA = ['{"','".join(hidden_names)}'];
|
|
187
|
+
|
|
188
|
+
const {{injectDataFromForm}} = require('./stph-extras');
|
|
189
|
+
|
|
190
|
+
const {task_name_upper}_FORMS = ['{"','".join(form_types)}'];
|
|
191
|
+
|
|
192
|
+
var task_title = "{task_title}"
|
|
193
|
+
|
|
194
|
+
const {task_name_upper}_TASK_FORM = '{form_id}_{calculate_name}';
|
|
195
|
+
|
|
196
|
+
const {task_name}Content = function (content, contact, report){{
|
|
197
|
+
|
|
198
|
+
injectDataFromForm(content, '', CASE_DATA, {task_name_upper}_FORMS, [report], {'true' if repalce_dots else 'false'});
|
|
199
|
+
content['patient_id'] = report.contact._id;
|
|
200
|
+
content['source_id'] = report._id;
|
|
201
|
+
console.log(content);
|
|
202
|
+
console.log(report);
|
|
203
|
+
}};
|
|
204
|
+
//TODO: redirect after task
|
|
205
|
+
/*function navigateToTask() {{
|
|
206
|
+
Router.navigate(['first'])
|
|
207
|
+
}}*/
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
function {task_name}ContactLabel (){{
|
|
211
|
+
task_title;
|
|
212
|
+
}}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
function {task_name}ResolveIf(contact, report, event, dueDate) {{
|
|
216
|
+
return isFormArrayHasSourceId( report, contact.reports, event, dueDate, {task_name_upper}_TASK_FORMS);
|
|
217
|
+
}}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
module.exports = {{
|
|
221
|
+
{task_name_upper}_TASK_FORM,
|
|
222
|
+
{task_name_upper}_FORMS,
|
|
223
|
+
{task_name}Content,
|
|
224
|
+
{task_name}ContactLabel,
|
|
225
|
+
{task_name}ResolveIf,
|
|
226
|
+
}}
|
|
227
|
+
//
|
|
228
|
+
//// to be copied in task
|
|
229
|
+
//
|
|
230
|
+
//const {{
|
|
231
|
+
// {task_name_upper}_TASK_FORM,
|
|
232
|
+
// {task_name_upper}_FORMS,
|
|
233
|
+
// {task_name}Content,
|
|
234
|
+
// {task_name}ContactLabel,
|
|
235
|
+
// {task_name}ResolveIf, }} = require('./{task_name}');
|
|
236
|
+
//
|
|
237
|
+
//module.exports = [
|
|
238
|
+
//
|
|
239
|
+
// {{
|
|
240
|
+
// name: '{task_name}',
|
|
241
|
+
// icon: 'icon-healthcare-diagnosis',
|
|
242
|
+
// title: 'diagnostic',
|
|
243
|
+
// appliesTo: 'reports',
|
|
244
|
+
// appliesToType: {task_name_upper}_FORMS,
|
|
245
|
+
// actions: [
|
|
246
|
+
// {{
|
|
247
|
+
// type: 'report',
|
|
248
|
+
// form: {task_name_upper}_TASK_FORM,
|
|
249
|
+
// modifyContent: {task_name}Content
|
|
250
|
+
// }}
|
|
251
|
+
// ],
|
|
252
|
+
// events: [
|
|
253
|
+
// {{
|
|
254
|
+
// id: '{task_name}',
|
|
255
|
+
// days: 0,
|
|
256
|
+
// start: 1,
|
|
257
|
+
// end: 0
|
|
258
|
+
// }}
|
|
259
|
+
// ],
|
|
260
|
+
// resolvedIf: {task_name}ResolveIf
|
|
261
|
+
// }}
|
|
262
|
+
//];
|
|
263
|
+
"""
|
|
264
|
+
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tricc-oo
|
|
3
|
+
Version: 1.4.16
|
|
4
|
+
Summary: Python library that converts CDSS L2 in L3
|
|
5
|
+
Project-URL: Homepage, https://github.com/SwissTPH/tricc
|
|
6
|
+
Project-URL: Issues, https://github.com/SwissTPH/tricc/issues
|
|
7
|
+
Keywords: xlsform,drawio,authoring
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: lxml
|
|
13
|
+
Requires-Dist: markdownify
|
|
14
|
+
Requires-Dist: pydantic
|
|
15
|
+
Requires-Dist: babel
|
|
16
|
+
Requires-Dist: xlsxwriter
|
|
17
|
+
Requires-Dist: pandas
|
|
18
|
+
Requires-Dist: polib
|
|
19
|
+
Requires-Dist: strenum
|
|
20
|
+
Requires-Dist: fhir.resources
|
|
21
|
+
Requires-Dist: antlr4-python3-runtime==4.13.2
|
|
22
|
+
Requires-Dist: antlr4-tools==0.2.1
|
|
23
|
+
Requires-Dist: beautifulsoup4
|
|
24
|
+
Requires-Dist: ocldev
|
|
25
|
+
|
|
26
|
+
# design rules tricc_oo
|
|
27
|
+
|
|
28
|
+
## Nodes
|
|
29
|
+
|
|
30
|
+
## Node Types and Properties
|
|
31
|
+
|
|
32
|
+
**Start Node**
|
|
33
|
+
This node type represents the beginning of a process. It requires a label and can have attributes like process, parent, and form_id.
|
|
34
|
+
|
|
35
|
+
**Activity Start Node**
|
|
36
|
+
Marking the start of an activity, this node type needs both a label and a name. It can have attributes such as parent and instance.
|
|
37
|
+
|
|
38
|
+
**Note Nodes**
|
|
39
|
+
This node type are used for providing information. Note nodes require both a label and a name,.
|
|
40
|
+
|
|
41
|
+
**Selection Nodes**
|
|
42
|
+
There are three types of selection nodes:
|
|
43
|
+
- Select One: For single-choice selections
|
|
44
|
+
- Select Multiple: For multiple-choice selections
|
|
45
|
+
- Select Yes/No: For binary choices
|
|
46
|
+
|
|
47
|
+
All these nodes require a label, name, and list_name. They can have attributes like required, save, filter, constraint, and constraint_message.
|
|
48
|
+
|
|
49
|
+
**Numeric Input Nodes**
|
|
50
|
+
Decimal and Integer nodes are used for numeric input. They require a label and name, and can have attributes like min, max, constraint, save, constraint_message, and required.
|
|
51
|
+
|
|
52
|
+
**Text and Date Nodes**
|
|
53
|
+
These nodes are for text input and date selection. Both require a label and name.
|
|
54
|
+
|
|
55
|
+
**Calculation Nodes**
|
|
56
|
+
Add, Count, and Calculate nodes are used for various calculations. They require a label and name, and can have save and expression attributes
|
|
57
|
+
|
|
58
|
+
**Flow Control Nodes**
|
|
59
|
+
Rhombus and Wait nodes are used for flow control. They require a reference, name, and label, and can have save and expression attributes.
|
|
60
|
+
|
|
61
|
+
**Exclusive Node**
|
|
62
|
+
This node type doesn't have any mandatory attributes or specific attributes defined.
|
|
63
|
+
|
|
64
|
+
**Not Available Node**
|
|
65
|
+
Used to indicate unavailability, this node requires a label, name, and list_name.
|
|
66
|
+
|
|
67
|
+
**Link Nodes**
|
|
68
|
+
Link Out and Link In nodes are used for creating connections. Link Out requires a reference, label, and name, while Link In only needs a label and name.
|
|
69
|
+
|
|
70
|
+
**Go To Node**
|
|
71
|
+
This node is used for navigation. It requires a link, label, and name, and can have an instance attribute.
|
|
72
|
+
|
|
73
|
+
**End Nodes**
|
|
74
|
+
End and Activity End nodes mark the conclusion of processes or activities.
|
|
75
|
+
|
|
76
|
+
**Bridge Node**
|
|
77
|
+
This node can have a label attribute but doesn't have any mandatory attributes.
|
|
78
|
+
|
|
79
|
+
**Diagnosis Node**
|
|
80
|
+
Used for diagnostic purposes, this node requires a name and label
|
|
81
|
+
|
|
82
|
+
### Enrichment
|
|
83
|
+
|
|
84
|
+
Node can be enriched with message and media, simply add the media on the draw.io andlink them with an edge
|
|
85
|
+
|
|
86
|
+
**Image Node**
|
|
87
|
+
Used to add image to a question
|
|
88
|
+
|
|
89
|
+
**Hint Message Node**
|
|
90
|
+
Used to add an hint message to a question, need a label
|
|
91
|
+
|
|
92
|
+
**Help Message Node**
|
|
93
|
+
Used to add an help message to a question, need a label
|
|
94
|
+
|
|
95
|
+
## Attributes
|
|
96
|
+
|
|
97
|
+
**expression**
|
|
98
|
+
replace the calcualte deducted by inputs
|
|
99
|
+
|
|
100
|
+
**default**
|
|
101
|
+
not supported yet
|
|
102
|
+
|
|
103
|
+
**save**
|
|
104
|
+
will create a calculate with the same name
|
|
105
|
+
- obs: observation: save the option as a calcualte obs_[name of the option]
|
|
106
|
+
- can be written obs.[othername].[snomedCode]
|
|
107
|
+
- diag: diagnostic/classification save the option as a calcualte diag_[name of the option]
|
|
108
|
+
- flag: calculate save the option as a calcualte is_[name of the option]
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## Edges
|
|
112
|
+
|
|
113
|
+
The edge are in general labeless unless for :
|
|
114
|
+
- after a select multiple: can setup quick rhombus for the number of choice selected, an opperator is required (<>=) in the edge label
|
|
115
|
+
- after a yes/no quesiton: 'Yes', 'No', 'Follow' (translation can be added in the code )
|
|
116
|
+
- before a calculate to put weight: integer only
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# notes
|
|
120
|
+
|
|
121
|
+
## advanced interpretation of the edges:
|
|
122
|
+
|
|
123
|
+
Activity instances: if there is more that 1 instance of a single actity then the 1+ activity will be displayed only if the previous one were not, to do that the GoTO node are replaced by a path and a rombhus, the path got to the activitvy and rhombus and the next node (if any) are attached to the rhombus that is use to wait that the activity
|
|
124
|
+
|
|
125
|
+
the node following an 1+ activity will be display after the activy OR instead of the activity
|
|
126
|
+
|
|
127
|
+
Select multiple: if followed by a calculate (rhombus included) the calculate will be equal to the number of selected option BUT opt_none
|
|
128
|
+
if not a calculate then relevance will be used unless it is "required" then condition will be at least 1 selection
|
|
129
|
+
|
|
130
|
+
the Rhombus act as an AND between its imputs and its reference BUT it is an OR beween the inputs
|
|
131
|
+
(input1 OR input2 OR input3) AND reference
|
|
132
|
+
|
|
133
|
+
## start nodes
|
|
134
|
+
|
|
135
|
+
### Main start
|
|
136
|
+
|
|
137
|
+
the flow required at least 1 main start node, but in case of cdss output strategy , several could be used given that they have a 'process' atrribute
|
|
138
|
+
|
|
139
|
+
here is the list of the CPG process, this will be the execution oder too:
|
|
140
|
+
- **registration**,
|
|
141
|
+
- **triage**,
|
|
142
|
+
- **emergency-care**,
|
|
143
|
+
- **local-urgent-care**,
|
|
144
|
+
- **actue-tertiary-care**,
|
|
145
|
+
- **history-and-physical**,
|
|
146
|
+
- **diagnostic-testing**,
|
|
147
|
+
- **determine-diagnosis**,
|
|
148
|
+
- **provide-counseling**,
|
|
149
|
+
- **dispense-medications**,
|
|
150
|
+
- **monitor-and-follow-up-of-patient**,
|
|
151
|
+
- **alerts-reminders-education**,
|
|
152
|
+
- **discharge-referral-of-patient**,
|
|
153
|
+
- **charge-for-service**,
|
|
154
|
+
- **record-and-report**
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
# READ Xressource
|
|
158
|
+
https://jgraph.github.io/drawio-tools/tools/convert.html
|
|
159
|
+
|
|
160
|
+
option can have only incoming edge from images to be placed as option$
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# Note
|
|
164
|
+
|
|
165
|
+
## generation of the expressions
|
|
166
|
+
|
|
167
|
+
### add calcualte:
|
|
168
|
+
|
|
169
|
+
- Non or No in an egde will generate a negate node
|
|
170
|
+
- save adds a calcualte
|
|
171
|
+
- a rhombus will generate a calcualte using the reference (can you the label as a test, either with comparaisin or option selected with [option label])
|
|
172
|
+
|
|
173
|
+
### for calculate
|
|
174
|
+
|
|
175
|
+
Then we calculate based on the previous nodes: [get_prev_node_expression]
|
|
176
|
+
- if a "fake" calculate (Rhombus, exclusion) then get the underlying expression (should not depend of Calcualte = true) [get_calculation_terms]
|
|
177
|
+
- if a Select, manage it as a calculate too (should not depend of Calcualte = true) [get_calculation_terms]
|
|
178
|
+
- else get the expression via [get_calculation_terms] [get_prev_node_expression , calculate = False] -> get_node_expression for the prev node
|
|
179
|
+
|
|
180
|
+
# Running directly
|
|
181
|
+
|
|
182
|
+
`tricc` is technically a python library, but you can run it directly via the [`build.py` script](./tests/build.py).
|
|
183
|
+
|
|
184
|
+
## Running with Docker
|
|
185
|
+
|
|
186
|
+
Alternatively, if you prefer to build/run the project with Docker, you can do the following.
|
|
187
|
+
|
|
188
|
+
Start by building the Docker image:
|
|
189
|
+
|
|
190
|
+
```shell
|
|
191
|
+
git clone https://github.com/SwissTPH/tricc.git
|
|
192
|
+
cd tricc
|
|
193
|
+
|
|
194
|
+
docker build -t tricc .
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Once you have the image built you can use it to convert local `.drawio` files by mapping the local directory to the `docker run` command. (Note that `--user` is specified to make sure the current host user has write access to the output files.)
|
|
198
|
+
|
|
199
|
+
```shell
|
|
200
|
+
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc --help
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
This command will convert all `.drawio` files in the current directory:
|
|
204
|
+
|
|
205
|
+
```shell
|
|
206
|
+
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
You can also convert a single file:
|
|
210
|
+
|
|
211
|
+
```shell
|
|
212
|
+
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj/demo.drawio -o /proj
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Use the `-O` flag to specify the output strategy. For example to generate CHT files:
|
|
216
|
+
|
|
217
|
+
```shell
|
|
218
|
+
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj -O XLSFormCHTStrategy
|
|
219
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
tests/build.py,sha256=Wo2-JLEhsUSva8EanX5aRTS-tddqQWmBH-hwapotw1M,6478
|
|
2
|
+
tests/test_cql.py,sha256=sxAYEtiiZ-naXVaKPDYHaQFVhbw0QnYy4_MCItgv1Do,6547
|
|
3
|
+
tests/to_ocl.py,sha256=f_KeKF7N1tri9ChbtH1OShgHskt_T9Wj1IfaT6qJNGY,2247
|
|
4
|
+
tricc_oo/__init__.py,sha256=Els6sDXpOJiGU1zp45rTXZgEKceq_XhRZDfrx1mIMGc,255
|
|
5
|
+
tricc_oo/converters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
tricc_oo/converters/codesystem_to_ocl.py,sha256=-ZKMBeIvzgqmhJfnn6ptuwpnHQtuE-fCDDfKpfGvUSU,6066
|
|
7
|
+
tricc_oo/converters/cql_to_operation.py,sha256=TrZLfNRtLpcpHM1L524IQvv-hnWaksmrxWie0iMvFKM,13609
|
|
8
|
+
tricc_oo/converters/datadictionnary.py,sha256=WQCvMYgEcxoCL1nRqq2aCQszIaKrIPCe3CkkZ0reAyY,3824
|
|
9
|
+
tricc_oo/converters/drawio_type_map.py,sha256=HQR9fzwy52BRL0pWhYftzrRBd3LLWP4Ot1_CIqA8mCM,7011
|
|
10
|
+
tricc_oo/converters/tricc_to_xls_form.py,sha256=bIVP1J2eZyIiVTaGQ3oQ_yu18R0stb4abMxg4fWr9Zc,2137
|
|
11
|
+
tricc_oo/converters/utils.py,sha256=UyndDORsDbRV5-gYW-yInK5ztjtYdeCw6K-mrYr1Emk,1688
|
|
12
|
+
tricc_oo/converters/xml_to_tricc.py,sha256=SfOgqgy8lYO08Q7JfCPCTKWbzwr6hURGD7ULZgqMLtc,37147
|
|
13
|
+
tricc_oo/converters/cql/cqlLexer.py,sha256=t0-QvDv5kxCiBZJ9SfDumFOgnRSry_HJpakBZV224Ig,49126
|
|
14
|
+
tricc_oo/converters/cql/cqlListener.py,sha256=ketvj7XvO7t047S6A3_gTPvp2MlYk1bojmkl10v5E6Y,57523
|
|
15
|
+
tricc_oo/converters/cql/cqlParser.py,sha256=hIUdR907WX24P2Jlrxk-H0IT94n51yh_ZsCmwQhnFas,414730
|
|
16
|
+
tricc_oo/converters/cql/cqlVisitor.py,sha256=SWSDIqVYBhucR4VgLn_EPNs7LV9yCqsOmzFZ0bmRSGc,33865
|
|
17
|
+
tricc_oo/models/__init__.py,sha256=Rdk1fsNXHrbmXTQD1O7i0NC_A6os648Ap6CtWRliOg8,92
|
|
18
|
+
tricc_oo/models/base.py,sha256=kAQuZtOsFtwX3V84zePgW9Pc-RYiny4EsnBlLecr3Yw,24059
|
|
19
|
+
tricc_oo/models/calculate.py,sha256=Bw7OGa4OYxHP529wA23CZftMYDL_CA0SPQ0j1IFyTNA,7456
|
|
20
|
+
tricc_oo/models/lang.py,sha256=SwKaoxyRhE7gH_ZlYyFXzGuTQ5RE19y47LWAA35zYxg,2338
|
|
21
|
+
tricc_oo/models/ocl.py,sha256=ol35Gl1jCBp0Ven0yxOKzDIZkVL5Kx9uwaR_64pjxKI,8931
|
|
22
|
+
tricc_oo/models/ordered_set.py,sha256=cdvqlWgbwN0Jl7btssEoXbzQJ2rlMzxGILRblMqjRg0,4182
|
|
23
|
+
tricc_oo/models/tricc.py,sha256=FG8rq7zy3vbZO1C6WofMq--FE0JErdysM9WfAj4YYns,16321
|
|
24
|
+
tricc_oo/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
+
tricc_oo/parsers/xml.py,sha256=vq9PA5Zt4G3QMtZ1zgyN8110O1w19Jqt6JClJYhHJlU,4410
|
|
26
|
+
tricc_oo/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
+
tricc_oo/serializers/planuml.py,sha256=a81YKsjgng-h2H_rmFE2J5FeBBUaH8kRGT8YrvzpEKE,455
|
|
28
|
+
tricc_oo/serializers/xls_form.py,sha256=-4ktvS1Kjk_WDZb2nry_VMjpV7ju3LZHwfsCIFAd8Uw,25618
|
|
29
|
+
tricc_oo/strategies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
tricc_oo/strategies/input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
|
+
tricc_oo/strategies/input/base_input_strategy.py,sha256=QcNXJ3W5MuJ7yvW5bpbwztw_bk8BxMD5b-f0cuP4u0s,3932
|
|
32
|
+
tricc_oo/strategies/input/drawio.py,sha256=lWj5DYFxe4WpcpyrmVjy9S8_ubNG4rHxYBIp1cWzZaU,13345
|
|
33
|
+
tricc_oo/strategies/output/base_output_strategy.py,sha256=WiJwqm4g_x-rbksrjoE0ABhNMtM0_fAMoPH34RKZdc0,7173
|
|
34
|
+
tricc_oo/strategies/output/spice.py,sha256=s_COahyYCoc4Xv5TGh_AW9evDOW6GOex0Xwa_JWeLsI,11280
|
|
35
|
+
tricc_oo/strategies/output/xls_form.py,sha256=2sJhyy2BQXpekjxGptBywh-2kwILnLYEUFx2MoOIkx4,30531
|
|
36
|
+
tricc_oo/strategies/output/xlsform_cdss.py,sha256=dAT4KkXpoV8-PH7ya7aSa_86__YG0hElHss9VJoyVR8,9707
|
|
37
|
+
tricc_oo/strategies/output/xlsform_cht.py,sha256=tHayxmFFM1_7Xu-Huz-IjvteEQXQm2fhKwAMFtG-tjU,17472
|
|
38
|
+
tricc_oo/strategies/output/xlsform_cht_hf.py,sha256=bRTga6vteU86YWJC3umWeaL6Lt9dDz6e4pnHu7ctOiI,12377
|
|
39
|
+
tricc_oo/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
+
tricc_oo/visitors/tricc.py,sha256=rkF2GxTS-GQbo9a9lLv8_mS4bkd5tdmMDGfou1gPFMo,95347
|
|
41
|
+
tricc_oo/visitors/utils.py,sha256=Gol4JNozPEd30Q1l8IPIPhx5fqVyy9R81GofGVebgD8,484
|
|
42
|
+
tricc_oo/visitors/xform_pd.py,sha256=H8x-72EdyT_-QgHGQN-ZAe-wc7tLtJGCM9waA64mz3M,9424
|
|
43
|
+
tricc_oo-1.4.16.dist-info/METADATA,sha256=0nSlfJfj0Ld6tosT7IGmqkP3zZPq-ZxgIk1MnlVkglA,7853
|
|
44
|
+
tricc_oo-1.4.16.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
45
|
+
tricc_oo-1.4.16.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
|
|
46
|
+
tricc_oo-1.4.16.dist-info/RECORD,,
|