# FoodBridgeCT API specification — v1

**Status:** Current Phase II source contract. The October 21 public review found
production still reports `189f28f716497dde0b57a9df60611bde44725b07`, which lacks
newer service-day, transit, and video changes. The canonical source snapshot is
not certified as deployed. Examples describe reviewed snapshots, not current
food availability.

## 1. Scope and architecture

The API lets clients discover food providers, compare nutrition profiles, and explore
assistance programs and their documented connections. Version 1 is read-only and
requires no authentication. The public API runs at `https://api.foodaccess.me/api/v1`; the frontend also
provides the same-origin gateway `https://foodaccess.me/api/v1`.
The Part 3 PostgreSQL-backed Flask API uses `http://localhost:8000` locally.
The older static-site development server at `http://localhost:5174` retains its
JSON-backed compatibility API as a separate historical preview; the React application uses Flask.

```text
Website or Postman
       |
       | GET /api/v1/...
       v
Flask routes -> request validation -> SQL queries -> JSON response
                                          |
                                          v
                         PostgreSQL records and source evidence
                         providers <-> programs <-> nutrition
                              <---------------------->
```

The Flask application factory is `backend.main:create_app`. It requires
`DATABASE_URL`, uses SQLAlchemy against PostgreSQL 17, and never loads catalog
JSON during requests. Reviewed imports remain a separate administration step.
Filtering, counts, sorting, LIMIT and OFFSET execute in SQL; serializers hydrate
only the selected records and their evidence/relationships. Each request uses
one read-only REPEATABLE READ snapshot, including pagination metadata.
See [backend setup and verification](BACKEND.md) for Docker and native commands.

Authentication, record creation/editing/deletion, account management, and server-side
favorites are outside v1. Favorites remain browser-local. GitLab contribution
collection is separate from these directory endpoints.

## 2. HTTP conventions

| Property | Contract |
| --- | --- |
| Base path | `/api/v1` |
| Public origin | `https://api.foodaccess.me`; gateway: `https://foodaccess.me` |
| Local origin | `http://localhost:8000` for Flask; `5174` is the legacy static development server |
| Resource methods | `GET`; requests have no body |
| Request header | `Accept: application/json` |
| Response header | `Content-Type: application/json; charset=utf-8` |
| Field naming | Existing catalog camelCase; query names are specified below |
| IDs | Lowercase slug matching `^[a-z0-9]+(?:-[a-z0-9]+)*$` |
| Dates | `YYYY-MM-DD`; retrieval timestamps include a timezone |
| Arrays | Always arrays, including when empty; related IDs must be unique |
| Unknown values | Explicit `null` only where the schema permits it |

Canonical resource paths have no trailing slash. The local server also accepts
a trailing slash without redirecting. Browser pages such as `/providers/` remain separate HTML routes.
Unsupported write methods on a known resource return `405` with `Allow: GET`.
Deploying frontend and API under the same origin avoids requiring cross-origin access;
if they use different origins, configure the allowed frontend origin explicitly.

`CORS_ORIGINS` is a comma-separated list of exact frontend origins. Allowed
origins receive CORS headers on successes and errors; credentials are disabled.
Browser OPTIONS preflight requests are answered with 204 and advertise GET only.
Ordinary OPTIONS and HEAD requests retain the 405 contract. Disallowed origins
receive no allow-origin header; CORS is a browser policy, not authentication.
`GET /healthz` probes the database tables and returns `{"status":"ok"}` or 503.
Database failures return uncached JSON `SERVICE_UNAVAILABLE`, with a generic
message and no connection strings or SQL details. Production HTTPS checks are a separate release gate; local passing tests do not
establish public deployment status.

## 3. Endpoint map

