Skip to content

Commit

Permalink
Merge branch 'main' into try-new-attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gigaszi authored Jan 16, 2025
2 parents 6ff337e + 78bdfd5 commit 3dc284b
Show file tree
Hide file tree
Showing 16 changed files with 2,106 additions and 312 deletions.
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# Changelog

## Current Main
## Current Main

### New Features

- PR template: Hurl maintenance is mentioned and wording with respect to mergeability is clarified ([#860])
- attribute completeness: added new topic and topic - specific attributes and deleted non-functional attributes ([#850])


[#850]: https://github.com/GIScience/ohsome-quality-api/issue/850


## Release 1.8.2

- PR template: Hurl maintenance is mentioned and wording with respect to mergeability is clarified ([#860])

### Bug Fixes

- attribute-completeness: custom filters are now correctly combined with topic filter ([#865])


[#860]: https://github.com/GIScience/ohsome-quality-api/issues/860
[#865]: https://github.com/GIScience/ohsome-quality-api/pull/865


## Release 1.8.1
Expand Down
2 changes: 1 addition & 1 deletion ohsome_quality_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.8.1"
__version__ = "1.8.2"
__title__ = "ohsome quality API"
__description__ = "Data quality estimations for OpenStreetMap"
__author__ = "ohsome team"
Expand Down
8 changes: 2 additions & 6 deletions ohsome_quality_api/attributes/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,12 @@ def get_attribute_preset(topic_key: str) -> List[Attribute]:
) from error


def build_attribute_filter(attribute_key: List[str], topic_key: str) -> str:
def build_attribute_filter(attribute_key: List[str] | str, topic_key: str) -> str:
"""Build attribute filter for ohsome API query."""
attributes = get_attributes()
try:
if isinstance(attribute_key, str):
return (
get_topic_preset(topic_key).filter
+ " and "
+ attributes[topic_key][attribute_key].filter
)
return get_topic_preset(topic_key).filter + " and (" + attribute_key + ")"
else:
attribute_filter = get_topic_preset(topic_key).filter
for key in attribute_key:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def __init__(
for k in self.attribute_keys
]
)
else:
self.attribute_filter = build_attribute_filter(
self.attribute_filter,
self.topic.key,
)

async def preprocess(self) -> None:
# Get attribute filter
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ohsome_quality_api"
version = "1.8.1"
version = "1.8.2"
description = "Data quality estimations for OpenStreetMap."
authors = ["ohsome team <[email protected]>"]
homepage = "https://api.quality.ohsome.org"
Expand Down
4 changes: 2 additions & 2 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@


# please adjust these version names first
export OLD_VERSION=1.8.0
export NEW_VERSION=1.8.1
export OLD_VERSION=1.8.1
export NEW_VERSION=1.8.2


# exit immediately if a command exits with a non-zero status
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Querying the ohsome API failed! Invalid filter syntax. Please look at the additional info and examples about the filter parameter at https://docs.ohsome.org/ohsome-api. Detailed error message: line 1, column 9: whitespaces, EQUALS (=), NOT_EQUALS (!=) or in expected, f encountered.
Querying the ohsome API failed! Invalid filter syntax. Please look at the additional info and examples about the filter parameter at https://docs.ohsome.org/ohsome-api. Detailed error message: line 1, column 63: whitespaces, EQUALS (=), NOT_EQUALS (!=) or in expected, f encountered.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Querying the ohsome API failed! Invalid filter syntax. Please look at the additional info and examples about the filter parameter at https://docs.ohsome.org/ohsome-api. Detailed error message: line 1, column 9: whitespaces, EQUALS (=), NOT_EQUALS (!=) or in expected, f encountered.
Querying the ohsome API failed! Invalid filter syntax. Please look at the additional info and examples about the filter parameter at https://docs.ohsome.org/ohsome-api. Detailed error message: line 1, column 63: whitespaces, EQUALS (=), NOT_EQUALS (!=) or in expected, f encountered.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Querying the ohsome API failed! Invalid filter syntax. Please look at the additional info and examples about the filter parameter at https://docs.ohsome.org/ohsome-api. Detailed error message: line 1, column 9: whitespaces, EQUALS (=), NOT_EQUALS (!=) or in expected, f encountered.
Querying the ohsome API failed! Invalid filter syntax. Please look at the additional info and examples about the filter parameter at https://docs.ohsome.org/ohsome-api. Detailed error message: line 1, column 63: whitespaces, EQUALS (=), NOT_EQUALS (!=) or in expected, f encountered.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Querying the ohsome API failed! Invalid filter syntax. Please look at the additional info and examples about the filter parameter at https://docs.ohsome.org/ohsome-api. Detailed error message: line 1, column 63: whitespaces, EQUALS (=), NOT_EQUALS (!=) or in expected, f encountered.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
60.9% of all "building count" features (all: 30263 elements) in your area of interest have the selected additional attributes Height (matched: 18444 elements).
39.8% of all "building count" features (all: 30263 elements) in your area of interest have the selected additional attributes Height (matched: 12059 elements).

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions tests/integrationtests/indicators/test_attribute_completeness.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest
from approvaltests import verify

from ohsome_quality_api.attributes.definitions import get_attributes
from ohsome_quality_api.indicators.attribute_completeness.indicator import (
AttributeCompleteness,
)
Expand Down Expand Up @@ -243,3 +244,25 @@ def test_create_description_multiple_aggregation_types(
indicator.absolute_value_2 = absolute_value_2
indicator.create_description()
assert aggregation in indicator.description


def test_filters_match(topic_key_building_count, attribute_key_height):
indicator_attribute_keys = AttributeCompleteness(
get_topic_fixture(topic_key_building_count),
"foo",
attribute_keys=attribute_key_height,
)

attributes = get_attributes()
indicator_attribute_filter = AttributeCompleteness(
get_topic_fixture(topic_key_building_count),
"foo",
attribute_filter=attributes[topic_key_building_count][
attribute_key_height[0]
].filter,
)

assert (
indicator_attribute_filter.attribute_filter
== indicator_attribute_keys.attribute_filter
)

0 comments on commit 3dc284b

Please sign in to comment.