Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kohlrahbi crashes with FV2504 documents: "collector should not be empty" #356

Closed
hf-kklein opened this issue Jun 27, 2024 · 1 comment · Fixed by #371
Closed

Kohlrahbi crashes with FV2504 documents: "collector should not be empty" #356

hf-kklein opened this issue Jun 27, 2024 · 1 comment · Fixed by #371
Assignees
Labels
bug Something isn't working

Comments

@hf-kklein
Copy link
Contributor

See: https://github.com/Hochfrequenz/edi_energy_mirror/actions/runs/9678763969/job/26703242865

based on the data in Hochfrequenz/edi_energy_mirror@0cbf3a4 with kohlrahbi version 1.1.3

Run kohlrahbi ahb --assume-yes --edi-energy-mirror-path edi_energy_mirror --output-path ./machine-readable_anwendungshandbuecher/FV2504 --format-version FV2504 --file-type flatahb --file-type csv --file-type xlsx
Created directory /home/runner/work/edi_energy_mirror/edi_energy_mirror/machine-readable_anwendungshandbuecher/FV2504.
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.11.9/x64/bin/kohlrahbi", line 8, in
sys.exit(cli())
^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/ahb/command.py", line 109, in ahb
scrape_pruefis(
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/ahb/init.py", line 229, in scrape_pruefis
pruefi_to_file_mapping = get_pruefi_to_file_mapping(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/ahb/init.py", line 207, in get_pruefi_to_file_mapping
pruefi_to_file_mapping = find_pruefidentifikatoren(path_to_docx_files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/ahb/init.py", line 142, in find_pruefidentifikatoren
pruefis.update(extract_pruefis_from_docx(docx_path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/ahb/init.py", line 157, in extract_pruefis_from_docx
pruefis.update({pruefi: docx_path.name for pruefi in extract_pruefis_from_table(item)})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/ahb/init.py", line 185, in extract_pruefis_from_table
seed = Seed.from_table(docx_table=table)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/seed.py", line 43, in from_table
table_header = TableHeader.from_header_cell(row_cell=header_cell_with_all_pruefi_information)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/table_header.py", line 107, in from_header_cell
collector = cls.initialize_collector(paragraph=last(row_cell.paragraphs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/kohlrahbi/table_header.py", line 176, in initialize_collector
raise ValueError("collector should not be empty")
ValueError: collector should not be empty

@hf-kklein hf-kklein added the bug Something isn't working label Jun 27, 2024
@DeltaDaniel DeltaDaniel linked a pull request Jul 11, 2024 that will close this issue
@DeltaDaniel DeltaDaniel self-assigned this Jul 11, 2024
@DeltaDaniel
Copy link
Contributor

Problem is this new line in the APERAK/CONTRL AHB:
FV2504:
grafik
as compared to
FV2410:
grafik

The line "Prüfidentifikator" in the table header hints for pruefis to be found in the table. However, there are no pruefis and the error above is returned.

The linked PR should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants