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

DOC: added considerations for fill

parent 8b14cbcf
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
Pipeline #48130 passed
...@@ -65,4 +65,25 @@ def fill_template(template_path: str, json_path: str, result_path: str) -> None: ...@@ -65,4 +65,25 @@ def fill_template(template_path: str, json_path: str, result_path: str) -> None:
``template_path`` and store the result under ``result_path``. ``template_path`` and store the result under ``result_path``.
""" """
template = load_workbook(template_path) template = load_workbook(template_path)
# For each top level key in the json we iterate the values (if it is an array). Those are the
# root elements that belong to a particular sheet.
# After treating a root element, the row index for the corresponding sheet needs to be
# increased
# When we finished treating an object that goes into a lower ranked sheet (see below), we
# increase the row index of that sheet.
#
# We can generate a hierarchy of sheets in the beginning (using the paths). The lower sheets
# are for objects referenced by objects in higher ranked sheets.
# We can detect the sheet corresponding to a root element by looking at the first path element:
# The first path element must be the root element every where.
# Suggestion:
# row indices: Dict[str, int] string is the sheet name
# sheet_hirarchy: List[Tuple[str]] elements are sheet names
#
# Question:
# We can create an internal representation where we assign as sheet_names the same names that
# are used in table generator. Or should we create another special row that contains this
# somehow?
template.save(result_path) template.save(result_path)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment