-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat(attribute-completeness): support custom filter #848
Conversation
d417bdd
to
52e6764
Compare
support custom attribute filter (given as ohsome filter query) for the attribute completeness indicator
7c2f24a
to
c2b1b28
Compare
daf61b7
to
a37e06d
Compare
keep name closer to original pytest nodeid, but move approved files to own directory "tests/approved/{module}".
move them to its own file
support custom attribute filter (given as ohsome filter query) for API endpoint /indicators/attribute-completeness
First transform model values from enums to dataclasses (e.g. TopicEnum -> TopicDefinition). Then use unpacking of arguments and keyword arguments to make function calls simpler.
check is not needed anymore because of request validation by pydantic models
a37e06d
to
75ec59d
Compare
to attribute title
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 nice. We will test it in combination with the frontend. Maybe we should add hurl tests for the custom filter
@@ -49,29 +54,54 @@ class BaseBpolys(BaseConfig): | |||
|
|||
@field_validator("bpolys") | |||
@classmethod | |||
def transform(cls, value) -> geojson.FeatureCollection: | |||
def transform_bpolys(cls, value): |
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.
why remove the return type here?
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.
No reason. I re-added the type hint!
result = round(self.result.value * 100, 1) | ||
if self.attribute_title is None: | ||
raise TypeError("Attribute names should not be None.") | ||
else: |
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.
why use names here and not title?
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 catch. I started out with attribute names and changed it to title later on. Will correct it here.
Description
Support custom attribute definition via ohsome filter query for the Attribute Completeness indicator. Now, the API endpoint
attribute-completeness
takes eitherattributeKeys
as before orattributeFilter
andattributeNames
as parameters. The first is an ohsome filter query and the second is a list of attribute names represented by the ohsome filter query.Corresponding issue
Closes #840
New or changed dependencies
Checklist
main
(e.g. throughgit rebase main
)