thecont1/traffic-oracle
GitHub: thecont1/traffic-oracle
Stars: 0 | Forks: 0
# TraffiCOracle
&& cd TraffiCOracle
# Install dependencies
bun install
# Start the development server
bun run dev
Open **http://localhost:5173**. No database, no API key, no `.env` file — the dashboard fetches live data automatically.
### Useful commands
bun run typecheck # Check TypeScript types
bun test # Run the test suite
bun run build # Build for production
bun run deploy # Deploy to Cloudflare Workers
## Data
### Where the data comes from
- **Routes file** — metadata about each monitored road (`csv-routes-bangalore.csv`)
- **Traffic file** — timestamped speed and duration readings (`csv-traffic-bangalore.csv`)
### Traffic data columns
| Column | Example | Meaning |
|--------|---------|---------|
| `date` | `2026-04-01` | Calendar date of the reading |
| `time` | `08:30` | Time of day (24-hour format) |
| `route_code` | `R-100` | Internal route identifier |
| `label_full` | `Hosur Road` | Human-readable route name |
| `label_short` | `Hosur Road` | Short display label |
| `duration` | `35` | Travel time in minutes |
| `distance` | `18` | Route distance in kilometres |
From `duration` and `distance`, TraffiCOracle computes **average speed** (km/h) for every row.
### Data quality
Before any number reaches a chart, the dashboard silently discards rows that fail common-sense checks:
- Trips longer than 5 hours (`duration > 300`)
- Speeds above 150 km/h (impossible in city traffic)
- Unreadable or missing dates
- Missing distance values (defaulted to 10 km to avoid crashes)
After validation, rows are aggregated by week and by day, and filtered by the route and time-of-day you select.
### How often it updates
## How it works
TraffiCOracle is a **zero-backend** React app. That means there is no private server holding your data, no login gate, and no API key to configure.
Your Browser
│
├─► fetches CSV from GitHub (public raw URLs)
│
├─► parses the CSV inside the browser
│
├─► validates, cleans, and aggregates the numbers
│
└─► draws charts, cards, and maps
Everything from the raw CSV download to the final chart pixel happens on your device. The only external dependency is the public GitHub repository that stores the raw traffic readings.
### Why percentiles matter
City traffic is not normally distributed: most trips cluster around a "typical" speed, but a single accident can create a long tail of very slow trips. Simple averages hide this. TraffiCOracle uses **percentiles** — the same approach used by professional traffic services like INRIX and TomTom — so the "typical" band truly represents what most commuters experience.
## Tips & Troubleshooting
| Problem | What to try |
|---------|-------------|
| Dashboard shows no data | Check your internet connection. The app needs to reach GitHub to download the CSV files. |
| TrafficNOW! looks old | Click the **Refresh** button in the pane, or wait a few minutes for the next automatic check. |
| Shared link looks different on my friend's screen | Make sure the URL contains the same `theme=` parameter if you want identical colours. |
| Fonts or layout look odd | Use the zoom pill in the header (`[-] 92% [+]`) instead of browser zoom. |
## License
MIT
标签:自动化攻击