-
Notifications
You must be signed in to change notification settings - Fork 47
Add 13 harvesters for the Pensoft suite of open journals #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
erinspace
wants to merge
9
commits into
CenterForOpenScience:develop
Choose a base branch
from
erinspace:feature/pensoft
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
42f0132
make end date optional because some OAI harvesters break with it
erinspace 2a082ae
Add tests for all pensoft harvesters
erinspace 685030f
Add image files for new harvesters
erinspace 7d34e12
Add harvesters for pensoft
erinspace d7a32f5
Add new base class for Pensoft harvesters based on OAI PMH harvesters
erinspace c5f3f68
Remove Pensoft baseclass from __init__
erinspace 011fa80
Add pensoft base, make each instance smaller, change example calls
erinspace dd4e512
Remove unused check and make return docs better
erinspace 21305dd
Merge branch 'develop' of github.com:fabianvf/scrapi into feature/pen…
erinspace File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| """ | ||
| Harvester for repositories in Pensoft for the SHARE project | ||
|
|
||
| Example API calls for each service in each harvester | ||
| """ | ||
|
|
||
|
|
||
| from __future__ import unicode_literals | ||
|
|
||
| from furl import furl | ||
| from lxml import etree | ||
| from datetime import timedelta, date | ||
|
|
||
| from scrapi import settings | ||
| from scrapi import util | ||
| from scrapi.base import OAIHarvester | ||
| from scrapi.linter.document import RawDocument | ||
|
|
||
|
|
||
| class PensoftHarvester(OAIHarvester): | ||
|
|
||
| @property | ||
| def base_url(self): | ||
| return 'http://{short}.pensoft.net/oai.php/?set={short}'.format(short=self.short_name) | ||
|
|
||
| @property | ||
| def url(self): | ||
| return 'http://{short}.pensoft.net'.format(short=self.short_name) | ||
|
|
||
| property_list = ['format', 'rights', 'source', 'relation', 'date', 'identifier', 'type', 'setSpec'] | ||
| timezone_granularity = False | ||
|
|
||
| # don't include the end date for pensoft harvesters | ||
| def harvest(self, start_date=None, end_date=None): | ||
|
|
||
| start_date = (start_date or date.today() - timedelta(settings.DAYS_BACK)).isoformat() | ||
| end_date = (end_date or date.today()).isoformat() | ||
|
|
||
| furled_baseurl = furl(self.base_url) | ||
| furled_baseurl.args['verb'] = 'ListRecords' | ||
| furled_baseurl.args['metadataPrefix'] = 'oai_dc' | ||
| furled_baseurl.args['from'] = start_date | ||
|
|
||
| records = self.get_records(furled_baseurl.url, start_date) | ||
|
|
||
| return [ | ||
| RawDocument({ | ||
| 'doc': etree.tostring(record, encoding=self.record_encoding), | ||
| 'source': self.short_name, | ||
| 'docID': record.xpath('ns0:header/ns0:identifier', namespaces=self.namespaces)[0].text, | ||
| 'filetype': 'xml' | ||
| }) for record in records | ||
| ] | ||
|
|
||
|
|
||
| class BiodiversityDataJournalHarvester(PensoftHarvester): | ||
| '''Harvester for Biodiversity Data Journal | ||
| Sample API Call = http://bdj.pensoft.net/oai.php?set=bdj&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'bdj' | ||
| long_name = 'Biodiversity Data Journal' | ||
|
|
||
|
|
||
| class ZooKeysHarvester(PensoftHarvester): | ||
| '''Harvester for ZooKeys | ||
| Sample API Call = http://zookeys.pensoft.net/oai.php?set=zookeys&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'zookeys' | ||
| long_name = 'ZooKeys' | ||
|
|
||
|
|
||
| class PhytoKeysHarvester(PensoftHarvester): | ||
| '''Harvester for PhytoKeys | ||
| Sample API Call = http://phytokeys.pensoft.net/oai.php?set=phytokeys&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'phytokeys' | ||
| long_name = 'PhytoKeys' | ||
|
|
||
|
|
||
| class MycoKeysHarvester(PensoftHarvester): | ||
| '''Harvester for MycoKeys | ||
| Sample API Call = http://mycokeys.pensoft.net/oai.php?set=mycokeys&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'mycokeys' | ||
| long_name = 'MycoKeys' | ||
|
|
||
|
|
||
| class BioRiskHarvester(PensoftHarvester): | ||
| '''Harvester for BioRisk | ||
| Sample API Call = http://biorisk.pensoft.net/oai.php?set=biorisk&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'biorisk' | ||
| long_name = 'BioRisk' | ||
|
|
||
|
|
||
| class ComparativeCytogeneticsHarvester(PensoftHarvester): | ||
| '''Harvester for Comparative Cytogenetics | ||
| Sample API Call = http://compcytogen.pensoft.net/oai.php?set=compcytogen&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'compcytogen' | ||
| long_name = 'Comparative Cytogenetics' | ||
|
|
||
|
|
||
| class InternationalJournalofMyriapodologyHarvester(PensoftHarvester): | ||
| '''Harvester for International Journal of Myriapodology | ||
| Sample API Call = http://ijm.pensoft.net/oai.php?set=ijm&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'ijm' | ||
| long_name = 'International Journal of Myriapodology' | ||
|
|
||
|
|
||
| class JournalofHymenopteraResearchHarvester(PensoftHarvester): | ||
| '''Harvester for Journal of Hymenoptera Research | ||
| Sample API Call = http://jhr.pensoft.net/oai.php?set=jhr&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'jhr' | ||
| long_name = 'Journal of Hymenoptera Research' | ||
|
|
||
|
|
||
| class NatureConservationHarvester(PensoftHarvester): | ||
| '''Harvester for Nature Conservation | ||
| Sample API Call = http://natureconservation.pensoft.net/oai.php?set=natureconservation&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'natureconservation' | ||
| long_name = 'Nature Conservation' | ||
|
|
||
|
|
||
| class NeoBiotaHarvester(PensoftHarvester): | ||
| '''Harvester for NeoBiota | ||
| Sample API Call = http://neobiota.pensoft.net/oai.php?set=neobiota&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'neobiota' | ||
| long_name = 'NeoBiota' | ||
|
|
||
|
|
||
| class SubterraneanBiologyHarvester(PensoftHarvester): | ||
| '''Harvester for Subterranean Biology | ||
| Sample API Call = http://subtbiol.pensoft.net/oai.php?set=subtbiol&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'subtbiol' | ||
| long_name = 'Subterranean Biology' | ||
|
|
||
|
|
||
| class DeutscheEntomologischeZeitschriftHarvester(PensoftHarvester): | ||
| '''Harvester for Deutsche Entomologische Zeitschrift | ||
| Sample API Call = http://dez.pensoft.net/oai.php?set=dez&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'dez' | ||
| long_name = 'Deutsche Entomologische Zeitschrift' | ||
|
|
||
|
|
||
| class ZoosystematicsandEvolutionHarvester(PensoftHarvester): | ||
| '''Harvester for Zoosystematics and Evolution | ||
| Sample API Call = http://zse.pensoft.net/oai.php?set=zse&verb=ListRecords&metadataPrefix=oai_dc | ||
| ''' | ||
|
|
||
| short_name = 'zse' | ||
| long_name = 'Zoosystematics and Evolution' | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we get in contact with pensoft about this limitation?