openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

When merging works, display author names

Open zorae opened this issue 1 year ago • 8 comments

Proposal

The view for merging works currently only displays the OL…A identifiers of works’ authors. I propose also displaying the name of each author.

IMG_3607

Justification

It is hard to tell if the selected works are true duplicates. Because the OL…A identifiers are hard to visually parse, I cannot easily tell if there are works with the same title but a different author.

Also, if some of the works have different authors, the current merge view makes it impossible to tell if those authors are actually different or if it is a case of duplicate author records (i.e. same author name, but different OL…A identifier).

The proposed change would allow me to merge works quicker and without having to click through to author pages.

Breakdown

Requirements Checklist

  • [ ] Update https://github.com/internetarchive/openlibrary/blob/9641c21c548b588a8230ea19c25cc32c6ffc38cd/openlibrary/components/MergeUI/utils.js to have a new method, get_author_names(works: object[]) -> Promise<Record<str, object>>
    • [ ] This method takes all the author keys out of the work (use lodash's uniq and flatMap methods). They are located at .authors[].author.key (sample work)
    • [ ] makes a call to /search/authors.json with all the authors, eg key:(/authors/OL123A OR /authors/OL453A OR ...). Example: https://openlibrary.org/search/authors.json?q=key%3A(%2Fauthors%2FOL29079A%20OR%20/authors/OL53264A)&mode=everything&fields=key,name,birth_date,death_date
    • [ ] Returns an object that maps the author key to the document returned by the search response
  • [ ] In https://github.com/internetarchive/openlibrary/blob/32bb0bf5dcbb4d2a9d2d7dc86f01c66ad2c0c013/openlibrary/components/MergeUI/MergeTable.vue
    • [ ] Create a new asyncComputed, augmentedRecords, that makes a copy of this.records (use _.cloneDeep), fetches the author data with the above method, and adds the name field to the author object in the copies. (The copy is needed to avoid accidentally saving this data back into open library).
    • [ ] Update the template to use the augmentedRecords when it's displaying the records.

That should largely do it!

For development/testing: Start the vue serve for live reloading

npm install --no-audit
npm run serve --component=MergeUI

And then go to eg http://localhost:8080/static/components/?records=OL1233242W,OL12312W


Instructions for Contributors

Please run these commands to ensure your repository is up to date before creating a new branch 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.

zorae avatar Aug 27 '24 07:08 zorae

It is hard to tell if the selected works are true duplicates. […] I cannot easily tell if there are works with the same title but a different author.

Just a note that works with the same title and same author might still not be true duplicates. :)

Other than that, I’m all for displaying more information when merging!

Freso avatar Aug 27 '24 08:08 Freso

I've updated the issue with steps/instructions, so this should now be a good first issue if someone is interested in tackling it! Help wanted! :)

cdrini avatar Sep 10 '24 16:09 cdrini

@cdrini I'm interested in taking this one if it's still available.

DanielleInkster avatar Sep 18 '24 15:09 DanielleInkster

Hi @DanielleInkster it is! Assigning it to you, let us know if you have any questions!

cdrini avatar Sep 19 '24 13:09 cdrini

@cdrini - My PR is up. I highlighted two sections I was unsure of in my PR request. I noticed there is another PR above. Has this been reassigned?

DanielleInkster avatar Oct 01 '24 16:10 DanielleInkster

Wonderful! Responded/closed the other PR, and we should be able to review your PR within the week or so!

cdrini avatar Oct 02 '24 09:10 cdrini

is this issue still open? If Yes, can u assign it to me?

DipeshK47 avatar Oct 11 '24 21:10 DipeshK47

@DipeshK47 It’s still open, but there’s an open PR for it by the currently assigned person.

Freso avatar Oct 12 '24 15:10 Freso