tricc-oo 1.5.22__py3-none-any.whl → 1.5.23__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 +13 -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 +39 -53
- 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 +144 -88
- 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 +57 -69
- tricc_oo/strategies/output/base_output_strategy.py +108 -67
- tricc_oo/strategies/output/spice.py +106 -127
- tricc_oo/strategies/output/xls_form.py +275 -200
- tricc_oo/strategies/output/xlsform_cdss.py +623 -142
- tricc_oo/strategies/output/xlsform_cht.py +106 -114
- tricc_oo/strategies/output/xlsform_cht_hf.py +13 -24
- tricc_oo/visitors/tricc.py +1191 -1021
- 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.23.dist-info}/METADATA +3 -1
- tricc_oo-1.5.23.dist-info/RECORD +47 -0
- tricc_oo-1.5.23.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.23.dist-info}/WHEEL +0 -0
- {tricc_oo-1.5.22.dist-info → tricc_oo-1.5.23.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,21 @@ 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
|
-
[cht_input_df, self.df_survey, self.get_cht_summary()], ignore_index=True
|
|
39
|
-
)
|
|
32
|
+
self.df_survey = pd.concat([cht_input_df, self.df_survey, self.get_cht_summary()], ignore_index=True)
|
|
40
33
|
|
|
41
34
|
def get_cht_input(self, start_pages, **kwargs):
|
|
42
35
|
empty = langs.get_trads("", force_dict=True)
|
|
43
36
|
df_input = pd.DataFrame(columns=SURVEY_MAP.keys())
|
|
44
|
-
# [ #type, '',#name ''#label, '',#hint '',#help '',#default '',#'appearance',
|
|
37
|
+
# [ #type, '',#name ''#label, '',#hint '',#help '',#default '',#'appearance',
|
|
38
|
+
# '',#'constraint', '',#'constraint_message' '',#'relevance' '',#'disabled'
|
|
39
|
+
# '',#'required' '',#'required message' '',#'read only' '',#'expression' '',#
|
|
40
|
+
# 'repeat_count' ''#'image' ],
|
|
45
41
|
df_input.loc[len(df_input)] = [
|
|
46
42
|
"begin_group",
|
|
47
43
|
"inputs",
|
|
@@ -235,7 +231,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
235
231
|
inputs = self.export_inputs(start_pages[self.processes[0]], **kwargs)
|
|
236
232
|
for input in inputs:
|
|
237
233
|
df_input.loc[len(df_input)] = get_input_line(input)
|
|
238
|
-
self.get_contact_inputs(df_input)
|
|
234
|
+
self.get_contact_inputs(df_input)
|
|
239
235
|
df_input.loc[len(df_input)] = [
|
|
240
236
|
"hidden",
|
|
241
237
|
"external_id",
|
|
@@ -301,8 +297,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
301
297
|
"",
|
|
302
298
|
"",
|
|
303
299
|
]
|
|
304
|
-
|
|
305
|
-
|
|
306
300
|
|
|
307
301
|
df_input.loc[len(df_input)] = [
|
|
308
302
|
"end_group",
|
|
@@ -325,7 +319,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
325
319
|
"",
|
|
326
320
|
"",
|
|
327
321
|
]
|
|
328
|
-
|
|
322
|
+
|
|
329
323
|
df_input.loc[len(df_input)] = [
|
|
330
324
|
"hidden",
|
|
331
325
|
"data_load",
|
|
@@ -355,18 +349,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
355
349
|
*list(empty.values()), # hint
|
|
356
350
|
*list(empty.values()), # help
|
|
357
351
|
"", # 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'
|
|
352
|
+
"", # 'appearance', clean_name
|
|
353
|
+
"", # 'constraint',
|
|
354
|
+
*list(empty.values()), # 'constraint_message'
|
|
355
|
+
"", # 'relevance'
|
|
356
|
+
"", # 'disabled'
|
|
357
|
+
"", # 'required'
|
|
358
|
+
*list(empty.values()), # 'required message'
|
|
359
|
+
"", # 'read only'
|
|
360
|
+
"../inputs/user/contact_id", # 'expression'
|
|
361
|
+
"",
|
|
362
|
+
"", # 'repeat_count'
|
|
363
|
+
"", # 'image'
|
|
370
364
|
"", # choice filter
|
|
371
365
|
]
|
|
372
366
|
df_input.loc[len(df_input)] = [
|
|
@@ -376,18 +370,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
376
370
|
*list(empty.values()), # hint
|
|
377
371
|
*list(empty.values()), # help
|
|
378
372
|
"", # 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'
|
|
373
|
+
"", # 'appearance', clean_name
|
|
374
|
+
"", # 'constraint',
|
|
375
|
+
*list(empty.values()), # 'constraint_message'
|
|
376
|
+
"", # 'relevance'
|
|
377
|
+
"", # 'disabled'
|
|
378
|
+
"", # 'required'
|
|
379
|
+
*list(empty.values()), # 'required message'
|
|
380
|
+
"", # 'read only'
|
|
381
|
+
"../inputs/user/facility_id", # 'expression'
|
|
382
|
+
"",
|
|
383
|
+
"", # 'repeat_count'
|
|
384
|
+
"", # 'image'
|
|
391
385
|
"", # choice filter
|
|
392
386
|
]
|
|
393
387
|
df_input.loc[len(df_input)] = [
|
|
@@ -397,18 +391,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
397
391
|
*list(empty.values()), # hint
|
|
398
392
|
*list(empty.values()), # help
|
|
399
393
|
"", # 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'
|
|
394
|
+
"", # 'appearance', clean_name
|
|
395
|
+
"", # 'constraint',
|
|
396
|
+
*list(empty.values()), # 'constraint_message'
|
|
397
|
+
"", # 'relevance'
|
|
398
|
+
"", # 'disabled'
|
|
399
|
+
"", # 'required'
|
|
400
|
+
*list(empty.values()), # 'required message'
|
|
401
|
+
"", # 'read only'
|
|
402
|
+
"../inputs/user/name", # 'expression'
|
|
403
|
+
"",
|
|
404
|
+
"", # 'repeat_count'
|
|
405
|
+
"", # 'image'
|
|
412
406
|
"", # choice filter
|
|
413
407
|
]
|
|
414
408
|
df_input.loc[len(df_input)] = [
|
|
@@ -418,18 +412,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
418
412
|
*list(empty.values()), # hint
|
|
419
413
|
*list(empty.values()), # help
|
|
420
414
|
"", # 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'
|
|
415
|
+
"", # 'appearance', clean_name
|
|
416
|
+
"", # 'constraint',
|
|
417
|
+
*list(empty.values()), # 'constraint_message'
|
|
418
|
+
"", # 'relevance'
|
|
419
|
+
"", # 'disabled'
|
|
420
|
+
"", # 'required'
|
|
421
|
+
*list(empty.values()), # 'required message'
|
|
422
|
+
"", # 'read only'
|
|
423
|
+
"../inputs/contact/_id", # 'expression'
|
|
424
|
+
"",
|
|
425
|
+
"", # 'repeat_count'
|
|
426
|
+
"", # 'image'
|
|
433
427
|
"", # choice filter
|
|
434
428
|
]
|
|
435
429
|
|
|
@@ -440,18 +434,18 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
440
434
|
*list(empty.values()), # hint
|
|
441
435
|
*list(empty.values()), # help
|
|
442
436
|
"", # 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'
|
|
437
|
+
"", # 'appearance', clean_name
|
|
438
|
+
"", # 'constraint',
|
|
439
|
+
*list(empty.values()), # 'constraint_message'
|
|
440
|
+
"", # 'relevance'
|
|
441
|
+
"", # 'disabled'
|
|
442
|
+
"", # 'required'
|
|
443
|
+
*list(empty.values()), # 'required message'
|
|
444
|
+
"", # 'read only'
|
|
445
|
+
"../inputs/source_id", # 'expression'
|
|
446
|
+
"",
|
|
447
|
+
"", # 'repeat_count'
|
|
448
|
+
"", # 'image'
|
|
455
449
|
"", # choice filter
|
|
456
450
|
]
|
|
457
451
|
df_input.loc[len(df_input)] = [
|
|
@@ -461,21 +455,20 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
461
455
|
*list(empty.values()), # hint
|
|
462
456
|
*list(empty.values()), # help
|
|
463
457
|
"", # 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'
|
|
458
|
+
"", # 'appearance', clean_name
|
|
459
|
+
"", # 'constraint',
|
|
460
|
+
*list(empty.values()), # 'constraint_message'
|
|
461
|
+
"", # 'relevance'
|
|
462
|
+
"", # 'disabled'
|
|
463
|
+
"", # 'required'
|
|
464
|
+
*list(empty.values()), # 'required message'
|
|
465
|
+
"", # 'read only'
|
|
466
|
+
"../inputs/user/facility_id", # 'expression'
|
|
467
|
+
"",
|
|
468
|
+
"", # 'repeat_count'
|
|
469
|
+
"", # 'image'
|
|
476
470
|
"", # choice filter
|
|
477
471
|
]
|
|
478
|
-
|
|
479
472
|
|
|
480
473
|
for input in inputs:
|
|
481
474
|
df_input.loc[len(df_input)] = get_input_calc_line(input)
|
|
@@ -484,7 +477,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
484
477
|
|
|
485
478
|
def get_contact_inputs(self, df_input):
|
|
486
479
|
empty = langs.get_trads("", force_dict=True)
|
|
487
|
-
if not len(df_input[df_input[
|
|
480
|
+
if not len(df_input[df_input["name"] == "sex"]):
|
|
488
481
|
df_input.loc[len(df_input)] = [
|
|
489
482
|
"hidden",
|
|
490
483
|
"sex",
|
|
@@ -506,7 +499,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
506
499
|
"",
|
|
507
500
|
"",
|
|
508
501
|
]
|
|
509
|
-
if not len(df_input[df_input[
|
|
502
|
+
if not len(df_input[df_input["name"] == "date_of_birth"]):
|
|
510
503
|
df_input.loc[len(df_input)] = [
|
|
511
504
|
"hidden",
|
|
512
505
|
"date_of_birth",
|
|
@@ -531,7 +524,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
531
524
|
|
|
532
525
|
return df_input
|
|
533
526
|
|
|
534
|
-
|
|
535
527
|
def get_contact_inputs_calculate(self, df_input):
|
|
536
528
|
empty = langs.get_trads("", force_dict=True)
|
|
537
529
|
df_input.loc[len(df_input)] = [
|
|
@@ -581,12 +573,6 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
581
573
|
|
|
582
574
|
def get_cht_summary(self):
|
|
583
575
|
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
576
|
return df_summary
|
|
591
577
|
|
|
592
578
|
def get_last_prev_index(self, df, e, depth=0):
|
|
@@ -601,7 +587,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
601
587
|
latest = index[-1]
|
|
602
588
|
if latest is None and depth > 5:
|
|
603
589
|
for p in e.prev_nodes:
|
|
604
|
-
index = get_last_prev_index(df, e, depth + 1)
|
|
590
|
+
index = self.get_last_prev_index(df, e, depth + 1)
|
|
605
591
|
if not latest and index and index > latest:
|
|
606
592
|
latest = index
|
|
607
593
|
return latest
|
|
@@ -635,9 +621,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
635
621
|
df_settings = pd.DataFrame(settings, index=indx)
|
|
636
622
|
df_settings.head()
|
|
637
623
|
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
|
-
)
|
|
624
|
+
self.df_survey.loc[self.df_survey["name"] == "version", "label"] = f"v{version}"
|
|
641
625
|
# create a Pandas Excel writer using XlsxWriter as the engine
|
|
642
626
|
writer = pd.ExcelWriter(newpath, engine="xlsxwriter")
|
|
643
627
|
self.df_survey.to_excel(writer, sheet_name="survey", index=False)
|
|
@@ -649,8 +633,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
649
633
|
for p in self.project.pages.values():
|
|
650
634
|
p_ends = list(
|
|
651
635
|
filter(
|
|
652
|
-
lambda x: issubclass(x.__class__, TriccNodeEnd)
|
|
653
|
-
and getattr(x, "process", "") == "pause",
|
|
636
|
+
lambda x: issubclass(x.__class__, TriccNodeEnd) and getattr(x, "process", "") == "pause",
|
|
654
637
|
p.nodes.values(),
|
|
655
638
|
)
|
|
656
639
|
)
|
|
@@ -668,9 +651,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
668
651
|
)
|
|
669
652
|
)
|
|
670
653
|
else:
|
|
671
|
-
logger.critical(
|
|
672
|
-
f"impossible to get last index before pause: {e.get_name()}"
|
|
673
|
-
)
|
|
654
|
+
logger.critical(f"impossible to get last index before pause: {e.get_name()}")
|
|
674
655
|
forms = [form_id]
|
|
675
656
|
for i, e in ends_prev:
|
|
676
657
|
new_form_id = f"{form_id}_{clean_name(e.name)}"
|
|
@@ -685,9 +666,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
685
666
|
}
|
|
686
667
|
df_settings = pd.DataFrame(settings, index=indx)
|
|
687
668
|
df_settings.head()
|
|
688
|
-
task_df, hidden_names = make_breakpoints(
|
|
689
|
-
self.df_survey, i, e.name, replace_dots=True
|
|
690
|
-
)
|
|
669
|
+
task_df, hidden_names = make_breakpoints(self.df_survey, i, e.name, replace_dots=True)
|
|
691
670
|
# deactivate the end node
|
|
692
671
|
task_df.loc[task_df["name"] == get_export_name(e), "calculation"] = 0
|
|
693
672
|
# print fileds
|
|
@@ -716,9 +695,7 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
716
695
|
|
|
717
696
|
media_path_tmp = os.path.join(self.output_path, "media-tmp")
|
|
718
697
|
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
|
|
698
|
+
if os.path.isdir(media_path): # check if it exists, because if it does, error will be raised
|
|
722
699
|
shutil.rmtree(media_path)
|
|
723
700
|
# (later change to make folder complaint to CHT)
|
|
724
701
|
os.mkdir(media_path)
|
|
@@ -731,16 +708,31 @@ class XLSFormCHTStrategy(XLSFormCDSSStrategy):
|
|
|
731
708
|
def tricc_operation_zscore(self, ref_expressions):
|
|
732
709
|
y, ll, m, s = self.get_zscore_params(ref_expressions)
|
|
733
710
|
# return ((Math.pow((y / m), l) - 1) / (s * l));
|
|
734
|
-
return f"cht:extension-lib('{
|
|
711
|
+
return f"""cht:extension-lib('{
|
|
712
|
+
ref_expressions[0][1:-1]
|
|
713
|
+
}.js',{
|
|
714
|
+
self.clean_coalesce(ref_expressions[1])
|
|
715
|
+
} ,{
|
|
716
|
+
self.clean_coalesce(ref_expressions[2])
|
|
717
|
+
} ,{
|
|
718
|
+
self.clean_coalesce(ref_expressions[3])
|
|
719
|
+
})"""
|
|
735
720
|
|
|
736
721
|
def tricc_operation_izscore(self, ref_expressions):
|
|
737
722
|
z, ll, m, s = self.get_zscore_params(ref_expressions)
|
|
738
723
|
# return (m * (z*s*l-1)^(1/l));
|
|
739
|
-
return f"cht:extension-lib('{
|
|
724
|
+
return f"""cht:extension-lib('{
|
|
725
|
+
ref_expressions[0][1:-1]
|
|
726
|
+
}.js',{
|
|
727
|
+
self.clean_coalesce(ref_expressions[1])
|
|
728
|
+
} ,{
|
|
729
|
+
self.clean_coalesce(ref_expressions[2])
|
|
730
|
+
} ,{
|
|
731
|
+
self.clean_coalesce(ref_expressions[3])
|
|
732
|
+
}, true)"""
|
|
740
733
|
|
|
741
734
|
def tricc_operation_drug_dosage(self, ref_expressions):
|
|
742
735
|
# drug name
|
|
743
736
|
# age
|
|
744
737
|
# weight
|
|
745
738
|
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")
|