tricc-oo 1.5.22__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 +17 -23
- tests/test_cql.py +37 -108
- tests/to_ocl.py +15 -17
- tricc_oo/__init__.py +0 -6
- tricc_oo/converters/codesystem_to_ocl.py +51 -40
- tricc_oo/converters/cql/cqlLexer.py +1 -0
- tricc_oo/converters/cql/cqlListener.py +1 -0
- tricc_oo/converters/cql/cqlParser.py +1 -0
- tricc_oo/converters/cql/cqlVisitor.py +1 -0
- tricc_oo/converters/cql_to_operation.py +125 -123
- tricc_oo/converters/datadictionnary.py +45 -54
- tricc_oo/converters/drawio_type_map.py +143 -61
- tricc_oo/converters/tricc_to_xls_form.py +14 -24
- tricc_oo/converters/utils.py +3 -3
- tricc_oo/converters/xml_to_tricc.py +286 -231
- tricc_oo/models/__init__.py +2 -1
- tricc_oo/models/base.py +300 -308
- tricc_oo/models/calculate.py +63 -49
- tricc_oo/models/lang.py +26 -27
- tricc_oo/models/ocl.py +146 -161
- tricc_oo/models/ordered_set.py +15 -19
- tricc_oo/models/tricc.py +145 -89
- tricc_oo/parsers/xml.py +15 -30
- tricc_oo/serializers/planuml.py +4 -6
- tricc_oo/serializers/xls_form.py +81 -135
- tricc_oo/strategies/input/base_input_strategy.py +28 -32
- tricc_oo/strategies/input/drawio.py +59 -71
- tricc_oo/strategies/output/base_output_strategy.py +142 -67
- 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/spice.py +106 -127
- tricc_oo/strategies/output/xls_form.py +263 -222
- tricc_oo/strategies/output/xlsform_cdss.py +623 -142
- tricc_oo/strategies/output/xlsform_cht.py +108 -115
- tricc_oo/strategies/output/xlsform_cht_hf.py +13 -24
- tricc_oo/visitors/tricc.py +1297 -1016
- tricc_oo/visitors/utils.py +16 -16
- tricc_oo/visitors/xform_pd.py +91 -89
- {tricc_oo-1.5.22.dist-info → tricc_oo-1.5.24.dist-info}/METADATA +127 -84
- tricc_oo-1.5.24.dist-info/RECORD +50 -0
- tricc_oo-1.5.24.dist-info/licenses/LICENSE +373 -0
- tricc_oo-1.5.22.dist-info/RECORD +0 -46
- {tricc_oo-1.5.22.dist-info → tricc_oo-1.5.24.dist-info}/WHEEL +0 -0
- {tricc_oo-1.5.22.dist-info → tricc_oo-1.5.24.dist-info}/top_level.txt +0 -0
|
@@ -2,7 +2,6 @@ import datetime
|
|
|
2
2
|
import logging
|
|
3
3
|
import os
|
|
4
4
|
import shutil
|
|
5
|
-
import re
|
|
6
5
|
import pandas as pd
|
|
7
6
|
|
|
8
7
|
from tricc_oo.models.lang import SingletonLangClass
|
|
@@ -24,24 +23,24 @@ logger = logging.getLogger("default")
|
|
|
24
23
|
|
|
25
24
|
class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
26
25
|
def process_export(self, start_pages, **kwargs):
|
|
27
|
-
diags = []
|
|
28
26
|
self.activity_export(start_pages[self.processes[0]], **kwargs)
|
|
29
27
|
# self.add_tab_breaks_choice()
|
|
30
|
-
cht_header = pd.DataFrame(columns=SURVEY_MAP.keys())
|
|
31
28
|
cht_input_df = self.get_cht_input(start_pages, **kwargs)
|
|
32
|
-
self.df_survey = self.df_survey[
|
|
33
|
-
~self.df_survey["name"].isin(cht_input_df["name"])
|
|
34
|
-
]
|
|
29
|
+
self.df_survey = self.df_survey[~self.df_survey["name"].isin(cht_input_df["name"])]
|
|
35
30
|
self.df_survey.reset_index(drop=True, inplace=True)
|
|
36
31
|
|
|
37
|
-
self.df_survey = pd.concat(
|
|
38
|
-
|
|
39
|
-
)
|
|
32
|
+
self.df_survey = pd.concat([cht_input_df, self.df_survey, self.get_cht_summary()], ignore_index=True)
|
|
33
|
+
|
|
34
|
+
self.inject_version()
|
|
35
|
+
|
|
40
36
|
|
|
41
37
|
def get_cht_input(self, start_pages, **kwargs):
|
|
42
38
|
empty = langs.get_trads("", force_dict=True)
|
|
43
39
|
df_input = pd.DataFrame(columns=SURVEY_MAP.keys())
|
|
44
|
-
# [ #type, '',#name ''#label, '',#hint '',#help '',#default '',#'appearance',
|
|
40
|
+
# [ #type, '',#name ''#label, '',#hint '',#help '',#default '',#'appearance',
|
|
41
|
+
# '',#'constraint', '',#'constraint_message' '',#'relevance' '',#'disabled'
|
|
42
|
+
# '',#'required' '',#'required message' '',#'read only' '',#'expression' '',#
|
|
43
|
+
# 'repeat_count' ''#'image' ],
|
|
45
44
|
df_input.loc[len(df_input)] = [
|
|
46
45
|
"begin_group",
|
|
47
46
|
"inputs",
|
|
@@ -235,7 +234,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
235
234
|
inputs = self.export_inputs(start_pages[self.processes[0]], **kwargs)
|
|
236
235
|
for input in inputs:
|
|
237
236
|
df_input.loc[len(df_input)] = get_input_line(input)
|
|
238
|
-
self.get_contact_inputs(df_input)
|
|
237
|
+
self.get_contact_inputs(df_input)
|
|
239
238
|
df_input.loc[len(df_input)] = [
|
|
240
239
|
"hidden",
|
|
241
240
|
"external_id",
|
|
@@ -301,8 +300,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
301
300
|
"",
|
|
302
301
|
"",
|
|
303
302
|
]
|
|
304
|
-
|
|
305
|
-
|
|
306
303
|
|
|
307
304
|
df_input.loc[len(df_input)] = [
|
|
308
305
|
"end_group",
|
|
@@ -325,7 +322,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
325
322
|
"",
|
|
326
323
|
"",
|
|
327
324
|
]
|
|
328
|
-
|
|
325
|
+
|
|
329
326
|
df_input.loc[len(df_input)] = [
|
|
330
327
|
"hidden",
|
|
331
328
|
"data_load",
|
|
@@ -355,18 +352,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
355
352
|
*list(empty.values()), # hint
|
|
356
353
|
*list(empty.values()), # help
|
|
357
354
|
"", # default
|
|
358
|
-
"", #'appearance', clean_name
|
|
359
|
-
"", #'constraint',
|
|
360
|
-
*list(empty.values()), #'constraint_message'
|
|
361
|
-
"", #'relevance'
|
|
362
|
-
"", #'disabled'
|
|
363
|
-
"", #'required'
|
|
364
|
-
*list(empty.values()), #'required message'
|
|
365
|
-
"", #'read only'
|
|
366
|
-
"../inputs/user/contact_id", #'expression'
|
|
367
|
-
"",
|
|
368
|
-
"", #'repeat_count'
|
|
369
|
-
"", #'image'
|
|
355
|
+
"", # 'appearance', clean_name
|
|
356
|
+
"", # 'constraint',
|
|
357
|
+
*list(empty.values()), # 'constraint_message'
|
|
358
|
+
"", # 'relevance'
|
|
359
|
+
"", # 'disabled'
|
|
360
|
+
"", # 'required'
|
|
361
|
+
*list(empty.values()), # 'required message'
|
|
362
|
+
"", # 'read only'
|
|
363
|
+
"../inputs/user/contact_id", # 'expression'
|
|
364
|
+
"",
|
|
365
|
+
"", # 'repeat_count'
|
|
366
|
+
"", # 'image'
|
|
370
367
|
"", # choice filter
|
|
371
368
|
]
|
|
372
369
|
df_input.loc[len(df_input)] = [
|
|
@@ -376,18 +373,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
376
373
|
*list(empty.values()), # hint
|
|
377
374
|
*list(empty.values()), # help
|
|
378
375
|
"", # default
|
|
379
|
-
"", #'appearance', clean_name
|
|
380
|
-
"", #'constraint',
|
|
381
|
-
*list(empty.values()), #'constraint_message'
|
|
382
|
-
"", #'relevance'
|
|
383
|
-
"", #'disabled'
|
|
384
|
-
"", #'required'
|
|
385
|
-
*list(empty.values()), #'required message'
|
|
386
|
-
"", #'read only'
|
|
387
|
-
"../inputs/user/facility_id", #'expression'
|
|
388
|
-
"",
|
|
389
|
-
"", #'repeat_count'
|
|
390
|
-
"", #'image'
|
|
376
|
+
"", # 'appearance', clean_name
|
|
377
|
+
"", # 'constraint',
|
|
378
|
+
*list(empty.values()), # 'constraint_message'
|
|
379
|
+
"", # 'relevance'
|
|
380
|
+
"", # 'disabled'
|
|
381
|
+
"", # 'required'
|
|
382
|
+
*list(empty.values()), # 'required message'
|
|
383
|
+
"", # 'read only'
|
|
384
|
+
"../inputs/user/facility_id", # 'expression'
|
|
385
|
+
"",
|
|
386
|
+
"", # 'repeat_count'
|
|
387
|
+
"", # 'image'
|
|
391
388
|
"", # choice filter
|
|
392
389
|
]
|
|
393
390
|
df_input.loc[len(df_input)] = [
|
|
@@ -397,18 +394,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
397
394
|
*list(empty.values()), # hint
|
|
398
395
|
*list(empty.values()), # help
|
|
399
396
|
"", # default
|
|
400
|
-
"", #'appearance', clean_name
|
|
401
|
-
"", #'constraint',
|
|
402
|
-
*list(empty.values()), #'constraint_message'
|
|
403
|
-
"", #'relevance'
|
|
404
|
-
"", #'disabled'
|
|
405
|
-
"", #'required'
|
|
406
|
-
*list(empty.values()), #'required message'
|
|
407
|
-
"", #'read only'
|
|
408
|
-
"../inputs/user/name", #'expression'
|
|
409
|
-
"",
|
|
410
|
-
"", #'repeat_count'
|
|
411
|
-
"", #'image'
|
|
397
|
+
"", # 'appearance', clean_name
|
|
398
|
+
"", # 'constraint',
|
|
399
|
+
*list(empty.values()), # 'constraint_message'
|
|
400
|
+
"", # 'relevance'
|
|
401
|
+
"", # 'disabled'
|
|
402
|
+
"", # 'required'
|
|
403
|
+
*list(empty.values()), # 'required message'
|
|
404
|
+
"", # 'read only'
|
|
405
|
+
"../inputs/user/name", # 'expression'
|
|
406
|
+
"",
|
|
407
|
+
"", # 'repeat_count'
|
|
408
|
+
"", # 'image'
|
|
412
409
|
"", # choice filter
|
|
413
410
|
]
|
|
414
411
|
df_input.loc[len(df_input)] = [
|
|
@@ -418,18 +415,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
418
415
|
*list(empty.values()), # hint
|
|
419
416
|
*list(empty.values()), # help
|
|
420
417
|
"", # default
|
|
421
|
-
"", #'appearance', clean_name
|
|
422
|
-
"", #'constraint',
|
|
423
|
-
*list(empty.values()), #'constraint_message'
|
|
424
|
-
"", #'relevance'
|
|
425
|
-
"", #'disabled'
|
|
426
|
-
"", #'required'
|
|
427
|
-
*list(empty.values()), #'required message'
|
|
428
|
-
"", #'read only'
|
|
429
|
-
"../inputs/contact/_id", #'expression'
|
|
430
|
-
"",
|
|
431
|
-
"", #'repeat_count'
|
|
432
|
-
"", #'image'
|
|
418
|
+
"", # 'appearance', clean_name
|
|
419
|
+
"", # 'constraint',
|
|
420
|
+
*list(empty.values()), # 'constraint_message'
|
|
421
|
+
"", # 'relevance'
|
|
422
|
+
"", # 'disabled'
|
|
423
|
+
"", # 'required'
|
|
424
|
+
*list(empty.values()), # 'required message'
|
|
425
|
+
"", # 'read only'
|
|
426
|
+
"../inputs/contact/_id", # 'expression'
|
|
427
|
+
"",
|
|
428
|
+
"", # 'repeat_count'
|
|
429
|
+
"", # 'image'
|
|
433
430
|
"", # choice filter
|
|
434
431
|
]
|
|
435
432
|
|
|
@@ -440,18 +437,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
440
437
|
*list(empty.values()), # hint
|
|
441
438
|
*list(empty.values()), # help
|
|
442
439
|
"", # default
|
|
443
|
-
"", #'appearance', clean_name
|
|
444
|
-
"", #'constraint',
|
|
445
|
-
*list(empty.values()), #'constraint_message'
|
|
446
|
-
"", #'relevance'
|
|
447
|
-
"", #'disabled'
|
|
448
|
-
"", #'required'
|
|
449
|
-
*list(empty.values()), #'required message'
|
|
450
|
-
"", #'read only'
|
|
451
|
-
"../inputs/source_id", #'expression'
|
|
452
|
-
"",
|
|
453
|
-
"", #'repeat_count'
|
|
454
|
-
"", #'image'
|
|
440
|
+
"", # 'appearance', clean_name
|
|
441
|
+
"", # 'constraint',
|
|
442
|
+
*list(empty.values()), # 'constraint_message'
|
|
443
|
+
"", # 'relevance'
|
|
444
|
+
"", # 'disabled'
|
|
445
|
+
"", # 'required'
|
|
446
|
+
*list(empty.values()), # 'required message'
|
|
447
|
+
"", # 'read only'
|
|
448
|
+
"../inputs/source_id", # 'expression'
|
|
449
|
+
"",
|
|
450
|
+
"", # 'repeat_count'
|
|
451
|
+
"", # 'image'
|
|
455
452
|
"", # choice filter
|
|
456
453
|
]
|
|
457
454
|
df_input.loc[len(df_input)] = [
|
|
@@ -461,21 +458,20 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
461
458
|
*list(empty.values()), # hint
|
|
462
459
|
*list(empty.values()), # help
|
|
463
460
|
"", # default
|
|
464
|
-
"", #'appearance', clean_name
|
|
465
|
-
"", #'constraint',
|
|
466
|
-
*list(empty.values()), #'constraint_message'
|
|
467
|
-
"", #'relevance'
|
|
468
|
-
"", #'disabled'
|
|
469
|
-
"", #'required'
|
|
470
|
-
*list(empty.values()), #'required message'
|
|
471
|
-
"", #'read only'
|
|
472
|
-
"../inputs/user/facility_id", #'expression'
|
|
473
|
-
"",
|
|
474
|
-
"", #'repeat_count'
|
|
475
|
-
"", #'image'
|
|
461
|
+
"", # 'appearance', clean_name
|
|
462
|
+
"", # 'constraint',
|
|
463
|
+
*list(empty.values()), # 'constraint_message'
|
|
464
|
+
"", # 'relevance'
|
|
465
|
+
"", # 'disabled'
|
|
466
|
+
"", # 'required'
|
|
467
|
+
*list(empty.values()), # 'required message'
|
|
468
|
+
"", # 'read only'
|
|
469
|
+
"../inputs/user/facility_id", # 'expression'
|
|
470
|
+
"",
|
|
471
|
+
"", # 'repeat_count'
|
|
472
|
+
"", # 'image'
|
|
476
473
|
"", # choice filter
|
|
477
474
|
]
|
|
478
|
-
|
|
479
475
|
|
|
480
476
|
for input in inputs:
|
|
481
477
|
df_input.loc[len(df_input)] = get_input_calc_line(input)
|
|
@@ -484,7 +480,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
484
480
|
|
|
485
481
|
def get_contact_inputs(self, df_input):
|
|
486
482
|
empty = langs.get_trads("", force_dict=True)
|
|
487
|
-
if not len(df_input[df_input[
|
|
483
|
+
if not len(df_input[df_input["name"] == "sex"]):
|
|
488
484
|
df_input.loc[len(df_input)] = [
|
|
489
485
|
"hidden",
|
|
490
486
|
"sex",
|
|
@@ -506,7 +502,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
506
502
|
"",
|
|
507
503
|
"",
|
|
508
504
|
]
|
|
509
|
-
if not len(df_input[df_input[
|
|
505
|
+
if not len(df_input[df_input["name"] == "date_of_birth"]):
|
|
510
506
|
df_input.loc[len(df_input)] = [
|
|
511
507
|
"hidden",
|
|
512
508
|
"date_of_birth",
|
|
@@ -531,7 +527,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
531
527
|
|
|
532
528
|
return df_input
|
|
533
529
|
|
|
534
|
-
|
|
535
530
|
def get_contact_inputs_calculate(self, df_input):
|
|
536
531
|
empty = langs.get_trads("", force_dict=True)
|
|
537
532
|
df_input.loc[len(df_input)] = [
|
|
@@ -581,12 +576,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
581
576
|
|
|
582
577
|
def get_cht_summary(self):
|
|
583
578
|
df_summary = pd.DataFrame(columns=SURVEY_MAP.keys())
|
|
584
|
-
# [ #type, '',#name ''#label, '',#hint '',#help '',#default '',#'appearance', '',#'constraint', '',#'constraint_message' '',#'relevance' '',#'disabled' '',#'required' '',#'required message' '',#'read only' '',#'expression' '',#'repeat_count' ''#'image' ],
|
|
585
|
-
# df_summary.loc[len(df_summary)] = [ 'begin group', 'group_summary' , 'Summary', '', '', '', 'field-list summary', '', '', '', '', '', '', '', '', '', '' ]
|
|
586
|
-
# df_summary.loc[len(df_summary)] = [ 'note', 'r_patient_info', '**${patient_name}** ID: ${patient_id}', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ]
|
|
587
|
-
# df_summary.loc[len(df_summary)] = [ 'note', 'r_followup', 'Follow Up <i class=“fa fa-flag”></i>', '', '', '', '', '', '','', '', '', '', '', '', '', '' ]
|
|
588
|
-
# df_summary.loc[len(df_summary)] = [ 'note', 'r_followup_note' ,'FOLLOWUP instruction', '', '', '', '', '', '', '','', '', '', '', '', '', '' ]
|
|
589
|
-
# df_summary.loc[len(df_summary)] = [ 'end group', '' ,'', '', '', '', '', '', '', '', '', '', '', '', '','', '' ]
|
|
590
579
|
return df_summary
|
|
591
580
|
|
|
592
581
|
def get_last_prev_index(self, df, e, depth=0):
|
|
@@ -601,7 +590,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
601
590
|
latest = index[-1]
|
|
602
591
|
if latest is None and depth > 5:
|
|
603
592
|
for p in e.prev_nodes:
|
|
604
|
-
index = get_last_prev_index(df, e, depth + 1)
|
|
593
|
+
index = self.get_last_prev_index(df, e, depth + 1)
|
|
605
594
|
if not latest and index and index > latest:
|
|
606
595
|
latest = index
|
|
607
596
|
return latest
|
|
@@ -634,10 +623,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
634
623
|
}
|
|
635
624
|
df_settings = pd.DataFrame(settings, index=indx)
|
|
636
625
|
df_settings.head()
|
|
637
|
-
if len(self.df_survey[self.df_survey["name"] == "version"]):
|
|
638
|
-
self.df_survey.loc[self.df_survey["name"] == "version", "label"] = (
|
|
639
|
-
f"v{version}"
|
|
640
|
-
)
|
|
641
626
|
# create a Pandas Excel writer using XlsxWriter as the engine
|
|
642
627
|
writer = pd.ExcelWriter(newpath, engine="xlsxwriter")
|
|
643
628
|
self.df_survey.to_excel(writer, sheet_name="survey", index=False)
|
|
@@ -649,8 +634,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
649
634
|
for p in self.project.pages.values():
|
|
650
635
|
p_ends = list(
|
|
651
636
|
filter(
|
|
652
|
-
lambda x: issubclass(x.__class__, TriccNodeEnd)
|
|
653
|
-
and getattr(x, "process", "") == "pause",
|
|
637
|
+
lambda x: issubclass(x.__class__, TriccNodeEnd) and getattr(x, "process", "") == "pause",
|
|
654
638
|
p.nodes.values(),
|
|
655
639
|
)
|
|
656
640
|
)
|
|
@@ -668,9 +652,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
668
652
|
)
|
|
669
653
|
)
|
|
670
654
|
else:
|
|
671
|
-
logger.critical(
|
|
672
|
-
f"impossible to get last index before pause: {e.get_name()}"
|
|
673
|
-
)
|
|
655
|
+
logger.critical(f"impossible to get last index before pause: {e.get_name()}")
|
|
674
656
|
forms = [form_id]
|
|
675
657
|
for i, e in ends_prev:
|
|
676
658
|
new_form_id = f"{form_id}_{clean_name(e.name)}"
|
|
@@ -685,9 +667,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
685
667
|
}
|
|
686
668
|
df_settings = pd.DataFrame(settings, index=indx)
|
|
687
669
|
df_settings.head()
|
|
688
|
-
task_df, hidden_names = make_breakpoints(
|
|
689
|
-
self.df_survey, i, e.name, replace_dots=True
|
|
690
|
-
)
|
|
670
|
+
task_df, hidden_names = make_breakpoints(self.df_survey, i, e.name, replace_dots=True)
|
|
691
671
|
# deactivate the end node
|
|
692
672
|
task_df.loc[task_df["name"] == get_export_name(e), "calculation"] = 0
|
|
693
673
|
# print fileds
|
|
@@ -716,9 +696,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
716
696
|
|
|
717
697
|
media_path_tmp = os.path.join(self.output_path, "media-tmp")
|
|
718
698
|
if os.path.isdir(media_path_tmp):
|
|
719
|
-
if os.path.isdir(
|
|
720
|
-
media_path
|
|
721
|
-
): # check if it exists, because if it does, error will be raised
|
|
699
|
+
if os.path.isdir(media_path): # check if it exists, because if it does, error will be raised
|
|
722
700
|
shutil.rmtree(media_path)
|
|
723
701
|
# (later change to make folder complaint to CHT)
|
|
724
702
|
os.mkdir(media_path)
|
|
@@ -731,16 +709,31 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
731
709
|
def tricc_operation_zscore(self, ref_expressions):
|
|
732
710
|
y, ll, m, s = self.get_zscore_params(ref_expressions)
|
|
733
711
|
# return ((Math.pow((y / m), l) - 1) / (s * l));
|
|
734
|
-
return f"cht:extension-lib('{
|
|
712
|
+
return f"""cht:extension-lib('{
|
|
713
|
+
ref_expressions[0][1:-1]
|
|
714
|
+
}.js',{
|
|
715
|
+
self.clean_coalesce(ref_expressions[1])
|
|
716
|
+
} ,{
|
|
717
|
+
self.clean_coalesce(ref_expressions[2])
|
|
718
|
+
} ,{
|
|
719
|
+
self.clean_coalesce(ref_expressions[3])
|
|
720
|
+
})"""
|
|
735
721
|
|
|
736
722
|
def tricc_operation_izscore(self, ref_expressions):
|
|
737
723
|
z, ll, m, s = self.get_zscore_params(ref_expressions)
|
|
738
724
|
# return (m * (z*s*l-1)^(1/l));
|
|
739
|
-
return f"cht:extension-lib('{
|
|
725
|
+
return f"""cht:extension-lib('{
|
|
726
|
+
ref_expressions[0][1:-1]
|
|
727
|
+
}.js',{
|
|
728
|
+
self.clean_coalesce(ref_expressions[1])
|
|
729
|
+
} ,{
|
|
730
|
+
self.clean_coalesce(ref_expressions[2])
|
|
731
|
+
} ,{
|
|
732
|
+
self.clean_coalesce(ref_expressions[3])
|
|
733
|
+
}, true)"""
|
|
740
734
|
|
|
741
735
|
def tricc_operation_drug_dosage(self, ref_expressions):
|
|
742
736
|
# drug name
|
|
743
737
|
# age
|
|
744
738
|
# weight
|
|
745
739
|
return f"cht:extension-lib('drugs.js',{','.join(map(self.clean_coalesce, ref_expressions))})"
|
|
746
|
-
|
|
@@ -1,46 +1,35 @@
|
|
|
1
|
-
import datetime
|
|
2
1
|
import logging
|
|
3
|
-
import os
|
|
4
|
-
import shutil
|
|
5
2
|
|
|
6
3
|
import pandas as pd
|
|
7
4
|
|
|
8
5
|
from tricc_oo.models.lang import SingletonLangClass
|
|
9
|
-
from tricc_oo.serializers.xls_form import
|
|
6
|
+
from tricc_oo.serializers.xls_form import (
|
|
7
|
+
SURVEY_MAP,
|
|
8
|
+
)
|
|
10
9
|
from tricc_oo.strategies.output.xlsform_cht import XLSFormCHTStrategy
|
|
11
|
-
from tricc_oo.visitors.xform_pd import make_breakpoints, get_tasksstrings
|
|
12
10
|
|
|
13
11
|
langs = SingletonLangClass()
|
|
14
12
|
logger = logging.getLogger("default")
|
|
15
13
|
|
|
14
|
+
|
|
16
15
|
class XLSFormCHTHFStrategy(XLSFormCHTStrategy):
|
|
17
16
|
|
|
18
|
-
|
|
19
17
|
def get_contact_inputs(self, df_inputs):
|
|
20
|
-
|
|
18
|
+
return None
|
|
21
19
|
|
|
22
20
|
def get_contact_inputs_calculate(self, df_inputs):
|
|
23
21
|
return None
|
|
24
|
-
|
|
22
|
+
|
|
25
23
|
def get_cht_summary(self):
|
|
26
|
-
|
|
24
|
+
|
|
27
25
|
df_summary = pd.DataFrame(columns=SURVEY_MAP.keys())
|
|
28
|
-
#[ #type, '',#name ''#label, '',#hint '',#help '',#default '',#'appearance', '',#'constraint', '',#'constraint_message' '',#'relevance' '',#'disabled' '',#'required' '',#'required message' '',#'read only' '',#'expression' '',#'repeat_count' ''#'image' ],
|
|
29
|
-
#df_summary.loc[len(df_summary)] = [ 'begin_group', 'group_summary' , 'Summary', '', '', '', 'field-list summary', '', '', '', '', '', '', '', '', '', '' ]
|
|
30
|
-
#df_summary.loc[len(df_summary)] = [ 'note', 'r_patient_info', '**${patient_name}** ID: ${patient_id}', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ]
|
|
31
|
-
#df_summary.loc[len(df_summary)] = [ 'note', 'r_followup', 'Follow Up <i class=“fa fa-flag”></i>', '', '', '', '', '', '','', '', '', '', '', '', '', '' ]
|
|
32
|
-
#df_summary.loc[len(df_summary)] = [ 'note', 'r_followup_note' ,'FOLLOWUP instruction', '', '', '', '', '', '', '','', '', '', '', '', '', '' ]
|
|
33
|
-
#df_summary.loc[len(df_summary)] = [ 'end_group', '' ,'', '', '', '', '', '', '', '', '', '', '', '', '','', '' ]
|
|
34
26
|
return df_summary
|
|
35
|
-
|
|
27
|
+
|
|
36
28
|
def tricc_operation_age_day(self, exps):
|
|
37
|
-
raise
|
|
38
|
-
|
|
29
|
+
raise NotImplementedError("AgeInDays Not compatible with this strategy")
|
|
30
|
+
|
|
39
31
|
def tricc_operation_age_year(self, exps):
|
|
40
|
-
raise
|
|
41
|
-
|
|
42
|
-
def tricc_operation_age_month(self, exps):
|
|
43
|
-
raise NotImplemented("AgeInMonths Not compatible with this strategy")
|
|
32
|
+
raise NotImplementedError("AgeInYears Not compatible with this strategy")
|
|
44
33
|
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
def tricc_operation_age_month(self, exps):
|
|
35
|
+
raise NotImplementedError("AgeInMonths Not compatible with this strategy")
|