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

[PY-620] Add properties checker util functions #748

Closed
wants to merge 50 commits into from
Closed

Conversation

saurbhc
Copy link
Member

@saurbhc saurbhc commented Dec 13, 2023

Problem

Lacking support for properties checker util functions

Solution

adds in util functions for checking properties

  • build_list_properties(List[dt.Annotation]) -> List[SelectedProperty]
  • properties_missing(List[FullProperty], List[SelectedProperty]) -> List[SelectedProperty]
  • mismatched_properties(List[FullProperty], List[SelectedProperty]) -> List[SelectedProperty]

TODO:

Changelog

Add properties checker util functions

@saurbhc saurbhc added the enhancement New feature or request label Dec 13, 2023
@saurbhc saurbhc self-assigned this Dec 13, 2023
Copy link

linear bot commented Dec 13, 2023

@saurbhc saurbhc marked this pull request as ready for review December 13, 2023 11:30
@saurbhc saurbhc requested a review from Nathanjp91 December 13, 2023 11:30
Copy link
Contributor

@Nathanjp91 Nathanjp91 left a comment

Choose a reason for hiding this comment

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

Would like some unit tests here to verify some expected returns

@@ -267,6 +268,45 @@ def _resolve_annotation_classes(
return local_classes_not_in_dataset, local_classes_not_in_team


def build_list_properties(annotations: List[dt.Annotation]) -> List[SelectedProperty]:
return [prop for annotation in annotations for prop in annotation.properties or []]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might need to also return the annotation.class info alongside the SelectedProperty, in a similar vein to metadata.json. See slack for more info.

team_properties: List[FullProperty], import_properties: List[SelectedProperty]
) -> List[SelectedProperty]:
missing_properties: List[SelectedProperty] = []
team_properties_lookup = {prop.name: prop for prop in team_properties}
Copy link
Contributor

Choose a reason for hiding this comment

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

Like the key lookup approach, very nice.

@saurbhc saurbhc closed this Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants