コード例 #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()