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:
- 'tiles' are wider and taller;
- most of them are now provided with a background color (the
same as Wikipedia's)
based on the elements' "subclass
of" property (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 is available for everyone!
And some more under the hood:
- rewritten in Python with Jinja2:
- more object-oriented
- presentation is split from actual logic
- 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 and
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