Scout: Case page crashes when case has analysis_date type=string

Created on 5 Nov 2019  路  8Comments  路  Source: Clinical-Genomics/scout

Traceback (most recent call last):
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/utils.py", line 26, in decorated_function
return render_template(template_name, *context)
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/flask/templating.py", line 140, in render_template
ctx.app,
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, *
kwargs)
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/blueprints/cases/templates/cases/cases.html", line 285, in top-level template code
chr{{clinvar.chromosome}}:{{clinvar.breakpoint1}}_{{clinvar.var_type}}
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/templates/layout_bs4.html", line 1, in top-level template code
{% extends "bootstrap4.html" %}
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/templates/bootstrap4.html", line 18, in top-level template code
{% block body %}
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/templates/bootstrap4.html", line 21, in block "body"
{% block content %}
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/templates/layout_bs4.html", line 80, in block "content"
{% block content_main %}{% endblock %}
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/blueprints/cases/templates/cases/cases.html", line 88, in block "content_main"

{{ cases_table(group_name, case_group) }}

File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/jinja2/runtime.py", line 574, in _invoke
rv = self._func(arguments)
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/blueprints/cases/templates/cases/cases.html", line 180, in template
{{ case_row(case) }}
File "/home/hiseq.clinical/miniconda/envs/prod-stage/lib/python3.6/site-packages/jinja2/runtime.py", line 574, in _invoke
rv = self._func(
arguments)
File "/home/hiseq.clinical/SERVER/apps/scout-stage/git/scout-stage/scout/server/blueprints/cases/templates/cases/cases.html", line 220, in template
{{ case.analysis_date.date() }}
jinja2.exceptions.UndefinedError: 'str object' has no attribute 'date'

bug

All 8 comments

It was a malformatted date as produced by cg scout load -p in this case; a string starting with datetime.date(..

It was a malformatted date as produced by cg scout load -p in this case; a string starting with datetime.date(..

Is this fixed now? I can't find the specific case that triggers the error!

Yeah, I edited the db. But it is easy to recreate locally if you want to test it.. ;-) It was the case KLR was working on.

Sooo should we close or not, I could add a check in the controller.

How can I recreate locally @dnil?

Sooo should we close or not, I could add a check in the controller.

How can I recreate locally @dnil?

Modify analysis_date so that it's not a Date object but a string:

image

Exactly! Add a string instead of a properly formatted date in a load config yaml, or just edit the db.

It would be nice to have a check to make sure that the case is not created with a string date since the beginning

What did the string look like that you used when it didn't work @dnil ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moonso picture moonso  路  4Comments

4WGH picture 4WGH  路  3Comments

keyvanelhami picture keyvanelhami  路  5Comments

hassanfa picture hassanfa  路  3Comments

ielvers picture ielvers  路  3Comments