Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2754512
Add a snapshot of https://raw.githubusercontent.com/osmlab/name-sugge…
CloCkWeRX Dec 31, 2023
1f028eb
Add a generator
CloCkWeRX Dec 31, 2023
e4d3bb6
Comment out debugging for the moment
CloCkWeRX Dec 31, 2023
19380cc
Add initially generated stores from OSM NSI
CloCkWeRX Dec 31, 2023
c9893a0
Unify naming
CloCkWeRX Dec 31, 2023
d0d0ee2
Append generated
CloCkWeRX Dec 31, 2023
b4eae74
Deal with english speakers vs country
CloCkWeRX Dec 31, 2023
793992e
Fix script
CloCkWeRX Dec 31, 2023
6863091
Append generated stores
CloCkWeRX Dec 31, 2023
9cf7066
Only render country if available
CloCkWeRX Dec 31, 2023
af49be9
Only render wikidata if available
CloCkWeRX Dec 31, 2023
94f0f09
English in the UK
CloCkWeRX Dec 31, 2023
c157240
Regenerated list
CloCkWeRX Dec 31, 2023
de13ba8
Merge lists
CloCkWeRX Dec 31, 2023
2db44a8
Merge lists
CloCkWeRX Dec 31, 2023
030f451
Merge branch 'main' into feature/7632-stores-taxinomy
CloCkWeRX Jan 2, 2024
e54359a
Merge branch 'main' into feature/7632-stores-taxinomy
CloCkWeRX Feb 14, 2024
382bd70
Merge branch 'main' into feature/7632-stores-taxinomy
CloCkWeRX Feb 25, 2024
a945a09
Merge branch 'main' into feature/7632-stores-taxinomy
teolemon Feb 13, 2025
cb5fa75
Merge branch 'main' into feature/7632-stores-taxinomy
CloCkWeRX Feb 13, 2025
9fcb62a
Merge branch 'main' into feature/7632-stores-taxinomy
CloCkWeRX Dec 14, 2025
cada148
Merge branch 'main' into feature/7632-stores-taxinomy
teolemon May 7, 2026
e3decb0
chore: Update NSI supermarkets to commit a86dd15d303126f8cfc7831aa395…
hangy Aug 22, 2026
836c86f
typo
hangy Aug 22, 2026
164d837
fix: enhance country code validation and language code handling in su…
hangy Aug 22, 2026
ebe5279
fix regexes and rerun script
hangy Aug 22, 2026
ea3c536
chore(taxonomies): resolve merge conflict in stores.txt keeping NSI r…
Aug 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ MongoDB:
Stores:
- changed-files:
- any-glob-to-any-file: "taxonomies/unused/stores.txt"
- any-glob-to-any-file: "taxonomies/external/name-suggestion-index/shop/*"
- any-glob-to-any-file: "scripts/tag_stores_magasins_u.pl"

# Mobile App
Expand Down
298 changes: 298 additions & 0 deletions taxonomies/external/name-suggestion-index/shop/supermarket.js

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm a big fan of the idea of leveraging NSI 👍
fyi I'm regularly contributing to the project, see openfoodfacts/open-prices#467 (comment)

@raphodn raphodn Dec 14, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe store a nsi_id: carrefour-c622af to know that it comes from NSI ?

  • to easily find it back
  • and differentiate in the taxonomy shops coming from NSI from shops coming from OFF contributors ?
  • thus knowing which shops could be added back to NSI

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.

Happy to split these out into an stores-nsi.txt or something of that nature to more clearly split it; I feel like at the time I did this manually.

Script likely needs to be re-run since it's been ~2 years.

@raphodn raphodn Dec 15, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can have a look later this week and try to re-run the script myself.
if we switch to xx: then the country mapping could be removed ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if we switch to xx: then the country mapping could be removed ?

I think country mapping could still be useful, esp. for cases where store-brands may have identical or near-identical names in different regions (see e.g. the 50 or so “COOP”s). (Mappings like country:en: en:United States of America,en:United States of America,en:United States of America,en:United States of America,en:United States of America are probably a bit excessive though…). Maybe this is too much “preemptive optimisation(/complication)” though, and could be easily solved with a human-added comment:en: key or similar where it’s actually needed.

Definitely +1 to using xx: similar to our brands.txt taxonomy though, with possible locale specific overrides for locales with scripts other than the first/primary xx: alias where relevant.

Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
// A nodejs script to parse NameSuggestionIndex formatted JSON data and attempt to output valid taxonomy data.
// Do not use results without careful review
const data = require('./supermarket.json');

// A quick ISO 3601 to human labels (english) mapping.
// TODO: Ensure this matches exactly with countries.txt
// TODO: Replace with a better lookup

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could this utilise the countries taxonomy?

