data-exp-lab / girder_ythub

Girder plugin enabling intergration with tmpnb
BSD 3-Clause "New" or "Revised" License
3 stars 10 forks source link

Dataverse external tool for Binder #9

Closed pdurbin closed 1 year ago

pdurbin commented 1 year ago

@Xarthisius me again! Happy New Year, if it isn't too late for that. 😄

Back in ec3f756 you added Dataverse support and I'm FINALLY getting around to playing with it again but I'm noticing something strange.

The redirect for a dataset on our demo server seems to work fine...

$ curl -i "https://girder.hub.yt/api/v1/ythub/dataverse?datasetPid=doi:10.5072/FK2/U6AEZM&siteUrl=https://demo.dataverse.org"

HTTP/2 303 
...
location: https://mybinder.org/v2/dataverse/10.5072/FK2/U6AEZM
...

... but it doesn't seem to work for Harvard Dataverse...

$ curl -i "https://girder.hub.yt/api/v1/ythub/dataverse?datasetPid=doi:10.7910/DVN/TJCLKP&siteUrl=https://dataverse.harvard.edu"

HTTP/2 500 
server: nginx
date: Thu, 19 Jan 2023 17:29:11 GMT
content-type: application/json
content-length: 78
allow: DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT

{"message": "An unexpected error occurred on the server.", "type": "internal"}

Any ideas on what's going on here? (I briefly tried to get the girder_ythub app running locally but I'm pretty lost.)

Also, I'm looking for a home for this external tool manifest you originally posted at https://github.com/IQSS/dataverse/issues/6807#issuecomment-611794683

{
  "displayName": "Binder",
  "description": "Run on Binder",
  "scope": "dataset",
  "type": "explore",
  "toolUrl": "https://girder.hub.yt/api/v1/ythub/dataverse",
  "toolParameters": {
    "queryParameters": [
      {
        "datasetPid": "{datasetPid}"
      },
      {
        "siteUrl": "{siteUrl}"
      },
      {
        "key": "{apiToken}"
      }
    ]
  }
}

Could we maybe add it to the README of this "girder_ythub" repo. We have a rule that external tool manifests shouldn't be hosted in the Dataverse guides. That's why we asked you and other Whole Tale folks to set up https://wholetale.readthedocs.io/en/stable/users_guide/integration.html#dataverse-external-tools (thanks again!).

So to summarize, I'd love to get https://girder.hub.yt/api/v1/ythub/dataverse working for Harvard Dataverse (no 500 error) and I'd love to find a home for the JSON file. Please let me know what you think! As always, you are welcome to ping me at https://chat.dataverse.org ! Thanks!

Oh, just to give a quick visual of the tool loaded up on a test server just now:

Screen Shot 2023-01-19 at 11 57 44 AM

Xarthisius commented 1 year ago

Hi @pdurbin! I don't know why, but for some reason when yt.hub tries to access:

https://dataverse.harvard.edu/api/datasets/:persistentId?persistentId=doi:10.7910/DVN/TJCLKP

during doi resolution it gets 403 forbidden response. That in turn causes 500 error you've been seeing.

Xarthisius commented 1 year ago

I switched from urllib to requests. Try now?

pdurbin commented 1 year ago

@Xarthisius much better! Thanks!

$ curl -i "https://girder.hub.yt/api/v1/ythub/dataverse?datasetPid=doi:10.7910/DVN/TJCLKP&siteUrl=https://dataverse.harvard.edu"

HTTP/2 303 
server: nginx
date: Thu, 19 Jan 2023 17:54:39 GMT
content-type: application/json
content-length: 4
allow: DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT
location: https://mybinder.org/v2/dataverse/10.7910/DVN/TJCLKP
content-security-policy: default-src 'self'; script-src 'self' 'unsafe-inline' https://www.google-analytics.com; img-src 'self' https://dxl.ncsa.illinois.edu https://data-exp-lab.github.io https://www.google-analytics.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' data: https://themes.googleusercontent.com https://fonts.gstatic.com; frame-src 'none'; object-src 'none'
strict-transport-security: max-age=31536000
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-clacks-overhead: GNU Terry Pratchett
referrer-policy: strict-origin-when-cross-origin

And thanks for opening this issue about the docs!