Bug: JSONDecodeError during check
The error message below was present in production agent logs even though the corresponding JSON doc had been written to CouchDB (http://medic-app-p-01.ukg.be-mrz.klin:8051/medic/621c80e3987f)
Version 0.4.0
agent_annotation_1 | 2021-03-01T20:06:23.378201595Z 2021-03-01T20:06:23.377827 - Check: {'method': 'check', 'params': {'message': None, 'options': {'archive_id': None, 'vault_id': None, 'cdstar_uri': None, 'cdstar_user': None, 'cdstar_pass': None, 'couch_db': None, 'couch_uri': None, 'couch_user': None, 'couch_pass': None, 'api_key': '', 'annotations_archive': {'name': 'Patient Feed raw data (HL7v2 ADT)', 'abstract': 'A batch of exported HL7v2 ADT relayed from clinical communication server.', 'batch': 'P07 Initialimport Februar 2021', 'sourceOrganization': {'@id': 'https://medic.umg.eu/metadata/Organization#umg', '@type': 'Organization'}, 'maintainer': {'@id': 'https://medic.umg.eu/metadata/Organization#medic', '@type': 'Organization'}}, 'annotations_file': {'name': 'Compressed ADT messages', 'abstract': 'A gzip compressed TAR archive of HL7v2 ADT messages from central patient feed relayed by clinical communication server.', 'sourceOrganization': {'@id': 'https://medic.umg.eu/metadata/Organization#umg', '@type': 'Organization'}, 'maintainer': {'@id': 'https://medic.umg.eu/metadata/Organization#medic', '@type': 'Organization'}}}, 'memory': {'archives': [('sources', '621c80e3987f')]}, 'credentials': [{}, {}, {}, {}]}}
agent_annotation_1 | 2021-03-01T20:06:23.380520162Z 172.23.0.11:42940 - "POST /annotator HTTP/1.1" 500
agent_annotation_1 | 2021-03-01T20:06:23.414661870Z [2021-03-01 20:06:23 +0000] [9] [ERROR] Exception in ASGI application
agent_annotation_1 | 2021-03-01T20:06:23.414680302Z Traceback (most recent call last):
agent_annotation_1 | 2021-03-01T20:06:23.414686529Z File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 385, in run_asgi
agent_annotation_1 | 2021-03-01T20:06:23.414692350Z result = await app(self.scope, self.receive, self.send)
agent_annotation_1 | 2021-03-01T20:06:23.414697812Z File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
agent_annotation_1 | 2021-03-01T20:06:23.414712551Z return await self.app(scope, receive, send)
agent_annotation_1 | 2021-03-01T20:06:23.414718501Z File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 190, in __call__
agent_annotation_1 | 2021-03-01T20:06:23.414724026Z await super().__call__(scope, receive, send)
agent_annotation_1 | 2021-03-01T20:06:23.414729436Z File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
agent_annotation_1 | 2021-03-01T20:06:23.414734902Z await self.middleware_stack(scope, receive, send)
agent_annotation_1 | 2021-03-01T20:06:23.414740301Z File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
agent_annotation_1 | 2021-03-01T20:06:23.414745665Z raise exc from None
agent_annotation_1 | 2021-03-01T20:06:23.414750906Z File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
agent_annotation_1 | 2021-03-01T20:06:23.414756372Z await self.app(scope, receive, _send)
agent_annotation_1 | 2021-03-01T20:06:23.414761454Z File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
agent_annotation_1 | 2021-03-01T20:06:23.414766790Z raise exc from None
agent_annotation_1 | 2021-03-01T20:06:23.414771970Z File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
agent_annotation_1 | 2021-03-01T20:06:23.414777372Z await self.app(scope, receive, sender)
agent_annotation_1 | 2021-03-01T20:06:23.414782566Z File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
agent_annotation_1 | 2021-03-01T20:06:23.414787932Z await route.handle(scope, receive, send)
agent_annotation_1 | 2021-03-01T20:06:23.414793190Z File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
agent_annotation_1 | 2021-03-01T20:06:23.414798576Z await self.app(scope, receive, send)
agent_annotation_1 | 2021-03-01T20:06:23.414803705Z File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
agent_annotation_1 | 2021-03-01T20:06:23.414809030Z response = await func(request)
agent_annotation_1 | 2021-03-01T20:06:23.414814230Z File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 188, in app
agent_annotation_1 | 2021-03-01T20:06:23.414819576Z raw_response = await run_endpoint_function(
agent_annotation_1 | 2021-03-01T20:06:23.414824736Z File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 137, in run_endpoint_function
agent_annotation_1 | 2021-03-01T20:06:23.414830523Z return await run_in_threadpool(dependant.call, **values)
agent_annotation_1 | 2021-03-01T20:06:23.414835419Z File "/usr/local/lib/python3.8/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool
agent_annotation_1 | 2021-03-01T20:06:23.414841527Z return await loop.run_in_executor(None, func, *args)
agent_annotation_1 | 2021-03-01T20:06:23.414846932Z File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
agent_annotation_1 | 2021-03-01T20:06:23.414852228Z result = self.fn(*self.args, **self.kwargs)
agent_annotation_1 | 2021-03-01T20:06:23.414857398Z File "/app/annotator/main.py", line 57, in aw_endpoint
agent_annotation_1 | 2021-03-01T20:06:23.414862659Z return check(
agent_annotation_1 | 2021-03-01T20:06:23.414867700Z File "/app/annotator/main.py", line 280, in check
agent_annotation_1 | 2021-03-01T20:06:23.414878233Z state = utils.get_state_from_metafile(metafile)
agent_annotation_1 | 2021-03-01T20:06:23.414883944Z File "/app/annotator/utils.py", line 109, in get_state_from_metafile
agent_annotation_1 | 2021-03-01T20:06:23.414889350Z state = json.load(m_f)
agent_annotation_1 | 2021-03-01T20:06:23.414894510Z File "/usr/local/lib/python3.8/json/__init__.py", line 293, in load
agent_annotation_1 | 2021-03-01T20:06:23.414899870Z return loads(fp.read(),
agent_annotation_1 | 2021-03-01T20:06:23.414905014Z File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
agent_annotation_1 | 2021-03-01T20:06:23.414910326Z return _default_decoder.decode(s)
agent_annotation_1 | 2021-03-01T20:06:23.414915503Z File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
agent_annotation_1 | 2021-03-01T20:06:23.414920806Z obj, end = self.raw_decode(s, idx=_w(s, 0).end())
agent_annotation_1 | 2021-03-01T20:06:23.414926172Z File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
agent_annotation_1 | 2021-03-01T20:06:23.414931527Z raise JSONDecodeError("Expecting value", s, err.value) from None
agent_annotation_1 | 2021-03-01T20:06:23.414936581Z json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)