Skip to content

Package the reporting tool, fix crashes on messy rows, add tests and CI - #1

Merged
royalpriest merged 1 commit into
mainfrom
claude/project-thread-q90zvi
Nov 7, 2026
Merged

royalpriest merged 1 commit into
mainfrom
claude/project-thread-q90zvi

Conversation

@royalpriest

Copy link
Copy Markdown
Owner

Requested by Royal · project thread

What changed

The notebook logic now lives in a report_tool package with a report-tool command. These are the must-fix items from the review:

  • No more crashes on messy rows. A blank Status used to raise AttributeError, and a Price like "$50" raised ValueError. Both killed the whole run. Now each row is validated: blank required fields, non-numeric prices, unknown statuses (for example "Pending", which used to vanish silently) and discounts outside 0–100 are skipped and listed in a SKIPPED ROWS section with the Excel row number and reason.
  • Columns are matched by header name, not position. A missing required column stops the run with a clear message.
  • Money uses Decimal, rounded to cents. "$1,200" and "15%" are accepted.
  • Reports are time-stamped (reports/booking_summary_YYYYMMDD_HHMMSS.txt) instead of overwriting bookingSummary.txt. They now include the cancellation rate, the average ticket, thousands separators, routes sorted busiest first, and dates without 00:00:00.
  • CLI: argparse with --out, --open (works on Windows, macOS and Linux), -v and --version. It still asks for the path if none is given. pyinputplus (no release since 2020) and the fixed 5-second sleep are gone. Exit codes are 0 for OK, 1 when there are no valid bookings, and 2 for bad input.
  • openpyxl now opens files with read_only=True, data_only=True, so formula cells return their values.

Tests and tooling

  • pytest suite (29 tests) that builds workbooks inside each test: clean data, each bad-row type, reordered headers, a missing column, blank rows, an empty sheet, a non-Excel file, a missing file, a full-report snapshot, and the prompt path.
  • pyproject.toml, ruff lint and format config, and GitHub Actions on Python 3.11–3.13.
  • samples/bookings_sample.xlsx plus samples/make_sample.py. The sample includes 3 deliberately bad rows.
  • The README now matches the code. Before, it referenced main.py, which didn't exist.

Project.ipynb is left unchanged for reference.

How I checked

  • pytest: 29 passed
  • ruff check . and ruff format --check .: clean
  • report-tool samples/bookings_sample.xlsx writes a report with 60 valid rows and 3 rows flagged as skipped

Not in this PR

The HTML dashboard report and name masking from the mockups. Those can be a follow-up PR built on this package.


Generated by Claude Code

- Move the notebook logic into a report_tool package with a report-tool CLI
- Validate each row: blank Status, non-numeric Price, unknown status and
  out-of-range discounts are skipped and listed with a reason, not fatal
- Match columns by header name; clear errors for missing columns and bad files
- Use Decimal for money; write time-stamped reports; cross-platform --open
- Drop pyinputplus and the fixed 5-second sleep
- Add pytest suite, pyproject.toml, ruff config, GitHub Actions CI, sample workbook
- Update README to match the code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016gtNTGbmvq2DdoGC4air5K
@royalpriest royalpriest self-assigned this Nov 7, 2026
@royalpriest
royalpriest merged commit 2038507 into main Nov 7, 2026
3 checks passed
royalpriest added a commit that referenced this pull request Nov 19, 2026
Package the reporting tool, fix crashes on messy rows, add tests and CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants