Database Management SystemUnit 89 min read
Data Warehousing & Data Mining: Architecture, ETL, OLAP, and Predictive Analytics
Unit 8 of Database Management System explores data warehousing (architecture, ETL processes, OLAP cubes) and data mining (techniques like clustering, classification, and association rules), with real-world applications in business intelligence, fraud detection, and customer segmentation. Learn how raw transactional dat
Key Concepts and Definitions
What is a Data Warehouse?
A data warehouse (DW) is a subject-oriented, integrated, time-variant, and non-volatile collection of data designed to support decision-making in an organization. Unlike operational databases (OLTP), it stores historical data optimized for complex queries and analytical processing (OLAP).
Key Characteristics:
| Feature | Operational DB (OLTP) | Data Warehouse (OLAP) |
|---|---|---|
| Purpose | Transaction processing | Decision support |
| Data Volume | Small, current records | Large, historical records |
| Update Frequency | Frequent (real-time) | Periodic (batch-loaded) |
| Query Type | Simple CRUD operations | Complex aggregations |
| Users | Clerks, tellers | Managers, analysts |
How Data Warehouses Work: ETL Process
Data warehouses are built using ETL (Extract, Transform, Load) processes. This involves:
- Extracting data from source systems (e.g., ERP, CRM, transactional databases).
- Transforming data (cleaning, aggregating, standardizing formats).
- Loading data into the data warehouse (often in a star schema or snowflake schema).
flowchart TD
A["Source Systems<br/>(ERP, CRM, OLTP)"] -->|"Extract"| B["ETL Process"]
B --> C["Transform<br/>(Clean, Aggregate, Standardize)"]
C --> D["Load<br/>into Data Warehouse"]
D --> E["Data Marts<br/>(Sales DW, HR DW)"]
E --> F["OLAP Tools<br/>(Power BI, Tableau)"]
F --> G["Business Intelligence<br/>(Dashboards, Reports)"]Example: eSewa’s Data Warehouse
- Source: Transaction logs (payments, billings), user profiles, merchant data.
- ETL: Aggregates daily transactions into monthly/yearly summaries.
- Output: Dashboards showing peak payment hours, fraud patterns, and customer retention trends.
Data Warehouse Architecture
A typical data warehouse follows a multi-layered architecture:
Key Components:
- Staging Area: Holds raw data before transformation.
- Data Warehouse Layer: Stores fact tables (measures) and dimension tables (descriptors).
- Data Marts: Subsets of the DW for specific departments (e.g., Sales Data Mart, HR Data Mart).
- OLAP Server: Enables multidimensional analysis (e.g., "Sales by Region, Product, and Quarter").
OLAP vs. OLTP
| Feature | OLTP (Operational) | OLAP (Analytical) |
|---|---|---|
| Focus | Transactions | Analysis |
| Data Volume | Small, current | Large, historical |
| Query Type | Simple (INSERT, UPDATE) | Complex (aggregations, trends) |
| Response Time | Milliseconds | Seconds to minutes |
| Example | Bank ATM transactions | "Which products sell best in Kathmandu?" |
Example: Ncell’s OLAP System
- OLTP: Processes real-time call logs (who called whom, duration).
- OLAP: Analyzes monthly call patterns to predict peak hours and optimize network load balancing.
Data Mining: Extracting Patterns from Data
Data mining is the process of discovering patterns, correlations, and insights from large datasets using statistical methods, machine learning, and AI.
Key Data Mining Techniques
| Technique | Description | Example Use Case |
|---|---|---|
| Classification | Categorizes data into predefined groups. | Spam detection in emails. |
| Clustering | Groups similar data without predefined labels. | Customer segmentation in Daraz. |
| Association Rules | Finds relationships between variables (e.g., "If A, then B"). | "Customers who buy X also buy Y" (Amazon). |
| Regression | Predicts continuous outcomes (e.g., sales, stock prices). | Forecasting NEPSE stock trends. |
| Anomaly Detection | Identifies rare or unusual patterns (e.g., fraud). | Detecting fake transactions in Khalti. |
Worked Example: Customer Segmentation for Daraz
Problem: Daraz wants to personalize recommendations for customers. Data Mining Technique: Clustering (K-Means Algorithm).
Steps:
- Collect Data: Purchase history, browsing behavior, demographics.
- Preprocess: Normalize data, handle missing values.
- Apply K-Means:
- Group customers into 3 clusters:
- High Spenders (frequent buyers, high cart value).
- Bargain Hunters (buy during sales, low average order value).
- Occasional Buyers (infrequent purchases).
- Group customers into 3 clusters:
- Action: Tailor discounts and recommendations per cluster.
Real-World Applications
1. eSewa: Fraud Detection with Data Mining
- Problem: Detect fake transactions or identity theft.
- Technique: Anomaly Detection (Isolation Forest Algorithm).
- How it Works:
- Trains on normal transaction patterns (time, amount, location).
- Flags transactions that deviate significantly (e.g., sudden large payment from a new device).
- Result: Reduces fraud by 30% in high-risk areas.
2. NTC: Predictive Maintenance for Power Grids
- Problem: Avoid power outages due to equipment failure.
- Technique: Time-Series Forecasting (ARIMA Model).
- How it Works:
- Analyzes historical data on transformer temperatures, voltage fluctuations.
- Predicts failure risk and schedules maintenance proactively.
- Result: Reduces downtime by 25%.
3. Pathao: Dynamic Pricing with OLAP
- Problem: Optimize ride prices based on demand.
- Technique: OLAP Cubes (Drill-Down Analysis).
- How it Works:
- Aggregates ride data by time, location, and driver availability.
- Adjusts prices in real-time during peak hours (e.g., 20% surge in Thapathali at 8 PM).
- Result: 15% increase in driver earnings and better customer satisfaction.
Data Warehousing vs. Data Mining: Key Differences
| Feature | Data Warehousing | Data Mining |
|---|---|---|
| Purpose | Store and manage data for analysis. | Extract patterns/insights from data. |
| Output | Structured, cleaned datasets. | Models, rules, predictions. |
| Tools | SQL, ETL (Informatica, SSIS). | Weka, Python (Scikit-learn), R. |
| Example | Sales data warehouse for reports. | Finding "frequently bought together" items. |
Exam Tip: How to Score Full Marks
Define Clearly:
- Data Warehouse: Always mention subject-oriented, integrated, time-variant, non-volatile.
- Data Mining: Define as "discovering patterns from large datasets using statistical/AI methods."
Compare OLAP vs. OLTP:
- Use a table (as above) and relate to real examples (e.g., Ncell’s call logs vs. sales trends).
ETL Process:
- Draw a flowchart (as above) and link to a business case (e.g., eSewa’s payment data).
Data Mining Techniques:
- Match techniques to examples:
- Classification → Spam filter.
- Clustering → Customer segmentation (Daraz).
- Association Rules → "Buy X, get Y" (Amazon).
- Match techniques to examples:
Worked Examples:
- Always tie to Nepalese companies (eSewa, Daraz, NTC) for contextual marks.
- Show SQL-like pseudocode for OLAP queries (e.g.,
SELECT Region, SUM(Sales) FROM Sales WHERE Year=2023 GROUP BY Region).
Diagrams Are Mandatory:
- Star Schema for DW structure.
- OLAP Cube for multidimensional analysis.
- K-Means Clustering for data mining.
Based on the TU BBA syllabus for Database Management System (IT232), unit 8.
Discussion
Loading…