HR¶
A workforce-analytics warehouse for a mid-size multinational. Employees belong to departments, work out of regional offices, hold a job level that changes over time (SCD2), and are assigned to one or more projects through a many-to-many bridge. Performance reviews carry trajectory-aligned narrative text; compensation changes get a CDC audit trail; review-season, fiscal-close, and summer dips drive the seasonality channel.
What it produces¶
| Table | Type | Grain | Rows (default) | Notes |
|---|---|---|---|---|
dim_date |
dim | per_period | 24 | 24 monthly periods, Jan 2023 – Dec 2024 |
dim_employee |
dim | per_entity (+ SCD2 + geo) | 104–416 | 104 employees, expanded by SCD2 job-level moves |
dim_manager |
dim | per_reference | 5 | manager pool with span sizes 5..15 |
dim_project |
dim | per_reference | 6 | project name, type, budget band |
fct_performance |
fact | per_entity_per_period | 2,496 | performance, engagement, training + bucket + narrative |
fct_compensation |
fact | per_entity_per_period (CDC) | 2,496 | comp + attrition risk; CDC for restated comp |
fct_attendance |
fact | per_entity_per_period | 2,496 | absence rate only |
evt_training_completion |
event | variable (proportional) | ~10,000 | scaled 4× engagement |
evt_attrition |
event | variable (threshold) | 5–25 | attrition_risk above 0.7 for 3 consecutive periods |
bridge_employee_project |
bridge | static M:N | 100–400 | each employee assigned to 1–4 projects |
104 entities across six segments: new_hire_ramp (18),
top_performer (22), core_team (28), disengaging (16),
burnout_cohort (10), comeback (10).
Features exercised¶
- Noise preset —
slightly_messy(sigma 0.03, outliers 0.01, MCAR 0.005). - Seasonality — annual review cycle Mar–Apr (+0.20), fiscal-year close Nov–Dec (+0.15), summer dip Jul–Aug (-0.20).
- Causal lag —
absence_ratefollowsengagementwith delay 1. - Correlations —
engagement driven_by performance_score,engagement opposes attrition_risk,absence_rate related attrition_risk, plus explicitcompensation 0.35 performance_score. - SCD2 —
job_levelondim_employeetrackingperformance_scorewith thresholds[0.30, 0.60, 0.85](ic / senior / lead / principal). - Bridge —
bridge_employee_project(M:N), trajectory-driven byperformance_score. Higher performers carry more concurrent projects. - Manager hierarchy via reference dim —
dim_manageris a static lookup (self-FK bridges are not supported; the reference-dim approach is the canonical hierarchy idiom). - CDC —
fct_compensationcarries audit columns for restated compensation cycles. - Geo bundle —
office_country,office_country_code,office_region,office_cityondim_employee. - Bucket column —
review_outcomeonfct_performancewith four bands:improvement_plan/meets/exceeds/top_talent. - Narrative column —
review_notesonfct_performancewith per-segment lexicons. - Multi-phase archetypes —
flat > growth @ 6,flat > decline @ 12,growth > spike_then_crash > flat @ 6 @ 14,decline > flat > growth @ 6 @ 14. - Lifecycle stages —
new_hire/established/disengaging/exitedonattrition_riskwithenforce_order: true(monotonic cursor, no jumping back). - Quality injection — null injection on engagement (4%), late arrivals on attendance (2%), duplicate rows on training events (1%).
- Events — one proportional (
evt_training_completion) and one threshold (evt_attrition).
Use it¶
Common customizations¶
Tighten the noise preset¶
Default is slightly_messy. To produce cleaner data for a teaching
demo:
Loosen the lifecycle monotonicity¶
Default enforce_order: true means an employee that hits disengaging
can't slide back to established. To allow stateless free-mode (each
period independently picks the highest band satisfied):
To allow hysteretic demotion under enforce_order (cursor moves back
after N consecutive sub-threshold periods), add downgrade_delay: N.
Add entity features for an attrition model¶
The output adds _entity_features.csv — one row per employee with
per-metric aggregates, ready for a flat-features ML pipeline.
Where it shines¶
- Attrition-prediction training pipelines —
attrition_riskand theevt_attritiontable provide a target and an event-rate signal; the entity-features companion compresses the time series into per-employee rows. - Performance-review NLP —
review_notescarries archetype-driven text suitable for classifying narrative tone against performance level. - Manager-span analysis —
dim_managerand the project bridge exercise SQL joins that mix reference dims, sub-entity grouping, and many-to-many.