Requirements & metrics- Measure mentorship exposure and outcomes: time-to-promotion, retention delta, goal completion, performance change.- Support cohort comparisons (mentored vs non-mentored), filtering by role, level, manager, start_date windows.Schema (star-like, in a warehouse)1) mentors_mentees (event-level)- mentorship_id (pk, uuid)- mentee_id (anon_id) — pseudonymized- mentor_id (anon_id)- start_date (date)- end_date (date, nullable)- program_id (nullable)- created_at, updated_at2) mentorship_goals- goal_id (pk)- mentorship_id (fk)- goal_text (optional hashed or tokenized)- goal_set_date- goal_target_date- goal_status (enum: open, in_progress, completed, abandoned)- status_change_date3) employee_snapshot (daily or monthly dimension)- snapshot_date- anon_id- hire_date- org_level (e.g., L3)- manager_id (anon)- team_id- location, business_unit- active_flag (bool)- promotion_date (nullable)- termination_date (nullable)- performance_rating (nullable)4) mentorship_activity (events)- activity_id- mentorship_id- event_type (meeting, note, feedback)- event_date- duration_minutes- metadata (json, nullable)Privacy & governance- Pseudonymize IDs using HMAC with a key stored in KMS; keep raw mapping in a separate secrets-managed table with strict RBAC and auditing.- Mask or hash free-text goals; store tokens for classification only.- Column-level access controls: only analytics role can see anon_id; HR analysts with approvals can join to raw IDs.- Differential access: aggregate-only views for dashboards (no row-level data export).- Retention policy: delete PII mappings after retention window; retain aggregated metrics.ETL / storage considerations- Partition employee_snapshot by snapshot_date and team; cluster by anon_id.- Ingest mentorship events in near real-time (Kafka → staging → transform in Spark) enriching with snapshot to compute cohort features.- Maintain a materialized table mentorship_cohorts for fast queries.Example SQLsTime-to-promotion: median days from mentorship start to first promotion within 12 monthssql
WITH mentee_prom AS (
SELECT m.mentee_id, m.start_date,
MIN(e.promotion_date) AS first_promo
FROM mentors_mentees m
LEFT JOIN employee_snapshot e
ON e.anon_id = m.mentee_id
AND e.promotion_date BETWEEN m.start_date AND DATE_ADD(m.start_date, INTERVAL 12 MONTH)
GROUP BY 1,2
)
SELECT
PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY DATEDIFF(first_promo, start_date)) AS median_days_to_promo,
COUNT(*) FILTER (WHERE first_promo IS NOT NULL) AS promoted_count,
COUNT(*) AS mentee_count
FROM mentee_prom;
Retention delta: compare 12-month retention rate for mentored vs matched non-mentoredsql
WITH mentored AS (
SELECT m.mentee_id, m.start_date,
CASE WHEN EXISTS (
SELECT 1 FROM employee_snapshot e
WHERE e.anon_id = m.mentee_id
AND e.snapshot_date BETWEEN DATE_ADD(m.start_date, INTERVAL 12 MONTH) AND DATE_ADD(m.start_date, INTERVAL 12 MONTH)
AND e.active_flag = true
) THEN 1 ELSE 0 END AS retained_12m
FROM mentors_mentees m
),
non_mentored AS (
-- simple matching by hire_date bucket & level; production: propensity-score matching
SELECT e.anon_id AS candidate_id, e.hire_date, e.org_level,
CASE WHEN EXISTS (
SELECT 1 FROM employee_snapshot s
WHERE s.anon_id = e.anon_id
AND s.snapshot_date BETWEEN DATE_ADD(e.hire_date, INTERVAL 12 MONTH) AND DATE_ADD(e.hire_date, INTERVAL 12 MONTH)
AND s.active_flag = true
) THEN 1 ELSE 0 END AS retained_12m
FROM employee_snapshot e
WHERE e.snapshot_date = (SELECT MAX(snapshot_date) FROM employee_snapshot)
AND e.anon_id NOT IN (SELECT mentee_id FROM mentors_mentees)
-- match filters (level, hire_date bucket) applied here
)
SELECT
AVG(mentored.retained_12m) AS mentored_retention,
AVG(non_mentored.retained_12m) AS non_mentored_retention,
AVG(mentored.retained_12m) - AVG(non_mentored.retained_12m) AS retention_delta
FROM mentored
JOIN (
SELECT * FROM non_mentored -- in practice use matching to pair cohorts
) nm ON 1=1 LIMIT 1;
Validation and caveats- Use matching (propensity scores) to reduce selection bias.- Control for confounders: level, tenure, performance baseline.- Add statistical tests (log-rank, t-test, survival analysis) to assess significance.- Monitor data quality: missing promotion dates, overlapping mentorship records.This design supports scalable ETL, preserves privacy via pseudonymization and RBAC, and provides analysts with repeatable SQL patterns for measuring mentorship impact.