将 PubMed 作者和从属关系与 Python 匹配

问题描述

我有一个脚本,它根据出版物的 PubMed ID (PMID) 从 PubMed 中提取各种信息。我想匹配作者和从属关系,现在它不能正确执行,因此对于某些名称,我得到了错误的从属关系。他们都有一个数字,例如,如果您查找 PMID:26432775(链接https://pubmed.ncbi.nlm.nih.gov/26432775/),姓名后面有一个 1,该人所属的隶属关系前面有一个 1。

现在,我得到了组合 帕特里克·基思-海因斯 意大利帕多瓦帕多瓦大学内科 DIM 代谢疾病科。

这是不对的。有谁知道如何修复我的 python 脚本?

def parse(self,response):
    pmid = response.request.Meta["pmid"]
    title = response.css("h1.heading-title").extract()[0]
    title = h.handle(title)
    title = title.replace("#","")
    doi = response.css("span.citation-doi::text").extract_first().split(":")[-1]
    epubDate = response.css("span.secondary-date::text").extract_first()
    if not epubDate:
        epubDate = ""
    citation = response.css("span.cit::text").extract_first()
    journal = response.css("div.journal-actions.dropdown-block > button::text").extract_first()

    lists = response.css("div.authors-list")[0]
    authorsList = lists.css("span.authors-list-item > a::text").extract()
    authorsText = ",".join(authorsList)

    affiliationsList = response.css("div.affiliations > ul > li::text").extract()
    affiliationsText = ",".join(affiliationsList)

    pmcid = response.css("span.identifier.pmc > a::text").extract_first()
    if not pmcid:
        pmcid = ""

    terms = response.css("div#mesh-terms > ul > li > div > button::text").extract()
    terms = [term.strip() for term in terms]
    terms = ",".join(terms)

    for author,affiliation in zip(authorsList,affiliationsList):
        yield {
            "PMID": pmid,"Author": author.strip(),"Affiliation": affiliation.strip(),}

    # abstract = ""
    abstract = h.handle(response.css("div.abstract-content").extract()[0])
    # print(abstract)
    if abstract:
        abstract = abstract.replace("*","")
    else:
        abstract = ""

    row = [pmid,pmcid.strip(),title.strip(),doi.strip(),journal.strip(),epubDate.strip(),citation.strip(),authorsText.strip(),terms.strip(),abstract.strip()]

    writer.writerow(row)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)