Skip to content
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

V2 #21

Closed
wants to merge 98 commits into from
Closed

V2 #21

wants to merge 98 commits into from

Conversation

rileyhales
Copy link
Contributor

@rileyhales rileyhales commented Feb 29, 2024

Summary by CodeRabbit

  • New Features
    • Launched a new Flask application with API endpoints, HTML pages, and CORS support.
    • Introduced versioning for API with separate modules for different versions, enhancing data product handling.
    • Added logging functionality to CloudWatch Logs for monitoring API requests.
    • Provided a comprehensive list of academic publications related to the GEOGLOWS ECMWF Streamflow Service.
  • Bug Fixes
    • Fixed the navbar and meta descriptions for consistent branding across all templates.
  • Documentation
    • Updated project and API documentation to reflect the standardized spelling of "GEOGLOWS."
  • Chores
    • Improved project setup by updating .gitignore, Dockerfile, and supervisord configuration for better development and deployment practices.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f2ed65f and 7645dd8.
Files selected for processing (1)
  • app/v2/data.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/v2/data.py

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7645dd8 and d969ea5.
Files ignored due to path filters (1)
  • helm/gsprestapi/Chart.yaml is excluded by: !**/*.yaml
Files selected for processing (9)
  • .gitignore (1 hunks)
  • .gitlab-ci.yml (5 hunks)
  • app/templates/base_template.html (5 hunks)
  • app/templates/documentation.html (2 hunks)
  • app/templates/license.html (3 hunks)
  • app/v2/controllers_forecasts.py (5 hunks)
  • app/v2/data.py (1 hunks)
  • app/v2/utilities.py (8 hunks)
  • check_helm_chart (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • app/templates/base_template.html
  • app/templates/documentation.html
  • app/templates/license.html
  • app/v2/data.py
Additional comments: 7
.gitignore (1)
  • 185-190: The updates to .gitignore are beneficial for both security and developer experience:
  • Excluding .vscode/ prevents the accidental inclusion of personal editor settings.
  • Including /aws_config.json is crucial for avoiding the accidental commit of AWS credentials.

Ensure these exclusions are consistently applied across all relevant branches and consider reviewing other potential sensitive files that should be excluded.

.gitlab-ci.yml (1)
  • 5-12: The inclusion of external files for Helm checks and Kaniko builds enhances the modularity of the CI/CD pipeline. Ensure that the referenced external files (/helm-check.yml and /kaniko-build.yml) are up-to-date and align with the project's current deployment requirements.
app/v2/utilities.py (3)
  • 1-18: The updates to imports and the shift towards using relative imports enhance the modularity and maintainability of the code. It's good practice to ensure that all new imports are used effectively and that the relative paths align with the project's directory structure.
  • 13-39: The modifications to the ALL_PRODUCTS dictionary and the introduction of new product types are significant for extending the functionality of the API. Ensure that these changes are well-documented and that any new product types are fully supported across the application.
Verification successful

Given the grep output, it's evident that the ALL_PRODUCTS dictionary is used for validation and error handling in app/v2/blueprint.py and app/v2/utilities.py. However, this does not confirm the full support for the new product types in terms of functionality across the application. To further verify, we should look for specific instances where the new product types are handled or processed, which could involve searching for the usage of individual product names or mechanisms that dynamically handle products based on their presence in the ALL_PRODUCTS dictionary.


The extensive search across the application's codebase for the usage of the new product types introduced in the ALL_PRODUCTS dictionary reveals that these product types are indeed referenced and utilized in various parts of the application. The search results show that the product types such as forecast, forecaststats, forecastensembles, forecastrecords, forecastanomalies, forecastwarnings, hindcast, monthlyaverages, dailyaverages, returnperiods, and hydroviewer are mentioned in multiple files, including documentation (docs/index.html, docs/swagger_doc.yaml), JavaScript files (app/static/js/geoglows_esri_map.js), and Python files within both version 1 and version 2 of the application (app/v1/*, app/v2/*).

These references are found in various contexts, including API endpoint definitions, data processing functions, and user interface components, indicating that the new product types are integrated into the application's functionality. The presence of these product types in the Swagger documentation (docs/swagger_doc.yaml) and their handling in the application's backend (app/v1/*, app/v2/*) suggest that these product types are supported and exposed through the application's API, allowing users to interact with them.

Given the evidence from the codebase, it can be concluded that the new product types introduced in the ALL_PRODUCTS dictionary are indeed supported across the application, as they are referenced and utilized in multiple components of the application, including API endpoints, data processing functions, and user interface elements.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that new product types introduced in the ALL_PRODUCTS dictionary are supported across the application.
grep -r "ALL_PRODUCTS" .

Length of output: 535



Script:

#!/bin/bash
# Search for instances where new product types are specifically handled or processed.
grep -r "getreachid\|dates\|forecast\|forecaststats\|forecastensembles\|forecastrecords\|forecastanomalies\|forecastwarnings\|hindcast\|monthlyaverages\|dailyaverages\|returnperiods\|hydroviewer" .

Length of output: 84105

* 49-86: > 📝 **NOTE** > This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [57-253]

Several functions have been updated or added, including handle_request, get_forecast_dataset, and dataframe_to_csv_flask_response, among others. These changes aim to improve the handling of different product types, date formats, and file paths. However, there are placeholder comments indicating incomplete features. It's crucial to track these TODOs outside of the codebase to ensure they are addressed.

Would you like me to open a GitHub issue to track the implementation of the commented functionality in these functions?

app/v2/controllers_forecasts.py (2)
  • 10-18: The refactoring of import statements to use relative imports and the organization of the code into more readable and maintainable structures are commendable improvements. Ensure that all updated imports are correctly resolved and that the new structure aligns with the overall architecture of the application.
  • 58-140: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [24-228]

The restructuring and refactoring of functions such as forecast, forecast_stats, forecast_ensembles, and others enhance the code's clarity and consistency. It's important to thoroughly test these changes to ensure they maintain the expected functionality and do not introduce regressions.

Comment on lines +27 to +32
RESULT=$(curl ${HELM_REPO_URL}/${HELM_REPO_CHANNEL}/charts/${LOCAL_PACKAGE} -so ${REMOTE_PACKAGE} -u ${ECCR_USER}:${ECCR_PASSWORD} -w '%{http_code}\n')
if [ ${RESULT} -eq 404 ]; then
echo "Chart not found on remote" >&2
if [[ "$2" == "--upload" ]]; then
helm package ${CHARTDIR} --sign --key 'Aquaveo Chart Signing Key' --keyring ~/.gnupg/secring.gpg
echo "Uploading chart..."
curl -F "chart=@${LOCAL_PACKAGE}" -F "prov=@${LOCAL_PACKAGE}.prov" https://eccr.ecmwf.int/api/chartrepo/geoglows_api/charts -u ${ECCR_USER}:${ECCR_PASSWORD}
curl -F "chart=@${LOCAL_PACKAGE}" ${HELM_REPO_URL}/${HELM_REPO_CHANNEL}/charts -u ${ECCR_USER}:${ECCR_PASSWORD}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script now dynamically interacts with a Helm repository using environment variables for the URL and channel. This is a positive change for flexibility. However, consider the following points:

  • Security: The script uses basic authentication with curl. Ensure that the environment variables ECCR_USER and ECCR_PASSWORD are securely managed.
  • Error Handling: The script exits with a -2 code for any non-200 and non-404 HTTP response. It might be beneficial to log or handle different classes of HTTP errors more granularly.
  • Readability and Maintainability: The script is straightforward, but as it grows, consider structuring it into functions or adding comments for clarity.

Comment on lines +52 to +57
before_script:
- >
echo "{\"auths\":{
\"$CI_REGISTRY\": {\"username\":\"$CI_REGISTRY_USER\", \"password\":\"$CI_REGISTRY_PASSWORD\"},
\"eccr.ecmwf.int/harbor\": {\"username\":\"$ECCR_USER\", \"password\":\"$ECCR_PASSWORD\"}
}}" > /kaniko/.docker/config.json
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The before_script section for Docker authentication is crucial for security. Ensure that the credentials used ($CI_REGISTRY_USER, $CI_REGISTRY_PASSWORD, $ECCR_USER, $ECCR_PASSWORD) are securely managed and not exposed in logs or other insecure channels.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d969ea5 and 0ee848c.
Files selected for processing (2)
  • app/templates/documentation.html (1 hunks)
  • app/v2/data.py (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/templates/documentation.html
  • app/v2/data.py

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0ee848c and f72b731.
Files selected for processing (2)
  • app/templates/documentation.html (2 hunks)
  • app/templates/license.html (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/templates/documentation.html
  • app/templates/license.html

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f72b731 and fe78543.
Files selected for processing (2)
  • app/v2/constants.py (1 hunks)
  • app/v2/controllers_historical.py (1 hunks)
Additional comments: 2
app/v2/constants.py (1)
  • 6-8: Consider externalizing sensitive or environment-specific information, such as ODP_S3_BUCKET_CORE_URI, ODP_S3_BUCKET_RETROSPECTIVE, and ODP_S3_BUCKET_REGION, to environment variables or a configuration file. This approach enhances security and flexibility, allowing for easier adjustments without code changes.
app/v2/controllers_historical.py (1)
  • 30-48: Ensure that all external data sources (e.g., S3 buckets) are accessible and that the data is correctly formatted for the expected use cases. Additionally, consider adding more detailed error handling for cases where data retrieval fails or the requested data is not available.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between fe78543 and 21813ac.
Files selected for processing (1)
  • app/v2/data.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/v2/data.py

@rileyhales
Copy link
Contributor Author

Replaced by #22

@rileyhales rileyhales closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants