π SWMM5 Model Matchmaker
π― What Is This?
"How alike are your two SWMM5 models β really?"
Bill James invented Similarity Scores for baseball players: start at 1,000, subtract points for every statistical difference. Model Matchmaker applies the same logic to EPA SWMM5 .inp files.
Every section of the input file becomes a scoring category. Every attribute pair becomes a potential deduction. One number tells you whether two models are calibration siblings β or total strangers.
Score = 1000
β Ξ£ (deduction_per_unit Γ |attr_A β attr_B|) // capped per attribute
β categorical penalties // units, routing, etc.
| Score |
Meaning |
| 1000 |
β
Identical models |
| 900 + |
π΅ Same model, light edits |
| 700 β 899 |
π‘ Same network, meaningful differences |
| < 600 |
π΄ Different models entirely |
β¨ Features
| Feature |
Detail |
| π Hybrid element matching |
Match by ID first; fall back to nearest-neighbor on coordinates within a user-set tolerance |
| π 7 scored categories |
Topology Β· Geometry Β· Hydraulics Β· Subcatchments Β· Hydrology Β· Boundary Conditions Β· Simulation Settings |
| π Top-N deduction drivers |
Largest score deductions surfaced first β see exactly why models diverge |
| π Fully private |
Parsing and scoring run 100 % in your browser β no upload, no server, no data leaves your machine |
| β‘ Fast |
Handles large .inp files instantly thanks to browser-native JS parsing |
| π Side-by-side compare |
/compare route lets you inspect per-category breakdowns |
ποΈ Project Structure
model-matchmaker/
βββ src/
β βββ routes/
β β βββ index.tsx # Landing page & score legend
β β βββ compare.tsx # File upload + diff engine
β β βββ methodology.tsx # Scoring algorithm docs
β βββ components/ # Shared UI components (shadcn/ui)
β βββ hooks/ # Custom React hooks
β βββ lib/ # SWMM5 parser & scoring logic
β βββ styles.css # Tailwind base styles
β βββ server.ts # TanStack Start server entry
βββ package.json
βββ vite.config.ts
π Usage
- Open the app (local dev or deployed URL)
- Navigate to
/compare
- Upload Model A β drag & drop or click to browse for a
.inp file
- Upload Model B β same process
- Read your score β 0β1000 with per-category breakdown and top deduction drivers
No account. No server. No storage. Just results.
π Methodology
The scoring engine mirrors James's baseball formula adapted for hydraulic infrastructure:
Categories & Caps
| # |
Category |
What's Compared |
| 1 |
Topology |
Conduit count, node connectivity, loop structure |
| 2 |
Geometry |
Conduit length, diameter/height, shape type |
| 3 |
Hydraulics |
Manning's n, invert elevations, max depth |
| 4 |
Subcatchments |
Area, imperviousness, slope, width |
| 5 |
Hydrology |
Infiltration parameters, RDII, LID controls |
| 6 |
Boundary Conditions |
Outfalls, storage, external inflows |
| 7 |
Simulation Settings |
Routing method, time step, report interval |
Each category is individually capped so no single difference can dominate the total score. Full algorithm details live in /methodology.
π οΈ Development
Prerequisites
- Bun β₯ 1.0 (or Node β₯ 18 with npm)
Quick Start
# Clone
git clone https://github.com/SWMMEnablement/model-matchmaker.git
cd model-matchmaker
# Install dependencies
bun install
# Start dev server
bun run dev
App runs at http://localhost:3000.
Available Scripts
| Command |
Action |
bun run dev |
Start Vite dev server with HMR |
bun run build |
Production build β dist/ |
bun run preview |
Preview production build locally |
bun run lint |
ESLint check |
bun run format |
Prettier format |
Stack
π Privacy
All computation β file reading, parsing, scoring β happens entirely in your browser via JavaScript. No .inp file contents are ever transmitted to any server. This design was intentional: SWMM5 models frequently contain proprietary infrastructure data.
π Background
EPA SWMM5 is the world's most widely used public-domain stormwater model. Engineers maintain dozens or hundreds of model versions across calibration runs, design alternatives, and regulatory submittals. Tracking how similar two versions are has historically meant manual inspection β this tool automates that comparison.
Inspired by Bill James's Hall of Fame Similarity Scores. SWMM5 is a public-domain hydraulic model maintained by the US EPA. This project is not affiliated with either.
π€ Contributing
Issues and pull requests are welcome! Please open an issue first for large changes.
- Fork the repo
- Create a feature branch:
git checkout -b feature/my-improvement
- Commit your changes:
git commit -m "feat: describe change"
- Push and open a PR against
main
π License
MIT β see LICENSE for details.