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

Aggregation Descriptor Ontology Validator Update #373

Merged
merged 8 commits into from Oct 19, 2021

Conversation

tasodorff
Copy link
Collaborator

Added the subfield category aggregation_descriptor to the ontology validator.

Added the subfield category `aggregation_descriptor` to the ontology validator.
@@ -220,6 +220,8 @@ def __init__(self):
_CATEGORIES_IN_ORDER = [
_CAT_SPEC(
cat=subfield_lib.SubfieldCategory.AGGREGATION, required=False, max=1),
_CAT_SPEC(
cat=subfield_lib.SubfieldCategory.AGGREGATION_DESCRIPTOR, required=False, max=10),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a need for allowing up to 10 aggregation descriptors in one field? From what I recall, the descriptors will only represent duration, and those should all be mutually exclusive.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i included this for future compatibility, in case we need something along the lines of rolling or fixed window descriptors. this would give us that ability.

i believe our long-term plan for adding this in to the translation as an attribute might not work, so this would be the alternative.

@@ -24,6 +24,7 @@
from yamlformat.validator import subfield_lib

AGGREGATION = subfield_lib.SubfieldCategory.AGGREGATION
AGGREGATION_DESCRIPTOR = subfield_lib.SubfieldCategory.AGGREGATION_DESCRIPTOR
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add and/or modify field tests to use the new subfield category.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i agree. what should this test be? thinking we should check that there is no agg_desc without an asssociated agg. does that make sense? if so, might need your help to expedite the test writing.

Copy link
Contributor

Choose a reason for hiding this comment

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

That actually sounds like something we should add as a validation check, and the same for measurement descriptors.

The GitHub app is giving me conflicting info on whether or not I can push directly to this branch, so if you want me to take over writing tests, I may need to do it on a separate PR.

@@ -144,8 +147,7 @@ def testAddFromConfig(self):
sff = subfield_lib.SubfieldFolder(_GOOD_PATH)
sff.AddFromConfig([doc], '{0}/file.yaml'.format(_GOOD_PATH))
ns = sff.local_namespace

self.assertCountEqual(['agg', 'comp', 'desc', 'mdesc', 'meas', 'ptype'],
self.assertCountEqual(['agg','aggdesc', 'comp', 'desc', 'mdesc', 'meas', 'ptype'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self.assertCountEqual(['agg','aggdesc', 'comp', 'desc', 'mdesc', 'meas', 'ptype'],
self.assertCountEqual(['agg', 'aggdesc', 'comp', 'desc', 'mdesc', 'meas', 'ptype'],

This line is too long, but I'm not sure what the preferred or linter-approved way to split it is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ive tried a backslash linebreak, but @charbull will need to confirm this works.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes it should work

Added two new tests for aggregation descriptors (check there isn't more than one, check that it comes with an aggregation). Some minor cleanup for linter.
Changed the code so that aggregation_descriptor precedes aggregation.
@tasodorff
Copy link
Collaborator Author

@charbull @berkoben its good to review i think. Please take a look

Copy link
Contributor

@berkoben berkoben left a comment

Choose a reason for hiding this comment

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

one nit

@charbull charbull merged commit fb186de into master Oct 19, 2021
@charbull charbull deleted the Aggregation-Descriptor-Added-To-Ontology-Validator branch October 19, 2021 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants