feat: Add is_producer_url_unstable to feed schema and expose in API#1771
Merged
Conversation
davidgamez
reviewed
Jul 23, 2026
| # Three-state flag from the catalog CSV ("True"/"False"/empty). An empty cell leaves the DB | ||
| # value untouched (same as is_official), so a re-import never wipes an operator-set value. | ||
| is_producer_url_unstable_from_csv = self.get_safe_boolean_value(row, "is_producer_url_unstable", None) | ||
| if is_producer_url_unstable_from_csv is not None: |
Member
There was a problem hiding this comment.
[nitpick]: Taking into consideration that None is a valid value and has a "meaning", this conditional doesn't allow setting the value back to None.
Collaborator
Author
There was a problem hiding this comment.
After discussion with @emmambd, we don't need to go back to None.
For clarity (and my own understanding), here is a trace of the value through each stage.
1. Export — JSON → CSV (export_to_csv.py)
| JSON value | CSV cell |
|---|---|
true |
True |
false |
False |
null |
(empty) |
| field absent | (empty) |
An explicit null and a missing field are indistinguishable after export — both become an empty cell. The CSV never contains the literal string null.
2. Populate — CSV → DB (populate_db_gtfs.py)
- DB default:
NULL - Empty cell → no-op — the DB value is left unchanged (so
NULLstaysNULL, and an existingTrue/Falseis retained). True/False→ written to the DB (overwrites whatever was there).
3. Read — DB → API response
| DB | Python | API JSON |
|---|---|---|
NULL |
None |
null |
true |
True |
true |
false |
False |
false |
Net behavior
A null or absent value in the JSON results in:
true/falseif the DB value was alreadytrue/false, ornulliftrue/falsewas never set.
You can't go back to the null API response once it's set to True or False.
davidgamez
approved these changes
Jul 23, 2026
jcpitre
marked this pull request as ready for review
July 23, 2026 20:50
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.
Closes #1766
is_producer_url_unstableto the DB schema (nullable boolean, defaultnull)./v1/feeds,/v1/feeds/{id}and/v1/searchresponses (viasource_info).source_info+ update-request models).The rule for updating the DB from the CSV file is:
is_producer_url_unstablecell in the CSV is a no-change in the DB.TRUEorFALSEvalue in the CSV overwrites the current value.is_official(get_safe_boolean_value+ a not-Noneguard).Note: This PR should be merged before this PR from mobility-database-catalogs: Add unstable_producer_url field
#1547
Testing tips:
This PR includes new unit tests.
The whole chain (mobility-database-catalogs → mobility-feed-api) was tested somewhat, except the notification between the repos, which is outside of scope.
The test was:
"is_producer_url_unstable": "True",to one JSON file, and set it to"False"in another.Export catalogs to CSVworkflow.sources.csv. The file is placed in the mdb-csv bucket (authentication required).Mobility Catalog Updateworkflow in this repo.Tested these cases:
TrueanytrueFalseanyfalsenullnulltruetruefalsefalsePlease make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything