Esempio n. 1
0
def query_api(request, review_name_slug):
    slugged_review = Review.objects.get(slug=review_name_slug)
    query_parts = slugged_review.query_set.all()
    query = "("
    for part in query_parts:
        query += part.query_string + ") AND ("
    query = query[:-6]
    esearch_result = pubmed.esearch_query(query)
    efetch_result = pubmed.efetch_query(esearch_result)
    elink_result = pubmed.elink_query(efetch_result)
    slugged_review.pool_size = len(esearch_result)
    slugged_review.save()
    for id in elink_result:
        result = elink_result[id]
        authors = ""
        for author in result["authors"]:
            authors += author + ", "
        authors = authors[:-2]
        paper = Paper.objects.create(review=slugged_review,
                                     title=result["title"],
                                     authors=authors,
                                     abstract=result["abstract"],
                                     publish_date=result["publish_date"],
                                     paper_url=result["paper_url"])
    return HttpResponse()
Esempio n. 2
0
def check_total_results(request, review_name_slug):
    slugged_review = Review.objects.get(slug=review_name_slug)
    query_parts = slugged_review.query_set.all()
    query = "("
    for part in query_parts:
        query += part.query_string + ") AND ("
    query = query[:-6]
    esearch_result = pubmed.esearch_query(query)
    return HttpResponse(len(esearch_result))
Esempio n. 3
0
def check_total_results(request,review_name_slug):
    slugged_review = Review.objects.get(slug=review_name_slug)
    query_parts = slugged_review.query_set.all()
    query = "("
    for part in query_parts:
        query += part.query_string + ") AND ("
    query=query[:-6]
    esearch_result = pubmed.esearch_query(query)
    return HttpResponse(len(esearch_result))
Esempio n. 4
0
def save_query_std(request, review_name_slug, query_string):
    review = Review.objects.get(slug=review_name_slug)
    formatted = format_query_novice(query_string)
    esearch_result = pubmed.esearch_query(formatted)
    id_string = ""
    for id in esearch_result:
        id_string += id + ","
    id_string = id_string[:-1]
    query_object = Query.objects.create(review=review,query_string=formatted,pool_size=len(esearch_result),results=id_string)
    return HttpResponse()
Esempio n. 5
0
def save_query_std(request, review_name_slug, query_string):
    review = Review.objects.get(slug=review_name_slug)
    formatted = format_query_novice(query_string)
    esearch_result = pubmed.esearch_query(formatted)
    id_string = ""
    for id in esearch_result:
        id_string += id + ","
    id_string = id_string[:-1]
    query_object = Query.objects.create(review=review,
                                        query_string=formatted,
                                        pool_size=len(esearch_result),
                                        results=id_string)
    return HttpResponse()
Esempio n. 6
0
def query_api(request,review_name_slug):
    slugged_review = Review.objects.get(slug=review_name_slug)
    query_parts = slugged_review.query_set.all()
    query = "("
    for part in query_parts:
        query += part.query_string + ") AND ("
    query=query[:-6]
    esearch_result = pubmed.esearch_query(query)
    efetch_result = pubmed.efetch_query(esearch_result)
    elink_result = pubmed.elink_query(efetch_result)
    slugged_review.pool_size= len(esearch_result)
    slugged_review.save()
    for id in elink_result:
        result = elink_result[id]
        authors = ""
        for author in result["authors"]:
            authors += author + ", "
        authors=authors[:-2]
        paper = Paper.objects.create(review=slugged_review,title=result["title"],authors=authors,abstract=result["abstract"],publish_date=result["publish_date"],paper_url=result["paper_url"])
    return HttpResponse()
Esempio n. 7
0
def check_API_std(request, review_name_slug, query_string):
    # get list of ID results from the PubMed API
    formatted = format_query_novice(query_string)
    id_list = pubmed.esearch_query(formatted)
    return HttpResponse(len(id_list))
Esempio n. 8
0
def check_API_std(request,review_name_slug,query_string):
    # get list of ID results from the PubMed API
    formatted = format_query_novice(query_string)
    id_list = pubmed.esearch_query(formatted)
    return HttpResponse(len(id_list))