Data Warehousing by Example
Data Warehousing by Example
|1
Barry Williams
|2
2. The Approach
............................................. 3
3. Data Warehouse for a Football Club ................ 9 4. BI on the Beach ........................................... 16 5. A Day at the Olympics ................................... 24 6. Holiday in Malaysia ....................................... 41 7. Retail Sales 8. Retail Banks ......................................... 125 ......................................... 141
9. Industry Data Models ................................. 155 10. Generic Data Models ................................. 165 11. Conclusion
1. Why ?
The purpose of this document is to present our Best Practice approach to Data Warehouse design based on more than 15 years experience. We are publishing it on Kindle, as cheaply as possible, in order to encourage constructive criticism so that we can improve the book. We would be very glad to have your comments at [email protected]. After 5 years ago, a teacher emailed me to say that his students found my Data Models boring and were falling asleep in class !!! At that point, I was in the habit of using Amazon and Starbucks as examples of Customers and Order Processing so that everybody could find them easy to relate to. However, I began to wonder how I could make them more interesting and still easy to relate to. My conclusion was that I could take everyday events to use as examples. That is why I have used Football, Malaysia and the Olympics. Of course, a holiday in Malaysia is not something we do every day, and Olympics is not an everyday event ;-0)
......................................... 173
|3
2. The Approach
In this Section we will discuss our Approach to the design of an Enterprise Data Model with associated Data Warehouses and how it applies to a Day at the Olympics and a Holiday in Malaysia. 2.1 Data Architecture This Architecture supports Data Migration into an Enterprise Data Warehouse to meet BI requirements. It shows the major Layers in an End-to-End Architecture for Data Migration from Data Sources, into a Data Warehouse and finally to a BI Layer to deliver data to the end-user.
|4
A Data Warehouse can be either a Third-Normal Form (3NF) Data Model or a Dimensional Data Model, or a combination of both. One benefit of a 3NF Data Model is that it facilitates production of A Single Version of the Truth. Multiple Data Marts will usually share common Dimensions, such as Dates, which we will call Conformed Dimensions. 2.3 Steps When all the Steps have been completed, Best Practice suggests that each item produced should be reviewed and extended or modified as appropriate. This includes the EDM, CDM, Subject Area Models, Canonical Data Models and Canonical Entities. In this way, the library of existing work is confirmed in its accuracy and relevance.
Step 1 : Draft the Enterprise Data Model (EDM)
Start by reviewing the list of candidates on the Database Answers Web Site : http://www.databaseanswers.org/data_models/enterprise_data_models.htm
|5
Typical Documents could be : A Sales Receipt A Bill of Lading A Contract A Delivery Note
People and Organisations are examples of the Roles played by Parties. Parties are often shown in Models produce d by professional Data Models. In that case, Best Practice usually dictates that Semantic Models are produced to help business users understand how Customers and so on, are modelled as Parties and Roles.
An early example of the use of the Canonical Data Model (CDM) is to map data from Data Sources to the EDM. This is a good opportunity to review the design of both the CDM and the EDM. You can see examples of how this works in practice in the Chapters on A Day at the Olympics and A Holiday in Malaysia. The current list of top-level Entities that feature in the CDM includes : Documents, Events, Locations, People Products, Organisations, Roles, Services
A Party Entity is implied but does not appear at the top-level to simplify the layout of the CDM.
|6
2.4 Development Framework Our Framework contains two elements :1. The Development Approach 2. Components used in the Framework The Approach involves these Steps :1. Identify the business Events 2. Define a Message for each Event 3. Map each Event to the Entities and Attributes in the CDM 4. Determine whether the CDM should be extended. 5. Create an Industry-specific CDM if appropriate. The Components include : Generic and Industry-specific Canonical Data Models (CDMs) Generic and Industry-specific Data Warehouse designs Core Entities and Core Subject Area Models Customers, Products and Suppliers. The rest of this Section is a Case Study for a Retail business Subject Area Models : Generic (Horizontal) Industry-specific o
o
|7
This shows the components used in the design of an Enterprise Data Model (EDM) with associated Subject Area Models, based on Industry-specific Models. Each Data Source is reviewed against the Canonical Data Model and the appropriate Messages formats are defined. Then the data in the Message is mapped to the Enterprise and Industry-specific Models. The current Enterprise Data Models are defined on this page of the Database Answers Web Site : http://www.databaseanswers.org/data_models/enterprise_data_models.htm
Messages
Data Sources
(eg Sales Receipts)
|8
2.5.2 Steps in the Process Step 1. Create the draft EDM. 1. Review the Mission Statement in the Clients organisation 2. Talk to users and produce a Statement of Business Objectives 3. Look at the organizations Web Site 4. Establish BI Requirements, KPIs and so on. 5. Draft Life Cycles of Events, Customers, Products, others.
Compare your Draft with the off-the-Shelf Enterprise Data Models on this Page : http://www.databaseanswers.org/data_models/enterprise_data_models.htm
Step 2. Identify the Subject Areas in the EDM. Look for matches with the list on this Page : http://www.databaseanswers.org/data_models/subject_area_data_models.htm
Step 3. Check Generic Data Models Check out the list of Generic Data Models and Design Patterns on this Page : http://www.databaseanswers.org/data_models/generic_data_models.htm
Step 4. Review the Canonical Data Model Determine whether the Subject Area Models are compatible with the Canonical Data Model on this Page : http://www.databaseanswers.org/data_models/canonical_data_models/index.htm
|9
3.1 Starting with the Basics We start by repeating a simple approach to designing a Database. Then we follow with an example of a Dimensional Model and two Data Marts, sharing Conformed Dimensions. Our simple approach consists of just these three simple rules : Identify the things we are Interested in Decide how they are related Establish what else we know about them.
Rule number 1. Identify the things we are Interested in We decide these are Clubs, Players and Games and show them as Entities like this :-
We decide that Clubs employ Players and play Games against other Clubs. So in a Data Model it begins to look like this :-
So far so good - except that when we think about how this works in practice, we realise that not all Players play in every Game. Therefore we need a more flexible way of identifying which players play in each Game.
| 10
But changes are possible and to provide for these changes, we need to identify the position each Player plays in during each Game. When we think about Positions, we realise that there are a small number of predefined Positions and therefore, we should prefix the 'Positions' Entity name by 'Ref_' to establish that this is Reference Data. So our Business Rules become :Clubs employ Players who play in Games against other Clubs. The specific Players and their Position in each Game will be decided before each Game So the Things of Interest now look like this :-
The additional data items that we know about the Entities is shown in this 3NF Data Model which shows all Attributes. Lets discuss what we know about Clubs :1.Because our Clubs entity refers to all Clubs, both ours and others, we need to identify our Club. Therefore, we add a data item called Our_Home_Team_YN which we set to either Y or N as appropriate. We will always want to record the Club Name, and we will usually want to know the Manager, and the Club Colours, and perhaps a description, such as the history of the Club. To allow for future work, we include a data item called Other_Details. In passing, lets point out that we follow a certain order to the appearance of these items in the Entity definition so as to help us in simply having a consistent layout on all our Data Models. We show Keys and Flags (such as YN values) at the beginning, with all other items listed alphabetically. The additional items in the other Entities follows similar thinking.
| 11
| 12
3.2 A Dimensional Model We can now define our first draft of the Dimensional Model, which looks like this :-
3.3 Data Marts with Conformed Dimensions We can also create an alternative design, based on two Data Marts with Conformed Dimensions. In this approach we separate the data in the Dimensional Model into Games and Players and each has its own Data Mart. Then we identify the Dimensions that they share and show them between the two Data Marts. We call these 'Conformed Dimensions' because the values have to conform to the same values in each Data Mart. If they do not, then the values cannot be used to join Data Sets and any analysis from the two Data Marts would produce inconsistent the results. Putting it differently, if the shared dimensions are not Conformed then our work as Data Warehouse designers and BI specialists would be completely wasted and we should take up a different line of work. The best and simplest example of a Conformed Dimension is dates, which we show in a Calendar. In passing, I call my Calendar entity 'Ref_Calendar' to emphasise the fact that it is Reference Data.
| 13
The granularity of data involving time must be the same. For example, daily results cannot be compared rom two Marts if data is not stored at daily level in both Marts. Dates in a calendar are an example of Master Data, and by definition, Master Data will always be Conformed Dimensions because they represent one consistent value across an organisation. In our case, we can use the Games Data Mart to obtain statistics about the Club and its standing in the League. The Players Data Mart, of course, would be used to obtain individual statistics about our favourite players and to identify, for example, who is the most prolific scorer.
3.4 Enquiries using the Data Marts A typical Enquiry would be :What are the standings today ? To respond to this enquiry, we need a list of Teams with names, and shown in order of Points scored. Points are obtained for the result of each Game : A Win scores three points A Draw scores two points A Loss scores zero points
This is how it is shown on the BBC Web Site at 8 pm on Saturday, February 9th. 2013 :-
| 14
This is the data that we need to produce these statistics, listed by Number of Point, in descending order : Club Name Where the Game Date is from the start of the season up to the present. Number of Points where each Win Result Code = 3, Draw=2 and Loss=0
In order to introduce an analytical Framework, we can define a Key Performance Indicator (KPI 1) as the Standing that we have defined above. Then we can create an SQL View as a neat way to bring the data together and populate it to a BI front-end. So we would have :-
| 15
| 16
4. BI on the Beach
A Data Warehouse is frequently developed to meet an organisations requirements for data to meet Business Intelligence (BI) requirements. One of the most common requirements is to provide Key Performance Indicators (KPIs). For a Retail business, a typical Financial KPI would be Sales or Profitability per staff headcount, and a Performance KPI would be On-Time-Delivery (OTD). At Database Answers we have designed a generic approach that we call BMEWS, which stands for Business Monitoring and Early Warning System. The reminder of this Section describes how BMEWS could be applied to monitor risk of a Data Warehouse that would allow the CIO or Security Manager to relax on the beach. This page describes this BI on the Beach application : http://www.databaseanswers.org/data_models/bmews_bi_on_the_beach/index.htm
4.1 BMEWS BI KPI Monitoring System This Section shows a generalised version of the RMS in the previous Section. Risk Monitoring System (RMS) is set up to provide timely notification to the Security Administrator of any situation that requires his attention. A number of Key Risk Indicators (KRIs) will have been identified and Dashboards produced regularly by the RMS that tracks the KRIs. The RMS allows the Security Administrator to pay attention only to the situations needing attention.
KPI Dashboard
Feedback
BI Layer KPIs BMEWS Platform
Data Extracts
| 17
This Data Migration Architecture provides for a controlled transformation of data from a variety of Data Sources, through Data Integration to an integrated Data Warehouse. This Data Warehouse provides a Single View of the Truth and Data Marts are then populated for specific purposes such as Basel 3, Risk Management, Customer Sales, Profitability and so on. Finally, the data in Data Marts is then displayed by Dashboards, KPIs, Reports and so on.
Data Warehouse
Data Sources
| 18
A Risk Monitoring System (RMS) is set up to provide timely notification to the Security Administrator of any situation that requires his attention. A number of Key Risk Indicators (KRIs) will have been identified and Dashboards produced regularly by the RMS that tracks the KRIs. The RMS allows the Security Administrator to pay attention only to the situations needing attention.
Situation Reports
KRI Dashboard
Feedback
Key Risk Indicators (KRIs) Risk Monitoring System GRC Platform
The Security Administrator is relaxing on the beach An Alert is sent to his Mobile phone about a situation that requires his attention. He drills down to the details He identifies the appropriate response He sends an Alert to the appropriate member of this staf6. He goes back to his relaxation
| 19
Compliance with Best Practice in Data Management, such as Data Consistency checks on Master Data Management, Orphan Orders, and so on.
4.2.3 Risk Dashboard The KRIs will be displayed in a Risk Dashboard looking something like this :-
| 20
This Layered Architecture appears further on in Section 6 and repeated here for convenience :-
4.2.5 Data Source The Data Source is the Log File and looks like this :-
| 21
The Message Codes in the Log File will be defined by the System Supplier and at this stage, we will validate the Message Codes and translate those that we are interested in to the appropriate Event ID.. The output from this Staged will be data that has been validated and transformed ready to be loaded into the Data Warehouse.
4.2.7 3NF Data Model This help us to understand the data for Key Risk Indicators (KRIs) and how it is related.
| 22
4.2.8 Dimensional Model In discussion with the Users, we have identified Key Risk Indicator 1 (KRI 1) to be the number of failed Login attempts in a 5-minute time period during the 24-hour day.
| 23
4.2.9 Data Mart 1 In discussion with the Users, we have identified Key Risk Indicator 1 (KRI 1) to be the number of failed Login attempts in a 5-minute time period during the 24-hour day. This Mart holds the data for KRI 1, which we use to send an Alert to all Users who have subscribed to KRI 1. .
| 24
5.2 Introduction In this Chapter we use a trip to the Olympics to discuss an approach to the implementation of a Reference Data Architecture and the design of a Data Warehouse. A Canonical Data Model (CDM) is central to this and we discuss the benefits of using Design Patterns based on a CDM. During the trip, I used the Ticket I had bought online, ate lunch and watched the Judo competition.
| 25
On the way home I found myself thinking that the trip would provide a good opportunity to develop an interesting and User-Friendly Tutorial on Data Warehouses. The design of the Data Models reflects the scope and the fact that the overall aim is to provide data for Business Intelligence. We also try to keep in mind that a well-designed Data Model should be good to look at and it should be possible to tell a story based on the Model.
5.3 The Approach The Approach is to follow these Steps :Step 1 Identify the Events involved Step 2 Define a Design Pattern based on the Event-driven Canonical Data Model from this page on our Database Answers Web Site : o http://www.databaseanswers.org/data_models/canonical_data_models/index.htm
Step 3 - Define a Message Format for the data in each Event Step 4 - Design a 3rd Normal Form Data Warehouse (DWH) and update it for each Event. Step 5 Define the format for loading data into the DWH for each Message
| 26
5.4 Canonical Data Model Step 1 Use the Event-driven Canonical Data Model from this page in our Web Site : o http://www.databaseanswers.org/data_models/canonical_data_model/index.htm
5.5 Design Pattern From the Canonical Data Model shown above, we can derive this Design Pattern :Supplier Chains
Suppliers
Customers
Services
Customer Services
Staff
Locations
Documents
| 27
5.7 3NF Data Warehouse The design of this Data Warehouse is derived from the Design Patterns for the three Events that we discuss. Every Event has an Outcome but it is not usually important and is taken for granted. We show it here because it is very important for Judo competitions. We show a many-to-many relationship between Products and Customer Services to provide for the situation where one Customer Services Order contains many Products. In my case, this applied when I went to the Restaurant and ordered a main course, yoghurt and wine.
Suppliers
Customers
Services
Customer Services
Staff
Products
Venues (Locations)
Outcome
| 28
| 29
CUSTOMERS
CREDIT CARD
SERVICES eg Checkin
STAFF
| 30
5.9.2 Message Format This shows the data items on the Ticket :-
This shows the fields in the Generic Message :EVENT DATE LOCATION PRICE DETAILS
This shows the fields in the Message for this Event :EVENT Purchase Ticket DATE Date of Purchase LOCATION Venue, Block, Row, Seat Nr PRICE Seat Price DETAILS Date, Time of Competition
| 31
The benefit of adopting a Third-Normal Form ERD is that it enforces a Single View of the Truth. If we adopt a Dimensional Model it is not so easy to achieve this. Thiis shows the design of the Data Warehouse (DWH) after the first Event of Purchasing a Ticket
Customers
Services
Customer Service
Staff
Location
Document
| 32
| 33
5.10 Event 2 Get Lunch This shows how we handle the Second Event.
5.10.1 The Design Pattern
Restaurant
Customers
Credit Card
Menu
Buy Lunch
Staff
Sales Receipt
5.10.2 Message Format This shows the fields in the Generic Message :EVENT DATE LOCATION PRICE DETAILS
This shows the fields in the Message for this Event :EVENT Buy Lunch DATE Date & Time of Lunch LOCATION Restaurant PRICE Total Price DETAILS Chicken and Mushroom Pie, Wine
| 34
5.10.3 Data Warehouse This shows the design of the Data Warehouse (DWH) after the second Event of Buying Lunch.
Supplier
Customers
Services
Customer Service
Staff
Location
Document
| 35
| 36
In this case, the Event is the Competition between two Judo experts and the Outcome is very important It is quite common for Event to have an Outcome, but so far, it has not been important enough to justify appearing at the top level. Audience (Customers)
My Ticket
Judo Venue
Competition
Outcome
5.11.2 Message Format This shows the fields in the Generic Message :EVENT DATE LOCATION PRICE DETAILS
This shows the fields in the Message for this Event :EVENT Watch the Judo DATE Event Date LOCATION PRICE DETAILS Outcome / Result
| 37
5.11.3 Data Warehouse This shows the design of the Data Warehouse (DWH) after the third Event of watching the Judo Competition.
Supplier
Customers
Services
Customer Service
Staff
Location
Document
Outcome
5.11.4 Data Mart This shows the Data Mart for Judo Competition Results data.
| 38
| 39
The reason for all the work that we have done to get to this point is, of course, to produce Business Intelligence (BI). Here is a simple example to show how this works in practice. One of the key aspects of the Olympics was an analysis of the number of medals that each country won. For Great Britain, funding was made available and targets were set for medals to be achieved by each sport. For Judo, the funding was almost 8 million and the target was 1 or 2 medals. In order to analyse this and produce the appropriate KPIs (Key Performance Indicators) we define a Bi Layer that takes data from the Judo Competition Results Data Mart. This shows the Data Model for the Judo Medal Total BI Layer :-
| 40
This is a simple example of how this data could be displayed using a Green Traffic light :BUDGET TARGET ACHIEVEMENT TRAFFIC LIGHT (RED/AMBER/GREEN)
DISCIPLINE
5.14 Conclusion This Chapter has presented a Method for designing a Data Warehouse following a Canonical Data Model and Messages. We have validated the Method by designing a Data Warehouse for a Day at the Olympics. I would be pleased to have your comments and you can email me at [email protected].
| 41
6. Holiday in Malaysia
6.1 Management Summary In this Chapter we use a trip to Malaysia to discuss an approach to the implementation of a Reference Data Architecture and the design of a Data Warehouse. A Canonical Data Model (CDM) is central to this and we discuss the benefits of using Design Patterns based on a CDM. During the trip, my wife and I stayed in three Hotels, hired a car and visited a number of Tourist Attractions, including an Elephant Sanctuary, a Crocodile Farm and an Underwater World in Langkawi Island in Malaysia. After we returned to England I found myself thinking that the trip would provide a good opportunity to develop an interesting and User-Friendly Tutorial on Data Warehouses. The design of the Data Models reflects the scope and the fact that the overall aim is to provide data for Business Intelligence. We also try to keep in mind that a well-designed Data Model should be good to look at and it should be possible to tell a story based on the Model.
6.1.1 The Approach
The Approach is to follow these Steps for each Event Step 1 Use the Event-driven Canonical Data Model from this page in our Web Site : o http://www.databaseanswers.org/data_models/canonical_data_model/index.htm
Step 2 - Define a Message Format for each Event Step 3 - Design a Data Warehouse and update it after we analyse each Event. These Steps will be followed for these Events that occurred during our trip to Langkawi Island in Malaysia : Event 1 - Check-in to a Hotel Event 2 - Hire a Car Event 3 - Go Shopping Event 4 - Visit Tourist Attractions Event 5 - Check-out of a Hotel
| 42
For each Event, we discuss the Operational Data Source (ODS) in the form of the Message for the Event, along with the Data Warehouse and the Dimensional Model. Our starting-point is defined by the Templates in Section 2.
6.1.2 Overview from ODS to BI This Section presents Data Architecture to support a Data Warehouse and BI Layer. A typical kind of display requested by users is a Pie-chart. This example shows the expenses that we incurred during our trip to Malaysia Car Hire, Hotel Accommodation, Shopping and Tourist Attractions The source of the data is Tickets and Sales Receipts generated in Stores. This data is stored in a Data Warehouse to provide a Single View of the Truth for the Pie-Charts in the BI Layer.
DATA WAREHOUSE
SALES RECEIPTS
Coffee Bean Receipt Elephant Sanctuary Starbucks in Langkawi
| 43
A short Slide Show has been created to give you an overview of how this approach works in practice and how the Canonical Data Model is central.
The Slide Show takes less than one minute : http://www.databaseanswers.org/bmews_slideshow_book_tutorial/index.htm Do these Steps for all Events
| 44
This discussion of the Theory in this Section will provide us with the background that we need to understand what follows in this book.
6.2.1 A Layered Data Architecture and SVOT
There are many different ways of defining a Data Architecture. This diagram shows the four major Stages in a layered Architecture that is very economical but also very powerful. The combination of a 3NF Data Warehouse with Master Data Management facilities in the Integrated Data Layer would help us in delivering a Single View of the Truth (SVOT).
| 45
6.2.2 A Cloud-based Data Architecture for the Future This Section describes an Architecture that can be used as a target To -Be for the future. This diagram shows more clearly how Web Services would be used with an ESB providing an Abstraction Layer. Data Virtualisation is a concept in Implementation that can be defined as the process of providing users with a Business View of the data in an organisation, which conceals the technical details of stored data, such as location, storage structure, APIs and storage technology.
Ubiquitous Data Available at Any Time, and Any Place with Any Device
Master Data in the Clouds Reference Data in the Clouds - Products/Services, Customers - Currencies, Languages
Web Services Design Enterprise Service Bus (ESB) Enterprise Data Model Data Virtualisation (Middleware) IBM, Informatica, Microsoft, Oracle, etc.
Implementation
Data Sources / Databases CSV, ODBC, Oracle, SAP, SQL Server, etc.
| 46
The Integrated Data Platform is a specific example of a more general Data Virtualization Layer. BI Layer
Semantic Models
Dimensional Models
Enterprise Data Model Web Services Get, Put, Update Customer, Product
Staging Area
ODS 1 Shipments
EtE.
| 47
The Canonical Data Model is used as a Template for a Design Pattern for an ERD for a Business Event. This Model appears on this page on our Database Answers Web Site : http://www.databaseanswers.org/data_models/canonical_data_models/index.htm
It provides a stripped-down Event-oriented Model that applies to a wide range of business and everyday situations. We use it as a standard to translate data into a common format suitable for loading into a Data Warehouse. We have used ERWin for this Data Model. This allows us to show Many-to-Many Relationships in a very concise and economical style. When we come to use the CDM we will expand these into One-to-Many Relationships.
| 48
6.2.6 Mapping to the CDM The purpose of this activity is to identify the correspondence between the Generic entities in the CDM with the specific entities for a particular Event. This example shows how the Entities in the Data Model for our Hotel Check-In Event map on to our Design Pattern based on our Canonical Data Model (CDM). We are very happy to see that it does because it helps to validate the CDM.
COMMENTS
Hotel Check-In Hotel Address Hotel Chains Hotels Staff in the Hotel Staff can be involved and represent the Organisation
6.2.7 Template Message Format This is our Generic Template that is used in the derivation of all the specific Message Formats for Car Hire, Shopping and so on.
Generic Supplier Date & Time Customer Products or Services Room,Meals, etc. Unit Price From Date To Date Total Price
Eg Hotel
Date
Customer, Guest
| 49
6.2.8 Extract, Transform and Load (ETL) At this point, we are interested in two aspects of ETL :1. 2. Specification of Rules for Validation, Clean-up and Transformation Definition of each item which is in common use and where a clear unique understanding is important.
Therefore, we create a table like this :Business Term Date & Time Validation Cannot be in the future Validation Cannot be before date to be determined, eg 1950 Clean-up Mark as bad data Transform Review with SMEs
Cannot be negative Less than or equal to To Date Must be before date to be determined, eg 2020 Cannot be negative Mark as bad data Review with SMEs
Total Price
A wide variety of software is available to meet ETL requirements. A desirable feature is the ability to build up a library of ETL functions that can be enhanced as a result of learning in the course of a Data Quality Project. This Library will then provide the foundation for the repetitive processing which is performed continuously until the data reaches the desired quality. This will be determined by the business users and SMEs. Although, as data management professionals, we might expect or want to have 100% good data, this is not always strictly necessary. For example, in UK Local Government, it is common to find that addresses in Council Tax are of a uniform high quality, and that Dates of Birth are good in Social Services, because these two data items are critical to the respective functions.
| 50
The Attribute are usually shown in the Dimensional Models. During our analysis of the Events we did not find a place for the Third_Parties Entity that is shown in our CDM in Section A.A.2. Therefore, we do not include in the future discussions in this Paper.
| 51
6.2.10 Template Dimensional Model This is a Generic Template Dimensional Model which corresponds to our CDM shown above. This will be an excellent starting-point for the analysis of the required Dimensional Models for the range of Events which make up a very important part of this document.
| 52
The top row shows the major Building Blocks in the migration of data from the Operational Data Stores to the Semantic Layer that defines the BI User View.
ODS
Staging Area
Dimensional Models
Semantic Layer
BI User View
Data
Warehouse
Bus
Master Data
Conformed Dimensions
Conformed Facts
eg Calendar Date
eg Profitability
eg Location
eg Performance
| 53
The MDM Component provides a Single View of the truth for Customers and Products. The principles behind the Single View of both the Customers and Products and Customers is the same : Establish uniqueness using Business Rules Map from alternatives to the single recore. If possible, define one Data Source as the Golden Record or Master Recore. For example, where Salesforce is in place, it is often provides the Master Customer recore.
In this case, the GetCustomer Service will try to match between the new characteristics, such as Customer name and address, and existing Customers.
| 54
A Customer Master Index (CMI) maintains a link between the single master Customer record and the Source Data Customers. This Data Model shows how the approach above will be implemented in our Reference Data Architecture.
For this Event, we must plan for loading Customer data into the Data Warehouse. This requires that we establish a Single View of the Customer. In the UK, the name Joe Bloggs is used whereas in the States it would be John Doe. Joe, of course, is an abbreviation of Joseph. On official documents, the name would be spelled Joseph, whereas in everyday conversation, it would normally be Joe. Therefore we have to allow for the possibility that a Joe Bloggs might be the same person as Joseph Bloggs
| 55
In the States, we might find the names of John Doe, Johnny Doe and J.Doe and we would have to match them if they are the same person.
6.2.12.2.2 The Solution
Resolution of this Problem and the ambiguity requires us to define a set of Business Rules that can be run whenever we load a Customer who might be ambiguous. Therefore, our solution to this problem of establishing a Single View of Customer Joe or Joseph is to have a Rules Engine where we can define and execute a Rule like Joe is equivalent to Joseph. The recommended practice to implement the Customer Master Index is to use Web Services for Get, Update and Put facilities.
6.2.12.3 Products
The requirements here are similar to the Master Customer Index. We need to match similar products from different Suppliers should be considered the same Product for BI and Performance Reports. For example, Red Sweaters will have different Product Codes from different Suppliers but we will want to include them in the same Product Category that we define for our analysis purposes. In this way, we establish a Single View of Products and Product Categories in the Data Warehouse. This will be achieved by a combination of automated Business Rules and manual intervention by members of stafH.
| 56
| 57
Petronas Towers, KL, Malaysia In the centre of this striking photo are the Petronas Towers in Kuala Lumpur, the capital of Malaysia, and commonly referred to simply as KL. At the time when they were built, they were the highest building in the world, and I believe they are still number two or three, with 80 floors each, and a footbridge on the 40th floor. I walked across and it is not something I would want to do very often. In passing, let me say that Petronas is a clever word because it is a combination of Petrol and Nasional, which is the word for National in the Malay language. In other words, Petronas is the Malaysian equivalent to British Petroleum or BP, in the UK.
| 58
From KL we took an internal flight to Langkawi island where we checked in at the Berjaya Hotel and Resort. For each Event, we check to see whether we can derive a Design Pattern based on our Canonical Data Model. If we can, then we have validated our CDM.
6.3.1.4 Data Warehouse for Hotel Check-In
| 59
6.4 Events 1 to 10 6.4.0 Adding new Data Sources A very important activity that we have to plan for is adding new Data Sources to our Data Warehouse. This is often as a direct response to a new business requirement. The Steps that we will follow are those that we describe in the succession of Events in this Appendix.
6.4.1 Event 1 - Check-in to a Hotel Checking-in to the Berjaya hotel in Langkawi is Event number 1. As you can see, it is in a beautiful location and consists of over 400 wooden chalets that blend in very naturally with the forest.
This Section discusses how the Canonical Data Model (CDM), shown earlier, applies to the Event of Checking-in to a Hotel. The CDM provides a Design Pattern for the Event-oriented Data Models that we need. The Design Pattern based on the Hotel Check-in Event looks like this :This Section discusses how the Canonical Data Model (CDM) applies to the Event of Checking-in to a Hotel. The CDM provides a Design Pattern for the Event-oriented Data Models that we need.
| 60
When we think about the Check-in procedure, we realise that in a small transaction, we have obtained a rich source of material for a Data Model : Customer name and Address Customer Credit card details Customer Passport details Hotel name and location Hotel Room Duration of Guest Stay Using this source data, we can apply the Design Pattern to the Hotel Check-in Event and produce this Data Model as the result (arrows point from Children to Parents):Hotel Chains
Hotels
Customers
Rooms
Hotel Reservations
Staff
Hotel Address
Business Rules It is very good practice to write out the Business Rules that define the conditions that the logic of the Model must comply with. They can then be reviewed and agreed with a Subject Matter Expert (SME). If it is appropriate, we can use a Business Rules Engine to automate the implementation of the Rules. In this case, the Rules look like this : A Customer has one and only one Address. A Customer has one or more Addresses. A Hotel belongs to one and only one Hotel Chain. A Hotel has one and only one Address. A Reservation is associated with one Customer. A Reservation is associated with one member of Staff. A Room belongs to one and only one Hotel. A Room Card or Key is associated with one and only one Room and Reservation
| 61
This Table shows how the Entities in our Hotel Check-In Data Model map on to our Design Pattern based on our Canonical Data Model (CDM). We are very happy to see that it does because it helps to validate the CDM. CDM Customers Documents EVENT : Hotel Check-In Guests Room Card / Key This is as near as we get to a document in a Hotel Check-in COMMENTS
Rent a Room Hotel Address Hotel Hotel Chains Staff in the Office Staff represent the Organisation and are usually involved during check-in.
This shows how the Generic Message Template applies to the Hotel Check-In Event. It defines the Source Data for this Event. TBD stands for To Be Determined . Supplier Date & Time Check-in Date & Time Customer Details Barrys Name and Credit Card Details Products or Services Room number Unit Price From Date From Date To Date Total Price
Berjaya Hotel
To Date
TBD
| 62
At this point, the Data Warehouse will contain data only for the Hotel Check-in Event and therefore it will look like the CDM. This diagram shows the Entities in the Data Model. The attributes are shown in the Dimensional Model in the next Section. In this diagram, we have positioned the Room Card/Key so that it corresponds to the Document Entity in the C DM. We have also shown the Hotel_Address entity with its correct relationship to the Hotel entity, whereas in the CDM, it is shown, for convenience sake, in a Many-to-Many Relationship with the Events entity. This is the same as Third-Normal Form Data Warehouse as the one shown earlier in this Section.
| 63
Derived data must not appear in an ERD, therefore the Room Card/Key does not appear in this ERD because the data is derived from data already recorded.
| 64
This Section discusses how the Canonical Data Model (CDM), shown in Section 2.1, applies to the Event of Hiring a Car. The CDM provides a Design Pattern for the Event-oriented Data Models that we need. The Design Pattern based on the Car Hire Event looks like this :-
Rental Office
Customers
Cars
Staff
Office Address
This Section discusses how the Canonical Data Model applies to the Event of Hiring a Car. We hired a car from a local Car Hire company at the airport when we landed on Langkawi island. We would normally create a Subject Area Model for Cars, to show details such as Car Make and Model. This Table shows how the Entities in our Car Hire Data Model map on to our Design Pattern based on our Canonical Data Model (CDM). We are very happy to see that it does because it helps to validate the CDM. CDM EVENT : Hire a Car COMMENTS
| 65
Staff are usually involved and represent the Organisations in the CDM
We hired a car from a local rental company in the airport in Langkawi, which worked out very well. Car Hire Company ABC Car Hires Date & Time Check-in Date & Time Customer Details Products or Services Car Reg Number Unit Price From Date To Date Total Price ---
From Date
To Date
| 66
At this point, we add the Car Hire data to the data for the Hotel Check-in Event which is already in the Data Warehouse.
| 67
After a little thought, we have combined Car Hire and Hotel Reservations into Suppliers and Services.
| 68
This is Event 2 where we add the Dimensions and Facts for Hotel Check-in to the existing ones for Car Hire.
| 69
Harrods is very popular in Malaysia, as you can tell from the customers browsing in the store.
| 70
Here we have Data Models for Receipts from Harrods, Starbucks and Tesco in Malaysia.
This shows a consolidated Receipt that provides a generic view of the three specific examples above.
| 71
This Section discusses how the Canonical Data Model applies to the Shopping Event We go Shopping which is when the long-suffering husband says one of three things :1. Its a tough job but someones got to do it 2. When the going gets tough, the tough go shopping 3. Yes, dear But usually, we survive the experience ;-0) This is how the CDM Design Pattern applies to the Shopping Event :Retail Chains
Stores
Customers
Products
Event : Go Shopping
Staff
Store Address
Sales Receipt
| 72
This Section discusses how the Canonical Data Model applies to the Event of Shopping. We went shopping at a number of stores in Malaysia. We would normally create a Subject Area Model for Shopping. This Table shows how the Entities in our Shopping Data Model map on to our Design Pattern based on our Canonical Data Model (CDM). We are very happy to see that it does because it helps to validate the CDM. CDM Customers Documents Events Locations Organisations EVENT : Go Shopping Customers Sales Receipt Go Shopping Stores Staff, Stores and Store Chains Retail Products N/A For example, Harrods and Tesco COMMENTS
The Message Format for this Event will resemble the Sales Receipt. Store Name Harrods Date & Time Visit Date & Time Customer Details Products or Services One or many Products Unit Price From Date N/A To Date Total Price
Purchase Price
N/A
To be calculated
| 73
At this point, we add the Shopping data for Event 3 to the data for the Car Hire and Hotel Check-in Events which is already in the Data Warehouse, so our design looks like this :-
At this point, we would normally consider creating a Glossary of Terms to establish agreed definitions of the word that are in common use.
| 74
The Dimensional Model will have data for Shopping, Car Hire and Hotel Reservations.
| 75
6.4.4 Event 4 - Visit the Elephant Sanctuary The Elephant Sanctuary was the first Tourist Attraction that we visited. Here we see an Elephant family in the Kuala Gandah Sanctuary.
Elephants, especially in small numbers that you see in a Sanctuary or a Circus, frequently have names and we often know their ages. However, this is not true for crocodiles. Therefore, we store names and ages for elephants but not for crocodiles so here is the Data Model for Elephants :-
| 76
This Section discusses how the Canonical Data Model applies to the Event of Visiting an Elephant Sanctuary. We were on Langkawi island where there are a lot of interesting things to see and do. My wife voted for a trip to Elephant Sanctuary because she thinks baby Elephants are very cute. So we decided on the Elephant Sanctuary, then the Crocodile Farm and finally the Underwater World. They have an overhead aquarium and I have always wanted to see fish going over my head, and it had a number of individual Attractions, including the Fish Aquarium and the Penguin Area. Here is our ticket for the Elephant Ride (called a Dumbo Boarding Pass !!!) :-
In our Canonical Data Model (CDM) this is an example of a Document related to an Event. In other words, this is an example of how we are able to validate our CDM.
| 77
Complexes
Customers
Elephant Sanctuary
Staff
Attraction Address
6.4.4.2 Mapping to the CDM
Tickets
This Section discusses how the Design Pattern for Visiting a Tourist Attraction maps to the Canonical Data Model applies to the Event of Visiting a Tourist Attraction. If we need to include more detail we would probably create a Subject Area Model for Tourist Attraction. This Table shows how the Entities in our Tourist Attraction Data Model map on to our Design Pattern based on our Canonical Data Model (CDM). We are very happy to see that it does because it helps to validate the CDM. CDM Customers Documents Events EVENT : Visit to Elephants Tourists Tickets Visit to Elephant Sanctuary An Elephant Sanctuary is an example of a Tourist Attraction COMMENTS
Locations
Address of Elephant Sanctuary Elephant Sanctuary Owners Take a Ride on an Elephant N/A
| 78
6.4.4.3 Message Format The Message Format will resemble the Tickets. Attraction Name eg Elephant Sanctuary Date & Time Visit Date & Time Customer Details N/A Services Unit Price From Date To Date Total Price
Attraction
Entry Fee
N/A
N/A
As determined
6.4.4.4 Data Warehouse for the Elephant Sanctuary This models the Elephant Sanctuary as a Tourist Attraction.
| 79
This consolidates the Tourist Attraction Entities with the existing Entities for Car Hire, Hotel Check-in and Shopping.
| 80
At this point, data for Event 4 Elephant Sanctuary ( Tourist Attractions) is added to data for Cars, Hotels and Shopping.
| 81
I was keen to go to the Crocodile Farm, because I enjoyed the scene in the James Bond Live and Let Die movie where he (Roger Moore) escapes from a small island surrounded by crocodiles by jumping across their backs. I have not been able to find exactly the scene that stuck in my mind, so here is the nearest, which are the crocodiles shown on a movie still :-
In Langkawi we were very impressed to see a brave guy sitting on the back of a crocodile. Later we found that he was an employee and somehow he had trained the crocodile to let him sit on its back.
| 82
6.4.5.0 Discussion
This Section discusses some of the implications for Data Modeling of combining a Visit to the Crocodile Farm with a Visit to the Elephant Sanctuary.
6.4.5.0.1 Adding Crocodiles to Elephant Data Model
We can see that the Crocodile Entity looks very similar to the Elephant Entity. The only difference is that we often know the name and age for an Elephant because they are somehow more user-friendly than Crocodiles. We never know the age and name of a Crocodile !!! When we try to produce a combined Model for both elephants and crocodiles this is our first draft.
| 83
| 84
| 85
Therefore we have to find another word that can apply equally to both Crocodiles and Elephants. Species is a word that comes to mind so we will use it, and we will use Sub-Species for specific types of Crocodiles and Elephants. You can see that we have established that ages and names are usually available to Elephants but not for other species.
| 86
This Section discusses how the Canonical Data Model applies to the Event of Visiting a Crocodile Farm. We would expect this to be identical to a Visit to the Elephant Sanctuary. But it is worth the effort of compiling the Mapping Analysis so that we can double-check the situation. Sure enough, after we complete the Mapping, we can see that the logic is identical. Therefore we do not need to change the Design Pattern or the Data Warehouse. The Dimensional Model will simply have additional data for the Crocodile Farm.
6.4.5.2 Mapping to the CDM
This Section discusses how the Canonical Data Model applies to the Event of Visiting a Crocodile Farm. We can see that the Data Model for Crocodile Farm is identical to that for the Elephant Sanctuary. We can simply create a Data Model for Tourist Attraction and create Event Types of Visits to a Crocodile Farm and an Elephant Sanctuary. Therefore, we handle Elephant Sanctuaries and Crocodile Farms as different sorts of Reference Data. This Table shows how the Entities in our Crocodile Farm Data Model map on to our Design Pattern based on our Canonical Data Model (CDM). We are very happy to see that it does because it helps to validate the CDM. CDM Customers Documents Events Locations Organisations Products or Services Third Parties EVENT : Visit to Crocodiles Tourists Tickets Visit to Crocodile Farm Address of Crocodile Farm Crocodile Farm Owners See the Crocodile Farm N/A COMMENTS
| 87
6.4.5.3 Message Format The Message Format will resemble the Tickets. Attraction Name eg Crocodile Farm Date & Time Visit Date & Time Customer Details N/A Services Unit Price From Date To Date Total Price
Attraction
Entry Fee
N/A
N/A
As determined
6.4.5.4 Data Warehouse for the Elephant Sanctuary The Data Model the Crocodile Farm is logically identical to the Elephant Sanctuary Model. Therefore we can use the same Model for Tourist Attractions and simply add values to the Reference Data.
| 88
When we review this Data Model, we can see that the logic of the Elephant Sanctuary applies equally to the Crocodile Farm. In other words, our Consolidated Data Warehouse is identical, and we simply add to the Reference Data as another kind of Tourist Attraction.
| 89
When we review the Dimensional Model, we can see that that we can accommodate Crocodile Farms by simply adding to the Reference Data.
| 90
The Underwater World was very difficult to find, but when we did find it, it was definitely worth it. We paid a fee to enter but when we got inside we discovered that there many Attractions inside a very large building, Entry to these Attractions, like the Aquarium, was free. After a little thought, I decided to treat the Underwater World as a Tourist Attraction. Then I decided to treat the Aquarium and Penguins as Tourist Attractions with a Parent relationship to the Underwater World. This is very easy to implement in the Model and makes it very easy to read the Model. This is important because every Data Model should tell a story and therefore a good test of a welldesigned Model is that it is easy to read it like a story. Therefore, the Aquarium and the Penguins both become Attractions with a zero entry fee and have a relationship to the Underwater World as a Parent. Heres a photo to give you a glimpse of the fascinating interior of Underwater World from this page on their Web Site : http://www.underwaterworldlangkawi.com.my/
| 91
6.4.7 Event 7 - Visit the Aquarium Visiting the Aquarium was great and allowed me to tick off another once-in-a-lifetime experience which was to walk inside an aquarium looking up at the fish swimming by over my head !!! This photo shows the view I saw when I looked up and saw fish swimming past above my head.
From a Data Modelling point of view, visiting an Aquarium is identical to visiting a Crocodile Farm or Elephant Sanctuary. Therefore we do not need a separate CDM, and we go through the process of mapping simply to confirm that it is identical. This Table shows how the Entities in our Visit the Aquarium Event map on to our Design Pattern based on our Canonical Data Model (CDM). CDM Customers Documents Events Locations Organisations Services Third Parties EVENT : Visit to Aquarium Tourists Tickets Visit to Aquarium Address of Aquarium Aquarium Owners See the Aquarium N/A COMMENTS
| 92
The Penguins were also at the Underwater World and I was very lucky again because I saw live penguins which was another first for me. They were a wonderful sight. It was very hot outside (over 90 degrees in the shade) outside in tropical Malaysia. But inside we saw Penguins in a very comfortable (for them) sub-zero temperature.
| 93
Validation proves that our existing Species Model is correct. Fish do not have names and their characteristics are the same as Crocodiles. We can say the same for Penguins. But Fish and Penguins both have Sub-Species !!! Therefore we have validated our Species Model and it is good as it stands for Fish and Penguins, as well as Crocodiles and Elephants. To make it clear that we are talking about the examples of Species that we see in the Underwater World we call the Entity Species in Attraction. It would be sensible for us to plan for future Species which might not be a Sub-Species. The simplest way to do this is to add a self-referencing Relationship to the Species Entity. This means that the Species can point to itself so that Species, Sub-Species are stored in the same table in a Database. In HR terms, this is like having an Employee table and saying Each Employee reports to a Superior.
| 94
This Section shows how the Design Pattern looks for Penguins.
6.4.8.2 Mapping to the CDM
This Section discusses how the CDM applies to the Penguin Area. When we check our CDM we can see that it applies in an identical way that it does to Elephants and Crocodiles. That is we pay for a Service and receive a Document, in the form of a ticket, that allows us to enter the Attraction. Therefore we do not need a separate CDM, and we go through the process of mapping simply to confirm that it is identical. This Table shows how the Entities in our Tourist Attraction Data Model map on to our Design Pattern based on our Canonical Data Model (CDM). CDM Customers Documents Events Locations Organisations Services Third Parties EVENT : Visit to Penguins Tourists Tickets Visit to Penguins Address of Penguins Area Penguin Area Owners See the Penguins N/A COMMENTS
| 95
Entry to the Penguin Area is free and not monitored after you buy your ticket for the Underwater World and enter. The Message Format will be simply the one for the Ticket to the Underwater World because there is no separate ticket for the Penguin Area. Attraction Name Underwater World Date & Time Visit Date & Time Customer Details N/A Services Unit Price From Date To Date Total Price
Penguin Area
Free
N/A
N/A
Free
| 96
This diagram shows the Design Pattern of the Canonical Data Model adapted for Tourist Attract ions.
| 97
This diagram shows the Design Pattern of the Canonical Data Model adapted for Tourist Attract ions.
6.4.9 Event 9 - Check-out from a Hotel The last Hotel we stayed in was the Shangri-la in Penang. This was the beautiful view from our room that we were very sad to see for the last time before we checked out:-
| 98
The Credit Card that I use was, of course, associated with me, but it was also associated with payment of the Hotel Bill so there is a relationship between the Credit Card and the Hotel Guest (ie Customer) and between the Credit Card and the Total Hotel Bill. This Section discusses how the Canonical Data Model (CDM), shown in Section 2.1, applies to the Event of Checking-in to a Hotel. The CDM provides a Design Pattern for the Event-oriented Data Models that we need. The Design Pattern based on the Hotel Check-in Event looks like this :Hotel Chains
Hotels
Customers
Staff
Hotel Address
Receipt
| 99
This Table shows how the Entities in our Hotel Check-out Data Model map on to our Design Pattern based on our Canonical Data Model (CDM). We are very happy to see that it does because it helps to validate the CDM. CDM Customers Documents Events EVENT : Hotel Check-out Guest Receipts Rent a Room, Use Restaurants, Laundry, and so on. Hotel Address Staff in the Hotel Staff are always involved in the course of a stay in a Hotel COMMENTS
Locations Organisations
This shows how the Generic Message Template applies to the Hotel Check-Out Event. It defines the Source Data for this Event. Generic Supplier Date & Time Customer Details Products or Services Room, Meal, Services Unit Price From Date To Date Total Price
Specific
Shangrila Hotel
From Date
To Date
Derived
| 100
At this point, we add specific Check-out data to the Data Warehouse. This diagram shows the Entities in the Data Model. The attributes are shown in the Dimensional Model in the next Section. We have also shown the Hotel_Address entity with its correct relationship to the Hotel entity, whereas in the CDM, it is shown, for the sake of convenience, in a Many-to-Many Relationship with the Events entity.
| 101
At this point, we add the Shopping data for Event 3 to the data for the Car Hire and Hotel Check-in Events which is already in the Data Warehouse, so our design looks like this :-
| 102
At this point, the Dimensional Model will have the complete set of Dimensions and Facts. This Data Model shows them all consolidated into a single Dimensional Model. An alternative design with more than one Fact Table is shown in the BI discussion. This is normally called multiple Data Marts which require Conformed Dimensions.
| 103
6.4.10 Event 10 - Shipping a Car from the UK to Malaysia We had such a great time in Malaysia, we decided to move out there for a while. One of the things we had to arrange was to ship our car out. We decided to use Maersk to help us. Here is the kind of Container Ship we had in mind :-
6.4.10.1 The CDM Design Pattern This Section shows how the CDM Design Pattern applies to the Event of Ship a Car to Malaysia.
Maersk
Maersk Line
Customers
Shipping Services
Staff
Port Locations
Shipping Contract
| 104
This Table is your starting-point for defining how the Entities correspond to the Entities in your Stopping for a Coffee Event. Replace the question marks by your answers. CDM Generic Entities Customers Documents Events Locations Organisations Organisations EVENT : Ship a Car by Sea Customer Contracts Ship a Car by Sea Booking Office Maersk Staff in the Office Staff can be involved and represent the Organisation COMMENTS
This shows how the Generic Message Template applies to the Specific Hotel Check-In Event. Generic Supplier Date & Time Customer Details Products Unit or Services Price Shipping Service Quoted price to ship Cargo From Date From Date To Date To Date Total Price ---
Specific
Maersk Line
Check-in Barrys Date & Name and Credit Card Time Details
| 105
6.4.10.4 Data Warehouse for Shipping a Car At first, this Event seems quite different from the others, but after a little thought, we realise that it has a Start and End Date. In addition, there is a Customer and we are using a Service provided by a Supplier. Therefore Shipping a Car is therefore logically similar to a stay in a hotel and our Data Warehouse looks like this :-
In general, we might be shipping many things and not just one thing, so our Data Model needs to provide for this. We will call these things Commodities We can do this by simply start with a many-to-many relationship between Commodities entity and the Shipments entity and resolve it to two one-many relationships, so that our Model looks like this :-
| 106
When we think about how we would show this Data Model in a generic format, this is the result :-
| 107
At this point, we add the Car Shipping data to the data for all the other Events which is already in the Data Warehouse, so our design looks like this :-
| 108
| 109
6.5 The BI Layer 6.5.1 The Approach Now we come to the Business Intelligence Layer which is, of course, the reason for everything that has gone before. Key Performance Indicators (KPIs) provide an excellent starting-point for Business Intelligence. We will use some basic KPIs defined for Profitability and Operational Performance. These can be enhanced in collaboration with the business users to establish commitment. Profitability can iniitially be defined as a basic difference between Profits and Revenue. One example of Performance KPIs is measurement of Deliveries being On-Time against plans agreed in Service Level Agreements (SLAs). In our work we do not have that kind of information available, so we will use a simple measure of the number of Customer Complaints.
Profitability
Performance
Revenue Data
Costs Data
Complaints
Customer Count
The initial Data Architecture will include this basic structure of KPI and Source Data. This will provide a simple but flexible framework which can be enhanced in a controlled manner. We will use this as a starting-point for discussions to establish the requirements with the business users.
| 110
We have adopted a general approach, where we classify Car Hire companies, Hotels, Shops and Tourist Attractions as Brand Chains and specific outlets as Branches. Therefore a particular Hotel is a Branch and the Branch Chain would be Hilton or Shangri-la. Here are a few simple examples of the kind of questions that we can answer with this approach. For the Finance Director of a Hotel chain : Which Hilton Hotel was the most profitable last month ? Which Hilton had the most complaints last week as a percentage of total Customers ?
For the Marketing Director of a Car Hire Company : What was the most popular type of car last week ? What was the most profitable type of car last week ?
For the Head of Tourism : What was the most popular Tourist Attraction last month ? What was the most popular Tourist Attraction over the past six months ?
| 111
When we consider the implementation options for the BI layer, we have quite a number of options. These include the Microstrategy Personal Cloud, as well as some KPI-oriented Cloud-based offerings Firstly, we design our Data Marts and then we have the basis for a selection criteria.
| 112
Here we show some examples of Screenshots for currently available Cloud-based BI Products. 1) KPI Library http://benchmark.kpilibrary.com/
3) Microstrategy Cloud Personal Here is the Web Site Link (Sign in as [email protected], with a password of m123 : http://www.microstrategy.com/cloud/personal/
4)Stacey Barr Stacey is a prolific writer on KPIs and Performance Measurement : http://www.staceybarr.com/products/performancemeasureblueprint.html
| 113
When we should consider using multiple Data Marts with Conformed Dimensions to meet our BI requirements.
| 114
6.7 Heres your Chance This Chapter offers you the chance to plan loading new data into our Data Warehouse. You will do it by completing the model answers, which are shown below as Template documents. If you feel like sending us your answers we will be happy to give you our comments. You can send them to [email protected].
6.7.1 Event : Coffee in Penang Airport
After we checked out of the Shangri-la, we took a limo to Penang Airport for the first leg of our trip back home to London. With plenty of time we got a coffee at the Coffee Bean , which was started by Herbert Hyman in California in 1963. It is now an international operation, and very popular in Malaysia. Looking for a suitable photo, I came across an excellent one on this page : http://www.airliners.net/aviation-forums/trip_reports/reae.main/126525/
| 115
Here is our Sales Receipt from the Coffee Bean, which we were glad to see validated our CDM :-
This Section shows the CDM Design Pattern. Please think about how it applies to the Event of Stopping for Coffee and change it accordingly. Chains
Supplier
Customers
Products or Services
Staff
Address
Documents
| 116
This Table is your starting-point for defining how the Entities correspond to the Entities in your Stopping for a Coffee Event. Replace the question marks by your answers. CDM Generic Entities Customers Documents Events Locations Organisations Organisations Organisations EVENT : Stop for Coffee Entities ??? ??? Stop for Coffee ??? ??? ??? Staff in the Hotel Staff can be involved and represent the Organisation COMMENTS
This shows how the Generic Message Template applies to the Specific Hotel Check-In Event. Generic Supplier Date & Time Customer Details Products or Services Room number Unit Price Price per Night From Date From Date To Date To Date Total Price ---
Specific
Shangrila Hotel
Check-in Barrys Date & Name and Credit Card Time Details
| 117
This is the same as Third-Normal Form Data Warehouse as the one shown earlier in this Section.
| 118
This is the Dimensional Model for the Hotel Check-in Event, which you can use as your starting-point.
| 119
This Section tries to describe the analysis and thought processes of a Data Modeller as he or she goes about his work. Of course, it is subjective and these are my thoughts on the topic. However, I have been doing this for over 15 years and I find it constantly fascinating. The reasons I find Data Modelling so fascinating are that it is visual, creative and can be a great help when used as a source of Data Models as a vehicle for communication between business users, management and data management professionals, analysts and developers. So here we go ;-0) 6.8.1 What are we going to do ? We are going to step through the process of designing Data Models and then reviewing the results to see whether we can simply the overall structure by generalising the Entities that we have produced. It is one of the situations where it takes longer to describe it (which is boring) than doing it (which is interesting). So (once again !!!) here we go
6.8.2 Where did we start ? Our Canonical Data Model is Event-oriented and we started with nine Events :1. Check-in a Hotel 2. Hire a Car 3. Go Shopping 4. Visit an Elephant Sanctuary 5. Visit a Crocodile Farms 6. Visit the Underwater World 7. Visit an overhead Aquarium 8. Visit a Penguin Area 9. Check-out of a Hotel
| 120
We have 9 different types of Events and our first Data Model looks like this :-
| 121
When we think about the Entities, it seems intuitive that visiting a Crocodile Farm must be similar to visiting an Elephant Sanctuary. Then we can review the discussion in the Section above to convince ourselves to treat them the same way.
| 122
At this stage, we are thinking about the underlying relationships between the entities that we have determined are in the scope of our study. We have started to group entities together in a way that helps us to reduce the overall size of the Data Model by identifying generic characteristics in the specific entities. However, every Data Model should tell a story and now we have to consider how our story can be told. For example, we would say Products are found in Stores and therefore we should show a one-tomany relationship between Stores and Products. We can see that it is the other way round in Version 3 because of the way it had evolved so now we have to change it to make it correct
| 123
At this stage, we start thinking about the story we want to tell and how we should structure the Data Model to reflect the story. For example, we would say Products are found in Stores and therefore we should show a one-tomany relationship between Stores and Products. At this point, we like the left-hand side of the Data Model and we can say :1. There is a Go Shopping Event which means buying Products, rather than go to Stores. 2. This allows us to show Products at the same level as Stores which means that we can maintain consistency with the terminology we have used elsewhere in this document. 3. We have decided that Services included Hiring a Car and Staying in a Hotel. So now we turn to the right-hand side of the Data Model.
| 124
At this stage, we start thinking about the story we want to tell and how we should structure the Data On the right-hand side, we show Species as a Tourist Attraction, whereas in fact, people say Lets go the Elephant Sanctuary so the entity that should be related to the Tourist Attraction is the Elephant Sanctuary, rather than the Elephant. Of course, people can also say Lets go and see the Elephants but in the physical world, the reality is that Elephants are housed in an Elephant Sanctuary and it the Sanctuary that they actually go and see. So we conclude that it is OK to show the Tourist Attractions and their relationships. We still have one or two questions to resolve but we are quite content because the Model looks good and the overall logic is good.
6.8.8 Conclusion
We hope you have found this discussion interesting and useful. If you have any comments, suggestions or questions, please feel free to email us at : [email protected].
| 125
7. Retail Sales
7.1 Development Framework In this Section, we discuss the Framework which contains two elements :3. The Development Approach 4. Components used in the Approach The Approach involves these Steps :6. Identify the business Events 7. Define a Message for each Event 8. Map each Event to the Entities and Attributes in the CDM 9. Determine whether the CDM should be extended. 10. Create an Industry-specific CDM if appropriate. The Components include : Generic and Industry-specific Canonical Data Models (CDMs) Generic and Industry-specific Data Warehouse designs Core Entities and Core Subject Area Models Customers, Products and Suppliers.
The rest of this Section is a Case Study for a Retail business. Subject Area Models : Generic (Horizontal) Industry-specific o o Insurance Common Data Model
http://www.databaseanswers.org/data_models/insurance_data_warehouses/common_data_model.ht m
| 126
7.2 Data Architecture This Architecture shows the major components in designing a Data Warehouse that incorporates Enterprise Data Mode with associated Subject Area Models, based on Industry-specific Models. Each Data Source is reviewed against the Canonical Data Model and the appropriate Messages formats are defined. Then the data in the Message is mapped to the Enterprise and Industry-specific Models. The current Enterprise Data Models are defined on this page of the Database Answers Web Site : http://www.databaseanswers.org/data_models/enterprise_data_models.htm
Canonical Entities
(eg Contract)
Messages
Data Sources
(eg Sales Receipts)
| 127
7.2.1 Generic Data Mart This should be reviewed for consistency with the Canonical Data Mart.
| 128
7.3 Canonical Data Model In this Section, we discuss how a Canonical Data Model (CDM) can be used to provide a frame of reference and a technique to generate standardised Messages and a flattening of the data to be loaded into a Third-Normal Form Data Warehouse and then a Dimensional Data Mart. During this application of the CDM and determine whether we need to extend to meet the specific requirement We will then achieve validation of the CDM which will be a very important result. Our Model is taken from this page on the Database Answers Web Site : http://www.databaseanswers.org/data_models/canonical_data_models/index.htm
In passing, we should add that we are discussing only purchases made by Customers in a Store. Online Purchases can be added later.
| 129
7.4 The ARTS Data Model This is an overview from this page : http://www.databaseanswers.org/data_models/arts_retail_data_model/index.htm
We can see similarities between the ARTS Model and our Canonical Data Model shown above. This is because the Canonical Model reflects the most common universal structure which is Events, Organisations, People and Products or Services.
| 130
The next Section shows a Sales Receipt from TK Maxx, which a major UK retailer, owned and operated by TJX, a multi-national US Retailer. When we examine the Receipt, we can see the following item of data : Credit/Debit Card o Type (eg Amex,Visa) last 4 digits, Expiry Date, Transaction Authorisation Number
Merchant ID, Terminal (Till) ID Product Category, Number and Prices of all the Products I purchased Purchase Date and Time of my Purchase Store Number, Name and Address and phone number
We can consider this to be our Operational Data Store, and from it we can generate details for the following Things of Interest : Customer Cards Products Purchases Stores
Sales Receipt
Stores
Products
Customers
Tills
Cards (Credit/Debit)
Of course, when a Customer uses a Card then we know some details of name, address and so on.
| 131
If the same Customer uses more than one Card then we will need to recognise the same Customer, which can become a little complicated if he is Joe Bloggs and Joseph Bloggs or J.Bloggs on another card. A fuller discussion of this topic can be found under the heading of Master Data Management : http://www.databaseanswers.org/mdm_master_data_management.htm
If a Customer pays by cash then we know nothing about them, and we would consider this to be an Anonymous Customers.
| 132
| 133
The Message for this Event includes the Store Number, Name and Address. Store Number Store Name Store Address
This diagram shows the new Stores Entity. We have created an Addresses Entity to hold details of all our Addresses. There are two benefits to this :1. An Address stored in a separate Table can be validated by third-party commercial software, such as QAS. 2. A single Address appears only once if it is used many times. This occurs frequently for people in families, but rarely for Stores.
| 134
The Message for this Event includes the Product Type, Number, Short Name and Retail Price. Product Type Product Number Product Name Retail Price
Here we add the Products Entity (shown in yellow) but, of course, there is no relationship between Products and Stores at this point.
| 135
The Message for this Event includes the Customer Name, Address, Card Number, Merchant Name, Amount, Date and Time of Purchase. Customer Name Customer Address Card Number Credit or Debit Card Type Expiry Date
This diagram shows the new Customers and Cards Entities. You can see that we have added the Customers Address to the Addresses table. This, of course, means that we are deriving increased value from the fact that we have created a separate Addresses Table. We have added a few attributes to the Cuzstomer_Cards Entity, such as thw Valid_from_Date that we can see when we look at one of our physical Cards, even though it does not appear on the Sales Receipt. This might not be in accordance with the Agile approach but it seems difficult to ignore when we think about it.
| 136
In this diagram we have not shown the Reference Data Entities because they add too much to the detail which makes the diagrams more difficult to understand at a glance without adding significantly to the information contained.
7.9 Event 1 A Customer makes a Purchase At this point, we have created the Entities for Customer, Products and Stores But, of course, they are not related. Now we add the Event of a Customer Purchase and this will provide relationships between all the Entities.
7.9.1 Message
At this point, the Customer Purchase generates the Sales Receipt that records the details that we have examined up to this point. Therefore we add the Customer Purchase entity that we will use to add details of Cards, Products, Purchase and Stores. We have separated the details of the Store, Product s and Customer and put them in separate Entities. Therefore, they are replaced by links in ID fields to the other Entities. This results in a simple elegant Data Model that makes it very clear what the Entities are and how they are related. When the time comes, it will be very straightforward for us to generate a Physical Data Model, with the SQL to create the Tables in a Database.
| 137
The Message for this Event includes the details of the Store, Products, Customer Card, and the Date and Time of Purchase. Sales Receipt for Customer Purchase - Store Details - Product Details - Customer Card Details - Date and Time Details
This diagram shows how the Customer Purchase is the Event that ties all the data together, and is, of course, reflects the business event that is the foundation of the business. This Model shows only the Entity names. This makes it suitable for discussion with business users and Subject Matter Experts.
| 138
7.9.3 The Complete Data Model (showing Ref Data and Attributes)
This version of the Model shows the Entity names, the Attributes and the Reference Data. This makes it suitable for discussion with developers and anybody interested in the details, especially of the relationships between the Entities.
| 139
This version of the Model shows the Entity names, the Attributes and the Reference Data, and is taken from this page :
http://www.databaseanswers.org/data_models/arts_retail_and_can_data_model/arts_and _canonical_model.htm
This version of the Model shows only the Entity names to facilitate comparison with the ARTS Model.
| 140
In this Tutorial we have learned how to follow a simple Step-by-Step approach to the design of a Third Normal Form Data Warehouse. We would work with the business users and Subject Matter Experts to establish the important Events and then to agree the data items that should appear in each Message. Our starting-point is that we know the Approach because we have used it before. Therefore we might consider running Facilitated Workshops to guide users to a successful conclusion.
| 141
8. Retail Banks
Here we describe a simple Event-Driven Approach to Data Warehouse Design. It also appears on our Database Answers Web Site with this Data Model for Retail Banks : http://www.databaseanswers.org/data_models/retail_banks/index.htm
The Steps involved are as follows : Identify the Events involved in the Life Cycle of important Entities Define a Message with data for each Event
8.1 Event 1 - Set-up Banks and Branches We know that the Bank has Branches so we define our starting-point accordingly.
| 142
The Message for this Event includes Personal, Contact and Address Details. First we create a new Customers Entity, then match the Address to the Address Entity and add the Address_ID field to the new Customers Entity.
| 143
| 144
8.3 Event 3 Set up a new Account We have created a new Customer, so now we can create an Account for the new Customer.
8.3.1 Message
The Message for this Event includes the data required to set up a new Account.
| 145
| 146
8.4.2 Enhance the Data Warehouse This diagram shows the two new Entities in yellow.
| 147
The Message for this Event includes the Account number, the date and the amount of the deposit
| 148
| 149
The Message for this Event show what is printed on atypical Sales Receipt, including Card Number, Merchant Name, Amount, Date and Time of Purchase.
| 150
| 151
The Message for this Event includes Customer name, Account Number, Date and Amount of Statement.
| 152
| 153
The Message for this Event includes Account Number and Date to be Closed.
| 154
| 155
9.2 Banking You will find this page interesting because it discusses Banking Data Warehouses
http://www.databaseanswers.org/data_models/banking_data_warehouses/index.htm
Here is a Model of Federated Data Marts for Banking http://www.databaseanswers.org/data_models/banking_data_warehouses/federated_data_marts.htm and this one on Banking Acquisitions http://www.databaseanswers.org/data_models/banking_acquisitions/data_warehouse.htm
The bottom of this page on Investment Banking Models shows three versions of a Data Warehouse as it evolved through facilitated Workshops with Client Management :
http://www.databaseanswers.org/data_models/investment_banking/index.htm
It includes this Data Warehouse for Investment Banking http://www.databaseanswers.org/data_models/banking_data_warehouses/investment_banking_da ta_warehouse_final_version.htm 9.2.2 Investment - Settlements Settlements are somewhat like Payments but money can be exchanged both ways and the details can be more complex than conventional Payments. Therefore, we categorise Settlements as specific to Investment Banking Link to the Settlements Data Modelhttp://www.databaseanswers.org/data_models/investment_banking/settlements.htm
| 156
It is rather surprising to find that the majority of Subject Area Models are Generic. However, based on our experience over ten years of working with Investment Banks, we would say that the devil is in the detail. In order words, once we start to develop more detailed Models for a specific Bank, we would find a great deal of bank-specific detail. This discussion is recorded on this page
http://www.databaseanswers.org/data_models/enterprise_data_model_for_investment_banks/index.htm
| 157
This Model shows Federated Data Marts for Corporate Service and Treasury with just one shared Conformed Dimension, which is Time.
Settlements are somewhat like Payments but money can be exchanged both ways and the details can be more complex than conventional Payments. Therefore, we categorise Settlements as specific to Investment Banking Settlements - http://www.databaseanswers.org/data_models/investment_banking/settlements.htm
| 158
9.2.5 Customer Loans The Loan_Fact Entity shows a Dimensional Model for typical Dimensions of Account, Customer, Time and so on.
| 159
Under the heading of Finance, here's a Dimensional Data Mart for Global Custody in an Investment Bank - http://www.databaseanswers.org/data_models/global_custody/data_mart.htm
| 160
| 161
9.4 Insurance
9.4.1 Insurance Top-Level 3NF Model
This Section contains Links to our Web Site and shows the Insurance Enterprise Data Model and Common Data Model. Here's a 3NF Insurance Data Model : http://www.databaseanswers.org/data_models/enterprise_data_model_for_insurance/index.htm
| 162
This Insurance Dimensional Model is on this page : http://www.databaseanswers.org/data_models/insurance_data_warehouses/index.htm We can see that the Dimensional Model Table will hold the Facts, where every record has a unique Fact ID as its Primary Key. The Relationship with the Ref_Data_Levels Entity is mandatory at the Data Levels end because every record must have a Data Level. For the Ref_Calendar Entity, we show one date as being mandatory because every analysis and report has a date field (even if it is implied). .
Products (Car, Home and Personal) http://www.databaseanswers.org/data_models/insurance_car_home_life/index.htm Products (Marine and Motor Vehicles) http://www.databaseanswers.org/data_models/insurance_general/index.htm
| 163
This is a draft description that we produced as we normally do. We then discuss it with business users and SMEs and changes it so that everybody is happy with it. It follows a Product Lifecycle approach, where we follow a typical Product from source to destination. In the case of oil, the source involves Exploration and Refining, as part of the Upstream activities. Refined Oil, in the form of petrol, is then delivered (Downstream) in Oil Tankers, vehicles to the final destination, in the shape of Service Stations, where it is purchased by Customers.
| 164
9.6TEMP Links to Generic (Horizontal) Subject Area Models Accounts - http://www.databaseanswers.org/data_models/investment_banking/accounts.htm Brokers - http://www.databaseanswers.org/data_models/investment_banking/brokers.htm Customers - http://www.databaseanswers.org/data_models/investment_banking/customers.htm Customer Purchases http://www.databaseanswers.org/data_models/investment_banking/customers.htm Deals - http://www.databaseanswers.org/data_models/investment_banking/deals_general.htm Deliveries http://www.databaseanswers.org/data_models/investment_banking/deals_general.htm Staff - http://www.databaseanswers.org/data_models/investment_banking/staf6.htm Transactions - http://www.databaseanswers.org/data_models/tracking_share_transactions/index.htm
| 165
| 166
Although we are practitioners in Data Modelling Best Practice here at Database Answers, we don't often get the chance to use the word 'Canonical'. When we do, we think of a Canonical Data Model as a 'stripped-down' Models which contains the basics for a specific application area. This makes it possible to use it for a number of different purposes :1. To be a standard for messaging in an ESB/SOA environment. 2. To provide a common point of agreement for all stakeholders. 3. To define a Kick-Start for Master Data Management. 4. To establish a starting-point for development of more detailed specific Data Models 5. To serve as a translation between different data sources. This diagram shows our Generic Canonical Data Model which is Event-oriented and this has proved to be the best generic design in our experience. Right now, we are using the Canonical Data Model as a general framework to analyse source data so that it can be used to design a 3NF Data Model and Dimensional Models It occurs again further on where we refer to it in the context. The Model appears on this page : http://www.databaseanswers.org/data_models/canonical_data_models/index.htm
| 167
http://www.databaseanswers.org/data_models/banking_data_warehouses/generic_dimensional_model.htm
This shows the four most common Dimensions of Customer, Location, Product and Calendar (Time period).
| 168
10.4 Conformed Dimensions Conformed Dimensions are Dimensions can be shared between Data Marts because they share the same domains and values. This means that SQL JOINS on these Dimensions will always find a match and return the appropriate number of values. 10.4.1 A Day at the Olympics This shows three Data Marts with some shared Conformed Dimensions. http://www.databaseanswers.org/data_models/a_day_at_the_olympics/index.htm
| 169
10.4.2 Customers and Deposits This Data Model shows a Federated Data Mart for Retail Banks and is from the Database Answers Web Site :-.
http://www.databaseanswers.org/data_models/banking_data_warehouses/federated_data_marts.htm
It shows two Data Marts related by five Conformed Dimensions of Account, Customer, Location and Status.
| 170
10.4.3 Retail This page shows Retail Conformed Data Marts : http://www.databaseanswers.org/data_models/retail_customers/retail_customers_data_mart.htm
The Calendar is a conformant Dimension for the three Data Marts. The Data Warehouse and the Product Data Mart share the conformed dimensions of Product Promotions and Products in Warehouse. The Data Warehouse and the Online Customers Data Mart share the conformed dimensions of Shipments and Shopping Carts.
| 171
| 172
10.6 Snowflake Schema This Data Model shows a typical Snowflake Schema for Customers, Accounts and Transactions. It appears on this page : http://www.databaseanswers.org/data_models/snowflake.htm
| 173
In this book we have presented an approach to Data Warehousing that we have used with great success in past assignments with a wide variety of Clients. Our intention is to update it regularly as a Kindle e-Book and to keep it timely and to establish it as a reference book of Best Practice. We would be very happy to hear from you if you have any comments or suggestions for improvement. Please email us at [email protected]