Skip to content

Commit

Permalink
Improve performance of validation of filters and raw fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronweeden committed Apr 4, 2024
1 parent 63141a0 commit f073b79
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Main development branch
- Update tests and testing instructions ([\#14](https://github.com/ubccr/xdmod-data/pull/14)).
- Improve performance of validation of filters and raw fields ([\#18](https://github.com/ubccr/xdmod-data/pull/18)).

## v1.0.0 (2023-07-21)
- Initial release.
2 changes: 1 addition & 1 deletion xdmod_data/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = 'xdmod-data'
__version__ = '1.0.0'
__version__ = '1.0.1-beta.1'
13 changes: 7 additions & 6 deletions xdmod_data/_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,14 @@ def __validate_filters(data_warehouse, descriptors, realm, filters):
if isinstance(filter_values, str):
filter_values = [filter_values]
result[dimension_id] = []
valid_filter_values = data_warehouse.get_filter_values(
realm,
dimension,
)
for filter_value in filter_values:
new_filter_value = __find_value_in_df(
'Filter value',
data_warehouse.get_filter_values(realm, dimension),
valid_filter_values,
filter_value,
)
result[dimension_id].append(new_filter_value)
Expand Down Expand Up @@ -214,12 +218,9 @@ def __find_str_in_sequence(value, sequence, label):
def __validate_raw_fields(data_warehouse, realm, fields):
try:
results = []
valid_raw_fields = data_warehouse.describe_raw_fields(realm)
for field in fields:
new_field = __find_value_in_df(
'Field',
data_warehouse.describe_raw_fields(realm),
field,
)
new_field = __find_value_in_df('Field', valid_raw_fields, field)
results.append(new_field)
return results
except TypeError:
Expand Down

0 comments on commit f073b79

Please sign in to comment.