internetarchive / internetarchive/openlibrary

Import endpoint should allow for Open Library work identifiers

Open
#9,471 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Lead: @scottbarnes Module: Import Priority: 3 Python Type: Feature Request
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 14h
Merged PRs (30d)
126

Description

### Problem

### TL;DR

Same as https://github.com/internetarchive/openlibrary/issues/9411 but for Works :)

### A clear and concise description of what you want to happen

Be able to provide Open Library `OL…W` Work identifiers when importing books if the importer has already otherwise dealt with the matching (e.g., using other identifiers).

### Expected behaviour / screenshots (ex: Figma design screenshots for UI feature)

Being able to include the OL Work identifier in the JSON or other import payload.

### Additional Context

It might be possible for bots or other scripts to do matching beforehand, or even for import sources to already have OL identifiers (e.g., BookBrainz, MusicBrainz, and Wikidata all do). Being able to provide this to OL when adding an import means that the OL importing pipeline would have to do a lot less work since it’s just been handed the ID.

### Proposal & Constraints

### What is the proposed solution / implementation?

Add a field in the schema to provide an `OL…W` identifier for a given book.

### Is there a precedent of this approach succeeding elsewhere?

### Which suggestions or requirements should be considered for how feature needs to appear or be implemented?

Unlike the case with https://github.com/internetarchive/openlibrary/issues/9411 a book (in the OL schema/data model) can only even have one Work and either the Work is known (ie., there’s an `OL…W` identifier) or it isn’t. However, it could still take the approach of using the `OL…W` in the first hand, but also be ready to toss it if it turns out that it’s a bad identifier and fall back to matching based on other values (ie., the current approach).

### Leads

### Related files

Schema: https://github.com/internetarchive/openlibrary-client/blob/master/olclient/schemata/import.schema.json (though this may be moved to this repository; see https://github.com/internetarchive/openlibrary/issues/9351 for status of this)
Import logic: https://github.com/internetarchive/openlibrary/tree/master/openlibrary/plugins/importapi

### Stakeholders


### Instructions for Contributors

- Please [run these commands](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#working-on-your-branch) to ensure your repository is up to date **before** [creating a new branch](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#making-changes-and-creating-a-pull-request) to work on this issue and **each time after** pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the import schema at olclient/schemata/import.schema.json and the import logic under openlibrary/plugins/importapi. Trace how book identifiers are accepted and matched, then verify that an OL…W identifier can be supplied in an import payload and that invalid identifiers can fall back to existing matching behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.