From e7b780aff94633dd1d148086c725ce7bb191f59c Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 23:33:58 +0000 Subject: [PATCH] Rewrite README for Python and full-stack developer roles Replace the SOC analyst framing with a back-end and full-stack overview, and add a tech stack breakdown and project structure. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016gtNTHTS9Tbvjje9fB12Z1 --- README.md | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 909b8ef..81e3ba5 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,23 @@ # Railstat: Data Analysis & Automated Reporting Tool ### Project Overview -This project is a Python-based automation tool designed to ingest, normalize, and analyze complex datasets from Excel. While currently configured for financial/booking data, the core engine demonstrates the logic required for Security Log Parsing and Incident Reporting. +Railstat is a Python package and a Flask web app. Together they turn a raw bookings spreadsheet into a validated, interactive dashboard. You can use it from the command line (`report-tool bookings.xlsx`), or upload a workbook in the browser and get the dashboard back. -As a SOC Analyst candidate, I developed this to showcase my ability to handle data integrity, automate repetitive administrative tasks, and generate structured technical reports. +It started as a single Jupyter notebook (`Project.ipynb`, kept for reference). I rebuilt it as a tested, packaged application to show how I take a working script to production quality on both the back end and the front end. -### Cybersecurity Relevance (SOC Context) -In a Security Operations Center (SOC), analysts must often parse through massive amounts of exported CSV/Excel data from SIEMs or Firewalls. This tool demonstrates three critical SOC competencies: +### What it demonstrates +**Back end (Python)** +- **Package design:** the code is split into modules with a single job each: loading and validation (`loader.py`), aggregation (`summary.py`), rendering (`html_report.py`, `render.py`) and privacy (`privacy.py`). The `report-tool` console script is installed through `pyproject.toml`. +- **Defensive input handling:** every row is validated on its own. Malformed values such as a blank status, a price like "TBD" or an unknown status are set aside with a reason instead of crashing the run. Bad files and missing columns raise typed exceptions that map to clear messages and exit codes. +- **Correctness:** money is handled with `Decimal` and rounded to cents. Columns are matched by header name, not position. +- **Testing and CI:** 53 pytest tests build their workbooks inside each test, and cover the loader, the summary math, the CLI, the HTML output and the web app. GitHub Actions runs ruff lint and format checks plus the test suite on Python 3.11, 3.12 and 3.13. -**Data Normalization:** Status, class, loyalty and money values are trimmed, case-normalized and type-checked (for example "Confirmed " and "confirmed" are treated the same, and "$1,200" is read as 1200.00), so inconsistent inputs are analyzed accurately. - -**Defensive Programming:** Every row is validated on its own. A malformed row (blank status, a price like "TBD", an unknown status) is set aside with the reason instead of crashing the run, and unreadable files or missing columns stop with a clear message and a non-zero exit code. - -**Automated Triage & Reporting:** Records are categorized (Confirmed vs. Cancelled) and metrics calculated, mimicking the logic used to triage "True Positives" vs. "False Positives" in an alert queue. Rows that couldn't be processed are listed in the report so nothing disappears silently. +**Full stack (web)** +- **Flask app (`app.py`):** routes for the landing page, upload (`POST /report`), a sample report and a downloadable template workbook. Uploads are capped at 4 MB, kept in temporary files that are deleted right after parsing, and served with `Cache-Control: no-store`. +- **Front end:** Jinja2 templates with a drag-and-drop upload and client-side checks of file type and size. The dashboard is a single self-contained HTML file. It recomputes its filters, period comparisons, charts and the sortable, paged table in vanilla JavaScript, with no charting library. +- **UX and accessibility:** light and dark themes that remember your choice, a responsive layout that works on phones, `aria-sort` on sortable headers, and charts that don't rely on colour alone. +- **Security and privacy:** Jinja2 autoescaping stops spreadsheet text from injecting HTML. CSV cells that could run as spreadsheet formulas are neutralised. Passenger names are masked unless you opt in. +- **Deployment:** it deploys to Vercel's Python runtime with no extra configuration. ### Features - **Automated ingestion:** reads the active sheet of an `.xlsx` workbook with openpyxl, matching columns by header name, so the column order doesn't matter. @@ -39,7 +44,24 @@ In a Security Operations Center (SOC), analysts must often parse through massive `TicketID`, `PassengerName`, `Route`, `Class`, `Price`, `Status` are required. `Date`, `DiscountApplied` (a percentage from 0 to 100; blank means none) and `LoyaltyMember` (Yes/No) are optional. Header names are matched without regard to case or spacing. ### Technical Stack -Python 3.11+, openpyxl, Jinja2 (HTML report), pytest and ruff for development, GitHub Actions for CI. +**Back end:** Python 3.11+, openpyxl, Flask, Jinja2 +**Front end:** HTML, CSS, vanilla JavaScript, inline SVG charts +**Tooling:** pytest, ruff, GitHub Actions CI, Vercel + +### Project Structure +``` +app.py Flask web app (upload page, report, sample, template) +report_tool/ + loader.py read the workbook and validate each row + summary.py aggregate bookings into report figures + html_report.py render the self-contained HTML dashboard + render.py plain-text report + privacy.py name masking + cli.py report-tool command + templates/ Jinja2 templates for the landing page and dashboard +tests/ pytest suite +samples/ sample workbook and its generator +``` ### How to Use ```bash