Red tides, or harmful algal blooms (HABs), are an oceanic phenomenon characterized by an unnaturally high concentration of algae, including blue-green algae (cyanobacteria). Given the harm red tides pose to unsuspecting swimmers, boaters, anglers and others, it’s critical to monitor the water for conditions likely to produce algal blooms. Business rules can play an important role in these monitoring efforts, so we have documented the process using AWS Lambda and Corticon.js to help predict red tide conditions.
Using sensor data from sources like buoys and docks, we can set up scheduled data queries for water conditions and trigger red tide risk alerts using business rules.
The complete set of rule assets and lambda functions can be accessed from the Corticon GitHub Repository.
In this project, we will leverage AWS Lambda functions to access data from a monitoring station maintained by Florida Gulf Coast University’s Water School at Sanibel Island in Florida. The station provides measurements every 10 minutes of the following conditions:
For this project, we have two Lambda functions.
The first is a Python function that retrieves water quality data from the ERDDAP server, transforms it into a usable format, and then sends it to a Corticon decision service (also implemented as a Lambda function) for analysis and reporting. It is comprised of the following components:
Trigger: An event (e.g., a scheduled event in CloudWatch) triggers the Lambda function.
Data Retrieval: The Lambda function retrieves water quality data from the ERDDAP server for the past seven days.
Data Transformation: The Lambda function transforms the ERDDAP data into a list of dictionaries.
Corticon Invocation: The Lambda function invokes the Corticon Lambda function, passing the transformed data as a JSON array.
Rule Execution: The Corticon Lambda function executes a set of rules against the water quality data.
Report Generation: The Corticon Lambda function returns a JSON response indicating which rules were triggered (if any).
Report Formatting: The Lambda function formats the Corticon response into a human-readable report.
Response: The Lambda function returns a success response with the formatted water quality report.
Monitoring and Alerting: This setup enables automated monitoring and alerting for Tampa Bay water quality, providing timely information for decision-making.
Chlorophyll: Chlorophyll is the pigment responsible for light absorption in photosynthesis. Chlorophyll-a is the predominant type of chlorophyll used by algae and is generally highly correlated to harmful algae concentrations.
Dissolved Oxygen: Because algae consume oxygen but only replenish it when photosynthesizing from sunlight, excessive concentrations of algae can deplete oxygen from the water.
Practical Salinity: In Florida waters, K. brevis thrives in high-salinity areas.
pH: Algae thrive in environments with elevated pH levels, so high pH levels can encourage excessive algae proliferation.
Turbidity: Turbidity is the measure of the cloudiness in water caused by suspended particles. It is measured in Nephelometric Turbidity Units (NTUs).
Fluorescent Dissolved Organic Matter (FDOM): FDOM appears in higher concentrations during red tides. It is measured based on the fluorescence of a given volume of water sampled, measured in quinine sulfate units (QSU).
Phycoerythrin: Phycoerythrin is a red pigment found in cyanobacteria that can contribute to the reddish color of seawater during red tide events. Cyanobacteria are the only phytoplankton that contain phycoerythrin, making it a good indicator of the amount of cyanobacteria in a body of water.
This serverless water quality monitoring system exemplifies the power and efficiency of combining modern technologies like AWS Lambda and a rules engine like Corticon. By decoupling data retrieval from the decision-making process, we achieve a highly scalable, cost-effective and easily maintainable solution.
The use of a rules engine empowers business users to define and adapt alert thresholds and logic without requiring code changes, enabling rapid responses to evolving environmental conditions. For large enterprises evaluating serverless architectures, this approach demonstrates the potential to build robust, event-driven systems that optimize resource utilization, minimize operational overhead, and provide actionable insights from real-time data streams, unlocking significant advantages in agility and cost savings compared to traditional monolithic applications.
Furthermore, this architecture’s modularity facilitates seamless integration with other enterprise systems, paving the way for a more comprehensive and responsive approach to environmental management and other data-intensive domains.
Corticon can be applied to any rule-intensive decision across verticals and lines of business—if you have a scenario in mind, we invite you to reach out to see a demo tailored for your use case!
While numerous species of algae can accumulate at levels sufficient to cause a red tide, the most common culprit in the Gulf of Mexico is Karenia brevis (K. brevis).
A bloom can develop when algae drifts into a region and steadily accumulates due to optimal water conditions. Once the population grows to sufficient concentrations, the threats to marine life mount and compound on each other. Algae like K. brevis produce neurotoxins that are toxic to exposed marine life or animals that consume exposed organisms—including humans. When the toxins become airborne from wind and waves, they can also lead to respiratory irritation in humans.
The toxins are not always the main threat to fish from algal blooms, however.
Although plants output oxygen via photosynthesis, they also must consume oxygen to survive. This isn’t usually a problem because the oxygen is created from photosynthesis at far faster rates than plants consume it. When the sun goes down, though, photosynthesis stops, and the injection of new oxygen into the ecosystem ceases, while plant consumption of oxygen continues. During an algal bloom, the large population of plant life can drain oxygen from the water overnight, killing massive numbers of fish through suffocation. Even when the algal bloom starts to dissipate, the natural breakdown of dead algae material by bacteria depletes additional oxygen from the water.
To learn more about business rules with Progress Corticon visit our website.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites