ExpDev07 / coronavirus-tracker-api

🦠 A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the 🔥 FastAPI framework. Supports multiple sources!
https://coronavirus-tracker-api.herokuapp.com
GNU General Public License v3.0
1.59k stars 320 forks source link

Adding continent codes? #73

Closed Bost closed 4 years ago

Bost commented 4 years ago

If there's a need I could implement 3-letter continent codes:

"coordinates" : "{…}"
"country" : "Thailand"
"country_code" : "TH" 
"continent" : "ASI"      <---- new

The main complications are:

What do you think about that?

I'm trying to work out all the problems at first in clojure in my own project, on the branch continents.

ExpDev07 commented 4 years ago

That would be useful yes. I guess with the multiple continents, we just have to bite the bullet and assign the continent that makes the most sense (??). Another idea would be to return a comma-separated string of continents, eg: “EUR, ASI”. Performance shouldn’t be that big of an issue, it’s just a simple lookup in a dict.

Bost commented 4 years ago

I've got something for you. It's all countries, not just those hit by the virus. So basically you can download the json files, commit them in your repo as static content... and somebody can start programming against this API from this commit on. And I'll just send you updates when something gets fixed, updated etc.

These are just my preliminary thoughts, I need some hammock time. Anyway I've been thinking about providing a redundant web service serving the same content as you do. That's also one of the reasons why I made web services, instead of just reaching you overs the json files. I'm increasingly of the opinion your service is a crucial element in this whole Corona Dashboard Industry and some redundancy won't hurt anybody.

Redundant implementation - in a different language and a redundant server, too. Yea ok, I see we're both at heroku - maybe we could use another service provider. To avoid having a single point of failure.

But as I said, I need some hammock time...

https://corona-cases-bot.herokuapp.com/ws/dev/codes https://corona-cases-bot.herokuapp.com/ws/dev/names

Edit: and also with two services you can compare their results against each other when doing some tricky refactoring etc.

ExpDev07 commented 4 years ago

I've got something for you. It's all countries, not just those hit by the virus. So basically you can download the json files, commit them in your repo as static content... and somebody can start programming against this API from this commit on. And I'll just send you updates when something gets fixed, updated etc.

Seems like an OK solution to me 👍 .

and some redundancy won't hurt anybody.

You are indeed correct.

in a different language and a redundant server, too. Yea ok, I see we're both at heroku - maybe we could use another service provider. To avoid having a single point of failure.

Probably. Heroku was the best and easiest free option I could find (not making any $$$ from this project).

Bost commented 4 years ago

Ups I have a bug there. Worldwide and ZZ need to be removed. It is a union of countries. I will fix it.

Bost commented 4 years ago

And I just found out we're rather screwed. In contrary to what I believed, my source - the List_of_sovereign_states_and_dependent_territories_bycontinent(data_file) really assigns following countries to multiple continents:

Oceania and North America:
United States Minor Outlying Islands

Europe and Asia:
Russian Federation
Armenia
Georgia
Cyprus
Turkey
Kazakhstan
Azerbaijan

That's a show stopper for the moment, bloody hell :-(

Bost commented 4 years ago

After some hammocking, I'm increasingly of the following opinion: If a country can belong to multiple continents then there's no other way around than instead of a new field continent containing a value of a primitive type, there must continents type-of list:

"coordinates" : "{…}"
"country" : "Thailand"
"country_code" : "TH" 
"continents" : ["ASI" "EUR"]     <---- new

Many people will wonder if it's a mistake and may others will make the same mistake (i.e. assuming the one-to-one correspondence). So maybe we should call this field continent-list to make it clear it's not a mistake. And even better, going one step further - writing in the service description something like "Be aware that continent(s) is a list - see <url>".

What do you think?

ExpDev07 commented 4 years ago

Seems like a good solution! Smart idea to call it continents_list

Bost commented 4 years ago

Continues in https://github.com/ExpDev07/coronavirus-tracker-api/pull/180