Page MenuHomePhabricator

Respect units when checking “Range” and “Diff within range” constraints
Closed, ResolvedPublic

Description

RangeChecker and DiffWithinRange checker need to account for units. Hopefully, it won’t be too hard to calculate and return the normalized value (which we already have for the query service) in RangeCheckerHelper.

Patch-For-Review:

Event Timeline

Lydia_Pintscher moved this task from incoming to ready to go on the Wikidata board.

Hm, what happens if any values can’t be converted to standard units? Perhaps we can just compare the raw quantities in that case (as before), and assume that most properties would also have a Units constraints which would report this case instead.

Change 352162 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Convert quantities to standard units

https://gerrit.wikimedia.org/r/352162

Jonas changed the task status from Open to Stalled.Jun 6 2017, 1:24 PM
Lucas_Werkmeister_WMDE changed the task status from Stalled to Open.Sep 18 2017, 2:26 PM

Copying this comment from Gerrit so it doesn’t get buried:

There’s one remaining problem [with Change Ic5dee62c01, PS12]: While the conversion of units in “difference within range” is very nice in theory (at least, IMHO :) ), it doesn’t really work on Wikidata. There are only three “difference within range” constraints on Wikidata, and they all use the unit “year” (Q577), which doesn’t have a standard unit conversion. We might have to make “year” a special case, where we really just count the full years between two dates.

Change 382204 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Add support for “year” ranges

https://gerrit.wikimedia.org/r/382204

Change 352162 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Convert quantities to standard units

https://gerrit.wikimedia.org/r/352162

Change 382204 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Add support for “year” ranges

https://gerrit.wikimedia.org/r/382204