Authoritex
View SourceAn Elixir library for searching and fetching controlled vocabulary authority terms, inspired by the Samvera Community's Questioning Authority.
Installation
Add authoritex to your list of dependencies in mix.exs:
def deps do
[
{:authoritex, "~> 1.0.0"}
]
endConfiguration
Activate modules for the authorities you want to have available by
configuring them in config/config.exs:
# To activate all
config :authoritex,
authorities: [
Authoritex.FAST.CorporateName,
Authoritex.FAST.EventName,
Authoritex.FAST.Form,
Authoritex.FAST.Geographic,
Authoritex.FAST.Personal,
Authoritex.FAST.Topical,
Authoritex.FAST.UniformTitle,
Authoritex.FAST,
Authoritex.GeoNames,
Authoritex.Getty.AAT,
Authoritex.Getty.TGN,
Authoritex.Getty.ULAN,
Authoritex.Getty,
Authoritex.Homosaurus,
Authoritex.LOC.GenreForms,
Authoritex.LOC.Languages,
Authoritex.LOC.Names,
Authoritex.LOC.SubjectHeadings,
Authoritex.LOC
]
# Authoritex uses httpoison_retry https://github.com/mgwidmann/httpoison_retry
# Override the config in your application if needed
config :httpoison_retry,
max_attempts: 3,
wait: 1_000,
retry_unknown_errors: falseUsage
See Authoritex.authorities/0, Authoritex.search/2, Authoritex.search/3,
and Authoritex.fetch/1.
Implementing Additional Authorities
- Create a module implementing the
Authoritexbehaviour - Create a test module using the
Authoritex.TestCasemodule AuthoritexusesExVCRto cache HTTP requests in the test suite. If you're seeing unexpected results during development, runmix vcr.delete CODE_(whereCODEis your authority module's unique short code) to clear that authority's cached results
Testing using mocks
See Authoritex.Mock
Supported Elixir/OTP versions
Authoritex supports (i.e., is tested against) a matrix consisting of the three most recent Elixir minor versions and up to three most recent Erlang/OTP major versions (depending on Elixir compatibility). Right now, that means:
| Elixir/OTP | 25 | 26 | 27 |
|---|---|---|---|
| 1.18 | ✔️ | ✔️ | |
| 1.17 | ✔️ | ||
| 1.16 | ✔️ |
Support for other versions/combinations is possible (probable, even), but unsupported.
Contributing
Issues and Pull Requests are always welcome!