feat: expose license tags in search endpoint results and filters#1620
feat: expose license tags in search endpoint results and filters#1620
Conversation
Co-authored-by: davidgamez <1192523+davidgamez@users.noreply.github.com>
Co-authored-by: davidgamez <1192523+davidgamez@users.noreply.github.com>
|
*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/ * (Desktop)
*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/feeds * (Desktop)
*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/feeds/gtfs/mdb-2126 * (Desktop)
*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/gbfs/gbfs-flamingo_porirua * (Desktop)
|
|
Preview Firebase Hosting URL: https://mobility-feeds-dev--pr-1620-1gfa98il.web.app |
|
Example DEV request: Response: ...
{
"id": "tdg-83744",
"data_type": "gtfs",
"status": "active",
"created_at": "2026-01-12T14:46:01.482456Z",
"official": true,
"external_ids": [
{
"external_id": "83744",
"source": "tdg"
}
],
"provider": "COMMUNE DE COURCHEVEL",
"feed_name": "Transport par câble hivernal Courchevel",
"note": null,
"feed_contact_email": null,
"source_info": {
"producer_url": "https://transport.data.gouv.fr/resources/83744/download?token=xdgqKBTAzhw4DSPz6zeGc4c5eW0LhwztcGv4-vpzP4U",
"authentication_type": 0,
"authentication_info_url": null,
"api_key_parameter_name": null,
"license_url": "https://www.data.gouv.fr/pages/legal/licences/etalab-2.0",
"license_id": "etalab-2.0",
"license_is_spdx": true,
"license_notes": null,
"license_tags": [
"domain:content",
"domain:data",
"license:government-open-license",
"notes:attribution-required",
"notes:government-open-license"
]
},
"redirects": null,
"locations": [
{
"country_code": "FR",
"country": "France",
"subdivision_name": "Courchevel",
"municipality": null
}
],
"latest_dataset": null,
"entity_types": null,
"versions": null,
"feed_references": null
},
... |
Adds
license_tags(array of taxonomy tag IDs fromlicense_license_tags) to the/v1/searchresponse and introduces alicense_tagsfilter parameter for querying feeds by their license tags.Changes
Materialized view (
feed_search.sql): Added LEFT JOIN onlicense_license_tagsto aggregate tag IDs per license; addedlicense_tagscolumn and a GIN index for efficient array overlap queries.OpenAPI spec (
DatabaseCatalogAPI.yaml): Addedlicense_tagsas query parameter onGET /v1/searchthe licenselicense_tagsas part of source_info was added as part of feat: expose license_tags to feed and license endpoints #1619.Search implementation (
search_api_impl.py): Addedlicense_tagparameter plumbed throughsearch_feeds→create_search_query/create_count_search_query→add_search_query_filters, filtering via PostgreSQL @> operator.Model mapping (
search_feed_item_result_impl.py): All threefrom_orm_*methods now populatelicense_tags, defaulting to[]whenNULL.Example
Returns only feeds whose license has at least one of the specified tags. Each result includes:
{ "id": "mdb-70", "source_info": { "producer_url": "https://transport.data.gouv.fr", "authentication_type": 0, "authentication_info_url": null, "api_key_parameter_name": null, "license_url": "https://www.data.gouv.fr/pages/legal/licences/etalab-2.0", "license_id": "etalab-2.0", "license_is_spdx": true, "license_notes": null, "license_tags": [ "domain:content", "domain:data", "license:government-open-license", "notes:attribution-required", "notes:government-open-license" ] ... }Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.