var iso3601 = {
"ad": "Andorra",
"ae": "United Arab Emirates",
"af": "Afghanistan",
"ag": "Antigua & Barbuda",
"ai": "Anguilla",
"al": "Albania",
"am": "Armenia",
"an": "Netherlands Antilles",
"ao": "Angola",
"aq": "Antarctica",
"ar": "Argentina",
"as": "American Samoa",
"at": "Austria",
"au": "Australia",
"aw": "Aruba",
"az": "Azerbaijan",
"ba": "Bosnia & Herzegovina",
"bb": "Barbados",
"bd": "Bangladesh",
"be": "Belgium",
"bf": "Burkina Faso",
"bg": "Bulgaria",
"bh": "Bahrain",
"bi": "Burundi",
"bj": "Benin",
"bm": "Bermuda",
"bn": "Brunei Darussalam",
"bo": "Bolivia",
"br": "Brazil",
"bs": "Bahamas",
"bt": "Bhutan",
"bv": "Bouvet Island",
"bw": "Botswana",
"by": "Belarus",
"bz": "Belize",
"ca": "Canada",
"cc": "Cocos (Keeling) Islands",
"cd": "Zaire",
"cf": "Central African Republic",
"cg": "Congo",
"ch": "Switzerland",
"ci": "Cote D'ivoire (Ivory Coast)",
"ck": "Cook Islands",
"cl": "Chile",
"cm": "Cameroon",
"cn": "China",
"co": "Colombia",
"cr": "Costa Rica",
"cu": "Cuba",
"cv": "Cape Verde",
"cx": "Christmas Island",
"cy": "Cyprus",
"cz": "Czech Republic",
"de": "Germany",
"dj": "Djibouti",
"dk": "Denmark",
"dm": "Dominica",
"do": "Dominican Republic",
"dz": "Algeria",
"ec": "Ecuador",
"ee": "Estonia",
"eg": "Egypt",
"eh": "Western Sahara",
"er": "Eritrea",
"es": "Spain",
"et": "Ethiopia",
"fi": "Finland",
"fj": "Fiji",
"fk": "Falkland Islands (Malvinas)",
"fm": "Micronesia",
"fo": "Faroe Islands",
"fr": "France",
"ga": "Gabon",
"gb": "United Kingdom",
"gd": "Grenada",
"ge": "Georgia",
"gf": "French Guiana",
"gh": "Ghana",
"gi": "Gibraltar",
"gl": "Greenland",
"gm": "Gambia",
"gn": "Guinea",
"gp": "Guadeloupe",
"gq": "Equatorial Guinea",
"gr": "Greece",
"gs": "S.Georgia & S.Sandwich Islands",
"gt": "Guatemala",
"gu": "Guam",
"gw": "Guinea-Bissau",
"gy": "Guyana",
"hk": "Hong Kong",
"hm": "Heard & McDonald Islands",
"hn": "Honduras",
"hr": "Croatia (Hrvatska)",
"ht": "Haiti",
"hu": "Hungary",
"id": "Indonesia",
"ie": "Ireland",
"il": "Israel",
"in": "India",
"io": "British Indian Ocean Territory",
"iq": "Iraq",
"ir": "Iran",
"is": "Iceland",
"it": "Italy",
"jm": "Jamaica",
"jo": "Jordan",
"jp": "Japan",
"ke": "Kenya",
"kg": "Kyrgyzstan",
"kh": "Cambodia",
"ki": "Kiribati",
"km": "Comoros",
"kn": "Saint Kitts & Nevis",
"kp": "Korea (North)",
"kr": "Korea (South)",
"kw": "Kuwait",
"ky": "Cayman Islands",
"kz": "Kazakhstan",
"la": "Laos",
"lb": "Lebanon",
"lc": "Saint Lucia",
"li": "Liechtenstein",
"lk": "Sri Lanka",
"lr": "Liberia",
"ls": "Lesotho",
"lt": "Lithuania",
"lu": "Luxembourg",
"lv": "Latvia",
"ly": "Libya",
"ma": "Morocco",
"mc": "Monaco",
"md": "Moldova",
"mg": "Madagascar",
"mh": "Marshall Islands",
"mk": "Macedonia",
"ml": "Mali",
"mm": "Myanmar",
"mn": "Mongolia",
"mo": "Macau",
"mp": "Northern Mariana Islands",
"mq": "Martinique",
"mr": "Mauritania",
"ms": "Montserrat",
"mt": "Malta",
"mu": "Mauritius",
"mv": "Maldives",
"mw": "Malawi",
"mx": "Mexico",
"my": "Malaysia",
"mz": "Mozambique",
"na": "Namibia",
"nc": "New Caledonia",
"ne": "Niger",
"nf": "Norfolk Island",
"ng": "Nigeria",
"ni": "Nicaragua",
"nl": "Netherlands",
"no": "Norway",
"np": "Nepal",
"nr": "Nauru",
"nu": "Niue",
"nz": "New Zealand",
"om": "Oman",
"pa": "Panama",
"pe": "Peru",
"pf": "French Polynesia",
"pg": "Papua New Guinea",
"ph": "Philippines",
"pk": "Pakistan",
"pl": "Poland",
"pm": "St. Pierre & Miquelon",
"pn": "Pitcairn",
"pr": "Puerto Rico",
"pt": "Portugal",
"pw": "Palau",
"py": "Paraguay",
"qa": "Qatar",
"re": "Reunion",
"ro": "Romania",
"ru": "Russian Federation",
"rw": "Rwanda",
"sa": "Saudi Arabia",
"sb": "Solomon Islands",
"sc": "Seychelles",
"sd": "Sudan",
"se": "Sweden",
"sg": "Singapore",
"sh": "St. Helena",
"si": "Slovenia",
"sj": "Svalbard & Jan Mayen Islands",
"sk": "Slovak Republic",
"sl": "Sierra Leone",
"sm": "San Marino",
"sn": "Senegal",
"so": "Somalia",
"sr": "Suriname",
"st": "Sao Tome & Principe",
"sv": "El Salvador",
"sy": "Syria",
"sz": "Swaziland",
"tc": "Turks & Caicos Islands",
"td": "Chad",
"tf": "French Southern Territories",
"tg": "Togo",
"th": "Thailand",
"tj": "Tajikistan",
"tk": "Tokelau",
"tm": "Turkmenistan",
"tn": "Tunisia",
"to": "Tonga",
"tp": "East Timor",
"tr": "Turkey",
"tt": "Trinidad & Tobago",
"tv": "Tuvalu",
"tw": "Taiwan",
"tz": "Tanzania",
"ua": "Ukraine",
"ug": "Uganda",
"us": "United States of America",
"uy": "Uruguay",
"uz": "Uzbekistan",
"va": "Vatican City (Holy See)",
"vc": "St. Vincent & the Grenadines",
"ve": "Venezuela",
"vg": "Virgin Islands (British)",
"vi": "Virgin Islands (U.S.)",
"vn": "Viet Nam",
"vu": "Vanuatu",
"wf": "Wallis & Futuna Islands",
"ws": "Samoa",
"ye": "Yemen",
"yt": "Mayotte",
"yu": "Yugoslavia",
"za": "South Africa",
"zm": "Zambia",
"zw": "Zimbabwe",
"fx": "France (Metropolitan)"
}

