Crime Journey

For this section, we will use Crime Journey as the example to show how to use TIBCO Cloud Integration(TCI) to integrate your own car plate detection model with Project Journey. This tutorial will guide you to build the following architecture.

crime architecture

When you witness a crime and report the car plate number on the liveapp, it would trigger the car plate detection model to find the criminal’s car then send the car information to the dashboard. The dahboard will show the camera’s captured video then identify the criminal’s escaping route, also display the criminal’s relationships by graph for investigation.

In the healthcare journey, we already showed you how to custom your own tgdb and spotfire mods. For this tutorial, we will use pre-built components in GitHub and focus on how to integrate them to create the crime journey.

1. Build the flogo application in TCI

a. Run the script and type the connection information to create the flogo application from template. Since we would co-locate the car plate simulator container with tgdb instance, so type the tgdb domain name as car plate simulator endpoint url. The TCM url will be in the tcm-config.yaml file which you downloaded from TCM portal -> Authentication.

cd labs-journey/src/journey_tci
sh install.sh

b. After running the script, the flogo.json would be created in journey_tci folder.
c. Go the the TCI portal, click Create/Import button on the top right.

crime flogo import

d. Select Messaging/Event-base Integration on the left menu, then click Create Flogo App crime flogo import

e. Click Import App crime flogo import

f. Drag and drop your flogo.json then click Upload and click Import. crime flogo import
crime flogo import

g. Now, we need to modify some configuration. Click the Connections on the top menu then click Create
crime flogo import

h. Select the TIBCO Cloud Messaging eFTL Connection
crime flogo import

i. Type the connection information accordind to your tcm-config.yaml then save crime flogo import

j. Back to the App and find your flogo application, then click the flow car_plate_processor
crime flogo import

k. Replace the 2 connections in flogo with the one you just created then save
crime flogo import
crime flogo import
crime flogo import

l. Verify the flogo then click Push. you will see the status is deploying
crime flogo import

m. Scale the instance from 0 to 1 to run the flogo
crime flogo import

n. Check the flogo app is workable by launch configuration
Click into the addCarPlateNumber flow
Click the Test button on the top right
crime flogo test

Create a new launch configuration for testing
crime flogo test

Type the content for each variable under body
e.g.

id = “30A61235”
manufacturer = “honda”
model = “speed”
color = “red”
caseRef = “c00004”

crime flogo test

Click Run then check the return code is 200 in log
crime flogo test

o. Set the enpoint visibility to TIBCO Cloud Mesh, click Update
crime flogo import
crime flogo import

p. Set the deployment stage, click set as live
crime flogo import
crime flogo import

q. The flogo status would like the picture below

crime flogo import

Now, leave it first, we will back to change liveapp configurations after we build the liveapp.

2. Build the liveapp

a. Go the the TIBCO Live App Designerr portal and click New application
crime liveapp

b. Select Case Data and follow the configuration below to create Data Field
crime liveapp

Id
crime liveapp
crime liveapp

CaseType
crime liveapp
crime liveapp

CaseDesc
crime liveapp

City
crime liveapp

Country
crime liveapp

Latitude
crime liveapp

Longtitude
crime liveapp

State
crime liveapp

Street
crime liveapp

PostCode
crime liveapp

CarPlateNumber
crime liveapp

c. Go to the States and add the states as below. Only the Expired is end state, others are all active state crime liveapp

d. Go to the Application and follow the configurations below to create actions
crime liveapp

Create Data Journey

Click Edit on the initiate task and configure the Form and Exit state
crime liveapp
crime liveapp

Drag a Task named InsertRecord and link with initiate task
crime liveapp

Configure the following information. For serice, please select the flogo application you publish and specify the addCarPlateNumber

crime liveapp
crime liveapp
crime liveapp
crime liveapp
crime liveapp

CloseCase

crime liveapp
crime liveapp

CollectEvidence

crime liveapp
crime liveapp

UpdateCase

crime liveapp
crime liveapp

UpdateState

crime liveapp
crime liveapp

e. Test it and lock for publish, then you can go to Application Admin to publish
crime liveapp
crime liveapp

3. Back to flogo to configure your liveapp

a. Stop the running flogo by scale down the instance from 1 to 0 crime liveapp

b. Modify 3 liveapp configuration in car_plate_processor flow and save crime liveapp
crime liveapp
crime liveapp
crime liveapp

c. Scale up the instance from 0 to 1 again to run the flogo crime liveapp

3. Build the Spotfire Data Stream

a. Go to the TIBCO Cloud Spotfire Data Stream, click Create new crime data stream

b. Configure with the following information, your TCM connection information would be in tcm-config.yaml crime data stream
crime data stream
crime data stream
crime data stream
crime data stream crime data stream

c. Start your Data stream and you will see the status turn to Running crime data stream
crime data stream

4. Start the Crime journey backend

Install Crime journey backend on the tgdb server

cd labs-journey/src/journey_backend
sh install

Check the containers run successfully

docker container ps -a

crime backend

5. Start the Crime journey mods

There are 2 mods we would use, one is for graph visualization, the other is for captured video. Start graph mods with your instance information and specify one of journey.

cd labs-journey/src/journey_mods
sh start_mods_server.sh

crime mod
Then, open another tab and start the video mod

cd labs-journey/src/journey_mods
sh start_video_mods_server.sh

Note: The port number would be different for video mod since the graph mod is running on 9001 crime mod

6. Build the Spotfire Dashboard

You would build the dashboard base on the template in GitHub. Using Spotfire Desktop to change the data connection in formation then using TIBCO Cloud Spotfire to add the mods.

a. Download the template and open it by Spotfire Desktop on the Window machine.

b. Modify the connection information of TGDB, Data Stream and LiveApp in Data connection properties crime dashboard crime dashboard

c. Check all components in the dashboard used your own sources(TGDB, Data Stream, LiveApp)

d. Save it as dxp

e. Go to the TIBCO Cloud Spotfire and upload the dxp file

f. Add the graph mod and video mod to the dahsboard.(two mods are running on different ports)
For the detail of adding mods, please reference this getting started section. If the graph or video do not show successfully, please follow the Troubleshooting section to check the certification.

crime dashboard

7. Start the Crime journey UI

You would use TIBCO Cloud Composer to pack all components into one application.
Run the start_journey_ui.sh with your connection information

cd labs-journey/src/journey_ui/
sh start_journey_ui.sh

crime ui
The sucessful message would show as below
crime ui

8. Test the Crime journey

a. Open the Crime journey ui on browser(e.g. https://localhost:4200)
b. Turn on the simulator on the top right
crime ui

c. Create a crime case
e.g.
CaseType = “Transportation Violation”
CaseDesc = “Speeding”
CarPlateNumber = “30A61235”
crime ui

d. The car which matched the reported car plate number would be detected. The crime escape route, captured video, and the criminal relationships graph would show on the dahsboard instantly.
crime verification


Last modified May 17, 2022: update src and doc (86fdab08)