| Method | Endpoint | Response |
| --- | --- | --- |
| GET | `/api/v1/providers` | `ListResponse<Provider>` |
| GET | `/api/v1/providers/{id}` | `DetailResponse<Provider>` |
| GET | `/api/v1/nutrition` | `ListResponse<Nutrition>` |
| GET | `/api/v1/nutrition/{id}` | `DetailResponse<Nutrition>` |
| GET | `/api/v1/programs` | `ListResponse<Program>` |
| GET | `/api/v1/programs/{id}` | `DetailResponse<Program>` |

Reviewed Phase II IDs:

| Model | IDs |
| --- | --- |
| Providers | `downtown`, `sunset-valley`, `mueller`, `aph-east-austin`, `haca-lakeside`, `austin-public-library`, `zavala-elementary`, `dove-springs-recreation-center`, `round-rock-serving-center`, `pan-american-recreation-center` |
| Nutrition | `carrots`, `broccoli`, `spinach`, `golden-delicious-apple`, `banana`, `pinto-beans`, `brown-rice`, `baked-sweet-potato`, `tomato`, `cucumber` |
| Programs | `snap`, `double-up`, `wic-fmnp`, `fresh-food-for-families`, `hope`, `csfp`, `backpack`, `feeding-futures-school-pantry`, `mobile-pantry`, `cacfp-afterschool-meals` |

IDs are unique within their model, not necessarily across models. Detail endpoints
accept no query parameters. To navigate a relationship, use its model and ID to
request the corresponding detail endpoint; there is no separate relationship endpoint.

## 4. Search, filtering, sorting, and pagination

### Shared list parameters

| Parameter | Type | Default | Meaning |
| --- | --- | --- | --- |
| `q` | string | empty | AND search for whitespace-separated terms across the model's five card fields |
| `page` | integer >= 1 | `1` | Requested result page |
| `per_page` | integer, 1–100 | `3` | Maximum records per page |
| `sort` | allowed field name | `name` | Field used for sorting |
| `order` | `asc` or `desc` | `asc` | Sort direction |

### Model-specific parameters

Every name listed below is a separate query parameter. Each numeric range has two
independent bounds; for example, `fiber_min=2.5&fiber_max=3`.

| Model | Text filters | Numeric filters | Allowed sort fields / fields searched by `q` |
| --- | --- | --- | --- |
| Providers | `name`, `type`, `city`, `zip`, `programNames` | None | `name`, `type`, `city`, `zip`, `programNames` |
| Nutrition | `name` | `energy_min`, `energy_max`, `protein_min`, `protein_max`, `fiber_min`, `fiber_max`, `sodium_min`, `sodium_max` | `name`, `energy`, `protein`, `fiber`, `sodium` |
| Programs | `name`, `type`, `audience`, `area` | `providerCount_min`, `providerCount_max` | `name`, `type`, `audience`, `area`, `providerCount` |

Providers also accept `open_day`, a full weekday name (case-insensitive).
For example, `open_day=saturday` matches only providers whose reviewed `hours`
explicitly name Saturday. Unknown/varying schedules are excluded from a specific
day; results are not a claim that a site is currently open. Empty values mean any
day; unrecognized nonempty values return 400. This filter does not add a sort
field or change the five-field general search contract.

### Processing rules

1. Validate the entire query before querying data. Reject unknown or repeated keys,
   unsupported sort fields/orders, and invalid numeric values with `400 INVALID_QUERY`.
   Parameter names, field names, and `asc`/`desc` are case-sensitive.
2. Text queries containing a null character (`%00`) match no records, since
   PostgreSQL text cannot contain that character. This preserves compatibility
   with the original API rather than reporting a database outage.
   Trim text queries and match case-insensitive substrings. An empty text filter is
   ignored. For `q`, split on Unicode whitespace, case-fold and de-duplicate terms,
   and require every term to occur as a literal substring somewhere in the joined
   searchable values. Term order is irrelevant and different terms may match
   different fields. Join the five displayed values with spaces; represent numbers
   without units and join array values with commas and spaces. Null contributes no text.
   Repeated terms do not affect results. Punctuation remains literal within a term;
   there is no phrase syntax, stemming, punctuation stripping, or relevance ranking.
   `programNames` matches the joined program-name list; it does not match program IDs.