// Overrides for the language codes/mappings inferred by country code.
// TODO: This list is far, far from accurate or complete and should be replaced with any internal/authoritative mappings

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be possible to use the language property from the countries taxonomy?

var iso3601_to_language_mappings = {
"ca": "en",
"au": "en",
"us": "en",
"gb": "en"
};

data["items"].forEach(function (record) {
var countryCodes = record.locationSet["include"];
var countryNames = [];

const languageMatcher = /^(?<language>[a-z]{2})$/i;
const countryMatcher = /^(?<country>[a-z]{2})(?:-.+)?$/i;
countryCodes.forEach(function (code) {
if (code == "001" || typeof code !== 'string') {
console.debug("Incompatible code type", code, typeof code);
return;
}

const isoMatch = code.match(countryMatcher);
if (!iso3601[isoMatch?.groups?.country]) {
console.debug("Unmapped ISO3601 code", code, isoMatch);
return;
} else {
countryNames.push("en:" + iso3601[isoMatch.groups.country]);
}
});

var primaryCountryCode = countryCodes[0].toString().split("-")[0];
var primaryLanguageCode = primaryCountryCode;
if (iso3601_to_language_mappings[primaryCountryCode]) {
primaryLanguageCode = iso3601_to_language_mappings[primaryCountryCode]
}

if (!languageMatcher.test(primaryLanguageCode)) {
console.debug("Unmapped language code", primaryLanguageCode);
primaryLanguageCode = "xx";
}

process.stdout.write([primaryLanguageCode, record.displayName].join(":") + "\n");
if (record.tags["brand:wikidata"]) {
process.stdout.write(["wikidata:en", record.tags["brand:wikidata"]].join(":") + "\n");
}
if (countryNames.length > 0) {
process.stdout.write(["country:en:", countryNames.join(",")].join(" ") + "\n");
}
process.stdout.write("\n");
});
Loading
Loading