Skip to content

Add affiliation-country filter for DOI queries via ROR-to-country mapping#1483

Merged
ashwinisukale merged 14 commits intomasterfrom
copilot/fix-411326-91705241-babb87d3-4aee-4ed5-8698-7edaab001ff6
Apr 8, 2026
Merged

Add affiliation-country filter for DOI queries via ROR-to-country mapping#1483
ashwinisukale merged 14 commits intomasterfrom
copilot/fix-411326-91705241-babb87d3-4aee-4ed5-8698-7edaab001ff6

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 18, 2026

Enables filtering DOIs by the country of affiliated organisations in creators/contributors metadata. Since country is not stored in DOI records directly, it must be resolved at index time via a ROR ID → country lookup table.

Mapping data

  • Added app/resources/ror_to_countries.json (placeholder; populated via S3 workflow)
  • Extended update-ror-mappings.yml to pull ror_funder_mapping/ror_to_countries.json from S3 monthly, diff semantically with jq, and open a PR if changed — same pattern as funder_to_ror.json / ror_hierarchy.json
  • Loaded as ROR_TO_COUNTRIES constant at boot in load_ror_data.rb

Indexing

  • New affiliation_countries keyword field in ES mapping
  • Doi#affiliation_countries walks creators + contributors, picks affiliations where affiliationIdentifierScheme == "ROR", resolves each via get_countries_from_ror, deduplicates
  • Added get_countries_from_ror(ror_id) to Rorable concern — normalises ROR ID format, looks up ROR_TO_COUNTRIES, returns uppercase ISO 3166-1 alpha-2 codes
  • Field included in as_indexed_json

Query filter

New affiliation-country query param: comma-separated, case-insensitive, normalised to uppercase
Generates an ES terms filter on affiliation_countries
Passed through to pagination next link

GET /dois?affiliation-country=US,GB
GET /dois?affiliation-country=de   # normalised → DE

OpenAPI

  • affiliation-country parameter documented alongside affiliation-id

Copilot AI changed the title [WIP] Add affiliation-country filter to /dois backed by ROR country mappings Add affiliation-country filter for DOI queries via ROR-to-country mapping Feb 18, 2026
Copilot AI requested a review from ashwinisukale February 18, 2026 07:09
@ashwinisukale ashwinisukale force-pushed the copilot/fix-411326-91705241-babb87d3-4aee-4ed5-8698-7edaab001ff6 branch from 535d824 to 55fcf0b Compare February 19, 2026 08:41
ashwinisukale and others added 3 commits February 19, 2026 14:21
…exing

Co-authored-by: ashwinisukale <1137325+ashwinisukale@users.noreply.github.com>
Co-authored-by: ashwinisukale <1137325+ashwinisukale@users.noreply.github.com>
@ashwinisukale ashwinisukale force-pushed the copilot/fix-411326-91705241-babb87d3-4aee-4ed5-8698-7edaab001ff6 branch from 55fcf0b to 6008c3f Compare February 19, 2026 08:51
@ashwinisukale ashwinisukale requested a review from a team February 19, 2026 09:32
…1326-91705241-babb87d3-4aee-4ed5-8698-7edaab001ff6
- For Rorable specs: expected countries are computed from
ROR_TO_COUNTRIES[ror_url] (and then upcased/uniq), instead of hardcoding
"US".
- For the DOI affiliation_countries specs: expected countries are
computed from the mapping for the RORs used, and deduplication is tested
by asserting the result equals result.uniq (instead of counting "US").
@ashwinisukale ashwinisukale marked this pull request as ready for review February 27, 2026 09:09
…91705241-babb87d3-4aee-4ed5-8698-7edaab001ff6
Comment thread spec/models/doi_spec.rb
…ON file

Agent-Logs-Url: https://github.com/datacite/lupo/sessions/44b8398a-25a1-47b0-be7c-39bccda1d1b8

Co-authored-by: ashwinisukale <1137325+ashwinisukale@users.noreply.github.com>
@ashwinisukale ashwinisukale merged commit 7d87c39 into master Apr 8, 2026
20 checks passed
@ashwinisukale ashwinisukale deleted the copilot/fix-411326-91705241-babb87d3-4aee-4ed5-8698-7edaab001ff6 branch April 8, 2026 05:36
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.

5 participants