Skip to content

feat(spider-stats): keep ATP's dataset attributes per spider - #940

Merged
brawer merged 1 commit into
mainfrom
spider-dataset-attributes
Nov 12, 2026
Merged

brawer merged 1 commit into
mainfrom
spider-dataset-attributes

Conversation

@brawer

@brawer brawer commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Requested by Sascha · project thread

Fixes #910.

Keeps ATP's per-spider dataset_attributes (license, attribution, use:openstreetmap, spider:lineage, …) through the pipeline, as a new dataset_attributes MAP<UTF8, UTF8> column of spider-stats.parquet, right after datum. Downstream tools join on atp.fetched.spider rather than having the attributes repeated on every row of conflated.parquet.

  • import_atp reads the attributes from each FeatureCollection's first line (already parsed there) and stores them, sorted by key, as a JSON object in a new last column of alltheplaces.spider-counts.tsv. Non-string values are kept as their JSON text; nulls are dropped. Attributes are kept for spiders whose features are not_for_osm too, since the license explains why.
  • compute_spider_stats writes them as a map: empty for a crashed spider (empty file), null for a spider without a file in the dump, like the other dump columns.
  • Counts files from an earlier version still read fine (no attributes), and import_atp treats them as missing so it counts again when the zip is there.
  • docs/outputs/SPIDER_STATS.md documents the column, with a DuckDB example.

The map type is unsorted like the tags of conflated.parquet, since MapBuilder can't produce a sorted one, but the entries are sorted.

Testing

cargo test (unit + integration) and cargo clippy --all-targets -- -D warnings pass. New unit tests cover the TSV round trip with tabs and newlines in values, reading the old header, and value conversion; the integration test checks license and attribution:name:en of winterthur_ch from the fixture dump.


Generated by Claude Code

import_atp now keeps the dataset_attributes of each spider's
FeatureCollection, such as license and attribution, in
alltheplaces.spider-counts.tsv, and compute_spider_stats writes them
to spider-stats.parquet as a MAP<UTF8, UTF8> column. Downstream tools
can join on atp.fetched.spider instead of repeating them on every row
of conflated.parquet.

Counts files from before are still read, without attributes, and
import_atp counts again where the zip is there.

Fixes #910.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ttfb2KDndfjnQEycP3Ay6G
@brawer brawer self-assigned this Nov 12, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Nov 12, 2026
@brawer
brawer merged commit 21e71ea into main Nov 12, 2026
6 checks passed
@brawer
brawer deleted the spider-dataset-attributes branch November 12, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep ATP's dataset attributes, such as licence, through the pipeline

2 participants