I'd like to announce a new Labs tool to show a periodic table https://tools.wmflabs.org/ptable/. It is based on WikiPeriod's PHP code (in turn ported from JavaScript) and features several improvements:
* 'tiles' are wider and taller; * most of them are now provided with a background color (the same as Wikipedia's https://en.wikipedia.org/wiki/Periodic_table#Periodic_table_legend_for_category) based on the elements' "subclass of" property https://www.wikidata.org/wiki/Property:P279 (the same that powers period/group detection); * for labels, Wikidata's built-in language fallback is used instead of just falling back to English; * a public JSON API https://tools.wmflabs.org/ptable/api is available for everyone!
And some more under the hood:
* rewritten in Python with Jinja2: o more object-oriented o presentation is split from actual logic o less vulnerable to XSS attacks * a LRU (least recently used) cache with a maximum TTL (per-item time-to-live) value of 6 hours is used to avoid hitting data sources on every request; * both the Wikidata API and Wikidata Query can be used interchangeably as sources.
I had to create some items such as Q19753344 https://www.wikidata.org/wiki/Q19753344 and Q19753345 https://www.wikidata.org/wiki/Q19753345 to properly categorize elements. My knowledge of chemistry is limited, so please report/fix every mistake you can find ;-)
Future plans include:
* oxidation state * images * responsive design * alternative table structures
Forgot: the code is formally under review here https://gerrit.wikimedia.org/r/202610/. GPL-3.0+ as the old WikiPeriod.
Il 08/04/2015 01:18, Ricordisamoa ha scritto:
I'd like to announce a new Labs tool to show a periodic table https://tools.wmflabs.org/ptable/. It is based on WikiPeriod's PHP code (in turn ported from JavaScript) and features several improvements:
- 'tiles' are wider and taller;
- most of them are now provided with a background color (the same as Wikipedia's https://en.wikipedia.org/wiki/Periodic_table#Periodic_table_legend_for_category) based on the elements' "subclass of" property https://www.wikidata.org/wiki/Property:P279 (the same that powers period/group detection);
- for labels, Wikidata's built-in language fallback is used instead of just falling back to English;
- a public JSON API https://tools.wmflabs.org/ptable/api is available for everyone!
And some more under the hood:
- rewritten in Python with Jinja2: o more object-oriented o presentation is split from actual logic o less vulnerable to XSS attacks
- a LRU (least recently used) cache with a maximum TTL (per-item time-to-live) value of 6 hours is used to avoid hitting data sources on every request;
- both the Wikidata API and Wikidata Query can be used interchangeably as sources.
I had to create some items such as Q19753344 https://www.wikidata.org/wiki/Q19753344 and Q19753345 https://www.wikidata.org/wiki/Q19753345 to properly categorize elements. My knowledge of chemistry is limited, so please report/fix every mistake you can find ;-)
Future plans include:
- oxidation state
- images
- responsive design
- alternative table structures
Merged! Thanks to Lucie for reviewing ;-)
Il 08/04/2015 01:22, Ricordisamoa ha scritto:
Forgot: the code is formally under review here https://gerrit.wikimedia.org/r/202610/. GPL-3.0+ as the old WikiPeriod
On 8 April 2015 at 00:18, Ricordisamoa ricordisamoa@openmailbox.org wrote:
I'd like to announce a new Labs tool to show a periodic table. It is based on WikiPeriod's PHP code (in turn ported from JavaScript) and features several improvements:
This is very impressive; thank you!
for labels, Wikidata's built-in language fallback is used instead of just falling back to English;
I'm not sure what you mean, here. Are you suggesting that tools.wmflabs.org knows what my Wikidata language preferences are?
Also, I have some suggestions:
* A drop down to change the language of labels, as demonstrated on QLabel - http://googleknowledge.github.io/qlabel/
* When possible (e.g. on a mobile device), use the device's preferred language (as done by QRpedia)
* Instead of linking to Wikidata items, link to Wikipedia articles in the chosen language (or link to Resonator)
Il 22/05/2015 17:30, Andy Mabbett ha scritto:
On 8 April 2015 at 00:18, Ricordisamoa ricordisamoa@openmailbox.org wrote:
I'd like to announce a new Labs tool to show a periodic table. It is based on WikiPeriod's PHP code (in turn ported from JavaScript) and features several improvements:
This is very impressive; thank you!
for labels, Wikidata's built-in language fallback is used instead of just falling back to English;
I'm not sure what you mean, here. Are you suggesting that tools.wmflabs.org knows what my Wikidata language preferences are?
No. It tries to detect /your browser/'s preferred language and send it to Wikidata, which would apply its own fallback rules (e.g. if the Neapolitan label can't be found, it returns the Italian one).
Also, I have some suggestions:
- A drop down to change the language of labels, as demonstrated on
Thanks for the suggestion: filed T100045 https://phabricator.wikimedia.org/T100045. But you can already change language right now, see https://tools.wmflabs.org/ptable/?lang=ga for an example.
- When possible (e.g. on a mobile device), use the device's
preferred language (as done by QRpedia)
It's already possible not only on mobile devices, as I wrote above.
- Instead of linking to Wikidata items, link to Wikipedia articles
in the chosen language (or link to Resonator)
Created T100046 https://phabricator.wikimedia.org/T100046.
On 22 May 2015 at 21:33, Ricordisamoa ricordisamoa@openmailbox.org wrote:
Il 22/05/2015 17:30, Andy Mabbett ha scritto:
Are you suggesting that tools.wmflabs.org knows what my Wikidata language preferences are?
No. It tries to detect your browser's preferred language and send it to Wikidata, which would apply its own fallback rules (e.g. if the Neapolitan label can't be found, it returns the Italian one).
Ah, that makes sense. Thank you for explaining.
- A drop down to change the language of labels, as demonstrated on
Thanks for the suggestion: filed T100045.
- Instead of linking to Wikidata items, link to Wikipedia articles
in the chosen language (or link to Resonator)
Created T100046.
Thanks again. I've also raised T100077 ("Add tooltips") & T100078 ("Standardise capitalisation").