Data Model — All Core Objects (Fundamental Layer)¶
🔴 Quan trọng · Kiến thức SCD4A Fundamental + Fact Snapshot + Fact Append + Classification SCD1
ERD Overview¶
Diagram tổng quan — chỉ hiển thị tên bảng và quan hệ, không có fields.
erDiagram
INVOLVED_PARTY ||--o{ CUSTOMER : "is-a"
INVOLVED_PARTY ||--o{ ORG_UNIT : "is-a"
ARRANGEMENT ||--o{ DEPOSIT_ARRANGEMENT : "is-a"
ARRANGEMENT ||--o{ LOAN_ARRANGEMENT : "is-a"
ORG_UNIT }o--|| DEPOSIT_ARRANGEMENT : "branch"
CUSTOMER }o--|| DEPOSIT_ARRANGEMENT : "owner"
PRODUCT }o--|| DEPOSIT_ARRANGEMENT : "product"
ORG_UNIT }o--|| LOAN_ARRANGEMENT : "branch"
CUSTOMER }o--|| LOAN_ARRANGEMENT : "owner"
PRODUCT }o--|| LOAN_ARRANGEMENT : "product"
ARRANGEMENT }o--|| TRANSACTION : "account"
CUSTOMER }o--|| TRANSACTION : "customer"
ARRANGEMENT }o--|| ARRANGEMENT_BALANCE : "account"
CUSTOMER }o--|| ARRANGEMENT_BALANCE : "customer"
CURRENCY }o--o{ TRANSACTION : "currency"
CLASSIFICATION_VALUE }o--o{ ARRANGEMENT : "codes"
CALENDAR_DATE }o--o{ ARRANGEMENT_BALANCE : "snapshot"
ERD Chi tiết — Nhóm 1: Party & Organisation¶
INVOLVED_PARTYlà base entity.CUSTOMERvàORG_UNITkế thừa (is-a).
erDiagram
INVOLVED_PARTY {
SK involved_party_id PK
Text involved_party_code
CV source_system_code
}
CUSTOMER {
SK customer_id PK
Text customer_code
Text full_name
Date birth_date
CV gender_code
Text identification_number
CV customer_type_code
CV customer_segment_code
CV line_of_business_code
CV life_cycle_status_code
Date end_customer_date
Date initiated_date
Date updated_date
CV source_system_code
}
ORG_UNIT {
SK org_unit_id PK
Text org_unit_code
CV org_unit_type_code
Text org_unit_name
CV region_code
}
INVOLVED_PARTY ||--o{ CUSTOMER : "is-a"
INVOLVED_PARTY ||--o{ ORG_UNIT : "is-a"
ERD Chi tiết — Nhóm 2: Product & Arrangement¶
ARRANGEMENTlà base.DEPOSIT_ARRANGEMENTvàLOAN_ARRANGEMENTkế thừa và tham chiếu tớiCUSTOMER,ORG_UNIT,PRODUCT.
erDiagram
PRODUCT {
SK product_id PK
Text product_code
Text product_name
CV source_system_code
}
ARRANGEMENT {
SK arrangement_id PK
Text arrangement_code
Text source_system_code
}
DEPOSIT_ARRANGEMENT {
SK deposit_arr_id PK
Text deposit_arr_code
Text account_number
Rate effective_interest_rate_pct
Text term
Date maturity_date
CV life_cycle_status_code
SK org_unit_id FK
SK customer_id FK
SK product_id FK
CV source_system_code
}
LOAN_ARRANGEMENT {
SK loan_arr_id PK
Text loan_arr_code
Text account_number
CV loan_term_type_code
Date disbursement_date
Date maturity_date
Cnt term_in_months
Rate effective_interest_rate_pct
CV interest_variance_type_code
CV payment_frequency_code
SK rel_org_unit_id FK
SK customer_id FK
SK product_id FK
CV source_system_code
}
ARRANGEMENT ||--o{ DEPOSIT_ARRANGEMENT : "is-a"
ARRANGEMENT ||--o{ LOAN_ARRANGEMENT : "is-a"
PRODUCT }o--|| DEPOSIT_ARRANGEMENT : "product"
PRODUCT }o--|| LOAN_ARRANGEMENT : "product"
ERD Chi tiết — Nhóm 3: Transaction & Balance (Fact)¶
TRANSACTIONlà Fact Append.ARRANGEMENT_BALANCElà Fact Snapshot (PK gồmsnapshot_date+arrangement_id).
erDiagram
ARRANGEMENT {
SK arrangement_id PK
Text arrangement_code
}
CUSTOMER {
SK customer_id PK
Text customer_code
}
TRANSACTION {
SK transaction_id PK
Text transaction_code
SK arrangement_id FK
SK customer_id FK
Date transaction_date
Date transaction_value_date
TS transaction_date_time
CV transaction_type_code
Amt transaction_amount
CV currency_code
CV channel_code
CV transaction_status_code
CV source_system_code
}
ARRANGEMENT_BALANCE {
Date snapshot_date PK
SK arrangement_id PK
Text arrangement_code
CV currency_code
SK customer_id FK
Text customer_code
Amt closing_balance_fcy
CV source_system_code
}
ARRANGEMENT }o--|| TRANSACTION : "account"
CUSTOMER }o--|| TRANSACTION : "customer"
ARRANGEMENT }o--|| ARRANGEMENT_BALANCE : "account"
CUSTOMER }o--|| ARRANGEMENT_BALANCE : "customer"
ERD Chi tiết — Nhóm 4: Classification Tables (SCD1)¶
Các bảng danh mục dùng chung:
CURRENCY,CLASSIFICATION_VALUE,CALENDAR_DATE.
erDiagram
CURRENCY {
Text currency_code PK
Ind base_currency_flag
Text currency_name
CV source_system_code
}
CLASSIFICATION_VALUE {
CV classification_code PK
CV scheme_code PK
Text scheme_name
Text classification_name
CV source_system_code
}
CALENDAR_DATE {
Date calendar_date PK
Text calendar_year
Text calendar_quarter
Text calendar_month
Text calendar_day
Text day_of_week
Ind holiday_flag
Text source_system_code
}
Ký hiệu kiểu dữ liệu¶
| Viết tắt | Kiểu đầy đủ | Ý nghĩa |
|---|---|---|
| SK | Surrogate Key | Khóa tự sinh (ID trên Data Model) |
| Text | Text | Chuỗi văn bản |
| CV | Classification Value | Giá trị phân loại (code) |
| Date | Date | Ngày tháng |
| TS | Timestamp | Thời điểm (ngày + giờ) |
| Ind | Indicator | Cờ đánh dấu (Y/N, 0/1) |
| Rate | Interest Rate | Lãi suất |
| Amt | Currency Amount | Số tiền |
| Cnt | Small Counter | Số đếm nhỏ |
Fundamental Tables (SCD4A)¶
Involved Party¶
Thông tin các involved party như khách hàng, chi nhánh, đối tác, ...
| Cột | Kiểu | PK | Mô tả |
|---|---|---|---|
| Involved Party Id | Surrogate Key | ✅ | Id của Involved Party trên Data Model |
| Involved Party Code | Text | Mã của Involved Party | |
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Customer¶
Thông tin khách hàng (kế thừa Involved Party)
| Cột | Kiểu | PK | Mô tả |
|---|---|---|---|
| Customer Id | Surrogate Key | ✅ | Id của Customer trên Data Model |
| Customer Code | Text | Mã khách hàng | |
| Full Name | Text | Tên khách hàng | |
| Birth Date | Date | Ngày sinh | |
| Gender Code | Classification Value | Giới tính | |
| Identification Number | Text | CCCD / ĐKKD | |
| Customer Type Code | Classification Value | Loại khách hàng | |
| Customer Segment Code | Classification Value | Phân khúc khách hàng | |
| Line of Business Code | Classification Value | Khối kinh doanh (cá nhân, doanh nghiệp, ...) | |
| Customer Life Cycle Status Code | Classification Value | Trạng thái khách hàng (Active, Inactive) | |
| End Customer Date | Date | Ngày đóng khách hàng | |
| Initiated Date | Date | Thời điểm tạo khách hàng | |
| Updated Date | Date | Thời điểm cập nhật khách hàng | |
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Organization Unit¶
Thông tin phòng ban, chi nhánh
| Cột | Kiểu | PK | Mô tả |
|---|---|---|---|
| Organization Unit Id | Surrogate Key | ✅ | Id của Organization Unit trên Data Model |
| Organization Unit Code | Text | Mã của Organization Unit | |
| Organization Unit Type Code | Classification Value | Phân loại (Chi nhánh, Phòng ban). Cụ thể là BRANCH trong yêu cầu PoC | |
| Organization Unit Name | Text | Tên của Organization | |
| Region Code | Classification Value | Vùng của chi nhánh |
Product¶
Danh mục sản phẩm
| Cột | Kiểu | PK | Mô tả |
|---|---|---|---|
| Product Id | Surrogate Key | ✅ | Mã của sản phẩm (ID trên Data Model) |
| Product Code | Text | Mã sản phẩm | |
| Product Name | Text | Tên sản phẩm | |
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Arrangement¶
Thông tin các hợp đồng, cam kết trong ngân hàng
| Cột | Kiểu | PK | Mô tả |
|---|---|---|---|
| Arrangement Id | Surrogate Key | ✅ | Id của Arrangement trên Data Model |
| Arrangement Code | Text | Mã của Arrangement | |
| Source System Code | Text | Mã nguồn dữ liệu |
Deposit Arrangement¶
Thông tin các hợp đồng tiền gửi (kế thừa Arrangement)
| Cột | Kiểu | PK/FK | Ref → | Mô tả |
|---|---|---|---|---|
| Deposit Arrangement Id | Surrogate Key | PK | ARRANGEMENT | Id của Deposit Arrangement trên Data Model |
| Deposit Arrangement Code | Text | Mã hợp đồng tiền gửi (số hợp đồng) | ||
| Account Number | Text | Số tài khoản | ||
| Effective Interest Rate Percentage | Interest Rate | Lãi suất | ||
| Term | Text | Kỳ hạn | ||
| Maturity Date | Date | Ngày đáo hạn | ||
| Life Cycle Status Code | Classification Value | Trạng thái hợp đồng (Active, Closed) | ||
| Organization Unit Id | Surrogate Key | FK | ORG_UNIT | Chi nhánh của hợp đồng |
| Organization Unit Code | Text | Chi nhánh của hợp đồng (code) | ||
| Customer Id | Surrogate Key | FK | CUSTOMER | Khách hàng |
| Customer Code | Text | Mã khách hàng | ||
| Product Id | Surrogate Key | FK | PRODUCT | Sản phẩm |
| Product Code | Text | Mã sản phẩm | ||
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Loan Arrangement¶
Thông tin các hợp đồng tiền vay (kế thừa Arrangement)
| Cột | Kiểu | PK/FK | Ref → | Mô tả |
|---|---|---|---|---|
| Loan Arrangement Id | Surrogate Key | PK | ARRANGEMENT | Id của Loan Arrangement trên Data Model |
| Loan Arrangement Code | Text | Mã khoản vay | ||
| Account Number | Text | Số hợp đồng tín dụng | ||
| Loan Term Type Code | Classification Value | Loại kỳ hạn (ShortTerm / MediumTerm / LongTerm) | ||
| Disbursement Date | Date | Ngày giải ngân | ||
| Maturity Date | Date | Ngày đáo hạn | ||
| Term in Months | Small Counter | Kỳ hạn theo tháng | ||
| Effective Interest Rate Percentage | Interest Rate | Lãi suất | ||
| Interest Variance Type Code | Classification Value | Loại lãi suất (Fixed, Floating) | ||
| Payment Frequency Code | Classification Value | Tần suất trả (Monthly, Quarterly) | ||
| Relationship Organization Unit Id | Surrogate Key | FK | ORG_UNIT | Chi nhánh quản lý |
| Relationship Organization Unit Code | Text | Mã chi nhánh quản lý | ||
| Customer Id | Surrogate Key | FK | CUSTOMER | Khách hàng |
| Customer Code | Text | Mã khách hàng | ||
| Product Id | Surrogate Key | FK | PRODUCT | Sản phẩm vay |
| Product Code | Text | Mã sản phẩm vay | ||
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Event / Activity Table (Fact Append)¶
Transaction¶
Bảng thông tin giao dịch
| Cột | Kiểu | PK/FK | Ref → | Mô tả |
|---|---|---|---|---|
| Transaction Id | Surrogate Key | PK | Id của Transaction trên Data Model | |
| Transaction Code | Text | Mã transaction | ||
| Arrangement Id | Surrogate Key | FK | ARRANGEMENT | Tài khoản |
| Arrangement Code | Text | Mã tài khoản | ||
| Customer Id | Surrogate Key | FK | CUSTOMER | Khách hàng |
| Customer Code | Text | Mã khách hàng | ||
| Transaction Date | Date | Ngày giao dịch | ||
| Transaction Value Date | Date | Ngày hạch toán | ||
| Transaction Date Time | Timestamp | Thời điểm giao dịch | ||
| Transaction Type Code | Classification Value | Loại giao dịch | ||
| Transaction Amount | Currency Amount | Số tiền giao dịch | ||
| Currency Code | Classification Value | Loại tiền | ||
| Channel Code | Classification Value | Kênh giao dịch | ||
| Transaction Status Code | Classification Value | Trạng thái giao dịch (Success / Reversed) | ||
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Fact Table (Fact Snapshot)¶
Arrangement Balance¶
Thông tin các loại số dư của hợp đồng, tài khoản
| Cột | Kiểu | PK/FK | Ref → | Mô tả |
|---|---|---|---|---|
| Snapshot Date | Date | PK | Ngày chạy dữ liệu | |
| Arrangement Id | Surrogate Key | PK | ARRANGEMENT | Số hợp đồng |
| Arrangement Code | Text | Số hợp đồng (code) | ||
| Currency Code | Classification Value | Loại tiền | ||
| Customer Id | Surrogate Key | FK | CUSTOMER | Khách hàng |
| Customer Code | Text | Mã khách hàng | ||
| Closing Balance FCY | Currency Amount | Số dư nguyên tệ | ||
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Classification Tables (SCD1)¶
Currency¶
Danh mục loại tiền
| Cột | Kiểu | PK | Mô tả |
|---|---|---|---|
| Currency Code | Text | ✅ | Mã loại tiền |
| Base Currency Flag | Indicator | Cờ đánh dấu loại tiền chính (VND) | |
| Currency Name | Text | Tên loại tiền | |
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Classification Value¶
Danh mục phân loại
| Cột | Kiểu | PK | Mô tả |
|---|---|---|---|
| Classification Code | Classification Value | ✅ | Mã giá trị phân loại |
| Scheme Code | Classification Value | ✅ | Mã loại phân loại |
| Scheme Name | Text | Tên loại phân loại | |
| Classification Name | Text | Tên giá trị phân loại (tên tiếng Việt) | |
| Source System Code | Classification Value | Mã nguồn dữ liệu |
Calendar Date¶
Ngày dữ liệu, lịch làm việc của ngân hàng
| Cột | Kiểu | PK | Mô tả |
|---|---|---|---|
| Calendar Date | Date | ✅ | Ngày |
| Calendar Year | Text | Năm | |
| Calendar Quarter | Text | Quý | |
| Calendar Month | Text | Tháng | |
| Calendar Day | Text | Ngày trong tháng | |
| Day Of Week | Text | Thứ trong tuần | |
| Holiday Flag | Indicator | Cờ đánh dấu ngày nghỉ | |
| Source System Code | Text | Mã nguồn dữ liệu |
Relationship Summary¶
Inheritance (is-a):
CUSTOMER ──→ INVOLVED_PARTY
ORG_UNIT ──→ INVOLVED_PARTY
DEPOSIT_ARRANGEMENT ──→ ARRANGEMENT
LOAN_ARRANGEMENT ──→ ARRANGEMENT
Deposit Arrangement references:
DEPOSIT_ARRANGEMENT ──→ ORG_UNIT (branch)
DEPOSIT_ARRANGEMENT ──→ CUSTOMER (owner)
DEPOSIT_ARRANGEMENT ──→ PRODUCT (product)
Loan Arrangement references:
LOAN_ARRANGEMENT ──→ ORG_UNIT (branch)
LOAN_ARRANGEMENT ──→ CUSTOMER (owner)
LOAN_ARRANGEMENT ──→ PRODUCT (product)
Transaction references:
TRANSACTION ──→ ARRANGEMENT (account)
TRANSACTION ──→ CUSTOMER (customer)
Arrangement Balance references:
ARRANGEMENT_BALANCE ──→ ARRANGEMENT (account)
ARRANGEMENT_BALANCE ──→ CUSTOMER (customer)