OSSPhilippines / covid19-tracker-cli

A console-oriented COVID-19 tracker with real-time updates for your favorite terminal. 💻🌏😷
https://covid19-cli.wareneutron.com
GNU General Public License v3.0
278 stars 44 forks source link

Finds wrong country #7

Closed ManuLinares closed 4 years ago

ManuLinares commented 4 years ago

curl https://covid19tracker.xyz/ar

expected "Argentina" as of iso3166 but it shows Denmark. Screenshot_2020-03-27_01-16-04

warengonzaga commented 4 years ago

@ManuelBarrioLinares got it thanks for reporting! I'll let you know once it is fixed.

BenAlexanderAU commented 4 years ago

Adding on to this...

curl https://covid19tracker.xyz/au

expected "Australia" but it shows Austria.

warengonzaga commented 4 years ago

@BenAlexanderAU can you try it again, as the API developer its already fixed.

BenAlexanderAU commented 4 years ago

@BenAlexanderAU can you try it again, as the API developer its already fixed.

Still returns details for Austria

warengonzaga commented 4 years ago

Thank you for your report @BenAlexanderAU I'm coordinating with the API developers. Thank you!

cpnfeeny commented 4 years ago

/de shows Sweden; it should show Germany /ge shows Germany; it should show Georgia

warengonzaga commented 4 years ago

@cpnfeeny thank you! I'll fix it...

aesycos commented 4 years ago

I don't believe the API is designed to be used by ISO3166-1 country codes, but instead full country name, the API is actually here corona.lmao.ninja a.k.a NovelCOVID/API and the API Endpoint is defined as:

GET Request: https://corona.lmao.ninja/countries/{country-name} Output: Returns data of a specific country. If an exact name match is desired pass ?strict=true in the query string

Unless, you can get NovelCOVID to add that feature to their API, you could add the feature to covid19-tracker and have country names less than 3 letters to either be translated into their full country name by the respective alpha-2 and alpha-3 code. Since the shortest country names are 4 letters this should be fairly simple, and you could just filter the country data already in country_utils.js or copy the relevant part var countryData[].

warengonzaga commented 4 years ago

@aesycos I contacted the developers at NovelCOVID and they said that the API don't served ISO 3166 code. In short, it returns the most related to your query. I'm working on adding the feature to the CLI. I don't want to wait for them to implement that. That's my mistake... I assume that the API supports ISO 3166.

aesycos commented 4 years ago

@WarenGonzaga I pushed a script to my fork of your project and a json file under lib one is a node file that takes an iso-3661 code and retrieves the countries code. I dotnt really know javascript or nodejs so im sure it could be alot better but it works. so basically node test.js [ISO-366-1 Code] i.e. node test.js AR output "Argentina" maybe you can use these

Also not to create another issue, but the time reported isn't local timezone, so you should look into adjusting the time to someone's current timezone or posting the timezone of the reported cases

warengonzaga commented 4 years ago

@WarenGonzaga I pushed a script to my fork of your project and a json file under lib one is a node file that takes an iso-3661 code and retrieves the countries code. I dotnt really know javascript or nodejs so im sure it could be alot better but it works. so basically node test.js [ISO-366-1 Code] i.e. node test.js AR output "Argentina" maybe you can use these

Also not to create another issue, but the time reported isn't local timezone, so you should look into adjusting the time to someone's current timezone or posting the timezone of the reported cases

Thank you for the effort I will take a look, but currently I have script for that using live API for all countries... I will give some updates later...

ak-42 commented 4 years ago

I see you're already handling it, but curl https://covid19tracker.xyz/hr results in Bahrain, should be Croatia.

warengonzaga commented 4 years ago

@ak-42 thanks for reporting...

warengonzaga commented 4 years ago

@ManuelBarrioLinares @ak-42 @aesycos @BenAlexanderAU @cpnfeeny

The API Devs fixed the issue and now they support the ISO-2 and ISO-3 code... so you may now use it. Upon checking, the AU is now pointing to Australia... please check thanks...

BenAlexanderAU commented 4 years ago

Upon checking, the AU is now pointing to Australia... please check thanks...

Confirm AU is working. Thanks for fixing this.

warengonzaga commented 4 years ago

@BenAlexanderAU thanks to the API devs for working on the fix... thank you for your effort to report the issue. I will close this now.