3. Combine `q` and individual filters with AND. Numeric bounds are inclusive,
   finite, and nonnegative. Provider-count bounds must be integers. An empty numeric
   parameter or a minimum greater than its maximum is invalid. Null nutrients never
   satisfy a numeric bound. Reject non-finite values such as `NaN` and `Infinity`.
4. Sort numbers numerically and text by case-folded lexical order. ZIP codes stay
   strings. For `programNames`, sort the case-folded program names, join with `, `,
   and compare that string. Null values sort last in both directions. Break all ties
   by ID ascending, regardless of the primary sort direction.
5. Count matching records, then paginate. `total` counts matches before pagination;
   `pages = ceil(total / per_page)`. A valid page beyond the last returns empty
   `data` while retaining the actual `total`, `pages`, and requested `page`.

Integer parameters accept decimal digits only. Percent-encode query values in URLs;
for example, `type=Produce%20incentive`. The API uses `fiber_min`, not the static
website's `filter-fiber-min` browser-state parameter. `saved` is not an API parameter.

### Reviewed multi-term examples

These expected IDs are tied to the reviewed snapshot and are the handoff oracle for
backend, Postman, frontend, and browser tests. IDs below are shown in the default
case-insensitive name order.

| Request | Expected IDs |
| --- | --- |
| `/api/v1/providers?q=Austin%20SNAP&per_page=100` | `sunset-valley`, `downtown`, `mueller` |
| `/api/v1/nutrition?q=banana%202.6&per_page=100` | `banana` |
| `/api/v1/programs?q=Texas%203&per_page=100` | `double-up`, `snap`, `wic-fmnp` |

Reversed order, mixed case, duplicate terms, and surrounding/repeated whitespace
must produce the same ID sets. An additional filter can only narrow the set;
sorting follows matching and filtering, and pagination follows sorting.

## 5. Response envelopes

The notation below describes schemas, not executable backend code. Every declared
field is required unless marked optional. List items and detail `data` use the same
complete entity schema; list responses do not include top-level relationship evidence.

```text
ListResponse<T> {
  data: T[],
  meta: {
    total: integer >= 0,
    page: integer >= 1,
    per_page: integer in [1, 100],
    pages: integer >= 0
  }
}

DetailResponse<T> {
  data: T,
  relationships: Relationship[]
}

ErrorResponse {
  error: {
    code: string,
    message: string
  }
}
```

An empty successful list is `200`, not `404`:

```json
{"data": [], "meta": {"total": 0, "page": 1, "per_page": 3, "pages": 0}}
```

## 6. Entity schemas

### Fields shared by every entity

| Field | Type | Meaning |
| --- | --- | --- |
| `id` | string | Stable model-specific slug |
| `name` | string | Resource's display name |
| `description` | string | Reviewed explanatory text |
| `snapshotDate` | date string | Date of the reviewed facts, not the request date |
| `sources` | string[] | Official source URLs |
| `sourceIds` | string[] | Identifiers of supporting source snapshots |
| `provenance` | SourceEvidence[] | Retrieval and checksum metadata |
| `media` | Media object | Reviewed local image path, alt text, caption, credit, source, width, and height |

### Provider extends the shared fields

| Field | Type | Meaning |
| --- | --- | --- |
| `type` | string | Service-site type, initially `Farmers’ market` |
| `city` | string | Municipality from the published address |
| `zip` | string | Five digits; preserve leading zeros |
| `address` | string | Full published service address |
| `organization` | string | Operating organization |
| `hours` | string | Published schedule in the snapshot |
| `visit` | string | Practical visit guidance and limitations |
| `programs` | string[] | Related program IDs |
| `nutrition` | string[] | Related nutrition IDs |
| `programNames` | string[] | Display names derived from related programs |
| `sourceLocationId` | positive integer, optional | Stable source-system location ID when supplied by the CTFB locator |

