Upload
ppradeepkumar
View
10
Download
0
Tags:
Embed Size (px)
DESCRIPTION
DATA STAGE Case study
Citation preview
DataStage Version 7.5.1a Case Study
Page 1 of 75
Note:
DataStage Version 7.5.1a
Training Workshop
Case Study
DataStage Version 7.5.1a Case Study
Page 2 of 75
Table of Contents 1. Introduction ................................................................................................. 3 2. OLTP Model .................................................................................................. 6 3. Dimension Model ............................................................................................ 7
3.1. Signing Fact Table ..................................................................................... 7 3.2. Premium Fact Table .................................................................................. 8 3.3. Claim Fact Table ...................................................................................... 9
4. High Level Project Plan for all Stages ................................................................ 10 5. ETL Job Design ............................................................................................ 12
5.1. Staging Area Specification ......................................................................... 12 5.2. Data Warehousing Job specifications ............................................................ 16
6. Database Script to CREATE Tables .................................................................... 24 6.1. SCRIPT TO CREATE BASE TABLES .................................................................. 24 6.2. Script to CREATE STAGING TABLES ............................................................... 27 6.3. SCRIPT TO CREATE DIMENSION TABLES .......................................................... 28 6.4. Script to CREATE FACT TABLES ................................................................... 30
7. Jobs to load all the Tables .............................................................................. 32 7.1. JOBS TO LOAD ALL THE STAGING TABLES ....................................................... 32 7.1.1. Staging Table for Assured Detail .............................................................. 32 7.1.2. Staging Table for Insurer Detail ............................................................... 35 7.1.3. Staging Table for Broker Detail ............................................................... 37 7.1.4. Staging Table for Premium Detail ............................................................ 39 7.1.5. Staging Table for Policy Details. .............................................................. 41 7.1.6. Staging Table for Claim Detail ................................................................ 42 7.2. Jobs to Load all the Dimension tables ........................................................... 44 7.2.1. Dimension table for Assured ................................................................... 44 7.2.2. Dimension table for Insurer .................................................................... 46 7.2.3. Dimension table for Broker .................................................................... 49 7.2.4. Dimension table for Risk Coverage ........................................................... 51 7.2.5. Dimension table for Claim Rejection ........................................................ 52 7.2.6. Dimension table for Claim Reason ............................................................ 54 7.2.7. Dimension table for Time ...................................................................... 56 7.2.8. Dimension table for Currency ................................................................. 58 7.2.9. Dimension table for Paid by ................................................................... 60 7.2.10. Dimension table for Premium Type .......................................................... 62 7.3. JOBS TO LOAD ALL THE FACT TABLES ........................................................... 64 7.3.1. Fact Table for Signing Status .................................................................. 64 7.3.2. Fact Table for Premium ........................................................................ 65 7.3.3. Fact Table for Claim ............................................................................ 68 7.4. INTEGRATING ALL THE JOBS ....................................................................... 71 7.4.1. LOADING PREMIUM FACT TABLE ............................................................... 71 7.4.2. LOADING SIGNING FACT TABLE ................................................................ 72 7.4.3. LOADING CLAIM FACT TABLE................................................................... 73 7.4.4. INTEGRATING INSURANCE FACT TABLE ...................................................... 75
DataStage Version 7.5.1a Case Study
Page 3 of 75
1. Introduction
Overview of Case study: ABC Brokerage Company is organization (Insurance
market) offering insurance brokerage services for high risk like ships, aero planes, oil
refineries etc. They want to build the data warehouse which allows them to analyze
the patterns associated to policy signing status, premium submission and claims
claimed till date.
Brokers (Agent) are front facers of insurance market. Any one who wants to get
insured (called Assured) need to contact broker for initial transaction. Broker in turn
identifies the underwriting agents (Called Insurers) and syndicates who can provide
protection for property and causality.
Brokers (i.e. agents) prepare reports, maintain records, seek out new clients, and,
in the event of a loss, help policyholders to settle policy holder’s insurance claims. Assured/Broker/Insurer relationship
Insurers select what risks to insure and decide how much premium to be charged for accepting those risks. Insurers can be one of the insurance company who take either entire risk or they can share risk with other insurance company. Based on above scenario, the whole of the transaction can be summed up in the following tables. You are expected to refer given tables from existing transactional model.
1. Policy table
Columns Descriptions
Policy_No(PK) The Policy number of each and every policy insured.
Policy_Date The date of the policy taken
Signing_status (y/n) The signing status of the policy
Signed_date The Date on which policy is signed
Assured_code(FK) The code for the Assured. Through whom policy has taken (Client / customer code who gets insured/take insurance)
Insurer_code(FK) The code for the Insurer (Broker Code)
Broker_Code(FK) Broker Code
Policy_Type(FK) The type of the policy
Sum_Assured The Assured Sum for the Policy
Assured Broker
Insurer
RELATIONSHIP CLIENT INSURANCE
BROKER
INSURANCE
COMPANY 1
INSURANCE
COMPANY 2
INSURANCE
COMPANY 3
TRANSACTION
DataStage Version 7.5.1a Case Study
Page 4 of 75
2. Policy Type
Columns Descriptions
Policy_Type(PK) Policy type
Policy Desc Type of policies such as Normal/Reinsurance policy
3. Risk Coverage Table
Columns Descriptions
Risk_coverage_code(PK) Risk Coverage Code
Risk_Desc Type of risks such as Airplane/Oil refineries/Ships etc
4. Policy_Transction_Detail
Columns Descriptions
Transaction_No (PK) Transaction No
Policy_No (FK) Unique Policy number
Transaction_Type (Premium/Claim)
Type of Transaction whether Premium paid or Amount claimed
Transaction_currency Type of currency used for transaction
Transaction_Amount Amount of Transaction
Risk_coverage_code(FK) Risk Area i.e. what to be insured is recorded here
5. Premium
Columns Descriptions
Policy_No (FK) Policy number
Transaction_No (FK) Transaction Number
Premium_type_Code(FK) The type of the premium such as Quarterly/Half yearly/Yearly
Premium amount The premium amount
Premium_paid_currency The currency in which the premium is paid
Paid_by Mode of payment (Cash/ cheque / DD)
Premium_Due_Date Date by which Premium should be paid
Paid_date Actual paid date of premium
6. Claim
Columns Description
Policy_No(FK) Policy number
Transaction_No (FK) Transactions
Claim_type (FK) Type of Claims which refers risk coverage table
Claim_amount Amount of claim
Assured_code (FK) Assured code who applies for claim
Claim_reason_code(FK) Claim reason code
claim_paid_currency Claim Currency
Claim_due_date Claim Due date
claim_paid_date Claim paid date
Claim_rejection_code(FK) Reason for claim rejection
DataStage Version 7.5.1a Case Study
Page 5 of 75
7. Claim reason
Columns Descriptions
Claim_reason_code(PK) Claim reason code
Claim_reason_desc Details of claim description
8. Claim Rejection
Columns Descriptions
Claim_rejection_code(PK) Claim rejection code
Claim_rejection_desc Details of claim rejection
9. Assured_Details
Columns Descriptions
Assured _code (PK) Assured Code
Assured_Name Name (first name, middle name and last name)
add_1 Address (street name, area)
add_2 Location name
city City
country_code (FK) Where from assured
10. Insurer_Details
Columns Descriptions
Insurer_code (PK) Insurer Code
Insurer_Name Name (first name, middle name and last name)
add_1 Address (street name, area)
add_2 Location name
city City
country_code (FK) Where from Insurer is located
11. Country
Columns Descriptions
Country_code(PK) Country Code
Country_name Country name
Country_currency Country Currency
12. Broker Detail
Columns Descriptions
Broker_code (PK) Broker Code
Broker_Name Name (first name, middle name and last name)
add_1 Address (street name, area)
add_2 Location name
city City
Country_code (FK) Where from Insurer is located
DataStage Version 7.5.1a Case Study
Page 6 of 75
2. OLTP Model
Based on above scenario following OLTP Model is built
DataStage Version 7.5.1a Case Study
Page 7 of 75
3. Dimension Model
Insurance Market wish to build data warehouse to analyze the patterns associated to policy signing status, premium submission and claims claimed till date. Following dimensional model is designed to perform above task 3.1. Signing Fact Table
DataStage Version 7.5.1a Case Study
Page 8 of 75
3.2. Premium Fact Table
DataStage Version 7.5.1a Case Study
Page 9 of 75
3.3. Claim Fact Table
DataStage Version 7.5.1a Case Study
Page 10 of 75
4. High Level Project Plan for all Stages
Project : Insurance Case Study
Project Plan
Sr. No Job Name Job Description
1 Joining Assured Detail with Country Detail in STG_ASSURED_DETAIL
This Job extracts data from Assured table and joins country table with respect to country code presented in the Assured Table. Holds data into STG_ASSURED_DETAIL Table
2 Joining Insurer Detail with Country Detail in STG_INSURER_DETAIL
This Job extracts data from Insurer_Detail table and joins country_Detail table with respect to country code presented in the insurer table. Holds data into STG_INSURER_DETAIL table.
3 Joining Broker Detail with Country Detail
in STG_BROKER_DETAIL
This job extract data from Broker_Detail table and joins country_Detail table with respect to country presented in the Broker table. Holds data into STG_BROKER_DETAIL table.
4 Populating Data from Premium_Detail
into STG_PREMIUM_DETAIL This Job populates data from PREMIUM_DETAIL table into STG_PREMIUM_DETAIL
5 Populating from Policy Detail to
STG_POLICY_DETAIL This job extract data from POLICY_DETAIL and populates into STG_POLICY_DETAIL
6 Populating data into
STG_CLAIM_DETAIL This job populates data from POLICY_DETAIL and CLAIM_DETAIL into STG_CLAIM_DETAIL
7 Populating Assured Detail with
Surrogate key into DIM_ASSURED
This job populates data from assured detail (STG_ASSURED_DETAIL) into Assured Dimension and also generates surrogate key for every record inserted.
8 Populating Insurer Detail with Surrogate
key into DIM_INSURER
This job populates data from Insurer detail (STG_INSURER_DETAIL) into Insurer Dimension along with generating surrogate key for every record inserted.
9 Populating Broker Detail with Surrogate
key into DIM_BROKER This job populates data from Broker detail (STG_BROKER_DETAIL) into Broker Dimension along with generating surrogate key for every record inserted.
10 Time Dimension Loading (DIM_TIME) This job loads time detail from time.txt into Time Dimension
11 Populating Currency_Type table into
DIM_CURRENCY
This Job populates currency information from CURRENCY (DB) and loads into DIM_CURRENCY table
12 Populates data into
DIM_RISK_COVERAGE This Populates data from RISK_COVERAGE table and load into DIM_RISK_COVERAGE table
13 Populates data into
DIM_CLAIM_REASON This Populates data from CLAIM_REASON table and load into DIM_CLAIM_REASON table
14 Populate data into
DIM_CLAIM_REJECTION This Populates data from CLAIM_REJECTION table and load into DIM_CLAIM_REJECTION table
DataStage Version 7.5.1a Case Study
Page 11 of 75
15 Populating Premium_TYPE table into
DIM_PREMIUM
This job populates static information from PREMIUM_TYPE into DIM_PREMIUM along with generating PREMIUM_KEY
16 Populating payment mode ie. from
Paid_By into DIM_PAID_BY
This job populates static information from Paid_By (DB) into DIM_PAID_BY along with generating PAID_BY KEY
17 Populating data into Premium type dimension DIM_PREMIUM_TYPE
This job populates data into DIM_PREMIUM_TYPE
18 Loading into FACT_SIGNING_STATUS
Populate data from DIM_INSURER, DIM_ASSURED, DIM_BROKER,DIM_CURRENCY, DIM_PAID_BY AND STG_POLICY_DETAIL INTO FACT_SIGNING_STATUS
19 Loading into FACT_PREMIUM
Populate data from DIM_INSURER, DIM_ASSURED, DIM_BROKER,DIM_CURRENCY, DIM_PREMIUM, DIM_PAID_BY AND STG_PREMIUM_DETAIL INTO FACT PREMIUM
20 Loading into FACT_CLAIME
Populate data from DIM_INSURER, DIM_ASSURED, DIM_BROKER,DIM_CURRENCY, DIM_PREMIUM, DIM_PAID_BY, DIM_RISK_COVERAGE, DIM_CLAIM_REASON AND STG_CLAIM_DETAIL INTO FACT CLAIM
21 Integrating All Jobs related to
FACT _PREMIUM table
This job will load data from INSURER, BROKER, ASSURER, DATE, CURRENCY,PAID BY, PREMIUM_TYPE DIMENSIONS and STG_PREMIUM_DETAIL TABLE.
22 Integrating All Jobs related to
FACT_SIGNING_STATUS table
This job will load data from INSURER, BROKER, ASSURER,DATE DIMENSIONS and STG_POLIC_DETAIL table.
23 Integrating All Jobs related to
FACT_CLAIM table
This job will load data from INSURER, BROKER, ASSURER, DATE, CURRENCY, PAID BY, PREMIUM_TYPE DIMENSIONS and STG_CLAIM_DETAIL TABLE.
24 Integrating all jobs This job will test the over all flow and structure.
DataStage Version 7.5.1a Case Study
Page 12 of 75
5. ETL Job Design
5.1. Staging Area Specification
Project : Insurance Case Study Details of Staging ETL Specification
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error handling Constraints
Colu
mn
nam
e
Data
Type
Wid
th
Key T
ype
Colu
mn
nam
e
Data
Type
Wid
th
Key T
ype
Sourc
e
Ta
ble
Targ
et
Ta
ble
STG_1
1 STG_ASSURED_DETAIL
ASSURE
ASSURED_CODE N 5 PK ASSURED_CODE N 5 PK
Direct Mapping
Any Error with respect to
Assured Code and Country Code goes to STG_Assured_Detail_Reject
_Table
Assure_Code :
Not Null
Assured_Code : PK
ASSURED_NAME V 20 ASSURED_NAME V 20 Direct Mapping
ADDRESS_1 N 20 ADDRESS_1 V 20 Direct Mapping
ADDDRESS_2 V 20 ADDDRESS_2 V 20 Direct Mapping Country_Code : Not Null
CITY N 20 CITY V 20 Direct Mapping
COUNTRY
COUNTRY_NAME V 40 COUNTRY.COUNTRY_NAME
V 40 Look-up
(Country_Code)
LAST_UPDATE_ON D FK LAST_UPDATE_ON D
STG_Assured_Detail.Last_Upd
ate_On. look-up(Control.Job
Name and Control.Last_U
pdate_On, Control.Last_Execution_Date) control table for incrimental load
STG_2
1 STG_INSURER_D
INSURER
INSURER_CODE N 5 PK INSURER_CODE N 5 PK
Direct Mapping Any Error with
respect to Insurer_Code :
Insurer_Code : PK
DataStage Version 7.5.1a Case Study
Page 13 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error handling Constraints
Colu
mn
nam
e
Data
Type
Wid
th
Key T
ype
Colu
mn
nam
e
Data
Type
Wid
th
Key T
ype
Sourc
e
Ta
ble
Targ
et
Ta
ble
ETAIL INSURER_NAME V 20 INSURER_NAME V 20 Direct Mapping Assured Code and Country Code goes to STG_Insurer_Detail_Reject_
Table
Not Null
ADDRESS_1 V 20 ADDRESS_1 V 20 Direct Mapping
ADDRESS_2 V 20 ADDDRESS_2 V 20 Direct Mapping Country_Code : Not Null
CITY V 20 CITY V 20 Direct Mapping
COUNTRY
COUNTRY_NAME V 40 COUNTRY.COUNTRY_
NAME V 40
Look-up (Country_Code)
LAST_UPDATE_ON D LAST_UPDATE_ON D
STG_Insurer_Detail.Last_Updat
e_On. look-up(Control.Job
Name and Control.Last_U
pdate_On, Control.Last_Execution_Date) control table for incrimental load
STG_3
1 STG_BROKER_D
ETAIL
BROKER
BROKER_CODE N 5 PK BROKER_CODE N 5 PK
Direct Mapping
Any Error with respect to
Brokerr_Code and
Country_Code goes to
Broker_Detail_reject table
Broker_Code:
Not Null
Broker_Code: Not Null
BROKER_NAME V 20 BROKER_NAME V 20 Direct Mapping Last_Up
date: Not Null
Country_Code_ Not
Null
ADDRESS_1 V 20 ADDRESS_1 V 20 Direct Mapping
ADDDRESS_2 V 20 ADDDRESS_2 V 20 Direct Mapping
CITY V 20 CITY V 20 Direct Mapping
COUNTRY
COUNTRY_NAME V 40 COUNTRY.COUNTRY_
NAME V 40
Look-up (Country_Code)
DataStage Version 7.5.1a Case Study
Page 14 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error handling Constraints
Colu
mn
nam
e
Data
Type
Wid
th
Key T
ype
Colu
mn
nam
e
Data
Type
Wid
th
Key T
ype
Sourc
e
Ta
ble
Targ
et
Ta
ble
LAST_UPDATE_ON D LAST_UPDATE_ON D
STG_Broker_Detail.Last_Update
_On. look-up(Control.Job
Name and Control.Last_U
pdate_On, Control.Last_Execution_Date) control table for incrimental load
STG_4
1 STG_POLICY_DE
TAIL
POLICY_DETAIL
POLICY_ID N 10
SIGN_DATE D SIGN_DATE D Direct Mapping
Any Entry where
Sign_Date is null will be sending to
STG_Policy_Detail_Reject
table
All Colums
: Not Nulll
Assured_Code : Not
null
SIGN_STATUS V 1 SIGN_STATUS V 1 Direct Mapping Insurer_Co
de : Not Null
INSURER_CODE N 10 INSURER_CODE N 10 Direct Mapping Status : Not
Null
ASSURED_CODE N 10 ASSURED_CODE N 10 Direct Mapping Broker_Code : Not Null
BROKER_CODE N 10 BROKER_CODE N 10 Direct Mapping Policy_No :
Not Null
STG_5
1 STG_PREMIUM_DETAIL
PREMIUM__DET
AIL PREMIUM_ID N 5 PK PREMIUM_ID 5 Direct Mapping
Premium_Type_Code: Not Null
PREMIUM TYPE
PREMIUM_TYPE_DETAIL V 40 Premium_Type_Code T 40
Premium_Detail..Premium_Type_
code = Premium_Type.Premium_Type_C
ode
PREMIUM_CURRENCY V 20 PREMIUM_CURRENC
Y V 20 Direct Mapping
PREMIUM_AMOUNT N 10 PREMIUM_AMOUNT N 10 Direct Mapping
DataStage Version 7.5.1a Case Study
Page 15 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error handling Constraints
Colu
mn
nam
e
Data
Type
Wid
th
Key T
ype
Colu
mn
nam
e
Data
Type
Wid
th
Key T
ype
Sourc
e
Ta
ble
Targ
et
Ta
ble
PAID_BY V 20 PAID_BY V 20 Direct Mapping
STG_6
1 STG_CLAIM_DET
AIL
POLICY_DETAIL
INSURER_CODE N 10 FK INSURER_CODE N 10 FK
Direct Mapping
Any unsoloicited
record will go to the
Claim_Detail_Reject table.
ASSURED_CODE N 10 FK ASSURED_CODE N 10 FK
Direct Mapping
BROKER_CODE N 10 FK BROKER_CODE N 10 FK
Direct Mapping
CLAIM_DETAIL
RISK_COVERAGE_CODE V 20 FK RISK_COVERAGE_CO
DE V 20
FK
Direct Mapping
CLAIM_REASON_CODE V 20 FK CLAIM_REASON_COD
E V 20
FK
Direct Mapping
CLAIM_AMOUNT N 10 CLAIM_AMOUNT V 10 Direct Mapping
CLAIM_CURRENCY V 5 CLAIM_CURRENCY V 20 Direct Mapping
PAID_DATE D PAID_DATE D Direct Mapping
LAST_UPDATE_ON D LAST_UPDATE_ON D
STG_Claim_Detail.Last_Update
_On. look-up(Control.Job
Name and Control.Last_U
pdate_On, Control.Last_Execution_Date) control table for incrimental load
DataStage Version 7.5.1a Case Study
Page 16 of 75
5.2. Data Warehousing Job specifications
Details DW ETL Specification
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error Constraints
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
ha
nd
lin
g
So
urc
e
Ta
ble
Ta
rge
t
Ta
ble
1
Assure_Code :
Not Null
Assure_Key : Not Null
DW_1
DIM_ASSURED
STG_ASSURED_DETAIL
Assured_Key N 5 PK System generated
Number
Last_Update_on: Not Null
ASSURED_CODE N 5 ASSURED_CODE N 5 Direct Mapping
ASSURED_NAME V 20 ASSURED_NAME V 20 Direct Mapping
ADDRESS_1 V 20 ADDRESS_1 V 20 Direct Mapping
ADDRESS_2 V 20 ADDRESS_2 V 20 Direct Mapping
CITY V 20 CITY V 20 Direct Mapping
COUNTRY_NAME V 40 COUNTRY_NAME V 40 Direct Mapping
LAST_UPDATE_ON
D FK LAST_UPDATE_ON D Direct Mapping
Status C 1
ASSURED_DETAIL.STATUS SHOULD
SET TO 'y' FOR EVERY ACTIVATED
RECORD
INSERTED_ON D System generated
Date
DataStage Version 7.5.1a Case Study
Page 17 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error Constraints
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
ha
nd
lin
g
So
urc
e
Ta
ble
Ta
rge
t
Ta
ble
DW_2
1 DIM
INSURER
STG_INSURER_DETAIL
Insurer_Key N 5
INSURER_CODE N 5 INSURER_CODE N 5 PK System generated
Number
Insurer_Code:
Not Null
Insurer_Key : Not Null
INSURER_NAME V 20 INSURER_NAME V 5 Direct Mapping Last_Update_On: Not Null
ADDRESS_1 V 20 ADDRESS_1 V 20 Direct Mapping
ADDRESS_2 V 20 ADDRESS_2 V 20 Direct Mapping
CITY V 20 CITY V 20 Direct Mapping
COUNTRY_NAME V 40 COUNTRY_NAME V 40 Direct Mapping
LAST_UPDATE_ON
D LAST_UPDATE_ON D Direct Mapping
STATUS C 1
INSURER_DETAIL.STATUS SHOULD SET TO 'y' FOR
EVERY ACTIVATED RECORD
INSERTED_ON D System generated
Date
DW_3
1
DIM_BROKER
STG_BROKER_D
ETAIL
Broker_Key N 5
BROKER_CODE N 5 BROKER_CODE N 5 PK Direct Mapping
Broker_Code : Not
Null
Broker_Key: Not Null
BROKER_NAME V 20 BROKER_NAME V 20 Direct Mapping Last_Update_On: Not Null
ADDRESS_1 V 20 ADDRESS_1 V 20 Direct Mapping
DataStage Version 7.5.1a Case Study
Page 18 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error Constraints
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
ha
nd
lin
g
So
urc
e
Ta
ble
Ta
rge
t
Ta
ble
ADDRESS_2 V 20 ADDRESS_2 V 20 Direct Mapping
CITY V 20 CITY V 20 Direct Mapping
COUNTRY_NAME V 40 COUNTRY_NAME V 40 Direct Mapping
LAST_UPDATE_ON
D Direct Mapping
STATUS C 1
BROKER_DETAIL.STATUS SHOULD SET TO 'y' FOR
EVERY ACTIVATED RECORD
INSERTED_ON D System generated
Date
DW_4
1
DIM_DATE
TIME.TXT
DATE_KEY N 10 PK System Generated
Number
Date_Key : Not
Null
YEAR N 10 YEAR N 10 Direct Mapping
QUARTERS N 10 QUARTERS N 10 Direct Mapping
MONTH N 10 MONTH N 10 Direct Mapping
WEEK N 10 WEEK N 10 Direct Mapping
DAY_OF_THE_MONTH
N 10 DAY_OF_THE_MONTH N 10 Direct Mapping
INSURER_KEY N 10 FK INSURER_KEY N 10 PK
LOOK-UP(STG_Policy_Detail.ASSURED_COD
E)
DW_6
1 DIM_PAI
D_BY PAID_BY PAID_BY_KEY V 3 PK Payment_Mode_Code T 5 PK Direct Mapping
Payment_Mode_Code:
Not Null
PAID_BY_KEY : Not Null
DataStage Version 7.5.1a Case Study
Page 19 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error Constraints
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
ha
nd
lin
g
So
urc
e
Ta
ble
Ta
rge
t
Ta
ble
PAID_BY V 20 Payment_Mode_BY T 20 Direct Mapping
Payment_Mode_BY : Not
Null
PAID_BY: Not Null
INSERTED_ON D System Generated
Date
DW_7
1
DIM_PREMIUM
PREMIUM_TYPE
PREMIUM_KEY V 5 PK Premium_Type_Code T 5 PK Direct Mapping
Premium_Type_Code : Not
Null
PREMIUM_KEY: Not Null
PREMIUM_TYPE V 20 premium_Type T 20 Direct Mapping premium_Type : Not Null
PREMIUM_TYPE: Not Null
INSERTED_ON D System Generated
Date
DW_8
1
DIM_CURRENC
Y
CURRENCY
CURRENCY_KEY V 5 PK Currency_Type_Code T 5 PK Direct Mapping
Currency_Type_Code:Not
Null
Currency_Key: Not Null
PREMIUM_CURRENCY
V 20 Currency_type T 20 Direct Mapping Currency_Type: Not Null
Premium_Currency_ Not Null
INSERTED_ON D System Generated
Date
DW_10
1
DIM_RISK_COVERAG
E
RISK_COVERA
GE
RISK_KEY N 10 PK
All Colums : Not Nulll RISK_COVERAGE
_CODE V 20 RISK_COVEAGE_CODE V 20 PK Direct mapping
RISK_COVEAGE_CODE :
PK
DataStage Version 7.5.1a Case Study
Page 20 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error Constraints
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
ha
nd
lin
g
So
urc
e
Ta
ble
Ta
rge
t
Ta
ble
RISK_COVERAGE_DESC
V 20 RISK_COVERAGE_DES
C V 20 Direct mapping
INSERTED_ON D System Generated
Date
DW_11
1 DIM_CLAIM_REASON
CLAIM_REASON
CLAIM_KEY N 10 PK
CLAIN_REASON_CODE
V 20 CLAIN_REASON_CODE V 20 PK Direct mapping
CLAIM_REASON_DESC
V 20 CLAIM_REASON_DESC V 20 Direct mapping
INSERTED_ON D System Generated
Date
DW_12
1 DIM_CURRENC
Y
CURRENCY
CURRENCY_KEY N 10 PK Direct Mapping
CURRENCY_NAME
V 5 Currency_name Direct mapping
INSERTED_ON D System Generated
Date
DW_5
2
FACT_SIGNING_STATU
S
DIM_DATE
BROKER_KEY N 10 FK BROKER_KEY N 10 PK
LOOK-UP(STG_Policy_Detail.INSURER_CODE
)
Assured:Key : Not
Null
DIM_BROKER
ASSURED_KEY N 10 FK ASSURED_KEY N 10 PK LOOK-
UP(STG_Policy_Detail.BROKER_CODE)
Insurer_Key: Not
Null
All Columns : Not Nulll
DIM_ASSURED
SIGN_DATE N 10 FK SIGN_DATE N 10 PK Broker_Key : Not
Null
DataStage Version 7.5.1a Case Study
Page 21 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error Constraints
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
ha
nd
lin
g
So
urc
e
Ta
ble
Ta
rge
t
Ta
ble
DIM_INSURER
TOTAL_SIGN_POLICIES
N 10 SIGN_STATUS V 1
AGGREGATE BASED ON
INSURER_KEY,BROKER_KEY,
ASSURED_KEY AND SIGN_DATE
Where STG_Policy_Detail.S
taus='Y'
Total_Policy_Sign Not null
STG_POLICY_DE
TAIL
TOTAL_UNSIGNED_POLICIES
N 10 SIGN_STATUS V 1
AGGREGATE BASED ON
INSURER_KEY,BROKER_KEY,
ASSURED_KEY AND SIGN_DATE
Where STG_Policy_Detail.S
taus='N'
Total_Policy_Not_Signed: Not Null
INSERTED_ON D System Generated
Date
DW_9
2 FACT_PREMIU
M
DIM_DATE
PREMIUM_KEY N 5 PREMIUM_KEY N 5 Direct Mapping
DIM_BROKER
INSURER_KEY N 5 INSURER_KEY N 5
LOOK-UP(STG_Policy_Detail.INSURER_CODE
)
DIM_ASSURED
BROKER_KEY N 5 BROKER_KEY N 5 LOOK-
UP(STG_Policy_Detail.BROKER_CODE)
Premium_Id : Not
Null
Assured_Key : Npt Null
DIM_INSURER
ASSURED_KEY N 5 ASSURED_KEY N 5
LOOK-UP(STG_Policy_Detail.ASSURED_COD
E)
Premium_Detail : Not Null
Broker Key : Not Null
DataStage Version 7.5.1a Case Study
Page 22 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error Constraints
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
ha
nd
lin
g
So
urc
e
Ta
ble
Ta
rge
t
Ta
ble
DIM_PREMIUM
PREMIUM_KEY V 5 PREMIUM_KEY V 5 Direct Mapping Premium_Amount : Not Null
Insurer Key : Not Null
DIM_PAID_BY
PAID_BY_KEY V 5 PAID_BY_KEY V 5 Direct Mapping Premium_Id :
Not Null
DIM_CURRENCY
CURRENCY_KEY V 5 CURRENCY_KEY V 5 Direct Mapping
STG_PREMIUM_DETAIL
DATE_KEY N DATE_KEY N Direct Mapping
PREMIUM_AMOUNT
N 10 PREMIUM_AMOUNT N 10
AGGREGATE BASED ON
INSURER_KEY,BROKER_KEY,
ASSURED_KEY AND
DATE_KEY,PAID_BY_KEY,CURRENCY
_KEY AND PREMIUM_KEY
INSERTED_ON D System Generated
Date
DW_13
2 FACT_C
LAIM
DIM_DATE
DATE_KEY N 10 FK DATE_KEY N 10 PK LOOK-
UP(STG_Policy_Detail.INSURER_CODE)
Assured:K
ey : Not Null
DIM_BROKER
BROKER_KEY N 10 FK BROKER_KEY N 10 PK LOOK-
UP(STG_Policy_Detail.BROKER_CODE)
Insurer_K
ey: Not Null
All Colums : Not Nulll
DataStage Version 7.5.1a Case Study
Page 23 of 75
Sr. No
Load Order
Target Table
Source Table
Target column Source column Transformation Error Constraints
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
Co
lum
n
na
me
Data
Ty
pe
Wid
th
Key
Ty
pe
ha
nd
lin
g
So
urc
e
Ta
ble
Ta
rge
t
Ta
ble
DIM_ASSURED
ASSURED_KEY N 10 FK ASSURED_KEY N 10 PK Broker_Key : Not
Null
DIM_INSURER
INSURER_KEY N 10 FK INSURER_KEY V 1 PK Total_Policy_Sign Not null
DIM_RISK_COVE
RAGE RISK_KEY N 10 FK RISK_KEY N 10 PK
DIM_CLAIM_REASON
CLAIM_KEY N 10 FK CLAIM_KEY N 10 PK
DIM_CURRENCY
CURRENCY_KEY V 5 FK CURRENCY_KEY V 5 PK
STG_CLAIM_DE
TAIL CLAIM_AMOUNT N 10 CLAIM_AMOUNT N 10 Not Null
STG_CLAIM_DE
TAIL
SANCTIONED_AMOUNT
N 10 CLAIM_AMOUNT N 10 Not Null
INSERTED_ON D System Generated
Date
DataStage Version 7.5.1a Case Study
Page 24 of 75
6. Database Script to CREATE Tables
6.1. SCRIPT TO CREATE BASE TABLES DROP TABLE Country_Detail CASCADE CONSTRAINTS; DROP TABLE Insurer_Detail CASCADE CONSTRAINTS; DROP TABLE Assured_Detail CASCADE CONSTRAINTS; DROP TABLE Broker_Detail CASCADE CONSTRAINTS; DROP TABLE Policy_Type CASCADE CONSTRAINTS; DROP TABLE Policy_Detail CASCADE CONSTRAINTS; DROP TABLE Claim_rejection CASCADE CONSTRAINTS; DROP TABLE Claim_Reason CASCADE CONSTRAINTS; DROP TABLE Claim_Details CASCADE CONSTRAINTS; DROP TABLE Premium_Detail CASCADE CONSTRAINTS; DROP TABLE Risk_coverage CASCADE CONSTRAINTS; CREATE TABLE Risk_coverage ( Risk_Coveage_Code VARCHAR2(20) NOT NULL, Risk_Coverage_Desc VARCHAR2(20) NULL, PRIMARY KEY (Risk_Coveage_Code)); CREATE TABLE Country_Detail (
Country_Code VARCHAR2(20) NOT NULL, Country_Name VARCHAR2(40) NULL, Country_Currency VARCHAR2(20) NULL, PRIMARY KEY (Country_Code) );
CREATE TABLE Insurer_Detail ( Insurer_Code NUMBER(10) NOT NULL, I nsurer_Name VARCHAR2(20) NULL, Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Country_Code VARCHAR2(20) NOT NULL, Last_Update_Date DATE DEFAULT SYSDATE, T_CODE VARCHAR2(5) DEFAULT 'IDIM', PRIMARY KEY (Insurer_Code), FOREIGN KEY (Country_Code) REFERENCES Country_Detail ); CREATE TABLE Assured_Detail ( Assured_Code NUMBER(10) NOT NULL, Assured_Name VARCHAR2(20) NULL, Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Country_Code VARCHAR2(20) NOT NULL, Last_updated_on DATE DEFAULT SYSDATE, T_CODE VARCHAR2(5) DEFAULT 'ADIM', PRIMARY KEY (Assured_Code), FOREIGN KEY (Country_Code) REFERENCES Country_Detail );
DataStage Version 7.5.1a Case Study
Page 25 of 75
CREATE TABLE Broker_Detail ( Broker_Code NUMBER(10) NOT NULL, Broker_Name VARCHAR2(20) NULL, Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Country_Code VARCHAR2(20) NOT NULL, Last_Update_Date DATE DEFAULT SYSDATE, T_CODE VARCHAR2(5) DEFAULT 'BDIM', PRIMARY KEY (Broker_Code), FOREIGN KEY (Country_Code) REFERENCES Country_Detail ); CREATE TABLE Policy_Type ( Policy_Type VARCHAR2(20) NOT NULL, Policy_Desc VARCHAR2(200) NULL, PRIMARY KEY (Policy_Type) ); CREATE TABLE Policy_Detail ( Policy_No NUMBER(10) NOT NULL, Sum_Assured NUMBER(10,2) NULL, Policy_Date DATE NULL, Sign_Date DATE NULL, Sign_Status VARCHAR2(20) NULL, Premium_Frequency NUMBER(10,2) NULL, Insurer_Code NUMBER(10) NOT NULL, Assured_Code NUMBER(10) NOT NULL, Policy_Type VARCHAR2(20) NOT NULL, Broker_Code NUMBER(10) NOT NULL, Risk_Coveage_Code VARCHAR2(20) NOT NULL, PRIMARY KEY (Policy_No), FOREIGN KEY (Risk_Coveage_Code) REFERENCES Risk_coverage, FOREIGN KEY (Insurer_Code) REFERENCES Insurer_Detail, FOREIGN KEY (Assured_Code) REFERENCES Assured_Detail, FOREIGN KEY (Broker_Code) REFERENCES Broker_Detail, FOREIGN KEY (Policy_Type) REFERENCES Policy_Type ); CREATE TABLE Claim_rejection ( Claim_Rejection_Code VARCHAR2(20) NOT NULL, Claim_Rejection_Desc VARCHAR2(20) NULL, PRIMARY KEY (Claim_Rejection_Code) ); CREATE TABLE Claim_Reason ( Claim_Reason_Code VARCHAR2(20) NOT NULL, Claim_Reason_Desc VARCHAR2(20) NULL, PRIMARY KEY (Claim_Reason_Code) ); CREATE TABLE Claim_Details ( Claim_id NUMBER(10) NOT NULL, Policy_No NUMBER(10) NOT NULL, Claim_Currency VARCHAR2(20) NULL, Claim_Amount NUMBER(10,2) NULL, Paid_By VARCHAR2(20) NULL, Paid_Date DATE NULL, Due_Date DATE NULL,
DataStage Version 7.5.1a Case Study
Page 26 of 75
Claim_Type VARCHAR2(20) NOT NULL, Claim_Reason_Code VARCHAR2(20) NOT NULL, Claim_Rejection_Code VARCHAR2(20) NOT NULL, PRIMARY KEY (Claim_id, Policy_No), FOREIGN KEY (Policy_No) REFERENCES Policy_Detail, FOREIGN KEY (Claim_Type) REFERENCES Risk_coverage, FOREIGN KEY (Claim_Rejection_Code) REFERENCES Claim_rejection, FOREIGN KEY (Claim_Reason_Code) REFERENCES Claim_Reason); CREATE TABLE Premium_Detail ( Premium_id NUMBER(10) NOT NULL, Policy_No NUMBER(10) NOT NULL, Premium_Type_Code VARCHAR2(20) NULL, Premium_Currency VARCHAR2(20) NULL, Premium_Amount NUMBER(10,2) NULL, Paid_By VARCHAR2(20) NULL, Paid_Date DATE NULL, Due_Date DATE NULL, PRIMARY KEY (Premium_id, Policy_No), FOREIGN KEY (Policy_No) REFERENCES Policy_Detail ); DROP TABLE CONTROL_TABLE; CREATE TABLE control_table (
LAST_EXEC_DATE DATE, CURRENT_EXEC_DATE DATE, T_CODE VARCHAR2(10) );
DROP TABLE CURRENCY; CREATE table currency (
CURRENCY_CODE VARCHAR2 (5) primary key, CURRENCY_NAME VARCHAR2 (20) );
DROP TABLE PAID_BY; CREATE TABLE PAID_BY(
PAID_BY_CODE VARCHAR2(5) primary key, PAID_BY VARCHAR2(10));
DROP TABLE PREMIUM_TYPE; CREATE TABLE PREMIUM_TYPE(
PREMIUM_TYPE_CODE VARCHAR2(5) primary key, PREMIUM_TYPE VARCHAR2(20));
DataStage Version 7.5.1a Case Study
Page 27 of 75
6.2. Script to CREATE STAGING TABLES DROP TABLE STG_Policy_Detail CASCADE CONSTRAINTS; CREATE TABLE STG_Policy_Detail (
Policy_No NUMBER(10)NULL, Assured_Code NUMBER(10)NULL, Insurer_Code NUMBER(10)NULL, Broker_Code NUMBER(10)NULL, Sign_Date DATE NOT NULL, Sign_Status VARCHAR2(20) NULL, Last_Updated_On DATE NULL );
DROP TABLE STG_Claim_Details CASCADE CONSTRAINTS; CREATE TABLE STG_Claim_Details (
Claim_id NUMBER(10)NOT NULL, Assured_Code NUMBER(10)NULL, Insurer_Code NUMBER(10)NULL, Broker_Code NUMBER(10)NULL, Claim_Currency VARCHAR2(20) NULL, Claim_Amount NUMBER(10)NULL, Paid_By VARCHAR2(20) NULL, Paid_Date DATE NULL, Last_update_on DATE NULL, Claim_Reason_code VARCHAR2(20) NOT NULL, claim_type varchar(20), Primary key (Claim_id, Assured_Code, Insurer_Code, Broker_Code,Claim_Reason_code) );
DROP TABLE STG_Assured_Detail CASCADE CONSTRAINTS; CREATE TABLE STG_Assured_Detail ( Assured_Code NUMBER(10)NOT NULL, Assured_Name VARCHAR2(20) NULL, Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Country_Name VARCHAR2(40) NULL, Last_updated_on DATE NULL ); DROP TABLE STG_Insurer_Detail CASCADE CONSTRAINTS; CREATE TABLE STG_Insurer_Detail ( Insurer_Code NUMBER(10)NOT NULL, Assured_Code NUMBER(10)NULL, Broker_Code NUMBER(10)NULL, Insurer_Name VARCHAR2(20) NULL, Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Country_Name VARCHAR2(40) NULL, Last_Update_Date DATE NULL );
DataStage Version 7.5.1a Case Study
Page 28 of 75
DROP TABLE STG_Broker_Detail CASCADE CONSTRAINTS; CREATE TABLE STG_Broker_Detail ( Broker_Code NUMBER(10)NOT NULL, Broker_Name VARCHAR2(20) NULL,
Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Country_Name VARCHAR2(40) NULL, Last_Update_Date DATE NULL ); DROP TABLE STG_Premium_Detail CASCADE CONSTRAINTS; CREATE TABLE STG_Premium_Detail ( Premium_id NUMBER(10)NOT NULL, Insurer_Code NUMBER(10)NOT NULL, Assured_Code NUMBER(10)NULL, Broker_Code NUMBER(10)NULL, Premium_Type VARCHAR2(20) NULL, Premium_Currency VARCHAR2(20) NULL, Premium_Amount NUMBER(10)NULL, Paid_By VARCHAR2(20) NULL, Paid_Date DATE NULL );
6.3. SCRIPT TO CREATE DIMENSION TABLES DROP TABLE Fact_Premium CASCADE CONSTRAINTS; DROP TABLE Fact_Signing_Status CASCADE CONSTRAINTS; DROP TABLE Fact_Claim CASCADE CONSTRAINTS; DROP TABLE DIM_Paid_By CASCADE CONSTRAINTS; DROP TABLE DIM_Premium CASCADE CONSTRAINTS; DROP TABLE DIM_Currency CASCADE CONSTRAINTS; DROP TABLE Dim_Risk_coverage CASCADE CONSTRAINTS; DROP TABLE Dim_Claim_Reason CASCADE CONSTRAINTS; DROP TABLE Dim_Date CASCADE CONSTRAINTS; DROP TABLE Dim_Assured CASCADE CONSTRAINTS; DROP TABLE Dim_Insurer CASCADE CONSTRAINTS; DROP TABLE Dim_Broker CASCADE CONSTRAINTS; DROP TABLE Dim_Claim_rejection CASCADE CONSTRAINTS; CREATE TABLE Dim_Claim_rejection ( Claim_key NUMBER(10) NOT NULL, Claim_Rejection_Code VARCHAR2(20) NOT NULL, Claim_Rejection_Desc VARCHAR2(20) NULL, PRIMARY KEY (Claim_key) );
DataStage Version 7.5.1a Case Study
Page 29 of 75
CREATE TABLE Dim_Broker ( Broker_Key NUMBER(10) NOT NULL, Broker_Code VARCHAR2(20) NOT NULL, Broker_Name VARCHAR2(20) NULL, Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Status CHAR(2) NULL, Inserted_On DATE DEFAULT SYSDATE, Last_Updated_Date DATE NULL, Country VARCHAR2(40) NULL, PRIMARY KEY (Broker_Key) ); CREATE TABLE Dim_Insurer ( Insurer_Key NUMBER(10) NOT NULL, Insurer_Code VARCHAR2(20) NOT NULL, Insurer_Name VARCHAR2(20) NULL, Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Status CHAR(2) NULL, Inserted_On DATE DEFAULT SYSDATE, Last_Updated_Date DATE NULL, Country VARCHAR2(40) NULL, PRIMARY KEY (Insurer_Key) ); CREATE TABLE Dim_Assured ( Assured_Key NUMBER(10) NOT NULL, Assured_Code NUMBER(10) NOT NULL, Assured_Name VARCHAR2(20) NULL, Address_1 VARCHAR2(20) NULL, Address_2 VARCHAR2(20) NULL, City VARCHAR2(20) NULL, Status CHAR(2) NULL, Inserted_On DATE DEFAULT SYSDATE, Last_Updated_Date DATE NULL, Country VARCHAR2(40) NULL, PRIMARY KEY (Assured_Key) ); CREATE TABLE Dim_Claim_Reason ( Claim_Key NUMBER(10) NOT NULL, Claim_Reason_Code VARCHAR2(20) NOT NULL, Claim_Reason_Desc VARCHAR2(20) NULL, Inserted_On DATE DEFAULT SYSDATE, PRIMARY KEY (Claim_Key) ); CREATE TABLE Dim_Risk_coverage ( Risk_Key NUMBER(10) NOT NULL, Risk_coverage_code VARCHAR2(20) NULL, Risk_Coverage_Desc VARCHAR2(20) NULL, Inserted_On DATE DEFAULT SYSDATE, PRIMARY KEY (Risk_Key) );
DataStage Version 7.5.1a Case Study
Page 30 of 75
CREATE TABLE DIM_Currency ( Currency_Key VARCHAR2(5) NOT NULL, CURRENCY_CODE VARCHAR2 (5), Currency_Name VARCHAR2(40) NOT NULL, Inserted_On DATE DEFAULT SYSDATE, PRIMARY KEY (Currency_Key) ); CREATE TABLE DIM_Premium ( Premium_Key NUMBER(10) NOT NULL, Premium_Type VARCHAR2(20) NOT NULL, Inserted_On DATE DEFAULT SYSDATE, PRIMARY KEY (Premium_Key) ); CREATE TABLE DIM_Paid_By ( Paid_By_Key VARCHAR2(5) NOT NULL, Paid_By VARCHAR2(20) NULL, Inserted_On DATE DEFAULT SYSDATE, PRIMARY KEY (Paid_By_Key) ); CREATE TABLE Dim_Date ( DAY DATE NULL, Date_Key NUMBER(10) NOT NULL, Year NUMBER(4) NULL, Quarters VARCHAR2(10) NULL, Month NUMBER(4) NULL, Week VARCHAR2(10) NULL, Day_of_The_Month NUMBER(4) NULL, PRIMARY KEY (Date_Key) );
6.4. Script to CREATE FACT TABLES CREATE TABLE Fact_Claim ( Insurer_Key NUMBER(10) NOT NULL, Broker_Key NUMBER(10) NOT NULL, Assured_Key NUMBER(10) NOT NULL, Claim_Key NUMBER(10) NOT NULL, Date_Key NUMBER(10) NOT NULL, Risk_Key NUMBER(10) NOT NULL, Currency_Key VARCHAR2(5) NOT NULL, Claim_Amount NUMBER(10) NULL, Sanctioned_Amount NUMBER(10) NULL, PRIMARY KEY (Insurer_Key, Broker_Key, Assured_Key, Claim_Key, Date_Key, Risk_Key, Currency_Key), FOREIGN KEY (Currency_Key) REFERENCES DIM_Currency, FOREIGN KEY (Risk_Key) REFERENCES Dim_Risk_coverage, FOREIGN KEY (Date_Key) REFERENCES Dim_Date, FOREIGN KEY (Claim_Key) REFERENCES Dim_Claim_Reason, FOREIGN KEY (Assured_Key) REFERENCES Dim_Assured, FOREIGN KEY (Insurer_Key) REFERENCES Dim_Insurer, FOREIGN KEY (Broker_Key) REFERENCES Dim_Broker );
DataStage Version 7.5.1a Case Study
Page 31 of 75
CREATE TABLE Fact_Signing_Status ( Insurer_Key NUMBER(10) NOT NULL, Broker_Key NUMBER(10) NOT NULL, Assured_Key NUMBER(10) NOT NULL, DATE_KEY NUMBER(10) NOT NULL, Sign_Date char(10) NULL, Total_Sign_Policies NUMBER(10) NULL, Total_Unsigned_Policies NUMBER(10) NULL, PRIMARY KEY (Insurer_Key, Broker_Key, Assured_Key, Sign_Date), FOREIGN KEY (DATE_KEY) REFERENCES Dim_Date, FOREIGN KEY (Insurer_Key) REFERENCES Dim_Insurer, FOREIGN KEY (Assured_Key) REFERENCES Dim_Assured, FOREIGN KEY (Broker_Key) REFERENCES Dim_Broker ); CREATE TABLE Fact_Premium ( Insurer_Key NUMBER(10) NOT NULL, Broker_Key NUMBER(10) NOT NULL, Assured_Key NUMBER(10) NOT NULL, Date_Key NUMBER NOT NULL, Premium_Key NUMBER(10) NOT NULL, Paid_By_Key VARCHAR2(5) NOT NULL, Currency_Key VARCHAR2(5) NOT NULL, Premium_Amount NUMBER NULL, PRIMARY KEY ( Insurer_Key, Broker_Key, Assured_Key, Date_Key, Premium_Key, Paid_By_Key, Currency_Key), FOREIGN KEY (Currency_Key) REFERENCES DIM_Currency, FOREIGN KEY (Premium_Key) REFERENCES DIM_Premium, FOREIGN KEY (Paid_By_Key) REFERENCES DIM_Paid_By, FOREIGN KEY (Date_Key) REFERENCES Dim_Date, FOREIGN KEY (Assured_Key) REFERENCES Dim_Assured, FOREIGN KEY (Insurer_Key) REFERENCES Dim_Insurer, FOREIGN KEY (Broker_Key) REFERENCES Dim_Broker);
DataStage Version 7.5.1a Case Study
Page 32 of 75
7. Jobs to load all the Tables
7.1. JOBS TO LOAD ALL THE STAGING TABLES
7.1.1. Staging Table for Assured Detail
PARAMETERS DESCRIPTION
Sources
Assured_Detail Holds the details of the Assured Table that is fetched from the OLTP system.
Country_Detail Holds the details of the Country Table.
Control table Holds the dates of the Last and Current Executions.
Targets
STG_Assured_Detail It temporarily holds the structured data which has to be loaded in the Assured Dimension table
Control_Detail Holds the new dates after the records have been inserted.
In the Control_Table (Target), the Update action is chosen as User-Defined SQL and in the Enter SQL the following statement is given UPDATE CONTROL_TABLE SET LAST_EXEC_DATE = ?, CURRENT_EXEC_DATE = ?, T_CODE = ? WHERE T_CODE='ADIM';
DataStage Version 7.5.1a Case Study
Page 33 of 75
Transformations
Trn_to_Stg
Matches the column Country_Code from the Assured_detail and Country_Detail and merges all the details. It performs lookup with the dates obtained from Control_table and then inserts the records to the Staging Table.
DataStage Version 7.5.1a Case Study
Page 34 of 75
In this transformation a constraint is provided so that the dates from the Assured_Detail can be matched with the dates from the Control_Table before the data is inserted. For Ex.: Link_Assured_Detail.LAST_UPDATED_ON >= Link_Control_Table.LAST_EXEC_DATE And Link_Assured_Detail.LAST_UPDATED_ON <= Link_Control_Table.CURRENT_EXEC_DATE
This Job loads the Staging Table for the Assured Details. From this staging table the data is loaded into the Fact table.
DataStage Version 7.5.1a Case Study
Page 35 of 75
7.1.2. Staging Table for Insurer Detail
PARAMETERS DESCRIPTION
Sources
Insurer_Detail Holds the details of the Insurer Table that is fetched from the OLTP system.
Country_Detail Holds the details of the Country Table.
Control table Holds the dates of the Last and Current Executions.
Targets
STG_Insurer_Detail It temporarily holds the structured data which has to be loaded in the Insurer Dimension table
Control_Detail Holds the new dates after the records have been inserted.
In the Control_Table (Target), the Update action is chosen as User-Defined SQL and in the Enter SQL the following statement is given UPDATE CONTROL_TABLE SET LAST_EXEC_DATE = ?, CURRENT_EXEC_DATE = ?, T_CODE = ? WHERE T_CODE='IDIM';
DataStage Version 7.5.1a Case Study
Page 36 of 75
Transformations
Trn_to_Stg
Matches the column Country_Code from the Insurer and Country_Detail and merges all the details. It performs lookup with the dates obtained from Control_table and then inserts the records to the Staging Table.
In this transformation a constraint is provided so that the dates from the Insurer_Detail can be matched with the dates from the Control_Table before the data is inserted. For Ex.: Link_Insurer_Detail.LAST_UPDATED_ON >= Link_Control_Table.LAST_EXEC_DATE And Link_Insurer_Detail.LAST_UPDATED_ON <= Link_Control_Table.CURRENT_EXEC_DATE This job loads the Staging table for the Insurer. From this staging table the data is loaded to the Insurer Dimension table.
DataStage Version 7.5.1a Case Study
Page 37 of 75
7.1.3. Staging Table for Broker Detail
PARAMETERS DESCRIPTION
Sources
Broker_Details Holds the details of the Broker Table that is fetched from the OLTP system.
Country_Details Holds the details of the Country Table.
Control table Holds the dates of the Last and Current Executions.
Targets
STG_Broker_Detail It temporarily holds the structured data which has to be loaded in the Broker Dimension table
Control_Detail Holds the new dates after the records have been inserted.
In the Control_Table (Target), the Update action is chosen as User-Defined SQL and in the Enter SQL the following statement is given
UPDATE CONTROL_TABLE SET LAST_EXEC_DATE = ?, CURRENT_EXEC_DATE = ?, T_CODE = ? WHERE T_CODE=’BDIM';
DataStage Version 7.5.1a Case Study
Page 38 of 75
Transformations
Trn_to_Stg
Matches the column Country_Code from the Broker_detail and Country_Detail and merges all the details. It performs lookup with the dates obtained from Control_table and then inserts the records to the Staging Table.
Here also the dates are to be compared by applying the constraint as in the previous Exercise. For Ex.: Link_Broker_to_Trn.LAST_UPDATE_DATE >= Link_Control_to_Trn.LAST_EXEC_DATE And Link_Broker_to_Trn.LAST_UPDATE_DATE <= Link_Control_to_Trn.CURRENT_EXEC_DATE
This job loads the Staging Table for the Broker Details. From this the data is loaded to the Broker Dimension table.
DataStage Version 7.5.1a Case Study
Page 39 of 75
7.1.4. Staging Table for Premium Detail
Loading into Staging_Premium_Detail
PARAMETERS DESCRIPTION
Sources
Premium_Type Holds the details about the Premium
Premium_Detail Holds the complete details of the Premium
Policy_Detail Holds complete information related to the policy like the policy number, the policy date etc.
Targets
Stg_Premium_detail A table that temporarily holds the structured data that is obtained from the source tables.
Transformations
Trn_to_Stg Used to load the data to the Stg_Premium_Detail table.
DataStage Version 7.5.1a Case Study
Page 40 of 75
This Job fetches the data from the Premium_type, Premium_Detail and Policy_Details table and populates the Stg_Premium_Detail.
DataStage Version 7.5.1a Case Study
Page 41 of 75
7.1.5. Staging Table for Policy Details.
Loading the Staging Table for Policy Details.
Stg_Policy_Details
PARAMETERS DESCRIPTION
Sources
Policy_Detail Table Holds detail information related to the Policy.
Targets
Stg_Policy_Details The Staging table for Policy_Detail.
Transformations
Trn_Policy_Detail A table that temporarily holds the structured data that is obtained from the source tables.
DataStage Version 7.5.1a Case Study
Page 42 of 75
The transformer would look like this
This job loads the staging table for the Policy Details. 7.1.6. Staging Table for Claim Detail
DataStage Version 7.5.1a Case Study
Page 43 of 75
Stg_Claim_Details
PARAMETERS DESCRIPTION
Sources
Claim_Detail Table Holds the complete details related about Claim.
Policy_Detail Table Holds detail information related to the Policy.
Targets
Stg_Claim_Details The Staging table for Claim_Detail.
Transformations
Trn_Stg_Claim_Detail A table that temporarily holds the structured data that is obtained from the source tables.
This Job loads the Claim Staging Table
DataStage Version 7.5.1a Case Study
Page 44 of 75
7.2. Jobs to Load all the Dimension tables
7.2.1. Dimension table for Assured
Extracting Data from Assured and country table and populates into Assured Dimension
PARAMETERS DESCRIPTION
Sources
Stg_Assured_Detail It temporarily holds the structured data which has to be loaded in the Assured Dimension table.
Targets
Dim_Assured Holds data of the Assured dimension
Transformations
Trn_Stg_to_Dim
Transforms the data obtained from the Stg_Assured_Detail to Dim_Assured generating a Surrogate key i.e, Assured_Key. The field Inserted On is the date on which we are inserting the records. This is the current date. The Status should be set to Y for every Activated Record
DataStage Version 7.5.1a Case Study
Page 45 of 75
This job fetches the Assured details from the Staging Table. The job loads the data to the dimension table along with the Surrogate key. In this way the Assured Dimension is created.
DataStage Version 7.5.1a Case Study
Page 46 of 75
7.2.2. Dimension table for Insurer
Extracting Data From insurer and country table and populates into Insurer Dimension
PARAMETERS DESCRIPTION
Sources
Insurer_Detail Holds the details of the Insurer Table that is fetched from the OLTP system.
Country_Detail Holds the details of the Country Table.
Control table Holds the dates of the Last and Current Executions.
Targets
STG_Insurer_Detail It temporarily holds the structured data which has to be loaded in the Insurer Dimension table
Dim_Insurer Holds data of the Insurer dimension
Control_Table Holds the new dates after the records have been inserted.
In the Control_Table (Target), the Update action is chosen as User-Defined SQL and in the Enter SQL the following statement is given UPDATE CONTROL_TABLE SET LAST_EXEC_DATE = ?, CURRENT_EXEC_DATE = ?, T_CODE = ? WHERE T_CODE='IDIM';
DataStage Version 7.5.1a Case Study
Page 47 of 75
Transformations
Trn_to_Stg
Matches the column Country_Code from the Insurer and Country_Detail and merges all the details. It performs lookup with the dates obtained from Control_table and then inserts the records to the Staging Table.
DataStage Version 7.5.1a Case Study
Page 48 of 75
Transformations
Trn_Dim_Insurer
Transforms the data obtained from the Stg_Insurer_Detail to Dim_Insurer generating a Surrogate key i.e, Insurer_Key. The field Inserted On is the date on which we are inserting the records. This is the current date. The Status should be set to Y for every Activated Record
This job captures the Insurer details from the OLTP system. It matches and merges the data from the Country table and puts the data temporarily into the Staging table. After that the job loads the data to the Dimension table along with the Surrogate key. In this way the Insurer Dimension is created.
DataStage Version 7.5.1a Case Study
Page 49 of 75
7.2.3. Dimension table for Broker Extracting Data from Broker and country table and populates into Broker Dimension
PARAMETERS DESCRIPTION
Sources
Stg_Broker_Details It temporarily holds the structured data which has to be loaded in the Broker Dimension table
Targets
Dim_Broker Holds data of the Broker dimension
DataStage Version 7.5.1a Case Study
Page 50 of 75
Transformations
Trn_Stg_to_Dim
Transforms the data obtained from the Stg_Broker_Detail to Dim_Broker generating a Surrogate key i.e, Broker_Key. The field Inserted On is the date on which we are inserting the records. This is the current date. The Status should be set to Y for every Activated Record
This job fetches the Broker details from the OLTP system. It matches and merges the data from the Country table and puts the data temporarily into the staging table. After that the job loads the data to the dimension table along with the Surrogate key. In this way the Broker Dimension is created.
DataStage Version 7.5.1a Case Study
Page 51 of 75
7.2.4. Dimension table for Risk Coverage
PARAMETERS DESCRIPTION
Sources
Risk_Coverage Table It holds the risk coverage code and its respective description.
Targets
Dim_Risk_Coverage The Dimensional table fro Risk_Coverage
Transformations
Trn_Risk_Coverage Used to load the data to the Dim_Risk_Coverage table.
In the transformation a Surrogate key (RISK_KEY) is generated and also has the details of the date on which the record has been inserted i.e., Current date The Transformation looks like :
DataStage Version 7.5.1a Case Study
Page 52 of 75
This Job loads the data for Risk Coverage Dimension table.
7.2.5. Dimension table for Claim Rejection
DataStage Version 7.5.1a Case Study
Page 53 of 75
PARAMETERS DESCRIPTION
Sources
Claim_Rejection Table It holds the Claim Rejection code and its respective description.
Targets
Dim_Claim_Rejection The Dimensional table for Claim_Rejection.
Transformations
Trn_Claim_Rejection Used to load the data to the Dim_Claim_Rejection table.
The transformation Looks like this
DataStage Version 7.5.1a Case Study
Page 54 of 75
7.2.6. Dimension table for Claim Reason Loading the Dimension table for Claim Reason
PARAMETERS DESCRIPTION
Sources
Claim_Reason Table It holds the Claim Reason code and its respective description.
Targets
Dim_Claim_Reason The Dimensional table for Claim_Reason.
Transformations
Trn_Claim_Reason Used to load the data to the Dim_Claim_Reason table.
DataStage Version 7.5.1a Case Study
Page 55 of 75
DataStage Version 7.5.1a Case Study
Page 56 of 75
7.2.7. Dimension table for Time
Extracting Data from Time.txt file and populates into Time Dimension
PARAMETERS DESCRIPTION
Sources
Time_Txt A text file that contains one column of dates, in the format yyyy-mm-dd.
Targets
Dim_Date Table that has seven columns containing each date and its corresponding month, quarter, week, day of the month and year alongwith the time_key
Transformations
Trn_Date
It is used to create new derivatives of the dates (month, quarter,day,week and year)
DataStage Version 7.5.1a Case Study
Page 57 of 75
This Job loads the time dimension table, in the data mart. The time dimension table contains many rows of dates, and almost always has additional columns to allow grouping of events by broader date ranges. Once this is accomplished, the time dimension allows to quickly group data by month, quarter or year, which is useful for reporting, and much more efficient than selecting every date individually, or using an expression of “greater than” one date and “less than” another.
DataStage Version 7.5.1a Case Study
Page 58 of 75
7.2.8. Dimension table for Currency
Loading into Currency dimension
PARAMETERS DESCRIPTION
Sources
Currency Table It has details about the Currency code and the Currency Name
Country Table It has the country details along with the country Currency Code
Targets
Dim_Currency It holds the Currency details along with the Currency_key .
Transformations
Trn_Dim_Currency Used to load the data to the Dim_Currency Dimension table.
DataStage Version 7.5.1a Case Study
Page 59 of 75
This job loads the data into the Dim_Currency Dimension. A surrogate key (Currency_key) is generated and the column Inserted On is the date on which the ecord has been inserted i.e., the Current Date The transformation matches the Country_Currency of the country table and Currency_Code of the currency table and loads the data into the dimension table (i.e, Dim_Currency)
DataStage Version 7.5.1a Case Study
Page 60 of 75
7.2.9. Dimension table for Paid by
Extracting data from paid_by txt file/database and loading into Paid_by dimension
PARAMETERS DESCRIPTION
Sources
Paid_By ODBC table that contains paid_by code and its respective description (it is paid by cash /cheque or DD).
Targets
Dim_Paid_By It holds the Paid_by details along with the Paid_by_key and the information of when it was paid.
Transformations
Trn_Paid_By Used to load the data to the Paid_By Dimension table
DataStage Version 7.5.1a Case Study
Page 61 of 75
This job loads the data into the Dim_Paid_By Dimension. A surrogate key (Paid_By_key) is generated and the column Inserted On is the date on which the record has been inserted i.e., the Current Date This job loads the Paid_by Dimension table and gives the information of how and when the Claim / Premium have been paid. It holds the details of how the payment has been made i.e whether it is paid by cash/cheque or DD
DataStage Version 7.5.1a Case Study
Page 62 of 75
7.2.10. Dimension table for Premium Type
Extracting data from Premium Type text file/Database and load into Premium_Type
PARAMETERS DESCRIPTION
Sources
Premium_type Table It holds the details about the Premium
Targets
Dim_Premium_Type It holds the details of the premium along with the premium key and the details of when it was inserted
Transformations
Trn_to_Dim Used to load the data to the Dim_Premium table.
DataStage Version 7.5.1a Case Study
Page 63 of 75
This job loads the data into the Dim_Premium Dimension. A surrogate key (Premium_key) is generated and the column Inserted On is the date on which the record has been inserted i.e., the Current Date This job loads the data into the Dim_Premium Dimension. Premium types can be Quarterly / Half Yearly / Yearly (Annual)
DataStage Version 7.5.1a Case Study
Page 64 of 75
7.3. JOBS TO LOAD ALL THE FACT TABLES
7.3.1. Fact Table for Signing Status
Loading the Signing Fact Table
PARAMETERS DESCRIPTION
Sources
Dim_Time The Time Dimension Table
Dim_Insurer The Insurer Dimension Table
Dim_Broker The Broker Dimension Table
Dim_Assured The Assured Dimension Table
Stg_Policy_Detail A table that temporarily holds the structured data that is obtained from the source tables.
Targets
Signing_Status_fact The Signing Status fact table.
Reject_Fact_Signing_Status All the rejected data are stored in this table.
DataStage Version 7.5.1a Case Study
Page 65 of 75
Transformations
Trn_Dim_to_Fact Used to load the data to the Fact table for Signing Status.
This job verifies those records which are matching with all condition will be loaded into signing fact table. The records which are not matching such if any of the key holds null value , date is not matching etc will be loaded into rejected signing fact table.
Add here screen shot of above transformer Trn_Dim_to_Fact
7.3.2. Fact Table for Premium
Loading the Premium Fact Table
PARAMETERS DESCRIPTION
Sources
Dim_Time The Time Dimension Table
Dim_Insurer The Insurer Dimension Table
Dim_Broker The Broker Dimension Table
Dim_Assured The Dimension table for Assured
Dim_Currency The Currency Dimension Table
DataStage Version 7.5.1a Case Study
Page 66 of 75
Dim_Premium Holds the details of the Premium
Stg_Premium_Detail Staging Table holding details of Premium
Targets
Fact_Premium The Fact Table for Premium
Transformations
Trn_to_Stg Used to load the data to the Aggregator from where we load it into the Premium Fact.
The aggregator is used to Aggregate the Premium Amount. The Aggregator should look like this :
DataStage Version 7.5.1a Case Study
Page 67 of 75
DataStage Version 7.5.1a Case Study
Page 68 of 75
7.3.3. Fact Table for Claim
Loading the Fact Claim table
PARAMETERS DESCRIPTION
Sources
Dim_Time The Time Dimension Table
Dim_Insurer The Insurer Dimension Table
Dim_Broker The Broker Dimension Table
Dim_Assured The Assured Dimension Table
Dim_Currency The Currency Dimension Table
Dim_Risk_coverage The Risk_coverage Dimension table
Dim_Claim_reason The Claim_reason Dimension table
Stg_Claim_Detail A table that temporarily holds the structured data that is obtained from the source tables.
DataStage Version 7.5.1a Case Study
Page 69 of 75
Targets
Stg_Premium_detail A table that temporarily holds the structured data that is obtained from the source tables.
Transformations
Trn_Fact_Claim Used to load the data to the Fact table for Claim.
Aggregator Used for grouping up the data
The Aggregator looks like this :
DataStage Version 7.5.1a Case Study
Page 70 of 75
DataStage Version 7.5.1a Case Study
Page 71 of 75
7.4. INTEGRATING ALL THE JOBS
7.4.1. LOADING PREMIUM FACT TABLE
PARAMETERS DESCRIPTION
Source Job activities
Job_Dim_Time This executes to load into time dimension
Job_Dim_Insurer This job executes to load into Insurer detail
Job_Dim_Broker This Job executes to load into Broker dimension
Job_Dim_Assured This job executes to load into assured dimension.
Job_Dim_Currency This job executes to load country currency Information into currency dimension
Job_Paid_by This job executes to load how payment has made ie. either Cheque/DD/Cash
Job_Premium_Type This job executes to load premium type information such whether premium Quarterly/Half yearly/Yearly
Target Job Activity
Job_loading_Premium_Detail This Job executes to load to detail information into staging table of premium detail
Job_loading_Premium_Fact This job executes to load into premium fact table
Sequencer jobs
Sequencer Dim_Sucess sequencer gathers information of all successfully
DataStage Version 7.5.1a Case Study
Page 72 of 75
exected jobs and proceed to loading into signing fact table.
Sequencer Dim_Failuer sequencer gathers information of failure of any of the jobs. Sends mail to concern person regarding intimation of failure of job.
Job Notification activity Success_of_Premium_Fact- Once it loads successfully then it Intimates through email message to concern person. It terminates all jobs in case of failure.
Job Notification activity Dimension Load Failure- Sends email message to concern person in case of failure.
Job Notification activity Failure of loading premium detail- Sends email message to concern person in case of failure of loading of premium detail.
Job Terminator It terminates all job in case of failure of claim fact table
7.4.2. LOADING SIGNING FACT TABLE
PARAMETERS DESCRIPTION
Source Job activities
Job_Dim_Time This executes to load into time dimension
Job_Dim_Insurer This job executes to load into Insurer detail
Job_Dim_Broker This Job executes to load into Broker dimension
Job_Dim_Assured This job executes to load into assured dimension.
Job_Stg_Policy_Detail This job executes to hold details information related to Policy including signing status of the policy and premium paid till date.
Target Job Activity
DataStage Version 7.5.1a Case Study
Page 73 of 75
Job_Signing_Status_fact This job executes to load into signing fact table.
Sequencer jobs
Sequencer Dim_Sucess sequencer gathers information of all successfully exected jobs and proceed to loading into signing fact table.
Sequencer Dim_Failuer sequencer gathers information of failure of any of the jobs. Sends mail to concern person regarding intimation of failure of job.
Job Notification activity
(Success_of_Claim_Fact) Once it loads successfully then it Intimates through email message to concern person. It terminates all jobs in case of failure.
Job Notification activity
(Dimension Load Failure) Sends email message to concern person in case of failure.
Job Terminator It terminates all job in case of failure of claim fact table
7.4.3. LOADING CLAIM FACT TABLE
DataStage Version 7.5.1a Case Study
Page 74 of 75
PARAMETERS DESCRIPTION
Source Job activities
Job_Dim_Time This executes to load into time dimension
Job_Dim_Insurer This job executes to load into Insurer detail
Job_Dim_Broker This Job executes to load into Broker dimension
Job_Dim_Assured This job executes to load into assured dimension.
Job_Claim_Detail This job executes to hold details information related to claim how and when claim has made. Also holds reason for claim.
Target Job Activity
Job_Loading_Claim_Fact This job executes to load into Claim Fact table
Sequencer jobs
Sequencer Dim_Sucess sequencer gathers information of all successfully exected jobs and proceed to loading into claim fact table.
Sequencer Dim_Failuer sequencer gathers information of failure of any of the jobs. Sends mail to concern person regarding intimation of failure of job.
Job Notification activity (Success_of_Claim_Fact) Once it loads successfully then it Intimates through email message to concern person. It terminates all jobs in case of failure.
Job Notification activity (Dimension Load Failure) Sends email message to concern person in case of failure.
Job Terminator It terminates all job in case of failure of claim fact table
DataStage Version 7.5.1a Case Study
Page 75 of 75
7.4.4. INTEGRATING INSURANCE FACT TABLE
PARAMETERS DESCRIPTION
Job activities
Premium_Fact This job executes to load loading into premium fact table
Signing_Fact This job executes to load loading into Signing fact table
Claim_Fact This job executes to load loading into Claim fact table.