-
Notifications
You must be signed in to change notification settings - Fork 67
Leonlu2/error on geo values #1095
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
Conversation
2. modified test_covidcast and test_delphi_epidata for server geo_value validation passing 3. add TODO for patch and mock part
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.
good job! i found a few things that might help reduce repetition and clean it up a bit
src/server/_params.py
Outdated
for geo_value in geo_values: | ||
if geo_value not in delphi_utils.geomap.GeoMapper().get_geo_values(geo_type): | ||
raise ValidationFailedException("invalid geo_value for the requested geo_type") |
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 is cool! A few notes though:
- You should put it in a constructor for
GeoSet
instead (here), and then youl'l get this check for free in the call toparse_geo_arg()
below (among other places). - It would be good for the Exception to include which of the specified
geo_value
s is the offender. - nit: you can call/create
GeoMapper()
outside of the loops so its only done once
fips = ['04019', '19143', '29063'] # Example list of valid FIPS codes as strings | ||
msa = ['40660', '44180', '48620'] # Example list of valid MSAs as strings | ||
|
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 might wanna put these into src/acquisition/covidcast/test_utils.py so they can be shared with other tests and dont have to be repeatedly defined in each test file. you could maybe even make them defaults in CovidcastTestRow
in test_utils.py
, and you wont have to specify them in every call to make_default_row()
!
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.
@melange396 thanks for jumping in on this review! i should provide some context for this particular change though: initially the plan was to mock out the GeoMapper calls in tests so that we wouldn't need to use actual FIPS and MSA codes. Leon hasn't had much mocking experience though, and we tried multiple ways to get it to work with no luck. so having these constants is a sortof stopgap to get this PR out, but i don't think they're a good solution long term.
what do you think, keep the constants, or find a mock wizard (a wizard at mock, not a sham magician) to take a look?
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 dont think using those constants is all that bad, though not as nice as a mock. one argument against using mocks is that theyll hide (from the tests, at least) any changes to the arguments or output of the GeoMapper. i think the constants can stick around for now (especially if we put them in one place), but definitely keep that TODO comment along with them.
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
… geo_value is invalid in the message 2. move the valid FIPS and MSA codes to test_utils.py, and import them when needed. 3. fix other failed places related to this change
…delphi/delphi-epidata into leonlu2/error_on_geo_values
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.
👍 nice work!
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.
Oh except the delete batch test is still failing; we should hold for that
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.
fantastic job! just found a few little things...
Yea I haven't finished working on this😂, I accidentally pushed after the commit |
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
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 is lookin really good, and i think its almost ready. the only things left are 3 unresolved comments in integrations/server/test_covidcast.py
and some format-tidying suggestions i made in tests/server/test_params.py
.
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
Co-authored-by: melange396 <[email protected]>
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.
looks great! very nice job!
thanks :) |
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.
small confusion about placeholder set three
Co-authored-by: Katie Mazaitis <[email protected]>
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.
👍 nice work!
Kudos, SonarCloud Quality Gate passed!
|
process about #641
Prerequisites:
dev
branchdev
Summary