### Nutrition extends the shared fields

| Field | Type | Meaning |
| --- | --- | --- |
| `fdcId` | positive integer | USDA FoodData Central identifier |
| `category` | string | Source food category |
| `preparation` | string | Preparation form, initially raw |
| `dataType` | string | Source dataset, initially `SR Legacy` |
| `basis` | string | `per 100 g edible portion` |
| `units` | object | `{"energy":"kcal","protein":"g","fiber":"g","sodium":"mg"}` |
| `energy` | nonnegative number or null | Energy in kcal per 100 g |
| `protein` | nonnegative number or null | Protein in g per 100 g |
| `fiber` | nonnegative number or null | Dietary fiber in g per 100 g |
| `sodium` | nonnegative number or null | Sodium in mg per 100 g |
| `providers` | string[] | Related provider IDs |
| `programs` | string[] | Related program IDs |

Missing nutrients remain null, never zero. Values describe the stated preparation
and measurement basis; they are not a serving recommendation or inventory claim.

### Program extends the shared fields

| Field | Type | Meaning |
| --- | --- | --- |
| `type` | string | Benefit, incentive, or other program category |
| `audience` | string | Source-described intended participants |
| `area` | string | Documented service area |
| `action` | string | Recommended next step and assistance information |
| `providers` | string[] | Linked provider IDs |
| `nutrition` | string[] | Linked nutrition IDs |
| `providerCount` | nonnegative integer | Length of `providers`, not the entire program network |

### SourceEvidence

| Field | Type | Meaning |
| --- | --- | --- |
| `id` | string | Source identifier referenced by `sourceIds` |
| `name` | string | Human-readable source label |
| `url` | string | Source URL without API credentials |
| `retrievedAt` | timestamp string | Actual retrieval time with timezone |
| `path` | string | Repository-relative evidence path under `data/`; metadata, not an API route |
| `sha256` | 64-character lowercase hex string | SHA-256 of the saved evidence bytes |
| `evidenceFormat` | string | Description of the saved evidence format |
| `archiveSha256` | string, optional | Historical archive checksum; not a replacement for `sha256` |

The backend must not return access tokens, absolute filesystem paths, or credentials.
Existing saved provenance includes `archiveSha256`; new sources may omit it.

## 7. Relationship schema and interpretation

```text
Relationship {
  fromModel: "providers" | "programs",
  fromId: string,
  toModel: "programs" | "nutrition",
  toId: string,
  kind: "documented" | "illustrative" | "derived",
  explanation: string,
  sources: string[],
  sourceIds: string[],
  viaPrograms: string[]  // required for derived edges; absent otherwise
}
```

| Stored direction | Kind | Interpretation |
| --- | --- | --- |
| Provider -> Program | `documented` | Officially documented participation |
| Program -> Nutrition | `illustrative` | Food illustrates a source-mentioned category; not promised distribution or eligibility |
| Provider -> Nutrition | `derived` | Connection through the provider's documented programs; not evidence of current inventory |

Only these three direction/kind combinations are valid. Relationships are stored
once but navigable in both directions. Each detail response includes every edge
where the requested model and ID appear at either end. A derived edge's
`viaPrograms` must refer to programs connecting that provider to that food.
Keep related ID arrays reciprocal and derive `programNames` and `providerCount`
from the same relationships. Return evidence edges in stable order by
`fromModel`, `fromId`, `toModel`, then `toId`.

For example, `/providers/mueller` under the API base path returns Mueller's provider
record plus its incident provider-program and provider-nutrition edges. Follow a
program ID with `GET /api/v1/programs/{id}` to retrieve that program's evidence.

## 8. Example requests and responses

