Closed nschwertner closed 6 years ago
It throws exceptions for most patients. I managed to start it with "Susan N Williams". For most of the other patients (that I tried it with) it throws errors like:
Traceback (most recent call last):
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/vlad/dev/sample-apps-stu3/rest-app/env/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/vlad/dev/sample-apps-stu3/rest-app/app.py", line 94, in index
out += '<li>%s</li>\n' % _med_name(med)
File "/Users/vlad/dev/sample-apps-stu3/rest-app/app.py", line 34, in _med_name
if med.text:
AttributeError: 'NoneType' object has no attribute 'text'
If we assume that such exceptions are OK for backend demo app, them we should at least give the users a list of good patients to try with. What do you think?
Is it possible to add some basic error handling to the demo and display a message to the user?
I made those fixes in d58f735fd6ca08fdec3413617811b9e5fbd6e084. It will display a message if the patient has no prescriptions and also follow medication references in case we have them instead of medicationCodeableConcept
. Since I am not a Python dev and I don't know the python fhir client very well, I was hoping that you can confirm if the changes are good enough.
You are right. This sample app was never upgraded to handle referenced objects. I think your implementation is good. I ported it over to the Python client sample app too so that it also works with the entire range of sample patient https://github.com/smart-on-fhir/client-py/commit/a20ca48
Also, I upgraded the medication name localizer to be able to handle Medication objects with multiple codings https://github.com/smart-on-fhir/sample-apps-stu3/pull/5
There were some issues with the Python client that I fixed a couple days back: https://github.com/smart-on-fhir/client-py/commits/master Note that the client is now on version 3.2.0
Apparently I don't have write access here, so submitting this as a pull request