-
Notifications
You must be signed in to change notification settings - Fork 635
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
Merged
Merged
Iss1019feat #1030
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
648e3e4
[FEAT] create the scraper in the getEuropeVariants.js file, modify th…
yosoycentli 69e948a
[FEAT] create the scraper in the getEuropeVariants.js file, modify th…
yosoycentli 51095ca
[MODIFY] Rename the getEuropeVariants to --> getVariants
yosoycentli c88a70a
[MODIFY] Add the line 22 variants to the json
yosoycentli 12611a6
[MODIFY] change the values of keys.variants in the line 15 and 22
yosoycentli 89d6cb2
[ADD/MODIFY] add the instance of the variant.js file and modify the g…
yosoycentli 2dc3beb
[MODIFY] change a several files in order to connect the variant scrap…
yosoycentli ac42848
[MODIFY] now the scraper works and return the data in the correct format
yosoycentli 614077c
[MODIFY] remove the parameters yearWeek and variant from router.get i…
yosoycentli 5d133ed
[MODIFY] add test for the getVariants.js scraper and remove console.l…
yosoycentli 2fb8e42
[MODIFY] add swagger documentation
yosoycentli 77816d7
[MODIFY] fix swagger documentation
yosoycentli 14ebd0e
Merge branch 'master' into iss1019feat
ebwinters c9c2f11
[MODIFY] fix eslint style problems
yosoycentli 3478e5b
Merge branch 'iss1019feat' of github.com:yosoycentli/API into iss1019…
yosoycentli aecddba
Merge branch 'master' into iss1019feat
yosoycentli 46bfc6a
[MODIFY] I commented the lines 2-5 in api_influenza.spec.js file to f…
yosoycentli e2a66aa
[MODIFY] I change the --timeout value from 200000 to 300000 for the '…
yosoycentli 67b85e2
Merge branch 'master' into iss1019feat
ebwinters 7442e60
[MODIFY] Put back the var in line 57 in order to get a right eslint p…
yosoycentli a4be9b4
Merge branch 'iss1019feat' of github.com:yosoycentli/API into iss1019…
yosoycentli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// *from here* This model comes from apiGov.js: | ||
|
||
// eslint-disable-next-line new-cap | ||
const router = require('express').Router(); | ||
|
||
const nameUtils = require('../../../utils/nameUtils'); | ||
const { wordToBoolean } = require('../../../utils/stringUtils'); | ||
const { redis, keys } = require('../../instances'); | ||
|
||
router.get('/v3/covid-19/variants/countries/:country?', async (req, res) => { | ||
const { allowNull } = req.query; | ||
const { country: countryName, yearWeek, variant } = req.params; | ||
if (countryName) { | ||
const standardizedCountryName = nameUtils.getCountryData(countryName.trim()).country || countryName.trim(); | ||
const data = JSON.parse(await redis.hget(keys.variants, standardizedCountryName)); | ||
if (data) { | ||
res.send(!wordToBoolean(allowNull) ? nameUtils.transformNull(data) : data); | ||
} else { | ||
res.status(404).send({ message: `Country '${standardizedCountryName}' not found or no data found for country` }); | ||
} | ||
} else { | ||
res.send((await redis.hkeys(keys.variants)).sort()); | ||
} | ||
}); | ||
|
||
module.exports = router; | ||
|
||
// *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 commentThe reason will be displayed to describe this comment to others. Learn more. remove once ready to publish draft |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.