Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zetan
Copy link

@zetan zetan commented Jan 28, 2020

feature:

  1. 按关键词搜索医院:搜索(医院名称+医院地址+所需物资)中带有关键词的医院
    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:

  1. API http://127.0.0.1:9000/wuhan2020/hospital_list 里把header改为const/HOSPICAL_HEADERS
  2. 读文件时用utf-8 encoding,对中文比较友好

@zetan zetan changed the title 列医院信息+按关键字搜索医院 [NewFeature]列医院信息+按关键字搜索医院 Jan 28, 2020
@menbotics menbotics bot added the kind/feature Category issues or prs related to feature request. label Jan 28, 2020
@rexwangcc rexwangcc self-requested a review January 28, 2020 15:29
@RobertIndie
Copy link
Contributor

希望能够将此搜索功能整合进/hospitals接口中,在其添加上可选的searchString参数,作为keyword。

该接口的pr:#38

Copy link
Contributor

@rexwangcc rexwangcc left a 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 = [
Copy link
Contributor

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)
Copy link
Contributor

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:
Copy link
Contributor

@rexwangcc rexwangcc Jan 28, 2020

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:
Copy link
Contributor

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.

@rexwangcc rexwangcc self-assigned this Jan 29, 2020
Copy link
Contributor

@rexwangcc rexwangcc left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Category issues or prs related to feature request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants