Exemple #1
0
 def test_openaccess(self):
     self.assertEqual(
         fetch_journal({
             'issn': '1471-2105'
         }).publisher.oa_status, 'OA')
     self.assertEqual(
         fetch_journal({
             'issn': '1951-6169'
         }).publisher.oa_status, 'OA')
Exemple #2
0
 def test_open(self):
     self.assertEqual(
         fetch_journal({
             'issn': '1631-073X'
         }).publisher.oa_status, 'OK')
     self.assertEqual(
         fetch_journal({
             'issn': '0099-2240'
         }).publisher.oa_status, 'OK')
     self.assertEqual(
         fetch_journal({
             'issn': '0036-8075'
         }).publisher.oa_status, 'OK')
Exemple #3
0
 def test_fetch_journal(self):
     terms = {'issn': '0022-328X'}
     orig_terms = terms.copy()
     self.assertIsInstance(fetch_journal(terms), Journal)
     self.assertEqual(terms, orig_terms)
     journal = find_journal_in_model(terms)
     self.assertIsInstance(journal, Journal)
     self.assertEqual(journal.issn, terms['issn'])
Exemple #4
0
 def test_escaping(self):
     # issue #115
     # in the meantime the journal has been deleted from sherpa
     journal = fetch_journal({'issn': '0302-9743'})
     # Small hack to make the journal appear in the publisher's journal list
     journal.update_stats()
     journal.stats.num_tot = 1
     journal.stats.save()
     publisher = journal.publisher
     r = self.getPage('publisher', kwargs={
                      'pk': publisher.pk, 'slug': publisher.slug})
     self.checkHtml(r)
Exemple #5
0
 def test_too_long(self):
     terms = {
         'jtitle':
         ("Volume 3: Industrial Applications; Modeling "
          "for Oil and Gas, Control and Validation, Estimation, and Control of "
          "Automotive Systems; Multi-Agent and Networked Systems; Control System "
          "Design; Physical Human-Robot Interaction; "
          "Rehabilitation Robotics; Sensing and Actuation for Control; Biomedical "
          "Systems; Time Delay Systems and Stability; Unmanned Ground and Surface "
          "Robotics; Vehicle Motion Controls; Vibration Analysis and Isolation; "
          "Vibration and Control for Energy Harvesting; Wind Energy")
     }
     self.assertEqual(fetch_journal(terms), None)
Exemple #6
0
def _create_publication(paper, metadata):
    if not metadata:
        return
    if not metadata.get('container-title'):
        return
    doi = to_doi(metadata.get('DOI', None))

    title = metadata['container-title']
    if isinstance(title, list):
        title = title[0]
    title = title[:512]

    issn = metadata.get('ISSN', None)
    if issn and isinstance(issn, list):
        issn = issn[0]  # TODO pass all the ISSN to the RoMEO interface
    volume = metadata.get('volume', None)
    pages = metadata.get('page', None)
    issue = metadata.get('issue', None)
    date_dict = metadata.get('issued', dict())
    pubdate = None
    if 'date-parts' in date_dict:
        dateparts = date_dict.get('date-parts')[0]
        pubdate = date_from_dateparts(dateparts)
    # for instance it outputs dates like 2014-2-3
    publisher_name = metadata.get('publisher', None)
    if publisher_name:
        publisher_name = publisher_name[:512]

    pubtype = metadata.get('type', 'unknown')
    pubtype = CROSSREF_PUBTYPE_ALIASES.get(pubtype, pubtype)
    splash_url = doi_to_url(doi)

    # PDF availability
    pdf_url = None
    licenses = set([(license or {}).get('URL')
                    for license in metadata.get('license', [])])
    doi_prefix = doi.split('/')[0]
    if doi_prefix in free_doi_prefixes or any(map(is_oa_license, licenses)):
        pdf_url = splash_url

    # Lookup journal
    search_terms = {'jtitle': title}
    if issn:
        search_terms['issn'] = issn
    journal = fetch_journal(search_terms)

    publisher = None
    if journal:
        publisher = journal.publisher
        AliasPublisher.increment(publisher_name, journal.publisher)
    else:
        publisher = fetch_publisher(publisher_name)

    barepub = BareOaiRecord(
            paper=paper,
            journal_title=title,
            issue=issue,
            volume=volume,
            pubdate=pubdate,
            pages=pages,
            doi=doi,
            pubtype=pubtype,
            publisher_name=publisher_name,
            journal=journal,
            publisher=publisher,
            pdf_url=pdf_url,
            splash_url=splash_url,
            source=OaiSource.objects.get(identifier='crossref'),
            identifier=doi_to_crossref_identifier(doi))
    rec = paper.add_oairecord(barepub)
    paper.update_availability()
    return paper, rec
Exemple #7
0
def _create_publication(paper, metadata):
    if not metadata:
        return
    if not 'container-title' in metadata or not metadata['container-title']:
        return
    doi = to_doi(metadata.get('DOI', None))

    title = metadata['container-title']
    if type(title) == type([]):
        title = title[0]
    title = title[:512]

    issn = metadata.get('ISSN', None)
    if issn and type(issn) == type([]):
        issn = issn[0]  # TODO pass all the ISSN to the RoMEO interface
    volume = metadata.get('volume', None)
    pages = metadata.get('page', None)
    issue = metadata.get('issue', None)
    date_dict = metadata.get('issued', dict())
    pubdate = None
    if 'date-parts' in date_dict:
        dateparts = date_dict.get('date-parts')[0]
        pubdate = date_from_dateparts(dateparts)
    # for instance it outputs dates like 2014-2-3
    publisher_name = metadata.get('publisher', None)
    if publisher_name:
        publisher_name = publisher_name[:512]

    pubtype = metadata.get('type', 'unknown')
    pubtype = CROSSREF_PUBTYPE_ALIASES.get(pubtype, pubtype)

    # PDF availability
    pdf_url = None
    licenses = set([(license or {}).get('URL')
                    for license in metadata.get('license', [])])
    if any(map(is_oa_license, licenses)):
        pdf_url = 'http://dx.doi.org/' + doi

    # Lookup journal
    search_terms = {'jtitle': title}
    if issn:
        search_terms['issn'] = issn
    journal = fetch_journal(search_terms)

    publisher = None
    if journal:
        publisher = journal.publisher
        AliasPublisher.increment(publisher_name, journal.publisher)
    else:
        publisher = fetch_publisher(publisher_name)

    barepub = BarePublication(title=title,
                              issue=issue,
                              volume=volume,
                              pubdate=pubdate,
                              paper=paper,
                              pages=pages,
                              doi=doi,
                              pubtype=pubtype,
                              publisher_name=publisher_name,
                              journal=journal,
                              publisher=publisher,
                              pdf_url=pdf_url)
    pub = paper.add_publication(barepub)
    cur_pubdate = paper.pubdate
    if type(cur_pubdate) != type(pubdate):
        cur_pubdate = cur_pubdate.date()
    if pubdate and pubdate > cur_pubdate:
        paper.pubdate = pubdate
    paper.update_availability()
    return paper, pub
Exemple #8
0
def _create_publication(paper, metadata):
    if not metadata:
        return
    if not 'container-title' in metadata or not metadata['container-title']:
        return
    doi = to_doi(metadata.get('DOI',None))

    title = metadata['container-title']
    if type(title) == type([]):
        title = title[0]
    title = title[:512]

    issn = metadata.get('ISSN',None)
    if issn and type(issn) == type([]):
        issn = issn[0] # TODO pass all the ISSN to the RoMEO interface
    volume = metadata.get('volume',None)
    pages = metadata.get('page',None)
    issue = metadata.get('issue',None)
    date_dict = metadata.get('issued',dict())
    pubdate = None
    if 'date-parts' in date_dict:
        dateparts = date_dict.get('date-parts')[0]
        pubdate = date_from_dateparts(dateparts)
    # for instance it outputs dates like 2014-2-3
    publisher_name = metadata.get('publisher', None)
    if publisher_name:
        publisher_name = publisher_name[:512]

    pubtype = metadata.get('type','unknown')
    pubtype = CROSSREF_PUBTYPE_ALIASES.get(pubtype, pubtype)

    # PDF availability
    pdf_url = None
    licenses = set([(license or {}).get('URL') for license in metadata.get('license', [])])
    if any(map(is_oa_license, licenses)):
        pdf_url = 'http://dx.doi.org/'+doi

    # Lookup journal
    search_terms = {'jtitle':title}
    if issn:
        search_terms['issn'] = issn
    journal = fetch_journal(search_terms)

    publisher = None
    if journal:
        publisher = journal.publisher
        AliasPublisher.increment(publisher_name, journal.publisher)
    else:
        publisher = fetch_publisher(publisher_name)

    barepub = BarePublication(title=title, issue=issue, volume=volume,
            pubdate=pubdate, paper=paper, pages=pages,
            doi=doi, pubtype=pubtype, publisher_name=publisher_name,
            journal=journal, publisher=publisher, pdf_url=pdf_url)
    pub = paper.add_publication(barepub)
    cur_pubdate = paper.pubdate
    if type(cur_pubdate) != type(pubdate):
        cur_pubdate = cur_pubdate.date()
    if pubdate and pubdate > cur_pubdate:
        paper.pubdate = pubdate
    paper.update_availability()
    return paper, pub
Exemple #9
0
 def test_overescaped(self):
     terms = {'issn': '2310-0133'}
     journal = fetch_journal(terms)
     self.assertEqual(journal.publisher.alias,
                      'Научный издательский дом Исследов')
Exemple #10
0
 def test_ampersand(self):
     terms = {'issn': '0003-1305'}
     journal = fetch_journal(terms)
     self.assertEqual(journal.publisher.name, 'Taylor & Francis')
Exemple #11
0
 def test_unicode(self):
     terms = {'issn': '0375-0906'}
     journal = fetch_journal(terms)
     self.assertEqual(journal.title,
                      'Revista de Gastroenterología de México')
     self.assertEqual(journal.publisher.name, 'Elsevier España')
Exemple #12
0
 def test_closed(self):
     self.assertEqual(
         fetch_journal({
             'issn': '0001-4826'
         }).publisher.oa_status, 'NOK')