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

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.

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

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>.

@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.)

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?

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.

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.

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.