-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NewFeature]列医院信息+按关键字搜索医院 #32
base: master
Are you sure you want to change the base?
Conversation
希望能够将此搜索功能整合进/hospitals接口中,在其添加上可选的searchString参数,作为keyword。 该接口的pr:#38 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your contribution!! I left my two cents on the PR, please take a look 😄
@@ -17,6 +17,15 @@ | |||
'factory_capacity', | |||
'factory_contact', | |||
] | |||
HOSPICAL_HEADERS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: HOSPITAL_HEADERS
@@ -61,15 +86,33 @@ def hospital_list(): | |||
'msg': '', | |||
} | |||
try: | |||
resp_data = csv_helper(HOSPITAL_PATH,HOTEL_HEADERS) | |||
resp_data = csv_helper(HOSPITAL_PATH,HOSPICAL_HEADERS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: HOSPITAL_HEADERS
if keyword.lower() not in field_val_concat: | ||
is_valid = False | ||
break | ||
except Exception as ex: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be great to not catch all exceptions, but only a handful of expected errors.
search_result = filter_entity(hospital_all, search_fields, keyword) | ||
resp['success'] = True | ||
resp['data'] = search_result | ||
except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to https://github.com/wuhan2020/api-server/pull/38/files#r372081013, this is trying to catch any exceptions, it also swallows the status codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some unresolved issues with this PR, leaving this PR open for now, will circle back later!
feature:
API: http://127.0.0.1:9000/wuhan2020/hospital_search?keyword=${kw}
e.g. http://127.0.0.1:9000/wuhan2020/hospital_search?keyword=%E6%89%8B%E6%9C%AF%E8%A1%A3
返回需要手术衣的医院名单
e.g. http://127.0.0.1:9000/wuhan2020/hospital_search?keyword=%E6%89%8B%E6%9C%AF%E8%A1%A3%20%E4%BB%99%E6%A1%83
返回需要手术衣的仙桃的医院名单
bugfix: