Skip to content

Make redirecting obsolete terms optional#205

Merged
mbklein merged 2 commits intomainfrom
no-auto-redirect
Feb 2, 2026
Merged

Make redirecting obsolete terms optional#205
mbklein merged 2 commits intomainfrom
no-auto-redirect

Conversation

@mbklein
Copy link
Contributor

@mbklein mbklein commented Jan 31, 2026

This PR adds support for fetching obsolete terms without redirecting, so the old label can be retrieved.

Changes:

  • Add Authoritex.Record and Authoritex.SearchResult structs to return instead of bare maps
  • Add opts \\ [] argument to Authoritex.fetch to allow for redirection (default: false)
  • Update Getty authorities to pull obsolete label if needed
  • Update LOC authorities to detect and handle obsolete terms
  • Update FAST authorities to detect and handle obsolete IDs (e.g., http://id.worldcat.org/fast/fst01205331 replaced by http://id.worldcat.org/fast/1205331 despite still being the same term)

This will be a MAJOR version update, as it breaks both the calling interface, the shape of the return values, and the redirect behavior:

# Without auto-redirect
iex> Authoritex.fetch("http://vocab.getty.edu/aat/300423926")
{:ok,
  %{
    id: "http://vocab.getty.edu/aat/300423926",
    label: "eating fork",
    qualified_label: "eating fork",
    hint: nil,
    variants: [],
    related: [replaced_by: "https://vocab.getty.edu/aat/300043099"]
  }}

# With auto-redirect
iex> Authoritex.fetch("http://vocab.getty.edu/aat/300423926", redirect: true)
{:ok,
%Authoritex.Record{
  id: "http://vocab.getty.edu/aat/300043099",
  label: "forks (flatware)",
  qualified_label: "forks (flatware)",
  hint: nil,
  variants: ["fork (flatware)", "eating fork", "叉子", "vork", "prakijzers",
    "Gabeln (Essbestecke)", "tenedor"],
  related: [replaces: "http://vocab.getty.edu/aat/300423926"]
}}

I am very open to calling the added field something other than extra. I thought maybe flags or notes, but couldn't really find one I felt great about. related seems much better.

First step in fixing repodev_planning_and_docs#5783

Copy link
Contributor

@bmquinn bmquinn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, though I think extra is a little vague. Approving regardless because I can live with it, but what do you think about provenance or relations instead?

@mbklein mbklein force-pushed the no-auto-redirect branch 2 times, most recently from 2bca065 to 2ac807b Compare February 2, 2026 17:57
@mbklein mbklein merged commit 64dc787 into main Feb 2, 2026
7 checks passed
@mbklein mbklein deleted the no-auto-redirect branch February 2, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants