Bananomia
Bananomia is a Ruby wrapper on the Bionomia API. Code follow the spirit/approach of the Gem serrano, and indeed much of the wrapping utility is copied 1:1 from that repo, thanks @sckott.
Installation
Add this line to your application's Gemfile:
gem 'bananomia'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install bananomia
Usage
Suggest Collector Names
Get collector name suggestions with a limit of 5:
Bananomia.suggest('Smith, Ja', limit: 5) # => MultiJson object
Filter suggestions to only public profiles
Bananomia.suggest('Smith, Ja', is_public: true) # => MultiJson object
Filter suggestions to only people that have occurrences associated with them:
Bananomia.suggest('Smith, Ja', has_occurrences: true) # => MultiJson object
Search Collectors
Search for a collector by name:
Bananomia.search_people('Thomas McElrath') # => MultiJson object
Filter the people search by taxonomic families_collected or taxonomic families_identified. If strict is set to true, then matches must include the taxonomic families.
Bananomia.search_people('Thomas McElrath', families_collected: 'Monotomidae', strict: true) # => MultiJson object
Bananomia.search_people('Thomas McElrath', families_identified: 'Monotomidae', strict: true) # => MultiJson object
Filter the search by whether the person was living on the specimen collection/identification date. If strict is set to true, it requires that they were alive on the date.
Bananomia.search_people('Smith', date: '1580-01-02', strict: true) # => MultiJson object
Setting the callback parameter returns JSON-P wrapped in the provided callback string.
Bananomia.search_people('Smith', callback: 'myFunction') # => JSON-P object
Use the page parameter for pagination of the search results:
Bananomia.search_people('Smith', page: 2) # => MultiJson object
Search Occurrences
Search for occurrences by GBIF datasetID and occurrenceID:
Bananomia.search_occurrences('f86a681d-7db8-483b-819a-248def18b70a', '7a1daa39-8d7c-d7c4-968f-799d58b3c7b0') # => MultiJson object
Setting the callback parameter returns JSON-P wrapped in the provided callback string.
Bananomia.search_occurrences('f86a681d-7db8-483b-819a-248def18b70a', '7a1daa39-8d7c-d7c4-968f-799d58b3c7b0', callback: 'myFunction') # => JSON-P object
Collectors
Get a person's profile by their ORCID or WikiData identifiers:
Bananomia.person('0000-0001-7618-5230') # => JSON-LD object
Specimens
Get a person's specimens by their ORCID or WikiData identifiers. Use the page parameter for pagination.
Bananomia.person('0000-0001-7618-5230', specimens: true) # => JSON-LD object
Bananomia.person('0000-0001-7618-5230', specimens: true, csv: true) # => comma-separated values
Occurrences
Get an occurrence with a GBIF occurrenceID:
Bananomia.occurrence('477976412') # => JSON-LD object
Parsing human names
Note: Bionomia provides a RESTful API for the human name parsing dwc_agent gem which uses the namae gem, and you likely will get better performance using those gems directly if parsing a large number of human names.
Parse authorships with names separated by ;
and each authorship set separated by \r\n
:
Bananomia.parse('Henry Robert Nicollon des Abbayes; Groom Q\r\nMrs. John Errol Chandos Aberdeen') # => MultiJson object
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, update the CHANGELOG.md
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/SpeciesFileGroup/bananomia. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT license. You can learn more about the MIT license on Wikipedia and compare it with other open source licenses at the Open Source Initiative.
Code of Conduct
Everyone interacting in the Bananomia project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.