diff --git a/src/doc/table-json-conversion/specs.md b/src/doc/table-json-conversion/specs.md index 68c54099d9befea14116e350ecd8b3bc1b09674f..b4fe5b7152e7b9b9c9273d4e829bd189dd2e4f50 100644 --- a/src/doc/table-json-conversion/specs.md +++ b/src/doc/table-json-conversion/specs.md @@ -252,6 +252,31 @@ For example, this table defines three coaches for the two trainings from the las | | 2024-02-27 | example.com/mp | Berta | | | 2024-02-27 | example.com/m | Chris | +#### Sepcial case: multiple choice "checkboxes" #### + +As a special case, enum arrays with `"uniqueItems": true` can be represented as multiple columns, +with one column per choice. The choices are denoted as the last `PATH` component, the column type +must be `MULTIPLE_CHOICE`. + +Stored data is denoted as an "x" character in the respective cell, empty cells denote that the item +was not selected. Additionally, the implementation also allows `TRUE` or `1` for selected items, +and `FALSE`, `0` or cells with only whitespace characters for deselected items: + +| `COL_TYPE` | `MULTIPLE_CHOICE` | `MULTIPLE_CHOICE` | `MULTIPLE_CHOICE` | +| `PATH` | `skills` | `skills` | `skills` | +| `PATH` | `Planning` | `Communication` | `Evaluation` | +| `IGNORE` | skills.Planning | skills.Communication | skills.Evaluation | +|------------|-------------------|----------------------|-------------------| +| | x | | X | +| | `" "` | `TRUE` | `FALSE` | +| | 0 | x | 1 | + +These rows correspond to: + +1. Planning, Evaluation +2. Communication +3. Communication, Evaluation + ## Current limitations ## The current implementation still lacks the following: diff --git a/unittests/table_json_conversion/test_table_template_generator.py b/unittests/table_json_conversion/test_table_template_generator.py index cefc792b0e759ec0dd92c45874c0fefcfb5e8b4a..61da2142d1965adf63fda54c1fbbde1ce1e2a060 100644 --- a/unittests/table_json_conversion/test_table_template_generator.py +++ b/unittests/table_json_conversion/test_table_template_generator.py @@ -267,6 +267,7 @@ def test_model_with_indirect_reference(): foreign_keys={"Wrapper": ["Training.name", "Training.url"]}, outfile=None) + def test_model_with_multiple_choice(): _compare_generated_to_known_good( schema_file=rfp("data/multiple_choice_schema.json"),