Пример #1
0
def get_drug_list_by_edi(*edi_codes, **kwargs):
    drug_list = Listorm()
    for edi in edi_codes:
        drug_list += get_drug_search_list(search_bohcode=edi)
    drug_codes = drug_list.column_values('drug_cd')
    detail_list = Listorm()
    for drug_code in drug_codes:
        detail_list += get_drug_detail(drug_code, **kwargs)
    ret = detail_list.join(drug_list, left_on='drug_code', right_on='drug_cd')
    return ret
Пример #2
0
def get_drug_detail(drug_code, ret_kpic=False):
    api_content = retrieve_search_drug.get_detail_api(drug_code)
    records = Listorm(parse_detail_api.parse(api_content))
    if ret_kpic:
        html_content = retrieve_search_drug.get_detail(drug_code)
        kpic_records = Listorm(parse_detail.parse(html_content, drug_code))
        if kpic_records:
            ret = kpic_records.join(records, on='drug_code', how='left')
            return ret
    return records
Пример #3
0
def get_drug_list(*criterias, **kwargs):
    drug_list = Listorm()
    for crit in tqdm(criterias, total=len(criterias)):
        drug_list += get_drug_search_list(**crit)
    drug_codes = drug_list.column_values('drug_cd')
    detail_list = Listorm()
    print('collecting {} items....'.format(len(drug_codes)))
    for drug_code in tqdm(drug_codes, total=len(drug_codes)):
        detail_list += get_drug_detail(drug_code, **kwargs)
    ret = detail_list.join(drug_list, left_on='drug_code', right_on='drug_cd')
    records = [dict(row) for row in ret]
    return records