pubmed_parser/medline_parser.py
def parse_grant_id(medline):
    """Parse Grant ID and related information from a given MEDLINE tree

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

    Returns
    -------
    grant_list: list
        List of grants acknowledged in the publications. Each
        entry in the dictionary contains the PubMed ID,
        grant ID, grant acronym, country, and agency.
    """
    article = medline.find('Article')
    pmid = parse_pmid(medline)

    grants = article.find('GrantList')
    grant_list = list()
    if grants is not None:
        grants_list = grants.getchildren()
        for grant in grants_list:
            grant_country = grant.find('Country')
            if grant_country is not None:
                country = grant_country.text
            else:
                country = ''
            grant_agency = grant.find('Agency')
            if grant_agency is not None:
                agency = grant_agency.text
            else:
                agency = ''
            grant_acronym = grant.find('Acronym')
            if grant_acronym is not None:
                acronym = grant_acronym.text
            else:
                acronym = ''
            grant_id = grant.find('GrantID')
            if grant_id is not None:
                gid = grant_id.text
            else:
                gid = ''
            grant_dict = {
                'pmid': pmid,
                'grant_id': gid,
                'grant_acronym': acronym,
                'country': country,
                'agency': agency
            }
            grant_list.append(grant_dict)
    return grant_list
Parse Grant ID and related information from a given MEDLINE tree

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

    Returns
    -------
    grant_list: list
        List of grants acknowledged in the publications. Each
        entry in the dictionary contains the PubMed ID,
        grant ID, grant acronym, country, and agency.
    
Parse Grant ID and related information from a given MEDLINE tree
Parameters

Element
The lxml node pointing to a medline document

Returns

list
List of grants acknowledged in the publications. Each
entry in the dictionary contains the PubMed ID,
grant ID, grant acronym, country, and agency.
Parse Grant ID and related information from a given MEDLINE tree Parameters Element The lxml node pointing to a medline document Returns list List of grants acknowledged in the publications . Each entry in the dictionary contains the PubMed ID grant ID grant acronym country and agency .
def parse_grant_id(medline):
    article = medline.find('Article')
    pmid = parse_pmid(medline)
    grants = article.find('GrantList')
    grant_list = list()
    if grants is not None:
        grants_list = grants.getchildren()
        for grant in grants_list:
            grant_country = grant.find('Country')
            if grant_country is not None:
                country = grant_country.text
            else:
                country = ''
            grant_agency = grant.find('Agency')
            if grant_agency is not None:
                agency = grant_agency.text
            else:
                agency = ''
            grant_acronym = grant.find('Acronym')
            if grant_acronym is not None:
                acronym = grant_acronym.text
            else:
                acronym = ''
            grant_id = grant.find('GrantID')
            if grant_id is not None:
                gid = grant_id.text
            else:
                gid = ''
            grant_dict = {
                'pmid': pmid,
                'grant_id': gid,
                'grant_acronym': acronym,
                'country': country,
                'agency': agency
            }
            grant_list.append(grant_dict)
    return grant_list
def parse_grant_id ( medline ) : article = medline . find ( 'Article' ) pmid = parse_pmid ( medline ) grants = article . find ( 'GrantList' ) grant_list = list ( ) if grants is not None : grants_list = grants . getchildren ( ) for grant in grants_list : grant_country = grant . find ( 'Country' ) if grant_country is not None : country = grant_country . text else : country = '' grant_agency = grant . find ( 'Agency' ) if grant_agency is not None : agency = grant_agency . text else : agency = '' grant_acronym = grant . find ( 'Acronym' ) if grant_acronym is not None : acronym = grant_acronym . text else : acronym = '' grant_id = grant . find ( 'GrantID' ) if grant_id is not None : gid = grant_id . text else : gid = '' grant_dict = { 'pmid' : pmid , 'grant_id' : gid , 'grant_acronym' : acronym , 'country' : country , 'agency' : agency } grant_list . append ( grant_dict ) return grant_list
Parse Grant ID and related information from a given MEDLINE tree
Parameters
Parse Grant ID and related information from a given MEDLINE tree Parameters
"""Parse Grant ID and related information from a given MEDLINE tree

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

    Returns
    -------
    grant_list: list
        List of grants acknowledged in the publications. Each
        entry in the dictionary contains the PubMed ID,
        grant ID, grant acronym, country, and agency.
    """
medline