[Countries] Synonyms or possible names for a lot of countries#117
[Countries] Synonyms or possible names for a lot of countries#117buster95 wants to merge 13 commits intodisease-sh:masterfrom
Conversation
|
alot has been changed. have you tested it? |
|
sure, was tested. I wanna know if can I integrate |
|
@ebwinters you can check this, I modified your code on endpoint |
|
@buster95 why did you remove the standardize countryName code? What is this PR even doing it seems like it's gonna screw a lot of things up |
|
@ebwinters 🙄 standardize countryName was moved, check results in my endpoint version and then check results in your endpoint version, after that tell me what version throws better result, PLEASE CHECK |
|
@buster95 I'm tryna fix something for my CLI rn but I'll pull your branch and run locally to test then I'll approve or reject 👍 |
|
I reviewed it and there's a lot of differences for the worse. For example, /countries/korea,%20south should return country: "S. Korea"
countryInfo :
iso2: "NO DATA"
iso3: "NO DATA"
_id: "NO DATA"
lat: 0
long: 0
flag: "https://raw.githubusercontent.com/NovelCOVID/API/master/assets/flags/unknow.png"
cases: 9037
todayCases: 76
deaths: 120
todayDeaths: 9
recovered: 3507
active: 5410
critical: 59
casesPerOneMillion: 176but instead returns message: "Country not found or dosen't have cases"I'm not sure why this PR is necessary stll, if it's something specific for an application you're building just do it on your end. When I ran it locally a lot of things that worked stopped working |
|
I don't think so, you can add possibleNames on South Korea in country_utils.js |
|
update the pr wih your latest code. |
…rs not understand ex. s. Korea from webpage in redis South Korea
|
@EliteDaMyth finished, you can check this |
ebwinters
left a comment
There was a problem hiding this comment.
Need to fix all comments before merge
| // @ebwinters version | ||
| // const standardizedCountryName = countryMap.standardizeCountryName(req.params.country.toLowerCase()); | ||
| // let country = countries.find(e => { | ||
| // // see if strict was even a parameter | ||
| // if (req.query.strict) { | ||
| // return req.query.strict.toLowerCase() == 'true' ? e.country.toLowerCase() === standardizedCountryName : e.country.toLowerCase().includes(standardizedCountryName) | ||
| // } | ||
| // else { | ||
| // return e.country.toLowerCase().includes(standardizedCountryName); | ||
| // } | ||
| // }); |
There was a problem hiding this comment.
Need to uncomment this for the endpoint to work correctly
| // @buster95 version | ||
| const countryData = country_utils.getCountryData(req.params.country); | ||
| let country = countries.find(e => { | ||
| // see if strict was even a parameter | ||
| if (req.query.strict) { | ||
| return req.query.strict.toLowerCase() == 'true' ? e.country.toLowerCase() === standardizedCountryName : e.country.toLowerCase().includes(standardizedCountryName) | ||
| } | ||
| else { | ||
| return e.country.toLowerCase().includes(standardizedCountryName); | ||
| return req.query.strict.toLowerCase() == 'true' ? | ||
| e.country.toLowerCase() === countryData.country.toLowerCase() : | ||
| e.country.toLowerCase().includes(countryData.country) | ||
| } else { | ||
| if (countryData.country) { | ||
| return e.country.toLowerCase().includes(countryData.country.toLowerCase()); | ||
| } | ||
| } | ||
| }); |
There was a problem hiding this comment.
@ebwinters I can't delete this remember, country names has changed in redis storage, names are differents than world meter country names, therefore your code dosen't work
There was a problem hiding this comment.
I tested locally and it worked fine, have you tested with these changes?
There was a problem hiding this comment.
Your code work but not for all countries
| { country: 'Bhutan', iso2: 'BT', iso3: 'BTN', _id: 64, lat: 27.5, long: 90.5 }, | ||
| { country: 'Bolivia, Plurinational State of', iso2: 'BO', iso3: 'BOL', _id: 68, lat: -17, long: -65 }, | ||
| { country: 'Bolivia', iso2: 'BO', iso3: 'BOL', _id: 68, lat: -17, long: -65 }, | ||
| { country: 'Bosnia and Herzegovina', iso2: 'BA', iso3: 'BIH', _id: 70, lat: 44, long: 18 }, |
There was a problem hiding this comment.
Change country name to Bosnia
| { country: 'Croatia', iso2: 'HR', iso3: 'HRV', _id: 191, lat: 45.1667, long: 15.5 }, | ||
| { country: 'Cuba', iso2: 'CU', iso3: 'CUB', _id: 192, lat: 21.5, long: -80 }, | ||
| { country: 'Cyprus', iso2: 'CY', iso3: 'CYP', _id: 196, lat: 35, long: 33 }, | ||
| { country: 'Czech Republic', iso2: 'CZ', iso3: 'CZE', _id: 203, lat: 49.75, long: 15.5, possibleNames: ['Czechia', 'Chequia'] }, |
There was a problem hiding this comment.
Change country name to Czechia
| { country: 'Kenya', iso2: 'KE', iso3: 'KEN', _id: 404, lat: 1, long: 38 }, | ||
| { country: 'Kiribati', iso2: 'KI', iso3: 'KIR', _id: 296, lat: 1.4167, long: 173 }, | ||
| { country: 'North Korea', iso2: 'KP', iso3: 'PRK', _id: 408, lat: 40, long: 127, possibleNames: ['Korea del Norte', 'N. Korea', 'Korea, North', 'Democratic People\'s Republic of Korea'] }, | ||
| { country: 'South Korea', iso2: 'KR', iso3: 'KOR', _id: 410, lat: 37, long: 127.5, possibleNames: ['Korea del Sur', 'S. Korea', 'Korea, South', 'Republic of Korea'] }, |
There was a problem hiding this comment.
change country name to S. Korea
| { country: 'Tuvalu', iso2: 'TV', iso3: 'TUV', _id: 798, lat: -8, long: 178 }, | ||
| { country: 'Uganda', iso2: 'UG', iso3: 'UGA', _id: 800, lat: 1, long: 32 }, | ||
| { country: 'Ukraine', iso2: 'UA', iso3: 'UKR', _id: 804, lat: 49, long: 32 }, | ||
| { country: 'United Arab Emirates', iso2: 'AE', iso3: 'ARE', _id: 784, lat: 24, long: 54, possibleNames: ['uae'] }, |
There was a problem hiding this comment.
Change country name to UAE
| { country: 'Uganda', iso2: 'UG', iso3: 'UGA', _id: 800, lat: 1, long: 32 }, | ||
| { country: 'Ukraine', iso2: 'UA', iso3: 'UKR', _id: 804, lat: 49, long: 32 }, | ||
| { country: 'United Arab Emirates', iso2: 'AE', iso3: 'ARE', _id: 784, lat: 24, long: 54, possibleNames: ['uae'] }, | ||
| { country: 'United Kingdom', iso2: 'GB', iso3: 'GBR', _id: 826, lat: 54, long: -2, possibleNames: ['UK'] }, |
There was a problem hiding this comment.
change country name to UK
| { country: 'Ukraine', iso2: 'UA', iso3: 'UKR', _id: 804, lat: 49, long: 32 }, | ||
| { country: 'United Arab Emirates', iso2: 'AE', iso3: 'ARE', _id: 784, lat: 24, long: 54, possibleNames: ['uae'] }, | ||
| { country: 'United Kingdom', iso2: 'GB', iso3: 'GBR', _id: 826, lat: 54, long: -2, possibleNames: ['UK'] }, | ||
| { country: 'United States', iso2: 'US', iso3: 'USA', _id: 840, lat: 38, long: -97, possibleNames: ['USA', 'Estados Unidos'] }, |
There was a problem hiding this comment.
Change country name to USA
|
the PR is conflicting. |
|
@EliteDaMyth I was talking with @ebwinters in Discord, he will review my PR |



Adding synonyms for a lot of countries, homologate
https://www.worldometers.info/coronavirus/ Country Catalog with this API
This PR has:
Korea del Sur->South Korea,Italia->ItalyThis PR
resolve #121
resolve #127
resolve #128
resolve #150