hypothesis / hypothesis/h

prevent ongoing document equivalence explosions

Open
#6,216 0 comments 0 reactions 0 assignees View on GitHub
bug document equivalence
Dominant language
Python
Stars
3.2k
Forks
459
Avg merge
27d 1h
Merged PRs (30d)
1

Description

The following URL was assigned in a course:

https://www.npr.org/sections/health-shots/2010/08/11/129127432/paul-longmore-historian-and-advocate-for-disabled-dies

The course dashboard displayed this list of annotated documents:

![image](https://user-images.githubusercontent.com/46509/92958570-4d85cf80-f41f-11ea-91c0-c4bea45217a4.png)

These are all the "same" document, with document_id 22734. Most users won't (yet) be seeing this dashboard view, but for everyone our client will load and try to anchor ~2500 annotations, the vast majority of which do not apply to this article.

This happens because:

1. The docs share this common metadata declaration: {href: "https://feeds.npr.org/feeds/103537970/feed.json", rel: "alternate", type: "application/json"}

2. We formerly used `rel="alternate"` to form equivalences, until we realized that this pattern -- a feed URL that's common to a whole class of documents on a site -- was causing an explosion of unwanted equivalence.

If nobody had ever annotate an NPR health article containing https://feeds.npr.org/feeds/103537970/feed.json as rel="alternate" I don't think we'd be seeing this problem, because the linking records in `document_uri` would not exist. But they do, and rewriting the database to untangle things isn't an option because we [merge](https://github.com/hypothesis/h/blob/5ab7cd380a6ccbfd08e90f438359662e58784290/h/cli/commands/normalize_uris.py#L75) equivalences.

But can we at least prevent creating new false equivalences, so that the next previously-unannotated NPR health article doesn't land in the same bucket?

One way to do that would be to stop the client from sending link elements except for `rel="canonical"`.

Currently, [here](https://github.com/hypothesis/client/blob/69c50358f82597facc4b1c4f9520b7cb8731d975/src/annotator/plugin/document.js#L231), we allow `alternate`, `canonical`, `bookmark`, and `shortlink`.

Consider two previously unannotated articles that use ``:

1 https://www.npr.org/2020/09/11/911828384/trump-says-he-downplayed-coronavirus-threat-in-u-s-to-avert-panic

2 https://www.npr.org/sections/health-shots/2020/09/11/911885577/as-covid-19-vaccine-trials-move-at-warp-speed-recruiting-black-volunteers-takes-

Annotating 1 creates document_id 22,734 and merges it with all the others.

Now I'll annotate 2 using a client that shortens the array of allowed link elements from ['alternate', 'canonical', 'bookmark', 'shortlink'] to ['canonical']. We get a fresh document_id, 1,125,647.

An alternate solution would be to keep sending these links and stop the equivalence on the back end. The client-side solution is easiest for me to demo, so that's what I'm illustrating here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.