Skip to content
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

Validator: remove reliance on meta fields and check mandatory queries #676

Merged
merged 4 commits into from Jan 18, 2021

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Jan 16, 2021

@ml-evs ml-evs added bug Something isn't working priority/high Issue or PR with a consensus of high priority validator Related to the OPTIMADE validator labels Jan 16, 2021
@codecov
Copy link

codecov bot commented Jan 16, 2021

Codecov Report

Merging #676 (cae2035) into master (4dced15) will decrease coverage by 0.31%.
The diff coverage is 72.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #676      +/-   ##
==========================================
- Coverage   93.58%   93.27%   -0.32%     
==========================================
  Files          61       61              
  Lines        3306     3344      +38     
==========================================
+ Hits         3094     3119      +25     
- Misses        212      225      +13     
Flag Coverage Δ
project 93.27% <72.22%> (-0.32%) ⬇️
validator 66.05% <72.22%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
optimade/validator/validator.py 82.87% <69.69%> (-1.49%) ⬇️
optimade/validator/config.py 100.00% <100.00%> (ø)
optimade/validator/utils.py 94.55% <100.00%> (+0.03%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4dced15...cae2035. Read the comment docs.

@ml-evs ml-evs marked this pull request as ready for review January 17, 2021 13:32
@ml-evs ml-evs requested a review from CasperWA as a code owner January 17, 2021 13:32
Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some suggested changes. It's a bit difficult for me to discern the functional changes and their consequence from the diff, but I'll give it another try once you've had a chance to respond to my suggested changes and comments.

optimade/validator/validator.py Outdated Show resolved Hide resolved
optimade/validator/validator.py Show resolved Hide resolved
optimade/validator/validator.py Outdated Show resolved Hide resolved
optimade/validator/validator.py Show resolved Hide resolved
optimade/validator/validator.py Show resolved Hide resolved
optimade/validator/validator.py Outdated Show resolved Hide resolved
@ml-evs ml-evs force-pushed the ml-evs/closes_#675 branch 2 times, most recently from 283a1e4 to 4388e53 Compare January 18, 2021 12:52
@ml-evs
Copy link
Member Author

ml-evs commented Jan 18, 2021

Just fixed a couple more issues arising after testing this on some other implementations; we no longer have any internal failures on the current state of OMDB, OQMD or COD. Happy to split this PR up if that helps, but the commit history should be sensible.

@ml-evs ml-evs changed the title Remove validator reliance on 'meta->data_returned' Remove validator reliance on optional 'meta->data_returned/data_available' fields Jan 18, 2021
@ml-evs ml-evs requested a review from CasperWA January 18, 2021 13:00
@CasperWA
Copy link
Member

CasperWA commented Jan 18, 2021

Just fixed a couple more issues arising after testing this on some other implementations; we no longer have any internal failures on the current state of OMDB, OQMD or COD. Happy to split this PR up if that helps, but the commit history should be sensible.

I would argue they all should still fail due to them not supporting the mandatory query on structure_features.

Edit: But of course, there shouldn't be internal errors in the validator. So your statement still stands (read it a bit too quickly).

@ml-evs
Copy link
Member Author

ml-evs commented Jan 18, 2021

I would argue they all should still fail due to them not supporting the mandatory query on structure_features.

* COD: https://www.crystallography.net/cod/optimade/v1/structures?filter=NOT%20structure_features%20HAS%20ALL%20%22assemblies%22

* OQMD: http://oqmd.org/optimade/v1/structures?filter=NOT%20structure_features%20HAS%20ALL%20%22assemblies%22

* OMDB: http://optimade.openmaterialsdb.se/v1.0.0/structures?filter=NOT%20structure_features%20HAS%20ALL%20%22assemblies%22

By internal failures I meant that they still fail validation but don't crash the validator! Though you raise a good point; we have no concept of required queries yet. This may be where we draw the line at the validator being "necessary not not sufficient" for OPTIMADE compliance. Perhaps you could raise an issue for this? I have another issue to raise at some point too, about default response fields...

@CasperWA
Copy link
Member

By internal failures I meant that they still fail validation but don't crash the validator! (...)

Yeah, sorry. Saw that. Also edited my post.

Though you raise a good point; we have no concept of required queries yet. This may be where we draw the line at the validator being "necessary not not sufficient" for OPTIMADE compliance. Perhaps you could raise an issue for this? I have another issue to raise at some point too, about default response fields...

Done, see #678.

Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The None additions are not part of the "requested changes".

I think there's a discrepancy for the providers submodule here? Did you update that in this PR? I'll run the dependabot instead.

optimade/validator/validator.py Outdated Show resolved Hide resolved
optimade/validator/validator.py Show resolved Hide resolved
optimade/validator/validator.py Show resolved Hide resolved
optimade/validator/validator.py Outdated Show resolved Hide resolved
@CasperWA
Copy link
Member

I think there's a discrepancy for the providers submodule here? Did you update that in this PR? I'll run the dependabot instead.

Just merged this in, updating the providers submodule in master.

@ml-evs ml-evs changed the title Remove validator reliance on optional 'meta->data_returned/data_available' fields Validator: remove reliance on meta fields and check mandatory queries Jan 18, 2021
@ml-evs
Copy link
Member Author

ml-evs commented Jan 18, 2021

Happy to split this into multiple PRs if this is getting unwieldy...

@CasperWA
Copy link
Member

CasperWA commented Jan 18, 2021

Happy to split this into multiple PRs if this is getting unwieldy...

With the creeping additions it quickly gets difficult to discern what is connected to what, for sure. But at the same time, I'd like to get this done.

Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A final comment for me, in this iteration of the PR 😅

optimade/validator/validator.py Outdated Show resolved Hide resolved
- Ensure return from _get_endpoint is always properly sanitized
- Improve displayed request by adapting to multistage parameter
- Improve some error message detail and fixed a docstring
CasperWA
CasperWA previously approved these changes Jan 18, 2021
Co-authored-by: Casper Welzel Andersen <casper.andersen@epfl.ch>
@ml-evs ml-evs merged commit 5ea4b75 into master Jan 18, 2021
@ml-evs ml-evs deleted the ml-evs/closes_#675 branch January 18, 2021 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority/high Issue or PR with a consensus of high priority validator Related to the OPTIMADE validator
Projects
None yet
2 participants