Internet of Things

IOT data is one very important aspect of eCommerce. Climatic conditions, weather, festive seasons, events etc. often significantly impact business operations.

Sometimes, it may not be always possible to plan for unplanned catastrophic events, but whenever data is available in advance, it always help tremendously in planning and provide huge opportunity for growth in revenue, branding and building relationships with customer.

Purpose of this section is, to use, weather | climatic | planned events data to help detect "Seasonality" in SARIMA ML Models in AI predictive analytics. (SARIMA : seasonal auto regression integrated moving average time series machine learning model).

We will use standard weather and news information from weather.com and NEW API websites.

below are few example datasets gathered via getPiper IOT device located in Los Angeles CA to support our analysis.

This section, assume, implanted IOT sensors or available API to capture vision, density, temperature, moisture, sound and activities.

not all IOT data mentioned below is used in our analysis.


events

using CSV, DataFrames
eventDF = DataFrame(CSV.File("../../assets/sampleData/eventCalendar.csv"))
first(eventDF[:, :], 10)

10 rows × 3 columns

CalendarDateDayOfWeekEvent
DateString3String
10022-01-01SATNew Year's Day
20022-01-17MONMartin Luther King Day
30022-01-17MONCivil Rights Day
40022-01-17MONIdaho Human Rights Day
50022-01-19WEDConfederate Heroes' Day
60022-01-27THUInternational Holocaust Remembrance Day
70022-02-01TUEBlack History Month
80022-02-01TUEChinese New Year
90022-02-14MONValentine's Day
100022-02-14MONArizona Statehood Day

holiday calendar

using CSV, DataFrames
calendarDF = DataFrame(CSV.File("../../assets/sampleData/calendar.csv"))
first(calendarDF[:, :], 10)

10 rows × 3 columns

HolidayDateEventDayOfWeek
DateStringString15
12022-01-01New Year's DaySaturday
22022-01-17Martin Luther King DayMonday
32022-01-24Belly Laugh DayMonday
42022-02-02Groundhog DayWednesday
52022-02-12Lincoln's BirthdaySaturday
62022-02-14Valentine's DayMonday
72022-02-21Presidents Day and Washington's BirthdayMonday
82022-03-01Mardi Gras CarnivalTuesday
92022-03-13Daylight SavingSunday
102022-03-17St. Patrick's DayThursday

temperature

Outside temperature

Sensors

##############################################
# outdoorTemp
##############################################
using DataFrames, CSV, Dates, Distributions
sampleSize = 365
weatherDF = DataFrame(
    recordDate = Date("2022-01-01", dateformat"y-m-d"):Day(1):(Date("2022-01-01", dateformat"y-m-d")+ Day(sampleSize-1)),
    cityId = 1:1:sampleSize,
    state = rand(["LA","LA","FL"], sampleSize),
    indoorTemp = rand(64:1:94, sampleSize),
    outdoorTemp = rand(54:1:104, sampleSize),
    wind = rand(5:1:30, sampleSize),
    humidity = rand(30:1:70, sampleSize),
    precipitation = rand(0:1:5, sampleSize)
    )
first(weatherDF[:, [:recordDate, :cityId, :state, :outdoorTemp]], 10)

10 rows × 4 columns

recordDatecityIdstateoutdoorTemp
DateInt64StringInt64
12022-01-011FL54
22022-01-022LA68
32022-01-033LA100
42022-01-044LA67
52022-01-055FL99
62022-01-066LA72
72022-01-077LA93
82022-01-088LA77
92022-01-099LA64
102022-01-1010FL94

Inside temperature

Sensors

##############################################
# inside temperature
##############################################
using DataFrames, CSV, Dates, Distributions
sampleSize = 365
weatherDF = DataFrame(
    recordDate = Date("2022-01-01", dateformat"y-m-d"):Day(1):(Date("2022-01-01", dateformat"y-m-d")+ Day(sampleSize-1)),
    cityId = 1:1:sampleSize,
    state = rand(["LA","LA","FL"], sampleSize),
    indoorTemp = rand(64:1:94, sampleSize),
    outdoorTemp = rand(54:1:104, sampleSize),
    wind = rand(5:1:30, sampleSize),
    humidity = rand(30:1:70, sampleSize),
    precipitation = rand(0:1:5, sampleSize)
    )
first(weatherDF[:, [:recordDate, :cityId, :state, :outdoorTemp]], 10)

