Skip to content

Historical comment attachments

comment_attachments.parquet has one row per attachment observed for an exact comment version. Join on both comment_id and the parent comment’s modify_date. The zero-based attachment_index preserves publisher list order. The publisher’s doc_order can differ. A withheld attachment can have an ID and restriction reason with null formats.

comment_attachment_coverage.parquet has one row per observed comment version. An observation of present or empty identifies a stated list. unstated means the staged source supplied no list, and conflict means copies disagree. An unmatched join means the stage has no observation for that version. Only stated lists have an attachment count. A size of -1 in the staged data appears as null in the typed formats list. The attachment_json column retains the staged object for inspection.

Run this DuckDB example against the public November 30 release. It returns one row even for a covered comment with no attachment rows.

SELECT c.comment_id, c.modify_date, c.observation, c.attachment_count,
       a.attachment_index, a.title, a.formats, a.restrict_reason
FROM read_parquet('https://data.spicygov.ai/sidecars/comment-attachments/1ab59641bcd6e405/comment_attachment_coverage.parquet') AS c
LEFT JOIN read_parquet('https://data.spicygov.ai/sidecars/comment-attachments/1ab59641bcd6e405/comment_attachments.parquet') AS a
  USING (comment_id, modify_date)
WHERE c.comment_id = 'ATF-2021-0002-134665'
  AND c.modify_date = '2021-08-29T20:39:01Z'
ORDER BY a.attachment_index;

To build a generation, pass the accepted attachment stage, its staging receipt and a new output directory. The builder verifies the source digest, reconciles repeated copies of each version, checks ordered lists against the stage and records counts and file hashes in manifest.json.

uv run --frozen python scripts/build_comment_attachment_sidecar.py reads.parquet staging.json release