Skip to content

feat: expose license tags in search endpoint results and filters#1620

Open
Copilot wants to merge 9 commits intomainfrom
copilot/expose-license-tag-search-endpoint
Open

feat: expose license tags in search endpoint results and filters#1620
Copilot wants to merge 9 commits intomainfrom
copilot/expose-license-tag-search-endpoint

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

Adds license_tags (array of taxonomy tag IDs from license_license_tags) to the /v1/search response and introduces a license_tags filter parameter for querying feeds by their license tags.

Changes

  • Materialized view (feed_search.sql): Added LEFT JOIN on license_license_tags to aggregate tag IDs per license; added license_tags column and a GIN index for efficient array overlap queries.

  • OpenAPI spec (DatabaseCatalogAPI.yaml): Added license_tags as query parameter on GET /v1/search the license license_tags as 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): Added license_tag parameter plumbed through search_feedscreate_search_query / create_count_search_queryadd_search_query_filters, filtering via PostgreSQL @> operator.

  • Model mapping (search_feed_item_result_impl.py): All three from_orm_* methods now populate license_tags, defaulting to [] when NULL.

Example

GET /v1/search?license_tags=family:ODC,license:open-data-commons

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

This section details on the original issue you should resolve

<issue_title>Expose license tag to the search endpoint and filters</issue_title>
<issue_description>### Describe the problem

In this PR, the license tags will be exposed in the feeds search endpoint v1/search.

Proposed solution

  • The license tag are returned in the search endpoint as a list; example:
    license_tags: [
    "family:ODC",
    "license:open-data-commons"
    ]
  • Add license tag filter to the search endpoint

Alternatives you've considered

No response

Additional context

No response</issue_description>

<agent_instructions>In this issue, we need to change the OpenAPI schema and the classes associated with the transformation of the search endpoint. To support this new field, we need to change the materialized view. Add or update the necessary tests.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 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.

Copilot AI and others added 2 commits March 11, 2026 18:13
Co-authored-by: davidgamez <1192523+davidgamez@users.noreply.github.com>
Co-authored-by: davidgamez <1192523+davidgamez@users.noreply.github.com>
Copilot AI changed the title [WIP] Expose license tag to the search endpoint and filters Expose license tags in search endpoint results and filters Mar 11, 2026
@davidgamez davidgamez changed the title Expose license tags in search endpoint results and filters feat: expose license tags in search endpoint results and filters Mar 11, 2026
@davidgamez davidgamez marked this pull request as ready for review March 11, 2026 19:15
@github-actions
Copy link

github-actions bot commented Mar 11, 2026

*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/ * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 82 🟢 100 🟢 100 🟢 100

*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/feeds * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 87 🟢 91 🟢 100 🟢 100

*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/feeds/gtfs/mdb-2126 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 71 🔴 0 🟢 93 🟢 100

*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 86 🟠 87 🟢 100 🟢 100

*Lighthouse ran on https://mobility-feeds-dev--pr-1620-1gfa98il.web.app/gbfs/gbfs-flamingo_porirua * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 99 🟢 100 🟢 96 🟢 100

@github-actions
Copy link

Preview Firebase Hosting URL: https://mobility-feeds-dev--pr-1620-1gfa98il.web.app

@davidgamez
Copy link
Member

Example DEV request:

curl --request GET \
  --url 'https://api-dev.mobilitydatabase.org/v1/search?limit=1000&offset=0&status=' \
  --header 'Authorization: Bearer  <TOKEN HERE>'

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
    },
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose license tag to the search endpoint and filters

2 participants