diff --git a/src/caosadvancedtools/table_json_conversion/table_generator.py b/src/caosadvancedtools/table_json_conversion/table_generator.py index 1e8f939266eee25a5326f8498fb909e72dfa3ee4..f0e8f6c6d816e4d0ea76e7d776d351e4a5d8ecb5 100644 --- a/src/caosadvancedtools/table_json_conversion/table_generator.py +++ b/src/caosadvancedtools/table_json_conversion/table_generator.py @@ -38,6 +38,7 @@ class ColumnType(Enum): SCALAR = 1 LIST = 2 FOREIGN = 3 + IGNORE = 3 class RowType(Enum): @@ -62,20 +63,20 @@ class TableTemplateGenerator(ABC): elements of the path within the JSON where the key is needed. Suppose we want to distinguis Persons that are referenced by Trainings, foreign_keys must at least contain the following: {"Training": {"Person": [key1, key2]}}. - Values wihtin the dicts can be a list representing the keys, a tuple where - the first element is the list representing the keys and the second elment is - a dict that allows to set further foreign keys at lower depth. The third - possibility is a dict. In that case no foreign keys exist at that level ( - e.g. in the above example there is no foreign key for the path ["Training"]. + Values wihtin the dicts can be a list representing the keys or + a dict that allows to set further foreign keys at lower depth. + In latter case if foreign keys exist at that level ( + e.g. in the above example there might be further levels below "Person".), + then the keys can be set using the special "__this__" key. + Example: {"Training": {"__this__": ["date"], "Person": [key1, key2]}} + Here, "date" is the sole key for Training. """ pass def _generate_sheets_from_schema(self, schema: dict, foreign_keys: dict = None - ) -> dict[str, dict[str, tuple[str, list]]]: + ) -> dict[str, dict[str, list]]: """ generates a sheet definition from a given JSON schema - - Parameters ---------- schema: dict