56
Building a System of Engagement with MongoDB { Name: ‘Bryan Reinero’, Title: ‘Developer Advocate’, Twitter: ‘@blimpyacht’, Email: [email protected] ’ }

Powering Systems of Engagement

  • Upload
    mongodb

  • View
    597

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Powering Systems of Engagement

Building a System of Engagement with MongoDB

{ Name: ‘Bryan Reinero’,Title: ‘Developer Advocate’,

Twitter: ‘@blimpyacht’,Email: ‘[email protected]’ }

Page 2: Powering Systems of Engagement

2

Systems of Engagement

• Real-Time • Context-Aware• Encourage

Interaction• Embedded in

Business Systems

Page 3: Powering Systems of Engagement

3

Systems of Engagement

• Context rich and User Relevant Interactions

• Integrates data from many systems

• Integrates Analytics

Page 4: Powering Systems of Engagement

4

The Importance of Engagement

• 74% Consumer would respond positively to companies that understand them

• 57% Would recommend the company• 29% Would make additional purchases

2013 Experian study

Page 5: Powering Systems of Engagement

5

• 84% Would walk away from a non-responsive company• 45% from a company that contacted them when they had asked

not to• 52% Would leave a company that tries to sell them something

they already said they weren't interested in

The Importance of Engagement

2013 Experian study

Page 6: Powering Systems of Engagement

6

• 84% Would walk away from a non-responsive company• 45% from a company that contacted them when they had asked

not to• 52% Would leave a company that tries to sell them something

they already said they weren't interested in

The Importance of Engagement

How is the application of value to the user?

Page 7: Powering Systems of Engagement

7

Page 8: Powering Systems of Engagement

8

Department of Veterans Affairs

20+ million Veterans in the US today

Doctors need a single view of a patient’s health record.What happens when a patient has to change their address?

Page 9: Powering Systems of Engagement

9

Customer Single View

• Understand customer relationships

• Improves customer experience • Develops effective customer

marketing• Improves product

Page 10: Powering Systems of Engagement

Requirements

• High performance requirements• Increasingly large datasets• High Availability

Page 11: Powering Systems of Engagement

11

Architecture

Systems of EngagementD

ata

Serv

ices

Systems of Record

Master Data

Raw Data

Integrated Data

ETLrecord

record

record

Page 12: Powering Systems of Engagement

12

Aggregating a Single View

Single customerVIEW

Page 13: Powering Systems of Engagement

13

Aggregating a Single View

Common Data

Source Metadata

Source Data A

Source Data B

Page 14: Powering Systems of Engagement

14

Aggregating a Single View

Common Data

Source Metadata

Source Data A

Source Data B

{ _id: <hash>, address: {

num: 860,street: “Grove”,city: “San Francisco”,state: “CA”,zip:

}}

Page 15: Powering Systems of Engagement

15

Aggregating a Single View

Common Data

Source Metadata

Source Data A

Source Data B

{ sources: [ { source: “URI”, updated: ISODate(), },

… ]}

Page 16: Powering Systems of Engagement

16

Aggregating a Single View

Common Data

Source Metadata

Source Data A

Source Data B

Shopping Cart,Purchase history,Prescriptions,Medical History,

Page 17: Powering Systems of Engagement

17

Multiple Data Sources

• Wearable Devices• Embedded Systems• Internet of Things

Page 18: Powering Systems of Engagement

The Point of Engagement

Page 19: Powering Systems of Engagement

19

The Scavenger Hunt App

Users create scavenger hunts by “pinning” waypoints

Page 20: Powering Systems of Engagement

20

The Checkpoint Document

{_id: ObjectId(),user: UUID,huntId: UUID,timestamp: ISODate(), geometry: {

type: "Point",coordinates: [125.6,

10.1]}

}

Page 21: Powering Systems of Engagement

21

The Checkpoint Document

{_id: ObjectId(),user: UUID,huntId: UUID,timestamp: ISODate(), geometry: {

type: "Point",coordinates: [125.6,

10.1]}

}

db.checkpoints.ensureIndex(timestamp: -1,geometry: “2dsphere”

);

Page 22: Powering Systems of Engagement

22

The Checkpoint Document

db.checkpoints.find({ date: {$gt: <10mins ago> } geometry: { $near:{ { type : "Point" , coordinates : [ -173, 40.7 ] }, $maxDistance : 100 }}});

{_id: ObjectId(),user: UUID,huntId: UUID,timestamp: ISODate(), geometry: {

type: "Point",coordinates: [125.6,

10.1]}

}

