Repository navigation
feat(spider-stats): keep ATP's dataset attributes per spider - #940
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 newdataset_attributes MAP<UTF8, UTF8>column ofspider-stats.parquet, right afterdatum. Downstream tools join onatp.fetched.spiderrather than having the attributes repeated on every row ofconflated.parquet.import_atpreads 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 ofalltheplaces.spider-counts.tsv. Non-string values are kept as their JSON text; nulls are dropped. Attributes are kept for spiders whose features arenot_for_osmtoo, since the license explains why.compute_spider_statswrites 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.import_atptreats them as missing so it counts again when the zip is there.docs/outputs/SPIDER_STATS.mddocuments the column, with a DuckDB example.The map type is unsorted like the
tagsofconflated.parquet, sinceMapBuildercan't produce a sorted one, but the entries are sorted.Testing
cargo test(unit + integration) andcargo clippy --all-targets -- -D warningspass. New unit tests cover the TSV round trip with tabs and newlines in values, reading the old header, and value conversion; the integration test checkslicenseandattribution:name:enofwinterthur_chfrom the fixture dump.Generated by Claude Code