Comments (5)
I haven't thought about this very much, but seeing as the reports won't be consistent between organisations, maybe we could simplify it to just /itapc
or jh
instead of categorising them further with national-reports
or world-reports
?
Then if you query the root of the api we could return a list of all the reports available.
So something like
GET /api/v1/ ->
[
{
"source": "Protezione Civile",
"reports_url": "/api/v1/itapc/"
},
{
"source": "John Hopkins CSSE",
"reports_url": "/api/v1/jh/"
}
]
GET /api/v1/jh/ -> what's now /daily-reports
GET /api/v1/itapc/ -> all the data from the Protezione Civile dataset
I think it makes sense to model each source independently and reuse column names from the original dataset, rather than trying to map each report to a common vocabulary, because the exact meaning of each metric will depend on how its collected/recorded.
from covid-api.
I think separate endpoints for each data source is a great way to go. It will make the payload size smaller for your consumer since they can be more granular in their fetch.
from covid-api.
Perhaps adding an abstraction layer will make it easier to add in new datasources.
def john_hopkins_data():
return fetched_data()
source_map = {
"john_hopkins": john_hopkins_data,
"another_source": another_source
}
def get_data(source_map, source_name):
getter = source_map[source_name]
return getter()
Doing something like this would make it easy to add new sources without updating your api. Serious downside though is this requires magic strings.
from covid-api.
Perhaps adding an abstraction layer will make it easier to add in new datasources.
def john_hopkins_data(): return fetched_data() source_map = { "john_hopkins": john_hopkins_data, "another_source": another_source } def get_data(source_map, source_name): getter = source_map[source_name] return getter()
Doing something like this would make it easy to add new sources without updating your api. Serious downside though is this requires magic strings.
Oh I see! So the end user would only call GET /api/v1/daily-report
and the response would contain something like:
{
"john_hopkins": {
.... (data from JH)
},
"protezione_civile": {
.... (data from Italian PC)
}
}
and it would be up to the user to pick the one they want, right?
We could even include the possibility to limit the returned source/sources or to exclude one we don't want.
Do we agree that each data source should have their own models? Cheers
from covid-api.
I'm closing this since we agreed on a solution.
from covid-api.
Related Issues (20)
- Some related projects HOT 4
- Patterns of Enterprise Application Architecture HOT 3
- Empty json HOT 8
- Covid-API MVP HOT 15
- Make the root URL do something useful HOT 2
- Implement a proper import script for the data
- Create a production app on Heroku HOT 9
- Cannot run tests with pytest anymore
- Ignore site-packages when running pytest HOT 1
- Deploy to Heroku when tests pass in CircleCI
- Add --all and --latest to import script
- Refactor the code to support additional sources of data
- Add query string support for /v1/jh/daily-reports endpoint
- Add standardised country code HOT 2
- Add Italian Protezione Civile data source
- Directory structure HOT 4
- Add report date to JH import
- Global testing dataset from OWID
- Is the date of the file needed? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from covid-api.