| Request | Expected result for the reviewed Phase II snapshot |
| --- | --- |
| `GET /api/v1/providers?q=78723` | Mueller only |
| `GET /api/v1/providers?zip=78701` | Austin Public Library, HACA Lakeside, then Downtown |
| `GET /api/v1/programs?type=Produce%20incentive` | Double Up only |
| `GET /api/v1/nutrition?fiber_min=2.5&sort=sodium` | First page: banana, pinto beans, broccoli; `total=5`, `pages=2` |
| `GET /api/v1/nutrition?name=broccoli` | The complete response below |
| `GET /api/v1/providers/mueller` | One provider plus its incident relationship edges |
| `GET /api/v1/nutrition?per_page=1&page=2&sort=name` | Broccoli; `total=10`, `pages=10` |
| `GET /api/v1/nutrition?page=5` | Empty data; `total=10`, `pages=4` |

Complete example: `GET /api/v1/nutrition?name=broccoli`, HTTP `200`:

```json
{
  "data": [
    {
      "id": "broccoli",
      "name": "Broccoli, raw",
      "fdcId": 170379,
      "category": "Vegetables",
      "preparation": "Raw",
      "basis": "per 100 g edible portion",
      "energy": 34,
      "protein": 2.82,
      "fiber": 2.6,
      "sodium": 33,
      "description": "This USDA profile describes broccoli, raw. Compare its energy, protein, fiber, and sodium using the same 100 g basis as the other foods in this directory. Cooking and added ingredients change the nutrient profile. Values come from USDA SR Legacy data and are not per serving or a dietary recommendation.",
      "sources": [
        "https://fdc.nal.usda.gov/food-details/170379/nutrients"
      ],
      "snapshotDate": "2026-09-27",
      "sourceIds": [
        "170379"
      ],
      "dataType": "SR Legacy",
      "units": {
        "energy": "kcal",
        "protein": "g",
        "fiber": "g",
        "sodium": "mg"
      },
      "media": {
        "image": {
          "path": "broccoli.svg",
          "alt": "Illustration of raw broccoli",
          "caption": "Original food illustration; not an indication of current provider stock",
          "credit": "FoodBridgeCT",
          "source": "/about/",
          "width": 640,
          "height": 420
        },
        "video": {
          "foodId": "broccoli",
          "youtubeId": "6XFBd7qqzLw",
          "title": "Broccoli and Everything Salad",
          "creator": "Food Hero",
          "source": "https://foodhero.org/recipes/broccoli-and-everything-salad",
          "videoSource": "https://foodhero.org/time-lapse-recipe-videos",
          "reviewedDate": "2026-10-21",
          "evidence": {
            "path": "raw/preparation-videos.json",
            "sha256": "f5a2658d76eedc802f578e1143ea28790a1921a62b425b678b62f1b7a1b1bd70"
          }
        }
      },
      "providers": [
        "downtown",
        "sunset-valley",
        "mueller",
        "aph-east-austin",
        "zavala-elementary",
        "round-rock-serving-center"
      ],
      "programs": [
        "snap",
        "double-up",
        "wic-fmnp",
        "fresh-food-for-families",
        "feeding-futures-school-pantry"
      ],
      "provenance": [
        {
          "id": "170379",
          "name": "USDA FoodData Central record 170379",
          "url": "https://api.nal.usda.gov/fdc/v1/food/170379",
          "retrievedAt": "2026-09-27T17:21:00.952969+00:00",
          "archiveSha256": "391f8cde74e6b78a555b40b164d6d0156e4b9c092b88d2b5bdab818d720f1730",
          "path": "raw/170379.json",
          "sha256": "292cf663dd8a7c600ef619296884c334500fc9aa858b777f032b64b242314f4d",
          "evidenceFormat": "USDA JSON"
        }
      ]
    }
  ],
  "meta": {
    "total": 1,
    "page": 1,
    "per_page": 3,
    "pages": 1
  }
}
```

## 9. Errors

