Clinical-Genomics / scout

VCF visualization interface
https://clinical-genomics.github.io/scout
BSD 3-Clause "New" or "Revised" License
152 stars 46 forks source link

MME matches date format parsing #4960

Closed dnil closed 3 weeks ago

dnil commented 3 weeks ago

Describe the bug Crash on the MME-matches page.

2024-10-17 17:13:22,807 - scout.server.app - ERROR: Exception on /cust003/14014/mme_matches [GET] [in /venv/lib/python3.11/site-packages/flask/app.py:838]
Traceback (most recent call last):
 File "/home/worker/app/scout/parse/matchmaker.py", line 191, in parse_matches
   mdate = datetime.datetime.fromtimestamp(match_date / 1000.0)
                                           ~~~~~~~~~~~^~~~~~~~
TypeError: unsupported operand type(s) for /: 'str' and 'float'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File "/venv/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app
   response = self.full_dispatch_request()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.11/site-packages/flask/app.py", line 882, in full_dispatch_request
   rv = self.handle_user_exception(e)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.11/site-packages/flask_cors/extension.py", line 194, in wrapped_function
   return cors_after_request(app.make_response(f(*args, **kwargs)))
                                               ^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.11/site-packages/flask/app.py", line 880, in full_dispatch_request
   rv = self.dispatch_request()
        ^^^^^^^^^^^^^^^^^^^^^^^
 File "/venv/lib/python3.11/site-packages/flask/app.py", line 865, in dispatch_request
   return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/worker/app/scout/server/utils.py", line 87, in decorated_function
   context = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
 File "/home/worker/app/scout/server/blueprints/cases/views.py", line 166, in matchmaker_matches
   data = controllers.matchmaker_matches(request, institute_id, case_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/worker/app/scout/server/blueprints/cases/controllers.py", line 1338, in matchmaker_matches
   pat_matches = parse_matches(patient_id, server_resp["content"]["matches"])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/home/worker/app/scout/parse/matchmaker.py", line 193, in parse_matches
   mdate = datetime.datetime.strptime(match_date, "%Y-%m-%dT%H:%M:%S.%fZ")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/local/lib/python3.11/_strptime.py", line 567, in _strptime_datetime
   tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/local/lib/python3.11/_strptime.py", line 349, in _strptime
   raise ValueError("time data %r does not match format %r" %
ValueError: time data '2023-08-16T01:03:53Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'
northwestwitch commented 3 weeks ago

Oh no. I'll start working on a fix now!

northwestwitch commented 3 weeks ago

I don't get why why this wasn't an issue until now though. Perhaps the connected node stores the date with another format?

dnil commented 3 weeks ago

Yes, the timing is odd. I would have been unsurprised if it was after like the python version update or a date time library change.

northwestwitch commented 3 weeks ago

The page now wprks after the the patch release. Closing the issue!