# CAA Head Start shared data catalog This is the shared structure for evidence used by the NYSCAA brief and hosted data library. It currently covers **33 imported New York CAA agency profiles**. It is not a nationwide directory and does not yet certify complete, current operating rosters. ## What is organized | Record | Purpose | Important distinction | |---|---|---| | Agency | Stable ID, name, state, external identifiers | Name changes must not create a second agency | | Program | Agency, program type, source, verification status | HS, EHS, combined programs and UPK are distinct populations | | Site | Reconciled physical location and address | A location-feed row is not automatically a center | | Program–site relationship | Delivery option, effective dates, operator, source | One building may host several programs | | Inventory record | Original source record, program, reported status, slots, district and snapshot date | Imported source assertions remain unreconciled until checked | | Contact | Role, contact details, source, as-of date, verification | Imported directory names are not certified current | | Metric | Stable code, definition, unit, denominator guidance, comparison rule | Children, families, funded places and visits are different measures | | Reporting period | Source label, period type, dates and precision | Unknown dates remain unknown; no invented January–December ranges | | Observation | Value, measure, population, geography, period, method, limitations and status | Multiple years and conflicting claims coexist; no silent latest-value substitution | | Source and source version | URL, title, retrieval date, archived-file hash and retrieval method | Evidence stays traceable when a website changes | | Citation | Observation, source version, page/section and supporting text | A link alone does not verify a claim | | Review and change history | Decision, reviewer, revision, fingerprint and previous values | Editing a fact or supporting source invalidates its approval | | Coverage and quality issue | Missing measures, unresolved discrepancies and reasons | Missing is never converted to zero | The metric dictionary and common collection checklist are maintained in the catalog. Consult the API or live coverage view for current counts. Checklist applicability starts as unknown; it must be established from the agency's programs. A metric being listed does not imply that every agency offers that service. ## Initial migration — historical baseline - 307 historical database claims plus 40 supplemental research statements: **347 staged observations**. - **337 original CAA location records** retained individually. No automatic address deduplication, center count or capacity sum. - 33 imported contacts retained for research; none certified current by the migration. - No inherited “approved” flags were promoted. There are **zero publication-approved observations in the new catalog** at initial migration. The audit's historical support classifications are preserved separately from structured publication approval. - The old evidence database remains an audit archive. New research and review belong in `backend/catalog.sqlite3`. Some historical statements have supporting research but still need population, measurement method, excerpt or denominator entered in the new review structure. Others have genuine unresolved source conflicts. These situations are visible separately in `research_status`, review status and quality issues. The structure does not itself resolve those research gaps. ## API Start `Start Data Catalog.command`, or from `backend` run `python3 local_server.py --page catalog.html`. Use the working address printed by the launcher. The catalog is at `/catalog.html` and the read-only API at `/api/v1` on that same address. An existing recognized local instance may use a different port. Run `Restart Head Start.command` after Python changes. | Endpoint | Returns | |---|---| | `/api/v1/agencies` | Agency IDs and names | | `/api/v1/agencies/{id}` | Uniform profile with approved dated observations, verified programs/contacts/sites, coverage and quality limits | | `/api/v1/agencies/{id}/research` | Full agency research bundle, including candidates, programs, contacts, inventory records and open issues; explicitly unapproved | | `/api/v1/metrics` | Definitions, units and comparability rules | | `/api/v1/observations` | Publication-approved observations only | | `/api/v1/observations?status=all` | Explicit research view, including unapproved claims | | `/api/v1/observations?agency_id={id}&metric_code={code}` | Approved evidence for a specific agency and measure | | `/api/v1/programs`, `/sites`, `/inventory-records`, `/contacts` | Research collections with their own verification/reconciliation status; do not assume these rows are verified | | `/api/v1/coverage?agency_id={id}` | Standard checklist with missing, needs-review, reviewed-dated-evidence or not-applicable status | | `/api/v1/quality-issues?agency_id={id}` | Recorded discrepancies and outstanding review requirements | | `/api/v1/sources`, `/source-versions`, `/reporting-periods` | Source metadata, archived-version identifiers and dated reporting periods | | `/api/v1/export` | Whole reviewed public catalog, including coverage gaps | | `/api/v1/snapshot` | Approved-evidence adapter used by the existing brief | | `/api/v1/schema` | Database field definitions and metric dictionary | Collection responses use `data` and `pagination`; default `limit=100`, maximum 500. Follow `pagination.next_offset` until it is null. Unknown parameters, invalid filters and unknown agency IDs are rejected. `status` accepts `approved`, `needs_review`, `disputed`, `retired`, or `all`; `kind` accepts `observed` or `modeled`. Numeric values are decimal strings to preserve precision. Local archival file paths and raw imported payloads are excluded from API responses. Example: ```javascript const response = await fetch('/api/v1/observations?agency_id=adirondack_community_action_programs_inc_ny'); const { data, pagination } = await response.json(); // data contains only observations that pass the current structured review. // Do not replace missing figures with zero or unreconciled inventory totals. ``` `openapi.json` provides a machine-readable interface definition. The local service supports GET only and binds to loopback. It is not an authenticated shared production service. A hosted API should serve `/export` and approved observations publicly, with authentication and role-based access around research/review endpoints. This task does not deploy a public backend. ## Adding and correcting data 1. Preserve the original document and hash; add a source/version, reporting period and source-defined program/population. 2. Create a draft observation with a metric code, source value, numeric interpretation, scope, method and limitations. Use `python3 -m catalog.manage draft observation.json --actor 'Researcher name'` from `backend`. Updates require `expected_revision` to prevent overwriting another edit. The command always creates a needs-review record. 3. Add the citation's page/section, supporting excerpt, population and denominator. Record conflicts as blocking quality issues. Do not classify ambiguous mixed populations as HS-only children. 4. Resolve discrepancies against authoritative sources. The internal `review_observation` function requires reviewer attribution, rationale and the expected revision; it rejects incomplete or conflicted claims. It is not exposed through an anonymous write API. Source/citation and structural record maintenance currently use the internal catalog functions/database, not a staff editing screen. The browser fact editor saves local drafts only and the confirmation worksheet exports responses; neither publishes to this catalog. 5. Run `python3 -m catalog.manage check`, then `python3 scripts/build_headstart_public.py` from the project root. The public package and brief snapshot are rebuilt from this catalog. Unreviewed values are excluded. Never use the legacy refresh/import commands to publish new evidence. The old server's write routes are archived in the updated server code. An already-running old server must be restarted to load that change; the catalog and brief must use the same active local address. The brief requires a catalog-versioned snapshot and will not accept a legacy export. ## Backups and validation Use SQLite's backup API to copy `backend/catalog.sqlite3` before importing or editing. Keep source archives, schema, metric definitions and the audit ledger with the backup. `python3 -m catalog.manage init` is repeatable: it imports missing records only and never overwrites reviews or changes publication status. Run from `backend`: `python3 -m unittest catalog.test_catalog -v`. Tests cover migration repeatability, relationships, unit/population validation, missing versus zero, source-change invalidation, revision conflicts, API filters and exclusion of unapproved values and private paths. This is application consistency testing, not a certification that all source claims are correct. ## Choosing agency-reported or other evidence Use `source_origin=agency_reported` or `source_origin=federal` on `/api/v1/observations`. Other values are `state`, `research`, and `unclassified`. The default response still includes approved observations only; `status=all` is explicitly a research view. Source origin identifies the publisher, not the measurement year or reliability. Each agency profile includes `source_counts`: approved agency-reported measure count, other reviewed measure count, and federal inventory row groups by snapshot date, program type and reported status. These are separate collections, never a combined center total. `data_quality.current_center_total` remains null until a current operating roster is established. The catalog's source comparison shows agency directory listings separately from federal program rows. An undated directory count remains research-only even when the entries themselves can be counted. The brief's Evidence control lets users choose agency figures, other published figures, or both, retaining every selected figure's population, period and citation. ## Keeping the Resource Hub current The Resource Hub is generated from catalog source metadata on **every catalog export and public build**. It includes public HTTP(S) source links even when their observations are still under review. Internal worksheets and local archive paths are excluded. Sources with the same URL are combined; fragment-only page references do not create duplicate cards. When discovering a source before recording a statistic, add its public title, URL, publisher, agency IDs, source origin, access date and a concise scope note to `backend/catalog/resource-discoveries.json`. Do not put candidate values, private paths or a claimed approval status there. Once observations are reviewed, the directory derives eligibility from the catalog's effective reviews, including source-change invalidation and blocking issues. A document supporting a reviewed fact is not approved in its entirety. Run `python3 scripts/build_headstart_public.py` followed by `python3 scripts/check_headstart.py` from the project root. This refreshes the local page, static hosting copy, downloadable source index and hosting ZIP together. The page uses `resource-sources.js`; other tools can read the same data in `resource-sources.json`. It works on static hosting without an administrative API connection. It is a published snapshot, not a live website crawler. ## Source monitoring and reviewed updates A separate source monitor now watches catalog citations, contact-citation URLs and the curated official report/directory pages in `backend/catalog/source-watchlist.json`. It records retrieval status and archived versions in `backend/source-monitor.sqlite3`, separate from the evidence catalog. Source changes, newly linked reports and repeated retrieval failures become review tasks. Monitoring never edits or approves catalog observations. Weekly checks are scheduled for Mondays at 9:00 a.m. Eastern in the existing Codex task. Local execution requires the project computer and Codex to be available. The public website displays the last built snapshot; it does not execute the monitor. A scheduled run rebuilds local public outputs and runs validation; external hosting is a separate publication step. See `backend/SOURCE_MONITOR.md` for commands, limitations and recovery. The first successful retrieval establishes a baseline, not a new review of all claims. A PDF that differs from its preserved catalog archive is flagged for comparison. Later HTML checks ignore navigation, scripts and whitespace, and detect candidate report links. Changed files may reflect formatting changes rather than changed facts. Failures preserve the last good archive and do not establish closure or zero services. Research candidate updates against their original sources. Record definitions, units, reporting periods, denominators, program/geographic scope, citations and review decisions before making a figure eligible. Preserve historically valid evidence and record contradictions in the review queue. The monitor covers known URLs and selected indexes, not every page on every agency website. User-submitted information can supplement this research; it is not the only update channel. After review, rebuild all outputs with `python3 scripts/build_headstart_public.py`, then run `python3 scripts/check_headstart.py`. The build refreshes brief evidence, Library/catalog snapshots, Resource Hub, staff guide and hosting ZIP together. Keep source-check times, publication/reporting dates, fact review dates and build dates separate. The imported location inventory/district geometry, agency-contact directory and congressional-recipient list still require their own reconciliation and maintained inputs. Watching their source links does not automatically update those records. Automated numerical extraction, automatic fact approval and unattended external deployment are not enabled.