dc-water-filter
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Val Town email trigger that filters DC Water emergency alerts by proximity. See
README.md for details.
This is a Val Town project. See VALTOWN_GUIDE.md for full Val Town platform
docs, standard libraries, and gotchas.
Key points for this project:
- Runtime is Deno (serverless), not Node.js
- Entry point:
backend/index.ts— exports a defaultasync function(e: Email)handler - Environment variables via
Deno.env.get() - Val Town std libraries used:
email(forwarding),openai(LLM fallback)
- TypeScript, strict mode
- Pure functions in
shared/for testability - Never hardcode secrets — use environment variables
- Fail open (forward the email) rather than silently dropping on errors
- Only hard filter is the NE quadrant check
deno test shared/parsing_test.ts --allow-read --allow-net --no-config
--no-configavoidsdeno.jsonimporting Val Town types unavailable locally.emltest fixtures inexamples/use CRLF line endings
- Geocoder: US Census Bureau (
geocoding.geo.census.gov) — free, no API key, handles DC intersections - LLM fallback: OpenAI gpt-4o-mini via Val Town
std/openaifor locations that resist deterministic parsing - Email format: Location is always in
located on/in [LOCATION]. Some customers— HTML uses<sup>for ordinals,&for &