glottolog / pyglottolog

Python API to access glottolog/glottolog
https://glottolog.org
Apache License 2.0
27 stars 5 forks source link

API object seems to export all citation-relevant metadata, apart from the year. #69

Open Anaphory opened 2 years ago

Anaphory commented 2 years ago

I have a need to import Glottolog into a BibTeX-like object. I noticed that I can get nearly all of the usual fields from attributes in the pyglottolog.Glottolog object, apart from the year:

Source(
    citekey="glottolog{:}".format(to_alphanumeric(glottolog.describe())),
    genre="book",
    address=glottolog.dataset_metadata.publisher.place,
    author=" and ".join(e.name for e in glottolog.current_editors)
    howpublished="Online",
    publisher=glottolog.dataset_metadata.publisher.name,
    title="Glottolog {:}".format(glottolog.describe()),
    url=glottolog.dataset_metadata.url,
    abstract=glottolog.dataset_metadata.description,
    year="????",
    eprint="doi: {:}".format(glottolog.publication.zenodo.doi),
)

For the year, I apparently need something like

import pyglottolog.metadata
pyglottolog.metadata.get_edition(repos=glottolog)["year"]

(where to my surprise, glottolog is the API object, not its .repos attribute) which seems a bit roundabout compared to the other attributes.

Did I miss something?

xrotwang commented 2 years ago

Sorry for late reply, just back from vacation.

From my POV, bibliographic metadata is still a bit of a mess - in general. And while we give explicit citation recommendations at https://github.com/glottolog/glottolog/releases , I'd say the essential piece of info is the DOI. Thus, I'd personally just get the BibTeX