Data Event Formats - Streams
Summary
CWMS needs a message structure to notify clients of stream-related events.
Opinions
Opinion 1
Summary: Use the structures described below for stream-related events.
All messages will be published to the appropriate REALTIME_OPS topic. Subscribers can set up appropriate filters to receive the desired messages.
Author: Mike Perryman
Streams
Only values necessary to uniquely identify the stream (“type”, “stream_id”) are required for the StreamCreated, StreamUpdated, and StreamDeleted messages.
StreamCreated Message Structure
Message Type |
Structure |
||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
StreamCreated |
|
Example StreamCreated message
{
"type": "stream_created",
"stream_id": {
"office_id": "SPK",
"name": "American"
},
"station_unit": "ft",
"length": 100.0,
"average_slope": 0.01,
"stationing_starts_downstream": true,
"flows_into_stream": "Sacramento",
"flows_into_station": 50.0,
"flows_into_bank": "L",
"comments": "Fake information for testing purposes"
}
StreamUpdated Message Structure
Message Type |
Structure |
||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
StreamUpdated |
|
Example StreamUpdated message
{
"type": "stream_updated",
"stream_id": {
"office_id": "SPK",
"name": "American"
},
"station_unit": "ft",
"length": 100.0,
"average_slope": 0.01,
"stationing_starts_downstream": true,
"flows_into_stream": "Sacramento",
"flows_into_station": 50.0,
"flows_into_bank": "L",
"comments": "More fake information for testing purposes"
}
StreamDeleted Message Structure
Message Type |
Structure |
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
StreamDeleted |
|
Example StreamDeleted message
{
"type": "stream_deleted",
"stream_id": {
"office_id": "SPK",
"name": "American"
}
}
Stream Reaches
Only values necessary to uniquely identify a stream reach (“type”, “reach_id”), and values necessary to minimally describe a strean reach (“upstream_location_id”, “downstream_location_id”) are required for StreamReachCreated and StreamReachUpdated messages.
StreamReachCreated Message Structure
Message Type |
Structure |
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
StreamReachCreated |
|
Example StreamReachCreated message
{
"type": "stream_reach_created",
"reach_id": {
"office_id": "SPK",
"name": "American_Reach_1"
},
"stream_id": "American",
"upstream_location_id": "Amer_Riv_Pkwy",
"downstream_location_id": "Amer_Sac_Confluence",
"comments": "Fake information for testing purposes"
}
StreamReachUpdated Message Structure
Message Type |
Structure |
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
StreamReachUpdated |
|
Example StreamReachUpdated message
{
"type": "stream_reach_updated",
"reach_id": {
"office_id": "SPK",
"name": "American_Reach_1"
},
"stream_id": "American",
"upstream_location_id": "Amer_Riv_Pkwy",
"downstream_location_id": "Amer_Sac_Confluence",
"comments": "Fake information for testing purposes"
}
Only values necessary to uniquely identify a stream reach (“type”, “reach_id”) are required for StreamReachDeleted messages.
StreamReachDeleted Message Structure
Message Type |
Structure |
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
StreamReachDeleted |
|
Example StreamReachDeleted message
{
"type": "stream_reach_deleted",
"reach_id": {
"office_id": "SPK",
"name": "American_Reach_1"
}
}
Stream Locations
Only values necessary to uniquely identify a stream location (“type”, “location_id”), and values necessary to minimally describe a stream location (“station”, “station_unit”) are required for StreamLocationCreated and StreamLocationUpdated messages.
StreamLocationCreated Message Structure
Message Type |
Structure |
||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
StreamLocationCreated |
|
Example StreamLocationCreated message
{
"type": "stream_location_created",
"location_id": {
"office_id": "SPK",
"name": "American_R_Pkwy"
},
"stream_id": "American",
"station": 1.25,
"station_unit": "mi",
"bank": "L",
"lowest_measurable_stage": 7.3,
"stage_unit": "ft",
"drainage_area": 1234.5,
"area_unit": "mi2"
}
StreamLocationUpdated Message Structure
Message Type |
Structure |
||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
StreamLocationUpdated |
|
Example StreamLocationUpdated message
{
"type": "stream_location_updated",
"location_id": {
"office_id": "SPK",
"name": "American_R_Pkwy"
},
"stream_id": "American",
"station": 1.25,
"published_station": 1.25,
"station_unit": "mi",
"bank": "L",
"lowest_measurable_stage": 7.3,
"stage_unit": "ft",
"drainage_area": 1234.5,
"area_unit": "mi2"
}
Only values necessary to uniquely identify a stream location (“type”, “location_id”) are required for StreamLocationDeleted messages.
StreamLocationDeleted Message Structure
Message Type |
Structure |
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
StreamLocationDeleted |
|
Example StreamLocationDeleted message
{
"type": "stream_location_deleted",
"location_id": {
"office_id": "SPK",
"name": "American_R_Pkwy"
}
}
Decision Status
Status: request for comments