Closed AITMAR-TAFE closed 1 week ago
This PR implements historical weather data comparison functionality by adding new API endpoints to fetch data from one year ago, extending existing functions to handle historical data, and creating new display functions. The implementation includes comprehensive error handling, testing capabilities through a testing flag, and proper data formatting.
sequenceDiagram
participant User
participant CLI
participant API
participant OpenMeteo
User->>CLI: Request historical weather data
CLI->>API: Call gather_data with historical flag
API->>OpenMeteo: Fetch UV history
OpenMeteo-->>API: Return UV history data
API->>OpenMeteo: Fetch ocean information history
OpenMeteo-->>API: Return ocean information history
API->>CLI: Return historical data
CLI->>User: Display historical data
Change | Details | Files |
---|---|---|
Added new API endpoints for retrieving historical weather data |
|
src/api.py |
Extended data gathering and display functionality |
|
src/helper.py |
Added comprehensive test coverage for new functionality |
|
tests/test_api.py tests/test_helper.py |
Attention: Patch coverage is 93.33333%
with 3 lines
in your changes missing coverage. Please review.
Files with missing lines | Patch % | Lines |
---|---|---|
src/api.py | 93.33% | 3 Missing :warning: |
Files with missing lines | Coverage Δ | |
---|---|---|
src/helper.py | 81.14% <ø> (ø) |
|
src/api.py | 94.56% <93.33%> (-0.40%) |
:arrow_down: |
@all-contributors please add @AITMAR-TAFE for code
@ryansurf
I've put up a pull request to add @AITMAR-TAFE! :tada:
Hey @ryansurf,
Thank you for your feedback! I appreciate your kind words about the changes and the testing implementation.
I did consider removing the default print function but hesitated because it was specified in my original issue. However, I have now fixed the issue that caused the linter to fail and removed the print function as you suggested. I also updated the user arguments and revised the README file to include instructions on retrieving all historical data arguments. Lastly, I added some tests for historcial data arguments to ensure everything works smooth.
Just let me know if there is anything else I can improve :) !
@AITMAR-TAFE just tested the changes, its working wonderfully!
Just an fyi, the linter failed again. However, this time its asking for the formatter to be ran, so I'll just merge the PR and take care of it on my end. Thats on me, I should have advised you to run that as well (make format
)
Also, it would be nice to implement abbreviations for the arguments, like hide_direction / hdir
. Just a thought though, feel free to ignore if you'd like
Regardless, great work! You've written clean, documented code with test cases. I really appreciate your efforts, thank you for the contribution
Edit: Actually, I'll wait a bit to merge it. If you want to run the formatter on your end, please do! If not, I'll merge the PR and do it myself in the next day or two 🥂
Hey @ryansurf , thanks for the feedback, and apologies for the back and forth! I've now taken care of the formatter and added the suggested abbreviations for the arguments. I really appreciate you taking the time to review my work. Thanks again for the support!
This pull request introduces a feature that enhances user experience by allowing users to compare current weather conditions with historical data from one year ago. This capability facilitates a better understanding of seasonal patterns, informs decision-making, and fosters awareness of climate trends. With versatile data presentation options through CLI prompts and a dedicated print function, users can access information in their preferred format. Comprehensive documentation and unit tests ensure clarity, maintainability, and reliability of the new functionality. Overall, this feature enriches user engagement and provides valuable insights into weather variability and its implications. Related to issue nr #148 .
Enhancements:
Implemented a two new function get_uv_history and ocean_information_history to fetch data one year ago. Refactored gather_data function to include historical weather data. Refactored arguments_dictionary , set_output_values and print_ocean_data for displaying past ocean data to maintain CLI prompt options. Created a separate print function print_historical_data for displaying historical data as default. Documented new functions and tests for clarity and maintainability.
Testing:
Added unit tests for the new functionality to ensure accuracy. These tests also confirm the functionality works as intended and adheres to expected outcomes.
Evidence of Implementation:
Screenshots: Included screenshot demonstrate how the feature looks in action.
Summary by Sourcery
Add a feature to compare current weather conditions with historical data from one year ago, including UV index and ocean data. Implement new functions for fetching historical data and refactor existing functions to support this feature. Update documentation and add unit tests to ensure functionality and maintainability.
New Features:
Enhancements:
Documentation:
Tests: