예제 #1
0
파일: tasks.py 프로젝트: jilljenn/dissemin
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
파일: tasks.py 프로젝트: jilljenn/dissemin
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
파일: tasks.py 프로젝트: jilljenn/dissemin
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
파일: tasks.py 프로젝트: jilljenn/dissemin
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
파일: tests.py 프로젝트: jilljenn/dissemin
 def setUpClass(self):
     super(PaperTest, self).setUpClass()
     self.ccf = get_ccf()
예제 #10
0
파일: tests.py 프로젝트: Lysxia/dissemin
 def setUpClass(self):
     super(PaperTest, self).setUpClass()
     self.ccf = get_ccf()