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

RTX Code Release (PI-3): Enhancements to Replace and Route to support enterprise hydrofabric and new NWPS api capabilities in near-real time #865

Open
wants to merge 26 commits into
base: ti
Choose a base branch
from

Conversation

taddyb33
Copy link

@taddyb33 taddyb33 commented Sep 3, 2024

The FIM-S team at RTX has been diligently working on enhancements to the existing Github solutions. This PR is the delivery of said enhancements, and documentation, for OWP approval. In short, the following enhancements were made:

Below we will go into more details of our changes:

image Figure 1: A diagram of the new RTX RnR Architecture

Additions

  • Changed the RnR architecture to be an event-driven API

    • Rather than being started through a python cmd line call, we are utilizing many docker containers managed by docker compose
    • The full pipeline is managed by a FastAPI app and can be triggered by running the /api/v1/publish/start endpoint from localhost:8000/docs or through a CURL command
    • This architecture uses RabbitMQ and Redis caching to ensure all forecasts are properly handled as floods, non-floods, errors, or forecasts that have been routed (no action).
    • A consumer python function handles individual RFC flooding events, formats output, calls T-Route, and post-processes output
  • Added IaC to call RnR through docker compose and syncs outputs to an S3 bucket

    • see Source/RnR/terraform/README.md for the full docs
  • Added T-Route as a service

  • Created a new Hfsubset tool for generating slices of v20.1 of the enterprise hydrofabric

  • Added a mock database to locally test Replace and Route without the need for a production server

    • Dockerfiles and scripts have been included for generating a mock DB
    • The mock DB can also be pulled using: docker pull ghcr.io/taddyb33/hydrovis/mock_database:0.0.1
  • Added jupyter notebooks to view historical RnR runs and verify correctness

    • See Source/RnR/notebooks/test_historical_LID.ipynb
  • Created a front-end service to view netcdf files and plots for successful RnR runs on RFC points.

  • Added a full docs/ suite to ensure code is documented

  • Added docstrings to functions and type hints to ensure code is readable and can be followed

Removals

  • See Changes

Changes

  • the existing owp-viz-replace-route-tar.gzip file has been moved to Source/RnR/nwm_3.0/ to ensure no code is lost

Testing

PyTests were generated for the following tests in the Source/RnR/tests folder and can be run using pytest -s from the Source/RnR folder:

  1. Testing the data consumer
  2. Testing hfsubset capabilities
  3. Testing how we are retrieving NWPS API data
  4. Testing how can are publishing RFC forecasts
  5. Testing the redis cache
  6. Testing how we ping our mock database
  7. Testing the full RnR service

These tests can be run either while docker compose is running, or if it is dead.

Screenshots

image Figure 2: A geospatial plot of where flow is (green) and where flow is not (grey) between two RFC points on the v20.1 enterprise hydrofabric

Notes

  • This code has been Demo'd to OWP and team on August 29th, 2024.
  • A MAJORITY of the inserted code is from included Bootstrap 5 CSS files for our Front-end service

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Target Environment support

  • Windows
  • Linux
  • Browser

Accessibility

  • Keyboard friendly
  • Screen reader friendly

Other

  • Is useable without CSS
  • Is useable without JS
  • Flexible from small to large screens
  • No linting errors or warnings
  • JavaScript tests are passing

taddyb and others added 26 commits August 22, 2024 08:09
* migrating files into repo

* adding gitignore

* changed identifier to lid to be less ambigious

* Delete Source/RnR/tests/test_data/2930769 directory

* editing binaries

* Delete Source/RnR/tests/test_data/2930769 directory

* adding back non-malformed data
…onously (#2)

* added aio pika

* fixed pika sync bugs and got message passing working

* removed old files

* linted the code

* updating requirements.txt

* fixed type hinting for python 3.9

* fixed decoding scope:

* removing distribution from github
* integrated t_route into the workflow

* adding metadata and postprocessing

* full beta of RnR done
…e async framework (#6)

* added troute intial state param

* integrated compose.yaml changes for new pacakges, and aio error handling

* adding ignores

* added test exception handling
* added troute intial state param

* integrated compose.yaml changes for new pacakges, and aio error handling

* adding ignores

* added test exception handling

* fixed plotting bugs

* linted and isort
* added logging module for errors

* tested assimation

* updating tests for logging

* added more settings updates
* Frontend plot/R&R data view

* Frontend changes - search one LID at a time

* Function name change in frontend router

* Function name change in frontend router
* started a jupyter notebook for verifying code outputs

* adding historical flood events

* adding historical data

* notebook progress

* notebook is done

* changed verbiage
* Frontend plot/R&R data view

* Frontend comment/documentation cleanup

* API comment/documentation cleanup
* added readme and cleaned requirements

* linted
* added readme and cleaned requirements

* linted

* updating docs

* added publish.md

* added rabbit mq docs

* added post processing docs

* added the last of the docs/ files

* added the rest of the README.mds

* updated compose
@taddyb33
Copy link
Author

taddyb33 commented Sep 3, 2024

Edit: added note about front-end services and how the majority of code insertions are bootstrap css files

@nickchadwick-noaa nickchadwick-noaa added this to the V2.1.x milestone Sep 5, 2024
@nickchadwick-noaa nickchadwick-noaa added the enhancement New feature or request label Sep 5, 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.

6 participants