Spine-Toolbox icon indicating copy to clipboard operation
Spine-Toolbox copied to clipboard

Single column mappings

Open JustinasJas opened this issue 7 months ago • 0 comments

Context

Input data structure - fist column lists all entities and subsequent columns its type-specific subsets. Objective - import data and export it in original format. Importer mapping chosen - separate mapping for each column, heading of first column is the name of entity class, headings of subsequent columns are values of parameter named "type".

Importer issues

1. Number of subsets Manual setup of individual column mappings requires manual update to accommodate data with different number of subsets. Extra subsets would not be read and fewer subsets would mean importing empty columns (have not checked Toolbox behavior in the latter case). 2. Multi-type entities Entity can be among multiple columns, but its presence can be saved only for number of times equal to number of parameter names. I.e., the chosen mapping approach requires manually setting "type 1", "type 2", … for all columns with repeating elements. In absence of additional "types" (i.e., parameter names) entity presence is saved only for the last subset (i.e., presence in previous columns is overwritten).

Exporter issues

3. No parameter values as headers Exporter does not allow to export parameter values as column headers - such setup only adds empty cell on the column's top. Exporter also does not allow the pivot option for parameter values. As a result subset type information is lost. Note that exporter does allow to export parameter values in a separate column. However, such mapping exports data in very different data structure from original input data. Such mapping is also undesirable because the whole column is composed of the same type (i.e., same parameter value) entities. 4. New export bellow old one Exporter exporting data to the same excel sheet always places data to the rows that are bellow rows with previously mapped data. This is so even when new mapping is specified for empty columns on the right of previously mapped data. The result is a stair of data instead of data table.

Example project

Single column mapings.zip Basically objective is to make .spinetoolbox\items\export_-_sets\output\Sets.xlsx identical to _Sets.xlsx.

Some thoughts

These four issues are presented here in one post as they arise from single import-export problem. Depending on solution approach chosen, it may be wise to split it. Importer issues seem less critical as they can be worked around with manual mapping updates. At the same time exporter issues does not allow to recreate the data structure of original input files. Ideally, the whole table could be imported and exported with single mapping. That would also automatically solve issue 4.

JustinasJas avatar Aug 01 '24 13:08 JustinasJas