Driving Behavior Data Analysis in IoV Scenarios
Application Scenarios
- Description
In 2016, there were over 300 million vehicles around China, including over 14 million trucks, over 30 million commercial vehicles, and over one million fleets of different scales. The vehicles are under extensive management.
With the support of the IoV technology, enterprises and fleet managers can use the powerful analysis and mining capabilities of cloud computing and big data to manage fleets more scientifically and conveniently.
- Solutions Figure 1 Solutions
- Tasks
DLI can query the records of vehicle driving features based on the detail records and freight order data regularly reported by the freight forwarder.
- Data Types
- Detail records
Detail records include the regularly reported location records and data of alarms triggered by abnormal driving behavior.
Table 1 Detail records Field
Field Type
Field Description
driverID
string
Driver ID
carNumber
string
License plate number
latitude
double
Latitude
longitude
double
Longitude
speed
int
Speed
direction
int
Direction
siteName
string
Site name
time
timestamp
Report time of the records
isRapidlySpeedup
int
Whether the vehicle rapidly speeds up. 1 indicates that the vehicle suddenly speeds up, and 0 indicates that the vehicle does not.
isRapidlySlowdown
int
Whether the vehicle suddenly slows down.
isNeutralSlide
int
Whether the vehicle is coasting.
isNeutralSlideFinished
int
Whether vehicle coasting has stopped.
neutralSlideTime
bigint
Time length of vehicle coasting.
isOverspeed
int
Whether the vehicle is speeding.
isOverspeedFinished
int
Whether the vehicle stops speeding.
overspeedTime
bigint
Duration of the vehicle speeding
isFatigueDriving
int
Whether fatigue driving occurs.
isHthrottleStop
int
Whether the driver revs the engine in neutral.
isOilLeak
int
Abnormal oil consumption
- Order data
Order data refers to the records of freight orders.
Table 2 Order data Field
Field Type
Field Description
orderNumber
string
Order ID
driverID
string
Driver ID
carNumber
string
License plate number
customerID
string
Customer ID
sourceCity
string
Departure
targetCity
string
Destination
expectArriveTime
timestamp
Expected delivery time
time
timestamp
Time when a record is generated.
action
string
Event type, including creating an order, dispatching goods, delivering packages, and signing orders.
- Detail records
Process
To use DLI to analyze driving behavior data, you need to perform the following three steps:
Step 1: Registering an Account. Before the data analysis, register a public cloud account and perform real name authentication.
Step 2: Uploading Data. Upload the data to OBS.
Step 3: Analyzing Data. Use DLI to query the data.
Step 1: Registering an Account
Register a public cloud account and perform real name authentication.
For details about how to register an account, see Registering a HUAWEI ID and Enabling HUAWEI CLOUD Services.
For details about real-name authentication, see Real-Name Authentication Entry.
If you have registered a public cloud account and completed real-name authentication, skip this step.
Step 2: Uploading Data
- Download OBS Browser+. For details about the download address, see the Object Storage Service Tools Guide.
- Install OBS Browser+. For details about the installation process, see the Object Storage Service Tools Guide.
- Log in to OBS Browser+. OBS Browser+ supports two login modes: AK login (using access keys) or authorization code login. For details about the login process, see the Object Storage Service Tools Guide.
- Upload data using the OBS browser+.
On the OBS Browser+ page, click Create Bucket. Select a region and enter a bucket name (for example, DLI_demo). After the bucket is created, return to the bucket list and click DLI_demo. OBS Browser+ supports upload by dragging. You can drag one or more files or folders from a local path to the object list of a bucket or a parallel file system on OBS Browser+. You can even drag a file or folder directly to a specified folder on OBS Browser+.
Step 3: Analyzing Data
Use DLI to query the data for analysis.
- Creating a Database and a Table
- On the homepage of the HUAWEI CLOUD management console, choose Service List > EI Enterprise Intelligence > Data Lake Insight.
- Create a database named demo. On the DLI console, click SQL Jobs to go to the SQL Editor page.
- In the left pane of the SQL Editor, select
and click
to create a database. For details, see Figure 2.
The default database is a built-in database. You cannot create a database named default.
- Choose the demo database, and enter the following SQL statement in the editing box:
create table detail_records( driverID String, carNumber String, latitude double, longitude double, speed int, direction int, siteName String, time timestamp, isRapidlySpeedup int, isRapidlySlowdown int, isNeutralSlide int, isNeutralSlideFinished int, neutralSlideTime long, isOverspeed int, isOverspeedFinished int, overspeedTime long, isFatigueDriving int, isHthrottleStop int, isOilLeak int) USING CSV OPTIONS (PATH 'obs://DLI-demo/detail-records/');
Set the file path in the preceding statement to the actual OBS path where the detail records are stored.
- Click Execute to create the detail_records table. See Figure 3.
- Run the following SQL statements to create the event_records table in the demo database. The operation is similar to 1.d.
create table event_records( driverID String, carNumber String, latitude double, longitude double, speed int, direction int, siteName String, time timestamp, isRapidlySpeedup int, isRapidlySlowdown int, isNeutralSlide int, isNeutralSlideFinished int, neutralSlideTime long, isOverspeed int, isOverspeedFinished int, overspeedTime long, isFatigueDriving int, isHthrottleStop int, isOilLeak int)
- Run the following SQL statement to extract the alarm and event data from the detail records and insert it into the event_records table.
insert into table event_records (select * from detail_records where isRapidlySpeedup > 0 OR isRapidlySlowdown > 0 OR isNeutralSlide > 0 OR isNeutralSlideFinished > 0 OR isOverspeed > 0 OR isOverspeedFinished > 0 OR isFatigueDriving > 0 OR isHthrottleStop > 0 OR isOilLeak > 0)
- Click + next to Table to create the order_records table, for which Data Location is set to DLI. See Figure 4. Set the column types according to Order data.
- Import OBS data to the order_records table. Click Data Management, and unfold the demo database. Click Table Management, find the order_records table, and click Operation < More < Import. Set Data Source Path to obs://DLI-demo/order-records/. The default timestamp format is yyyy-MM-dd HH:mm:ss. To use other formats, select Advanced Settings and manually enter the desired format. Click OK. See Figure 5.
- Querying Data
- Run the following SQL statement to query the alarm events of all drivers in a certain time period. You can save the frequently-used query statements as templates that are available in the Template Management page for later use. For details, see Figure 6. Click Execute to switch to the SQL Editor page. You can query data easily by modifying the query statements.
select driverID, carNumber, sum(isRapidlySpeedup) as rapidlySpeedupTimes, sum(isRapidlySlowdown) as rapidlySlowdownTimes, sum(isNeutralSlide) as neutralSlideTimes, sum(neutralSlideTime) as neutralSlideTimeTotal, sum(isOverspeed) as overspeedTimes, sum(overspeedTime) as overspeedTimeTotal, sum(isFatigueDriving) as fatigueDrivingTimes, sum(isHthrottleStop) as hthrottleStopTimes, sum(isOilLeak) as oilLeakTimes from event_records where time >= "2017-01-01 00:00:00" and time <= "2017-02-01 00:00:00" group by driverID, carNumber order by rapidlySpeedupTimes desc, rapidlySlowdownTimes desc, neutralSlideTimes desc, neutralSlideTimeTotal desc, overspeedTimes desc, overspeedTimeTotal desc, fatigueDrivingTimes desc, hthrottleStopTimes desc, oilLeakTimes desc
- Run the following SQL statement to query the detailed record of a driver in a certain time period.
select * from event_records where driverID = "panxian1000005" and time >= "2017-01-01 00:00:00" and time <= "2017-02-01 00:00:00"
- Run the following SQL statement to query the order information.
select * from order_records where orderNumber = "2017013013584419488" order by time desc
- Run the following SQL statement to query a vehicle's driving feature according to the driver ID and time of departure.
select driverID, carNumber, latitude, longitude, siteName, time from detail_records where driverID = "zouan1000007" and time > "2017-01-30 16:00:00" and siteName IS NOT NULL order by time desc
- Run the following SQL statement to query the alarm events of all drivers in a certain time period. You can save the frequently-used query statements as templates that are available in the Template Management page for later use. For details, see Figure 6. Click Execute to switch to the SQL Editor page. You can query data easily by modifying the query statements.
Next Article: Consulting Service Data Analysis in Financial Industry





Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.