tricc-oo 1.5.23__py3-none-any.whl → 1.5.24__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 +4 -0
- tricc_oo/converters/datadictionnary.py +6 -1
- tricc_oo/models/tricc.py +1 -1
- tricc_oo/strategies/input/drawio.py +2 -2
- tricc_oo/strategies/output/base_output_strategy.py +34 -0
- tricc_oo/strategies/output/fhir_form.py +377 -0
- tricc_oo/strategies/output/html_form.py +224 -0
- tricc_oo/strategies/output/openmrs_form.py +647 -0
- tricc_oo/strategies/output/xls_form.py +34 -68
- tricc_oo/strategies/output/xlsform_cht.py +3 -2
- tricc_oo/visitors/tricc.py +116 -5
- {tricc_oo-1.5.23.dist-info → tricc_oo-1.5.24.dist-info}/METADATA +125 -84
- {tricc_oo-1.5.23.dist-info → tricc_oo-1.5.24.dist-info}/RECORD +16 -13
- {tricc_oo-1.5.23.dist-info → tricc_oo-1.5.24.dist-info}/WHEEL +0 -0
- {tricc_oo-1.5.23.dist-info → tricc_oo-1.5.24.dist-info}/licenses/LICENSE +0 -0
- {tricc_oo-1.5.23.dist-info → tricc_oo-1.5.24.dist-info}/top_level.txt +0 -0
|
@@ -12,19 +12,17 @@ import pandas as pd
|
|
|
12
12
|
from tricc_oo.converters.utils import clean_name
|
|
13
13
|
from tricc_oo.models.base import (
|
|
14
14
|
TriccOperator,
|
|
15
|
-
TriccOperation, TriccStatic, TriccReference
|
|
15
|
+
TriccOperation, TriccStatic, TriccReference
|
|
16
16
|
)
|
|
17
17
|
from tricc_oo.models.ordered_set import OrderedSet
|
|
18
18
|
from tricc_oo.models.calculate import (
|
|
19
19
|
TriccNodeEnd,
|
|
20
20
|
TriccNodeDisplayCalculateBase,
|
|
21
|
-
TriccRhombusMixIn,
|
|
22
21
|
|
|
23
22
|
)
|
|
24
23
|
from tricc_oo.models.tricc import (
|
|
25
24
|
TriccNodeCalculateBase,
|
|
26
25
|
TriccNodeBaseModel,
|
|
27
|
-
TriccNodeSelectMultiple,
|
|
28
26
|
TriccNodeSelectOption,
|
|
29
27
|
TriccNodeInputModel,
|
|
30
28
|
TriccNodeDisplayModel
|
|
@@ -42,6 +40,8 @@ from tricc_oo.visitors.tricc import (
|
|
|
42
40
|
TRICC_TRUE_VALUE,
|
|
43
41
|
TRICC_FALSE_VALUE,
|
|
44
42
|
set_last_version_false,
|
|
43
|
+
generate_calculate,
|
|
44
|
+
generate_base,
|
|
45
45
|
)
|
|
46
46
|
from tricc_oo.serializers.xls_form import (
|
|
47
47
|
CHOICE_MAP,
|
|
@@ -104,13 +104,13 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
104
104
|
return str(expression)
|
|
105
105
|
|
|
106
106
|
def generate_base(self, node, **kwargs):
|
|
107
|
-
return
|
|
107
|
+
return generate_base(node, **kwargs)
|
|
108
108
|
|
|
109
109
|
def generate_relevance(self, node, **kwargs):
|
|
110
110
|
return self.generate_xls_form_relevance(node, **kwargs)
|
|
111
111
|
|
|
112
112
|
def generate_calculate(self, node, **kwargs):
|
|
113
|
-
return
|
|
113
|
+
return generate_calculate(node, **kwargs)
|
|
114
114
|
|
|
115
115
|
def __init__(self, project, output_path):
|
|
116
116
|
super().__init__(project, output_path)
|
|
@@ -131,6 +131,31 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
131
131
|
def generate_export(self, node, **kwargs):
|
|
132
132
|
return generate_xls_form_export(self, node, **kwargs)
|
|
133
133
|
|
|
134
|
+
def inject_version(self):
|
|
135
|
+
# Add hidden version field using ODK's jr:version()
|
|
136
|
+
empty = langs.get_trads("", force_dict=True)
|
|
137
|
+
self.df_survey.loc[len(self.df_survey)] = [
|
|
138
|
+
"hidden",
|
|
139
|
+
"version",
|
|
140
|
+
*list(empty.values()), # label
|
|
141
|
+
*list(empty.values()), # hint
|
|
142
|
+
*list(empty.values()), # help
|
|
143
|
+
"", # default
|
|
144
|
+
"hidden", # appearance
|
|
145
|
+
"", # constraint
|
|
146
|
+
*list(empty.values()), # constraint_message
|
|
147
|
+
"", # relevance
|
|
148
|
+
"", # disabled
|
|
149
|
+
"", # required
|
|
150
|
+
*list(empty.values()), # required_message
|
|
151
|
+
"", # read only
|
|
152
|
+
"jr:version()", # calculation
|
|
153
|
+
"", # trigger
|
|
154
|
+
"", # repeat_count
|
|
155
|
+
"", # image
|
|
156
|
+
"", # choice_filter
|
|
157
|
+
]
|
|
158
|
+
|
|
134
159
|
def export(self, start_pages, version):
|
|
135
160
|
if start_pages["main"].root.form_id is not None:
|
|
136
161
|
form_id = str(start_pages["main"].root.form_id)
|
|
@@ -158,10 +183,10 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
158
183
|
if not os.path.exists(self.output_path):
|
|
159
184
|
os.makedirs(self.output_path)
|
|
160
185
|
|
|
186
|
+
self.inject_version()
|
|
187
|
+
|
|
161
188
|
# create a Pandas Excel writer using XlsxWriter as the engine
|
|
162
189
|
writer = pd.ExcelWriter(newpath, engine="xlsxwriter")
|
|
163
|
-
if len(self.df_survey[self.df_survey["name"] == "version"]):
|
|
164
|
-
self.df_survey.loc[self.df_survey["name"] == "version", "label"] = f"v{version}"
|
|
165
190
|
self.df_survey.to_excel(writer, sheet_name="survey", index=False)
|
|
166
191
|
self.df_choice.to_excel(writer, sheet_name="choices", index=False)
|
|
167
192
|
df_settings.to_excel(writer, sheet_name="settings", index=False)
|
|
@@ -688,68 +713,9 @@ class XLSFormStrategy(BaseOutPutStrategy):
|
|
|
688
713
|
return True
|
|
689
714
|
return False
|
|
690
715
|
|
|
691
|
-
# function update the select node in the XLSFORM format
|
|
692
|
-
# @param left part
|
|
693
|
-
# @param right part
|
|
694
|
-
def generate_xls_form_condition(self, node, processed_nodes, stashed_nodes, calculates, **kwargs):
|
|
695
|
-
if is_ready_to_process(node, processed_nodes, strict=False) and process_reference(
|
|
696
|
-
node,
|
|
697
|
-
processed_nodes,
|
|
698
|
-
calculates,
|
|
699
|
-
replace_reference=False,
|
|
700
|
-
codesystems=kwargs.get("codesystems", None),
|
|
701
|
-
):
|
|
702
|
-
if node not in processed_nodes:
|
|
703
|
-
if issubclass(node.__class__, TriccRhombusMixIn) and isinstance(node.reference, str):
|
|
704
|
-
logger.warning("node {} still using the reference string".format(node.get_name()))
|
|
705
|
-
if issubclass(node.__class__, TriccNodeInputModel):
|
|
706
|
-
# we don't overright if define in the diagram
|
|
707
|
-
if node.constraint is None:
|
|
708
|
-
if isinstance(node, TriccNodeSelectMultiple):
|
|
709
|
-
node.constraint = or_join(
|
|
710
|
-
[
|
|
711
|
-
TriccOperation(
|
|
712
|
-
TriccOperator.EQUAL,
|
|
713
|
-
["$this", TriccStatic("opt_none")],
|
|
714
|
-
),
|
|
715
|
-
TriccOperation(
|
|
716
|
-
TriccOperator.NOT,
|
|
717
|
-
[
|
|
718
|
-
TriccOperation(
|
|
719
|
-
TriccOperator.SELECTED,
|
|
720
|
-
["$this", TriccStatic("opt_none")],
|
|
721
|
-
)
|
|
722
|
-
],
|
|
723
|
-
),
|
|
724
|
-
]
|
|
725
|
-
) # '.=\'opt_none\' or not(selected(.,\'opt_none\'))'
|
|
726
|
-
node.constraint_message = "**None** cannot be selected together with choice."
|
|
727
|
-
elif node.tricc_type in (
|
|
728
|
-
TriccNodeType.integer,
|
|
729
|
-
TriccNodeType.decimal,
|
|
730
|
-
):
|
|
731
|
-
constraints = []
|
|
732
|
-
constraints_min = ""
|
|
733
|
-
constraints_max = ""
|
|
734
|
-
if node.min is not None and node.min != "":
|
|
735
|
-
constraints.append(TriccOperation(TriccOperator.MORE_OR_EQUAL, ["$this", node.min]))
|
|
736
|
-
constraints_min = "The minimun value is {0}.".format(node.min)
|
|
737
|
-
if node.max is not None and node.max != "":
|
|
738
|
-
constraints.append(TriccOperation(TriccOperator.LESS_OR_EQUAL, ["$this", node.max]))
|
|
739
|
-
constraints_max = "The maximum value is {0}.".format(node.max)
|
|
740
|
-
if len(constraints) > 1:
|
|
741
|
-
node.constraint = TriccOperation(TriccOperator.AND, constraints)
|
|
742
|
-
node.constraint_message = (constraints_min + " " + constraints_max).strip()
|
|
743
|
-
elif len(constraints) == 1:
|
|
744
|
-
node.constraint = constraints[0]
|
|
745
|
-
node.constraint_message = (constraints_min + " " + constraints_max).strip()
|
|
746
|
-
# continue walk
|
|
747
|
-
return True
|
|
748
|
-
return False
|
|
749
|
-
|
|
750
|
-
# function transform an object to XLSFORM value
|
|
751
|
-
# @param r reference to be translated
|
|
752
716
|
def get_tricc_operation_operand(self, r, coalesce_fallback="''"):
|
|
717
|
+
# function transform an object to XLSFORM value
|
|
718
|
+
# @param r reference to be translated
|
|
753
719
|
if isinstance(r, TriccOperation):
|
|
754
720
|
return self.get_tricc_operation_expression(r)
|
|
755
721
|
elif isinstance(r, TriccReference):
|
|
@@ -31,6 +31,9 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
31
31
|
|
|
32
32
|
self.df_survey = pd.concat([cht_input_df, self.df_survey, self.get_cht_summary()], ignore_index=True)
|
|
33
33
|
|
|
34
|
+
self.inject_version()
|
|
35
|
+
|
|
36
|
+
|
|
34
37
|
def get_cht_input(self, start_pages, **kwargs):
|
|
35
38
|
empty = langs.get_trads("", force_dict=True)
|
|
36
39
|
df_input = pd.DataFrame(columns=SURVEY_MAP.keys())
|
|
@@ -620,8 +623,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
620
623
|
}
|
|
621
624
|
df_settings = pd.DataFrame(settings, index=indx)
|
|
622
625
|
df_settings.head()
|
|
623
|
-
if len(self.df_survey[self.df_survey["name"] == "version"]):
|
|
624
|
-
self.df_survey.loc[self.df_survey["name"] == "version", "label"] = f"v{version}"
|
|
625
626
|
# create a Pandas Excel writer using XlsxWriter as the engine
|
|
626
627
|
writer = pd.ExcelWriter(newpath, engine="xlsxwriter")
|
|
627
628
|
self.df_survey.to_excel(writer, sheet_name="survey", index=False)
|
tricc_oo/visitors/tricc.py
CHANGED
|
@@ -6,7 +6,7 @@ import base64
|
|
|
6
6
|
|
|
7
7
|
from tricc_oo.converters.utils import generate_id
|
|
8
8
|
from tricc_oo.models.base import (
|
|
9
|
-
TriccBaseModel,
|
|
9
|
+
TriccBaseModel, TriccNodeType,
|
|
10
10
|
TriccOperator, TriccOperation, TriccStatic, TriccReference, not_clean,
|
|
11
11
|
and_join, or_join, clean_or_list, nand_join, TriccEdge
|
|
12
12
|
)
|
|
@@ -34,6 +34,7 @@ from tricc_oo.models.calculate import (
|
|
|
34
34
|
from tricc_oo.models.tricc import (
|
|
35
35
|
TriccNodeCalculateBase, TriccNodeActivity, TriccNodeBaseModel, TriccNodeNumber,
|
|
36
36
|
TriccNodeSelectMultiple,
|
|
37
|
+
TriccNodeSelectOne,
|
|
37
38
|
TriccNodeSelectOption,
|
|
38
39
|
TriccNodeSelectYesNo,
|
|
39
40
|
TriccNodeInputModel,
|
|
@@ -217,7 +218,7 @@ def merge_expression(expression, last_version):
|
|
|
217
218
|
return expression
|
|
218
219
|
|
|
219
220
|
|
|
220
|
-
def
|
|
221
|
+
def load_calculate(
|
|
221
222
|
node, processed_nodes, stashed_nodes, calculates, used_calculates, warn=False, process=None, **kwargs
|
|
222
223
|
):
|
|
223
224
|
# used_calculates dict[name, Dict[id, node]]
|
|
@@ -892,7 +893,7 @@ def add_used_calculate(node, prev_node, calculates, used_calculates, processed_n
|
|
|
892
893
|
used_calculates[prev_node.name][max_version.id] = max_version
|
|
893
894
|
else:
|
|
894
895
|
logger.debug(
|
|
895
|
-
"
|
|
896
|
+
"load_calculate_version_requirement: failed for {0} , prev Node {1} ".format(
|
|
896
897
|
node.get_name(), prev_node.get_name()
|
|
897
898
|
)
|
|
898
899
|
)
|
|
@@ -2503,17 +2504,127 @@ def get_required_node_expression(node):
|
|
|
2503
2504
|
|
|
2504
2505
|
# Get a selected option
|
|
2505
2506
|
def get_selected_option_expression(option_node, negate):
|
|
2507
|
+
if isinstance(option_node.select, TriccNodeSelectOne):
|
|
2508
|
+
return get_selected_option_expression_single(option_node, negate)
|
|
2509
|
+
else:
|
|
2510
|
+
return get_selected_option_expression_multiple(option_node, negate)
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
def get_selected_option_expression_single(option_node, negate):
|
|
2514
|
+
|
|
2515
|
+
if not negate:
|
|
2516
|
+
return TriccOperation(TriccOperator.EQUAL, [option_node.select, option_node])
|
|
2517
|
+
|
|
2506
2518
|
|
|
2507
|
-
|
|
2519
|
+
def get_selected_option_expression_multiple(option_node, negate):
|
|
2520
|
+
|
|
2521
|
+
selected = TriccOperation(TriccOperator.SELECTED, [option_node.select, option_node])
|
|
2508
2522
|
|
|
2509
2523
|
if negate:
|
|
2510
2524
|
return TriccOperation(
|
|
2511
2525
|
operator=TriccOperator.AND,
|
|
2512
2526
|
resource=[
|
|
2513
2527
|
TriccOperation(operator=TriccOperator.NOT, resource=[selected]),
|
|
2514
|
-
TriccOperation(operator=TriccOperator.
|
|
2528
|
+
TriccOperation(operator=TriccOperator.ISNOTNULL, resource=[option_node.select]),
|
|
2515
2529
|
],
|
|
2516
2530
|
)
|
|
2517
2531
|
|
|
2518
2532
|
else:
|
|
2519
2533
|
return selected
|
|
2534
|
+
|
|
2535
|
+
|
|
2536
|
+
def generate_calculate(node, processed_nodes, **kwargs):
|
|
2537
|
+
# For calculations, set calculate in questionOptions
|
|
2538
|
+
# Check if node is ready to be processed (similar to XLS form strategy)
|
|
2539
|
+
if not is_ready_to_process(node, processed_nodes, strict=True):
|
|
2540
|
+
return False
|
|
2541
|
+
|
|
2542
|
+
# Process references to ensure dependencies are handled
|
|
2543
|
+
if not process_reference(
|
|
2544
|
+
node, processed_nodes, {}, replace_reference=True, codesystems=kwargs.get("codesystems", None)
|
|
2545
|
+
):
|
|
2546
|
+
return False
|
|
2547
|
+
|
|
2548
|
+
if node not in processed_nodes:
|
|
2549
|
+
if kwargs.get("warn", True):
|
|
2550
|
+
logger.debug("generation of calculate for node {}".format(node.get_name()))
|
|
2551
|
+
if (
|
|
2552
|
+
hasattr(node, "expression")
|
|
2553
|
+
and (node.expression is None)
|
|
2554
|
+
and issubclass(node.__class__, TriccNodeCalculateBase)
|
|
2555
|
+
):
|
|
2556
|
+
node.expression = get_node_expressions(
|
|
2557
|
+
node, processed_nodes, process=kwargs.get("process", "main ")
|
|
2558
|
+
)
|
|
2559
|
+
# continue walk
|
|
2560
|
+
if issubclass(
|
|
2561
|
+
node.__class__,
|
|
2562
|
+
(
|
|
2563
|
+
TriccNodeDisplayModel,
|
|
2564
|
+
TriccNodeDisplayCalculateBase,
|
|
2565
|
+
TriccNodeEnd,
|
|
2566
|
+
),
|
|
2567
|
+
):
|
|
2568
|
+
set_last_version_false(node, processed_nodes)
|
|
2569
|
+
return True
|
|
2570
|
+
|
|
2571
|
+
|
|
2572
|
+
def generate_base(node, processed_nodes, **kwargs):
|
|
2573
|
+
# Generate question for OpenMRS O3 schema
|
|
2574
|
+
# Handle activity nodes by processing their inner content
|
|
2575
|
+
# Check if node is ready to be processed (similar to XLS form strategy)
|
|
2576
|
+
if not is_ready_to_process(node, processed_nodes, strict=False):
|
|
2577
|
+
return False
|
|
2578
|
+
|
|
2579
|
+
# Process references to ensure dependencies are handled
|
|
2580
|
+
if not process_reference(
|
|
2581
|
+
node, processed_nodes, {}, replace_reference=False, codesystems=kwargs.get("codesystems", None)
|
|
2582
|
+
):
|
|
2583
|
+
return False
|
|
2584
|
+
if node not in processed_nodes:
|
|
2585
|
+
if issubclass(node.__class__, TriccRhombusMixIn) and isinstance(node.reference, str):
|
|
2586
|
+
logger.warning("node {} still using the reference string".format(node.get_name()))
|
|
2587
|
+
if issubclass(node.__class__, TriccNodeInputModel):
|
|
2588
|
+
# we don't overright if define in the diagram
|
|
2589
|
+
if node.constraint is None:
|
|
2590
|
+
if isinstance(node, TriccNodeSelectMultiple):
|
|
2591
|
+
node.constraint = or_join(
|
|
2592
|
+
[
|
|
2593
|
+
TriccOperation(
|
|
2594
|
+
TriccOperator.EQUAL,
|
|
2595
|
+
["$this", TriccStatic("opt_none")],
|
|
2596
|
+
),
|
|
2597
|
+
TriccOperation(
|
|
2598
|
+
TriccOperator.NOT,
|
|
2599
|
+
[
|
|
2600
|
+
TriccOperation(
|
|
2601
|
+
TriccOperator.SELECTED,
|
|
2602
|
+
["$this", TriccStatic("opt_none")],
|
|
2603
|
+
)
|
|
2604
|
+
],
|
|
2605
|
+
),
|
|
2606
|
+
]
|
|
2607
|
+
) # '.=\'opt_none\' or not(selected(.,\'opt_none\'))'
|
|
2608
|
+
node.constraint_message = "**None** cannot be selected together with choice."
|
|
2609
|
+
elif node.tricc_type in (
|
|
2610
|
+
TriccNodeType.integer,
|
|
2611
|
+
TriccNodeType.decimal,
|
|
2612
|
+
):
|
|
2613
|
+
constraints = []
|
|
2614
|
+
constraints_min = ""
|
|
2615
|
+
constraints_max = ""
|
|
2616
|
+
if node.min is not None and node.min != "":
|
|
2617
|
+
constraints.append(TriccOperation(TriccOperator.MORE_OR_EQUAL, ["$this", node.min]))
|
|
2618
|
+
constraints_min = "The minimun value is {0}.".format(node.min)
|
|
2619
|
+
if node.max is not None and node.max != "":
|
|
2620
|
+
constraints.append(TriccOperation(TriccOperator.LESS_OR_EQUAL, ["$this", node.max]))
|
|
2621
|
+
constraints_max = "The maximum value is {0}.".format(node.max)
|
|
2622
|
+
if len(constraints) > 1:
|
|
2623
|
+
node.constraint = TriccOperation(TriccOperator.AND, constraints)
|
|
2624
|
+
node.constraint_message = (constraints_min + " " + constraints_max).strip()
|
|
2625
|
+
elif len(constraints) == 1:
|
|
2626
|
+
node.constraint = constraints[0]
|
|
2627
|
+
node.constraint_message = (constraints_min + " " + constraints_max).strip()
|
|
2628
|
+
# continue walk
|
|
2629
|
+
return True
|
|
2630
|
+
return False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tricc-oo
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.24
|
|
4
4
|
Summary: Python library that converts CDSS L2 in L3
|
|
5
5
|
Project-URL: Homepage, https://github.com/SwissTPH/tricc
|
|
6
6
|
Project-URL: Issues, https://github.com/SwissTPH/tricc/issues
|
|
@@ -26,7 +26,130 @@ Requires-Dist: beautifulsoup4
|
|
|
26
26
|
Requires-Dist: ocldev
|
|
27
27
|
Dynamic: license-file
|
|
28
28
|
|
|
29
|
-
#
|
|
29
|
+
# TRICC-OO
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Strategy
|
|
33
|
+
|
|
34
|
+
### XLSFormStrategy
|
|
35
|
+
|
|
36
|
+
to use on OKD and clones,
|
|
37
|
+
|
|
38
|
+
### XLSFormCDSSStrategy
|
|
39
|
+
|
|
40
|
+
based on XLSFormStrategy
|
|
41
|
+
to use on OKD and clones,
|
|
42
|
+
support the CDSS specific behaviour such as Classification management
|
|
43
|
+
|
|
44
|
+
### XLSFormCHTStrategy
|
|
45
|
+
|
|
46
|
+
based on XLSFormCDSSStrategy
|
|
47
|
+
to use on medic CHT if the questionnaire is run Patient level
|
|
48
|
+
Support the inputs from patient
|
|
49
|
+
Support the extention libs
|
|
50
|
+
|
|
51
|
+
### XLSFormCHTHFStrategy
|
|
52
|
+
|
|
53
|
+
based on XLSFormCHTStrategy
|
|
54
|
+
to use on medic CHT if the questionnaire is run on Health facility level without selecting a patient
|
|
55
|
+
Support inputs from HF
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### OpenMRSStrategy
|
|
59
|
+
|
|
60
|
+
(under development)
|
|
61
|
+
|
|
62
|
+
### FhirStrategy
|
|
63
|
+
|
|
64
|
+
(UNTESTED)
|
|
65
|
+
|
|
66
|
+
### HTMLStrategy
|
|
67
|
+
|
|
68
|
+
(UNTESTED)
|
|
69
|
+
|
|
70
|
+
## start nodes
|
|
71
|
+
|
|
72
|
+
### Main start
|
|
73
|
+
|
|
74
|
+
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
|
|
75
|
+
|
|
76
|
+
here is the list of the CPG process, this will be the execution oder too:
|
|
77
|
+
- **registration**,
|
|
78
|
+
- **triage**,
|
|
79
|
+
- **emergency-care**,
|
|
80
|
+
- **local-urgent-care**,
|
|
81
|
+
- **actue-tertiary-care**,
|
|
82
|
+
- **history-and-physical**,
|
|
83
|
+
- **diagnostic-testing**,
|
|
84
|
+
- **determine-diagnosis**,
|
|
85
|
+
- **provide-counseling**,
|
|
86
|
+
- **dispense-medications**,
|
|
87
|
+
- **monitor-and-follow-up-of-patient**,
|
|
88
|
+
- **alerts-reminders-education**,
|
|
89
|
+
- **discharge-referral-of-patient**,
|
|
90
|
+
- **charge-for-service**,
|
|
91
|
+
- **record-and-report**
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# Note
|
|
97
|
+
|
|
98
|
+
## generation of the expressions
|
|
99
|
+
|
|
100
|
+
### add calcualte:
|
|
101
|
+
|
|
102
|
+
- Non or No in an egde will generate a negate node
|
|
103
|
+
- save adds a calcualte
|
|
104
|
+
- 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])
|
|
105
|
+
|
|
106
|
+
### for calculate
|
|
107
|
+
|
|
108
|
+
Then we calculate based on the previous nodes: [get_prev_node_expression]
|
|
109
|
+
- if a "fake" calculate (Rhombus, exclusion) then get the underlying expression (should not depend of Calcualte = true) [get_calculation_terms]
|
|
110
|
+
- if a Select, manage it as a calculate too (should not depend of Calcualte = true) [get_calculation_terms]
|
|
111
|
+
- else get the expression via [get_calculation_terms] [get_prev_node_expression , calculate = False] -> get_node_expression for the prev node
|
|
112
|
+
|
|
113
|
+
# Running directly
|
|
114
|
+
|
|
115
|
+
`tricc` is technically a python library, but you can run it directly via the [`build.py` script](./tests/build.py).
|
|
116
|
+
|
|
117
|
+
## Running with Docker
|
|
118
|
+
|
|
119
|
+
Alternatively, if you prefer to build/run the project with Docker, you can do the following.
|
|
120
|
+
|
|
121
|
+
Start by building the Docker image:
|
|
122
|
+
|
|
123
|
+
```shell
|
|
124
|
+
git clone https://github.com/SwissTPH/tricc.git
|
|
125
|
+
cd tricc
|
|
126
|
+
|
|
127
|
+
docker build -t tricc .
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
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.)
|
|
131
|
+
|
|
132
|
+
```shell
|
|
133
|
+
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc --help
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This command will convert all `.drawio` files in the current directory:
|
|
137
|
+
|
|
138
|
+
```shell
|
|
139
|
+
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
You can also convert a single file:
|
|
143
|
+
|
|
144
|
+
```shell
|
|
145
|
+
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj/demo.drawio -o /proj
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Use the `-O` flag to specify the output strategy. For example to generate CHT files:
|
|
149
|
+
|
|
150
|
+
```shell
|
|
151
|
+
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj -O XLSFormCHTStrategy
|
|
152
|
+
```
|
|
30
153
|
|
|
31
154
|
## Nodes
|
|
32
155
|
|
|
@@ -133,90 +256,8 @@ if not a calculate then relevance will be used unless it is "required" then cond
|
|
|
133
256
|
the Rhombus act as an AND between its imputs and its reference BUT it is an OR beween the inputs
|
|
134
257
|
(input1 OR input2 OR input3) AND reference
|
|
135
258
|
|
|
136
|
-
## start nodes
|
|
137
|
-
|
|
138
|
-
### Main start
|
|
139
|
-
|
|
140
|
-
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
|
|
141
|
-
|
|
142
|
-
here is the list of the CPG process, this will be the execution oder too:
|
|
143
|
-
- **registration**,
|
|
144
|
-
- **triage**,
|
|
145
|
-
- **emergency-care**,
|
|
146
|
-
- **local-urgent-care**,
|
|
147
|
-
- **actue-tertiary-care**,
|
|
148
|
-
- **history-and-physical**,
|
|
149
|
-
- **diagnostic-testing**,
|
|
150
|
-
- **determine-diagnosis**,
|
|
151
|
-
- **provide-counseling**,
|
|
152
|
-
- **dispense-medications**,
|
|
153
|
-
- **monitor-and-follow-up-of-patient**,
|
|
154
|
-
- **alerts-reminders-education**,
|
|
155
|
-
- **discharge-referral-of-patient**,
|
|
156
|
-
- **charge-for-service**,
|
|
157
|
-
- **record-and-report**
|
|
158
|
-
|
|
159
|
-
|
|
160
259
|
# READ Xressource
|
|
161
260
|
https://jgraph.github.io/drawio-tools/tools/convert.html
|
|
162
261
|
|
|
163
262
|
option can have only incoming edge from images to be placed as option$
|
|
164
263
|
|
|
165
|
-
|
|
166
|
-
# Note
|
|
167
|
-
|
|
168
|
-
## generation of the expressions
|
|
169
|
-
|
|
170
|
-
### add calcualte:
|
|
171
|
-
|
|
172
|
-
- Non or No in an egde will generate a negate node
|
|
173
|
-
- save adds a calcualte
|
|
174
|
-
- 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])
|
|
175
|
-
|
|
176
|
-
### for calculate
|
|
177
|
-
|
|
178
|
-
Then we calculate based on the previous nodes: [get_prev_node_expression]
|
|
179
|
-
- if a "fake" calculate (Rhombus, exclusion) then get the underlying expression (should not depend of Calcualte = true) [get_calculation_terms]
|
|
180
|
-
- if a Select, manage it as a calculate too (should not depend of Calcualte = true) [get_calculation_terms]
|
|
181
|
-
- else get the expression via [get_calculation_terms] [get_prev_node_expression , calculate = False] -> get_node_expression for the prev node
|
|
182
|
-
|
|
183
|
-
# Running directly
|
|
184
|
-
|
|
185
|
-
`tricc` is technically a python library, but you can run it directly via the [`build.py` script](./tests/build.py).
|
|
186
|
-
|
|
187
|
-
## Running with Docker
|
|
188
|
-
|
|
189
|
-
Alternatively, if you prefer to build/run the project with Docker, you can do the following.
|
|
190
|
-
|
|
191
|
-
Start by building the Docker image:
|
|
192
|
-
|
|
193
|
-
```shell
|
|
194
|
-
git clone https://github.com/SwissTPH/tricc.git
|
|
195
|
-
cd tricc
|
|
196
|
-
|
|
197
|
-
docker build -t tricc .
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
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.)
|
|
201
|
-
|
|
202
|
-
```shell
|
|
203
|
-
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc --help
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
This command will convert all `.drawio` files in the current directory:
|
|
207
|
-
|
|
208
|
-
```shell
|
|
209
|
-
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
You can also convert a single file:
|
|
213
|
-
|
|
214
|
-
```shell
|
|
215
|
-
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj/demo.drawio -o /proj
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
Use the `-O` flag to specify the output strategy. For example to generate CHT files:
|
|
219
|
-
|
|
220
|
-
```shell
|
|
221
|
-
docker run --rm -v "$PWD":/proj --user $(id -u):$(id -g) tricc -i /proj -o /proj -O XLSFormCHTStrategy
|
|
222
|
-
```
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
tests/build.py,sha256=
|
|
1
|
+
tests/build.py,sha256=hyfl88bkNdqSqp9U5TKm6jpH6YdKMrCAB29Yr8ZONVk,6559
|
|
2
2
|
tests/test_cql.py,sha256=R6rLrkw4587vvR38XwI3XnuTTYI1ft1XNmBPCxyOif4,5252
|
|
3
3
|
tests/to_ocl.py,sha256=4e-i65K3UM6wHgdVcrZcM9AyL1bahIsXJiZTXhhHgQk,2048
|
|
4
4
|
tricc_oo/__init__.py,sha256=oWCE1ubmC_6iqaWOMgTei4eXVQgV202Ia-tXS1NnW_4,139
|
|
5
5
|
tricc_oo/converters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
tricc_oo/converters/codesystem_to_ocl.py,sha256=Fh7Vk73OsxljZKu1k6H9uzYwz334tpQTMZBjWWbamYE,6151
|
|
7
7
|
tricc_oo/converters/cql_to_operation.py,sha256=PUyV_YpUY98Ox0H_F_CN3UUf_I-BhFZVOcWWKTtwecM,14492
|
|
8
|
-
tricc_oo/converters/datadictionnary.py,sha256=
|
|
8
|
+
tricc_oo/converters/datadictionnary.py,sha256=T2HLCBo4Am1p0kFqSH1r0PqbD8AC2IGuWkbvMvSCru0,3658
|
|
9
9
|
tricc_oo/converters/drawio_type_map.py,sha256=UCPiGs7Lw0bigKScmZUnmOhACBz-FiDq92jHkI7RTSQ,9113
|
|
10
10
|
tricc_oo/converters/tricc_to_xls_form.py,sha256=NwBOBy_tuEWd6d0ig9XzIm84dGDmRj-bATPB_D7HcHQ,1999
|
|
11
11
|
tricc_oo/converters/utils.py,sha256=Lc9oOgkuiAHA95rb9s-RCbguhPfkinNcsuwQ1cxKvSc,1675
|
|
@@ -20,7 +20,7 @@ tricc_oo/models/calculate.py,sha256=uNP0IDUqPQcJq9Co05H8eX5wbR_DikSxuOHxfVE5Dxg,
|
|
|
20
20
|
tricc_oo/models/lang.py,sha256=ZMRwdoPWe01wEDhOM0uRk-6rt3BkoAAZM8mZ61--s3A,2265
|
|
21
21
|
tricc_oo/models/ocl.py,sha256=MybSeB6fgCOUVJ4aektff0vrrTZsyfwZ2Gt_pPBu_FY,8728
|
|
22
22
|
tricc_oo/models/ordered_set.py,sha256=BpXLW8plRAy4te25PIUPvVXPnLPcypvKg3iNPhtPulA,3833
|
|
23
|
-
tricc_oo/models/tricc.py,sha256=
|
|
23
|
+
tricc_oo/models/tricc.py,sha256=R7MtjoTJXc3gtL4sZmFdobcxaWfh4pdVyP_2g-3uMPs,17421
|
|
24
24
|
tricc_oo/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
tricc_oo/parsers/xml.py,sha256=uzkb1y18MHfqVFmZqVh0sKT4cx6u0-NcAT_lV_gHBt8,4208
|
|
26
26
|
tricc_oo/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -29,19 +29,22 @@ tricc_oo/serializers/xls_form.py,sha256=iPF-Is8EAGkgwi-I_1Opxr59KM1mhw0kihO9b2KY
|
|
|
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=BEODXS74na1QRRcJVQ4cxiD8F7uRqaLyhE3QzKpGVvk,3891
|
|
32
|
-
tricc_oo/strategies/input/drawio.py,sha256=
|
|
33
|
-
tricc_oo/strategies/output/base_output_strategy.py,sha256
|
|
32
|
+
tricc_oo/strategies/input/drawio.py,sha256=uXAUPhXOeg0Uk_BNqlCqFBW4cWNox4VfH559bj1fhC0,12767
|
|
33
|
+
tricc_oo/strategies/output/base_output_strategy.py,sha256=M9UFR67-_CFoW681bPAeBS1OUGuFtmUbM_rltACI0hk,8798
|
|
34
|
+
tricc_oo/strategies/output/fhir_form.py,sha256=hbL921pe1Doun4IQrJuZ_Sq2fCh98G3grYie5olC4uc,15740
|
|
35
|
+
tricc_oo/strategies/output/html_form.py,sha256=qSleEZOMV_-Z04y-i-ucyd5rgAYWAyjPwMrw0IHtCRM,8604
|
|
36
|
+
tricc_oo/strategies/output/openmrs_form.py,sha256=I0K6hc-ffodnSPJQa3Dr6FbsRVlJw6EfbHge8GawC5U,27190
|
|
34
37
|
tricc_oo/strategies/output/spice.py,sha256=QMeoismVC3PdbvwTK0PtUjWX9jl9780fbQIXn76fMXw,10761
|
|
35
|
-
tricc_oo/strategies/output/xls_form.py,sha256=
|
|
38
|
+
tricc_oo/strategies/output/xls_form.py,sha256=ofEg6oZlhEytfdLRRWqQKCaewDIKedZ-uVpQl9OiyYw,29787
|
|
36
39
|
tricc_oo/strategies/output/xlsform_cdss.py,sha256=X00Lt5MzV8TX14dR4dFI1MqllI5S1e13bKbeysWM9uA,17435
|
|
37
|
-
tricc_oo/strategies/output/xlsform_cht.py,sha256=
|
|
40
|
+
tricc_oo/strategies/output/xlsform_cht.py,sha256=jXrgUxs8aKiEE3o7ujABcFqPs12AHrG6HAtOsaNoXgA,22966
|
|
38
41
|
tricc_oo/strategies/output/xlsform_cht_hf.py,sha256=xm6SKirV3nMZvM2w54_zJcXAeAgAkq-EEqGEjnOWv6c,988
|
|
39
42
|
tricc_oo/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
tricc_oo/visitors/tricc.py,sha256=
|
|
43
|
+
tricc_oo/visitors/tricc.py,sha256=Ndg5tnOH3JXYDSlxJwa2FgPVnPeJE4YWmOOFW-FcULQ,107105
|
|
41
44
|
tricc_oo/visitors/utils.py,sha256=j83aAq5s5atXi3OC0jc_uJd54a8XrHHmizeeEbWZQJg,421
|
|
42
45
|
tricc_oo/visitors/xform_pd.py,sha256=ryAnI3V9x3eTmJ2LNsUZfvl0_yfCqo6oBgeSu-WPqaE,9613
|
|
43
|
-
tricc_oo-1.5.
|
|
44
|
-
tricc_oo-1.5.
|
|
45
|
-
tricc_oo-1.5.
|
|
46
|
-
tricc_oo-1.5.
|
|
47
|
-
tricc_oo-1.5.
|
|
46
|
+
tricc_oo-1.5.24.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
|
|
47
|
+
tricc_oo-1.5.24.dist-info/METADATA,sha256=PWTak1ccZ0K_e4CZUOUgw51JHJ8gMQmr7cKiOwhqAys,8577
|
|
48
|
+
tricc_oo-1.5.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
49
|
+
tricc_oo-1.5.24.dist-info/top_level.txt,sha256=NvbfMNAiy9m4b1unBsqpeOQWh4IgA1Xa33BtKA4abxk,15
|
|
50
|
+
tricc_oo-1.5.24.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|