-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor query methods for data source handling #9
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The code has been refactored to individual query methods for clear data handling and improve readability. The 'data_sources_query' method in 'DataSources.py' which was previously handling all query types is replaced with specific, self-explanatory query methods such as 'get_approved_data_sources', 'needs_identification_data_sources' and 'get_data_sources_for_map'. This also leads to the introduction of 'convert_data_source_matches' in 'data_source_queries.py' file for better format conversion.
The archives_put_query method has been removed from the archives_queries.py and its functionality has been split into direct calls to the appropriate methods, archives_put_broken_as_of_results or archives_put_last_cached_results. This change simplifies the code and makes it more legible by clearly specifying the function being used in each situation. The refactoring also involves adjustments in the Archives.py resource to accommodate these changes.
Updated data access in various tests, which replaced indexed access with direct attribute access. Added a test 'convert_data_source_matches' to validate the conversion of data source matches to dictionaries. Removed unused test method 'test_data_sources_query' as it was no longer relevant. These adjustments enhance readability and maintainability of test codes.
The function 'convert_data_source_matches' now has type hints and a descriptive docstring. This change provides clarity on what the function expects as parameters and what it returns. Improved documentation aids in understanding the code and enhances maintainability.
…_281_middleware_god_function_actual # Conflicts: # resources/Archives.py # resources/DataSources.py
…281_middleware_god_function_actual
This commit replaces the broken data_sources_query function calls in the SearchTokens module with properly defined functions. This includes using the new get_approved_data_sources function for fetching approved data sources and get_data_sources_for_map for getting data sources specific to maps.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Description
Resources
Resources
functionsTesting
test_data_source_queries
,test_archives_queries
to confirm continued operation of functionality.Performance
Docs