Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programmatically determine list of dataset "subjects" #27

Closed
mih opened this issue Jun 13, 2022 · 7 comments
Closed

Programmatically determine list of dataset "subjects" #27

mih opened this issue Jun 13, 2022 · 7 comments

Comments

@mih
Copy link
Member

mih commented Jun 13, 2022

Calling pyDataverse.api.NativeApi.create_dataset() requires to specified "subjects". This is not optional, and it cannot be an arbitrary string.

The WebUI exposes a predefined list of identifiers

image

we have to be able to query this list programmatically, in order to be able to give meaningful advice for composing this mandatory dataset metadata.

@mih
Copy link
Member Author

mih commented Jun 14, 2022

I confirmed that this list is not defined in pyDataverse code.

@bpoldrack
Copy link
Member

This seems to be the request to get that list:

❱ curl -H X-Dataverse-key:$API_TOKEN $SERVER_URL/api/metadatablocks 
{"status":"OK","data":[{"id":1,"displayName":"Citation Metadata","name":"citation"},{"id":2,"displayName":"Geospatial Metadata","name":"geospatial"},{"id":3,"displayName":"Social Science and Humanities Metadata","name":"socialscience"},{"id":4,"displayName":"Astronomy and Astrophysics Metadata","name":"astrophysics"},{"id":5,"displayName":"Life Sciences Metadata","name":"biomedical"},{"id":6,"displayName":"Journal Metadata","name":"journal"}]} 

@ksarink
Copy link
Collaborator

ksarink commented Jun 17, 2022

This seems to be the request to get that list:

❱ curl -H X-Dataverse-key:$API_TOKEN $SERVER_URL/api/metadatablocks 
{"status":"OK","data":[{"id":1,"displayName":"Citation Metadata","name":"citation"},{"id":2,"displayName":"Geospatial Metadata","name":"geospatial"},{"id":3,"displayName":"Social Science and Humanities Metadata","name":"socialscience"},{"id":4,"displayName":"Astronomy and Astrophysics Metadata","name":"astrophysics"},{"id":5,"displayName":"Life Sciences Metadata","name":"biomedical"},{"id":6,"displayName":"Journal Metadata","name":"journal"}]} 

This api endpoint does not seem to provide the information needed. Under $SERVER_URL/api/metadatablocks/citation/ the field subject is defined but there is no information about the possible values. See:

"subject": {
    "name": "subject",
    "displayName": "Subject",
    "title": "Subject",
    "type": "TEXT",
    "watermark": "",
    "description": "Domain-specific Subject Categories that are topically relevant to the Dataset."
},

@pdurbin
Copy link

pdurbin commented Jun 17, 2022

I'm sorry. The list of subjects is not available via API expect through an "admin" API that you usually can't reach unless you are ssh'ed into the Dataverse server.

I made a note about your request at IQSS/dataverse#1510 (comment)

In practice, you'll probably have to hard-code the list of subjects.

@bpoldrack
Copy link
Member

Here is the list as extracted from the webinterface:

['Agricultural Sciences',
 'Arts and Humanities',
 'Astronomy and Astrophysics',
 'Business and Management',
 'Chemistry',
 'Computer and Information Science',
 'Earth and Environmental Sciences',
 'Engineering',
 'Law',
 'Mathematical Sciences',
 'Medicine, Health and Life Sciences',
 'Physics',
 'Social Sciences',
 'Other']

@bpoldrack
Copy link
Member

FTR: Should have looked at the linked commit in the dataverse issue first.

From within the docker I can get it here:

curl http://localhost:8080/api/admin/datasetfield/controlledVocabulary/subject

Just noting it here, in case that endpoint becomes relevant for us in the future.

@pdurbin
Copy link

pdurbin commented Dec 8, 2022

Please note that the plan is to introduce a non-admin API (to show the list of subjects, etc.) in this PR:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants