Page MenuHomePhabricator

Create a Lua module that converts tabular data to a wiki table
Closed, ResolvedPublic

Description

As a Wikipedia editor I would like a simple way to display tabular data in a Wikipedia article. This would be very useful in the use case of Covid-19, where we would like to reuse the same data in many different language versions.

Event Timeline

Ainali created this task.May 9 2020, 9:14 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 9 2020, 9:14 PM
mxn added a subscriber: mxn.May 9 2020, 9:15 PM
Sj added a subscriber: Sj.May 9 2020, 9:21 PM

I like this -- with an option for a "time-series" that would take one row as a 'primary key' and pull out only the most recent row for each unique key.

mxn added a comment.May 9 2020, 9:25 PM

mw.ext.data.get() returns the tabular data for a page as a Lua table. A starting point would be to output a wikitable that formats the tabular data exactly as on Commons.

Jarekt renamed this task from Create a Lua module that converts tabular data to a table to Create a Lua module that converts tabular data to a wiki table.May 9 2020, 9:26 PM
mxn added a comment.May 10 2020, 12:32 AM

This is now one of the functions in https://en.wikipedia.org/wiki/Module:Tabular_data. For this function to be useful to articles that currently hardcode tabular data, there will probably need to be styling and data formatting options, and the sources should probably go in <ref>.

mxn added a subscriber: eprodromou.EditedMay 10 2020, 12:37 AM

@eprodromou had a similar idea with https://en.wikipedia.org/wiki/Module:Covid19Data, which is specific to COVID-19 case count tables. (https://en.wikipedia.org/wiki/Template:Medical_cases_chart can also display such a table as a bar chart.)

Jarekt added a subscriber: Jarekt.May 10 2020, 4:34 AM

I did not see mxn posts and wrote Template:Json2table. It has a lot of styling and formatting options.

I did not see mxn posts and wrote Template:Json2table. It has a lot of styling and formatting options.

This is already pretty remarkable and even better than I could imagine when writing this task. Great work! Are you still improving it or is it ready to be copied to other language projects?

Zblace added a subscriber: Zblace.May 10 2020, 8:13 AM

I did not see mxn posts and wrote Template:Json2table. It has a lot of styling and formatting options.

This is already pretty remarkable and even better than I could imagine when writing this task. Great work! Are you still improving it or is it ready to be copied to other language projects?

At this point it just needs to be used and new tables have to be tried. The module was tested so far on 2 Data pages, and I am sure once more are tried more issues will be discovered. But feel free to move it to other projects. At this stage, I will fix issues and provide more options as needed.

The Module Module:Json2table depends on 3 other modules; two of them you are likely to find on any wiki and Module:Core which might have to be ported as well.

Jarekt claimed this task.May 10 2020, 12:49 PM

Nice, I ported it to svwiki: Modul:Json2table.

mxn added a comment.May 10 2020, 4:21 PM

Should we try to unify the functionality in https://en.wikipedia.org/wiki/Template:Json2table and https://en.wikipedia.org/wiki/Module:Tabular_data? Or maybe it’s better to have one focus on “raw” output and the other focus on polished formatting?

Should we try to unify the functionality in https://en.wikipedia.org/wiki/Template:Json2table and https://en.wikipedia.org/wiki/Module:Tabular_data? Or maybe it’s better to have one focus on “raw” output and the other focus on polished formatting?

I am ready to move on to other tasks, so I am not planning any major rewrites, but feel free to grab any chunks that might be useful.

Ainali closed this task as Resolved.May 10 2020, 7:22 PM

I think what I asked for has been completed, so I will close this task and move to Done. Feel free to start new tasks for improvments.