Page 23: Powering Systems of Engagement

23

The Scavenger Hunt App

Business Requirements• Location Based

Targeting• Enable Social

Interactions• Recommendations

Page 24: Powering Systems of Engagement

24

Waypoint{ _id: ObjectId(), name: "Doug’s Coffee", desc: "The best brew", offers: [ ”Morning rush hour discount",

”Order ahead with our app",”Start your digital frequent

flyer card" ], "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }};

Page 25: Powering Systems of Engagement

25

Waypoint{ _id: ObjectId(), name: "Doug’s Coffee", desc: "The best brew", offers: [ ”Morning rush hour discount",

”Order ahead with our app",”Start your digital frequent

flyer card" ], "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }};

Page 26: Powering Systems of Engagement

26

Waypoint{ _id: ObjectId(), name: "Doug’s Coffee", desc: "The best brew", offers: [ ”Morning rush hour discount",

”Order ahead with our app",”Start your digital frequent

flyer card" ], "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }};

Geospacial Index:ensureIndex( { geometry: “2dsphere” } )

Page 27: Powering Systems of Engagement

27

The Checkpoint Document

{_id: ObjectId(),user: UUID,huntId: UUID,timestamp: ISODate(), geometry: {

type: "Point",coordinates: [125.6,

10.1]}

}

Page 28: Powering Systems of Engagement

28

The Checkpoint Document

{_id: ObjectId(),user: UUID,huntId: UUID,timestamp: ISODate(), geometry: {

type: "Point",coordinates: [125.6,

10.1]}

}

db.checkpoints.ensureIndex(timestamp: -1,geometry: “2dsphere”

);

Page 29: Powering Systems of Engagement

29

The Checkpoint Document

db.checkpoints.find({ date: {$gt: <10mins ago> } geometry: { $near:{ { type : "Point" , coordinates : [ -173, 40.7 ] }, $maxDistance : 100 }}});

{_id: ObjectId(),user: UUID,huntId: UUID,timestamp: ISODate(), geometry: {

type: "Point",coordinates: [125.6,

10.1]}

}

Page 30: Powering Systems of Engagement

30

Geo Targeting

Page 31: Powering Systems of Engagement

31

Geo Targeting

{ "type": "Polygon", "coordinates" : [ [ [ -73.969581, 40.760331 ], [ -73.974487, 40.762245 ], [ -73.977692, 40.763598], [ -73.979508, 40.761269 ], [ -73.982364, 40.762358 ], [ -73.983692, 40.760497 ], [ -73.972821, 40.755861 ], [ -73.969581, 40.760331 ] ] ]}

Defines a business service area

Page 32: Powering Systems of Engagement

32

$geoIntersects

{ $geoIntersects: { $geometry: { "type": "Point", "coordinates": [ -73.975010, 40.760071 ] } } }

Page 33: Powering Systems of Engagement

33

Defining Service Areas

Data Driven Decisions• Find users within a given area• Intersections with multiple service areas• Fraud detection• Where are my competitors located

Page 34: Powering Systems of Engagement

Social Interactions

Page 35: Powering Systems of Engagement

35

Social Interactions

Requirements• Allow users to follow one

another• Allow users to exchange

messages • Send users notifications

Page 36: Powering Systems of Engagement

36

Social Interactions

Eratosthenes

Democritus

Hypatia

Shemp

Euripides

Graph modelsPersonal RelationshipsRecommendation Engines

Page 37: Powering Systems of Engagement

37

Social Interactions

Followers Collection{ follower: ‘Shemp’, followed: ‘Euripides’},{ follower:‘Shemp’, followed: ’Eratosthenes”},{ follower: “Eratosthenes’, followed: ‘Shemp’ },…

Eratosthenes

Democritus

Hypatia

Shemp

Euripides

Page 38: Powering Systems of Engagement

38

Social Interactions

Eratosthenes

Democritus

Hypatia

Shemp

Euripides

Followers Collection{ follower: ‘Shemp’, followed: ‘Euripides’},{ follower:‘Shemp’, followed: ’Eratosthenes”},{ follower: “Eratosthenes’, followed: ‘Shemp’ },…

! (Euripides -> Shemp )

Page 39: Powering Systems of Engagement

39

Social Interactions

db.followers.find( { follower:‘Shemp’ } );

