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

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

    Returns
    -------
    pmid: str
        String version of the PubMed ID
    """
    medline = pubmed_article.find('MedlineCitation')
    if medline.find('PMID') is not None:
        pmid = medline.find('PMID').text
        return pmid
    else:
        article_ids = pubmed_article.find('PubmedData/ArticleIdList')
        if article_ids is not None:
            pmid = article_ids.find('ArticleId[@IdType="pmid"]')
            pmid = pmid.text.strip() if pmid is not None else ''
        else:
            pmid = ''
    return pmid
Parse PMID from a given Pubmed Article tree

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

    Returns
    -------
    pmid: str
        String version of the PubMed ID
    
Parse PMID from a given Pubmed Article tree
Parameters

Element
The lxml node pointing to a medline document

Returns

str
String version of the PubMed ID
Parse PMID from a given Pubmed Article tree Parameters Element The lxml node pointing to a medline document Returns str String version of the PubMed ID
def parse_pmid(pubmed_article):
    medline = pubmed_article.find('MedlineCitation')
    if medline.find('PMID') is not None:
        pmid = medline.find('PMID').text
        return pmid
    else:
        article_ids = pubmed_article.find('PubmedData/ArticleIdList')
        if article_ids is not None:
            pmid = article_ids.find('ArticleId[@IdType="pmid"]')
            pmid = pmid.text.strip() if pmid is not None else ''
        else:
            pmid = ''
    return pmid
def parse_pmid ( pubmed_article ) : medline = pubmed_article . find ( 'MedlineCitation' ) if medline . find ( 'PMID' ) is not None : pmid = medline . find ( 'PMID' ) . text return pmid else : article_ids = pubmed_article . find ( 'PubmedData/ArticleIdList' ) if article_ids is not None : pmid = article_ids . find ( 'ArticleId[@IdType="pmid"]' ) pmid = pmid . text . strip ( ) if pmid is not None else '' else : pmid = '' return pmid
Parse PMID from a given Pubmed Article tree
Parameters
Parse PMID from a given Pubmed Article tree Parameters
"""Parse PMID from a given Pubmed Article tree

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

    Returns
    -------
    pmid: str
        String version of the PubMed ID
    """
pubmed_article