Пример #1
0
def fetch_everything_for_researcher(pk):
    ccf = get_ccf()
    oai = OaiPaperSource(ccf, max_results=250)
    sources = [
        ('orcid',OrcidPaperSource(ccf, oai, max_results=1000)),
        ('crossref',CrossRefPaperSource(ccf, oai, max_results=500)),
        ('oai',oai),
       ]
    r = Researcher.objects.get(pk=pk)

    ## If it is the first time we fetch this researcher
    #if r.stats is None:
    # make sure publications already known are also considered
    ccf.reclusterBatch(r)
    try:
        for key,source in sources:
            update_researcher_task(r, key)
            source.fetch_and_save(r, incremental=True)
        update_researcher_task(r, None)

    except MetadataSourceException as e:
        raise e
    finally:
        r = Researcher.objects.get(pk=pk)
        update_researcher_task(r, 'stats')
        r.update_stats()
        r.harvester = None
        update_researcher_task(r, None)
        ccf.clear()
        name_lookup_cache.prune()
Пример #2
0
def fetch_everything_for_researcher(pk):
    ccf = get_ccf()
    oai = OaiPaperSource(ccf, max_results=250)
    sources = [
        ('orcid', OrcidPaperSource(ccf, oai, max_results=1000)),
        ('crossref', CrossRefPaperSource(ccf, oai, max_results=500)),
        ('oai', oai),
    ]
    r = Researcher.objects.get(pk=pk)

    ## If it is the first time we fetch this researcher
    #if r.stats is None:
    # make sure publications already known are also considered
    ccf.reclusterBatch(r)
    try:
        for key, source in sources:
            update_researcher_task(r, key)
            source.fetch_and_save(r, incremental=True)
        update_researcher_task(r, None)

    except MetadataSourceException as e:
        raise e
    finally:
        r = Researcher.objects.get(pk=pk)
        update_researcher_task(r, 'stats')
        r.update_stats()
        r.harvester = None
        update_researcher_task(r, None)
        ccf.clear()
        name_lookup_cache.prune()
Пример #3
0
def get_paper_by_doi(doi):
    ccf = get_ccf()
    oai = OaiPaperSource(ccf=ccf, max_results=10)
    crps = CrossRefPaperSource(ccf=ccf, oai=oai, max_results=10)
    p = crps.create_paper_by_doi(doi)
    if p is not None:
        p = Paper.from_bare(p)
    return p
Пример #4
0
def get_paper_by_doi(doi):
    ccf = get_ccf()
    oai = OaiPaperSource(ccf=ccf, max_results=10)
    crps = CrossRefPaperSource(ccf=ccf, oai=oai, max_results=10)
    p = crps.create_paper_by_doi(doi)
    if p is not None:
        p = Paper.from_bare(p)
    return p
Пример #5
0
def recluster_researcher(pk):
    ccf = get_ccf()
    try:
        r = Researcher.objects.get(pk=pk)
        ccf.reclusterBatch(r)
    finally:
        r.update_stats()
        update_researcher_task(r, None)
    del ccf
Пример #6
0
def recluster_researcher(pk):
    ccf = get_ccf()
    try:
        r = Researcher.objects.get(pk=pk)
        ccf.reclusterBatch(r)
    finally:
        r.update_stats()
        update_researcher_task(r, None)
    del ccf
Пример #7
0
def init_profile_from_orcid(pk):
    """
    Populates the profile from ORCID and Proaixy.
    Does not fetch DOIs from ORCID as it can be slow.

    This task is intended to be very quick, so that users
    can see their ORCID publications quickly.
    """
    
    ccf = get_ccf()
    r = Researcher.objects.get(pk=pk)
    update_task = lambda name: update_researcher_task(r, name)
    update_task('clustering')
    fetch_everything_for_researcher(pk)
    ccf.clear()
Пример #8
0
def init_profile_from_orcid(pk):
    """
    Populates the profile from ORCID and Proaixy.
    Does not fetch DOIs from ORCID as it can be slow.

    This task is intended to be very quick, so that users
    can see their ORCID publications quickly.
    """

    ccf = get_ccf()
    r = Researcher.objects.get(pk=pk)
    update_task = lambda name: update_researcher_task(r, name)
    update_task('clustering')
    fetch_everything_for_researcher(pk)
    ccf.clear()
Пример #9
0
 def setUpClass(self):
     super(PaperTest, self).setUpClass()
     self.ccf = get_ccf()
Пример #10
0
 def setUpClass(self):
     super(PaperTest, self).setUpClass()
     self.ccf = get_ccf()