adsabs / biblib-service

ADS library service
https://ui.adsabs.harvard.edu
MIT License
4 stars 8 forks source link

Tags, annotations, and other blasphemy #102

Open jonnybazookatone opened 8 years ago

jonnybazookatone commented 8 years ago

We have had several debates, and discussions about tags, and annotations (any many other forms of the same thing). For the foreseeable year, I believe this argument holds true:

So, I hesitantly write the following, and encourage that this feature only be considered if the developers and other team members think it is important.

Tags or Annotations: Backend

Given the way the system is currently architected, it is completely possible to include tags or annotations.

Bibcode level

Bibcode level refers to, annotating a single bibcode Bib1 with a tag, or an annotation, within a given library Lib1.

Each user's library contains the following:

class Library(db.Model):
    """
    Library table
    """
    ....
    bibcode = db.Column(MutableDict.as_mutable(JSON), default={})
    ....

The idea would be simple. You can add an annotation to the dictionary of the bibcode, so you'll essentially have a JSON blob as:

{
  "Bib1": {
    "annotations": ["page1": "Interesting!", "page20": "Discuss at work"],
    "tags": ["clusters", "to-read", "10/10"],
    },
}

Keep in mind, this would always have a Library scope. If you wanted to use the same tags and annotations for a user through all of our interface, I do not believe the library service is the way to do it, given the way the models are -- but worth thinking about.

Library level

Library level refers to the scope of the library itself, i.e., you want to tag or place notes on that library. Again this is easily feasible. One need just update the model of the library:

class Library(db.Model):
    """
    Library table
    """
    tags = db.Column(db.List(db.String(20)))
    annotations = db.Column(db.JSON)

Or whatever type of notes you wish to be added to the library at this level. You'd then simply update the REST end points, and migrate the database.

aaccomazzi commented 7 years ago

While I don't have an objection to the implementation suggested here, we should definitely take into consideration the W3C annotation model even for these kinds of annotations (called "whole-record", meaning we are annotating the entire document with a tag or some free-text content). See https://www.w3.org/annotation/ and links therein.

I suspect we'll need to collect a lot more information about the annotation itself to be compliant with the model. Given the potential expansion to full-text annotation in ADS and other services, we need to be sure that we can provide an OA-compliant API some day.