internetarchive / internetarchive/openlibrary

DRY/Fix methods to fetch isbn from work + edition

Open
#2,439 0 comments 0 reactions 0 assignees View on GitHub
Lead: @mekarpeles Priority: 3 Theme: Identifiers Type: Refactor/Clean-up
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

Refactor `get_isbn` and `get_identifiers` methods to standardize the way we get isbns from works and editions. There are likely many ways that an isbn is taken from an `Edition`. There is a method, `Edition:get_identifiers` which looks like it's meant to handle this, but it doesn't appear to do any isbn cleanup or isbn13 to isbn10 transformation. The method seems a little convoluted to me (and it's only used in one other file). It might be best to remove it.

### Summary of requirements
- [ ] Method on `Edition` for getting isbn13s that
- [ ] returns an array of unique strings
- [ ] each string should be a normalized isbn
- [ ] converts any isbn10s to isbn13s
- [ ] Method on `Edition` for getting isbn10s
- [ ] returns an array of unique strings
- [ ] each string should be a normalized isbn
- [ ] converts any isbn13s to isbn10s
- [ ] Method on `Edition` for getting asin
- [ ] returns an array of string
- [ ] Does NOT use isbn10 if ASIN not on the record
- [ ] Anywhere in the templates that checks for isbn13/isbn10/asin should use these methods
- [ ] Any new methods should have tests
- [ ] Any related methods which are no longer used should be deleted
- [ ] Law of refactor: No observable changes (or list what they are)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.