oaregithub / oare_mono

1 stars 0 forks source link

Connect to Metropolitan's photos of their collection (Develop way to aggregate open access photos at other websites) #807

Closed edstratford closed 2 years ago

edstratford commented 3 years ago

The Met has a small collection (about three dozen) tablets. But they have very nice photos.

We connect to cdli, but it would be nice to connect to the Met. (and figure out how we will do this for a range of collections aside from our own S3 images. Example: https://www.metmuseum.org/art/collection/search/326712

The Met has API's and open access.

hbludworth commented 2 years ago

@edstratford The open access APIs they have here are super easy to use! The only thing we'll need is the Object ID for each text. That's how the Met organizes everything (similar to a CDLI num for CDLI). Is that data already in the database somewhere? Or is it something you could add?

edstratford commented 2 years ago

We don't have those yet... I would expect we should add this somewhere - perhaps to the resource table and tag the type as MMA (for Metropolitan Museum of Art) -- but they are not showing the object ID's. If someone can help me query the API, I can help figure out the department and some key data to narrow that list down. We could start with a report of Object ID where the title of their page has 66.245.5a in it.

edstratford commented 2 years ago

Now the museum ID number that the API needs is in resource table, and the container column value for all these are 'metmuseum'. The links are also in place.

Note - the museum sometimes seems to be mislabeling them, so if there a photo does show and it seems to be the wring one, just make a comment here and I'll follow up to see whether it is the SQL that needs to be updated rather than a problem with the code, but all of them should bring up a photo.

Any tablet that has a name with "CTMMA 1" as publication prefix will apply here. For example, CTMMA 1 91, CTMMA 1 89a, etc.

hbludworth commented 2 years ago

@10808249 This will be a slightly more complicated issue than the ones you've worked on so far! Feel free to ask any questions as you go.

Currently, images that are displayed next to texts in the epigraphy view can come from two places:

  1. Our own AWS S3 archive
  2. CDLI

As you can see above, we'd like to pull images from the Met museum as well. The information for their API can be found here: https://metmuseum.github.io

You can see that one of the API routes allows you to use the Met's ObjectID to get information about an object, including links to images. So, we'll want to use that to get those links so we can display the images.

So, you'll have to find the code that we already have that gets images from S3 and CDLI, and add another source using the Met's API routes.

This is the tricky part: In order to get the images, you'll need to get the ObjectID for a text. Luckily, Dr. Stratford has added this information to the SQL database. It is a bit tricky.

The ObjectIDs can be found in the resource table. They will have a type of img, a container of metmuseum and the objectID will be found in the link column.

But, how do you get the right ObjectID for a given text so you can display the right pictures? Kinda tricky! I can explain better if you need it, but here is the basic idea:

Each text has a text_uuid. If you select the rows in the link table that have a reference_uuid that matches the text's text_uuid, then you'll get a number of rows. Then, you'll have to select all rows in resource that have a uuid that matches the link.obj_uuid and fit the other criteria above.

This will return the ObjectID for a text. You can then use that with the Met's API to get the picture links and display them on the frontend. I probably didn't explain this well so please ask questions if you need them!

10808249 commented 2 years ago
  1. making a new router for MET in packages/backend/src/api/text_epigraphies.ts
  2. and make a new function for getting image links by ObjectID on packages/backend/src/api/daos/ResourceDao/index.ts

Can you check if I understood correctly? I would appreciate it if you could let me know if there is anything I missed.

hbludworth commented 2 years ago

I have reassigned this issue to myself because it will require some updates to complete.