wellcomecollection / platform

Wellcome Collection Digital Platform
https://developers.wellcomecollection.org/
MIT License
48 stars 10 forks source link

Getting a work from a bnumber #4471

Closed tomcrane closed 4 years ago

tomcrane commented 4 years ago

(assuming for now b number is still the driver - #4468)

DDS.new needs to get bibliographic info from the catalogue API. Catalogue API knows about bnumbers: https://api.wellcomecollection.org/catalogue/v2/works?include=identifiers But what's the best way to get a work from the catalogue API, given its b number?

e.g., from b16699178 get https://api.wellcomecollection.org/catalogue/v2/works/a2262ru9?include=identifiers,items,subjects,genres,contributors,production,notes,collection

This needs to be able to retrieve CALM-origin works too, from a b number.

kenoir commented 4 years ago

The catalogue api should support being able to search by identifier. Ping @jamesgorrie

alexwlchan commented 4 years ago

You can query for a b number it, e.g.

https://api.wellcomecollection.org/catalogue/v2/works?query=BNUMBER&include=identifiers

There was talk of adding a filter for identifiers for the item requesting service, but I don't think that was ever implemented, and it's not in the docs: https://developers.wellcomecollection.org/catalogue/v2/works/getworks

kenoir commented 4 years ago

There was talk of adding a filter for identifiers for the item requesting service, but I don't think that was ever implemented, and it's not in the docs: https://developers.wellcomecollection.org/catalogue/v2/works/getworks

It's not, but we probably should support that.

tomcrane commented 4 years ago

https://api.wellcomecollection.org/catalogue/v2/works?query=b14658197

This returns 8 results; one of them is I think the "right" one at https://wellcomecollection.org/works/nydjbrr7

How do I know which result is the source of descriptive metadata for the digitised item that Goobi processed as b14658197 ? They all have b14658197 in their identifiers.

nydjbrr7 is the only one that has a workType k.

Need to establish a rule set for all workTypes, disambiguation etc. I can see that nydjbrr7 is the one that points back to the IIIF Manifest, so that's one way (even if it appears dangerously circular) - but at what point in workflow does that appear in the catalogue API? If this were the info to match on, it would need to be there by the time Goobi first tells the DDS about the b number.

(btw connecting the IIIF resources to the X-Rays of the painting here would be awesome).

alexwlchan commented 4 years ago

Not sure about the bigger question; the preferred way to look up a work by identifier is https://api.wellcomecollection.org/catalogue/v2/works?identifiers=b14658197

That does a Boolean filter rather than a query, so returns slightly faster and is kinder to our index!

tomcrane commented 4 years ago

Always be kind to indexes. One day, it might be your index.

alexwlchan commented 4 years ago

I can see that nydjbrr7 is the one that points back to the IIIF Manifest, so that's one way (even if it appears dangerously circular) - but at what point in workflow does that appear in the catalogue API?

It’s pretty variable. It goes something like:

The catalogue API is eventually consistent, but I don't think we have any guarantees on how long updates take to propagate.

tomcrane commented 4 years ago

Little bit more info on picking the work I am interested in.

Of the 8 results returned for https://api.wellcomecollection.org/catalogue/v2/works?identifiers=b14658197&include=identifiers, the one I should pick, nydjbrr7, is the only one without a Miro Identifier. It only has a Sierra identifier.

tomcrane commented 4 years ago

(write a test app that tries to acquire one and only one work for each b number currently known to DDS; 0 works or > 1 works are fails).

tomcrane commented 4 years ago

The questions above are now moot as only one result is returned for an explicit b number query. This can be closed.