I'm trying to figure out how to use Tabular Data to store the logs of the Commons Wiki Loves contests I'm handling (Wiki Loves Monuments, Wiki Loves Earth and the like). At the moment, I'm using the CSV format, which is nice to be read and written down from pywikibot and handled through Pandas (I'm using <pre></pre> to encapsulate it). I've noticed that Tabular Data seems to be the current option for Mediawiki. I've created commons:Data:Wiki_Loves_in_Spain/Wiki_Loves_Earth/2017/Log.tab from PAWS using pywikibot but possibly in a wrong way (don't know why yet). However, when I try to edit it in order to see what's the difference with, for instance commons:Data:Ncei.noaa.gov/weather/New York City.tab (the content seems to be the same) I get the cryptic message in this item subject and I'm not actually able to edit the page. Any help on this?
Topic on Help talk:Tabular data/Flow
@Discasto it seems when you were uploading the data via API, you used wrong format, and somehow it got accepted (it should have been rejected during the save). Take a look at other .tab pages, and see what content format they use via API, so that you can set the same params in the edit API call.
Hi @Yurik: I'm not using (directly) the API. I'm using the 'save' method in Pywikibot and the content I'm saving is right (in fact, I'm cutting and pasting the content of a "valid" tab (the one I'm mentioning). If you don't give me more information about what's "wrong" (I guess it has to do with the MIME type, but Pywikibot does not provide any means for setting the MIME type), I cannot talk to the Pywikibot guys. What can be saved in a Data page?
Additionally, I've followed a simple example (API:Edit/Editing with Python) to write a string encoding a valid JSON document with the same result. It seems as if the API does not allow to write on the Data namespace. Any idea?
@Discasto I don't know the exact settings for the pywikibot to edit data pages. I think you need to set contentformat and contentmodel parameters. See
https://commons.wikimedia.org/w/api.php?action=help&modules=edit for available values, but more specifically, take a look at an existing page like this one: https://commons.wikimedia.org/w/api.php?action=query&prop=info&titles=Data:Sandbox/Doc_James/Obesity_Males_CC-BY-SA.tab -- as you can see, "contentmodel" = "Tabular.JsonConfig". Hope this helps.
@Yurik. Thanks, this seems to be sensible. I'll try to investigate it more with the pywikibot guys... In fact, the difference with https://commons.wikimedia.org/w/api.php?action=query&prop=info&titles=Wiki_Loves_in_Spain/Wiki_Loves_Earth/2017/Log.tab is quite informative