Followers Collection{ follower: ‘Shemp’, followed: ‘Euripides’},{ follower:‘Shemp’, followed: ’Eratosthenes”},{ follower: “Eratosthenes’, followed: ‘Shemp’ },…

Page 40: Powering Systems of Engagement

Notifications

Page 41: Powering Systems of Engagement

41

Personal Timeline / Hotlist

{

_id: UUID,

user: ”Democritus",

hotList" : [

{

message: "New scavenger hunt tomorrow!",

url: "http://bit.ly/1hKn9ff",

date" : ISODate()

},

{

message: "Get 50% off at Toga City",

url: "http://bit.ly/1KnlFHQ",

date: ISODate()

}

],

atime: ISODate("2015 03 13T04:38:43.606Z")

}

Page 42: Powering Systems of Engagement

42

Personal Timeline / Hotlist

Notifications of highest user relevance

{

_id: UUID,

user: ”Democritus",

hotList" : [

{

message: "New scavenger hunt tomorrow!",

url: "http://bit.ly/1hKn9ff",

date" : ISODate()

},

{

message: "Get 50% off at Toga City",

url: "http://bit.ly/1KnlFHQ",

date: ISODate()

}

],

atime: ISODate("2015 03 13T04:38:43.606Z")

}

Page 43: Powering Systems of Engagement

43

Write to Bucket

Parameters• User

db.user.update( {"user" : "Democritus"}, {$push: { hotList: { $each:

[ { o: 10, <MESSAGE> }, { o: 7, <MESSAGE> }, … ], $sort: { o: -1 },

$slice: 50 } }});

Page 44: Powering Systems of Engagement

44

Write to Bucket

Parameters• user• $push append to end of hotList array

db.user.update( {"user" : "Democritus"}, {$push: { hotList: { $each:

[ { o: 10, <MESSAGE> }, { o: 7, <MESSAGE> }, … ], $sort: { o: -1 },

$slice: 50 } }});

Page 45: Powering Systems of Engagement

45

Write to Bucket

Parameters• user• $push append to end of hotList array• $each list of message elements

db.user.update( {"user" : "Democritus"}, {$push: { hotList: { $each:

[ { o: 10, <MESSAGE> }, { o: 7, <MESSAGE> }, … ], $sort: { o: -1 },

$slice: 50 } }});

Page 46: Powering Systems of Engagement

46

Write to Bucket

Parameters• user• $push append to end of hotList array• $each message in array• $sort the resulting array in descending order

db.user.update( {"user" : "Democritus"}, {$push: { hotList: { $each:

[ { o: 10, <MESSAGE> }, { o: 7, <MESSAGE> }, … ], $sort: { o: -1 },

$slice: 50 } }});

Page 47: Powering Systems of Engagement

47

Write to Bucket

Parameters• user• $push append to end of hotList array• $each message in array• $sort the resulting array in descending order• $slice include only the first 50 elements

db.user.update( {"user" : "Democritus"}, {$push: { hotList: { $each:

[ { o: 10, <MESSAGE> }, { o: 7, <MESSAGE> }, … ], $sort: { o: -1 },

$slice: 50 } }});

Page 48: Powering Systems of Engagement

Analytics

Page 49: Powering Systems of Engagement

49

Analytics

• Behavioral analytics• Segmentation• Fraud detection• Prediction• Pricing analytics• Sales analytics

Page 50: Powering Systems of Engagement

50

Analytics

Systems of EngagementD

ata

Serv

ices

Data Processing Integration, Analytics, etc.

Systems of Record

Master Data

Raw Data

Integrated Data

ETLrecord

record

record

Page 51: Powering Systems of Engagement

51

MongoDB as an Operational Store

Application Server

Other DBMS

& Legacy systems

Page 52: Powering Systems of Engagement

Data Capture

Page 53: Powering Systems of Engagement

53

Capture Data Changes

Systems of EngagementD

ata

Serv

ices

Data Processing Integration, Analytics, etc.

Systems of Record

Master Data

Raw Data

Integrated Data

ETL

Bus

Apache Kafka

record

record

record

Page 54: Powering Systems of Engagement

54

Many Complexities to Tackle

• Data modeling• Data Extraction (ETL)• Change Data Capture (CDC)• Data Governance• Data Lineage• Security

Page 55: Powering Systems of Engagement

55

How is the application of value to the user?

Page 56: Powering Systems of Engagement

Thanks!

{ Name: ‘Bryan Reinero’,Title: ‘Developer Advocate’,

Twitter: ‘@blimpyacht’,Email: ‘[email protected]’ }