rcpch / digital-growth-charts-server

RCPCH's open source Digital Growth Chart API
https://growth.rcpch.ac.uk/
GNU Affero General Public License v3.0
16 stars 11 forks source link

Server error with new ISO date time format for t21 / turner reference calculations #146

Closed chvanlennep closed 7 months ago

chvanlennep commented 3 years ago

The server accepts UK-WHO calc requests no problem, but gives 500 error with t21 and turner calculations.

Measurement parameters used in this example:

{ birth_date: '2020-03-22T00:00:00.000Z', gestation_days: 0, gestation_weeks: 40, measurement_method: 'weight', observation_date: '2021-03-22T00:00:00.000Z', observation_value: 9, sex: 'female', };

172.17.0.1 - - [22/Mar/2021 10:14:43] "POST /trisomy-21/calculation HTTP/1.1" 500 -

Traceback (most recent call last):

File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__

return self.wsgi_app(environ, start_response)

File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app

response = self.handle_exception(e)

File "/usr/local/lib/python3.8/site-packages/flask_cors/extension.py", line 161, in wrapped_function

return cors_after_request(app.make_response(f(*args, **kwargs)))

File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception

reraise(exc_type, exc_value, tb)

File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise

raise value

File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app

response = self.full_dispatch_request()

File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/usr/local/lib/python3.8/site-packages/flask_cors/extension.py", line 161, in wrapped_function

return cors_after_request(app.make_response(f(*args, **kwargs)))

File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception

reraise(exc_type, exc_value, tb)

File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise

raise value

File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request

rv = self.dispatch_request()

File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File "/app/blueprints/trisomy_21_blueprint.py", line 77, in trisomy_21_calculation

birth_date=datetime.strptime(

File "/usr/local/lib/python3.8/_strptime.py", line 568, in _strptime_datetime

tt, fraction, gmtoff_fraction = _strptime(data_string, format)

File "/usr/local/lib/python3.8/_strptime.py", line 352, in _strptime

raise ValueError("unconverted data remains: %s" %

ValueError: unconverted data remains: .000Z
pacharanero commented 3 years ago

@chvanlennep thaks for reporting. This is my own silly error! I missed adding a tiny yet vital bit of code to the T21 and Turner endpoints. I have fixed and once the server is rebuilt (~8 minutes for the GH Action to complete) it should work for you.

chvanlennep commented 3 years ago

Glad it was a simple fix :)

dc2007git commented 7 months ago

Closing as reported to have been fixed