Repository navigation
fix(deletion): compare the main category, not only the match mask - #1011
Merged
Merged
Conversation
An unmatched OSM feature became a deletion candidate when ATP had features of its brand in the country whose match mask intersected its own. The mask is coarse, so ATP's Walmart supermarkets made Walmart's pharmacies, garden centres and auto centres candidates, and fuel spiders made the shops and chargers at their stations candidates. Coverage now also keeps the main categories of the ATP features, and an OSM feature must have an equal category or a known pair, such as amenity=pharmacy and shop=chemist. The pairs are the contact matcher's, moved with main_category and category_factor to matchers/category.rs. 23 pairs from brand:wikidata matches are added, reviewed by hand; infer_contact_category_pairs.py gains --evidence=brand_wikidata to find them in any production run. On the 2026-11-16 output, this removes 9,792 of 178,989 candidates (5.5%). For 69% of a sample of them, ATP has a feature of the same brand within 100 m, against 12% for the candidates that stay. See docs/notes/2026-11-21-deletion-candidate-categories.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ttfb2NGXRJv4snY4vYNEXQ
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
Deletion candidates now need the main category to agree, not only the match mask. The mask lumps supermarkets, pharmacies, garden centres and car repair together, so ATP's Walmart supermarkets made Walmart's pharmacies, garden centres and auto centres deletion candidates, and fuel spiders made the shops and chargers at their stations candidates.
Change
main_category,category_factorand the pair table move frommatchers/contactto a newmatchers/category.rs, so the matcher and deletion use the same notion of "one business, two categories". The table keeps leaving out pairs that are two features at one site, such as a fuel station and its shop, or a counter inside a supermarket. Deletion needs exactly that line too.AtpCoveragekeeps the distinct main categories of the ATP features, as interned ids, next to the mask. An OSM feature is covered if the masks intersect and its category agrees (categories_agree) with one of them. A feature without a main category is judged by the mask alone, as before, and so is a brand whose ATP features have none.shop=vacantwith a brand stays a candidate. Street infrastructure keeps its own finer kind.brand:wikidatamatches are added after review by hand, for exampleshop=mobile_phone~shop=telecommunication(Orange, Vodafone),shop=department_store~shop=supermarket(Target, Walmart),amenity=fast_food~shop=bakery(Greggs) andamenity=cafe~shop=coffee(Starbucks). The file also lists 15 pairs that were rejected, with the reason: station shops, chargers, counters inside shops.infer_contact_category_pairs.py --evidence=brand_wikidatareads any productionconflated.parquet, because those matches ignore the category.Eval
I ran the new
deletion_reasonon all 178,989 candidates of the 2026-11-16 output, with the coverage rebuilt from that output's 4.3M ATP rows. The full write-up is indocs/notes/2026-11-21-deletion-candidate-categories.md.shop=convenience), 2,226 chargers at fuel stations, 774 pharmacies (Walmart, Sam's Club, Wegmans), 420shop=gas, 409 garden centres, 151 auto centres.Not covered
CATEGORY_PAIR_FACTOR. I didn't run the eval regions for this, so the next production run will show its effect.amenity=post_office~shop=copyshop. It's one business for The UPS Store and FedEx, but in the contact review it was postal counters inside shops. So about 100 UPS Stores mapped as post offices are no longer candidates.Tests
cargo fmt --check,cargo clippy --all-targets -- -D warnings, and the 528 library tests pass, including new ones forcategories_agree, category coverage by Wikidata and by name, andshop=vacant.pytestforscripts/passes.tippecanoe. They fail atrender_conflated_overview, afterconflate, and CI will run them.Generated by Claude Code