Create a Streaming Application Solution to Manage Real-time Traffic

Create a Streaming Application Solution to Manage Real-time Traffic


You can monitor and manage real-time
traffic with Oracle Stream Analytics platform. It runs on a big data stack,
powered by spark streaming and kafka messaging runtime. From your Oracle
Integration Cloud home page, click Streams, and then click the user profile.
Now, click System Settings to verify the kafka zookeeper connection and runtime
server details in the Environment tab and click the Analytics tab to verify
the analytic settings. A few of the artefacts comprising the base stream of
transport data that you will create and use to build the solution are: public
transport buses with individual speed, highways used, and assigned drivers; the
connection that defines the underlying configuration for accessing your
database kafka topics; and a map artefact describing the geofence areas of
interest, in this case around Atlanta. Now, create a pipeline to solve the business
problem by clicking Create New Item, and then click Pipeline. Provide a Name, a
useful Description, and tags for searching artefacts later in the catalog.
Select Transport Stream as the streaming data and click Save. The newly created
pipeline is displayed in the pipeline editor. Next, add a spatial analytics
stage to identify the vehicles that are within the Atlanta area. To do this, click
Add a Stage and select Pattern. Then, select Geofence filter. Provide a Name
and a Description of the stage, save it, and then provide the parameters of the
geofence, such as, name, latitude, longitude, and object key. The map displays the
desired results. Next, click Add a Stage, select Query
provide its Name and Description, and click Save. In the Filters tab, click Add
a Filter. If you want to ignore vehicles that aren’t moving, set the filter to
match Bus underscore Speed that is greater than zero. In the Sources tab, click
the timer icon and select the Range and Evaluation frequency as ten seconds. In
the Summaries tab, click Add a Group by, click Add a Field, and select Bus Trip ID.
Then, enable Retain All Columns, click Add a Summary and set it as AVG Bus
underscore Speed to indicate average of the Bus Speed. We can change the live
output stream column names. For example, right-click AVG Bus underscore Speed and
Bus trip ID, select Rename, and change the names of these columns to AVG Speed and
Bus ID respectively. Now, click the Expression Editor icon on the live
output table and enter No underscore Violation in the Expression Editor field.
Then, click the Apply icon to apply the changes. Right-click the calc column and
rename it to violation. Next, add a business rule stage to specify the
different speeding limits. To do that, click Add a Stage, select Rule, provide
its Name and Description, and Save it. Now, provide the name of the first rule as DFLT underscore HWY to indicate default highway rule. Provide its Description and
click Done. Next, set IF clause to Bus underscore HWY to equals blank to
indicate that the bus highway is blank. And set the THEN condition as Bus
underscore HWY to UNKNOWN. All the highways that do not have names will be
tagged as unknown. Add rules for Reckless, Major and Minor driving violations in
the same way. Now you can add some cool visualisations
to the pipeline. Select the Visualisations tab in the Speed
Violation stage. Click Add a Visualisation, and then select Geospatial. Provide the
Name and Description of the visualisation; and specify latitude,
longitude, and key fields as bus lat bus long and bus trip ID. In the
Customizations tab, click the plus icon; and then provide orange purple and green
color coding for reckless, major, and minor violations respectively.
Select Save as Slice for future reference and click Create. Here, the various
vehicle positions and speeds can be observed on a configurable focused map
view. You can add another bar chart visualisation to the Default Highway
business rule. To do that, click the DFLT underscore HWY rule, select the
Visualisations tab, click Add a Visualization, and then select Bar Chart.
Provide the Name, Description, Value for Y-axis and its Label, value for X-axis and
its Label, select Save as a Slice for future reference, and click Create. For
each Highway, the live output stream displays the average speeds. The lower
the average speed, the greater the possibility of congestion. Now, you can
create a Target for the pipeline. To do that, click Target from the pipeline,
click create, provide Name, Description Tags, select Target Type as Kafka, and
click Next. In the Target Details tab, select the Connection as Transport
Analysis, and enter the Topic Name as Transport Analysis, and then click Next.
In the Shape tab, select Manual Shape, verify the Field Type and the Field
Paths, and then click Save. Make sure that the required columns are
correctly mapped, so that the live output stream shows the required information.
Remember, only published pipelines can start streaming the event results as
needed. To enable that, click Publish, accept the default application settings
as required, and click Publish again to build the final pipeline and redeploy
it to this spark runtime. With that completed, the catalog will show the
visualisation chart slices created earlier. So there we have it, a complete
end-to-end vehicle monitoring and management
analysis solution, built not in weeks or days, but in minutes. Find out more at
cloud dot oracle dot com.

Leave a Reply

Your email address will not be published. Required fields are marked *