pubmed_parser/medline_parser.py
def parse_doi(pubmed_article):
    """Parse DOI from a given Pubmed Article tree

    Parameters
    ----------
    medline: Element
        The lxml node pointing to a medline document

    Returns
    -------
    doi: str, DOI from a given lxml node
    """
    medline = pubmed_article.find('MedlineCitation')
    article = medline.find('Article')
    elocation_ids = article.findall('ELocationID')

    if len(elocation_ids) > 0:
        for e in elocation_ids:
            doi = e.text.strip() or '' if e.attrib.get('EIdType', '') == 'doi' else ''
    else:
        article_ids = pubmed_article.find('PubmedData/ArticleIdList')
        if article_ids is not None:
            doi = article_ids.find('ArticleId[@IdType="doi"]')
            doi = (doi.text.strip() if doi.text is not None else '') if doi is not None else ''
        else:
            doi = ''
    return doi
Parse DOI from a given Pubmed Article tree

    Parameters
    ----------
    medline: Element
        The lxml node pointing to a medline document

    Returns
    -------
    doi: str, DOI from a given lxml node
    
Parse DOI from a given Pubmed Article tree
Parameters

Element
The lxml node pointing to a medline document

Returns

str, DOI from a given lxml node
Parse DOI from a given Pubmed Article tree Parameters Element The lxml node pointing to a medline document Returns str DOI from a given lxml node
def parse_doi(pubmed_article):
    medline = pubmed_article.find('MedlineCitation')
    article = medline.find('Article')
    elocation_ids = article.findall('ELocationID')
    if len(elocation_ids) > 0:
        for e in elocation_ids:
            doi = e.text.strip() or '' if e.attrib.get('EIdType', '') == 'doi' else ''
    else:
        article_ids = pubmed_article.find('PubmedData/ArticleIdList')
        if article_ids is not None:
            doi = article_ids.find('ArticleId[@IdType="doi"]')
            doi = (doi.text.strip() if doi.text is not None else '') if doi is not None else ''
        else:
            doi = ''
    return doi
def parse_doi ( pubmed_article ) : medline = pubmed_article . find ( 'MedlineCitation' ) article = medline . find ( 'Article' ) elocation_ids = article . findall ( 'ELocationID' ) if len ( elocation_ids ) > 0 : for e in elocation_ids : doi = e . text . strip ( ) or '' if e . attrib . get ( 'EIdType' , '' ) == 'doi' else '' else : article_ids = pubmed_article . find ( 'PubmedData/ArticleIdList' ) if article_ids is not None : doi = article_ids . find ( 'ArticleId[@IdType="doi"]' ) doi = ( doi . text . strip ( ) if doi . text is not None else '' ) if doi is not None else '' else : doi = '' return doi
Parse DOI from a given Pubmed Article tree
Parameters
Parse DOI from a given Pubmed Article tree Parameters
"""Parse DOI from a given Pubmed Article tree

    Parameters
    ----------
    medline: Element
        The lxml node pointing to a medline document

    Returns
    -------
    doi: str, DOI from a given lxml node
    """
pubmed_article