Seeing "sanity check fails for dataframe in SJOG prod data
Opened this issue · 2 comments
[ERROR:2023-05-15 14:46:06,946:log.py:224:log_response] Internal Server Error: /crcmi/dash/app/SinglePatientDashboardApp/_dash-update-component
Traceback (most recent call last):
File "/env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/env/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/env/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/env/lib/python3.8/site-packages/django_plotly_dash/views.py", line 74, in update
return _update(request, ident, stateless, **kwargs)
File "/env/lib/python3.8/site-packages/django_plotly_dash/views.py", line 91, in _update
resp = app.dispatch_with_args(request_body, arg_map)
File "/env/lib/python3.8/site-packages/django_plotly_dash/dash_wrapper.py", line 700, in dispatch_with_args
res = callback(*args, **argMap)
File "/env/lib/python3.8/site-packages/django_plotly_dash/callback.py", line 82, in add_context
output_value = func(*func_args, **func_kwargs) # %% callback invoked %%
File "/env/lib/python3.8/site-packages/dashboards/dash_apps.py", line 87, in render_tab_content
graphics_map = get_single_patient_graphics_map(
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 230, in get_single_patient_graphics_map
graphics_map = {
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 231, in
f"tab{vc.id}": create_graphic(vc, data, patient, None, static_followups)
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 138, in wrapper
return func(vis_config, data, patient, all_patients_data, static_followups)
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 175, in create_graphic
return ScaleGroupComparison(
File "/env/lib/python3.8/site-packages/dashboards/components/common.py", line 58, in graphic
return self.get_graphic()
File "/env/lib/python3.8/site-packages/dashboards/components/sgc.py", line 95, in get_graphic
self.load_all_patients_data()
File "/env/lib/python3.8/site-packages/dashboards/components/sgc.py", line 524, in load_all_patients_data
sanity_check("in load all", self.all_patients_data)
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 284, in sanity_check
raise DataFrameError(
dashboards.utils.DataFrameError: in load all followup should have seq > 0: FollowUpProms has seq = 0
[INFO:2023-05-15 14:46:26,135:dash_apps.py:71:render_tab_content] active tab tab_9
[INFO:2023-05-15 14:46:26,467:data.py:103:init] time taken to load/generate df = 0.024986 seconds
[INFO:2023-05-15 14:46:27,023:data.py:88:init] loading dataframe from base config json
[INFO:2023-05-15 14:46:27,190:dash_apps.py:132:] all_app defined
[INFO:2023-05-15 14:46:27,395:data.py:103:init] time taken to load/generate df = 0.372242 seconds
[ERROR:2023-05-15 14:46:27,737:log.py:224:log_response] Internal Server Error: /crcmi/dash/app/SinglePatientDashboardApp/_dash-update-component
Traceback (most recent call last):
File "/env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/env/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/env/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/env/lib/python3.8/site-packages/django_plotly_dash/views.py", line 74, in update
return _update(request, ident, stateless, **kwargs)
File "/env/lib/python3.8/site-packages/django_plotly_dash/views.py", line 91, in _update
resp = app.dispatch_with_args(request_body, arg_map)
File "/env/lib/python3.8/site-packages/django_plotly_dash/dash_wrapper.py", line 700, in dispatch_with_args
res = callback(*args, **argMap)
File "/env/lib/python3.8/site-packages/django_plotly_dash/callback.py", line 82, in add_context
output_value = func(*func_args, **func_kwargs) # %% callback invoked %%
File "/env/lib/python3.8/site-packages/dashboards/dash_apps.py", line 87, in render_tab_content
graphics_map = get_single_patient_graphics_map(
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 230, in get_single_patient_graphics_map
graphics_map = {
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 231, in
f"tab{vc.id}": create_graphic(vc, data, patient, None, static_followups)
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 138, in wrapper
return func(vis_config, data, patient, all_patients_data, static_followups)
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 175, in create_graphic
return ScaleGroupComparison(
File "/env/lib/python3.8/site-packages/dashboards/components/common.py", line 58, in graphic
return self.get_graphic()
File "/env/lib/python3.8/site-packages/dashboards/components/sgc.py", line 95, in get_graphic
self.load_all_patients_data()
File "/env/lib/python3.8/site-packages/dashboards/components/sgc.py", line 524, in load_all_patients_data
sanity_check("in load all", self.all_patients_data)
File "/env/lib/python3.8/site-packages/dashboards/utils.py", line 284, in sanity_check
raise DataFrameError(
This is caused when a followup doesn't have a collection date or is before or equal to the collection date of the baseline ( for any patient) - it screws up everyones dashboard as the sanity check occurs on each sgc component
better to make it less brittle or enforce the collection date policy - on SjOG prod the collection date field was introduced after some followups collected and the dates are empty