kensho-technologies/qwikidata

How to render Time (datavalue type)

ccsasuke opened this issue · 1 comments

The Time datavalue type has "precision", which affects how the time is interpreted or rendered.
The following example is taken from the comments in qwikidata/datavalue.py

That is, 1988-07-13T00:00:00 with
      precision 8 (decade) will be interpreted as 198?-??-?? and rendered as "1980s".

However, the Time class does not seem to have a method to render the time value in such way according to its precision. The __str__() method simply prints the precision, while the get_parsed_datetime_dict() method ignores the precision.

Am I missing anything? Thanks.

I don't think you are missing anything, but maybe this will help clarify ... the comments in the code are taken from the Wikidata description of the fields so the "render" there refers to Wikidata's rendering of that information not qwikidata's rendering. You are correct in your understanding that qwikidata does not provide a way to do this rendering but does provide access to the precision data.

The relevant Wikidata docs are,

By looking at the talk page, it appears that there has been some discussion and editing since I wrote these qwikidata docs,
https://www.mediawiki.org/wiki/Talk:Wikibase/DataModel/JSON (in the "Disputed interpretation" section). If you come up with a string rendering that incorporates precision that you are happy with, I'm happy to take a look at a pull request.

best,
-G