10 rows × 4 columns

recordDatecityIdstateoutdoorTemp
DateInt64StringInt64
12022-01-011FL89
22022-01-022LA74
32022-01-033FL88
42022-01-044LA74
52022-01-055LA84
62022-01-066FL93
72022-01-077LA64
82022-01-088LA76
92022-01-099FL58
102022-01-1010FL103

moisture

Sensors

##############################################
# moisture
##############################################
using DataFrames, CSV, Dates, Distributions
sampleSize = 365
weatherDF = DataFrame(
    recordDate = Date("2022-01-01", dateformat"y-m-d"):Day(1):(Date("2022-01-01", dateformat"y-m-d")+ Day(sampleSize-1)),
    cityId = 1:1:sampleSize,
    state = rand(["LA","LA","FL"], sampleSize),
    indoorTemp = rand(64:1:94, sampleSize),
    outdoorTemp = rand(54:1:104, sampleSize),
    wind = rand(5:1:30, sampleSize),
    humidity = rand(30:1:70, sampleSize),
    precipitation = rand(0:1:5, sampleSize)
    )
first(weatherDF[:,[:recordDate,:cityId, :state, :humidity]], 10)

10 rows × 4 columns

recordDatecityIdstatehumidity
DateInt64StringInt64
12022-01-011FL32
22022-01-022FL66
32022-01-033LA43
42022-01-044LA66
52022-01-055LA66
62022-01-066LA41
72022-01-077LA48
82022-01-088LA54
92022-01-099LA33
102022-01-1010LA58

sound

Sensors

##############################################
# Noise / sound
##############################################
using DataFrames, CSV, Dates, Distributions
sampleSize = 365
weatherDF = DataFrame(
    recordDate = Date("2022-01-01", dateformat"y-m-d"):Day(1):(Date("2022-01-01", dateformat"y-m-d")+ Day(sampleSize-1)),
    cityId = 1:1:sampleSize,
    state = rand(["LA","LA","FL"], sampleSize),
    indoorTemp = rand(64:1:94, sampleSize),
    sound = rand(54:1:104, sampleSize),
    wind = rand(5:1:30, sampleSize),
    humidity = rand(30:1:70, sampleSize),
    precipitation = rand(0:1:5, sampleSize)
    )
first(weatherDF[:,[:recordDate,:cityId, :state, :sound]], 10)

10 rows × 4 columns

recordDatecityIdstatesound
DateInt64StringInt64
12022-01-011FL62
22022-01-022FL80
32022-01-033FL86
42022-01-044LA68
52022-01-055LA55
62022-01-066LA104
72022-01-077FL103
82022-01-088LA94
92022-01-099LA94
102022-01-1010FL68

activities

motion activities

Sensors

##############################################
# motion activities
##############################################
using DataFrames, CSV, Dates, Distributions
sampleSize = 365
weatherDF = DataFrame(
    recordDate = Date("2022-01-01", dateformat"y-m-d"):Day(1):(Date("2022-01-01", dateformat"y-m-d")+ Day(sampleSize-1)),
    cityId = 1:1:sampleSize,
    state = rand(["LA","LA","FL"], sampleSize),
    indoorTemp = rand(64:1:94, sampleSize),
    sound = rand(54:1:104, sampleSize),
    shadows = rand(5:1:30, sampleSize),
    humidity = rand(30:1:70, sampleSize),
    precipitation = rand(0:1:5, sampleSize)
    )
first(weatherDF[:,[:recordDate, :cityId, :state, :shadows]], 10)

10 rows × 4 columns

recordDatecityIdstateshadows
DateInt64StringInt64
12022-01-011FL30
22022-01-022LA6
32022-01-033FL29
42022-01-044FL23
52022-01-055FL14
62022-01-066FL16
72022-01-077FL12
82022-01-088LA17
92022-01-099LA10
102022-01-1010LA25

density / vision

Capturing crowd density varies case by case. For example, In case of, organized gatherings like Theme parks, concerts etc. number of people attending the event can be predicted in advance.

However, at the same, number of people entering, leaving and present at a given time is very important. Most of the chaos, happens when too many people appear at a place at the same time. for example, people entering / leaving premises.

Sensors Sensors

Reference

other option is, Density will calculated using vision AI, captured through a motion camera / CCTV footage.

Sensors


visibility

Brightness

Sensors


news