Table2Base

From Testiwiki
Revision as of 10:25, 9 July 2012 by Jouni (talk | contribs)
Jump to: navigation, search


Table2Base is an extension which enables direct upload of data from wikipages to Opasnet Base. Data is displayed as a table in wikipage.

Usage

Example:

<t2b index="Year,Country" unit="#" obs="Mortality">
2001|Finland|1000
2002|Finland|100
2001|Sweden|600
2002|Sweden|800
</t2b>

Displays:

Table2Base(#)
ObsYearCountryMortality
12001Norway1000
22002Finland100
32001Sweden600
42002Sweden800

Notes:

  • index argument defines indices of the datatable:
    • example has 2 indices: Year and Country
    • it is obligatory to have at least 1 index
  • unit defines the unit of the variable
    • it is obligatory to define unit
  • obs defines the name of the result column
    • obs is optional
    • if not defined default value "Result" is used
  • Data is saved only when table is altered and page is saved
  • Number of data columns must match to number of indices + result column
  • Each row must have equal number of columns
  • Table caption is a link to Base UI

--4 : It must be possible to define units for each observation row separately. I suggest that if the parameter unit="column" then the Unit appears as a column before the observation columns and not in the title. Also, if parameter description="column", then the last column will be Description. --Jouni 13:23, 9 July 2012 (EEST)

1 The t2b functionality is important. However, the distinction of variables into "index" ja "location" types is ambiguous and arbitrary. E.g. in the dataset...

  • municipality, last name, first names, sex, height, weight, blood group

... at least the variables "municipality", "sex", and "blood group" (and in principle any of the other variables too) could be treated equally well as either "index" or "location" type. ⇒ Thus, I suggest that all variables be treated alike in the t2b syntax. --Erkki Kuusisto 15:22, 21 May 2012 (EEST)

7 : The distinction between indices (explanations) and observations ("locations") is important, because they are stored in the database differently. You can search for index results but not for observation results. So, if you want to search for something, make it an index. --Jouni 13:23, 9 July 2012 (EEST)

--# : The use of words index, location, observation, explanation, result, value,... are used in a confusing way. I suggest that we reparametrize this in the following way:

  • index → explanations. The use will remain the same.
  • explanationunits: a new parameter for the units of explanation columns. Must have the same length as explanations.
  • locations → observations. The use will remain the same.
  • unit: the name will remain but if gets the value "column", a new column is created for unit before the Result column. Any other value implies a unit for all rows.
  • description: a new parameter. If gets the value "column", a new column is created for description as the last column.
  • "Observation type": if the observation columns do not have an obvious meaningful name, this is used. Note: this name does not imply any special computing, unlike "Observation" in the old Opasnet Base system.

--Jouni 13:23, 9 July 2012 (EEST)

2 : It is important that the "unit" can be defined separately for each variable. E.g. for weight and height in the sample dataset above. --Erkki Kuusisto 15:22, 21 May 2012 (EEST)

5 : I support this idea. However, units of indices should be a separate parameter (e.g. indexnames) with the same length as index. --Jouni 13:23, 9 July 2012 (EEST)

3 Combining attacks 1–2 above, I suggest a simplified syntax for t2b:

<t2b variables_and_units=" var_name_1, var_unit_1, var_name_2, var_unit_2, ..., var_name_N, var_unit_N ">

An example with the above dataset:

<t2b variables=" municipality, , last name, , first names, , sex, , height, cm, weight, kg, blood group, , ">
--Erkki Kuusisto 15:22, 21 May 2012 (EEST)

6 : Because attack #1 is not accepted, also #3 is not accepted. --Jouni 13:23, 9 July 2012 (EEST)


Hints for spreadsheet software

If you have your data table in Open Office Calc, Excel, or some other software, you can use these formulas to convert tables into Table2Base code. This example is for Excel, other software may have slightly different syntax. Here, the data is in the spreadsheet in columns A...D. Columns A...C contain index values and column D observations. The first row contains index names and rows starting from row 2 contain data.

Formula for the first row
="<tb2 index="&CHAR(34)&A1&","&B1&","&C1&CHAR(34)&" unit="&CHAR(34)&"kg"&CHAR(34)&" obs="&CHAR(34)&D1&CHAR(34)&">"
Formula for the second row and beyond
=A2&"|"&B2&"|"&C2&"|"&D2

See also

Keywords

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>