File size: 6,691 Bytes
7a5c442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c322288
7a5c442
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Active surface

## What this is

`helper.py` is a single 1293-LOC module that all 8 tabs import from. This doc catalogues what is exported and which tabs consume each export. It is the closest thing to a public API contract this repo has today.

Splitting `helper.py` into focused modules is **out of scope** for the AI-standards remediation. It is flagged for a later architecture-hardening slice with explicit non-goals.

## Top-level exports in `helper.py`

| Export                                                | Kind     | First seen at line |
|-------------------------------------------------------|----------|---------------------|
| `extract_zip_to_temp(uploaded_file)`                  | function | 41                  |
| `extract_images_from_xlsx_zip_method(...)`            | function | 48                  |
| `process_files(input_folder, marken_index, output_root)` | function | 106                 |
| `is_valid_file(file_path)`                            | function | 172                 |
| `generate_excel_report(...)`                          | function | 179                 |
| `add_brand_pages_with_png_extensions(...)`            | function | 311                 |
| `generate_filename_based_pdf_report_with_extensions(...)` | function | 362                 |
| `extract_images_from_xlsx_by_sheet(...)`              | function | 493                 |
| `extract_images_from_xlsx(xlsx_file, output_dir)`     | function | 608                 |
| `extract_brand(file_stem)`                            | function | 630                 |
| `erkenne_marken_aus_ordnern(input_folder)`            | function | 658                 |
| `get_files_by_marke(input_folder, marken)`            | function | 669                 |
| `get_asset_cell(file_path, filename, col_count)`      | function | 689                 |
| `build_marken_einzelseiten(...)`                      | function | 744                 |
| `get_excel_worksheets_simple(excel_file_path)`        | function | 807                 |
| `add_brand_pages(...)`                                | function | 836                 |
| `analyze_files_by_filename(input_folder)`             | function | 874                 |
| `generate_pdf_report(input_folder, erste_marke=None)` | function | 914                 |
| `get_cleaned_filename_without_brand(filename, brand)` | function | 961                 |
| `generate_filename_based_pdf_report(...)`             | function | 970                 |
| `add_brand_pages_with_final_labels(...)`              | function | 1078                |
| `generate_two_section_pdf_report(...)`                | function | 1124                |
| `ALLOWED_IMAGE_EXTENSIONS`                            | constant | (module-level set) |
| `ALLOWED_TEXT_EXTENSIONS`                             | constant | (module-level set) |
| `ALLOWED_VIDEO_EXTENSIONS`                            | constant | (module-level set) |
| `ALLOWED_AUDIO_EXTENSIONS`                            | constant | (module-level set) |
| `NON_IMAGE_EXTENSIONS`                                | constant | (module-level set) |

## Consumer map (which tab imports what)

| Tab      | Tool                                          | Imports from `helper`                                                                                                          |
|----------|-----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| `tab1.py`| Extract Images from Excel                     | `get_excel_worksheets_simple`, `extract_images_from_xlsx_by_sheet`                                                              |
| `tab2.py`| Name Assets by Brand                          | `extract_zip_to_temp`, `ALLOWED_IMAGE_EXTENSIONS`, `ALLOWED_TEXT_EXTENSIONS`, `ALLOWED_VIDEO_EXTENSIONS`, `ALLOWED_AUDIO_EXTENSIONS`, + more |
| `tab3.py`| Canvas White to Transparent                   | `ALLOWED_IMAGE_EXTENSIONS`                                                                                                      |
| `tab4.py`| Asset Overview (PDF)                          | `extract_zip_to_temp`, `erkenne_marken_aus_ordnern`, `generate_pdf_report`, `get_files_by_marke`, `analyze_files_by_filename`, `generate_two_section_pdf_report` |
| `tab5.py`| Name Stims by Block                           | `extract_zip_to_temp`, `analyze_files_by_filename`, `generate_filename_based_pdf_report_with_extensions`, `process_files`, `generate_excel_report` |
| `tab6.py`| Re-run Matrix                                 | `ALLOWED_IMAGE_EXTENSIONS`, `ALLOWED_VIDEO_EXTENSIONS`, `ALLOWED_AUDIO_EXTENSIONS`, `ALLOWED_TEXT_EXTENSIONS`, `NON_IMAGE_EXTENSIONS`, `get_cleaned_filename_without_brand`, `extract_brand` |
| `tab7.py`| Resize                                        | `extract_zip_to_temp`, `ALLOWED_IMAGE_EXTENSIONS`                                                                               |
| `tab8.py`| Place on Canvas                               | `extract_zip_to_temp`, `ALLOWED_IMAGE_EXTENSIONS`                                                                               |

(Counts above are derived from grepping `from helper import …` blocks at the time of writing β€” verify against current source before relying on them.)

## Concern clusters within `helper.py`

If a future architecture-hardening slice splits `helper.py`, these are the natural cluster boundaries:

1. **constants** β€” the five `ALLOWED_*` / `NON_IMAGE_*` extension sets.
2. **zip + io** β€” `extract_zip_to_temp`, `is_valid_file`.
3. **brand index** β€” `extract_brand`, `erkenne_marken_aus_ordnern`, `get_files_by_marke`, `get_cleaned_filename_without_brand`, `analyze_files_by_filename`, `process_files`.
4. **Excel image extraction** β€” `extract_images_from_xlsx_zip_method`, `extract_images_from_xlsx_by_sheet`, `extract_images_from_xlsx`, `get_excel_worksheets_simple`.
5. **Excel report** β€” `generate_excel_report`.
6. **PDF report** β€” `generate_pdf_report`, `generate_filename_based_pdf_report`, `generate_filename_based_pdf_report_with_extensions`, `generate_two_section_pdf_report`, `add_brand_pages`, `add_brand_pages_with_png_extensions`, `add_brand_pages_with_final_labels`, `build_marken_einzelseiten`, `get_asset_cell`.

This is a sketch, not a commitment. The real split would need a design doc and a deprecation strategy for the existing top-level imports.

## Rule

Until `helper.py` is split, **all changes that add a shared utility go into `helper.py`**, not into the tab files. Inlining shared logic into a tab is the cheap path that grows the next 1293-LOC module β€” do not do it.