OpenREM 1.0.0b2__py3-none-any.whl → 1.0.0b3__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.
- openrem/locale/de/LC_MESSAGES/django.po +1060 -1059
- openrem/locale/django.pot +973 -972
- openrem/locale/es_MX/LC_MESSAGES/django.po +1049 -1048
- openrem/locale/it/LC_MESSAGES/django.po +1044 -1043
- openrem/locale/lt/LC_MESSAGES/django.po +989 -988
- openrem/locale/nb_NO/LC_MESSAGES/django.po +985 -984
- openrem/locale/pt_BR/LC_MESSAGES/django.po +1003 -1002
- openrem/manage.py +10 -10
- openrem/openremproject/__init__.py +1 -1
- openrem/openremproject/local_settings.py.linux +128 -128
- openrem/openremproject/local_settings.py.windows +144 -144
- openrem/openremproject/local_settings.py.windows-sqlite3 +129 -129
- openrem/openremproject/settings.py +278 -278
- openrem/openremproject/urls.py +32 -32
- openrem/openremproject/wsgi.py.example +28 -28
- openrem/remapp/__init__.py +2 -2
- openrem/remapp/admin.py +31 -31
- openrem/remapp/exports/ct_export.py +780 -753
- openrem/remapp/exports/dx_export.py +817 -805
- openrem/remapp/exports/export_common.py +931 -951
- openrem/remapp/exports/export_common_pandas.py +2422 -0
- openrem/remapp/exports/exportviews.py +815 -860
- openrem/remapp/exports/mg_csv_nhsbsp.py +292 -292
- openrem/remapp/exports/mg_export.py +673 -510
- openrem/remapp/exports/nm_export.py +796 -575
- openrem/remapp/exports/rf_export.py +1418 -1431
- openrem/remapp/extractors/ct_philips.py +424 -414
- openrem/remapp/extractors/ct_toshiba.py +2116 -2108
- openrem/remapp/extractors/dx.py +1033 -952
- openrem/remapp/extractors/extract_common.py +817 -817
- openrem/remapp/extractors/import_views.py +426 -426
- openrem/remapp/extractors/mam.py +685 -672
- openrem/remapp/extractors/nm_image.py +439 -431
- openrem/remapp/extractors/ptsizecsv2db.py +368 -368
- openrem/remapp/extractors/rdsr.py +667 -654
- openrem/remapp/extractors/rdsr_methods.py +1771 -1768
- openrem/remapp/extractors/rrdsr_methods.py +630 -622
- openrem/remapp/fixtures/openskin_safelist.json +11 -11
- openrem/remapp/forms.py +2286 -2277
- openrem/remapp/interface/chart_functions.py +2412 -2393
- openrem/remapp/interface/mod_filters.py +1241 -1243
- openrem/remapp/migrations/0001_initial.py.1-0-upgrade +1043 -1043
- openrem/remapp/models.py +3418 -3407
- openrem/remapp/netdicom/dicomviews.py +681 -683
- openrem/remapp/netdicom/qrscu.py +2646 -2646
- openrem/remapp/netdicom/tools.py +134 -134
- openrem/remapp/static/css/bootstrap-theme.css +587 -587
- openrem/remapp/static/css/bootstrap-theme.min.css +4 -4
- openrem/remapp/static/css/bootstrap.css +6800 -6800
- openrem/remapp/static/css/bootstrap.min.css +4 -4
- openrem/remapp/static/css/datepicker3.css +790 -790
- openrem/remapp/static/css/jquery.qtip.min.css +2 -2
- openrem/remapp/static/css/openrem-extra.css +442 -442
- openrem/remapp/static/css/openrem.css +96 -96
- openrem/remapp/static/css/registration.css +34 -34
- openrem/remapp/static/fonts/glyphicons-halflings-regular.svg +287 -287
- openrem/remapp/static/js/bootstrap-datepicker.js +1671 -1671
- openrem/remapp/static/js/bootstrap.js +2363 -2363
- openrem/remapp/static/js/bootstrap.min.js +6 -6
- openrem/remapp/static/js/charts/chartCommonFunctions.js +75 -75
- openrem/remapp/static/js/charts/chartFullScreen.js +41 -41
- openrem/remapp/static/js/charts/ctChartAjax.js +331 -331
- openrem/remapp/static/js/charts/dxChartAjax.js +290 -290
- openrem/remapp/static/js/charts/mgChartAjax.js +144 -144
- openrem/remapp/static/js/charts/nmChartAjax.js +64 -64
- openrem/remapp/static/js/charts/plotly-2.35.2.min.js +8 -0
- openrem/remapp/static/js/charts/rfChartAjax.js +128 -128
- openrem/remapp/static/js/chroma.min.js +32 -32
- openrem/remapp/static/js/datepicker.js +5 -5
- openrem/remapp/static/js/dicom.js +115 -115
- openrem/remapp/static/js/django_reverse/reverse.js +13 -13
- openrem/remapp/static/js/formatDate.js +7 -7
- openrem/remapp/static/js/html5shiv.min.js +8 -8
- openrem/remapp/static/js/jquery-1.11.0.min.js +4 -4
- openrem/remapp/static/js/npm.js +12 -12
- openrem/remapp/static/js/respond.min.js +4 -4
- openrem/remapp/static/js/skin-dose-maps/jquery.qtip.min.js +4 -4
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMap3dHUDObject.js +112 -112
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMap3dObject.js +367 -367
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMap3dPersonObject.js +158 -158
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMapColourScaleObject.js +153 -153
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMapObject.js +367 -367
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMapping.js +584 -584
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMapping3d.js +255 -255
- openrem/remapp/static/js/skin-dose-maps/rfSkinDoseMappingAjax.js +267 -212
- openrem/remapp/static/js/skin-dose-maps/three.min.js +835 -835
- openrem/remapp/static/js/sorttable.js +495 -495
- openrem/remapp/templates/base.html +253 -253
- openrem/remapp/templates/registration/changepassword.html +25 -25
- openrem/remapp/templates/registration/changepassworddone.html +12 -12
- openrem/remapp/templates/registration/login.html +42 -42
- openrem/remapp/templates/remapp/backgroundtaskmaximumrows_form.html +29 -29
- openrem/remapp/templates/remapp/base.html +1 -1
- openrem/remapp/templates/remapp/ctdetail.html +235 -235
- openrem/remapp/templates/remapp/ctfiltered.html +310 -310
- openrem/remapp/templates/remapp/dicomdeletesettings_form.html +31 -31
- openrem/remapp/templates/remapp/dicomqr.html +147 -147
- openrem/remapp/templates/remapp/dicomquerydetails.html +83 -83
- openrem/remapp/templates/remapp/dicomqueryimages.html +49 -49
- openrem/remapp/templates/remapp/dicomqueryseries.html +109 -109
- openrem/remapp/templates/remapp/dicomquerysummary.html +48 -48
- openrem/remapp/templates/remapp/dicomremoteqr_confirm_delete.html +60 -60
- openrem/remapp/templates/remapp/dicomremoteqr_form.html +32 -32
- openrem/remapp/templates/remapp/dicomstorescp_confirm_delete.html +53 -53
- openrem/remapp/templates/remapp/dicomstorescp_form.html +48 -48
- openrem/remapp/templates/remapp/dicomsummary.html +257 -257
- openrem/remapp/templates/remapp/displaychartoptions.html +184 -184
- openrem/remapp/templates/remapp/displayhomepageoptions.html +57 -57
- openrem/remapp/templates/remapp/displayname-count.html +6 -6
- openrem/remapp/templates/remapp/displayname-last-date.html +3 -3
- openrem/remapp/templates/remapp/displayname-modality.html +86 -105
- openrem/remapp/templates/remapp/displayname-skinmap.html +18 -18
- openrem/remapp/templates/remapp/displaynameupdate.html +100 -100
- openrem/remapp/templates/remapp/displaynameview.html +222 -219
- openrem/remapp/templates/remapp/dxdetail.html +176 -176
- openrem/remapp/templates/remapp/dxfiltered.html +324 -324
- openrem/remapp/templates/remapp/exports-active.html +25 -25
- openrem/remapp/templates/remapp/exports-complete.html +35 -35
- openrem/remapp/templates/remapp/exports-error.html +26 -26
- openrem/remapp/templates/remapp/exports-queue.html +18 -18
- openrem/remapp/templates/remapp/exports.html +191 -191
- openrem/remapp/templates/remapp/failed_summary_list.html +27 -27
- openrem/remapp/templates/remapp/filteredbase.html +162 -162
- openrem/remapp/templates/remapp/highdosemetricalertsettings_form.html +76 -76
- openrem/remapp/templates/remapp/home-list-modalities.html +94 -94
- openrem/remapp/templates/remapp/home.html +202 -202
- openrem/remapp/templates/remapp/list_filters.html +24 -24
- openrem/remapp/templates/remapp/mgdetail.html +160 -138
- openrem/remapp/templates/remapp/mgfiltered.html +311 -311
- openrem/remapp/templates/remapp/nmdetail.html +300 -300
- openrem/remapp/templates/remapp/nmfiltered.html +255 -255
- openrem/remapp/templates/remapp/notpatient.html +190 -190
- openrem/remapp/templates/remapp/notpatientindicators_form_base.html +81 -81
- openrem/remapp/templates/remapp/notpatientindicatorsid_confirm_delete.html +54 -54
- openrem/remapp/templates/remapp/notpatientindicatorsid_form.html +23 -23
- openrem/remapp/templates/remapp/notpatientindicatorsname_confirm_delete.html +54 -54
- openrem/remapp/templates/remapp/notpatientindicatorsname_form.html +23 -23
- openrem/remapp/templates/remapp/notpatientindicatorsname_form_base.html +85 -85
- openrem/remapp/templates/remapp/openskinsafelist_add.html +130 -130
- openrem/remapp/templates/remapp/openskinsafelist_confirm_delete.html +100 -100
- openrem/remapp/templates/remapp/openskinsafelist_form.html +207 -207
- openrem/remapp/templates/remapp/patientidsettings_form.html +83 -83
- openrem/remapp/templates/remapp/populate_summary_progress.html +83 -83
- openrem/remapp/templates/remapp/populate_summary_progress_error.html +36 -36
- openrem/remapp/templates/remapp/review_failed_imports.html +157 -157
- openrem/remapp/templates/remapp/review_failed_study.html +41 -41
- openrem/remapp/templates/remapp/review_studies_delete_button.html +20 -20
- openrem/remapp/templates/remapp/review_study.html +19 -19
- openrem/remapp/templates/remapp/review_summary_list.html +245 -245
- openrem/remapp/templates/remapp/rf_dose_alert_email_template.html +14 -1
- openrem/remapp/templates/remapp/rfalertnotificationsview.html +59 -59
- openrem/remapp/templates/remapp/rfdetail.html +547 -543
- openrem/remapp/templates/remapp/rfdetailbase.html +18 -18
- openrem/remapp/templates/remapp/rffiltered.html +404 -404
- openrem/remapp/templates/remapp/sizeimports.html +119 -119
- openrem/remapp/templates/remapp/sizeprocess.html +96 -96
- openrem/remapp/templates/remapp/sizeupload.html +110 -110
- openrem/remapp/templates/remapp/skindosemapcalcsettings_form.html +28 -28
- openrem/remapp/templates/remapp/standardname-modality.html +69 -69
- openrem/remapp/templates/remapp/standardnames_confirm_delete.html +71 -71
- openrem/remapp/templates/remapp/standardnames_form.html +87 -87
- openrem/remapp/templates/remapp/standardnamesettings_form.html +41 -41
- openrem/remapp/templates/remapp/standardnamesrefreshall.html +92 -92
- openrem/remapp/templates/remapp/standardnameview.html +103 -103
- openrem/remapp/templates/remapp/study_confirm_delete.html +147 -147
- openrem/remapp/templates/remapp/task_admin.html +265 -265
- openrem/remapp/templates/remapp/tasks.html +76 -76
- openrem/remapp/templatetags/formfilters.py +13 -13
- openrem/remapp/templatetags/proper_paginate.py +38 -38
- openrem/remapp/templatetags/remappduration.py +36 -36
- openrem/remapp/templatetags/sigdig.py +38 -38
- openrem/remapp/templatetags/sort_class_property_value.py +15 -15
- openrem/remapp/templatetags/update_variable.py +20 -20
- openrem/remapp/templatetags/url_replace.py +25 -25
- openrem/remapp/tests/test_charts_common.py +202 -202
- openrem/remapp/tests/test_charts_ct.py +7111 -7111
- openrem/remapp/tests/test_charts_dx.py +3513 -3513
- openrem/remapp/tests/test_charts_mg.py +1116 -1115
- openrem/remapp/tests/test_dcmdatetime.py +189 -189
- openrem/remapp/tests/test_dicom_qr.py +2580 -2580
- openrem/remapp/tests/test_display_name.py +274 -274
- openrem/remapp/tests/test_export_ct_xlsx.py +272 -248
- openrem/remapp/tests/test_export_dx_xlsx.py +137 -134
- openrem/remapp/tests/test_export_mammo_csv.py +242 -242
- openrem/remapp/tests/test_export_rf_xlsx.py +246 -246
- openrem/remapp/tests/test_files/DX-Im-DRGEM.dcm +0 -0
- openrem/remapp/tests/test_files/MG-RDSR-GEPristina-2D.dcm +0 -0
- openrem/remapp/tests/test_files/MG-RDSR-GEPristina-DBT.dcm +0 -0
- openrem/remapp/tests/test_files/MG-RDSR-Giotto-DBT.dcm +0 -0
- openrem/remapp/tests/test_files/skin_map_alphenix.py +590 -590
- openrem/remapp/tests/test_files/skin_map_zee.py +354 -354
- openrem/remapp/tests/test_filters_ct.py +321 -321
- openrem/remapp/tests/test_filters_dx.py +92 -92
- openrem/remapp/tests/test_filters_mammo.py +183 -183
- openrem/remapp/tests/test_filters_rf.py +118 -118
- openrem/remapp/tests/test_get_values.py +72 -72
- openrem/remapp/tests/test_hash_id.py +65 -65
- openrem/remapp/tests/test_import_ct_esr_ge.py +3034 -3034
- openrem/remapp/tests/test_import_ct_philips_rdsr.py +42 -42
- openrem/remapp/tests/test_import_ct_rdsr_multiple.py +256 -256
- openrem/remapp/tests/test_import_ct_rdsr_siemens.py +827 -827
- openrem/remapp/tests/test_import_ct_rdsr_spectrumdynamics.py +91 -91
- openrem/remapp/tests/test_import_ct_rdsr_toshiba_dosecheck.py +67 -67
- openrem/remapp/tests/test_import_ct_rdsr_toshiba_multivaluesd.py +33 -33
- openrem/remapp/tests/test_import_ct_rdsr_toshiba_pixelmed.py +118 -118
- openrem/remapp/tests/test_import_ct_sc_philips.py +44 -44
- openrem/remapp/tests/test_import_dual_rdsr.py +110 -110
- openrem/remapp/tests/test_import_dx.py +1267 -1191
- openrem/remapp/tests/test_import_dx_rdsr.py +1250 -1253
- openrem/remapp/tests/test_import_mam.py +438 -438
- openrem/remapp/tests/test_import_mg_im_hol_proj.py +46 -46
- openrem/remapp/tests/test_import_mg_rdsr.py +586 -586
- openrem/remapp/tests/test_import_nm_image.py +420 -420
- openrem/remapp/tests/test_import_nm_siemens_rdsr.py +396 -396
- openrem/remapp/tests/test_import_px.py +161 -161
- openrem/remapp/tests/test_import_rf_rdsr.py +420 -418
- openrem/remapp/tests/test_missing_date.py +42 -42
- openrem/remapp/tests/test_not_patient.py +60 -60
- openrem/remapp/tests/test_openskin.py +272 -272
- openrem/remapp/tests/test_patient_id_settings.py +72 -72
- openrem/remapp/tests/test_pt_size_import.py +232 -232
- openrem/remapp/tests/test_rf_detail.py +113 -113
- openrem/remapp/tests/test_rf_high_dose_alert.py +361 -361
- openrem/remapp/tools/background.py +361 -361
- openrem/remapp/tools/check_standard_name_status.py +47 -0
- openrem/remapp/tools/check_uid.py +70 -70
- openrem/remapp/tools/dcmdatetime.py +248 -248
- openrem/remapp/tools/default_import.py +44 -47
- openrem/remapp/tools/get_values.py +230 -230
- openrem/remapp/tools/hash_id.py +58 -58
- openrem/remapp/tools/make_skin_map.py +448 -406
- openrem/remapp/tools/not_patient_indicators.py +72 -72
- openrem/remapp/tools/openskin/calc_exp_map.py +173 -173
- openrem/remapp/tools/openskin/geomclass.py +475 -475
- openrem/remapp/tools/openskin/geomfunc.py +433 -432
- openrem/remapp/tools/openskin/skinmap.py +417 -417
- openrem/remapp/tools/populate_summary.py +185 -193
- openrem/remapp/tools/save_skin_map_structure.py +73 -73
- openrem/remapp/tools/send_high_dose_alert_emails.py +238 -207
- openrem/remapp/urls.py +456 -448
- openrem/remapp/version.py +11 -11
- openrem/remapp/views.py +1147 -1052
- openrem/remapp/views_admin.py +3876 -3936
- openrem/remapp/views_charts_ct.py +2110 -2058
- openrem/remapp/views_charts_dx.py +1906 -1836
- openrem/remapp/views_charts_mg.py +1349 -1196
- openrem/remapp/views_charts_nm.py +535 -535
- openrem/remapp/views_charts_rf.py +1219 -1241
- openrem/remapp/views_openskin.py +379 -384
- openrem/sample-config/openrem-consumer.service +12 -12
- openrem/sample-config/openrem-gunicorn.service +13 -13
- openrem/sample-config/openrem-server +14 -13
- openrem/sample-config/openrem_orthanc_config_linux.lua +454 -454
- openrem/sample-config/openrem_orthanc_config_windows.lua +455 -455
- openrem/sample-config/queue-init.bat +73 -73
- openrem/scripts/openrem_ctphilips.py +25 -25
- openrem/scripts/openrem_cttoshiba.py +28 -28
- openrem/scripts/openrem_dx.py +22 -22
- openrem/scripts/openrem_mg.py +22 -22
- openrem/scripts/openrem_nm.py +22 -22
- openrem/scripts/openrem_ptsizecsv.py +17 -17
- openrem/scripts/openrem_qr.py +12 -12
- openrem/scripts/openrem_rdsr.py +25 -25
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info}/METADATA +39 -29
- openrem-1.0.0b3.dist-info/RECORD +379 -0
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info}/WHEEL +1 -1
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info/licenses}/COPYING-GPLv3 +674 -674
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info/licenses}/LICENSE +22 -22
- OpenREM-1.0.0b2.dist-info/RECORD +0 -373
- openrem/remapp/static/js/charts/plotly-2.17.1.min.js +0 -8
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_ctphilips.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_cttoshiba.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_dx.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_mg.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_nm.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_ptsizecsv.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_qr.py +0 -0
- {OpenREM-1.0.0b2.data → openrem-1.0.0b3.data}/scripts/openrem_rdsr.py +0 -0
- {OpenREM-1.0.0b2.dist-info → openrem-1.0.0b3.dist-info}/top_level.txt +0 -0
|
@@ -1,1836 +1,1906 @@
|
|
|
1
|
-
# pylint: disable=too-many-lines
|
|
2
|
-
import logging
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
from django.conf import settings
|
|
5
|
-
from django.contrib.auth.decorators import login_required
|
|
6
|
-
from django.core.exceptions import ObjectDoesNotExist
|
|
7
|
-
from django.http import JsonResponse
|
|
8
|
-
from remapp.forms import (
|
|
9
|
-
DXChartOptionsForm,
|
|
10
|
-
DXChartOptionsFormIncStandard,
|
|
11
|
-
)
|
|
12
|
-
from remapp.interface.mod_filters import dx_acq_filter
|
|
13
|
-
from remapp.models import (
|
|
14
|
-
create_user_profile,
|
|
15
|
-
StandardNameSettings,
|
|
16
|
-
)
|
|
17
|
-
from remapp.views_admin import (
|
|
18
|
-
set_average_chart_options,
|
|
19
|
-
required_average_choices,
|
|
20
|
-
initialise_dx_form_data,
|
|
21
|
-
set_dx_chart_options,
|
|
22
|
-
set_common_chart_options,
|
|
23
|
-
)
|
|
24
|
-
from .interface.chart_functions import (
|
|
25
|
-
create_dataframe,
|
|
26
|
-
create_dataframe_weekdays,
|
|
27
|
-
create_dataframe_aggregates,
|
|
28
|
-
plotly_boxplot,
|
|
29
|
-
plotly_barchart,
|
|
30
|
-
plotly_histogram_barchart,
|
|
31
|
-
plotly_barchart_weekdays,
|
|
32
|
-
plotly_set_default_theme,
|
|
33
|
-
plotly_frequency_barchart,
|
|
34
|
-
plotly_scatter,
|
|
35
|
-
construct_over_time_charts,
|
|
36
|
-
generate_average_chart_group,
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# pylint: disable=too-many-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
profile.
|
|
61
|
-
profile.
|
|
62
|
-
profile.
|
|
63
|
-
|
|
64
|
-
if
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if settings.DEBUG:
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
user_profile.
|
|
636
|
-
user_profile.
|
|
637
|
-
user_profile.
|
|
638
|
-
user_profile.
|
|
639
|
-
user_profile.
|
|
640
|
-
user_profile.
|
|
641
|
-
user_profile.
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
charts_of_interest
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
charts_of_interest
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
)
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
)
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
charts_of_interest.append(
|
|
729
|
-
|
|
730
|
-
)
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
if
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
)
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
"
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
"
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
"
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
"
|
|
977
|
-
"
|
|
978
|
-
"
|
|
979
|
-
"
|
|
980
|
-
"
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
return_structure["
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
"
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
"
|
|
1004
|
-
"
|
|
1005
|
-
"
|
|
1006
|
-
"
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
"
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
"
|
|
1015
|
-
"
|
|
1016
|
-
"
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
"
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
"
|
|
1040
|
-
"
|
|
1041
|
-
"
|
|
1042
|
-
"
|
|
1043
|
-
"
|
|
1044
|
-
"
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
user_profile.
|
|
1054
|
-
user_profile.
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
if
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
]
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
"
|
|
1259
|
-
"
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
"
|
|
1266
|
-
"
|
|
1267
|
-
"
|
|
1268
|
-
"
|
|
1269
|
-
"
|
|
1270
|
-
"
|
|
1271
|
-
"
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
"
|
|
1295
|
-
"
|
|
1296
|
-
"
|
|
1297
|
-
"
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
"
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
"
|
|
1306
|
-
"
|
|
1307
|
-
"
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
if user_profile.
|
|
1319
|
-
return_structure["
|
|
1320
|
-
"
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
"
|
|
1331
|
-
"
|
|
1332
|
-
"
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
"
|
|
1337
|
-
"
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
"
|
|
1342
|
-
"
|
|
1343
|
-
"
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
"
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
"
|
|
1640
|
-
"
|
|
1641
|
-
"
|
|
1642
|
-
"
|
|
1643
|
-
"
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
]
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1
|
+
# pylint: disable=too-many-lines
|
|
2
|
+
import logging
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from django.conf import settings
|
|
5
|
+
from django.contrib.auth.decorators import login_required
|
|
6
|
+
from django.core.exceptions import ObjectDoesNotExist
|
|
7
|
+
from django.http import JsonResponse
|
|
8
|
+
from remapp.forms import (
|
|
9
|
+
DXChartOptionsForm,
|
|
10
|
+
DXChartOptionsFormIncStandard,
|
|
11
|
+
)
|
|
12
|
+
from remapp.interface.mod_filters import dx_acq_filter
|
|
13
|
+
from remapp.models import (
|
|
14
|
+
create_user_profile,
|
|
15
|
+
StandardNameSettings,
|
|
16
|
+
)
|
|
17
|
+
from remapp.views_admin import (
|
|
18
|
+
set_average_chart_options,
|
|
19
|
+
required_average_choices,
|
|
20
|
+
initialise_dx_form_data,
|
|
21
|
+
set_dx_chart_options,
|
|
22
|
+
set_common_chart_options,
|
|
23
|
+
)
|
|
24
|
+
from .interface.chart_functions import (
|
|
25
|
+
create_dataframe,
|
|
26
|
+
create_dataframe_weekdays,
|
|
27
|
+
create_dataframe_aggregates,
|
|
28
|
+
plotly_boxplot,
|
|
29
|
+
plotly_barchart,
|
|
30
|
+
plotly_histogram_barchart,
|
|
31
|
+
plotly_barchart_weekdays,
|
|
32
|
+
plotly_set_default_theme,
|
|
33
|
+
plotly_frequency_barchart,
|
|
34
|
+
plotly_scatter,
|
|
35
|
+
construct_over_time_charts,
|
|
36
|
+
generate_average_chart_group,
|
|
37
|
+
)
|
|
38
|
+
from .tools.check_standard_name_status import are_standard_names_enabled
|
|
39
|
+
|
|
40
|
+
logger = logging.getLogger(__name__)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def generate_required_dx_charts_list(profile):
|
|
44
|
+
# pylint: disable=too-many-branches
|
|
45
|
+
# pylint: disable=too-many-statements
|
|
46
|
+
"""Obtain a list of dictionaries containing the title string and base
|
|
47
|
+
variable name for each required chart"""
|
|
48
|
+
|
|
49
|
+
# Obtain the system-level enable_standard_names setting
|
|
50
|
+
enable_standard_names = are_standard_names_enabled()
|
|
51
|
+
|
|
52
|
+
required_charts = []
|
|
53
|
+
|
|
54
|
+
charts_of_interest = [
|
|
55
|
+
profile.plotDXAcquisitionMeanDAPOverTime,
|
|
56
|
+
profile.plotDXAcquisitionMeanmAsOverTime,
|
|
57
|
+
profile.plotDXAcquisitionMeankVpOverTime,
|
|
58
|
+
]
|
|
59
|
+
if enable_standard_names:
|
|
60
|
+
charts_of_interest.append(profile.plotDXStandardAcquisitionMeanDAPOverTime)
|
|
61
|
+
charts_of_interest.append(profile.plotDXStandardAcquisitionMeanmAsOverTime)
|
|
62
|
+
charts_of_interest.append(profile.plotDXStandardAcquisitionMeankVpOverTime)
|
|
63
|
+
|
|
64
|
+
if any(charts_of_interest):
|
|
65
|
+
keys = list(dict(profile.TIME_PERIOD).keys())
|
|
66
|
+
values = list(dict(profile.TIME_PERIOD).values())
|
|
67
|
+
time_period = (
|
|
68
|
+
values[keys.index(profile.plotDXAcquisitionMeanDAPOverTimePeriod)]
|
|
69
|
+
).lower()
|
|
70
|
+
|
|
71
|
+
if profile.plotDXAcquisitionMeanDAP:
|
|
72
|
+
if profile.plotMean:
|
|
73
|
+
required_charts.append(
|
|
74
|
+
{
|
|
75
|
+
"title": "Chart of mean DAP for each acquisition protocol",
|
|
76
|
+
"var_name": "acquisitionMeanDAP",
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
if profile.plotMedian:
|
|
80
|
+
required_charts.append(
|
|
81
|
+
{
|
|
82
|
+
"title": "Chart of median DAP for each acquisition protocol",
|
|
83
|
+
"var_name": "acquisitionMedianDAP",
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
if profile.plotBoxplots:
|
|
87
|
+
required_charts.append(
|
|
88
|
+
{
|
|
89
|
+
"title": "Boxplot of DAP for each acquisition protocol",
|
|
90
|
+
"var_name": "acquisitionBoxplotDAP",
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
if profile.plotHistograms:
|
|
94
|
+
required_charts.append(
|
|
95
|
+
{
|
|
96
|
+
"title": "Histogram of DAP for each acquisition protocol",
|
|
97
|
+
"var_name": "acquisitionHistogramDAP",
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
if profile.plotDXAcquisitionFreq:
|
|
102
|
+
required_charts.append(
|
|
103
|
+
{
|
|
104
|
+
"title": "Chart of acquisition protocol frequency",
|
|
105
|
+
"var_name": "acquisitionFrequency",
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
if profile.plotDXAcquisitionMeankVp:
|
|
110
|
+
if profile.plotMean:
|
|
111
|
+
required_charts.append(
|
|
112
|
+
{
|
|
113
|
+
"title": "Chart of mean kVp for each acquisition protocol",
|
|
114
|
+
"var_name": "acquisitionMeankVp",
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
if profile.plotMedian:
|
|
118
|
+
required_charts.append(
|
|
119
|
+
{
|
|
120
|
+
"title": "Chart of median kVp for each acquisition protocol",
|
|
121
|
+
"var_name": "acquisitionMediankVp",
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
if profile.plotBoxplots:
|
|
125
|
+
required_charts.append(
|
|
126
|
+
{
|
|
127
|
+
"title": "Boxplot of kVp for each acquisition protocol",
|
|
128
|
+
"var_name": "acquisitionBoxplotkVp",
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
if profile.plotHistograms:
|
|
132
|
+
required_charts.append(
|
|
133
|
+
{
|
|
134
|
+
"title": "Histogram of kVp for each acquisition protocol",
|
|
135
|
+
"var_name": "acquisitionHistogramkVp",
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
if profile.plotDXAcquisitionMeanmAs:
|
|
140
|
+
if profile.plotMean:
|
|
141
|
+
required_charts.append(
|
|
142
|
+
{
|
|
143
|
+
"title": "Chart of mean mAs for each acquisition protocol",
|
|
144
|
+
"var_name": "acquisitionMeanmAs",
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
if profile.plotMedian:
|
|
148
|
+
required_charts.append(
|
|
149
|
+
{
|
|
150
|
+
"title": "Chart of median mAs for each acquisition protocol",
|
|
151
|
+
"var_name": "acquisitionMedianmAs",
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
if profile.plotBoxplots:
|
|
155
|
+
required_charts.append(
|
|
156
|
+
{
|
|
157
|
+
"title": "Boxplot of mAs for each acquisition protocol",
|
|
158
|
+
"var_name": "acquisitionBoxplotmAs",
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
if profile.plotHistograms:
|
|
162
|
+
required_charts.append(
|
|
163
|
+
{
|
|
164
|
+
"title": "Histogram of mAs for each acquisition protocol",
|
|
165
|
+
"var_name": "acquisitionHistogrammAs",
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
if profile.plotDXAcquisitionMeanDAPOverTime:
|
|
170
|
+
if profile.plotMean:
|
|
171
|
+
required_charts.append(
|
|
172
|
+
{
|
|
173
|
+
"title": "Chart of mean DAP per acquisition protocol over time ("
|
|
174
|
+
+ time_period
|
|
175
|
+
+ ")",
|
|
176
|
+
"var_name": "acquisitionMeanDAPOverTime",
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
if profile.plotMedian:
|
|
180
|
+
required_charts.append(
|
|
181
|
+
{
|
|
182
|
+
"title": "Chart of median DAP per acquisition protocol over time ("
|
|
183
|
+
+ time_period
|
|
184
|
+
+ ")",
|
|
185
|
+
"var_name": "acquisitionMedianDAPOverTime",
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
if profile.plotDXAcquisitionMeankVpOverTime:
|
|
190
|
+
if profile.plotMean:
|
|
191
|
+
required_charts.append(
|
|
192
|
+
{
|
|
193
|
+
"title": "Chart of mean kVp per acquisition protocol over time ("
|
|
194
|
+
+ time_period
|
|
195
|
+
+ ")",
|
|
196
|
+
"var_name": "acquisitionMeankVpOverTime",
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
if profile.plotMedian:
|
|
200
|
+
required_charts.append(
|
|
201
|
+
{
|
|
202
|
+
"title": "Chart of median kVp per acquisition protocol over time ("
|
|
203
|
+
+ time_period
|
|
204
|
+
+ ")",
|
|
205
|
+
"var_name": "acquisitionMediankVpOverTime",
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
if profile.plotDXAcquisitionMeanmAsOverTime:
|
|
210
|
+
if profile.plotMean:
|
|
211
|
+
required_charts.append(
|
|
212
|
+
{
|
|
213
|
+
"title": "Chart of mean mAs per acquisition protocol over time ("
|
|
214
|
+
+ time_period
|
|
215
|
+
+ ")",
|
|
216
|
+
"var_name": "acquisitionMeanmAsOverTime",
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
if profile.plotMedian:
|
|
220
|
+
required_charts.append(
|
|
221
|
+
{
|
|
222
|
+
"title": "Chart of median mAs per acquisition protocol over time ("
|
|
223
|
+
+ time_period
|
|
224
|
+
+ ")",
|
|
225
|
+
"var_name": "acquisitionMedianmAsOverTime",
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
if profile.plotDXAcquisitionDAPvsMass:
|
|
230
|
+
required_charts.append(
|
|
231
|
+
{
|
|
232
|
+
"title": "Chart of acquisition protocol DAP vs patient mass",
|
|
233
|
+
"var_name": "acquisitionDAPvsMass",
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
if enable_standard_names:
|
|
238
|
+
if profile.plotDXStandardAcquisitionMeanDAP:
|
|
239
|
+
if profile.plotMean:
|
|
240
|
+
required_charts.append(
|
|
241
|
+
{
|
|
242
|
+
"title": "Chart of mean DAP for each standard acquisition name",
|
|
243
|
+
"var_name": "standardAcquisitionMeanDAP",
|
|
244
|
+
}
|
|
245
|
+
)
|
|
246
|
+
if profile.plotMedian:
|
|
247
|
+
required_charts.append(
|
|
248
|
+
{
|
|
249
|
+
"title": "Chart of median DAP for each standard acquisition name",
|
|
250
|
+
"var_name": "standardAcquisitionMedianDAP",
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
if profile.plotBoxplots:
|
|
254
|
+
required_charts.append(
|
|
255
|
+
{
|
|
256
|
+
"title": "Boxplot of DAP for each standard acquisition name",
|
|
257
|
+
"var_name": "standardAcquisitionBoxplotDAP",
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
if profile.plotHistograms:
|
|
261
|
+
required_charts.append(
|
|
262
|
+
{
|
|
263
|
+
"title": "Histogram of DAP for each standard acquisition name",
|
|
264
|
+
"var_name": "standardAcquisitionHistogramDAP",
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
if profile.plotDXStandardAcquisitionFreq:
|
|
269
|
+
required_charts.append(
|
|
270
|
+
{
|
|
271
|
+
"title": "Chart of standard acquisition name frequency",
|
|
272
|
+
"var_name": "standardAcquisitionFrequency",
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
if profile.plotDXStandardAcquisitionMeankVp:
|
|
277
|
+
if profile.plotMean:
|
|
278
|
+
required_charts.append(
|
|
279
|
+
{
|
|
280
|
+
"title": "Chart of mean kVp for each standard acquisition name",
|
|
281
|
+
"var_name": "standardAcquisitionMeankVp",
|
|
282
|
+
}
|
|
283
|
+
)
|
|
284
|
+
if profile.plotMedian:
|
|
285
|
+
required_charts.append(
|
|
286
|
+
{
|
|
287
|
+
"title": "Chart of median kVp for each standard acquisition name",
|
|
288
|
+
"var_name": "standardAcquisitionMediankVp",
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
if profile.plotBoxplots:
|
|
292
|
+
required_charts.append(
|
|
293
|
+
{
|
|
294
|
+
"title": "Boxplot of kVp for each standard acquisition name",
|
|
295
|
+
"var_name": "standardAcquisitionBoxplotkVp",
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
if profile.plotHistograms:
|
|
299
|
+
required_charts.append(
|
|
300
|
+
{
|
|
301
|
+
"title": "Histogram of kVp for each standard acquisition name",
|
|
302
|
+
"var_name": "standardAcquisitionHistogramkVp",
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
if profile.plotDXStandardAcquisitionMeanmAs:
|
|
307
|
+
if profile.plotMean:
|
|
308
|
+
required_charts.append(
|
|
309
|
+
{
|
|
310
|
+
"title": "Chart of mean mAs for each standard acquisition name",
|
|
311
|
+
"var_name": "standardAcquisitionMeanmAs",
|
|
312
|
+
}
|
|
313
|
+
)
|
|
314
|
+
if profile.plotMedian:
|
|
315
|
+
required_charts.append(
|
|
316
|
+
{
|
|
317
|
+
"title": "Chart of median mAs for each standard acquisition name",
|
|
318
|
+
"var_name": "standardAcquisitionMedianmAs",
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
if profile.plotBoxplots:
|
|
322
|
+
required_charts.append(
|
|
323
|
+
{
|
|
324
|
+
"title": "Boxplot of mAs for each standard acquisition name",
|
|
325
|
+
"var_name": "standardAcquisitionBoxplotmAs",
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
if profile.plotHistograms:
|
|
329
|
+
required_charts.append(
|
|
330
|
+
{
|
|
331
|
+
"title": "Histogram of mAs for each standard acquisition name",
|
|
332
|
+
"var_name": "standardAcquisitionHistogrammAs",
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
if profile.plotDXStandardAcquisitionMeanDAPOverTime:
|
|
337
|
+
if profile.plotMean:
|
|
338
|
+
required_charts.append(
|
|
339
|
+
{
|
|
340
|
+
"title": "Chart of mean DAP per standard acquisition name over time ("
|
|
341
|
+
+ time_period
|
|
342
|
+
+ ")",
|
|
343
|
+
"var_name": "standardAcquisitionMeanDAPOverTime",
|
|
344
|
+
}
|
|
345
|
+
)
|
|
346
|
+
if profile.plotMedian:
|
|
347
|
+
required_charts.append(
|
|
348
|
+
{
|
|
349
|
+
"title": "Chart of median DAP per standard acquisition name over time ("
|
|
350
|
+
+ time_period
|
|
351
|
+
+ ")",
|
|
352
|
+
"var_name": "standardAcquisitionMedianDAPOverTime",
|
|
353
|
+
}
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
if profile.plotDXStandardAcquisitionMeankVpOverTime:
|
|
357
|
+
if profile.plotMean:
|
|
358
|
+
required_charts.append(
|
|
359
|
+
{
|
|
360
|
+
"title": "Chart of mean kVp per standard acquisition name over time ("
|
|
361
|
+
+ time_period
|
|
362
|
+
+ ")",
|
|
363
|
+
"var_name": "standardAcquisitionMeankVpOverTime",
|
|
364
|
+
}
|
|
365
|
+
)
|
|
366
|
+
if profile.plotMedian:
|
|
367
|
+
required_charts.append(
|
|
368
|
+
{
|
|
369
|
+
"title": "Chart of median kVp per standard acquisition name over time ("
|
|
370
|
+
+ time_period
|
|
371
|
+
+ ")",
|
|
372
|
+
"var_name": "standardAcquisitionMediankVpOverTime",
|
|
373
|
+
}
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
if profile.plotDXStandardAcquisitionMeanmAsOverTime:
|
|
377
|
+
if profile.plotMean:
|
|
378
|
+
required_charts.append(
|
|
379
|
+
{
|
|
380
|
+
"title": "Chart of mean mAs per standard acquisition name over time ("
|
|
381
|
+
+ time_period
|
|
382
|
+
+ ")",
|
|
383
|
+
"var_name": "standardAcquisitionMeanmAsOverTime",
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
if profile.plotMedian:
|
|
387
|
+
required_charts.append(
|
|
388
|
+
{
|
|
389
|
+
"title": "Chart of median mAs per standard acquisition name over time ("
|
|
390
|
+
+ time_period
|
|
391
|
+
+ ")",
|
|
392
|
+
"var_name": "standardAcquisitionMedianmAsOverTime",
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
if profile.plotDXStandardAcquisitionDAPvsMass:
|
|
397
|
+
required_charts.append(
|
|
398
|
+
{
|
|
399
|
+
"title": "Chart of standard acquisition name DAP vs patient mass",
|
|
400
|
+
"var_name": "standardAcquisitionDAPvsMass",
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
if profile.plotDXStandardStudyMeanDAP:
|
|
405
|
+
if profile.plotMean:
|
|
406
|
+
required_charts.append(
|
|
407
|
+
{
|
|
408
|
+
"title": "Chart of mean DAP for each standard study name",
|
|
409
|
+
"var_name": "standardStudyMeanDAP",
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
if profile.plotMedian:
|
|
413
|
+
required_charts.append(
|
|
414
|
+
{
|
|
415
|
+
"title": "Chart of median DAP for each standard study name",
|
|
416
|
+
"var_name": "standardStudyMedianDAP",
|
|
417
|
+
}
|
|
418
|
+
)
|
|
419
|
+
if profile.plotBoxplots:
|
|
420
|
+
required_charts.append(
|
|
421
|
+
{
|
|
422
|
+
"title": "Boxplot of DAP for each standard study name",
|
|
423
|
+
"var_name": "standardStudyBoxplotDAP",
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
if profile.plotHistograms:
|
|
427
|
+
required_charts.append(
|
|
428
|
+
{
|
|
429
|
+
"title": "Histogram of DAP for each standard study name",
|
|
430
|
+
"var_name": "standardStudyHistogramDAP",
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
if profile.plotDXStandardStudyFreq:
|
|
435
|
+
required_charts.append(
|
|
436
|
+
{
|
|
437
|
+
"title": "Chart of standard study name frequency",
|
|
438
|
+
"var_name": "standardStudyFrequency",
|
|
439
|
+
}
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
if profile.plotDXStandardStudyPerDayAndHour:
|
|
443
|
+
required_charts.append(
|
|
444
|
+
{
|
|
445
|
+
"title": "Chart of standard study name workload",
|
|
446
|
+
"var_name": "standardStudyWorkload",
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
if profile.plotDXStandardStudyDAPvsMass:
|
|
451
|
+
required_charts.append(
|
|
452
|
+
{
|
|
453
|
+
"title": "Chart of standard study name DAP vs patient mass",
|
|
454
|
+
"var_name": "standardStudyDAPvsMass",
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
|
|
458
|
+
if profile.plotDXStudyMeanDAP:
|
|
459
|
+
if profile.plotMean:
|
|
460
|
+
required_charts.append(
|
|
461
|
+
{
|
|
462
|
+
"title": "Chart of mean DAP for each study description",
|
|
463
|
+
"var_name": "studyMeanDAP",
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
if profile.plotMedian:
|
|
467
|
+
required_charts.append(
|
|
468
|
+
{
|
|
469
|
+
"title": "Chart of median DAP for each study description",
|
|
470
|
+
"var_name": "studyMedianDAP",
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
if profile.plotBoxplots:
|
|
474
|
+
required_charts.append(
|
|
475
|
+
{
|
|
476
|
+
"title": "Boxplot of DAP for each study description",
|
|
477
|
+
"var_name": "studyBoxplotDAP",
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
if profile.plotHistograms:
|
|
481
|
+
required_charts.append(
|
|
482
|
+
{
|
|
483
|
+
"title": "Histogram of DAP for each study description",
|
|
484
|
+
"var_name": "studyHistogramDAP",
|
|
485
|
+
}
|
|
486
|
+
)
|
|
487
|
+
|
|
488
|
+
if profile.plotDXStudyFreq:
|
|
489
|
+
required_charts.append(
|
|
490
|
+
{
|
|
491
|
+
"title": "Chart of study description frequency",
|
|
492
|
+
"var_name": "studyFrequency",
|
|
493
|
+
}
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
if profile.plotDXStudyPerDayAndHour:
|
|
497
|
+
required_charts.append(
|
|
498
|
+
{
|
|
499
|
+
"title": "Chart of study description workload",
|
|
500
|
+
"var_name": "studyWorkload",
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
if profile.plotDXStudyDAPvsMass:
|
|
505
|
+
required_charts.append(
|
|
506
|
+
{
|
|
507
|
+
"title": "Chart of study description DAP vs patient mass",
|
|
508
|
+
"var_name": "studyDAPvsMass",
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
|
|
512
|
+
if profile.plotDXRequestMeanDAP:
|
|
513
|
+
if profile.plotMean:
|
|
514
|
+
required_charts.append(
|
|
515
|
+
{
|
|
516
|
+
"title": "Chart of mean DAP for each requested procedure",
|
|
517
|
+
"var_name": "requestMeanDAP",
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
if profile.plotMedian:
|
|
521
|
+
required_charts.append(
|
|
522
|
+
{
|
|
523
|
+
"title": "Chart of median DAP for each requested procedure",
|
|
524
|
+
"var_name": "requestMedianDAP",
|
|
525
|
+
}
|
|
526
|
+
)
|
|
527
|
+
if profile.plotBoxplots:
|
|
528
|
+
required_charts.append(
|
|
529
|
+
{
|
|
530
|
+
"title": "Boxplot of DAP for each requested procedure",
|
|
531
|
+
"var_name": "requestBoxplotDAP",
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
if profile.plotHistograms:
|
|
535
|
+
required_charts.append(
|
|
536
|
+
{
|
|
537
|
+
"title": "Histogram of DAP for each requested procedure",
|
|
538
|
+
"var_name": "requestHistogramDAP",
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
if profile.plotDXRequestFreq:
|
|
543
|
+
required_charts.append(
|
|
544
|
+
{
|
|
545
|
+
"title": "Chart of requested procedure frequency",
|
|
546
|
+
"var_name": "requestFrequency",
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
|
|
550
|
+
if profile.plotDXRequestDAPvsMass:
|
|
551
|
+
required_charts.append(
|
|
552
|
+
{
|
|
553
|
+
"title": "Chart of requested procedure DAP vs patient mass",
|
|
554
|
+
"var_name": "requestDAPvsMass",
|
|
555
|
+
}
|
|
556
|
+
)
|
|
557
|
+
|
|
558
|
+
return required_charts
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
@login_required
|
|
562
|
+
def dx_summary_chart_data(request):
|
|
563
|
+
"""Obtain data for Ajax chart call."""
|
|
564
|
+
pid = bool(request.user.groups.filter(name="pidgroup"))
|
|
565
|
+
f = dx_acq_filter(request.GET, pid=pid)
|
|
566
|
+
|
|
567
|
+
try:
|
|
568
|
+
# See if the user has plot settings in userprofile
|
|
569
|
+
user_profile = request.user.userprofile
|
|
570
|
+
except ObjectDoesNotExist:
|
|
571
|
+
# Create a default userprofile for the user if one doesn't exist
|
|
572
|
+
create_user_profile(sender=request.user, instance=request.user, created=True)
|
|
573
|
+
user_profile = request.user.userprofile
|
|
574
|
+
|
|
575
|
+
if settings.DEBUG:
|
|
576
|
+
start_time = datetime.now()
|
|
577
|
+
|
|
578
|
+
return_structure = dx_plot_calculations(f, user_profile)
|
|
579
|
+
|
|
580
|
+
if settings.DEBUG:
|
|
581
|
+
logger.debug(f"Elapsed time is {datetime.now() - start_time}")
|
|
582
|
+
|
|
583
|
+
return JsonResponse(return_structure, safe=False)
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
def dx_plot_calculations(f, user_profile, return_as_dict=False):
|
|
587
|
+
# pylint: disable=too-many-locals
|
|
588
|
+
# pylint: disable=too-many-branches
|
|
589
|
+
# pylint: disable=too-many-statements
|
|
590
|
+
"""Calculations for radiographic charts."""
|
|
591
|
+
# Return an empty structure if the queryset is empty
|
|
592
|
+
if not f.qs.exists():
|
|
593
|
+
return {}
|
|
594
|
+
|
|
595
|
+
# Obtain the system-level enable_standard_names setting
|
|
596
|
+
enable_standard_names = are_standard_names_enabled()
|
|
597
|
+
|
|
598
|
+
# Set the Plotly chart theme
|
|
599
|
+
plotly_set_default_theme(user_profile.plotThemeChoice)
|
|
600
|
+
|
|
601
|
+
return_structure = {}
|
|
602
|
+
|
|
603
|
+
average_choices = []
|
|
604
|
+
if user_profile.plotMean:
|
|
605
|
+
average_choices.append("mean")
|
|
606
|
+
if user_profile.plotMedian:
|
|
607
|
+
average_choices.append("median")
|
|
608
|
+
|
|
609
|
+
charts_of_interest = [
|
|
610
|
+
user_profile.plotDXAcquisitionMeanDAPOverTime,
|
|
611
|
+
user_profile.plotDXAcquisitionMeankVpOverTime,
|
|
612
|
+
user_profile.plotDXAcquisitionMeanmAsOverTime,
|
|
613
|
+
]
|
|
614
|
+
if enable_standard_names:
|
|
615
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeanDAPOverTime)
|
|
616
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeankVpOverTime)
|
|
617
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeanmAsOverTime)
|
|
618
|
+
if any(charts_of_interest):
|
|
619
|
+
plot_timeunit_period = user_profile.plotDXAcquisitionMeanDAPOverTimePeriod
|
|
620
|
+
|
|
621
|
+
#######################################################################
|
|
622
|
+
# Prepare acquisition-level Pandas DataFrame to use for charts
|
|
623
|
+
charts_of_interest = [
|
|
624
|
+
user_profile.plotDXAcquisitionMeanDAP,
|
|
625
|
+
user_profile.plotDXAcquisitionFreq,
|
|
626
|
+
user_profile.plotDXAcquisitionMeankVp,
|
|
627
|
+
user_profile.plotDXAcquisitionMeanmAs,
|
|
628
|
+
user_profile.plotDXAcquisitionMeankVpOverTime,
|
|
629
|
+
user_profile.plotDXAcquisitionMeanmAsOverTime,
|
|
630
|
+
user_profile.plotDXAcquisitionMeanDAPOverTime,
|
|
631
|
+
user_profile.plotDXAcquisitionDAPvsMass,
|
|
632
|
+
]
|
|
633
|
+
if enable_standard_names:
|
|
634
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeanDAP)
|
|
635
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionFreq)
|
|
636
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeankVp)
|
|
637
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeanmAs)
|
|
638
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeankVpOverTime)
|
|
639
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeanmAsOverTime)
|
|
640
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeanDAPOverTime)
|
|
641
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionDAPvsMass)
|
|
642
|
+
|
|
643
|
+
if any(charts_of_interest):
|
|
644
|
+
|
|
645
|
+
name_fields = []
|
|
646
|
+
charts_of_interest = [
|
|
647
|
+
user_profile.plotDXAcquisitionMeanDAP,
|
|
648
|
+
user_profile.plotDXAcquisitionFreq,
|
|
649
|
+
user_profile.plotDXAcquisitionMeankVp,
|
|
650
|
+
user_profile.plotDXAcquisitionMeanmAs,
|
|
651
|
+
user_profile.plotDXAcquisitionMeankVpOverTime,
|
|
652
|
+
user_profile.plotDXAcquisitionMeanmAsOverTime,
|
|
653
|
+
user_profile.plotDXAcquisitionMeanDAPOverTime,
|
|
654
|
+
user_profile.plotDXAcquisitionDAPvsMass,
|
|
655
|
+
]
|
|
656
|
+
if any(charts_of_interest):
|
|
657
|
+
name_fields.append(
|
|
658
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
659
|
+
)
|
|
660
|
+
|
|
661
|
+
if enable_standard_names:
|
|
662
|
+
charts_of_interest = [
|
|
663
|
+
user_profile.plotDXStandardAcquisitionMeanDAP,
|
|
664
|
+
user_profile.plotDXStandardAcquisitionFreq,
|
|
665
|
+
user_profile.plotDXStandardAcquisitionMeankVp,
|
|
666
|
+
user_profile.plotDXStandardAcquisitionMeanmAs,
|
|
667
|
+
user_profile.plotDXStandardAcquisitionMeankVpOverTime,
|
|
668
|
+
user_profile.plotDXStandardAcquisitionMeanmAsOverTime,
|
|
669
|
+
user_profile.plotDXStandardAcquisitionMeanDAPOverTime,
|
|
670
|
+
user_profile.plotDXStandardAcquisitionDAPvsMass,
|
|
671
|
+
]
|
|
672
|
+
if any(charts_of_interest):
|
|
673
|
+
name_fields.append(
|
|
674
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
675
|
+
)
|
|
676
|
+
|
|
677
|
+
value_fields = []
|
|
678
|
+
value_multipliers = []
|
|
679
|
+
charts_of_interest = [
|
|
680
|
+
user_profile.plotDXAcquisitionMeanDAP,
|
|
681
|
+
user_profile.plotDXAcquisitionMeanDAPOverTime,
|
|
682
|
+
user_profile.plotDXAcquisitionDAPvsMass,
|
|
683
|
+
]
|
|
684
|
+
if enable_standard_names:
|
|
685
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeanDAP)
|
|
686
|
+
charts_of_interest.append(
|
|
687
|
+
user_profile.plotDXStandardAcquisitionMeanDAPOverTime
|
|
688
|
+
)
|
|
689
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionDAPvsMass)
|
|
690
|
+
if any(charts_of_interest):
|
|
691
|
+
value_fields.append(
|
|
692
|
+
"projectionxrayradiationdose__irradeventxraydata__dose_area_product"
|
|
693
|
+
)
|
|
694
|
+
value_multipliers.append(1000000)
|
|
695
|
+
|
|
696
|
+
charts_of_interest = [
|
|
697
|
+
user_profile.plotDXAcquisitionMeankVp,
|
|
698
|
+
user_profile.plotDXAcquisitionMeankVpOverTime,
|
|
699
|
+
]
|
|
700
|
+
if enable_standard_names:
|
|
701
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeankVp)
|
|
702
|
+
charts_of_interest.append(
|
|
703
|
+
user_profile.plotDXStandardAcquisitionMeankVpOverTime
|
|
704
|
+
)
|
|
705
|
+
if any(charts_of_interest):
|
|
706
|
+
value_fields.append(
|
|
707
|
+
"projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__kvp__kvp"
|
|
708
|
+
)
|
|
709
|
+
value_multipliers.append(1)
|
|
710
|
+
|
|
711
|
+
charts_of_interest = [
|
|
712
|
+
user_profile.plotDXAcquisitionMeanmAs,
|
|
713
|
+
user_profile.plotDXAcquisitionMeanmAsOverTime,
|
|
714
|
+
]
|
|
715
|
+
if enable_standard_names:
|
|
716
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionMeanmAs)
|
|
717
|
+
charts_of_interest.append(
|
|
718
|
+
user_profile.plotDXStandardAcquisitionMeanmAsOverTime
|
|
719
|
+
)
|
|
720
|
+
if any(charts_of_interest):
|
|
721
|
+
value_fields.append(
|
|
722
|
+
"projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__exposure__exposure"
|
|
723
|
+
)
|
|
724
|
+
value_multipliers.append(0.001)
|
|
725
|
+
|
|
726
|
+
charts_of_interest = [user_profile.plotDXAcquisitionDAPvsMass]
|
|
727
|
+
if enable_standard_names:
|
|
728
|
+
charts_of_interest.append(user_profile.plotDXStandardAcquisitionDAPvsMass)
|
|
729
|
+
if any(charts_of_interest):
|
|
730
|
+
value_fields.append("patientstudymoduleattr__patient_weight")
|
|
731
|
+
value_multipliers.append(1)
|
|
732
|
+
|
|
733
|
+
time_fields = []
|
|
734
|
+
date_fields = []
|
|
735
|
+
charts_of_interest = [
|
|
736
|
+
user_profile.plotDXAcquisitionMeanDAPOverTime,
|
|
737
|
+
user_profile.plotDXAcquisitionMeankVpOverTime,
|
|
738
|
+
user_profile.plotDXAcquisitionMeanmAsOverTime,
|
|
739
|
+
]
|
|
740
|
+
if enable_standard_names:
|
|
741
|
+
charts_of_interest.append(
|
|
742
|
+
user_profile.plotDXStandardAcquisitionMeanDAPOverTime
|
|
743
|
+
)
|
|
744
|
+
charts_of_interest.append(
|
|
745
|
+
user_profile.plotDXStandardAcquisitionMeankVpOverTime
|
|
746
|
+
)
|
|
747
|
+
charts_of_interest.append(
|
|
748
|
+
user_profile.plotDXStandardAcquisitionMeanmAsOverTime
|
|
749
|
+
)
|
|
750
|
+
if any(charts_of_interest):
|
|
751
|
+
date_fields.append("study_date")
|
|
752
|
+
|
|
753
|
+
system_field = []
|
|
754
|
+
if user_profile.plotSeriesPerSystem:
|
|
755
|
+
system_field.append(
|
|
756
|
+
"generalequipmentmoduleattr__unique_equipment_name_id__display_name"
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
fields = {
|
|
760
|
+
"names": name_fields,
|
|
761
|
+
"values": value_fields,
|
|
762
|
+
"dates": date_fields,
|
|
763
|
+
"times": time_fields,
|
|
764
|
+
"system": system_field,
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
df = create_dataframe(
|
|
768
|
+
f.qs,
|
|
769
|
+
fields,
|
|
770
|
+
data_point_name_lowercase=user_profile.plotCaseInsensitiveCategories,
|
|
771
|
+
data_point_name_remove_whitespace_padding=user_profile.plotRemoveCategoryWhitespacePadding,
|
|
772
|
+
data_point_value_multipliers=value_multipliers,
|
|
773
|
+
char_wrap=user_profile.plotLabelCharWrap,
|
|
774
|
+
uid="projectionxrayradiationdose__irradeventxraydata__pk",
|
|
775
|
+
)
|
|
776
|
+
#######################################################################
|
|
777
|
+
|
|
778
|
+
#######################################################################
|
|
779
|
+
# Addressing issue 1050 (https://bitbucket.org/openrem/openrem/issues/1050)
|
|
780
|
+
# Filter data frame using acquisition protocol name, min / max event DAP,
|
|
781
|
+
# and standard acquisition name filters.
|
|
782
|
+
if "event_dap_min" in f.data:
|
|
783
|
+
if f.data["event_dap_min"]:
|
|
784
|
+
df = df[
|
|
785
|
+
df[
|
|
786
|
+
"projectionxrayradiationdose__irradeventxraydata__dose_area_product"
|
|
787
|
+
]
|
|
788
|
+
>= float(f.data["event_dap_min"])
|
|
789
|
+
]
|
|
790
|
+
|
|
791
|
+
if "event_dap_max" in f.data:
|
|
792
|
+
if f.data["event_dap_max"]:
|
|
793
|
+
df = df[
|
|
794
|
+
df[
|
|
795
|
+
"projectionxrayradiationdose__irradeventxraydata__dose_area_product"
|
|
796
|
+
]
|
|
797
|
+
<= float(f.data["event_dap_max"])
|
|
798
|
+
]
|
|
799
|
+
|
|
800
|
+
if (
|
|
801
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
802
|
+
in f.data
|
|
803
|
+
):
|
|
804
|
+
if f.data[
|
|
805
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
806
|
+
]:
|
|
807
|
+
df[
|
|
808
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
809
|
+
] = df[
|
|
810
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
811
|
+
].astype(
|
|
812
|
+
"object"
|
|
813
|
+
)
|
|
814
|
+
df = df[
|
|
815
|
+
df[
|
|
816
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
817
|
+
].str.contains(
|
|
818
|
+
f.data[
|
|
819
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
820
|
+
],
|
|
821
|
+
case=False,
|
|
822
|
+
)
|
|
823
|
+
]
|
|
824
|
+
df[
|
|
825
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
826
|
+
] = df[
|
|
827
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
828
|
+
].astype(
|
|
829
|
+
"category"
|
|
830
|
+
)
|
|
831
|
+
|
|
832
|
+
if (
|
|
833
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
834
|
+
in f.data
|
|
835
|
+
):
|
|
836
|
+
if f.data[
|
|
837
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
838
|
+
]:
|
|
839
|
+
df[
|
|
840
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
841
|
+
] = df[
|
|
842
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
843
|
+
].astype(
|
|
844
|
+
"object"
|
|
845
|
+
)
|
|
846
|
+
df = df[
|
|
847
|
+
df[
|
|
848
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
849
|
+
].str.contains(
|
|
850
|
+
f.data[
|
|
851
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
852
|
+
],
|
|
853
|
+
case=False,
|
|
854
|
+
)
|
|
855
|
+
]
|
|
856
|
+
df[
|
|
857
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
858
|
+
] = df[
|
|
859
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
860
|
+
].astype(
|
|
861
|
+
"category"
|
|
862
|
+
)
|
|
863
|
+
#######################################################################
|
|
864
|
+
|
|
865
|
+
if user_profile.plotDXAcquisitionMeanDAP:
|
|
866
|
+
|
|
867
|
+
name_field = (
|
|
868
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
869
|
+
)
|
|
870
|
+
value_field = (
|
|
871
|
+
"projectionxrayradiationdose__irradeventxraydata__dose_area_product"
|
|
872
|
+
)
|
|
873
|
+
value_text = "DAP"
|
|
874
|
+
units_text = "(cGy.cm<sup>2</sup>)"
|
|
875
|
+
name_text = "Acquisition protocol"
|
|
876
|
+
variable_name_start = "acquisition"
|
|
877
|
+
variable_value_name = "DAP"
|
|
878
|
+
modality_text = "DX"
|
|
879
|
+
chart_message = ""
|
|
880
|
+
|
|
881
|
+
new_charts = generate_average_chart_group(
|
|
882
|
+
average_choices,
|
|
883
|
+
chart_message,
|
|
884
|
+
df,
|
|
885
|
+
modality_text,
|
|
886
|
+
name_field,
|
|
887
|
+
name_text,
|
|
888
|
+
return_as_dict,
|
|
889
|
+
return_structure,
|
|
890
|
+
units_text,
|
|
891
|
+
user_profile,
|
|
892
|
+
value_field,
|
|
893
|
+
value_text,
|
|
894
|
+
variable_name_start,
|
|
895
|
+
variable_value_name,
|
|
896
|
+
user_profile.plotDXInitialSortingChoice,
|
|
897
|
+
)
|
|
898
|
+
|
|
899
|
+
return_structure = {**return_structure, **new_charts}
|
|
900
|
+
|
|
901
|
+
if user_profile.plotDXAcquisitionMeankVp:
|
|
902
|
+
|
|
903
|
+
name_field = (
|
|
904
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
905
|
+
)
|
|
906
|
+
value_field = "projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__kvp__kvp"
|
|
907
|
+
value_text = "kVp"
|
|
908
|
+
units_text = ""
|
|
909
|
+
name_text = "Acquisition protocol"
|
|
910
|
+
variable_name_start = "acquisition"
|
|
911
|
+
variable_value_name = "kVp"
|
|
912
|
+
modality_text = "DX"
|
|
913
|
+
chart_message = ""
|
|
914
|
+
|
|
915
|
+
new_charts = generate_average_chart_group(
|
|
916
|
+
average_choices,
|
|
917
|
+
chart_message,
|
|
918
|
+
df,
|
|
919
|
+
modality_text,
|
|
920
|
+
name_field,
|
|
921
|
+
name_text,
|
|
922
|
+
return_as_dict,
|
|
923
|
+
return_structure,
|
|
924
|
+
units_text,
|
|
925
|
+
user_profile,
|
|
926
|
+
value_field,
|
|
927
|
+
value_text,
|
|
928
|
+
variable_name_start,
|
|
929
|
+
variable_value_name,
|
|
930
|
+
user_profile.plotDXInitialSortingChoice,
|
|
931
|
+
)
|
|
932
|
+
|
|
933
|
+
return_structure = {**return_structure, **new_charts}
|
|
934
|
+
|
|
935
|
+
if user_profile.plotDXAcquisitionMeanmAs:
|
|
936
|
+
|
|
937
|
+
name_field = (
|
|
938
|
+
"projectionxrayradiationdose__irradeventxraydata__acquisition_protocol"
|
|
939
|
+
)
|
|
940
|
+
value_field = "projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__exposure__exposure" # pylint: disable=line-too-long
|
|
941
|
+
value_text = "mAs"
|
|
942
|
+
units_text = ""
|
|
943
|
+
name_text = "Acquisition protocol"
|
|
944
|
+
variable_name_start = "acquisition"
|
|
945
|
+
variable_value_name = "mAs"
|
|
946
|
+
modality_text = "DX"
|
|
947
|
+
chart_message = ""
|
|
948
|
+
|
|
949
|
+
new_charts = generate_average_chart_group(
|
|
950
|
+
average_choices,
|
|
951
|
+
chart_message,
|
|
952
|
+
df,
|
|
953
|
+
modality_text,
|
|
954
|
+
name_field,
|
|
955
|
+
name_text,
|
|
956
|
+
return_as_dict,
|
|
957
|
+
return_structure,
|
|
958
|
+
units_text,
|
|
959
|
+
user_profile,
|
|
960
|
+
value_field,
|
|
961
|
+
value_text,
|
|
962
|
+
variable_name_start,
|
|
963
|
+
variable_value_name,
|
|
964
|
+
user_profile.plotDXInitialSortingChoice,
|
|
965
|
+
)
|
|
966
|
+
|
|
967
|
+
return_structure = {**return_structure, **new_charts}
|
|
968
|
+
|
|
969
|
+
if user_profile.plotDXAcquisitionFreq:
|
|
970
|
+
parameter_dict = {
|
|
971
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__acquisition_protocol",
|
|
972
|
+
"sorting_choice": [
|
|
973
|
+
user_profile.plotInitialSortingDirection,
|
|
974
|
+
user_profile.plotDXInitialSortingChoice,
|
|
975
|
+
],
|
|
976
|
+
"legend_title": "Acquisition protocol",
|
|
977
|
+
"df_x_axis_col": "x_ray_system_name",
|
|
978
|
+
"x_axis_title": "System",
|
|
979
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
980
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
981
|
+
"filename": "OpenREM DX acquisition protocol frequency",
|
|
982
|
+
"groupby_cols": None,
|
|
983
|
+
"facet_col": None,
|
|
984
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
985
|
+
"return_as_dict": return_as_dict,
|
|
986
|
+
}
|
|
987
|
+
(
|
|
988
|
+
return_structure["acquisitionFrequencyData"],
|
|
989
|
+
return_structure["acquisitionFrequencyDataCSV"],
|
|
990
|
+
) = plotly_frequency_barchart( # pylint: disable=line-too-long
|
|
991
|
+
df,
|
|
992
|
+
parameter_dict,
|
|
993
|
+
csv_name="acquisitionFrequencyData.csv",
|
|
994
|
+
)
|
|
995
|
+
|
|
996
|
+
if user_profile.plotDXAcquisitionMeanDAPOverTime:
|
|
997
|
+
facet_title = "System"
|
|
998
|
+
|
|
999
|
+
if user_profile.plotGroupingChoice == "series":
|
|
1000
|
+
facet_title = "Acquisition protocol"
|
|
1001
|
+
|
|
1002
|
+
parameter_dict = {
|
|
1003
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__acquisition_protocol",
|
|
1004
|
+
"df_value_col": "projectionxrayradiationdose__irradeventxraydata__dose_area_product",
|
|
1005
|
+
"df_date_col": "study_date",
|
|
1006
|
+
"name_title": "Acquisition protocol",
|
|
1007
|
+
"value_title": "DAP (cGy.cm<sup>2</sup>)",
|
|
1008
|
+
"date_title": "Study date",
|
|
1009
|
+
"facet_title": facet_title,
|
|
1010
|
+
"sorting_choice": [
|
|
1011
|
+
user_profile.plotInitialSortingDirection,
|
|
1012
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1013
|
+
],
|
|
1014
|
+
"time_period": plot_timeunit_period,
|
|
1015
|
+
"average_choices": average_choices + ["count"],
|
|
1016
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1017
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1018
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1019
|
+
"filename": "OpenREM DX acquisition protocol DAP over time",
|
|
1020
|
+
"return_as_dict": return_as_dict,
|
|
1021
|
+
}
|
|
1022
|
+
result = construct_over_time_charts(
|
|
1023
|
+
df,
|
|
1024
|
+
parameter_dict,
|
|
1025
|
+
)
|
|
1026
|
+
|
|
1027
|
+
if user_profile.plotMean:
|
|
1028
|
+
return_structure["acquisitionMeanDAPOverTime"] = result["mean"]
|
|
1029
|
+
if user_profile.plotMedian:
|
|
1030
|
+
return_structure["acquisitionMedianDAPOverTime"] = result["median"]
|
|
1031
|
+
|
|
1032
|
+
if user_profile.plotDXAcquisitionMeankVpOverTime:
|
|
1033
|
+
facet_title = "System"
|
|
1034
|
+
|
|
1035
|
+
if user_profile.plotGroupingChoice == "series":
|
|
1036
|
+
facet_title = "Acquisition protocol"
|
|
1037
|
+
|
|
1038
|
+
parameter_dict = {
|
|
1039
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__acquisition_protocol",
|
|
1040
|
+
"df_value_col": "projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__kvp__kvp",
|
|
1041
|
+
"df_date_col": "study_date",
|
|
1042
|
+
"name_title": "Acquisition protocol",
|
|
1043
|
+
"value_title": "kVp",
|
|
1044
|
+
"date_title": "Study date",
|
|
1045
|
+
"facet_title": facet_title,
|
|
1046
|
+
"sorting_choice": [
|
|
1047
|
+
user_profile.plotInitialSortingDirection,
|
|
1048
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1049
|
+
],
|
|
1050
|
+
"time_period": plot_timeunit_period,
|
|
1051
|
+
"average_choices": average_choices + ["count"],
|
|
1052
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1053
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1054
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1055
|
+
"filename": "OpenREM DX acquisition protocol kVp over time",
|
|
1056
|
+
"return_as_dict": return_as_dict,
|
|
1057
|
+
}
|
|
1058
|
+
result = construct_over_time_charts(
|
|
1059
|
+
df,
|
|
1060
|
+
parameter_dict,
|
|
1061
|
+
)
|
|
1062
|
+
|
|
1063
|
+
if user_profile.plotMean:
|
|
1064
|
+
return_structure["acquisitionMeankVpOverTime"] = result["mean"]
|
|
1065
|
+
if user_profile.plotMedian:
|
|
1066
|
+
return_structure["acquisitionMediankVpOverTime"] = result["median"]
|
|
1067
|
+
|
|
1068
|
+
if user_profile.plotDXAcquisitionMeanmAsOverTime:
|
|
1069
|
+
facet_title = "System"
|
|
1070
|
+
|
|
1071
|
+
if user_profile.plotGroupingChoice == "series":
|
|
1072
|
+
facet_title = "Acquisition protocol"
|
|
1073
|
+
|
|
1074
|
+
parameter_dict = { # pylint: disable=line-too-long
|
|
1075
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__acquisition_protocol",
|
|
1076
|
+
"df_value_col": "projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__exposure__exposure", # pylint: disable=line-too-long
|
|
1077
|
+
"df_date_col": "study_date",
|
|
1078
|
+
"name_title": "Acquisition protocol",
|
|
1079
|
+
"value_title": "mAs",
|
|
1080
|
+
"date_title": "Study date",
|
|
1081
|
+
"facet_title": facet_title,
|
|
1082
|
+
"sorting_choice": [
|
|
1083
|
+
user_profile.plotInitialSortingDirection,
|
|
1084
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1085
|
+
],
|
|
1086
|
+
"time_period": plot_timeunit_period,
|
|
1087
|
+
"average_choices": average_choices + ["count"],
|
|
1088
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1089
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1090
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1091
|
+
"filename": "OpenREM DX acquisition protocol mAs over time",
|
|
1092
|
+
"return_as_dict": return_as_dict,
|
|
1093
|
+
}
|
|
1094
|
+
result = construct_over_time_charts(
|
|
1095
|
+
df,
|
|
1096
|
+
parameter_dict,
|
|
1097
|
+
)
|
|
1098
|
+
|
|
1099
|
+
if user_profile.plotMean:
|
|
1100
|
+
return_structure["acquisitionMeanmAsOverTime"] = result["mean"]
|
|
1101
|
+
if user_profile.plotMedian:
|
|
1102
|
+
return_structure["acquisitionMedianmAsOverTime"] = result["median"]
|
|
1103
|
+
|
|
1104
|
+
if user_profile.plotDXAcquisitionDAPvsMass:
|
|
1105
|
+
parameter_dict = {
|
|
1106
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__acquisition_protocol",
|
|
1107
|
+
"df_x_col": "patientstudymoduleattr__patient_weight",
|
|
1108
|
+
"df_y_col": "projectionxrayradiationdose__irradeventxraydata__dose_area_product",
|
|
1109
|
+
"sorting_choice": [
|
|
1110
|
+
user_profile.plotInitialSortingDirection,
|
|
1111
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1112
|
+
],
|
|
1113
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1114
|
+
"legend_title": "Acquisition protocol",
|
|
1115
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1116
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1117
|
+
"x_axis_title": "Patient mass (kg)",
|
|
1118
|
+
"y_axis_title": "DAP (mGy.cm<sup>2</sub>)",
|
|
1119
|
+
"filename": "OpenREM DX acquisition protocol DAP vs patient mass",
|
|
1120
|
+
"return_as_dict": return_as_dict,
|
|
1121
|
+
}
|
|
1122
|
+
return_structure["acquisitionDAPvsMass"] = plotly_scatter(
|
|
1123
|
+
df,
|
|
1124
|
+
parameter_dict,
|
|
1125
|
+
)
|
|
1126
|
+
|
|
1127
|
+
if enable_standard_names:
|
|
1128
|
+
charts_of_interest = [
|
|
1129
|
+
user_profile.plotDXStandardAcquisitionMeanDAP,
|
|
1130
|
+
user_profile.plotDXStandardAcquisitionFreq,
|
|
1131
|
+
user_profile.plotDXStandardAcquisitionMeankVp,
|
|
1132
|
+
user_profile.plotDXStandardAcquisitionMeanmAs,
|
|
1133
|
+
user_profile.plotDXStandardAcquisitionMeankVpOverTime,
|
|
1134
|
+
user_profile.plotDXStandardAcquisitionMeanmAsOverTime,
|
|
1135
|
+
user_profile.plotDXStandardAcquisitionMeanDAPOverTime,
|
|
1136
|
+
user_profile.plotDXStandardAcquisitionDAPvsMass,
|
|
1137
|
+
]
|
|
1138
|
+
|
|
1139
|
+
if any(charts_of_interest):
|
|
1140
|
+
|
|
1141
|
+
# Exclude "Blank" and "blank" standard_acqusition_name data
|
|
1142
|
+
df_without_blanks = df[
|
|
1143
|
+
(
|
|
1144
|
+
df[
|
|
1145
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
1146
|
+
]
|
|
1147
|
+
!= "blank"
|
|
1148
|
+
)
|
|
1149
|
+
& (
|
|
1150
|
+
df[
|
|
1151
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
1152
|
+
]
|
|
1153
|
+
!= "Blank"
|
|
1154
|
+
)
|
|
1155
|
+
].copy()
|
|
1156
|
+
# Remove any unused categories (this will include "Blank" or "blank")
|
|
1157
|
+
df_without_blanks[
|
|
1158
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
1159
|
+
] = df_without_blanks[
|
|
1160
|
+
"projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
1161
|
+
].cat.remove_unused_categories()
|
|
1162
|
+
|
|
1163
|
+
if user_profile.plotDXStandardAcquisitionMeanDAP:
|
|
1164
|
+
name_field = "projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
1165
|
+
value_field = "projectionxrayradiationdose__irradeventxraydata__dose_area_product"
|
|
1166
|
+
value_text = "DAP"
|
|
1167
|
+
units_text = "(cGy.cm<sup>2</sup>)"
|
|
1168
|
+
name_text = "Standard acquisition name"
|
|
1169
|
+
variable_name_start = "standardAcquisition"
|
|
1170
|
+
variable_value_name = "DAP"
|
|
1171
|
+
modality_text = "DX"
|
|
1172
|
+
chart_message = ""
|
|
1173
|
+
|
|
1174
|
+
new_charts = generate_average_chart_group(
|
|
1175
|
+
average_choices,
|
|
1176
|
+
chart_message,
|
|
1177
|
+
df_without_blanks,
|
|
1178
|
+
modality_text,
|
|
1179
|
+
name_field,
|
|
1180
|
+
name_text,
|
|
1181
|
+
return_as_dict,
|
|
1182
|
+
return_structure,
|
|
1183
|
+
units_text,
|
|
1184
|
+
user_profile,
|
|
1185
|
+
value_field,
|
|
1186
|
+
value_text,
|
|
1187
|
+
variable_name_start,
|
|
1188
|
+
variable_value_name,
|
|
1189
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1190
|
+
)
|
|
1191
|
+
|
|
1192
|
+
return_structure = {**return_structure, **new_charts}
|
|
1193
|
+
|
|
1194
|
+
if user_profile.plotDXStandardAcquisitionMeankVp:
|
|
1195
|
+
name_field = "projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
1196
|
+
value_field = "projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__kvp__kvp"
|
|
1197
|
+
value_text = "kVp"
|
|
1198
|
+
units_text = ""
|
|
1199
|
+
name_text = "Standard acquisition name"
|
|
1200
|
+
variable_name_start = "standardAcquisition"
|
|
1201
|
+
variable_value_name = "kVp"
|
|
1202
|
+
modality_text = "DX"
|
|
1203
|
+
chart_message = ""
|
|
1204
|
+
|
|
1205
|
+
new_charts = generate_average_chart_group(
|
|
1206
|
+
average_choices,
|
|
1207
|
+
chart_message,
|
|
1208
|
+
df_without_blanks,
|
|
1209
|
+
modality_text,
|
|
1210
|
+
name_field,
|
|
1211
|
+
name_text,
|
|
1212
|
+
return_as_dict,
|
|
1213
|
+
return_structure,
|
|
1214
|
+
units_text,
|
|
1215
|
+
user_profile,
|
|
1216
|
+
value_field,
|
|
1217
|
+
value_text,
|
|
1218
|
+
variable_name_start,
|
|
1219
|
+
variable_value_name,
|
|
1220
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1221
|
+
)
|
|
1222
|
+
|
|
1223
|
+
return_structure = {**return_structure, **new_charts}
|
|
1224
|
+
|
|
1225
|
+
if user_profile.plotDXStandardAcquisitionMeanmAs:
|
|
1226
|
+
name_field = "projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name"
|
|
1227
|
+
value_field = "projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__exposure__exposure" # pylint: disable=line-too-long
|
|
1228
|
+
value_text = "mAs"
|
|
1229
|
+
units_text = ""
|
|
1230
|
+
name_text = "Standard acquisition name"
|
|
1231
|
+
variable_name_start = "standardAcquisition"
|
|
1232
|
+
variable_value_name = "mAs"
|
|
1233
|
+
modality_text = "DX"
|
|
1234
|
+
chart_message = ""
|
|
1235
|
+
|
|
1236
|
+
new_charts = generate_average_chart_group(
|
|
1237
|
+
average_choices,
|
|
1238
|
+
chart_message,
|
|
1239
|
+
df_without_blanks,
|
|
1240
|
+
modality_text,
|
|
1241
|
+
name_field,
|
|
1242
|
+
name_text,
|
|
1243
|
+
return_as_dict,
|
|
1244
|
+
return_structure,
|
|
1245
|
+
units_text,
|
|
1246
|
+
user_profile,
|
|
1247
|
+
value_field,
|
|
1248
|
+
value_text,
|
|
1249
|
+
variable_name_start,
|
|
1250
|
+
variable_value_name,
|
|
1251
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1252
|
+
)
|
|
1253
|
+
|
|
1254
|
+
return_structure = {**return_structure, **new_charts}
|
|
1255
|
+
|
|
1256
|
+
if user_profile.plotDXStandardAcquisitionFreq:
|
|
1257
|
+
parameter_dict = {
|
|
1258
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name", # pylint: disable=line-too-long
|
|
1259
|
+
"sorting_choice": [
|
|
1260
|
+
user_profile.plotInitialSortingDirection,
|
|
1261
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1262
|
+
],
|
|
1263
|
+
"legend_title": "Standard acquisition name",
|
|
1264
|
+
"df_x_axis_col": "x_ray_system_name",
|
|
1265
|
+
"x_axis_title": "System",
|
|
1266
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1267
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1268
|
+
"filename": "OpenREM DX standard acquisition name frequency",
|
|
1269
|
+
"groupby_cols": None,
|
|
1270
|
+
"facet_col": None,
|
|
1271
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1272
|
+
"return_as_dict": return_as_dict,
|
|
1273
|
+
}
|
|
1274
|
+
(
|
|
1275
|
+
return_structure["standardAcquisitionFrequencyData"],
|
|
1276
|
+
return_structure["standardAcquisitionFrequencyDataCSV"],
|
|
1277
|
+
) = plotly_frequency_barchart(
|
|
1278
|
+
df_without_blanks,
|
|
1279
|
+
parameter_dict,
|
|
1280
|
+
csv_name="standardAcquisitionFrequencyData.csv",
|
|
1281
|
+
)
|
|
1282
|
+
|
|
1283
|
+
if user_profile.plotDXStandardAcquisitionMeanDAPOverTime:
|
|
1284
|
+
facet_title = "System"
|
|
1285
|
+
|
|
1286
|
+
if user_profile.plotGroupingChoice == "series":
|
|
1287
|
+
facet_title = "Standard acquisition name"
|
|
1288
|
+
|
|
1289
|
+
parameter_dict = {
|
|
1290
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name", # pylint: disable=line-too-long
|
|
1291
|
+
"df_value_col": "projectionxrayradiationdose__irradeventxraydata__dose_area_product",
|
|
1292
|
+
"df_date_col": "study_date",
|
|
1293
|
+
"name_title": "Standard acquisition name",
|
|
1294
|
+
"value_title": "DAP (cGy.cm<sup>2</sup>)",
|
|
1295
|
+
"date_title": "Study date",
|
|
1296
|
+
"facet_title": facet_title,
|
|
1297
|
+
"sorting_choice": [
|
|
1298
|
+
user_profile.plotInitialSortingDirection,
|
|
1299
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1300
|
+
],
|
|
1301
|
+
"time_period": plot_timeunit_period,
|
|
1302
|
+
"average_choices": average_choices + ["count"],
|
|
1303
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1304
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1305
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1306
|
+
"filename": "OpenREM DX standard acquisition name DAP over time",
|
|
1307
|
+
"return_as_dict": return_as_dict,
|
|
1308
|
+
}
|
|
1309
|
+
result = construct_over_time_charts(
|
|
1310
|
+
df_without_blanks,
|
|
1311
|
+
parameter_dict,
|
|
1312
|
+
)
|
|
1313
|
+
|
|
1314
|
+
if user_profile.plotMean:
|
|
1315
|
+
return_structure["standardAcquisitionMeanDAPOverTime"] = result[
|
|
1316
|
+
"mean"
|
|
1317
|
+
]
|
|
1318
|
+
if user_profile.plotMedian:
|
|
1319
|
+
return_structure["standardAcquisitionMedianDAPOverTime"] = (
|
|
1320
|
+
result["median"]
|
|
1321
|
+
)
|
|
1322
|
+
|
|
1323
|
+
if user_profile.plotDXStandardAcquisitionMeankVpOverTime:
|
|
1324
|
+
facet_title = "System"
|
|
1325
|
+
|
|
1326
|
+
if user_profile.plotGroupingChoice == "series":
|
|
1327
|
+
facet_title = "Standard acquisition name"
|
|
1328
|
+
|
|
1329
|
+
parameter_dict = {
|
|
1330
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name", # pylint: disable=line-too-long
|
|
1331
|
+
"df_value_col": "projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__kvp__kvp", # pylint: disable=line-too-long
|
|
1332
|
+
"df_date_col": "study_date",
|
|
1333
|
+
"name_title": "Standard acquisition name",
|
|
1334
|
+
"value_title": "kVp",
|
|
1335
|
+
"date_title": "Study date",
|
|
1336
|
+
"facet_title": facet_title,
|
|
1337
|
+
"sorting_choice": [
|
|
1338
|
+
user_profile.plotInitialSortingDirection,
|
|
1339
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1340
|
+
],
|
|
1341
|
+
"time_period": plot_timeunit_period,
|
|
1342
|
+
"average_choices": average_choices + ["count"],
|
|
1343
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1344
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1345
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1346
|
+
"filename": "OpenREM DX standard acquisition name kVp over time",
|
|
1347
|
+
"return_as_dict": return_as_dict,
|
|
1348
|
+
}
|
|
1349
|
+
result = construct_over_time_charts(
|
|
1350
|
+
df_without_blanks,
|
|
1351
|
+
parameter_dict,
|
|
1352
|
+
)
|
|
1353
|
+
|
|
1354
|
+
if user_profile.plotMean:
|
|
1355
|
+
return_structure["standardAcquisitionMeankVpOverTime"] = result[
|
|
1356
|
+
"mean"
|
|
1357
|
+
]
|
|
1358
|
+
if user_profile.plotMedian:
|
|
1359
|
+
return_structure["standardAcquisitionMediankVpOverTime"] = (
|
|
1360
|
+
result["median"]
|
|
1361
|
+
)
|
|
1362
|
+
|
|
1363
|
+
if user_profile.plotDXStandardAcquisitionMeanmAsOverTime:
|
|
1364
|
+
facet_title = "System"
|
|
1365
|
+
|
|
1366
|
+
if user_profile.plotGroupingChoice == "series":
|
|
1367
|
+
facet_title = "Standard acquisition name"
|
|
1368
|
+
|
|
1369
|
+
parameter_dict = {
|
|
1370
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name", # pylint: disable=line-too-long
|
|
1371
|
+
"df_value_col": "projectionxrayradiationdose__irradeventxraydata__irradeventxraysourcedata__exposure__exposure", # pylint: disable=line-too-long
|
|
1372
|
+
"df_date_col": "study_date",
|
|
1373
|
+
"name_title": "Standard acquisition name",
|
|
1374
|
+
"value_title": "mAs",
|
|
1375
|
+
"date_title": "Study date",
|
|
1376
|
+
"facet_title": facet_title,
|
|
1377
|
+
"sorting_choice": [
|
|
1378
|
+
user_profile.plotInitialSortingDirection,
|
|
1379
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1380
|
+
],
|
|
1381
|
+
"time_period": plot_timeunit_period,
|
|
1382
|
+
"average_choices": average_choices + ["count"],
|
|
1383
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1384
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1385
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1386
|
+
"filename": "OpenREM DX standard acquisition name mAs over time",
|
|
1387
|
+
"return_as_dict": return_as_dict,
|
|
1388
|
+
}
|
|
1389
|
+
result = construct_over_time_charts(
|
|
1390
|
+
df_without_blanks,
|
|
1391
|
+
parameter_dict,
|
|
1392
|
+
)
|
|
1393
|
+
|
|
1394
|
+
if user_profile.plotMean:
|
|
1395
|
+
return_structure["standardAcquisitionMeanmAsOverTime"] = result[
|
|
1396
|
+
"mean"
|
|
1397
|
+
]
|
|
1398
|
+
if user_profile.plotMedian:
|
|
1399
|
+
return_structure["standardAcquisitionMedianmAsOverTime"] = (
|
|
1400
|
+
result["median"]
|
|
1401
|
+
)
|
|
1402
|
+
|
|
1403
|
+
if user_profile.plotDXStandardAcquisitionDAPvsMass:
|
|
1404
|
+
parameter_dict = {
|
|
1405
|
+
"df_name_col": "projectionxrayradiationdose__irradeventxraydata__standard_protocols__standard_name", # pylint: disable=line-too-long
|
|
1406
|
+
"df_x_col": "patientstudymoduleattr__patient_weight",
|
|
1407
|
+
"df_y_col": "projectionxrayradiationdose__irradeventxraydata__dose_area_product",
|
|
1408
|
+
"sorting_choice": [
|
|
1409
|
+
user_profile.plotInitialSortingDirection,
|
|
1410
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1411
|
+
],
|
|
1412
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1413
|
+
"legend_title": "Standard acquisition name",
|
|
1414
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1415
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1416
|
+
"x_axis_title": "Patient mass (kg)",
|
|
1417
|
+
"y_axis_title": "DAP (mGy.cm<sup>2</sub>)",
|
|
1418
|
+
"filename": "OpenREM DX standard acquisition name DAP vs patient mass",
|
|
1419
|
+
"return_as_dict": return_as_dict,
|
|
1420
|
+
}
|
|
1421
|
+
return_structure["standardAcquisitionDAPvsMass"] = plotly_scatter(
|
|
1422
|
+
df_without_blanks,
|
|
1423
|
+
parameter_dict,
|
|
1424
|
+
)
|
|
1425
|
+
|
|
1426
|
+
#######################################################################
|
|
1427
|
+
# Prepare study- and request-level Pandas DataFrame to use for charts
|
|
1428
|
+
charts_of_interest = [
|
|
1429
|
+
user_profile.plotDXStudyMeanDAP,
|
|
1430
|
+
user_profile.plotDXStudyFreq,
|
|
1431
|
+
user_profile.plotDXStudyPerDayAndHour,
|
|
1432
|
+
user_profile.plotDXStudyDAPvsMass,
|
|
1433
|
+
user_profile.plotDXRequestMeanDAP,
|
|
1434
|
+
user_profile.plotDXRequestFreq,
|
|
1435
|
+
user_profile.plotDXRequestDAPvsMass,
|
|
1436
|
+
]
|
|
1437
|
+
if enable_standard_names:
|
|
1438
|
+
charts_of_interest.append(user_profile.plotDXStandardStudyMeanDAP)
|
|
1439
|
+
charts_of_interest.append(user_profile.plotDXStandardStudyFreq)
|
|
1440
|
+
charts_of_interest.append(user_profile.plotDXStandardStudyPerDayAndHour)
|
|
1441
|
+
charts_of_interest.append(user_profile.plotDXStandardStudyDAPvsMass)
|
|
1442
|
+
|
|
1443
|
+
if any(charts_of_interest):
|
|
1444
|
+
|
|
1445
|
+
name_fields = []
|
|
1446
|
+
charts_of_interest = [
|
|
1447
|
+
user_profile.plotDXStudyMeanDAP,
|
|
1448
|
+
user_profile.plotDXStudyFreq,
|
|
1449
|
+
user_profile.plotDXStudyPerDayAndHour,
|
|
1450
|
+
user_profile.plotDXStudyDAPvsMass,
|
|
1451
|
+
]
|
|
1452
|
+
if any(charts_of_interest):
|
|
1453
|
+
name_fields.append("study_description")
|
|
1454
|
+
|
|
1455
|
+
charts_of_interest = [
|
|
1456
|
+
user_profile.plotDXRequestMeanDAP,
|
|
1457
|
+
user_profile.plotDXRequestFreq,
|
|
1458
|
+
user_profile.plotDXRequestDAPvsMass,
|
|
1459
|
+
]
|
|
1460
|
+
if any(charts_of_interest):
|
|
1461
|
+
name_fields.append("requested_procedure_code_meaning")
|
|
1462
|
+
|
|
1463
|
+
if enable_standard_names:
|
|
1464
|
+
charts_of_interest = [
|
|
1465
|
+
user_profile.plotDXStandardStudyMeanDAP,
|
|
1466
|
+
user_profile.plotDXStandardStudyFreq,
|
|
1467
|
+
user_profile.plotDXStandardStudyPerDayAndHour,
|
|
1468
|
+
user_profile.plotDXStandardStudyDAPvsMass,
|
|
1469
|
+
]
|
|
1470
|
+
if any(charts_of_interest):
|
|
1471
|
+
name_fields.append("standard_names__standard_name")
|
|
1472
|
+
|
|
1473
|
+
value_fields = []
|
|
1474
|
+
value_multipliers = []
|
|
1475
|
+
charts_of_interest = [
|
|
1476
|
+
user_profile.plotDXStudyMeanDAP,
|
|
1477
|
+
user_profile.plotDXRequestMeanDAP,
|
|
1478
|
+
user_profile.plotDXStudyDAPvsMass,
|
|
1479
|
+
user_profile.plotDXRequestDAPvsMass,
|
|
1480
|
+
]
|
|
1481
|
+
if enable_standard_names:
|
|
1482
|
+
charts_of_interest.append(user_profile.plotDXStandardStudyMeanDAP)
|
|
1483
|
+
charts_of_interest.append(user_profile.plotDXStandardStudyDAPvsMass)
|
|
1484
|
+
|
|
1485
|
+
if any(charts_of_interest):
|
|
1486
|
+
value_fields.append("total_dap")
|
|
1487
|
+
value_multipliers.append(1000000)
|
|
1488
|
+
|
|
1489
|
+
charts_of_interest = [
|
|
1490
|
+
user_profile.plotDXStudyDAPvsMass,
|
|
1491
|
+
user_profile.plotDXRequestDAPvsMass,
|
|
1492
|
+
]
|
|
1493
|
+
if enable_standard_names:
|
|
1494
|
+
charts_of_interest.append(user_profile.plotDXStandardStudyDAPvsMass)
|
|
1495
|
+
|
|
1496
|
+
if any(charts_of_interest):
|
|
1497
|
+
value_fields.append("patientstudymoduleattr__patient_weight")
|
|
1498
|
+
value_multipliers.append(1)
|
|
1499
|
+
|
|
1500
|
+
date_fields = []
|
|
1501
|
+
time_fields = []
|
|
1502
|
+
charts_of_interest = [user_profile.plotDXStudyPerDayAndHour]
|
|
1503
|
+
if enable_standard_names:
|
|
1504
|
+
charts_of_interest.append(user_profile.plotDXStandardStudyPerDayAndHour)
|
|
1505
|
+
|
|
1506
|
+
if any(charts_of_interest):
|
|
1507
|
+
date_fields.append("study_date")
|
|
1508
|
+
time_fields.append("study_time")
|
|
1509
|
+
|
|
1510
|
+
system_field = []
|
|
1511
|
+
if user_profile.plotSeriesPerSystem:
|
|
1512
|
+
system_field.append(
|
|
1513
|
+
"generalequipmentmoduleattr__unique_equipment_name_id__display_name"
|
|
1514
|
+
)
|
|
1515
|
+
|
|
1516
|
+
fields = {
|
|
1517
|
+
"names": name_fields,
|
|
1518
|
+
"values": value_fields,
|
|
1519
|
+
"dates": date_fields,
|
|
1520
|
+
"times": time_fields,
|
|
1521
|
+
"system": system_field,
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
# If only standard_names__standard_name is required then exclude all entries where these are None as these are
|
|
1525
|
+
# not required for standard name charts.
|
|
1526
|
+
queryset = f.qs
|
|
1527
|
+
if name_fields == ["standard_names__standard_name"]:
|
|
1528
|
+
queryset = queryset.exclude(standard_names__standard_name__isnull=True)
|
|
1529
|
+
|
|
1530
|
+
df = create_dataframe(
|
|
1531
|
+
queryset,
|
|
1532
|
+
fields,
|
|
1533
|
+
data_point_name_lowercase=user_profile.plotCaseInsensitiveCategories,
|
|
1534
|
+
data_point_name_remove_whitespace_padding=user_profile.plotRemoveCategoryWhitespacePadding,
|
|
1535
|
+
data_point_value_multipliers=value_multipliers,
|
|
1536
|
+
char_wrap=user_profile.plotLabelCharWrap,
|
|
1537
|
+
uid="pk",
|
|
1538
|
+
)
|
|
1539
|
+
#######################################################################
|
|
1540
|
+
|
|
1541
|
+
if user_profile.plotDXStudyMeanDAP:
|
|
1542
|
+
|
|
1543
|
+
name_field = "study_description"
|
|
1544
|
+
value_field = "total_dap"
|
|
1545
|
+
value_text = "DAP"
|
|
1546
|
+
units_text = "(cGy.cm<sup>2</sup>)"
|
|
1547
|
+
name_text = "Study description"
|
|
1548
|
+
variable_name_start = "study"
|
|
1549
|
+
variable_value_name = "DAP"
|
|
1550
|
+
modality_text = "DX"
|
|
1551
|
+
chart_message = ""
|
|
1552
|
+
|
|
1553
|
+
new_charts = generate_average_chart_group(
|
|
1554
|
+
average_choices,
|
|
1555
|
+
chart_message,
|
|
1556
|
+
df,
|
|
1557
|
+
modality_text,
|
|
1558
|
+
name_field,
|
|
1559
|
+
name_text,
|
|
1560
|
+
return_as_dict,
|
|
1561
|
+
return_structure,
|
|
1562
|
+
units_text,
|
|
1563
|
+
user_profile,
|
|
1564
|
+
value_field,
|
|
1565
|
+
value_text,
|
|
1566
|
+
variable_name_start,
|
|
1567
|
+
variable_value_name,
|
|
1568
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1569
|
+
)
|
|
1570
|
+
|
|
1571
|
+
return_structure = {**return_structure, **new_charts}
|
|
1572
|
+
|
|
1573
|
+
if user_profile.plotDXStudyFreq:
|
|
1574
|
+
parameter_dict = {
|
|
1575
|
+
"df_name_col": "study_description",
|
|
1576
|
+
"sorting_choice": [
|
|
1577
|
+
user_profile.plotInitialSortingDirection,
|
|
1578
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1579
|
+
],
|
|
1580
|
+
"legend_title": "Study description",
|
|
1581
|
+
"df_x_axis_col": "x_ray_system_name",
|
|
1582
|
+
"x_axis_title": "System",
|
|
1583
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1584
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1585
|
+
"filename": "OpenREM DX study description frequency",
|
|
1586
|
+
"groupby_cols": None,
|
|
1587
|
+
"facet_col": None,
|
|
1588
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1589
|
+
"return_as_dict": return_as_dict,
|
|
1590
|
+
}
|
|
1591
|
+
(
|
|
1592
|
+
return_structure["studyFrequencyData"],
|
|
1593
|
+
return_structure["studyFrequencyDataCSV"],
|
|
1594
|
+
) = plotly_frequency_barchart( # pylint: disable=line-too-long
|
|
1595
|
+
df,
|
|
1596
|
+
parameter_dict,
|
|
1597
|
+
csv_name="studyFrequencyData.csv",
|
|
1598
|
+
)
|
|
1599
|
+
|
|
1600
|
+
if user_profile.plotDXRequestMeanDAP:
|
|
1601
|
+
|
|
1602
|
+
name_field = "requested_procedure_code_meaning"
|
|
1603
|
+
value_field = "total_dap"
|
|
1604
|
+
value_text = "DAP"
|
|
1605
|
+
units_text = "(cGy.cm<sup>2</sup>)"
|
|
1606
|
+
name_text = "Requested procedure"
|
|
1607
|
+
variable_name_start = "request"
|
|
1608
|
+
variable_value_name = "DAP"
|
|
1609
|
+
modality_text = "DX"
|
|
1610
|
+
chart_message = ""
|
|
1611
|
+
|
|
1612
|
+
new_charts = generate_average_chart_group(
|
|
1613
|
+
average_choices,
|
|
1614
|
+
chart_message,
|
|
1615
|
+
df,
|
|
1616
|
+
modality_text,
|
|
1617
|
+
name_field,
|
|
1618
|
+
name_text,
|
|
1619
|
+
return_as_dict,
|
|
1620
|
+
return_structure,
|
|
1621
|
+
units_text,
|
|
1622
|
+
user_profile,
|
|
1623
|
+
value_field,
|
|
1624
|
+
value_text,
|
|
1625
|
+
variable_name_start,
|
|
1626
|
+
variable_value_name,
|
|
1627
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1628
|
+
)
|
|
1629
|
+
|
|
1630
|
+
return_structure = {**return_structure, **new_charts}
|
|
1631
|
+
|
|
1632
|
+
if user_profile.plotDXRequestFreq:
|
|
1633
|
+
parameter_dict = {
|
|
1634
|
+
"df_name_col": "requested_procedure_code_meaning",
|
|
1635
|
+
"sorting_choice": [
|
|
1636
|
+
user_profile.plotInitialSortingDirection,
|
|
1637
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1638
|
+
],
|
|
1639
|
+
"legend_title": "Requested procedure",
|
|
1640
|
+
"df_x_axis_col": "x_ray_system_name",
|
|
1641
|
+
"x_axis_title": "System",
|
|
1642
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1643
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1644
|
+
"filename": "OpenREM DX requested procedure frequency",
|
|
1645
|
+
"groupby_cols": None,
|
|
1646
|
+
"facet_col": None,
|
|
1647
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1648
|
+
"return_as_dict": return_as_dict,
|
|
1649
|
+
}
|
|
1650
|
+
(
|
|
1651
|
+
return_structure["requestFrequencyData"],
|
|
1652
|
+
return_structure["requestFrequencyDataCSV"],
|
|
1653
|
+
) = plotly_frequency_barchart( # pylint: disable=line-too-long
|
|
1654
|
+
df,
|
|
1655
|
+
parameter_dict,
|
|
1656
|
+
csv_name="requestFrequencyData.csv",
|
|
1657
|
+
)
|
|
1658
|
+
|
|
1659
|
+
if user_profile.plotDXStudyPerDayAndHour:
|
|
1660
|
+
df_time_series_per_weekday = create_dataframe_weekdays(
|
|
1661
|
+
df, "study_description", df_date_col="study_date"
|
|
1662
|
+
)
|
|
1663
|
+
|
|
1664
|
+
return_structure["studyWorkloadData"] = plotly_barchart_weekdays(
|
|
1665
|
+
df_time_series_per_weekday,
|
|
1666
|
+
"weekday",
|
|
1667
|
+
"study_description",
|
|
1668
|
+
name_axis_title="Weekday",
|
|
1669
|
+
value_axis_title="Frequency",
|
|
1670
|
+
colourmap=user_profile.plotColourMapChoice,
|
|
1671
|
+
filename="OpenREM DX study description workload",
|
|
1672
|
+
facet_col_wrap=user_profile.plotFacetColWrapVal,
|
|
1673
|
+
sorting_choice=[
|
|
1674
|
+
user_profile.plotInitialSortingDirection,
|
|
1675
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1676
|
+
],
|
|
1677
|
+
return_as_dict=return_as_dict,
|
|
1678
|
+
)
|
|
1679
|
+
|
|
1680
|
+
if user_profile.plotDXStudyDAPvsMass:
|
|
1681
|
+
parameter_dict = {
|
|
1682
|
+
"df_name_col": "study_description",
|
|
1683
|
+
"df_x_col": "patientstudymoduleattr__patient_weight",
|
|
1684
|
+
"df_y_col": "total_dap",
|
|
1685
|
+
"sorting_choice": [
|
|
1686
|
+
user_profile.plotInitialSortingDirection,
|
|
1687
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1688
|
+
],
|
|
1689
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1690
|
+
"legend_title": "Study description",
|
|
1691
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1692
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1693
|
+
"x_axis_title": "Patient mass (kg)",
|
|
1694
|
+
"y_axis_title": "DAP (mGy.cm<sup>2</sub>)",
|
|
1695
|
+
"filename": "OpenREM DX study description DAP vs patient mass",
|
|
1696
|
+
"return_as_dict": return_as_dict,
|
|
1697
|
+
}
|
|
1698
|
+
return_structure["studyDAPvsMass"] = plotly_scatter(
|
|
1699
|
+
df,
|
|
1700
|
+
parameter_dict,
|
|
1701
|
+
)
|
|
1702
|
+
|
|
1703
|
+
if user_profile.plotDXRequestDAPvsMass:
|
|
1704
|
+
parameter_dict = {
|
|
1705
|
+
"df_name_col": "requested_procedure_code_meaning",
|
|
1706
|
+
"df_x_col": "patientstudymoduleattr__patient_weight",
|
|
1707
|
+
"df_y_col": "total_dap",
|
|
1708
|
+
"sorting_choice": [
|
|
1709
|
+
user_profile.plotInitialSortingDirection,
|
|
1710
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1711
|
+
],
|
|
1712
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1713
|
+
"legend_title": "Requested procedure",
|
|
1714
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1715
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1716
|
+
"x_axis_title": "Patient mass (kg)",
|
|
1717
|
+
"y_axis_title": "DAP (mGy.cm<sup>2</sub>)",
|
|
1718
|
+
"filename": "OpenREM DX requested procedure DAP vs patient mass",
|
|
1719
|
+
"return_as_dict": return_as_dict,
|
|
1720
|
+
}
|
|
1721
|
+
return_structure["requestDAPvsMass"] = plotly_scatter(
|
|
1722
|
+
df,
|
|
1723
|
+
parameter_dict,
|
|
1724
|
+
)
|
|
1725
|
+
|
|
1726
|
+
if enable_standard_names:
|
|
1727
|
+
charts_of_interest = [
|
|
1728
|
+
user_profile.plotDXStandardStudyMeanDAP,
|
|
1729
|
+
user_profile.plotDXStandardStudyFreq,
|
|
1730
|
+
user_profile.plotDXStandardStudyPerDayAndHour,
|
|
1731
|
+
user_profile.plotDXStandardStudyDAPvsMass,
|
|
1732
|
+
]
|
|
1733
|
+
|
|
1734
|
+
if any(charts_of_interest):
|
|
1735
|
+
|
|
1736
|
+
# Create a standard name data frame - remove any blank standard names
|
|
1737
|
+
standard_name_df = df[
|
|
1738
|
+
(df["standard_names__standard_name"] != "blank")
|
|
1739
|
+
& (df["standard_names__standard_name"] != "Blank")
|
|
1740
|
+
].copy()
|
|
1741
|
+
# Remove any unused categories (this will include "Blank" or "blank")
|
|
1742
|
+
standard_name_df["standard_names__standard_name"] = standard_name_df[
|
|
1743
|
+
"standard_names__standard_name"
|
|
1744
|
+
].cat.remove_unused_categories()
|
|
1745
|
+
|
|
1746
|
+
if user_profile.plotDXStandardStudyMeanDAP:
|
|
1747
|
+
|
|
1748
|
+
name_field = "standard_names__standard_name"
|
|
1749
|
+
value_field = "total_dap"
|
|
1750
|
+
value_text = "DAP"
|
|
1751
|
+
units_text = "(cGy.cm<sup>2</sup>)"
|
|
1752
|
+
name_text = "Standard study name"
|
|
1753
|
+
variable_name_start = "standardStudy"
|
|
1754
|
+
variable_value_name = "DAP"
|
|
1755
|
+
modality_text = "DX"
|
|
1756
|
+
chart_message = ""
|
|
1757
|
+
|
|
1758
|
+
new_charts = generate_average_chart_group(
|
|
1759
|
+
average_choices,
|
|
1760
|
+
chart_message,
|
|
1761
|
+
standard_name_df,
|
|
1762
|
+
modality_text,
|
|
1763
|
+
name_field,
|
|
1764
|
+
name_text,
|
|
1765
|
+
return_as_dict,
|
|
1766
|
+
return_structure,
|
|
1767
|
+
units_text,
|
|
1768
|
+
user_profile,
|
|
1769
|
+
value_field,
|
|
1770
|
+
value_text,
|
|
1771
|
+
variable_name_start,
|
|
1772
|
+
variable_value_name,
|
|
1773
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1774
|
+
)
|
|
1775
|
+
|
|
1776
|
+
return_structure = {**return_structure, **new_charts}
|
|
1777
|
+
|
|
1778
|
+
if user_profile.plotDXStandardStudyFreq:
|
|
1779
|
+
parameter_dict = {
|
|
1780
|
+
"df_name_col": "standard_names__standard_name",
|
|
1781
|
+
"sorting_choice": [
|
|
1782
|
+
user_profile.plotInitialSortingDirection,
|
|
1783
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1784
|
+
],
|
|
1785
|
+
"legend_title": "Standard study name",
|
|
1786
|
+
"df_x_axis_col": "x_ray_system_name",
|
|
1787
|
+
"x_axis_title": "System",
|
|
1788
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1789
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1790
|
+
"filename": "OpenREM DX standard study name frequency",
|
|
1791
|
+
"groupby_cols": None,
|
|
1792
|
+
"facet_col": None,
|
|
1793
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1794
|
+
"return_as_dict": return_as_dict,
|
|
1795
|
+
}
|
|
1796
|
+
(
|
|
1797
|
+
return_structure["standardStudyFrequencyData"],
|
|
1798
|
+
return_structure["standardStudyFrequencyDataCSV"],
|
|
1799
|
+
) = plotly_frequency_barchart( # pylint: disable=line-too-long
|
|
1800
|
+
standard_name_df,
|
|
1801
|
+
parameter_dict,
|
|
1802
|
+
csv_name="standardStudyFrequencyData.csv",
|
|
1803
|
+
)
|
|
1804
|
+
|
|
1805
|
+
if user_profile.plotDXStandardStudyPerDayAndHour:
|
|
1806
|
+
df_time_series_per_weekday = create_dataframe_weekdays(
|
|
1807
|
+
standard_name_df,
|
|
1808
|
+
"standard_names__standard_name",
|
|
1809
|
+
df_date_col="study_date",
|
|
1810
|
+
)
|
|
1811
|
+
|
|
1812
|
+
return_structure["standardStudyWorkloadData"] = (
|
|
1813
|
+
plotly_barchart_weekdays(
|
|
1814
|
+
df_time_series_per_weekday,
|
|
1815
|
+
"weekday",
|
|
1816
|
+
"standard_names__standard_name",
|
|
1817
|
+
name_axis_title="Weekday",
|
|
1818
|
+
value_axis_title="Frequency",
|
|
1819
|
+
colourmap=user_profile.plotColourMapChoice,
|
|
1820
|
+
filename="OpenREM DX standard study name workload",
|
|
1821
|
+
facet_col_wrap=user_profile.plotFacetColWrapVal,
|
|
1822
|
+
sorting_choice=[
|
|
1823
|
+
user_profile.plotInitialSortingDirection,
|
|
1824
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1825
|
+
],
|
|
1826
|
+
return_as_dict=return_as_dict,
|
|
1827
|
+
)
|
|
1828
|
+
)
|
|
1829
|
+
|
|
1830
|
+
if user_profile.plotDXStandardStudyDAPvsMass:
|
|
1831
|
+
parameter_dict = {
|
|
1832
|
+
"df_name_col": "standard_names__standard_name",
|
|
1833
|
+
"df_x_col": "patientstudymoduleattr__patient_weight",
|
|
1834
|
+
"df_y_col": "total_dap",
|
|
1835
|
+
"sorting_choice": [
|
|
1836
|
+
user_profile.plotInitialSortingDirection,
|
|
1837
|
+
user_profile.plotDXInitialSortingChoice,
|
|
1838
|
+
],
|
|
1839
|
+
"grouping_choice": user_profile.plotGroupingChoice,
|
|
1840
|
+
"legend_title": "Standard study name",
|
|
1841
|
+
"colourmap": user_profile.plotColourMapChoice,
|
|
1842
|
+
"facet_col_wrap": user_profile.plotFacetColWrapVal,
|
|
1843
|
+
"x_axis_title": "Patient mass (kg)",
|
|
1844
|
+
"y_axis_title": "DAP (mGy.cm<sup>2</sub>)",
|
|
1845
|
+
"filename": "OpenREM DX standard study name DAP vs patient mass",
|
|
1846
|
+
"return_as_dict": return_as_dict,
|
|
1847
|
+
}
|
|
1848
|
+
return_structure["standardStudyDAPvsMass"] = plotly_scatter(
|
|
1849
|
+
standard_name_df,
|
|
1850
|
+
parameter_dict,
|
|
1851
|
+
)
|
|
1852
|
+
|
|
1853
|
+
return return_structure
|
|
1854
|
+
|
|
1855
|
+
|
|
1856
|
+
def dx_chart_form_processing(request, user_profile):
|
|
1857
|
+
# pylint: disable=too-many-statements
|
|
1858
|
+
|
|
1859
|
+
# Obtain the system-level enable_standard_names setting
|
|
1860
|
+
enable_standard_names = are_standard_names_enabled()
|
|
1861
|
+
|
|
1862
|
+
# Obtain the chart options from the request
|
|
1863
|
+
chart_options_form = None
|
|
1864
|
+
if enable_standard_names:
|
|
1865
|
+
chart_options_form = DXChartOptionsFormIncStandard(request.GET)
|
|
1866
|
+
else:
|
|
1867
|
+
chart_options_form = DXChartOptionsForm(request.GET)
|
|
1868
|
+
|
|
1869
|
+
# check whether the form data is valid
|
|
1870
|
+
if chart_options_form.is_valid():
|
|
1871
|
+
# Use the form data if the user clicked on the submit button
|
|
1872
|
+
if "submit" in request.GET:
|
|
1873
|
+
# process the data in form.cleaned_data as required
|
|
1874
|
+
|
|
1875
|
+
set_common_chart_options(chart_options_form, user_profile)
|
|
1876
|
+
|
|
1877
|
+
set_average_chart_options(chart_options_form, user_profile)
|
|
1878
|
+
|
|
1879
|
+
set_dx_chart_options(chart_options_form, user_profile)
|
|
1880
|
+
|
|
1881
|
+
user_profile.save()
|
|
1882
|
+
|
|
1883
|
+
# If submit was not clicked then use the settings already stored in the user's profile
|
|
1884
|
+
else:
|
|
1885
|
+
average_choices = required_average_choices(user_profile)
|
|
1886
|
+
|
|
1887
|
+
dx_form_data = initialise_dx_form_data(user_profile)
|
|
1888
|
+
|
|
1889
|
+
form_data = {
|
|
1890
|
+
"plotCharts": user_profile.plotCharts,
|
|
1891
|
+
"plotGrouping": user_profile.plotGroupingChoice,
|
|
1892
|
+
"plotSeriesPerSystem": user_profile.plotSeriesPerSystem,
|
|
1893
|
+
"plotHistograms": user_profile.plotHistograms,
|
|
1894
|
+
"plotInitialSortingDirection": user_profile.plotInitialSortingDirection,
|
|
1895
|
+
"plotAverageChoice": average_choices,
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
form_data = {**form_data, **dx_form_data}
|
|
1899
|
+
|
|
1900
|
+
chart_options_form = None
|
|
1901
|
+
if enable_standard_names:
|
|
1902
|
+
chart_options_form = DXChartOptionsFormIncStandard(form_data)
|
|
1903
|
+
else:
|
|
1904
|
+
chart_options_form = DXChartOptionsForm(form_data)
|
|
1905
|
+
|
|
1906
|
+
return chart_options_form
|