| Status | Code | When |
| --- | --- | --- |
| 200 | — | Valid list or known detail resource |
| 400 | `INVALID_QUERY` | Invalid query or malformed detail ID |
| 404 | `NOT_FOUND` | Valid slug with no matching record, or unknown API route |
| 405 | `METHOD_NOT_ALLOWED` | Unsupported method on a known resource; include `Allow: GET` |
| 500 | `INTERNAL_ERROR` | Unexpected server failure |
| 503 | `SERVICE_UNAVAILABLE` | PostgreSQL is unavailable to the Flask backend |

Examples:

```json
{"error": {"code": "INVALID_QUERY", "message": "fiber_min must not exceed fiber_max"}}
```

```json
{"error": {"code": "NOT_FOUND", "message": "Record not found"}}
```

```json
{"error": {"code": "INTERNAL_ERROR", "message": "An unexpected error occurred"}}
```

Clients should branch on `code`, not the human-readable message. Error responses
use the same JSON content type as successful responses. Log diagnostic details
server-side; never return stack traces, credentials, or filesystem details.

## 10. Running and testing

Use the public API without starting a local server:

```sh
curl "https://api.foodaccess.me/api/v1/providers"
```

For the Part 3 Flask/PostgreSQL API, follow [BACKEND.md](BACKEND.md), then run
`npm run test:postman` against `http://localhost:8000`. To test isolated databases
and HTTP together, set `TEST_DATABASE_URL` and run `python -m backend.check`.

For legacy static-site development:

```sh
npm ci
npm run dev
```

Open `http://localhost:5174` for the website. For example:

```sh
curl "http://localhost:5174/api/v1/providers?q=78723"
curl "http://localhost:5174/api/v1/nutrition?fiber_min=2.5&sort=sodium"
curl "http://localhost:5174/api/v1/programs/snap"
```

Use `npm run dev -- --port 8080` to change ports. `npm run share` serves both
website and API on the LAN. Restart after changing source or catalog data.
The Python standard-library server is a local development server. Publishing only
`dist/` to a static host does not deploy the API; public API hosting requires a
Python server process. The current public deployment runs that process on EC2
and exposes both website and API through Cloudflare Tunnel.

`npm run check` runs automated HTTP and query tests, builds the site, and checks
local links. `npm run check:browser` also verifies same-origin API access alongside
the website. The acceptance requirements are:

- All six endpoints return the specified envelopes and complete entity fields.
- Every list supports its five sort fields, both orders, applicable filters,
  case-insensitive search, and combined queries.
- Pagination works for empty matches and requests beyond the last page.
- Numeric sorting is numeric; null values stay last and never match numeric bounds.
- Unknown/repeated parameters, invalid ranges, bad IDs, and unsupported methods
  return the documented errors without leaking internal details.
- All 30 reviewed records can be reached through their related IDs, and detail
  evidence preserves documented, illustrative, and derived meanings.
- The server can start and answer requests without live source APIs or credentials.
- Automated tests exercise these behaviors against a running HTTP server.

