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

Zenodo #7

Open
00sapo opened this issue Feb 3, 2023 · 3 comments
Open

Zenodo #7

00sapo opened this issue Feb 3, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@00sapo
Copy link

00sapo commented Feb 3, 2023

Some conferences in my field are used to publish papers to zenodo. Therefore, I would like to implement a lookup for zenodo. I've given a look at the code, and it should be similar to the DBLP API class, but I cannot completely get what are the supposed input and output types of each method.

Documentation for the Zenodo API is here: https://developers.zenodo.org/#list36

@dlesbre
Copy link
Owner

dlesbre commented Feb 3, 2023

Yes it's non obvious because the inheritance structure is quite large. It inherits from JSON_AT_Lookup will perform queries using title (and author, if present) info, and expect a JSON response. If you copy the DBLP class you should only have to change the following:

  • override name to a unique name, path and domain to the API's path and domain
  • override get_params to return the query parameters (so {'q': my_search_string, 'token':ACCESS_TOKEN}). You can construct a search string using self.author: str | None (space separated list of author last names) and self.title: str
  • override get_results to transform the query response (bytes) into a list of entries data. Typically this is convert to JSON (e.g. using SafeJSON.from_bytes), navigate to where the list of matches is, and returning an iterator to that list (SafeJSON.iter_list).
  • override get_value to parse your JSON into a BibtexEntry.
    • The SafeJSON class I use is simply a class that returns None instead of failing if keys/indexes/whatever are invalid
    • BibtexEntry just has all standard bibtex field as attributes, with some hidden normalization logic. Most fields are string options. The author field is a list of a custom Author class wich separates last and first names.
  • override FieldNames to the set of field names you define in get_value. This allows to skip queries for entries where all those fields are defined, since there is no data to add
  • Add your new class to the list in API/__init__.py

Let me know if you have more specific questions

@dlesbre
Copy link
Owner

dlesbre commented Feb 27, 2023

Since I haven't heard anymore from you I'll assume you figured it out. If not feel free to send me any further questions you might have!

@dlesbre dlesbre closed this as completed Feb 27, 2023
@00sapo
Copy link
Author

00sapo commented Feb 28, 2023

I haven't actually been working on this. I'll come back on it when I will need it again...

@dlesbre dlesbre added the enhancement New feature or request label Feb 1, 2024
@dlesbre dlesbre reopened this Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants