Logging Rain Events and SWPPP Inspections Client-Side
The Problem
Stormwater compliance is a bookkeeping problem wearing a hydrology costume. The permit says: inspect on a routine interval, and inspect within some window after any rain event over a threshold. Simple rules — but they generate real questions on a Tuesday in February. Did Thursday's 0.6 inches qualify? Did anyone inspect after it? When's the next routine one due? Stormwater enforcement runs on records, and a rain log kept daily, matched to signed inspection forms, is the difference between a clean audit and a notice of violation built on gaps [1].
The Approach
The tracker keeps two logs — rain events with amounts, and inspections with types (routine, post-rain, pre-storm) — against configurable permit rules: qualifying threshold, post-rain due window, routine interval. A qualifying event is covered if an inspection lands between the event date and the event date plus the window; otherwise it surfaces as awaiting inspection, and overdue once the window passes. The matching logic is deliberately simple and visible — if your permit counts working days or combines events, adjust behavior, not expectations.
The date bug that isn't obvious until it is
One implementation detail worth passing along, because it silently corrupts any date-only log: in JavaScript, new Date("2026-07-07") parses as UTC midnight. In any US timezone, that instant is still the previous local day — so every date in your log displays one day early, and a rain event slides to the wrong side of a compliance window. The fix is to split the string and construct by components, which the engine treats as local time:
// wrong: UTC midnight, off by one day west of Greenwich
var d = new Date("2026-07-07");
// right: local midnight
var p = "2026-07-07".split("-");
var d = new Date(+p[0], +p[1] - 1, +p[2]);
Both this tracker and the working-day tracker use the component form everywhere a date enters or leaves storage.
Why contemporaneous logging matters
- Log the rain even when it doesn't qualify — a string of 0.2-inch days that never triggered an inspection is itself a record that you were watching.
- Forecast-triggered requirements (pre-storm inspections, REAP-type action plans in some states) are on you to track from the forecast — the pre-storm inspection type records that you did.
- The daily habit is the compliance; the tracker just makes the habit cheap.
Everything lives in this browser's localStorage and nothing leaves it — the tracker is a field aid; the signed inspection forms and the SWPPP remain the compliance documents [2]. Single file, vanilla JS.
The tool: SWPPP Rain Event & Inspection Tracker.
References
- [1] EPA Construction General Permit (or the state-issued equivalent) — qualifying events, frequencies, and deadlines. https://www.epa.gov/npdes/stormwater-discharges-construction-activities
- [2] The project SWPPP — site-specific inspection requirements (governing document).