-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iss1019feat #1030
Iss1019feat #1030
Conversation
…e api_gov.spec.js and getGovData.js files
…e api_gov.spec.js and getGovData.js files
…etGovData.js since the variant scraper doesn't belong in there
…er with the endpoint v3/covid-19/variants/countries/{country}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks pretty good, similar to the rest of the code base. Left a few comments, when you are ready to publish (and have docs+tests) I will review again. Thanks for the work here, I'm sure it will be picked up and used by people around the world!
routes/v3/covid-19/apiVariants.js
Outdated
|
||
router.get('/v3/covid-19/variants/countries/:country?', async (req, res) => { | ||
const { allowNull } = req.query; | ||
const { country: countryName, yearWeek, variant } = req.params; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the yearWeek and variant parameters being used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put them there since I wanted the API had to have these parameters, but I think it's better to remove them and later when they're created added again.
routes/v3/covid-19/apiVariants.js
Outdated
// *to here* | ||
|
||
// Take this code below as an example: | ||
// router.get('/v3/covid-19/countries/:query', async (req, res) => { | ||
// const { yesterday, twoDaysAgo, strict, allowNull } = req.query; | ||
// const { query } = req.params; | ||
// let countries = JSON.parse(await redis.get(wordToBoolean(yesterday) ? keys.yesterday_countries : wordToBoolean(twoDaysAgo) ? keys.twoDaysAgo_countries : keys.countries)) | ||
// .filter(country => country.country.toLowerCase() !== 'world').map(fixApostrophe); | ||
// countries = splitQuery(query) | ||
// .map(country => nameUtils.getWorldometersData(countries, country, strict !== 'false')) | ||
// .filter(value => value).map(country => !wordToBoolean(allowNull) ? nameUtils.transformNull(country) : country); | ||
// if (countries.length > 0) res.send(countries.length === 1 ? countries[0] : countries); | ||
// else res.status(404).send({ message: 'Country not found or doesn\'t have any cases' }); | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove once ready to publish draft
scrapers/covid-19/getVariants.js
Outdated
const csvUtils = require("../../utils/csvUtils"); | ||
|
||
const PATH = | ||
"https://opendata.ecdc.europa.eu/covid19/virusvariant/csv/data.csv"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scrapers/covid-19/getVariants.js
Outdated
return obj; | ||
}, {}); | ||
|
||
console.log(dataByCountry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove when publishing draft, or alternatively put a log statement with the length of the result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I'll remove this "console.log()"
Thanks for checking this.
tests/v3/covid-19/api_gov.spec.js
Outdated
@@ -71,6 +71,34 @@ describe.skip('TESTING /v3/covid-19/gov/canada', () => { | |||
}); | |||
}); | |||
|
|||
// here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put into own testing file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, this new variants endpoint needs its own test file, I'm working on that.
…n apiVariants.js file since they're never use
…og and commented code from the others files.
Hi @ebwinters, Best regards from Mexico City. |
"variantsECDC": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right. See how other endpoints do this where they return an array of type x
and then go on to declare x
as the object structure of the element. Like
"updated": dateTime,
"country": string,
"yearWeek": string...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right, sorry about this.
I'm going to do fix it.
@ebwinters Thank you very much for your effort, time and comments, they're very helpful. |
It's approved. Unit tests will fail for now until #1031 is merged. Once that is in, pull master, and the tests should all pass. Also linting failed, check out why in the workflow run and fix that please |
Hi @ebwinters, Thank you so much for your patience with me :) |
All right then, I'll fix it right now :) |
…ix the linting problem, as there are variables assigned that are never used.
I commented the lines 2-5 to fix the linting problem. At least in my computer that is enough to pass the eslint check. |
now your unit tests are failing |
I'll check these, I truly don't know why this is happening. Thanks for your patience. |
@yosoycentli it's still failing, just checking back in |
I'm working on these tests, I still don't know why it's happening but I'll find out, I'm sure of that. |
…test' and the 'test-single' in the package.json file in order to get time enough to complete all tests
Hi @ebwinters I want to know if the limit of 200000 in the --timeout from the test and test-single scripts is something that I can change because I modified this number to 300000 and now all my tests are passing correctly. |
yea totally fine that's not a hard limitation |
Hi, @ebwinters, I finally understood why my tests don't pass, the reason is that the page where the scraper gets the information is usually under maintenance, so it's common that the tests don't pass. I was wondering what is recommended to do in these cases, I noticed that there are tests that are pending, should I put my tests as pending? Without anything else for the moment again I appreciate your patience with me. Greetings from Mexico City |
no it's fine if they are pending |
All right then @ebwinters ;). |
Hi @ebwinters , |
This Pull Request add the next feature related with the 1019 issue (#1019):
You can see data from 30 European countries related to the different COVID-19 variants, as you can see in the pictures.
Source of the data: https://www.ecdc.europa.eu/en/publications-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide
There are two new endpoints:
I'm still working on the test for this scraper, the swagger documentation and I need to remove the instance "Redis commander" that I install in order to see what I load to the Redis database http://joeferner.github.io/redis-commander/.
I'm sure that there will be comments and modifications requests from the maintainers but I think is a good start what I've done here.
Best Regards Centli Garcés