Marine Weather Integration and Mobile UX Enhancements#171
Merged
Conversation
Enhance the Open-Meteo service to fetch marine weather data (wave height, direction, period, swell, SST, and sea level) in parallel with wind data. Changes: - Add `OPEN_METEO_MARINE_URL` constant - Update `fetch_wind_data_single_point` to fetch and merge marine data - Update `fetch_wind_data_grid` to batch fetch marine data - Update tests to reflect the new dual-API call behavior (Wind + Marine) This enables the frontend to display comprehensive marine conditions without requiring additional scheduled tasks or database schema changes, leveraging the existing 3-tier caching infrastructure.
- Backend: Fetch marine data (wave height, period, direction, swell, SST) from Open-Meteo in addition to wind. - Service: Enhance `calculate_wind_suitability` to consider wave height and period. High waves (>1.5m) or surge now trigger "Avoid" or "Difficult" ratings independent of wind. - API: Update `get_wind_recommendations` and `get_wind_data` endpoints to return full marine datasets. - Frontend: Add `MarineConditionsCard` component with tabs for Wind and Marine data. - UI: Update map popups (DiveSitesMap, LeafletMapView, WindOverlay) to display wave and water temperature data under "Weather & Sea Conditions". - UI: Implement lazy loading via Ant Design `Collapse` for "Current Weather Conditions" and "Nearby Dive Sites" on the Dive Site Detail page to improve performance. - Docs: Update Wind Overlay Legend to explain new marine-based suitability criteria.
- Update `NavbarMobileControls` to force white text color for sub-menu items (Dive Log, Dive Sites, etc.), fixing contrast issues where items appeared disabled. - Update `ResponsiveFilterBar` to use sticky positioning for the search and filter bar, ensuring they remain accessible while scrolling. - Refactor `useResponsive` hook to refine scroll detection logic, adding a delay before hiding the search bar on scroll up to prevent flickering during interaction. - Ensure `DiveSites` page always renders the filter bar to support the sticky behavior.
…n v6 Security Fixes: - Implement chunked file reading for dive site photo uploads in backend to prevent Memory Exhaustion DoS (CVE-like pattern). - Integrate DOMPurify in frontend to sanitize map popup content in: - DiveSitesMap.js - LeafletMapView.js - DivesMap.js - DivingCentersMap.js This mitigates potential Stored XSS vulnerabilities in all map components. Frontend Refactoring (Ant Design v6 Migration): - Refactor Help and Changelog pages to adhere to latest naming conventions: - Replace `Steps` children with `items` prop. - Update `Space` `direction` -> `orientation`. - Update `Divider` `type` -> `orientation`. - Update `Card` `bodyStyle` -> `styles.body`. - Fix linting errors in DiveSites.js. Test & Compatibility Updates: - Update backend weather API tests to correctly verify parameters across multiple concurrent service calls (Wind + Marine data). - Update frontend calculator test expectations (BestMix, Mod, MinGas, GasPlanning) to align with precise physics calculations using Standard Surface Pressure (1.01325 bar) and Real Gas Law (Z-Factor). Verification: - Backend: All 1339 tests passed. - Frontend: All unit tests passed.
- Filter out invalid cylinders in `create_structured_gas_data` that lack size, pressure, gas mix, or valid description. - Prevent creation of "Stage 2" ghost tanks (often "unknown" description in XML) when importing Subsurface logs. - Add regression tests in `backend/tests/test_dive_import_utils.py`.
This file contains hidden or 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
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.
Summary
This PR significantly enhances the application's weather data capabilities by integrating the Open-Meteo Marine API and provides several mobile user experience improvements. It also includes a fix for the Subsurface XML import process and various security refactorings.
Changes Made
New Features & Enhancements
Additional Improvements & Fixes
backend/app/routers/dives/dives_import.pyto filter out invalid/empty "ghost" cylinders that appeared in certain XML exports.Testing
Automated Testing
backend/tests/test_dive_import_utils.pyto ensure robust parsing of cylinder data and prevent regression of the ghost tank bug../docker-test-github-actions.sh, confirming stability across weather and dive logging modules.Manual Testing
Related Issues
Additional Notes