本書は TFHD(東急不動産ホールディングス想定)案件における CDP 構築のテーブル関係および処理設計を framework v2 として整理したものである。賃貸基幹・売買基幹・営業CRM・Web会員・MA の5ソースを横断し、顧客(customer)・契約(contract)・物件(product)・商談(deal)・行動(activity)の5ドメインに対し Raw → Base → Staging → Core → Mart の5レイヤーで段階加工する。各レイヤーの責務を明確化し、名寄せ・統合・配信の処理順序を再現可能な形で固定することを目的とする。
v1(テーブル列挙のみ)では「Raw と Base の責務が曖昧」「処理順序が暗黙」「名寄せロジックがブラックボックス」という課題があった。v2 では (1) 5レイヤー責務をレイヤー定義表で固定、(2) ドメイン別フロー図で依存を可視化、(3) 名寄せ・customer 統合を独立処理として切り出し、(4) 管理マスタを横断参照として独立化した。これにより設計レビュー・実装委譲・運用継承のいずれも単一の図表セットで完結する。
| レイヤー | 役割 | 加工 | 粒度 | 例 |
|---|---|---|---|---|
| 管理マスタ | コード値・分類定義の SoT。全レイヤーから参照 | 手動メンテ/外部マスタ取込 | 1コード=1行 | company_master, product_type_master |
| Raw | ソースシステムの原文取込。1ソース=1テーブル | 無加工(型のみ) | ソース行そのまま | raw_customer_sales_crm |
| Base | Raw のクレンジング・型統一・正規化。1Raw=1Base | NULL正規化・型変換・PIIマスキング | Raw と同粒度 | base_customer_sales_crm |
| Staging | 同ドメインの複数 Base を共通スキーマに集約 | UNION・列マッピング・ソース識別子付与 | 顧客レコード横断 | stg_customer_common |
| Core | 名寄せ後の統合エンティティ。CDP の中核 | 名寄せ・代表属性選定・履歴化 | 1顧客=1行 など | customer, customer_identity |
| Mart | 用途別の集計・非正規化・配信整形 | 集計・JOIN・セグメント・同意制御 | 用途依存 | mart_customer_360 |
| Dashboard | BI・外部連携の参照層(Mart の直接参照) | 表示用整形のみ | Mart 同等 | BI / HubSpot / 広告連携 |
ドメインごとに Raw → Base → Staging → Core → Mart のフローを通す。Raw / Base は複数ソースが並列に存在し、Staging で1本に集約、Core で統合される。管理マスタは全レイヤーから参照される横断資産として上段に独立配置する。
| テーブル名 | 役割 | 主な利用先 |
|---|---|---|
company_master | グループ会社コード・社名・事業区分 | 全レイヤー(会社別集計・所有権判定) |
business_master | 事業区分(賃貸・売買・その他)の定義 | Staging 以降の事業別分岐・Mart KPI |
source_system_master | ソースシステム識別(sales_crm / rent_core 等) | Raw タグ付け・Staging UNION・名寄せ重み |
business_mapping_rule | 会社×ソース×事業の対応ルール | Staging 集約時の事業判定 |
product_type_master | 物件種別(マンション・戸建・収益・その他) | product / Mart |
contract_type_master | 契約種別(賃貸普通借・売買・更新 等) | contract / Mart KPI |
deal_stage_master | 商談ステージ定義・順序 | deal / ファネル分析 |
activity_type_master | 行動種別(ページ閲覧・問合せ・来店 等) | activity / スコアリング |
customer_role_master | 顧客の役割(本人・連帯保証人・同居人) | customer / contract |
consent_type_master | 同意種別(メール・SMS・第三者提供) | Mart 配信フィルタ・ガバナンス |
| レイヤー | 物理名 | 論理名 | 主キー | 粒度 | 入力元 | 出力先 | 更新頻度 | 備考 |
|---|---|---|---|---|---|---|---|---|
| Raw | raw_customer_sales_crm | 営業CRM顧客 | crm_contact_id | CRM 顧客1行 | 営業CRM (HubSpot想定) | base_customer_sales_crm | 日次 | API取込 |
| Raw | raw_customer_rent_core | 賃貸基幹顧客 | rent_customer_id | 賃貸顧客1行 | 賃貸基幹 | base_customer_rent_core | 日次 | DB抽出 |
| Raw | raw_customer_sales_core | 売買基幹顧客 | sales_customer_id | 売買顧客1行 | 売買基幹 | base_customer_sales_core | 日次 | DB抽出 |
| Raw | raw_customer_web | Web会員 | web_member_id | Web会員1行 | 会員DB | base_customer_web | 日次 | 同意フラグ含む |
| Raw | raw_customer_ma | MA顧客 | ma_contact_id | MA連絡先1行 | MAツール | base_customer_ma | 日次 | 配信履歴別管理 |
| Raw | raw_contract_rent_core | 賃貸契約 | contract_no | 契約1行 | 賃貸基幹 | base_contract_rent_core | 日次 | 更新契約含む |
| Raw | raw_contract_sales_core | 売買契約 | contract_no | 契約1行 | 売買基幹 | base_contract_sales_core | 日次 | — |
| Raw | raw_product_rent_core | 賃貸物件 | property_id | 物件1行 | 賃貸基幹 | base_product_rent_core | 日次 | — |
| Raw | raw_product_sales_core | 売買物件 | property_id | 物件1行 | 売買基幹 | base_product_sales_core | 日次 | — |
| Raw | raw_deal_sales_crm | 商談 | deal_id | 商談1行 | 営業CRM | base_deal_sales_crm | 日次 | — |
| Raw | raw_activity_web | Web行動 | event_id | イベント1行 | Web計測基盤 | base_activity_web | 日次 | 大量データ |
| Raw | raw_activity_ma | メール配信履歴 | send_event_id | 送信/開封/クリック1行 | MAツール | base_activity_ma | 日次 | — |
| Raw | raw_activity_sales_crm | CRM活動 | activity_id | 活動1行 | 営業CRM | base_activity_sales_crm | 日次 | — |
| Base | base_customer_sales_crm | 営業CRM顧客 整形 | crm_contact_id | Raw 同等 | raw_customer_sales_crm | stg_customer_common | 日次 | 型統一・PIIマスキング |
| Base | base_customer_rent_core | 賃貸基幹顧客 整形 | rent_customer_id | Raw 同等 | raw_customer_rent_core | stg_customer_common | 日次 | — |
| Base | base_customer_sales_core | 売買基幹顧客 整形 | sales_customer_id | Raw 同等 | raw_customer_sales_core | stg_customer_common | 日次 | — |
| Base | base_customer_web | Web会員 整形 | web_member_id | Raw 同等 | raw_customer_web | stg_customer_common | 日次 | — |
| Base | base_customer_ma | MA顧客 整形 | ma_contact_id | Raw 同等 | raw_customer_ma | stg_customer_common | 日次 | — |
| Base | base_contract_rent_core | 賃貸契約 整形 | contract_no | Raw 同等 | raw_contract_rent_core | stg_contract | 日次 | — |
| Base | base_contract_sales_core | 売買契約 整形 | contract_no | Raw 同等 | raw_contract_sales_core | stg_contract | 日次 | — |
| Base | base_product_rent_core | 賃貸物件 整形 | property_id | Raw 同等 | raw_product_rent_core | stg_product | 日次 | — |
| Base | base_product_sales_core | 売買物件 整形 | property_id | Raw 同等 | raw_product_sales_core | stg_product | 日次 | — |
| Base | base_deal_sales_crm | 商談 整形 | deal_id | Raw 同等 | raw_deal_sales_crm | stg_deal | 日次 | — |
| Base | base_activity_web | Web行動 整形 | event_id | Raw 同等 | raw_activity_web | stg_activity | 日次 | — |
| Base | base_activity_ma | メール配信履歴 整形 | send_event_id | Raw 同等 | raw_activity_ma | stg_activity | 日次 | — |
| Base | base_activity_sales_crm | CRM活動 整形 | activity_id | Raw 同等 | raw_activity_sales_crm | stg_activity | 日次 | — |
| Staging | stg_customer_common | 顧客 共通スキーマ | source_system+source_id | ソース顧客1行 | base_customer_* (5本) | customer_identity / customer | 日次 | UNION・列マッピング |
| Staging | stg_contract | 契約 共通スキーマ | source_system+contract_no | 契約1行 | base_contract_* (2本) | customer_contract | 日次 | — |
| Staging | stg_product | 物件 共通スキーマ | source_system+property_id | 物件1行 | base_product_* (2本) | product | 日次 | — |
| Staging | stg_deal | 商談 共通スキーマ | source_system+deal_id | 商談1行 | base_deal_sales_crm | customer_deal | 日次 | — |
| Staging | stg_activity | 行動 共通スキーマ | source_system+event_id | 行動1行 | base_activity_* (3本) | customer_activity | 日次 | — |
| Core | customer | 統合顧客 | customer_id | 1顧客=1行 | customer_identity + stg_customer_common | customer_contract / customer_deal / customer_activity / Mart | 日次 | 代表属性選定済 |
| Core | customer_identity | 名寄せ結果 | customer_id + source_system + source_id | ソース顧客×customer_id 紐付1行 | stg_customer_common | customer | 日次 | 履歴持ち |
| Core | product | 統合物件 | product_id | 1物件=1行 | stg_product | customer_contract / Mart | 日次 | — |
| Core | customer_contract | 顧客紐付済 契約 | contract_id | 契約1行 | stg_contract + customer_identity + product | Mart | 日次 | customer_id 必須 |
| Core | customer_deal | 顧客紐付済 商談 | deal_id | 商談1行 | stg_deal + customer_identity | Mart | 日次 | — |
| Core | customer_activity | 顧客紐付済 行動 | activity_id | 行動1行 | stg_activity + customer_identity | Mart | 日次/一部リアルタイム | 大量データ |
| Mart | mart_customer_360 | 顧客360°ビュー | customer_id | 1顧客=1行 | customer / customer_contract / customer_deal / customer_activity | BI Dashboard | 日次 | 非正規化 |
| Mart | mart_hubspot_contact | HubSpot 連携用 | customer_id | 1顧客=1行 | customer / customer_activity / consent_master | HubSpot API | 日次 | 同意フィルタ適用 |
| Mart | mart_dashboard_kpi | 経営KPI | kpi_date+segment | 日次×セグメント | customer_contract / customer_deal | BI Dashboard | 日次 | 集計 |
| Mart | mart_identity_quality | 名寄せ品質指標 | snapshot_date | 日次スナップショット | customer_identity | BI / 運用監視 | 日次 | 重複率・統合率 |
| Mart | mart_cross_sell_candidate | クロスセル候補 | customer_id+product_id | 候補1行 | customer / product / customer_activity | 営業CRM 配信 | 週次 | スコア付き |
| 処理ID | 処理名 | 入力 | 出力 | 処理内容 | 実行順 |
|---|---|---|---|---|---|
| 0 | 管理マスタ整備 | 外部マスタ/手動メンテ | 各種 *_master | コード値・分類定義の更新 | 0(先行) |
| 1 | Raw 取込 | 5ソースシステム | raw_* (13本) | 無加工取込・型のみ確保 | 1 |
| 2a | Base 作成 — customer | raw_customer_* (5本) | base_customer_* (5本) | クレンジング・型統一・PIIマスキング | 2 |
| 2b | Base 作成 — contract | raw_contract_* (2本) | base_contract_* (2本) | 同上 | 2 |
| 2c | Base 作成 — product | raw_product_* (2本) | base_product_* (2本) | 同上 | 2 |
| 2d | Base 作成 — deal | raw_deal_sales_crm | base_deal_sales_crm | 同上 | 2 |
| 2e | Base 作成 — activity | raw_activity_* (3本) | base_activity_* (3本) | 同上 | 2 |
| 3a | Staging 集約 — customer | base_customer_* (5本) | stg_customer_common | UNION・列マッピング・ソース識別子付与 | 3 |
| 3b | Staging 集約 — contract | base_contract_* (2本) | stg_contract | 同上 | 3 |
| 3c | Staging 集約 — product | base_product_* (2本) | stg_product | 同上 | 3 |
| 3d | Staging 集約 — deal | base_deal_sales_crm | stg_deal | 共通スキーマ整形 | 3 |
| 3e | Staging 集約 — activity | base_activity_* (3本) | stg_activity | UNION・列マッピング | 3 |
| 4 | 名寄せ | stg_customer_common | customer_identity | 強一致/弱一致/新規採番ルール適用 | 4 |
| 5 | customer 作成 | customer_identity + stg_customer_common | customer | 代表属性選定・履歴化 | 5 |
| 6 | product 作成 | stg_product | product | 正規化・分類付与 | 5 |
| 7 | customer_contract 作成 | stg_contract + customer_identity + product | customer_contract | 顧客・物件紐付 | 6 |
| 8 | customer_deal 作成 | stg_deal + customer_identity | customer_deal | 顧客紐付・ステージ正規化 | 6 |
| 9 | customer_activity 作成 | stg_activity + customer_identity | customer_activity | 顧客紐付 | 6 |
| 10 | Mart 作成 | customer / customer_contract / customer_deal / customer_activity / product | mart_* | 集計・非正規化・セグメント・同意制御 | 7 |
| 11 | Dashboard / 外部連携配信 | mart_* | BI / HubSpot / 広告 | 表示・API配信 | 8 |
名寄せは stg_customer_common を入力に、ソースを跨いで同一人物を識別し統合 customer_id を採番する処理である。出力 customer_identity は (customer_id, source_system, source_id) を粒度とし、履歴を保持する。判定強度・信頼度・名寄せルールIDを列として持ち、後段の品質可視化(mart_identity_quality)で検証可能にする。
| 区分 | 項目 |
|---|---|
| 入力 | stg_customer_common(5ソース統合・PIIマスキング済) |
| 参照 | customer_identity 前日スナップショット(既存ID維持判定) |
| 出力 | customer_identity(customer_id, source_system, source_id, match_rule, confidence, valid_from, valid_to) |
| パターン | 条件 | customer_id 動作 | 備考 |
|---|---|---|---|
| 既存ID維持 | 前日と同一ソースID・属性大変動なし | 既存 customer_id を継続 | 履歴は更新せず |
| 強一致紐づけ | メール完全一致 or 電話完全一致 (+氏名類似) | 強一致先の既存 customer_id を継承 | match_rule=STRONG |
| 新規採番 | 強一致も弱一致も無い | 新規 customer_id 採番 | 初出ソースを保存 |
| 統合 | 新着レコードが複数の既存 customer_id に強一致 | 最古の customer_id に統合・他は廃止 | statement_id 履歴を残す |
| 分離 | 既存 customer_id が誤統合と運用判明 | 新 customer_id を採番し履歴に分離記録 | 運用ツール経由 |
customer は customer_identity と stg_customer_common を入力に、1顧客=1行の統合エンティティを作る処理である。同一 customer_id に紐づく複数ソース属性のうちどれを代表値とするかを、項目ごとのルールで一意に決める。代表値選定は再現可能で説明可能であること(監査対応)を最優先とする。
| 属性 | 選定ルール | 優先ソース |
|---|---|---|
| 氏名 | 最新更新日 + ソース優先度 | 賃貸基幹 > 売買基幹 > CRM > Web > MA |
| メールアドレス | 同意あり優先・最新更新 | Web > MA > CRM |
| 電話番号 | 形式正規化後の最新値 | 基幹優先 |
| 住所 | 最新契約に紐づく住所優先 | 賃貸基幹(現契約) > 売買基幹 > CRM |
| customer_type | 所有契約の種類から導出(賃貸/売買/見込) | customer_contract 参照 |
| first_seen_at / last_seen_at | 全ソース横断で min / max | — |
Mart は用途別に Core を集計・非正規化・整形する層である。配信先(BI / HubSpot / 広告)の要件に応じてスキーマと更新頻度を分ける。同意制御は Mart 段階で必ず適用する(Core では適用しない)。
| Mart | 用途 | 主入力 | 配信先 | 更新頻度 |
|---|---|---|---|---|
mart_customer_360 | 顧客360°ビュー | customer + 全 customer_* | BI Dashboard | 日次 |
mart_hubspot_contact | HubSpot 連携 | customer + customer_activity + consent_master | HubSpot API | 日次 |
mart_dashboard_kpi | 経営 KPI | customer_contract + customer_deal | BI Dashboard | 日次 |
mart_identity_quality | 名寄せ品質 | customer_identity | BI / 運用監視 | 日次 |
mart_cross_sell_candidate | クロスセル候補 | customer + product + customer_activity | 営業CRM | 週次 |
| 処理種別 | 内容 |
|---|---|
| 集計 | 契約金額・件数・LTV を customer_id 粒度で集計 |
| 非正規化 | customer に契約サマリ・行動サマリを横並び展開 |
| セグメント | 属性・行動・契約ステータスから配信セグメントを付与 |
| スコアリング | クロスセル確度・離反確度をルール/モデルで算出 |
| 外部連携整形 | 連携先API(HubSpot等)のスキーマに合わせて整形 |
| 同意・権限制御 | consent_master を JOIN し配信可レコードのみ抽出 |
| 観点 | チェック | レイヤー | 対応 |
|---|---|---|---|
| 件数 | 前日比 ±N% 以内 | Raw / Base / Staging / Core / Mart | 逸脱時アラート |
| 重複 | 主キー重複ゼロ | Base 以降全レイヤー | 重複検知=処理停止 |
| NULL | 必須項目の NULL 率しきい値 | Base / Staging | しきい値超でアラート |
| 参照整合 | customer_id 紐付ヒット率 | customer_contract / customer_deal / customer_activity | 未紐付分は隔離テーブル |
| 更新遅延 | 各テーブルの SLA 遵守 | 全レイヤー | 遅延でアラート |
| PIIマスキング | 必要属性のマスキング適用 | Base 以降全レイヤー | 非マスキング検出=処理停止 |
| 観点 | Before (v1) | After (v2) | 効果 |
|---|---|---|---|
| レイヤー責務 | Raw と Base が曖昧・混在 | 5レイヤー責務を表で固定 | 実装レビュー可能化 |
| 処理順序 | 暗黙・口頭伝承 | 処理ID + 実行順を表で固定 | 再現可能・委譲可能 |
| 名寄せ | ブラックボックス(コード参照必須) | 独立処理+customer_id決定方針表 | 監査対応・ルール改訂容易 |
| 管理マスタ | 各テーブルに散在 | 横断資産として独立配置 | SoT 一元化・参照容易 |
Raw / Base 責務曖昧: 「Raw でクレンジングするか Base でクレンジングするか」を実装ごとに判断するとレイヤー責務が崩壊する。本書のレイヤー定義表を実装規約として固定し、レビュー時に逸脱を弾く運用が必要。
テーブル依存だけでは不十分: テーブル間の依存グラフだけでは「同レイヤー内の並列実行可否」「再実行時の整合性」が表現できない。処理設計一覧の実行順とトランザクション境界を併せて参照する必要がある。
処理順序不明だと再現不可: 処理順序が暗黙のままだと障害時の再実行・差分実行が判断できない。本書の処理ID 0〜11 を実装ジョブ名と1対1対応させ、ジョブ依存定義に反映することが必須。
本 framework v2 により、CDP のテーブル関係と処理が単一の図表セットで再現可能となった。レイヤー責務の固定・処理順序の明示・名寄せの独立化・管理マスタの横断化により、設計レビュー・実装委譲・運用継承のいずれも図表参照のみで完結する。
次ステップは TFHD 実環境のソース確定とカラムマッピング作業である。実テーブル・実件数・実SLAを v3 で置換し、その後ジョブ実装・品質監視・本番運用へと展開する。