Skip to content

feat: add country-to-continent mapping for issue labels - #1477

Merged
Alessandro100 merged 13 commits into
mainfrom
feat/continent-tagging-issue
Nov 26, 2025
Merged

feat: add country-to-continent mapping for issue labels#1477
Alessandro100 merged 13 commits into
mainfrom
feat/continent-tagging-issue

Conversation

@ianktc

@ianktc ianktc commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Country to Continent mapping found here: https://gist.github.com/stevewithington/20a69c0b6d2ff846ea5d35e5fc47f26c

Addressing MobilityData/mobility-database-catalogs#1005

Google Sheet: https://docs.google.com/spreadsheets/d/1mP4330nAewh5X5Z6XeVei6IJ-YudaEC-asdPAixrol4/edit?gid=1816052211#gid=1816052211

Summary:

Summarize the changes in the pull request including how it relates to any issues (include the #number, or link them).

Expected behavior:

Explain and/or show screenshots for how you expect the pull request to work in your testing (in case other devices exhibit different behavior).

Testing tips:

Provide tips, procedures and sample files on how to test the feature.
Testers are invited to follow the tips AND to try anything they deem relevant outside the bounds of the testing tips.

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@ianktc ianktc changed the title Add country-to-continent mapping for issue labels feat: add country-to-continent mapping for issue labels Nov 21, 2025
@ianktc

ianktc commented Nov 21, 2025

Copy link
Copy Markdown
Contributor Author

Could probably move these to a constant in another file cause its alot of lines.

@github-actions

github-actions Bot commented Nov 24, 2025

Copy link
Copy Markdown

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

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

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

Performance Accessibility Best Practices SEO
🟢 92 🟢 91 🟢 100 🟢 100

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

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

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

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

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

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

@github-actions

Copy link
Copy Markdown

Preview Firebase Hosting URL: https://mobility-feeds-dev--pr-1477-3qk4cuff.web.app

@cka-y

cka-y commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

Could probably move these to a constant in another file cause its alot of lines.

[suggestion] Checkout pycountry_convert.country_alpha2_to_continent_code

@ianktc

ianktc commented Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

Could probably move these to a constant in another file cause its alot of lines.

[suggestion] Checkout pycountry_convert.country_alpha2_to_continent_code

Sorry for so many commits 😅 I found a ts library that seems reputable: https://www.npmjs.com/package/countries-list

@ianktc
ianktc requested a review from Alessandro100 November 26, 2025 15:15
labels.push(continent);
}
} catch (error) {
logger.error("Error mapping ${formData.country} to continent", error);

@Alessandro100 Alessandro100 Nov 26, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.error("Error mapping ${formData.country} to continent", error);
logger.error(`Error mapping ${formData.country} to continent`, error);

need to use ` to display ${formData.country} variable

Comment on lines +327 to +334
try {
if (formData.country && formData.country in countries) {
const country = countries[formData.country as TCountryCode];
const continent = continents[country.continent].toLowerCase();
labels.push(continent);
}
} catch (error) {
logger.error("Error mapping ${formData.country} to continent", error);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for a try catch, you're better off handling the undefined case explicitly

const continent = continents[country.continent].toLowerCase();
if(continent != null) labels.push(continent)

@Alessandro100 Alessandro100 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, nice use of the countries-list library

@Alessandro100
Alessandro100 merged commit ab22d76 into main Nov 26, 2025
4 checks passed
@Alessandro100
Alessandro100 deleted the feat/continent-tagging-issue branch November 26, 2025 18:48
@welcome

welcome Bot commented Nov 26, 2025

Copy link
Copy Markdown

🥳 Congrats on getting your first pull request merged!

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.

3 participants