Match or create providers for raw records

Open
#1,913 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
backend, databases

Research direction

Start by reading the extractor code that creates agencytxt and feedinfo records, the shared services under api/src/shared, and the tasks_executor task patterns. Trace how records, providers, aliases, and contacts are stored, then identify existing URL normalization and locking support. Done means new and backfilled records are linked idempotently, matching follows the stated name and normalized URL rules, and concurrent runs do not create duplicate providers.

Written by the indexing model from the issue text.

Description

Describe the problem

Every raw agency.txt and feed_info.txt record needs a provider, and there is no capacity to review each one by hand.

Proposed solution
  • Shared link service in api/src/shared: links a record to a provider and adds the record's name as an alias and its URL, email and phone as contacts when missing (URLs compared after normalization). Nothing is removed or overwritten.
  • When the extractor creates a new agencytxt or feedinfo record:
    • if a linked record of the same type has the same name (trimmed) and the same normalized URL, link to its provider;
    • otherwise create a provider (name from the record, status published) and link it.
  • A record without a URL never matches and gets its own provider.
  • Serialize match-or-create per name and normalized URL (advisory lock) so concurrent tasks don't create duplicate providers.
  • tasks_executor task to run match-or-create on all unlinked records (backfill after #1909).

Acceptance criteria:

  • Every new record is linked to a provider.
  • http/https, www. and trailing / differences still match; name differences do not.
  • Reruns and concurrent runs create no duplicate providers.
  • No fuzzy matching or confidence score.
Alternatives you've considered
  • Leaving unmatched records unlinked for manual review: rejected, not enough people to process the queue.
  • Matching on name or URL alone: rejected, a shared parent website or a generic name would wrongly merge separate agencies.
Additional context
Dominant language
Python
Stars
34
Forks
7
Avg merge
3d 3h
Merged PRs (30d)
22

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MobilityData/mobility-feed-api

All issues in MobilityData/mobility-feed-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.