Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ In a Security Operations Center (SOC), analysts must often parse through massive
- bookings by route and by class;
- a bookings table you can sort, search and page through.

It has Export CSV and Print / Save PDF buttons and a light/dark switch, uses the Space Mono font (falling back to the system monospace font offline), and works on a phone.
It has Export CSV and Print / Save PDF buttons and a light/dark switch, uses DM Sans for the interface and Space Mono for compact data labels (with offline system fallbacks), and works on a phone.
- **Text report:** `--format txt` (or `both`) writes the same figures as plain text.
- **Skipped rows:** listed in the report and saved next to it as `..._skipped_rows.csv`.
- **Privacy by default:** passenger names are masked (`Maria Gonzalez` becomes `M. G•••••••`) and full names are never written to the file unless you pass `--show-names`. Spreadsheet text is HTML-escaped, and CSV cells that could run as spreadsheet formulas are neutralised.
Expand Down Expand Up @@ -65,10 +65,11 @@ python samples/make_sample.py # regenerate the sample workbook
`Project.ipynb` is the original notebook version, kept for reference. The maintained code is in `report_tool/`.

### Web app (Vercel)
`app.py` is a small Flask app. The landing page explains the tool, shows a preview built from the sample file, and takes an `.xlsx` upload (up to 4 MB, drag and drop or browse) that returns the HTML dashboard. `/sample` shows the sample report and `/template.xlsx` downloads a blank workbook with the right headers. Upload problems (wrong file type, missing columns, no usable rows) are explained in plain words with how to fix them. The page uses the Space Mono font and has a light/dark switch that remembers your choice. Uploads are processed in a temporary file that is deleted straight away; nothing is stored. Passenger names stay masked unless the "Show full passenger names" box is ticked.
`app.py` is a small Flask app. The landing page explains the tool, shows a preview built from the sample file, and takes an `.xlsx` upload (up to 4 MB, drag and drop or browse) that returns the HTML dashboard. `/sample` shows the sample report and `/template.xlsx` downloads a blank workbook with the right headers. Upload problems (wrong file type, missing columns, no usable rows) are explained in plain words with how to fix them. The page uses a light retro design with warm paper surfaces, muted modular accents and DM Sans typography and has a light/dark switch that remembers your choice. Uploads are processed in a temporary file that is deleted straight away; nothing is stored. Passenger names stay masked unless the "Show full passenger names" box is ticked.

```bash
flask --app app run # http://127.0.0.1:5000
```

On Vercel it deploys with no extra configuration: Vercel finds `app.py` and installs the dependencies from `pyproject.toml`.

2 changes: 1 addition & 1 deletion assets/railstat-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions report_tool/templates/_logo.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{# Railstat logo: a rising rail route (two stations joined by a line that climbs like a trend). #}
<span class="brand-mark" aria-hidden="true"><svg viewBox="0 0 32 32" width="28" height="28"><rect width="32" height="32" rx="8" fill="#2a78d6"></rect><path d="M6.5 24.5H11L16 19.5H19L25.5 13" fill="none" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"></path><circle cx="6.5" cy="24.5" r="2.6" fill="#2a78d6" stroke="#fff" stroke-width="2"></circle><circle cx="25.5" cy="13" r="3.4" fill="#fff"></circle><circle cx="25.5" cy="13" r="1.4" fill="#2a78d6"></circle></svg></span>
<span class="brand-name">Rail<span class="brand-accent">stat</span></span>
{# Small modular locomotive, with understated brick colours. #}
<span class="brand-mark" aria-hidden="true"><svg viewBox="0 0 42 34" width="38" height="32"><rect x="3" y="15" width="17" height="14" rx="2" fill="#c9937b"/><rect x="20" y="5" width="17" height="24" rx="2" fill="#a4bdc7"/><rect x="19" y="2" width="19" height="4" rx="1" fill="#d5b36e"/><rect x="25" y="9" width="8" height="8" rx="1" fill="#faf9f5"/><rect x="3" y="23" width="34" height="6" rx="1" fill="#8ba59a"/><circle cx="10" cy="29" r="5" fill="#35433e"/><circle cx="23" cy="29" r="5" fill="#35433e"/><circle cx="35" cy="29" r="5" fill="#35433e"/></svg></span>
<span class="brand-name">Railstat</span>
58 changes: 36 additions & 22 deletions report_tool/templates/_theme.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{# Shared look: Space Mono, light/dark tokens, and the theme switcher. Included in <head>. #}
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22%3E%3Crect width=%2232%22 height=%2232%22 rx=%228%22 fill=%22%232a78d6%22/%3E%3Cpath d=%22M6.5 24.5H11L16 19.5H19L25.5 13%22 fill=%22none%22 stroke=%22%23fff%22 stroke-width=%223%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22/%3E%3Ccircle cx=%226.5%22 cy=%2224.5%22 r=%222.6%22 fill=%22%232a78d6%22 stroke=%22%23fff%22 stroke-width=%222%22/%3E%3Ccircle cx=%2225.5%22 cy=%2213%22 r=%223.4%22 fill=%22%23fff%22/%3E%3Ccircle cx=%2225.5%22 cy=%2213%22 r=%221.4%22 fill=%22%232a78d6%22/%3E%3C/svg%3E">
{# Shared look: warm paper, light modular accents, light/dark tokens, and the theme switcher. Included in <head>. #}
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2042%2034%22%20width%3D%2238%22%20height%3D%2232%22%3E%3Crect%20x%3D%223%22%20y%3D%2215%22%20width%3D%2217%22%20height%3D%2214%22%20rx%3D%222%22%20fill%3D%22%23c9937b%22%2F%3E%3Crect%20x%3D%2220%22%20y%3D%225%22%20width%3D%2217%22%20height%3D%2224%22%20rx%3D%222%22%20fill%3D%22%23a4bdc7%22%2F%3E%3Crect%20x%3D%2219%22%20y%3D%222%22%20width%3D%2219%22%20height%3D%224%22%20rx%3D%221%22%20fill%3D%22%23d5b36e%22%2F%3E%3Crect%20x%3D%2225%22%20y%3D%229%22%20width%3D%228%22%20height%3D%228%22%20rx%3D%221%22%20fill%3D%22%23faf9f5%22%2F%3E%3Crect%20x%3D%223%22%20y%3D%2223%22%20width%3D%2234%22%20height%3D%226%22%20rx%3D%221%22%20fill%3D%22%238ba59a%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2229%22%20r%3D%225%22%20fill%3D%22%2335433e%22%2F%3E%3Ccircle%20cx%3D%2223%22%20cy%3D%2229%22%20r%3D%225%22%20fill%3D%22%2335433e%22%2F%3E%3Ccircle%20cx%3D%2235%22%20cy%3D%2229%22%20r%3D%225%22%20fill%3D%22%2335433e%22%2F%3E%3C%2Fsvg%3E">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
<script>
// Apply the saved theme before first paint so there's no flash. No saved choice = follow the system.
(function () {
Expand All @@ -15,39 +15,40 @@
<style>
:root {
color-scheme: light;
--font: "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
--page: #f4f4f1; --surface: #ffffff; --ink: #0b0b0b; --ink-2: #4a4945; --muted: #63625d;
--line: #e1e0d9; --axis: #c3c2b7; --head: #f4f4f1; --chip: #e9e8e3;
--series-1: #2a78d6; --series-2: #eb6834; --series-2-soft: #f4b393;
--good: #006300; --good-fill: #0ca30c; --bad: #b42318;
--font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
--mono: "Space Mono", ui-monospace, monospace;
--page: #faf9f5; --surface: #fdfcf9; --ink: #303933; --ink-2: #56605a; --muted: #626b65;
--line: #dedfd7; --axis: #b6bdb2; --head: #faf9f5; --chip: #f0eee6;
--series-1: #668ba3; --series-2: #bb765d; --series-2-soft: #dec0ac;
--good: #427345; --good-fill: #76966d; --bad: #b42318;
--warn-bg: #fff7e3; --warn-line: #f0d48a; --warn-ink: #4a3000;
--error-bg: #fdeceb; --error-line: #b42318; --error-ink: #7a1c1a;
--accent-bg: #eef5fd; --accent-ink: #104281; --focus: #2a78d6;
--shadow: 0 18px 40px rgba(11, 11, 11, 0.08);
--accent-bg: #edf1ef; --accent-ink: #3e6379; --focus: #668ba3;
--shadow: 0 3px 0 rgba(48, 57, 51, 0.035);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
color-scheme: dark;
--page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a29b;
--line: #2c2c2a; --axis: #4a4a46; --head: #222220; --chip: #2c2c2a;
--series-1: #3987e5; --series-2: #d95926; --series-2-soft: #7a3a20;
--good: #3fbf3f; --good-fill: #0ca30c; --bad: #f08a80;
--page: #1d2421; --surface: #252e29; --ink: #eceee5; --ink-2: #b6bdb2; --muted: #b0b9af;
--line: #424d43; --axis: #637063; --head: #2e3831; --chip: #424d43;
--series-1: #96b9cc; --series-2: #dc9d81; --series-2-soft: #9c7561;
--good: #a4c79b; --good-fill: #76966d; --bad: #f08a80;
--warn-bg: #2b2210; --warn-line: #6b5420; --warn-ink: #f5dfa8;
--error-bg: #2d1514; --error-line: #f08a80; --error-ink: #f5c2bf;
--accent-bg: #14243a; --accent-ink: #a9cdf6; --focus: #6da7ec;
--shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
--accent-bg: #2e3d3b; --accent-ink: #b9d5df; --focus: #a4c5d4;
--shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}
}
:root[data-theme="dark"] {
color-scheme: dark;
--page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a29b;
--line: #2c2c2a; --axis: #4a4a46; --head: #222220; --chip: #2c2c2a;
--series-1: #3987e5; --series-2: #d95926; --series-2-soft: #7a3a20;
--good: #3fbf3f; --good-fill: #0ca30c; --bad: #f08a80;
--page: #1d2421; --surface: #252e29; --ink: #eceee5; --ink-2: #b6bdb2; --muted: #b0b9af;
--line: #424d43; --axis: #637063; --head: #2e3831; --chip: #424d43;
--series-1: #96b9cc; --series-2: #dc9d81; --series-2-soft: #9c7561;
--good: #a4c79b; --good-fill: #76966d; --bad: #f08a80;
--warn-bg: #2b2210; --warn-line: #6b5420; --warn-ink: #f5dfa8;
--error-bg: #2d1514; --error-line: #f08a80; --error-ink: #f5c2bf;
--accent-bg: #14243a; --accent-ink: #a9cdf6; --focus: #6da7ec;
--shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
--accent-bg: #2e3d3b; --accent-ink: #b9d5df; --focus: #a4c5d4;
--shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}
.theme-toggle { min-height: 40px; min-width: 40px; padding: 0 12px; border: 1px solid var(--axis); border-radius: 8px;
background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
Expand All @@ -65,4 +66,17 @@
.brand-mark svg { display: block; }
.brand-accent { color: var(--series-1); }
@media print { .theme-toggle { display: none; } }

:root { --key: #f8e7af; --key-ink: #3f3826; --key-edge: #d9c789; --brick: #c9a35b; }
:root[data-theme="dark"] { --key: #d3b766; --key-ink: #22281f; --key-edge: #9a854d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --key: #d3b766; --key-ink: #22281f; --key-edge: #9a854d; } }
.brand { font-size: 23px; letter-spacing: -.04em; font-weight: 700; }
.brand-accent { color: inherit; }
.brand-mark svg { width: 38px; height: 32px; }
.theme-toggle { border-color: var(--line); background: transparent; }
button, .btn, .button { transition: background-color .15s, border-color .15s, transform .15s; }
button:hover, .btn:hover, .button:hover { border-color: var(--axis); }
button:active, .btn:active, .button:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) { button, .btn, .button { transition: none; } }
</style>

34 changes: 33 additions & 1 deletion report_tool/templates/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,37 @@
.tag-opt { background: var(--chip); color: var(--ink-2); }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-top: 20px; padding-bottom: 20px; font-size: 13px; color: var(--ink-2); }

/* Warm, spacious upload workspace, paired with the report. */
.wrap { max-width: 1280px; padding-left: 32px; padding-right: 32px; }
.site-header, .site-footer { background: transparent; }
.site-header .wrap { padding-top: 20px; padding-bottom: 20px; }
.hero { gap: 56px; padding-top: 64px; }
.hero h1 { font-size: clamp(34px, 4vw, 50px); font-weight: 600; line-height: 1.13; letter-spacing: -.045em; }
.lead { font-size: 17px; line-height: 1.7; max-width: 48ch; }
.card { border-radius: 10px; background: transparent; }
.btn { border-color: var(--line); background: transparent; font-weight: 500; }
.btn-primary { background: var(--key); color: var(--key-ink); border-color: var(--key); box-shadow: 0 2px 0 var(--key-edge); }
.upload { padding: 24px; gap: 18px; }
.drop { border: 1px dashed var(--axis); border-radius: 8px; padding: 32px 20px; background: var(--surface); }
.drop svg { color: var(--series-1); }
.field-label { font-weight: 500; }
.hint, .privacy { line-height: 1.6; }
.preview-col { padding-top: 24px; }
.preview { padding: 24px; gap: 22px; box-shadow: none; }
.eyebrow { font: 11px var(--mono); letter-spacing: .06em; }
.mini-kpi { border: 0; border-left: 2px solid var(--line); border-radius: 0; padding: 8px 14px; }
.mini-kpi strong { font-size: 25px; font-weight: 500; }
.mini-kpi span { font-size: 12px; }
.chip { border-radius: 5px; background: transparent; }
.section h2 { font-weight: 500; letter-spacing: -.03em; }
.steps { gap: 28px; }
.step { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 22px 0; }
.step-num { border-radius: 5px; background: var(--key); color: var(--key-ink); font: 12px var(--mono); width: 30px; height: 28px; box-shadow: 0 2px 0 var(--key-edge); }
.step h3, .feature h3 { font-weight: 500; }
th { font: 11px var(--mono); }
.tag { border-radius: 4px; font-weight: 500; }
@media (max-width: 640px) { .wrap { padding-left: 18px; padding-right: 18px; } .hero { padding-top: 36px; gap: 20px; } main { gap: 48px; } .upload, .preview { padding: 18px; } .preview-col { padding-top: 8px; } }
</style>
</head>
<body>
Expand All @@ -138,7 +169,7 @@
<main class="wrap">
<section class="hero">
<div class="hero-copy">
<h1>Turn a bookings spreadsheet into a dashboard in seconds</h1>
<h1>Your bookings.<br>A clearer picture.</h1>
<p class="lead">Upload an Excel export. Railstat checks every row, flags the ones it can't read, and builds a report of revenue, cancellations and routes you can filter, print or share.</p>

<form class="card upload" id="upload-form" action="/report" method="post" enctype="multipart/form-data" novalidate>
Expand Down Expand Up @@ -374,3 +405,4 @@ <h2 id="columns-title">What your file needs</h2>
</script>
</body>
</html>

Loading
Loading