DC Water Filter — AI Assistant Context

Project Overview

Val Town email trigger that filters DC Water emergency alerts by proximity. See README.md for details.

Platform

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 default async function(e: Email) handler
  • Environment variables via Deno.env.get()
  • Val Town std libraries used: email (forwarding), openai (LLM fallback)

Code Standards

  • 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

Testing

deno test shared/parsing_test.ts --allow-read --allow-net --no-config
  • --no-config avoids deno.json importing Val Town types unavailable locally
  • .eml test fixtures in examples/ use CRLF line endings

Architecture Notes

  • 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/openai for locations that resist deterministic parsing
  • Email format: Location is always in located on/in [LOCATION]. Some customers — HTML uses <sup> for ordinals, &amp; for &