Help:Tabular Data/fr

Les données tabulaires permettent aux utilisateurs de créer des tableaux de données au format CSV, et de les utiliser depuis d'autres wikis pour créer automatiquement des tableaux, des listes, ou des graphiques.

To create a new table, go to Wikimedia Commons, and create a new page in the Data namespace with a .tab suffix, such as. Feel free to experiment by creating pages with the Sandbox/&lt;username>/ prefix. For now, page content can only be edited in the raw JSON format and with a basic table editor, but a gadget allows import/export from/to CSV and Excel files. À terme (écrit le 21 novembre 2016), nous espérons qu'il y aura un éditeur de type tableur pour simplifier l'édition des données.



Licence des données
All data in the  namespace must explicitly indicate the license of the data. The recommended license is Public Domain, licensed under Creative Commons Zero (CC0) license. To indicate this, every data page must have, which means the data can be used under the CC0 version 1.0, or (at your option) any later version. By editing the data, you agree to the Terms of Use, and you irrevocably agree to release your contribution to the public domain under CC0.

S'il n'est pas possible de publier les données sous la licence CC0, les licences suivantes sont également supportées :


 * CC-BY:
 * CC-BY-1.0: Creative Commons Attribution 1.0
 * CC-BY-2.0: Creative Commons Attribution 2.0
 * CC-BY-2.5: Creative Commons Attribution 2.5
 * CC-BY-3.0: Creative Commons Attribution 3.0
 * CC-BY-4.0: Creative Commons Attribution 4.0
 * CC-BY-4.0+: Creative Commons Attribution 4.0 or later version
 * CC-BY-SA
 * CC-BY-SA-1.0: Creative Commons Attribution-Share Alike 1.0
 * CC-BY-SA-2.0: Creative Commons Attribution-Share Alike 2.0
 * CC-BY-SA-2.5: Creative Commons Attribution-Share Alike 2.5
 * CC-BY-SA-3.0: Creative Commons Attribution-Share Alike 3.0
 * CC-BY-SA-4.0: Creative Commons Attribution-Share Alike 4.0
 * CC-BY-SA-4.0+: Creative Commons Attribution-Share Alike 4.0 or later version
 * ODbL-1.0
 * ODbL-1.0: ODC Open Database License v1.0

Tout modèle important des données de sources hors licence CC0 doit se conformer aux modalités d'attributions pertinentes, il est donc fortement recommandé de préférer la licence CC0 dans la mesure du possible.

Dans le futur, la liste des licences supportées par les données pourra être étendue.



Types de données
Tabular JSON data supports several basic value types. You may also use  instead of the value to mark it as missing.


 * - A numeric value with an optional fractional part and may use exponential E notation, but cannot include non-numbers like NaN.
 * - only allows  and   values.
 * - a text string no longer than 400 characters long. Special characters like new lines  and tabs   are not allowed.
 * - A multilingual string, represented as an object with keys being language codes (e.g. "en"), and values being a string with above limitations of 400 max chars. For example,  has string values for both English and French.



Champs de niveaux supérieurs
Les données tabulaires possèdent plusieurs éléments de niveau supérieur, obligatoires et optionnels :


 * The required  field must always be set to   string value. For now, tabular data only supports CC0 (Public Domain dedication) license version 1.0 or later. More license support may be available in the future.
 * The required  field must set to an object that contains a list. Each field describes a column of the tabular data. Each field must be an object with mandatory   and   values.
 * The required  field is the name of the column. The value must begin with a letter or an underscore , and must only contain letters, underscores, or digits. This is done so that each header can be easily used from a coding environment like Lua or Vega graphs.
 * The required  field must be set to one of these values: ,  ,  , or.
 * The optional  field is an optional translation for the column's header. If set, it must be a localized string object.
 * The required  field must always be set to a list of lists. Each sub-list must have the same number of elements as headers, and must match the value types.
 * The optional  field must be set to a localized string value - an object with at least one key-value, where the key is a language code (e.g. "en"), and the value is a description string.
 * The optional  field must be a Wiki markup string value that describes the source of the data.

Utilisation
Il y a deux façons d'utiliser ces données :


 * A Lua script on any wiki can get this data by calling . The function returns tabular data in almost the same format as the original JSON, except that all localized strings will be converted to regular strings, and the license field will also include a localized license name. To get the data in another language, pass language code as the second parameter. To get the data in the original, unmodified form, use "_" as the language code.
 * A Vega graph can get tabular data by using  as the data source url.

On Commons, transcluding a page from the Data namespace, i.e., will render it as an HTML table. To access data directly on a wiki page, you can import (if you don't already have them) the tabular data module (requires the navbar module) and optionally the tabular query template. (requires the before mentioned tabular data module) With these tools you can easily get the value of a single cell.

Exemple
See c:Data:COVID-19 cases in Santa Clara County, California.tab for an example of how the JSON data renders on Commons.



Restrictions et pièges

 * Each string value except the  must be no more than 400 symbols long. Special characters like new lines   and tabs   are not allowed.
 * The overall size of the page may not exceed 2MB.



Notes aux administrateurs

 * Site administrators may customize error messages, such as  to make sure editors know about the CC0-only limitation.



Conversion des données en JSON
There are several tools available for converting other formats to JSON

CSV and TSV

 * convertcsv.com (select "CSV to JSON Array") - Generate output as JSON Array, under 'output options' select option 'if to JSON Array, create array for column names with name'. You will still need to manually add "name": and "type": to each entry in "fields" (see example above for formatting)

XLS

 * xls-to-json



Voir aussi

 * - similarly structured map data in the Data: namespace on commons.
 * - some implementation details
 * - templates to do graphs with the Commons Datasets
 * DataNamespace - previous proposal
 * TheDJ/tabularImportExport.js - A script to import from and export to CSV and Excel files, by User:TheDJ.
 * T154071
 * T154071