fix(salary): skip prose notes tabs instead of listing sentences as companies (#644)

* fix(salary): skip prose notes tabs instead of listing sentences as companies

A workbook's notes tab ("Each row is one company in the survey.") has no
table header, so the strict header pass finds nothing and the fallback
takes the first line mentioning a company word. With no salary column
beside it, every following sentence was emitted as a company entry and
showed up in --list-all and lookups. A fallback-detected header with no
salary columns now skips the sheet with a warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(changelog): record fix for #644

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* changelog: place the #644 entry under [Unreleased]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Mads Lorentzen <madslorentzen_17@hotmail.com>
This commit is contained in:
authored and GitHub committed 2026-10-19 19:52:23 +02:00
1 parent 1ec64d243c
commit 971f26499b
3 files changed
+97

No files matched your search

+14
View File
@@ -162,6 +162,7 @@ def parse_sheet(ws, sheet_label=None):
return [str(cell.value).strip() for cell in row if cell.value]
header_row = None
corroborated = True
for row_idx, row in enumerate(rows, start=1):
cell_texts = _cell_texts(row)
company_idxs = {i for i, t in enumerate(cell_texts) if header_matches(t, COMPANY_PATTERNS)}
@@ -177,6 +178,7 @@ def parse_sheet(ws, sheet_label=None):
break
if header_row is None:
corroborated = False
for row_idx, row in enumerate(rows, start=1):
if any(header_matches(t, COMPANY_PATTERNS) for t in _cell_texts(row)):
header_row = row_idx
@@ -282,6 +284,18 @@ def parse_sheet(ws, sheet_label=None):
for col_idx, col_header in untyped_cols:
categories.append({"name": col_header.lower().replace(" ", "_"), "value_col": col_idx})
if not categories and not corroborated:
# The fallback pass matched a lone company word and no salary column
# sits beside it: this is prose (a "Notes" or "About the data" tab
# mentioning "company"), not a table. Reading it would turn every
# sentence below that line into a company entry.
print(
f"Warning: Skipping sheet '{ws.title}': no table header found "
"(a company word appears only in text, with no salary columns).",
file=sys.stderr,
)
return []
if not categories:
print(
f"Warning: No salary data columns detected in sheet '{ws.title}' "