Read the [public Postman API documentation](https://documenter.getpostman.com/view/13905587/2sBYHURz16).
The editable collection is maintained in the [FoodBridgeCT Postman workspace](https://danacoates-5316873.postman.co/workspace/foodbridgect~fd7e203c-6225-4682-b55a-ef1b5a9fd84c/overview).
Import `api/foodbridgect.postman_collection.json` into Postman. Its default
`baseUrl` is `https://foodaccess.me`, with no trailing slash or `/api/v1`; each
request already includes the API path. For local development, change it to
`http://localhost:8000` for the Flask backend and select **Desktop Agent**.
The JSON-backed historical compatibility preview is separately available on 5174.
Cloud Agent cannot reach your local backend. Saved response examples can be inspected offline.

The collection includes **65 executable requests** in Providers, Nutrition, and
Programs folders: all six endpoint patterns, all 30 instance IDs, search and
combined filters, numeric ranges and ordering, pagination, empty matches, and
negative cases. Each request includes its purpose, an example generated by the
backend's dispatcher, and status/schema assertions. Detail assertions check
connections to both other models and evidence meaning. Negative requests pass
when their expected `400`, `404`, or `405` is returned, including `Allow: GET` for
unsupported writes. Collection-level checks verify JSON and `Cache-Control`.

Use **Run collection** to execute all folders against the public API, or override `baseUrl` to test a running local server.
ID/order and pagination assertions target the reviewed September 27 and October
19, 2026 snapshots. Run `npm run api` to regenerate examples and assertions after reviewed
catalog changes. The complete contract in this file is also embedded in the
collection description, so graders can read it within Postman. Automated Python
HTTP tests check every saved example against the running server.

Image metadata is part of each entity response; map embeds are assembled by the
website renderer from provider addresses. The website's multimedia presentation
remains separate from the API's source and relationship evidence schemas.
The API is publicly accessible without authentication. Access to the editable
Postman workspace depends on its separate workspace permissions.


## Deployment metadata (outside API v1)

The Flask and React services each provide `GET /version`, returning
`{"revision":"<full deployed Git SHA>"}` with `Cache-Control: no-store`.
Docker runtime images set this from the `RELEASE_SHA` build argument; native
unconfigured development returns `development`. This does not query PostgreSQL
or replace `/healthz`. `/healthz` verifies database-backed service availability.
The legacy static compatibility server does not implement these deployment
routes. The six `/api/v1` route patterns and the 65-request Postman contract are
preserved; the separate `scripts/release_check.py` verifies production metadata,
TLS, CORS, HTML, and canonical routing. See [deployment](DEPLOYMENT.md).

## Live and controlled-seed Postman checks

The exported collection defaults to `verificationMode=live`: schema, requested
filters, stable sorting, pagination arithmetic, unique IDs, and relationship
evidence are checked without assuming a fixed record total. Saved examples remain
reviewed snapshots. For a disposable database imported from the exact catalog
used to generate the collection, pass `--env-var verificationMode=snapshot` to
Newman. This additionally asserts exact generated IDs/order and metadata.
`backend.check` and the backend Compose gate set snapshot mode explicitly.
Regenerate both exports with `python3 scripts/make_api.py` after reviewed changes.

Photographs may include optional `media.image.variants`, an array of local WebP
`path` and positive integer `width` candidates. Original media, attribution, and
alt text remain authoritative; renderers select a candidate using `srcset/sizes`.

### Optional provider transit media

`media.transit` carries reviewed scheduled-bus enrichment: `providerId`, source
URL, feed version, retrieval date, service-window dates, evidence path/SHA, and
`stops`. Each stop has a code/name/coordinates, scheduled route IDs/names,
`straightLineMeters`, and pedestrian `walkMeters`/`walkMinutes`. Walking values
are approximate mapped pedestrian routes, not live journey/arrival estimates.
The source is validated at import and stored in the existing media JSONB field.
Missing enrichment never means that a provider has no public transport.

### Optional nutrition preparation video

`media.video` contains `foodId`, an allowlisted 11-character `youtubeId`, title,
creator, educational recipe `source`, `videoSource`, review date, and source
extract path/SHA. It is reviewed enrichment stored in the existing media JSONB
field; numeric nutrient values still describe the original food preparation.
The website renders an on-demand embedded player plus always-visible source and
watch links. Invalid IDs/sources, wrong-food assignments, and metadata differing
from the hashed source extract fail import validation.

## Phase III release verification

See [Step 4 handoff](PHASE3_STEP4.md) for current local evidence, required CI
jobs, artifact names and pending release metadata. Reimport the reviewed program
media changes before integration checks. The public release probe now verifies
exact multi-term results, totals, page boundaries, same-origin parity and safe
SSR highlights for all three models. Older counts in this document are historical.
