Skip to content

Standardize preset terms#1758

Merged
tyrasd merged 73 commits intoopenstreetmap:mainfrom
FloEdelmann:standardize-terms
Oct 14, 2025
Merged

Standardize preset terms#1758
tyrasd merged 73 commits intoopenstreetmap:mainfrom
FloEdelmann:standardize-terms

Conversation

@FloEdelmann
Copy link
Copy Markdown
Contributor

@FloEdelmann FloEdelmann commented Oct 14, 2025

Description, Motivation & Context

As mentioned in the guidelines, terms should be lowercase and sorted A-Z. This PR standardizes all presets to follow this format.

As requested in #1753 (comment), I opened one big PR to fix them all (440 presets!), so a check can be introduced to the build scripts that would alert if the order is mixed up.

I split up the changes over at least one commit per directory (for bigger directories: one commit per subdirectory) to make it easy to rebase and fix individual merge conflicts, should this be required.

Related issues

Follow-up to #1753.

Links and data

Relevant OSM Wiki links:
Relevant tag usage stats:

Checklist and Test-Documentation Template

Read on to get your PR merged faster…

Follow these steps to test your PR yourself and make it a lot easier and faster for maintainers to check and approve it.

This is how it works:

  1. After you submit your PR, the system will create a preview and comment on your PR:

    🍱 Your pull request preview is ready.
    If this is your first contribution to this project, the preview will not happen right away but requires a click from one of the project members. We will do this ASAP.

  2. Once the preview is ready, use it to test your changes.

  3. Now copy the snippet below into a new comment and fill out the blanks.

  4. Now your PR is ready to be reviewed.

## Test-Documentation

### Preview links & Sidebar Screenshots

<!-- Use the preview to find examples, select the feature in question and **copy this link here**.
     Find examples of nodes/areas. Find examples with a lot of tags or very few tags. – Whatever helps to test this thoroughly.
     Add relevant **screenshots** of the sidebar of those examples. -->

<!-- FYI: What we will check:
     - Is the [icon](https://github.com/ideditor/schema-builder/blob/main/ICONS.md) well chosen.
     - Are the fields well-structured and have good labels.
     - Do the dropdowns (etc.) work well and show helpful data. -->

### Search

<!-- **Test the search** of your preset and share relevant **screenshots** here.
     - Test the preset name as search terms.
     - Also test the preset terms and aliases as search terms (if present). -->

### Info-`i`

<!-- **Test the info-i** for your fields and preset and share relevant **screenshots** here.
     The info needs to help mappers understand the preset and when to use it.
     [Learn more…](https://github.com/openstreetmap/id-tagging-schema/blob/main/CONTRIBUTING.md#info-i)
 -->

### Wording

- [ ] American English
- [ ] `name`, `aliases` (if present) use Title Case
- [ ] `terms` (if present) use lower case, sorted A-Z
<!-- Learn more in https://github.com/openstreetmap/id-tagging-schema/blob/main/GUIDELINES.md#2-design-the-preset -->

@github-actions
Copy link
Copy Markdown

🍱 Your pull request preview is ready

Please use this preview to check your changes. Ideally use the test documentation template and document your test results by commenting on the PR. This will speed up the review process for everyone.

FYI, once this PR is merged, you can use the iD Editor Preview to test your changes in interaction with all other changes.

"café",
"caffe",
"caffè",
"café",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This might be controversial: this is now sorted on UTF-16 code units order (which can easily be checked programmatically), but the previous sort order definitely makes sense, too.

"doner kebab",
"döner kebab",
"drive-in",
"döner kebab",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

"water closet",
"WC",
"W.C."
"wc"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

"r&d",
"r & d",
"r and d",
"r&d",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

"W.C."
"public toilet",
"w.c.",
"wc"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

"gym",
"pullup",
"pull up",
"pullup",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

"monkey bars",
"pullup",
"pull up",
"pullup",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

"gym",
"pushup",
"push up",
"pushup",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

"muscle up",
"pullup",
"pull up",
"pullup",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

"gym",
"situp",
"sit up",
"situp",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Again.

@tyrasd tyrasd merged commit 6e7e7be into openstreetmap:main Oct 14, 2025
5 checks passed
@FloEdelmann FloEdelmann deleted the standardize-terms branch October 14, 2025 18:20
@FloEdelmann FloEdelmann changed the title Standardize terms Standardize preset terms Oct 14, 2025
@matkoniecz
Copy link
Copy Markdown
Collaborator

@FloEdelmann do you have still code that did this rewrite?

It would be useful for #874 (comment) and #1813

@FloEdelmann
Copy link
Copy Markdown
Contributor Author

FloEdelmann commented Nov 24, 2025

For reference, this was the code to generate these changes:

scripts/sort-terms.js
#!/usr/bin/env zx

// NOTE: uses https://github.com/google/zx and has to be called from id-tagging-schema root directory

const presetJsonFiles = await glob('./data/presets/**/*.json', {
    gitignore: true,
    absolute: true,
})

for (const file of presetJsonFiles) {
    const preset = JSON.parse(fs.readFileSync(file, 'utf-8'))
    const terms = preset.terms

    if (!terms) {
        continue
    }

    const expectedTerms = terms.map(term => term.toLowerCase()).sort()
    if (terms.every((term, index) => expectedTerms[index] === term)) {
        continue
    }

    console.log(file)
    console.log(terms, expectedTerms)

    preset.terms = expectedTerms
    fs.writeFileSync(file, JSON.stringify(preset, null, 4) + '\n', 'utf8')
}

It assumes that Node.js v22+ and https://github.com/google/zx are available.

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