Skip to content
Snippets Groups Projects
Commit 6b3289d9 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

wip

parent f62037c1
No related branches found
No related tags found
4 merge requests!100WIP: Filling XLSX: Seems to be working.,!94ENH: add framework for converting json schema into table templates,!93Filling XLSX: Everything except multiple choice.,!92ENH: xlsx template generator
...@@ -33,6 +33,7 @@ def _fill_leaves(json_doc: dict, workbook): ...@@ -33,6 +33,7 @@ def _fill_leaves(json_doc: dict, workbook):
_fill_leaves(el, workbook) _fill_leaves(el, workbook)
wb.cell(1, 2, el) wb.cell(1, 2, el)
def _get_row_type_column(worksheet): def _get_row_type_column(worksheet):
for col in worksheet.columns: for col in worksheet.columns:
for cell in col: for cell in col:
...@@ -40,6 +41,7 @@ def _get_row_type_column(worksheet): ...@@ -40,6 +41,7 @@ def _get_row_type_column(worksheet):
return cell.column return cell.column
raise ValueError("The column which defines row types (COL_TYPE, PATH, ...) is missing") raise ValueError("The column which defines row types (COL_TYPE, PATH, ...) is missing")
def _get_path_rows(worksheet): def _get_path_rows(worksheet):
rows = [] rows = []
rt_col = _get_row_type_column(worksheet) rt_col = _get_row_type_column(worksheet)
...@@ -50,7 +52,6 @@ def _get_path_rows(worksheet): ...@@ -50,7 +52,6 @@ def _get_path_rows(worksheet):
return rows return rows
def _generate_path_col_mapping(workbook): def _generate_path_col_mapping(workbook):
rt_col = _get_row_type_column(workbook) rt_col = _get_row_type_column(workbook)
......
...@@ -30,6 +30,7 @@ import tomli ...@@ -30,6 +30,7 @@ import tomli
# TODO why do I need a running LA instance? # TODO why do I need a running LA instance?
def prepare_datamodel(): def prepare_datamodel():
model = parser.parse_model_from_yaml("./model.yml") model = parser.parse_model_from_yaml("./model.yml")
...@@ -37,7 +38,7 @@ def prepare_datamodel(): ...@@ -37,7 +38,7 @@ def prepare_datamodel():
# additional_options_for_text_props=additional_text_options, # additional_options_for_text_props=additional_text_options,
# name_and_description_in_properties=True, # name_and_description_in_properties=True,
name_property_for_new_records=True, name_property_for_new_records=True,
#do_not_create=do_not_create, do_not_create=["Organisation"],
# do_not_retrieve=do_not_retrieve, # do_not_retrieve=do_not_retrieve,
) )
schema_top = exporter.recordtype_to_json_schema(model.get_deep("Training")) schema_top = exporter.recordtype_to_json_schema(model.get_deep("Training"))
......
...@@ -53,10 +53,18 @@ ...@@ -53,10 +53,18 @@
"type": "string" "type": "string"
}, },
"Organisation": { "Organisation": {
"oneOf": [
{
"title": "Existing entries",
"enum": [
"Federal Reserve"
]
},
{
"type": "object", "type": "object",
"required": [], "required": [],
"additionalProperties": false, "additionalProperties": false,
"title": "Organisation", "title": "Create new",
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
...@@ -67,6 +75,8 @@ ...@@ -67,6 +75,8 @@
} }
} }
} }
]
}
} }
} }
}, },
...@@ -87,10 +97,18 @@ ...@@ -87,10 +97,18 @@
"type": "string" "type": "string"
}, },
"Organisation": { "Organisation": {
"oneOf": [
{
"title": "Existing entries",
"enum": [
"Federal Reserve"
]
},
{
"type": "object", "type": "object",
"required": [], "required": [],
"additionalProperties": false, "additionalProperties": false,
"title": "Organisation", "title": "Create new",
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
...@@ -101,6 +119,8 @@ ...@@ -101,6 +119,8 @@
} }
} }
} }
]
}
} }
}, },
"duration": { "duration": {
...@@ -132,10 +152,18 @@ ...@@ -132,10 +152,18 @@
"type": "string" "type": "string"
}, },
"Organisation": { "Organisation": {
"oneOf": [
{
"title": "Existing entries",
"enum": [
"Federal Reserve"
]
},
{
"type": "object", "type": "object",
"required": [], "required": [],
"additionalProperties": false, "additionalProperties": false,
"title": "Organisation", "title": "Create new",
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
...@@ -146,6 +174,8 @@ ...@@ -146,6 +174,8 @@
} }
} }
} }
]
}
}, },
"$schema": "https://json-schema.org/draft/2020-12/schema" "$schema": "https://json-schema.org/draft/2020-12/schema"
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment