Beispiel #1
0
def get_year_groups(query_pmids, years):
    if VERBOSE:
        print "filter_pmids for %s" %query_pmids
        
    if not query_pmids:
        return([])
    (client, the_post) = get_history_client_post(pmids)
    flags = {}
    for year in years:
        pubmed_filter_string = "1[PDAT]:%d/12/31[PDAT]" %(year)
        try:
            time.sleep(1/3)
            filtered_pmid_records = the_post.search(
                        '#%s AND (%s)' %(the_post.query_key, pubmed_filter_string), 
                        db="pubmed") 
            filtered_pmids = filtered_pmid_records.dbids.ids
        except AttributeError:
            filtered_pmids = []
        except EUtils.EUtilsError, e:
            if e.args[0].strip() == "Empty result - nothing todo":
                filtered_pmids = []
            else:
                raise datasourcesError(e) 

        pmid_passes_filter = [(pmid in filtered_pmids) for pmid in query_pmids]   
        flags[year] = _map_booleans_to_flags(pmid_passes_filter)
Beispiel #2
0
def get_year_groups(query_pmids, years):
    if VERBOSE:
        print "filter_pmids for %s" % query_pmids

    if not query_pmids:
        return ([])
    (client, the_post) = get_history_client_post(pmids)
    flags = {}
    for year in years:
        pubmed_filter_string = "1[PDAT]:%d/12/31[PDAT]" % (year)
        try:
            time.sleep(1 / 3)
            filtered_pmid_records = the_post.search(
                '#%s AND (%s)' % (the_post.query_key, pubmed_filter_string),
                db="pubmed")
            filtered_pmids = filtered_pmid_records.dbids.ids
        except AttributeError:
            filtered_pmids = []
        except EUtils.EUtilsError, e:
            if e.args[0].strip() == "Empty result - nothing todo":
                filtered_pmids = []
            else:
                raise datasourcesError(e)

        pmid_passes_filter = [(pmid in filtered_pmids) for pmid in query_pmids]
        flags[year] = _map_booleans_to_flags(pmid_passes_filter)
Beispiel #3
0
def search(pubmed_filter_string):
    if VERBOSE:
        print "filter_pmids for %s" %pubmed_filter_string
    try:
        entrez = get_eutils_history_client()
        filtered_pmid_records = entrez.search(pubmed_filter_string, db="pubmed") 
        filtered_pmids = filtered_pmid_records.dbids.ids
    except AttributeError:
        filtered_pmids = []
    except EUtils.EUtilsError, e:
        if e.args[0].strip() == "Empty result - nothing todo":
            filtered_pmids = []
        else:
            raise datasourcesError(e) 
Beispiel #4
0
def search(pubmed_filter_string):
    if VERBOSE:
        print "filter_pmids for %s" % pubmed_filter_string
    try:
        time.sleep(1 / 3)
        entrez = get_eutils_history_client()
        filtered_pmid_records = entrez.search(pubmed_filter_string,
                                              db="pubmed")
        filtered_pmids = filtered_pmid_records.dbids.ids
    except AttributeError:
        filtered_pmids = []
    except EUtils.EUtilsError, e:
        if e.args[0].strip() == "Empty result - nothing todo":
            filtered_pmids = []
        else:
            raise datasourcesError(e)
Beispiel #5
0
def filter_pmids(query_pmids, pubmed_filter_string):
    if VERBOSE:
        print "filter_pmids for %s" %query_pmids
        
    if not query_pmids:
        return([])
    try:
        (client, the_post) = get_history_client_post(query_pmids)
        filtered_pmid_records = client.search(
                    '#%s AND (%s)' %(the_post.query_key, pubmed_filter_string), 
                    db="pubmed") 
        print len(filtered_pmid_records)
        filtered_pmids = filtered_pmid_records.dbids.ids
    except AttributeError:
        filtered_pmids = []
    except EUtils.EUtilsError, e:
        if e.args[0].strip() == "Empty result - nothing todo":
            filtered_pmids = []
        else:
            raise datasourcesError(e) 
Beispiel #6
0
def filter_pmids(query_pmids, pubmed_filter_string):
    print "filter_pmids for %s" % query_pmids
    if VERBOSE:
        print "filter_pmids for %s" % query_pmids

    if not query_pmids:
        return ([])
    try:
        time.sleep(1 / 3)
        (client, the_post) = get_history_client_post(query_pmids)
        filtered_pmid_records = client.search(
            '#%s AND (%s)' % (the_post.query_key, pubmed_filter_string),
            db="pubmed")
        print len(filtered_pmid_records)
        filtered_pmids = filtered_pmid_records.dbids.ids
    except AttributeError:
        filtered_pmids = []
    except EUtils.EUtilsError, e:
        if e.args[0].strip() == "Empty result - nothing todo":
            filtered_pmids = []
        else:
            raise datasourcesError(e)