Squashed 'vendor/ruvector/' content from commit b64c2172

git-subtree-dir: vendor/ruvector
git-subtree-split: b64c21726f2bb37286d9ee36a7869fef60cc6900
This commit is contained in:
ruv
2026-02-28 14:39:40 -05:00
commit d803bfe2b1
7854 changed files with 3522914 additions and 0 deletions

View File

@@ -0,0 +1,367 @@
# Employee Simulation Examples
Comprehensive synthetic data generation for workforce modeling, organizational planning, and HR system testing using agentic-synth.
## Overview
This directory contains realistic employee behavior simulations designed for:
- **HR System Testing**: Test HR platforms with realistic synthetic employee data
- **Workforce Planning**: Model hiring needs, skill gaps, and organizational changes
- **Organizational Analysis**: Analyze team dynamics, culture, and performance patterns
- **Process Optimization**: Optimize onboarding, reviews, and development programs
- **Predictive Analytics**: Train ML models for turnover prediction and workforce forecasting
## Files
### 1. workforce-behavior.ts
Employee daily behavior patterns and productivity modeling.
**Includes:**
- Daily work schedules (flexible, remote, hybrid)
- Productivity patterns with time-of-day variations
- Collaboration and communication patterns
- Meeting attendance and participation
- Task completion rates and patterns
- Work location preferences (WFH vs office)
**Use Cases:**
- Productivity analytics
- Collaboration optimization
- Meeting culture analysis
- Remote work planning
- Time tracking validation
### 2. performance-data.ts
Employee performance metrics and achievement data.
**Includes:**
- KPI achievement across roles
- Project deliverables tracking
- Code commits and review metrics (developers)
- Sales targets and achievements
- Quality metrics and defect rates
- Learning and development progress
- 360-degree performance reviews
**Use Cases:**
- Performance management systems
- OKR tracking platforms
- Sales analytics
- Engineering metrics
- Quality assurance
### 3. organizational-dynamics.ts
Team formation, leadership, and cultural patterns.
**Includes:**
- Team formation and evolution
- Cross-functional collaboration
- Leadership effectiveness metrics
- Mentorship relationships
- Organizational culture indicators
- Succession planning scenarios
**Use Cases:**
- Org design planning
- Leadership development
- Team health monitoring
- Culture measurement
- Succession planning
### 4. workforce-planning.ts
Strategic HR planning and forecasting data.
**Includes:**
- Hiring needs forecasting
- Skill gap analysis
- Turnover predictions with risk factors
- Compensation analysis and equity
- Career progression paths
- Workforce diversity metrics
**Use Cases:**
- Headcount planning
- Budget forecasting
- Retention strategies
- Compensation planning
- Diversity initiatives
### 5. workplace-events.ts
Lifecycle events and HR processes.
**Includes:**
- Onboarding journeys
- Offboarding and exit analytics
- Promotions and transfers
- Performance review cycles
- Training and development events
- Team building activities
- Conflict resolution scenarios
**Use Cases:**
- HRIS event modeling
- Process optimization
- Employee journey mapping
- Compliance testing
- Learning management systems
## Privacy & Ethics
### Critical Guidelines
**SYNTHETIC DATA ONLY**
- All data is 100% synthetic and generated by AI
- No real employee data is included or should be used
- Never train models on real employee data without consent
**ETHICAL USE**
- Use only for system testing and planning
- Never use to make actual decisions about real employees
- Maintain appropriate security for even synthetic HR data
- Be aware of and mitigate algorithmic bias
**PRIVACY CONSIDERATIONS**
- Treat synthetic data as if it were real (practice good habits)
- Don't mix synthetic and real data
- Follow all applicable privacy regulations (GDPR, CCPA, etc.)
- Document that data is synthetic in all systems
**BIAS MITIGATION**
- Simulations include diverse populations
- Avoid reinforcing stereotypes
- Include representation across all demographics
- Test for disparate impact in any derived models
**COMPLIANCE**
- Ensure generated data complies with equal employment laws
- Don't generate protected class data inappropriately
- Follow pay equity and anti-discrimination guidelines
- Consult legal counsel for production use
## Usage Examples
### Basic Usage
```typescript
import { generateWorkSchedules } from './workforce-behavior.js';
import { generateKPIData } from './performance-data.js';
// Generate 500 realistic work schedules
const schedules = await generateWorkSchedules();
console.log(`Generated ${schedules.data.length} schedules`);
// Generate performance KPI data
const kpis = await generateKPIData();
console.log(`Generated ${kpis.data.length} KPI records`);
```
### Batch Generation
```typescript
import { createSynth } from '../../src/index.js';
const synth = createSynth({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY,
cacheStrategy: 'memory'
});
// Generate multiple datasets in parallel
const [schedules, performance, reviews] = await Promise.all([
synth.generateStructured({ count: 1000, schema: scheduleSchema }),
synth.generateStructured({ count: 500, schema: performanceSchema }),
synth.generateStructured({ count: 300, schema: reviewSchema })
]);
```
### Streaming Generation
```typescript
import { createSynth } from '../../src/index.js';
const synth = createSynth({ streaming: true });
// Stream productivity data
for await (const dataPoint of synth.generateStream('timeseries', {
count: 5000,
interval: '1h',
metrics: ['productivityScore', 'focusLevel']
})) {
// Process each data point as it's generated
await processProductivityData(dataPoint);
}
```
### Custom Scenarios
```typescript
// Generate data for specific scenarios
const seniorEngineerSchema = {
role: { type: 'string', default: 'senior_engineer' },
yearsExperience: { type: 'number', min: 5, max: 15 },
// ... more fields
};
const result = await synth.generateStructured({
count: 100,
schema: seniorEngineerSchema,
context: 'Generate profiles for senior engineers in a fast-growing startup'
});
```
## Configuration
### Environment Variables
```bash
# Required for AI-powered generation
GEMINI_API_KEY=your_gemini_api_key
# Optional: Alternative providers
OPENROUTER_API_KEY=your_openrouter_key
```
### Generation Options
```typescript
const config = {
provider: 'gemini', // or 'openrouter'
model: 'gemini-2.0-flash-exp', // or specific model
cacheStrategy: 'memory', // Enable caching for faster re-runs
cacheTTL: 3600, // Cache for 1 hour
maxRetries: 3,
timeout: 30000
};
```
## Data Quality
### Realism Features
- **Statistical Accuracy**: Distributions match industry benchmarks
- **Temporal Patterns**: Seasonal and cyclical variations
- **Correlations**: Realistic relationships between variables
- **Edge Cases**: Includes outliers and unusual patterns
- **Diversity**: Represents varied demographics and experiences
### Validation
Each example includes:
- Schema validation for data structure
- Range validation for numeric values
- Enum validation for categorical data
- Relationship validation for correlated fields
- Statistical validation against benchmarks
## Performance
- **Generation Speed**: 100-1000 records/second (cached)
- **Memory Usage**: ~1MB per 1000 records
- **Batch Processing**: Parallel generation for large datasets
- **Streaming**: Low memory footprint for large volumes
## Integration
### HR Systems
- Workday, SAP SuccessFactors, Oracle HCM
- BambooHR, Namely, Rippling
- Custom HRIS implementations
### Analytics Platforms
- Tableau, Power BI, Looker
- People analytics tools
- Custom dashboards
### Machine Learning
- Sklearn, PyTorch, TensorFlow
- Feature engineering pipelines
- Model training and validation
## Best Practices
### 1. Start Small
```typescript
// Generate small sample first
const sample = await generateKPIData();
console.log(sample.data.slice(0, 3)); // Review quality
```
### 2. Use Caching
```typescript
// Enable caching for iterative development
const synth = createSynth({ cacheStrategy: 'memory' });
```
### 3. Validate Output
```typescript
// Check data quality
const result = await synth.generateStructured({ count: 100, schema });
assert(result.data.every(r => r.salary > 0));
```
### 4. Document Usage
```typescript
// Always document that data is synthetic
const metadata = {
synthetic: true,
generated: new Date(),
purpose: 'Testing HRIS integration',
source: 'agentic-synth'
};
```
### 5. Test Edge Cases
```typescript
// Include edge cases in generation
const context = `
Include edge cases:
- New hires (0-90 days)
- Long tenure (10+ years)
- High performers and strugglers
- Various leave scenarios
`;
```
## Troubleshooting
### Common Issues
**Slow Generation**
- Enable caching: `cacheStrategy: 'memory'`
- Use batch processing for large volumes
- Consider using faster models
**Unrealistic Data**
- Adjust context prompts for more specificity
- Review and refine schemas
- Add validation constraints
**Memory Issues**
- Use streaming for large datasets
- Process in batches
- Clear cache periodically
## Support & Contribution
### Questions
- GitHub Issues: [ruvector/issues](https://github.com/ruvnet/ruvector/issues)
- Documentation: [agentic-synth docs](https://github.com/ruvnet/ruvector/tree/main/packages/agentic-synth)
### Contributing
Contributions welcome! Please ensure:
- Synthetic data remains realistic
- Privacy and ethics guidelines are followed
- Documentation is updated
- Tests are included
## License
MIT License - see LICENSE file in repository root.
## Disclaimer
This software generates synthetic data for testing and planning purposes only. It should not be used to make decisions about real employees. Users are responsible for ensuring compliance with all applicable laws and regulations, including employment law, privacy law, and anti-discrimination law. The authors and maintainers assume no liability for misuse of this software.
---
**Remember**: This is synthetic data for testing. Always prioritize real employee privacy, dignity, and fairness in actual HR systems and processes.

View File

@@ -0,0 +1,45 @@
/**
* Organizational Dynamics Simulation
*
* Generates realistic team formation, cross-functional collaboration,
* leadership effectiveness, mentorship relationships, and cultural indicators
* for organizational planning and analysis.
*
* ETHICAL USE: These simulations model organizational behavior patterns.
* Always maintain confidentiality and use only for legitimate org planning.
*/
/**
* Generate team formation and evolution data
* Models how teams form, grow, and change over time
*/
export declare function generateTeamDynamics(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate cross-functional collaboration data
* Models interactions between departments and teams
*/
export declare function generateCrossFunctionalCollaboration(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate leadership effectiveness data
* Models manager and leadership impact on teams
*/
export declare function generateLeadershipEffectiveness(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate mentorship relationship data
* Models mentor-mentee pairings and outcomes
*/
export declare function generateMentorshipData(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate organizational culture indicators
* Models cultural health and employee sentiment
*/
export declare function generateCultureIndicators(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate succession planning scenarios
* Models leadership pipeline and readiness
*/
export declare function generateSuccessionPlanning(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Run all organizational dynamics examples
*/
export declare function runAllOrganizationalExamples(): Promise<void>;
//# sourceMappingURL=organizational-dynamics.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"organizational-dynamics.d.ts","sourceRoot":"","sources":["organizational-dynamics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;GAGG;AACH,wBAAsB,oBAAoB,oEA0EzC;AAED;;;GAGG;AACH,wBAAsB,oCAAoC,oEA2EzD;AAED;;;GAGG;AACH,wBAAsB,+BAA+B,oEA4EpD;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,oEA4F3C;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,oEA+E9C;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,oEAmF/C;AAED;;GAEG;AACH,wBAAsB,4BAA4B,kBAgCjD"}

View File

@@ -0,0 +1,544 @@
"use strict";
/**
* Organizational Dynamics Simulation
*
* Generates realistic team formation, cross-functional collaboration,
* leadership effectiveness, mentorship relationships, and cultural indicators
* for organizational planning and analysis.
*
* ETHICAL USE: These simulations model organizational behavior patterns.
* Always maintain confidentiality and use only for legitimate org planning.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateTeamDynamics = generateTeamDynamics;
exports.generateCrossFunctionalCollaboration = generateCrossFunctionalCollaboration;
exports.generateLeadershipEffectiveness = generateLeadershipEffectiveness;
exports.generateMentorshipData = generateMentorshipData;
exports.generateCultureIndicators = generateCultureIndicators;
exports.generateSuccessionPlanning = generateSuccessionPlanning;
exports.runAllOrganizationalExamples = runAllOrganizationalExamples;
const index_js_1 = require("../../src/index.js");
/**
* Generate team formation and evolution data
* Models how teams form, grow, and change over time
*/
async function generateTeamDynamics() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const teamSchema = {
teamId: { type: 'string', required: true },
teamName: { type: 'string', required: true },
department: { type: 'string', required: true },
formationDate: { type: 'string', required: true },
size: { type: 'number', required: true },
composition: {
type: 'object',
required: true,
properties: {
senior: { type: 'number' },
mid: { type: 'number' },
junior: { type: 'number' },
manager: { type: 'number' }
}
},
diversity: {
type: 'object',
required: true,
properties: {
genderBalance: { type: 'number' }, // percentage women
ageRange: { type: 'string' },
tenureSpread: { type: 'number' }, // years variance
skillDiversity: { type: 'number' } // 0-100
}
},
performance: {
type: 'object',
required: true,
properties: {
velocity: { type: 'number' },
qualityScore: { type: 'number' },
collaborationScore: { type: 'number' },
innovationScore: { type: 'number' }
}
},
stage: {
type: 'string',
required: true,
enum: ['forming', 'storming', 'norming', 'performing', 'adjourning']
},
healthScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
turnoverRate: { type: 'number', required: true }, // percentage annual
remoteMembers: { type: 'number', required: true }
};
const result = await synth.generateStructured({
count: 50,
schema: teamSchema,
format: 'json',
context: `Generate realistic team dynamics:
- Team size: 5-12 members (optimal: 7-9)
- Composition: 1-2 senior, 3-5 mid, 1-3 junior, 1 manager
- Gender balance: 30-70% (increasing trend)
- Age range: 22-65, modal 28-35
- Stage progression: 3 months forming, 2 months storming, then performing
- High performing teams: >85 health score, <10% turnover
- Struggling teams: <60 health score, >25% turnover
- Remote ratio: 20-60%
- Diversity correlates with innovation (+15-20%)`
});
return result;
}
/**
* Generate cross-functional collaboration data
* Models interactions between departments and teams
*/
async function generateCrossFunctionalCollaboration() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const collaborationSchema = {
initiativeId: { type: 'string', required: true },
initiativeName: { type: 'string', required: true },
startDate: { type: 'string', required: true },
teamsInvolved: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
teamId: { type: 'string' },
department: { type: 'string' },
memberCount: { type: 'number' },
contributionLevel: { type: 'string', enum: ['lead', 'major', 'minor', 'support'] }
}
}
},
collaborationMetrics: {
type: 'object',
required: true,
properties: {
meetingFrequency: { type: 'number' }, // per week
communicationScore: { type: 'number' }, // 0-100
alignmentScore: { type: 'number' }, // 0-100
conflictLevel: { type: 'string', enum: ['none', 'low', 'moderate', 'high'] }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
delivered: { type: 'boolean' },
onTime: { type: 'boolean' },
budgetAdherence: { type: 'number' }, // percentage
stakeholderSatisfaction: { type: 'number' }, // 1-10
innovationScore: { type: 'number' } // 1-10
}
},
barriers: {
type: 'array',
required: true,
items: {
type: 'string',
enum: ['communication', 'priorities', 'resources', 'tools', 'culture', 'process']
}
},
successFactors: {
type: 'array',
required: true,
items: { type: 'string' }
}
};
const result = await synth.generateStructured({
count: 100,
schema: collaborationSchema,
format: 'json',
context: `Generate cross-functional collaboration patterns:
- 2-5 teams per initiative (sweet spot: 3)
- Delivery rate: 75% delivered, 60% on-time
- Budget: 80% within ±10%
- More teams = lower alignment, higher conflict
- Success factors: clear goals, executive sponsor, dedicated time
- Common barriers: competing priorities (40%), communication (30%), resources (20%)
- High communication score correlates with success
- Innovation higher with 3+ teams (+25%)
- Include both successful and challenging collaborations`
});
return result;
}
/**
* Generate leadership effectiveness data
* Models manager and leadership impact on teams
*/
async function generateLeadershipEffectiveness() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const leadershipSchema = {
leaderId: { type: 'string', required: true },
role: {
type: 'string',
required: true,
enum: ['team_lead', 'manager', 'director', 'vp', 'executive']
},
tenureInRole: { type: 'number', required: true }, // months
teamSize: { type: 'number', required: true },
directReports: { type: 'number', required: true },
leadershipMetrics: {
type: 'object',
required: true,
properties: {
teamEngagement: { type: 'number', min: 0, max: 100 },
teamRetention: { type: 'number', min: 0, max: 100 },
teamPerformance: { type: 'number', min: 0, max: 100 },
oneOnOneFrequency: { type: 'number' }, // per month
feedbackQuality: { type: 'number', min: 1, max: 5 }
}
},
competencies: {
type: 'object',
required: true,
properties: {
strategicThinking: { type: 'number', min: 1, max: 5 },
peopleManagement: { type: 'number', min: 1, max: 5 },
communication: { type: 'number', min: 1, max: 5 },
decisionMaking: { type: 'number', min: 1, max: 5 },
emotionalIntelligence: { type: 'number', min: 1, max: 5 }
}
},
upwardFeedback: {
type: 'object',
required: true,
properties: {
participationRate: { type: 'number' }, // percentage
overallScore: { type: 'number', min: 1, max: 5 },
recommendationRate: { type: 'number' } // percentage who would recommend
}
},
developmentAreas: {
type: 'array',
required: true,
items: { type: 'string' }
},
successorReadiness: {
type: 'string',
required: true,
enum: ['immediate', 'within_year', 'within_two_years', 'not_identified']
}
};
const result = await synth.generateStructured({
count: 80,
schema: leadershipSchema,
format: 'json',
context: `Generate leadership effectiveness data:
- Team engagement: mean 72%, stddev 15%
- Retention: 85% average (range 60-95%)
- High performers: >4.0 all competencies, >80% recommendation rate
- Direct reports: Team lead 5-8, Manager 8-12, Director 15-30
- 1:1 frequency: 2-4 per month (higher for new reports)
- Correlation: EQ score strongly predicts retention (+20% at 5.0 vs 3.0)
- New leaders (0-6 months): lower scores, higher variability
- Experienced leaders: more consistent, higher scores
- Successor ready: 40% immediate/within year
- Include spectrum from struggling to exceptional leaders`
});
return result;
}
/**
* Generate mentorship relationship data
* Models mentor-mentee pairings and outcomes
*/
async function generateMentorshipData() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const mentorshipSchema = {
relationshipId: { type: 'string', required: true },
mentorId: { type: 'string', required: true },
menteeId: { type: 'string', required: true },
startDate: { type: 'string', required: true },
status: {
type: 'string',
required: true,
enum: ['active', 'completed', 'paused', 'ended_early']
},
mentorProfile: {
type: 'object',
required: true,
properties: {
yearsExperience: { type: 'number' },
department: { type: 'string' },
level: { type: 'string' }
}
},
menteeProfile: {
type: 'object',
required: true,
properties: {
yearsExperience: { type: 'number' },
department: { type: 'string' },
level: { type: 'string' }
}
},
engagement: {
type: 'object',
required: true,
properties: {
meetingsHeld: { type: 'number' },
meetingsPlanned: { type: 'number' },
avgMeetingDuration: { type: 'number' }, // minutes
communicationFrequency: { type: 'string', enum: ['weekly', 'biweekly', 'monthly'] }
}
},
focusAreas: {
type: 'array',
required: true,
items: {
type: 'string',
enum: ['career_development', 'technical_skills', 'leadership', 'networking', 'work_life_balance', 'specific_project']
}
},
outcomes: {
type: 'object',
required: true,
properties: {
menteeSatisfaction: { type: 'number', min: 1, max: 5 },
mentorSatisfaction: { type: 'number', min: 1, max: 5 },
goalsAchieved: { type: 'number' }, // percentage
skillsGained: { type: 'number' },
networkExpanded: { type: 'boolean' }
}
},
impact: {
type: 'object',
required: true,
properties: {
promotionWithinYear: { type: 'boolean' },
retentionImproved: { type: 'boolean' },
performanceImprovement: { type: 'number' } // percentage points
}
}
};
const result = await synth.generateStructured({
count: 150,
schema: mentorshipSchema,
format: 'json',
context: `Generate mentorship relationship data:
- Active: 70%, Completed: 20%, Ended early: 10%
- Meeting attendance: 80% of planned
- Duration: 45-60 minutes average
- Satisfaction: mean 4.2/5 (mentees), 4.0/5 (mentors)
- 75% achieve 70%+ of goals
- Cross-departmental mentoring: 40% of relationships
- Same department: higher technical skill transfer
- Different department: better networking outcomes
- Promotion impact: 25% promoted within year (vs 15% baseline)
- Retention: 10% improvement for mentees
- Include diverse pairings and outcomes`
});
return result;
}
/**
* Generate organizational culture indicators
* Models cultural health and employee sentiment
*/
async function generateCultureIndicators() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const cultureSchema = {
surveyId: { type: 'string', required: true },
department: { type: 'string', required: true },
surveyDate: { type: 'string', required: true },
participationRate: { type: 'number', required: true }, // percentage
dimensions: {
type: 'object',
required: true,
properties: {
trust: { type: 'number', min: 0, max: 100 },
transparency: { type: 'number', min: 0, max: 100 },
innovation: { type: 'number', min: 0, max: 100 },
collaboration: { type: 'number', min: 0, max: 100 },
workLifeBalance: { type: 'number', min: 0, max: 100 },
diversity: { type: 'number', min: 0, max: 100 },
growth: { type: 'number', min: 0, max: 100 },
recognition: { type: 'number', min: 0, max: 100 }
}
},
engagement: {
type: 'object',
required: true,
properties: {
overallScore: { type: 'number', min: 0, max: 100 },
eNPS: { type: 'number', min: -100, max: 100 },
recommendRate: { type: 'number' } // percentage
}
},
sentimentAnalysis: {
type: 'object',
required: true,
properties: {
positive: { type: 'number' }, // percentage
neutral: { type: 'number' },
negative: { type: 'number' }
}
},
topThemes: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
theme: { type: 'string' },
sentiment: { type: 'string', enum: ['positive', 'neutral', 'negative'] },
frequency: { type: 'number' }
}
}
},
actionItems: {
type: 'array',
required: true,
items: { type: 'string' }
}
};
const result = await synth.generateStructured({
count: 40,
schema: cultureSchema,
format: 'json',
context: `Generate culture survey data:
- Participation: 65-85% (higher in engaged orgs)
- Overall engagement: mean 72%, stddev 12%
- eNPS: mean +25, range -20 to +60
- Dimension scores: typically 65-85 range
- Variations by department: Engineering +5%, Sales -3%
- Remote teams: +10% work-life balance, -5% collaboration
- Sentiment: 55% positive, 30% neutral, 15% negative
- Common positive themes: flexibility, growth, team
- Common negative themes: processes, communication, resources
- Correlations: trust predicts engagement, innovation follows growth`
});
return result;
}
/**
* Generate succession planning scenarios
* Models leadership pipeline and readiness
*/
async function generateSuccessionPlanning() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const successionSchema = {
positionId: { type: 'string', required: true },
positionTitle: { type: 'string', required: true },
level: {
type: 'string',
required: true,
enum: ['manager', 'senior_manager', 'director', 'vp', 'svp', 'c_suite']
},
criticality: {
type: 'string',
required: true,
enum: ['critical', 'important', 'standard']
},
currentHolder: {
type: 'object',
required: true,
properties: {
employeeId: { type: 'string' },
tenure: { type: 'number' }, // years
retirementRisk: { type: 'string', enum: ['0-2_years', '2-5_years', '5+_years'] },
flightRisk: { type: 'string', enum: ['low', 'medium', 'high'] }
}
},
successors: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
readiness: { type: 'string', enum: ['ready_now', '1_year', '2_years', '3+_years'] },
gapAnalysis: {
type: 'array',
items: { type: 'string' }
},
potentialScore: { type: 'number', min: 1, max: 5 },
performanceScore: { type: 'number', min: 1, max: 5 }
}
}
},
developmentPlan: {
type: 'object',
required: true,
properties: {
exists: { type: 'boolean' },
lastUpdated: { type: 'string' },
keyActions: {
type: 'array',
items: { type: 'string' }
}
}
},
riskLevel: {
type: 'string',
required: true,
enum: ['low', 'medium', 'high', 'critical']
}
};
const result = await synth.generateStructured({
count: 60,
schema: successionSchema,
format: 'json',
context: `Generate succession planning data:
- Critical positions: 30%, Important: 50%, Standard: 20%
- Ready now successors: 25% of positions
- 1-2 year ready: 45% of positions
- No identified successor: 15% of positions (high risk)
- Average 1.8 successors per position
- 9-box model: High potential + high performance = ready now
- Common gaps: strategic thinking, executive presence, financial acumen
- Development plans exist for 70% of critical roles
- Flight risk: increases without clear path (+30% turnover)
- Retirement pipeline: 15% of leaders within 5 years
- Include diversity in succession pipeline`
});
return result;
}
/**
* Run all organizational dynamics examples
*/
async function runAllOrganizationalExamples() {
console.log('=== Organizational Dynamics Simulation Examples ===\n');
console.log('1. Generating Team Dynamics...');
const teams = await generateTeamDynamics();
console.log(`Generated ${teams.data.length} team records`);
console.log('Sample:', JSON.stringify(teams.data[0], null, 2));
console.log('\n2. Generating Cross-Functional Collaboration...');
const collaboration = await generateCrossFunctionalCollaboration();
console.log(`Generated ${collaboration.data.length} collaboration records`);
console.log('Sample:', JSON.stringify(collaboration.data[0], null, 2));
console.log('\n3. Generating Leadership Effectiveness...');
const leadership = await generateLeadershipEffectiveness();
console.log(`Generated ${leadership.data.length} leadership records`);
console.log('Sample:', JSON.stringify(leadership.data[0], null, 2));
console.log('\n4. Generating Mentorship Data...');
const mentorship = await generateMentorshipData();
console.log(`Generated ${mentorship.data.length} mentorship records`);
console.log('Sample:', JSON.stringify(mentorship.data[0], null, 2));
console.log('\n5. Generating Culture Indicators...');
const culture = await generateCultureIndicators();
console.log(`Generated ${culture.data.length} culture survey records`);
console.log('Sample:', JSON.stringify(culture.data[0], null, 2));
console.log('\n6. Generating Succession Planning...');
const succession = await generateSuccessionPlanning();
console.log(`Generated ${succession.data.length} succession planning records`);
console.log('Sample:', JSON.stringify(succession.data[0], null, 2));
}
// Uncomment to run
// runAllOrganizationalExamples().catch(console.error);
//# sourceMappingURL=organizational-dynamics.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,567 @@
/**
* Organizational Dynamics Simulation
*
* Generates realistic team formation, cross-functional collaboration,
* leadership effectiveness, mentorship relationships, and cultural indicators
* for organizational planning and analysis.
*
* ETHICAL USE: These simulations model organizational behavior patterns.
* Always maintain confidentiality and use only for legitimate org planning.
*/
import { createSynth } from '../../src/index.js';
/**
* Generate team formation and evolution data
* Models how teams form, grow, and change over time
*/
export async function generateTeamDynamics() {
const synth = createSynth({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const teamSchema = {
teamId: { type: 'string', required: true },
teamName: { type: 'string', required: true },
department: { type: 'string', required: true },
formationDate: { type: 'string', required: true },
size: { type: 'number', required: true },
composition: {
type: 'object',
required: true,
properties: {
senior: { type: 'number' },
mid: { type: 'number' },
junior: { type: 'number' },
manager: { type: 'number' }
}
},
diversity: {
type: 'object',
required: true,
properties: {
genderBalance: { type: 'number' }, // percentage women
ageRange: { type: 'string' },
tenureSpread: { type: 'number' }, // years variance
skillDiversity: { type: 'number' } // 0-100
}
},
performance: {
type: 'object',
required: true,
properties: {
velocity: { type: 'number' },
qualityScore: { type: 'number' },
collaborationScore: { type: 'number' },
innovationScore: { type: 'number' }
}
},
stage: {
type: 'string',
required: true,
enum: ['forming', 'storming', 'norming', 'performing', 'adjourning']
},
healthScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
turnoverRate: { type: 'number', required: true }, // percentage annual
remoteMembers: { type: 'number', required: true }
};
const result = await synth.generateStructured({
count: 50,
schema: teamSchema,
format: 'json',
context: `Generate realistic team dynamics:
- Team size: 5-12 members (optimal: 7-9)
- Composition: 1-2 senior, 3-5 mid, 1-3 junior, 1 manager
- Gender balance: 30-70% (increasing trend)
- Age range: 22-65, modal 28-35
- Stage progression: 3 months forming, 2 months storming, then performing
- High performing teams: >85 health score, <10% turnover
- Struggling teams: <60 health score, >25% turnover
- Remote ratio: 20-60%
- Diversity correlates with innovation (+15-20%)`
});
return result;
}
/**
* Generate cross-functional collaboration data
* Models interactions between departments and teams
*/
export async function generateCrossFunctionalCollaboration() {
const synth = createSynth({
provider: 'gemini'
});
const collaborationSchema = {
initiativeId: { type: 'string', required: true },
initiativeName: { type: 'string', required: true },
startDate: { type: 'string', required: true },
teamsInvolved: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
teamId: { type: 'string' },
department: { type: 'string' },
memberCount: { type: 'number' },
contributionLevel: { type: 'string', enum: ['lead', 'major', 'minor', 'support'] }
}
}
},
collaborationMetrics: {
type: 'object',
required: true,
properties: {
meetingFrequency: { type: 'number' }, // per week
communicationScore: { type: 'number' }, // 0-100
alignmentScore: { type: 'number' }, // 0-100
conflictLevel: { type: 'string', enum: ['none', 'low', 'moderate', 'high'] }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
delivered: { type: 'boolean' },
onTime: { type: 'boolean' },
budgetAdherence: { type: 'number' }, // percentage
stakeholderSatisfaction: { type: 'number' }, // 1-10
innovationScore: { type: 'number' } // 1-10
}
},
barriers: {
type: 'array',
required: true,
items: {
type: 'string',
enum: ['communication', 'priorities', 'resources', 'tools', 'culture', 'process']
}
},
successFactors: {
type: 'array',
required: true,
items: { type: 'string' }
}
};
const result = await synth.generateStructured({
count: 100,
schema: collaborationSchema,
format: 'json',
context: `Generate cross-functional collaboration patterns:
- 2-5 teams per initiative (sweet spot: 3)
- Delivery rate: 75% delivered, 60% on-time
- Budget: 80% within ±10%
- More teams = lower alignment, higher conflict
- Success factors: clear goals, executive sponsor, dedicated time
- Common barriers: competing priorities (40%), communication (30%), resources (20%)
- High communication score correlates with success
- Innovation higher with 3+ teams (+25%)
- Include both successful and challenging collaborations`
});
return result;
}
/**
* Generate leadership effectiveness data
* Models manager and leadership impact on teams
*/
export async function generateLeadershipEffectiveness() {
const synth = createSynth({
provider: 'gemini'
});
const leadershipSchema = {
leaderId: { type: 'string', required: true },
role: {
type: 'string',
required: true,
enum: ['team_lead', 'manager', 'director', 'vp', 'executive']
},
tenureInRole: { type: 'number', required: true }, // months
teamSize: { type: 'number', required: true },
directReports: { type: 'number', required: true },
leadershipMetrics: {
type: 'object',
required: true,
properties: {
teamEngagement: { type: 'number', min: 0, max: 100 },
teamRetention: { type: 'number', min: 0, max: 100 },
teamPerformance: { type: 'number', min: 0, max: 100 },
oneOnOneFrequency: { type: 'number' }, // per month
feedbackQuality: { type: 'number', min: 1, max: 5 }
}
},
competencies: {
type: 'object',
required: true,
properties: {
strategicThinking: { type: 'number', min: 1, max: 5 },
peopleManagement: { type: 'number', min: 1, max: 5 },
communication: { type: 'number', min: 1, max: 5 },
decisionMaking: { type: 'number', min: 1, max: 5 },
emotionalIntelligence: { type: 'number', min: 1, max: 5 }
}
},
upwardFeedback: {
type: 'object',
required: true,
properties: {
participationRate: { type: 'number' }, // percentage
overallScore: { type: 'number', min: 1, max: 5 },
recommendationRate: { type: 'number' } // percentage who would recommend
}
},
developmentAreas: {
type: 'array',
required: true,
items: { type: 'string' }
},
successorReadiness: {
type: 'string',
required: true,
enum: ['immediate', 'within_year', 'within_two_years', 'not_identified']
}
};
const result = await synth.generateStructured({
count: 80,
schema: leadershipSchema,
format: 'json',
context: `Generate leadership effectiveness data:
- Team engagement: mean 72%, stddev 15%
- Retention: 85% average (range 60-95%)
- High performers: >4.0 all competencies, >80% recommendation rate
- Direct reports: Team lead 5-8, Manager 8-12, Director 15-30
- 1:1 frequency: 2-4 per month (higher for new reports)
- Correlation: EQ score strongly predicts retention (+20% at 5.0 vs 3.0)
- New leaders (0-6 months): lower scores, higher variability
- Experienced leaders: more consistent, higher scores
- Successor ready: 40% immediate/within year
- Include spectrum from struggling to exceptional leaders`
});
return result;
}
/**
* Generate mentorship relationship data
* Models mentor-mentee pairings and outcomes
*/
export async function generateMentorshipData() {
const synth = createSynth({
provider: 'gemini'
});
const mentorshipSchema = {
relationshipId: { type: 'string', required: true },
mentorId: { type: 'string', required: true },
menteeId: { type: 'string', required: true },
startDate: { type: 'string', required: true },
status: {
type: 'string',
required: true,
enum: ['active', 'completed', 'paused', 'ended_early']
},
mentorProfile: {
type: 'object',
required: true,
properties: {
yearsExperience: { type: 'number' },
department: { type: 'string' },
level: { type: 'string' }
}
},
menteeProfile: {
type: 'object',
required: true,
properties: {
yearsExperience: { type: 'number' },
department: { type: 'string' },
level: { type: 'string' }
}
},
engagement: {
type: 'object',
required: true,
properties: {
meetingsHeld: { type: 'number' },
meetingsPlanned: { type: 'number' },
avgMeetingDuration: { type: 'number' }, // minutes
communicationFrequency: { type: 'string', enum: ['weekly', 'biweekly', 'monthly'] }
}
},
focusAreas: {
type: 'array',
required: true,
items: {
type: 'string',
enum: ['career_development', 'technical_skills', 'leadership', 'networking', 'work_life_balance', 'specific_project']
}
},
outcomes: {
type: 'object',
required: true,
properties: {
menteeSatisfaction: { type: 'number', min: 1, max: 5 },
mentorSatisfaction: { type: 'number', min: 1, max: 5 },
goalsAchieved: { type: 'number' }, // percentage
skillsGained: { type: 'number' },
networkExpanded: { type: 'boolean' }
}
},
impact: {
type: 'object',
required: true,
properties: {
promotionWithinYear: { type: 'boolean' },
retentionImproved: { type: 'boolean' },
performanceImprovement: { type: 'number' } // percentage points
}
}
};
const result = await synth.generateStructured({
count: 150,
schema: mentorshipSchema,
format: 'json',
context: `Generate mentorship relationship data:
- Active: 70%, Completed: 20%, Ended early: 10%
- Meeting attendance: 80% of planned
- Duration: 45-60 minutes average
- Satisfaction: mean 4.2/5 (mentees), 4.0/5 (mentors)
- 75% achieve 70%+ of goals
- Cross-departmental mentoring: 40% of relationships
- Same department: higher technical skill transfer
- Different department: better networking outcomes
- Promotion impact: 25% promoted within year (vs 15% baseline)
- Retention: 10% improvement for mentees
- Include diverse pairings and outcomes`
});
return result;
}
/**
* Generate organizational culture indicators
* Models cultural health and employee sentiment
*/
export async function generateCultureIndicators() {
const synth = createSynth({
provider: 'gemini'
});
const cultureSchema = {
surveyId: { type: 'string', required: true },
department: { type: 'string', required: true },
surveyDate: { type: 'string', required: true },
participationRate: { type: 'number', required: true }, // percentage
dimensions: {
type: 'object',
required: true,
properties: {
trust: { type: 'number', min: 0, max: 100 },
transparency: { type: 'number', min: 0, max: 100 },
innovation: { type: 'number', min: 0, max: 100 },
collaboration: { type: 'number', min: 0, max: 100 },
workLifeBalance: { type: 'number', min: 0, max: 100 },
diversity: { type: 'number', min: 0, max: 100 },
growth: { type: 'number', min: 0, max: 100 },
recognition: { type: 'number', min: 0, max: 100 }
}
},
engagement: {
type: 'object',
required: true,
properties: {
overallScore: { type: 'number', min: 0, max: 100 },
eNPS: { type: 'number', min: -100, max: 100 },
recommendRate: { type: 'number' } // percentage
}
},
sentimentAnalysis: {
type: 'object',
required: true,
properties: {
positive: { type: 'number' }, // percentage
neutral: { type: 'number' },
negative: { type: 'number' }
}
},
topThemes: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
theme: { type: 'string' },
sentiment: { type: 'string', enum: ['positive', 'neutral', 'negative'] },
frequency: { type: 'number' }
}
}
},
actionItems: {
type: 'array',
required: true,
items: { type: 'string' }
}
};
const result = await synth.generateStructured({
count: 40,
schema: cultureSchema,
format: 'json',
context: `Generate culture survey data:
- Participation: 65-85% (higher in engaged orgs)
- Overall engagement: mean 72%, stddev 12%
- eNPS: mean +25, range -20 to +60
- Dimension scores: typically 65-85 range
- Variations by department: Engineering +5%, Sales -3%
- Remote teams: +10% work-life balance, -5% collaboration
- Sentiment: 55% positive, 30% neutral, 15% negative
- Common positive themes: flexibility, growth, team
- Common negative themes: processes, communication, resources
- Correlations: trust predicts engagement, innovation follows growth`
});
return result;
}
/**
* Generate succession planning scenarios
* Models leadership pipeline and readiness
*/
export async function generateSuccessionPlanning() {
const synth = createSynth({
provider: 'gemini'
});
const successionSchema = {
positionId: { type: 'string', required: true },
positionTitle: { type: 'string', required: true },
level: {
type: 'string',
required: true,
enum: ['manager', 'senior_manager', 'director', 'vp', 'svp', 'c_suite']
},
criticality: {
type: 'string',
required: true,
enum: ['critical', 'important', 'standard']
},
currentHolder: {
type: 'object',
required: true,
properties: {
employeeId: { type: 'string' },
tenure: { type: 'number' }, // years
retirementRisk: { type: 'string', enum: ['0-2_years', '2-5_years', '5+_years'] },
flightRisk: { type: 'string', enum: ['low', 'medium', 'high'] }
}
},
successors: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
readiness: { type: 'string', enum: ['ready_now', '1_year', '2_years', '3+_years'] },
gapAnalysis: {
type: 'array',
items: { type: 'string' }
},
potentialScore: { type: 'number', min: 1, max: 5 },
performanceScore: { type: 'number', min: 1, max: 5 }
}
}
},
developmentPlan: {
type: 'object',
required: true,
properties: {
exists: { type: 'boolean' },
lastUpdated: { type: 'string' },
keyActions: {
type: 'array',
items: { type: 'string' }
}
}
},
riskLevel: {
type: 'string',
required: true,
enum: ['low', 'medium', 'high', 'critical']
}
};
const result = await synth.generateStructured({
count: 60,
schema: successionSchema,
format: 'json',
context: `Generate succession planning data:
- Critical positions: 30%, Important: 50%, Standard: 20%
- Ready now successors: 25% of positions
- 1-2 year ready: 45% of positions
- No identified successor: 15% of positions (high risk)
- Average 1.8 successors per position
- 9-box model: High potential + high performance = ready now
- Common gaps: strategic thinking, executive presence, financial acumen
- Development plans exist for 70% of critical roles
- Flight risk: increases without clear path (+30% turnover)
- Retirement pipeline: 15% of leaders within 5 years
- Include diversity in succession pipeline`
});
return result;
}
/**
* Run all organizational dynamics examples
*/
export async function runAllOrganizationalExamples() {
console.log('=== Organizational Dynamics Simulation Examples ===\n');
console.log('1. Generating Team Dynamics...');
const teams = await generateTeamDynamics();
console.log(`Generated ${teams.data.length} team records`);
console.log('Sample:', JSON.stringify(teams.data[0], null, 2));
console.log('\n2. Generating Cross-Functional Collaboration...');
const collaboration = await generateCrossFunctionalCollaboration();
console.log(`Generated ${collaboration.data.length} collaboration records`);
console.log('Sample:', JSON.stringify(collaboration.data[0], null, 2));
console.log('\n3. Generating Leadership Effectiveness...');
const leadership = await generateLeadershipEffectiveness();
console.log(`Generated ${leadership.data.length} leadership records`);
console.log('Sample:', JSON.stringify(leadership.data[0], null, 2));
console.log('\n4. Generating Mentorship Data...');
const mentorship = await generateMentorshipData();
console.log(`Generated ${mentorship.data.length} mentorship records`);
console.log('Sample:', JSON.stringify(mentorship.data[0], null, 2));
console.log('\n5. Generating Culture Indicators...');
const culture = await generateCultureIndicators();
console.log(`Generated ${culture.data.length} culture survey records`);
console.log('Sample:', JSON.stringify(culture.data[0], null, 2));
console.log('\n6. Generating Succession Planning...');
const succession = await generateSuccessionPlanning();
console.log(`Generated ${succession.data.length} succession planning records`);
console.log('Sample:', JSON.stringify(succession.data[0], null, 2));
}
// Uncomment to run
// runAllOrganizationalExamples().catch(console.error);

View File

@@ -0,0 +1,49 @@
/**
* Employee Performance Data Simulation
*
* Generates realistic KPI achievement data, project deliverables, code metrics,
* sales targets, quality metrics, and learning progress for performance analysis.
*
* ETHICS NOTE: Performance simulations should be used for system testing only.
* Never use synthetic data to make actual decisions about real employees.
*/
/**
* Generate KPI achievement data
* Models diverse performance metrics across different roles
*/
export declare function generateKPIData(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate project deliverables tracking
* Models project contributions and completion quality
*/
export declare function generateProjectDeliverables(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate code commits and review metrics (for developers)
* Models realistic development activity and code quality
*/
export declare function generateCodeMetrics(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate sales targets and achievements
* Models sales performance with realistic quota attainment
*/
export declare function generateSalesPerformance(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate quality metrics across different roles
* Models output quality and accuracy
*/
export declare function generateQualityMetrics(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate learning and development progress
* Models continuous learning and skill acquisition
*/
export declare function generateLearningProgress(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate comprehensive performance review data
* Models 360-degree feedback and competency ratings
*/
export declare function generatePerformanceReviews(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Run all performance data examples
*/
export declare function runAllPerformanceExamples(): Promise<void>;
//# sourceMappingURL=performance-data.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"performance-data.d.ts","sourceRoot":"","sources":["performance-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;GAGG;AACH,wBAAsB,eAAe,oEA2DpC;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,oEAyDhD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,oEA2ExC;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,oEAuC7C;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,oEA6D3C;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,oEAyE7C;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,oEA+E/C;AAED;;GAEG;AACH,wBAAsB,yBAAyB,kBAqC9C"}

View File

@@ -0,0 +1,514 @@
"use strict";
/**
* Employee Performance Data Simulation
*
* Generates realistic KPI achievement data, project deliverables, code metrics,
* sales targets, quality metrics, and learning progress for performance analysis.
*
* ETHICS NOTE: Performance simulations should be used for system testing only.
* Never use synthetic data to make actual decisions about real employees.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateKPIData = generateKPIData;
exports.generateProjectDeliverables = generateProjectDeliverables;
exports.generateCodeMetrics = generateCodeMetrics;
exports.generateSalesPerformance = generateSalesPerformance;
exports.generateQualityMetrics = generateQualityMetrics;
exports.generateLearningProgress = generateLearningProgress;
exports.generatePerformanceReviews = generatePerformanceReviews;
exports.runAllPerformanceExamples = runAllPerformanceExamples;
const index_js_1 = require("../../src/index.js");
/**
* Generate KPI achievement data
* Models diverse performance metrics across different roles
*/
async function generateKPIData() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const kpiSchema = {
employeeId: { type: 'string', required: true },
quarter: { type: 'string', required: true },
role: {
type: 'string',
required: true,
enum: ['engineer', 'designer', 'product_manager', 'sales', 'marketing', 'support']
},
kpis: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
name: { type: 'string' },
target: { type: 'number' },
actual: { type: 'number' },
unit: { type: 'string' },
weight: { type: 'number' } // percentage of total performance
}
}
},
overallScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
rating: {
type: 'string',
required: true,
enum: ['exceeds', 'meets', 'developing', 'needs_improvement']
},
notes: { type: 'string', required: false }
};
const result = await synth.generateStructured({
count: 400,
schema: kpiSchema,
format: 'json',
context: `Generate realistic KPI data with normal distribution:
- Exceeds expectations: 15%
- Meets expectations: 70%
- Developing: 10%
- Needs improvement: 5%
- Engineer KPIs: story points, code quality, bug fix rate
- Sales KPIs: revenue, deals closed, pipeline value
- Support KPIs: CSAT, resolution time, ticket volume
- Include realistic variance and outliers
- Consider external factors (market conditions, resources)`
});
return result;
}
/**
* Generate project deliverables tracking
* Models project contributions and completion quality
*/
async function generateProjectDeliverables() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const deliverableSchema = {
projectId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
deliverable: { type: 'string', required: true },
deliveryDate: { type: 'string', required: true },
dueDate: { type: 'string', required: true },
completionStatus: {
type: 'string',
required: true,
enum: ['on_time', 'early', 'late', 'partial']
},
qualityRating: {
type: 'number',
required: true,
min: 1,
max: 5
},
scope: {
type: 'string',
required: true,
enum: ['as_planned', 'expanded', 'reduced']
},
stakeholderSatisfaction: {
type: 'number',
required: true,
min: 1,
max: 10
},
technicalDebt: {
type: 'string',
required: true,
enum: ['none', 'minimal', 'moderate', 'significant']
},
reworkRequired: { type: 'boolean', required: true }
};
const result = await synth.generateStructured({
count: 600,
schema: deliverableSchema,
format: 'json',
context: `Generate realistic project deliverables:
- 65% on-time delivery
- 15% early delivery
- 20% late delivery (avg 3-5 days)
- Quality rating: normal distribution around 4.0
- 10% require rework
- Scope changes: 60% as planned, 25% expanded, 15% reduced
- Stakeholder satisfaction correlates with on-time + quality
- Technical debt: 50% minimal, 30% moderate, 15% significant, 5% none`
});
return result;
}
/**
* Generate code commits and review metrics (for developers)
* Models realistic development activity and code quality
*/
async function generateCodeMetrics() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const codeMetricsSchema = {
employeeId: { type: 'string', required: true },
week: { type: 'string', required: true },
commits: {
type: 'object',
required: true,
properties: {
count: { type: 'number' },
linesAdded: { type: 'number' },
linesRemoved: { type: 'number' },
filesChanged: { type: 'number' }
}
},
pullRequests: {
type: 'object',
required: true,
properties: {
opened: { type: 'number' },
merged: { type: 'number' },
avgReviewTime: { type: 'number' }, // hours
avgSize: { type: 'number' } // lines changed
}
},
codeReviews: {
type: 'object',
required: true,
properties: {
reviewsGiven: { type: 'number' },
commentsPosted: { type: 'number' },
avgResponseTime: { type: 'number' } // hours
}
},
quality: {
type: 'object',
required: true,
properties: {
testCoverage: { type: 'number' }, // percentage
bugsFound: { type: 'number' },
codeSmells: { type: 'number' },
securityIssues: { type: 'number' }
}
},
productivity: {
type: 'object',
required: true,
properties: {
storyPointsCompleted: { type: 'number' },
velocity: { type: 'number' }
}
}
};
const result = await synth.generateTimeSeries({
count: 500,
interval: '1w',
metrics: ['commits.count', 'quality.testCoverage', 'productivity.velocity'],
trend: 'stable',
seasonality: false,
context: `Generate realistic code metrics for diverse developers:
- Senior devs: 15-25 commits/week, 80-90% test coverage
- Mid-level: 10-20 commits/week, 70-80% test coverage
- Junior: 5-15 commits/week, 60-75% test coverage
- PR size: 100-500 lines optimal
- Review time: 2-24 hours (median 6h)
- Bugs found: inverse correlation with experience
- Include realistic variations: vacation weeks, sprint cycles
- Quality-focused devs: fewer commits, higher coverage`
});
return result;
}
/**
* Generate sales targets and achievements
* Models sales performance with realistic quota attainment
*/
async function generateSalesPerformance() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const salesSchema = {
employeeId: { type: 'string', required: true },
month: { type: 'string', required: true },
territory: { type: 'string', required: true },
quota: { type: 'number', required: true },
revenue: { type: 'number', required: true },
quotaAttainment: { type: 'number', required: true }, // percentage
dealsWon: { type: 'number', required: true },
dealsLost: { type: 'number', required: true },
winRate: { type: 'number', required: true }, // percentage
avgDealSize: { type: 'number', required: true },
pipelineValue: { type: 'number', required: true },
newLeads: { type: 'number', required: true },
customerRetention: { type: 'number', required: true }, // percentage
upsellRevenue: { type: 'number', required: true }
};
const result = await synth.generateStructured({
count: 300,
schema: salesSchema,
format: 'json',
context: `Generate realistic sales performance data:
- Quota attainment: normal distribution, mean 85%, stddev 20%
- 40% hit or exceed quota
- Win rate: 20-40% range
- Seasonal patterns: Q4 spike, Q1 dip
- Territory impact: ±15% variance
- Top performers: 120%+ attainment (15% of team)
- Struggling reps: <60% attainment (10% of team)
- Pipeline: 3-5x quota
- Include slump periods and recovery`
});
return result;
}
/**
* Generate quality metrics across different roles
* Models output quality and accuracy
*/
async function generateQualityMetrics() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const qualitySchema = {
employeeId: { type: 'string', required: true },
week: { type: 'string', required: true },
role: { type: 'string', required: true },
outputs: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
outputType: { type: 'string' },
count: { type: 'number' },
defectRate: { type: 'number' }, // percentage
reworkRate: { type: 'number' }, // percentage
peerRating: { type: 'number' } // 1-5
}
}
},
customerFeedback: {
type: 'object',
required: true,
properties: {
nps: { type: 'number' }, // -100 to 100
csat: { type: 'number' }, // 1-5
feedbackCount: { type: 'number' }
}
},
consistencyScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
innovationScore: {
type: 'number',
required: true,
min: 0,
max: 100
}
};
const result = await synth.generateStructured({
count: 400,
schema: qualitySchema,
format: 'json',
context: `Generate quality metrics by role:
- Engineers: defect rate 1-5%, code review score 3.5-4.5
- Designers: peer rating 3.8-4.8, iteration count 2-5
- Support: CSAT 4.2-4.8, first contact resolution 70-85%
- Content: error rate 0.5-2%, engagement metrics
- Quality improves with experience (10-15% difference)
- Consistency vs Innovation tradeoff
- Include learning curves and improvement trends`
});
return result;
}
/**
* Generate learning and development progress
* Models continuous learning and skill acquisition
*/
async function generateLearningProgress() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const learningSchema = {
employeeId: { type: 'string', required: true },
quarter: { type: 'string', required: true },
coursesCompleted: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
courseName: { type: 'string' },
category: { type: 'string' },
hoursSpent: { type: 'number' },
completionRate: { type: 'number' }, // percentage
assessmentScore: { type: 'number' }, // percentage
certification: { type: 'boolean' }
}
}
},
skillsAcquired: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
skill: { type: 'string' },
level: { type: 'string', enum: ['beginner', 'intermediate', 'advanced'] },
verifiedBy: { type: 'string' }
}
}
},
mentoring: {
type: 'object',
required: true,
properties: {
hoursReceived: { type: 'number' },
hoursGiven: { type: 'number' },
mentees: { type: 'number' }
}
},
learningHoursGoal: { type: 'number', required: true },
learningHoursActual: { type: 'number', required: true },
learningBudgetUsed: { type: 'number', required: true }, // dollars
applicationScore: {
type: 'number',
required: true,
min: 0,
max: 10
}
};
const result = await synth.generateStructured({
count: 350,
schema: learningSchema,
format: 'json',
context: `Generate learning and development data:
- Goal: 40 hours per quarter per employee
- Actual: normal distribution, mean 35 hours, stddev 12
- 70% achieve 80%+ of learning goal
- Assessment scores: mean 82%, stddev 10%
- Course completion: 85% average
- Senior employees: more mentoring given
- Junior employees: more mentoring received
- Application score: practical use of learning
- Budget: $1000-$3000 per employee per year
- Include self-directed vs formal training mix`
});
return result;
}
/**
* Generate comprehensive performance review data
* Models 360-degree feedback and competency ratings
*/
async function generatePerformanceReviews() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const reviewSchema = {
employeeId: { type: 'string', required: true },
reviewPeriod: { type: 'string', required: true },
reviewType: {
type: 'string',
required: true,
enum: ['annual', 'mid_year', '90_day', 'probation']
},
competencies: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
name: { type: 'string' },
rating: { type: 'number', min: 1, max: 5 },
selfRating: { type: 'number', min: 1, max: 5 },
managerRating: { type: 'number', min: 1, max: 5 },
peerRating: { type: 'number', min: 1, max: 5 }
}
}
},
strengths: {
type: 'array',
required: true,
items: { type: 'string' }
},
areasForImprovement: {
type: 'array',
required: true,
items: { type: 'string' }
},
goals: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
goal: { type: 'string' },
achieved: { type: 'number' }, // percentage
impact: { type: 'string' }
}
}
},
overallRating: {
type: 'string',
required: true,
enum: ['outstanding', 'exceeds', 'meets', 'developing', 'unsatisfactory']
},
promotionReady: { type: 'boolean', required: true },
riskOfAttrition: {
type: 'string',
required: true,
enum: ['low', 'medium', 'high']
}
};
const result = await synth.generateStructured({
count: 250,
schema: reviewSchema,
format: 'json',
context: `Generate performance review data with realistic distributions:
- Overall ratings: Outstanding 10%, Exceeds 20%, Meets 60%, Developing 8%, Unsatisfactory 2%
- Self-ratings typically 0.3-0.5 points higher than manager
- Peer ratings most accurate (closest to actual performance)
- 3-5 strengths, 2-3 areas for improvement
- 3-5 goals per review period
- 70% of goals fully or mostly achieved
- Promotion ready: 15% of workforce
- Attrition risk: Low 70%, Medium 20%, High 10%
- Include diversity in feedback styles and competencies`
});
return result;
}
/**
* Run all performance data examples
*/
async function runAllPerformanceExamples() {
console.log('=== Employee Performance Data Simulation Examples ===\n');
console.log('1. Generating KPI Data...');
const kpis = await generateKPIData();
console.log(`Generated ${kpis.data.length} KPI records`);
console.log('Sample:', JSON.stringify(kpis.data[0], null, 2));
console.log('\n2. Generating Project Deliverables...');
const deliverables = await generateProjectDeliverables();
console.log(`Generated ${deliverables.data.length} deliverable records`);
console.log('Sample:', JSON.stringify(deliverables.data[0], null, 2));
console.log('\n3. Generating Code Metrics...');
const code = await generateCodeMetrics();
console.log(`Generated ${code.data.length} code metric records`);
console.log('Sample:', JSON.stringify(code.data[0], null, 2));
console.log('\n4. Generating Sales Performance...');
const sales = await generateSalesPerformance();
console.log(`Generated ${sales.data.length} sales records`);
console.log('Sample:', JSON.stringify(sales.data[0], null, 2));
console.log('\n5. Generating Quality Metrics...');
const quality = await generateQualityMetrics();
console.log(`Generated ${quality.data.length} quality metric records`);
console.log('Sample:', JSON.stringify(quality.data[0], null, 2));
console.log('\n6. Generating Learning Progress...');
const learning = await generateLearningProgress();
console.log(`Generated ${learning.data.length} learning records`);
console.log('Sample:', JSON.stringify(learning.data[0], null, 2));
console.log('\n7. Generating Performance Reviews...');
const reviews = await generatePerformanceReviews();
console.log(`Generated ${reviews.data.length} review records`);
console.log('Sample:', JSON.stringify(reviews.data[0], null, 2));
}
// Uncomment to run
// runAllPerformanceExamples().catch(console.error);
//# sourceMappingURL=performance-data.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,541 @@
/**
* Employee Performance Data Simulation
*
* Generates realistic KPI achievement data, project deliverables, code metrics,
* sales targets, quality metrics, and learning progress for performance analysis.
*
* ETHICS NOTE: Performance simulations should be used for system testing only.
* Never use synthetic data to make actual decisions about real employees.
*/
import { createSynth } from '../../src/index.js';
/**
* Generate KPI achievement data
* Models diverse performance metrics across different roles
*/
export async function generateKPIData() {
const synth = createSynth({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const kpiSchema = {
employeeId: { type: 'string', required: true },
quarter: { type: 'string', required: true },
role: {
type: 'string',
required: true,
enum: ['engineer', 'designer', 'product_manager', 'sales', 'marketing', 'support']
},
kpis: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
name: { type: 'string' },
target: { type: 'number' },
actual: { type: 'number' },
unit: { type: 'string' },
weight: { type: 'number' } // percentage of total performance
}
}
},
overallScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
rating: {
type: 'string',
required: true,
enum: ['exceeds', 'meets', 'developing', 'needs_improvement']
},
notes: { type: 'string', required: false }
};
const result = await synth.generateStructured({
count: 400,
schema: kpiSchema,
format: 'json',
context: `Generate realistic KPI data with normal distribution:
- Exceeds expectations: 15%
- Meets expectations: 70%
- Developing: 10%
- Needs improvement: 5%
- Engineer KPIs: story points, code quality, bug fix rate
- Sales KPIs: revenue, deals closed, pipeline value
- Support KPIs: CSAT, resolution time, ticket volume
- Include realistic variance and outliers
- Consider external factors (market conditions, resources)`
});
return result;
}
/**
* Generate project deliverables tracking
* Models project contributions and completion quality
*/
export async function generateProjectDeliverables() {
const synth = createSynth({
provider: 'gemini'
});
const deliverableSchema = {
projectId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
deliverable: { type: 'string', required: true },
deliveryDate: { type: 'string', required: true },
dueDate: { type: 'string', required: true },
completionStatus: {
type: 'string',
required: true,
enum: ['on_time', 'early', 'late', 'partial']
},
qualityRating: {
type: 'number',
required: true,
min: 1,
max: 5
},
scope: {
type: 'string',
required: true,
enum: ['as_planned', 'expanded', 'reduced']
},
stakeholderSatisfaction: {
type: 'number',
required: true,
min: 1,
max: 10
},
technicalDebt: {
type: 'string',
required: true,
enum: ['none', 'minimal', 'moderate', 'significant']
},
reworkRequired: { type: 'boolean', required: true }
};
const result = await synth.generateStructured({
count: 600,
schema: deliverableSchema,
format: 'json',
context: `Generate realistic project deliverables:
- 65% on-time delivery
- 15% early delivery
- 20% late delivery (avg 3-5 days)
- Quality rating: normal distribution around 4.0
- 10% require rework
- Scope changes: 60% as planned, 25% expanded, 15% reduced
- Stakeholder satisfaction correlates with on-time + quality
- Technical debt: 50% minimal, 30% moderate, 15% significant, 5% none`
});
return result;
}
/**
* Generate code commits and review metrics (for developers)
* Models realistic development activity and code quality
*/
export async function generateCodeMetrics() {
const synth = createSynth({
provider: 'gemini'
});
const codeMetricsSchema = {
employeeId: { type: 'string', required: true },
week: { type: 'string', required: true },
commits: {
type: 'object',
required: true,
properties: {
count: { type: 'number' },
linesAdded: { type: 'number' },
linesRemoved: { type: 'number' },
filesChanged: { type: 'number' }
}
},
pullRequests: {
type: 'object',
required: true,
properties: {
opened: { type: 'number' },
merged: { type: 'number' },
avgReviewTime: { type: 'number' }, // hours
avgSize: { type: 'number' } // lines changed
}
},
codeReviews: {
type: 'object',
required: true,
properties: {
reviewsGiven: { type: 'number' },
commentsPosted: { type: 'number' },
avgResponseTime: { type: 'number' } // hours
}
},
quality: {
type: 'object',
required: true,
properties: {
testCoverage: { type: 'number' }, // percentage
bugsFound: { type: 'number' },
codeSmells: { type: 'number' },
securityIssues: { type: 'number' }
}
},
productivity: {
type: 'object',
required: true,
properties: {
storyPointsCompleted: { type: 'number' },
velocity: { type: 'number' }
}
}
};
const result = await synth.generateTimeSeries({
count: 500,
interval: '1w',
metrics: ['commits.count', 'quality.testCoverage', 'productivity.velocity'],
trend: 'stable',
seasonality: false,
context: `Generate realistic code metrics for diverse developers:
- Senior devs: 15-25 commits/week, 80-90% test coverage
- Mid-level: 10-20 commits/week, 70-80% test coverage
- Junior: 5-15 commits/week, 60-75% test coverage
- PR size: 100-500 lines optimal
- Review time: 2-24 hours (median 6h)
- Bugs found: inverse correlation with experience
- Include realistic variations: vacation weeks, sprint cycles
- Quality-focused devs: fewer commits, higher coverage`
});
return result;
}
/**
* Generate sales targets and achievements
* Models sales performance with realistic quota attainment
*/
export async function generateSalesPerformance() {
const synth = createSynth({
provider: 'gemini'
});
const salesSchema = {
employeeId: { type: 'string', required: true },
month: { type: 'string', required: true },
territory: { type: 'string', required: true },
quota: { type: 'number', required: true },
revenue: { type: 'number', required: true },
quotaAttainment: { type: 'number', required: true }, // percentage
dealsWon: { type: 'number', required: true },
dealsLost: { type: 'number', required: true },
winRate: { type: 'number', required: true }, // percentage
avgDealSize: { type: 'number', required: true },
pipelineValue: { type: 'number', required: true },
newLeads: { type: 'number', required: true },
customerRetention: { type: 'number', required: true }, // percentage
upsellRevenue: { type: 'number', required: true }
};
const result = await synth.generateStructured({
count: 300,
schema: salesSchema,
format: 'json',
context: `Generate realistic sales performance data:
- Quota attainment: normal distribution, mean 85%, stddev 20%
- 40% hit or exceed quota
- Win rate: 20-40% range
- Seasonal patterns: Q4 spike, Q1 dip
- Territory impact: ±15% variance
- Top performers: 120%+ attainment (15% of team)
- Struggling reps: <60% attainment (10% of team)
- Pipeline: 3-5x quota
- Include slump periods and recovery`
});
return result;
}
/**
* Generate quality metrics across different roles
* Models output quality and accuracy
*/
export async function generateQualityMetrics() {
const synth = createSynth({
provider: 'gemini'
});
const qualitySchema = {
employeeId: { type: 'string', required: true },
week: { type: 'string', required: true },
role: { type: 'string', required: true },
outputs: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
outputType: { type: 'string' },
count: { type: 'number' },
defectRate: { type: 'number' }, // percentage
reworkRate: { type: 'number' }, // percentage
peerRating: { type: 'number' } // 1-5
}
}
},
customerFeedback: {
type: 'object',
required: true,
properties: {
nps: { type: 'number' }, // -100 to 100
csat: { type: 'number' }, // 1-5
feedbackCount: { type: 'number' }
}
},
consistencyScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
innovationScore: {
type: 'number',
required: true,
min: 0,
max: 100
}
};
const result = await synth.generateStructured({
count: 400,
schema: qualitySchema,
format: 'json',
context: `Generate quality metrics by role:
- Engineers: defect rate 1-5%, code review score 3.5-4.5
- Designers: peer rating 3.8-4.8, iteration count 2-5
- Support: CSAT 4.2-4.8, first contact resolution 70-85%
- Content: error rate 0.5-2%, engagement metrics
- Quality improves with experience (10-15% difference)
- Consistency vs Innovation tradeoff
- Include learning curves and improvement trends`
});
return result;
}
/**
* Generate learning and development progress
* Models continuous learning and skill acquisition
*/
export async function generateLearningProgress() {
const synth = createSynth({
provider: 'gemini'
});
const learningSchema = {
employeeId: { type: 'string', required: true },
quarter: { type: 'string', required: true },
coursesCompleted: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
courseName: { type: 'string' },
category: { type: 'string' },
hoursSpent: { type: 'number' },
completionRate: { type: 'number' }, // percentage
assessmentScore: { type: 'number' }, // percentage
certification: { type: 'boolean' }
}
}
},
skillsAcquired: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
skill: { type: 'string' },
level: { type: 'string', enum: ['beginner', 'intermediate', 'advanced'] },
verifiedBy: { type: 'string' }
}
}
},
mentoring: {
type: 'object',
required: true,
properties: {
hoursReceived: { type: 'number' },
hoursGiven: { type: 'number' },
mentees: { type: 'number' }
}
},
learningHoursGoal: { type: 'number', required: true },
learningHoursActual: { type: 'number', required: true },
learningBudgetUsed: { type: 'number', required: true }, // dollars
applicationScore: {
type: 'number',
required: true,
min: 0,
max: 10
}
};
const result = await synth.generateStructured({
count: 350,
schema: learningSchema,
format: 'json',
context: `Generate learning and development data:
- Goal: 40 hours per quarter per employee
- Actual: normal distribution, mean 35 hours, stddev 12
- 70% achieve 80%+ of learning goal
- Assessment scores: mean 82%, stddev 10%
- Course completion: 85% average
- Senior employees: more mentoring given
- Junior employees: more mentoring received
- Application score: practical use of learning
- Budget: $1000-$3000 per employee per year
- Include self-directed vs formal training mix`
});
return result;
}
/**
* Generate comprehensive performance review data
* Models 360-degree feedback and competency ratings
*/
export async function generatePerformanceReviews() {
const synth = createSynth({
provider: 'gemini'
});
const reviewSchema = {
employeeId: { type: 'string', required: true },
reviewPeriod: { type: 'string', required: true },
reviewType: {
type: 'string',
required: true,
enum: ['annual', 'mid_year', '90_day', 'probation']
},
competencies: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
name: { type: 'string' },
rating: { type: 'number', min: 1, max: 5 },
selfRating: { type: 'number', min: 1, max: 5 },
managerRating: { type: 'number', min: 1, max: 5 },
peerRating: { type: 'number', min: 1, max: 5 }
}
}
},
strengths: {
type: 'array',
required: true,
items: { type: 'string' }
},
areasForImprovement: {
type: 'array',
required: true,
items: { type: 'string' }
},
goals: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
goal: { type: 'string' },
achieved: { type: 'number' }, // percentage
impact: { type: 'string' }
}
}
},
overallRating: {
type: 'string',
required: true,
enum: ['outstanding', 'exceeds', 'meets', 'developing', 'unsatisfactory']
},
promotionReady: { type: 'boolean', required: true },
riskOfAttrition: {
type: 'string',
required: true,
enum: ['low', 'medium', 'high']
}
};
const result = await synth.generateStructured({
count: 250,
schema: reviewSchema,
format: 'json',
context: `Generate performance review data with realistic distributions:
- Overall ratings: Outstanding 10%, Exceeds 20%, Meets 60%, Developing 8%, Unsatisfactory 2%
- Self-ratings typically 0.3-0.5 points higher than manager
- Peer ratings most accurate (closest to actual performance)
- 3-5 strengths, 2-3 areas for improvement
- 3-5 goals per review period
- 70% of goals fully or mostly achieved
- Promotion ready: 15% of workforce
- Attrition risk: Low 70%, Medium 20%, High 10%
- Include diversity in feedback styles and competencies`
});
return result;
}
/**
* Run all performance data examples
*/
export async function runAllPerformanceExamples() {
console.log('=== Employee Performance Data Simulation Examples ===\n');
console.log('1. Generating KPI Data...');
const kpis = await generateKPIData();
console.log(`Generated ${kpis.data.length} KPI records`);
console.log('Sample:', JSON.stringify(kpis.data[0], null, 2));
console.log('\n2. Generating Project Deliverables...');
const deliverables = await generateProjectDeliverables();
console.log(`Generated ${deliverables.data.length} deliverable records`);
console.log('Sample:', JSON.stringify(deliverables.data[0], null, 2));
console.log('\n3. Generating Code Metrics...');
const code = await generateCodeMetrics();
console.log(`Generated ${code.data.length} code metric records`);
console.log('Sample:', JSON.stringify(code.data[0], null, 2));
console.log('\n4. Generating Sales Performance...');
const sales = await generateSalesPerformance();
console.log(`Generated ${sales.data.length} sales records`);
console.log('Sample:', JSON.stringify(sales.data[0], null, 2));
console.log('\n5. Generating Quality Metrics...');
const quality = await generateQualityMetrics();
console.log(`Generated ${quality.data.length} quality metric records`);
console.log('Sample:', JSON.stringify(quality.data[0], null, 2));
console.log('\n6. Generating Learning Progress...');
const learning = await generateLearningProgress();
console.log(`Generated ${learning.data.length} learning records`);
console.log('Sample:', JSON.stringify(learning.data[0], null, 2));
console.log('\n7. Generating Performance Reviews...');
const reviews = await generatePerformanceReviews();
console.log(`Generated ${reviews.data.length} review records`);
console.log('Sample:', JSON.stringify(reviews.data[0], null, 2));
}
// Uncomment to run
// runAllPerformanceExamples().catch(console.error);

View File

@@ -0,0 +1,44 @@
/**
* Employee Behavior Patterns Simulation
*
* Generates realistic daily work schedules, productivity patterns, collaboration,
* and communication behaviors for workforce modeling.
*
* PRIVACY NOTE: All data is synthetic. No real employee data is used or should
* be used to train these models without explicit consent and proper anonymization.
*/
/**
* Generate daily work schedule patterns
* Simulates diverse work hours including flexible schedules, remote work, etc.
*/
export declare function generateWorkSchedules(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate productivity patterns throughout the day
* Models realistic variations in focus and output
*/
export declare function generateProductivityPatterns(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate collaboration and communication patterns
* Models team interactions, meeting participation, and communication frequency
*/
export declare function generateCollaborationPatterns(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate meeting attendance and participation data
* Models realistic meeting behaviors and engagement
*/
export declare function generateMeetingBehavior(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate task completion rates and patterns
* Models realistic work output and completion behaviors
*/
export declare function generateTaskCompletion(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate work-from-home vs office patterns
* Models hybrid work preferences and patterns
*/
export declare function generateWorkLocationPatterns(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Run all workforce behavior examples
*/
export declare function runAllBehaviorExamples(): Promise<void>;
//# sourceMappingURL=workforce-behavior.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"workforce-behavior.d.ts","sourceRoot":"","sources":["workforce-behavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;GAGG;AACH,wBAAsB,qBAAqB,oEA6C1C;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,oEA+CjD;AAED;;;GAGG;AACH,wBAAsB,6BAA6B,oEAwDlD;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,oEAuD5C;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,oEA8C3C;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,oEA+CjD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,kBAgC3C"}

View File

@@ -0,0 +1,360 @@
"use strict";
/**
* Employee Behavior Patterns Simulation
*
* Generates realistic daily work schedules, productivity patterns, collaboration,
* and communication behaviors for workforce modeling.
*
* PRIVACY NOTE: All data is synthetic. No real employee data is used or should
* be used to train these models without explicit consent and proper anonymization.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateWorkSchedules = generateWorkSchedules;
exports.generateProductivityPatterns = generateProductivityPatterns;
exports.generateCollaborationPatterns = generateCollaborationPatterns;
exports.generateMeetingBehavior = generateMeetingBehavior;
exports.generateTaskCompletion = generateTaskCompletion;
exports.generateWorkLocationPatterns = generateWorkLocationPatterns;
exports.runAllBehaviorExamples = runAllBehaviorExamples;
const index_js_1 = require("../../src/index.js");
/**
* Generate daily work schedule patterns
* Simulates diverse work hours including flexible schedules, remote work, etc.
*/
async function generateWorkSchedules() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const scheduleSchema = {
employeeId: { type: 'string', required: true },
date: { type: 'string', required: true },
workMode: {
type: 'string',
required: true,
enum: ['office', 'remote', 'hybrid']
},
checkIn: { type: 'string', required: true }, // ISO time
checkOut: { type: 'string', required: true },
breaks: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
start: { type: 'string' },
duration: { type: 'number' } // minutes
}
}
},
overtimeMinutes: { type: 'number', required: false },
timezone: { type: 'string', required: true }
};
const result = await synth.generateStructured({
count: 500,
schema: scheduleSchema,
format: 'json',
context: `Generate diverse work schedules representing:
- Different time zones (US, Europe, Asia)
- Various work modes (40% office, 30% remote, 30% hybrid)
- Flexible start times (7am-10am)
- Standard 8-hour days with realistic variations
- Cultural diversity in break patterns
- Occasional overtime (10% of records)`
});
return result;
}
/**
* Generate productivity patterns throughout the day
* Models realistic variations in focus and output
*/
async function generateProductivityPatterns() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const productivitySchema = {
employeeId: { type: 'string', required: true },
timestamp: { type: 'string', required: true },
productivityScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
focusLevel: {
type: 'string',
required: true,
enum: ['deep_work', 'moderate', 'distracted', 'break']
},
tasksCompleted: { type: 'number', required: true },
meetingsAttended: { type: 'number', required: true },
codeCommits: { type: 'number', required: false },
documentsEdited: { type: 'number', required: false },
emailsProcessed: { type: 'number', required: false },
energyLevel: {
type: 'string',
required: true,
enum: ['high', 'medium', 'low']
}
};
const result = await synth.generateTimeSeries({
count: 1000,
interval: '1h',
metrics: ['productivityScore', 'focusLevel', 'energyLevel'],
trend: 'cyclical', // Morning high, afternoon dip, late recovery pattern
seasonality: true,
context: `Model realistic productivity patterns:
- Morning peak (9am-11am): 70-90% productivity
- Post-lunch dip (1pm-3pm): 50-70% productivity
- Afternoon recovery (3pm-5pm): 60-80% productivity
- Individual variations based on chronotype
- Friday effect (10-15% lower average)
- Monday ramp-up period`
});
return result;
}
/**
* Generate collaboration and communication patterns
* Models team interactions, meeting participation, and communication frequency
*/
async function generateCollaborationPatterns() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const collaborationSchema = {
employeeId: { type: 'string', required: true },
date: { type: 'string', required: true },
interactions: {
type: 'object',
required: true,
properties: {
slackMessages: { type: 'number' },
emails: { type: 'number' },
meetings: { type: 'number' },
codeReviews: { type: 'number' },
pairProgramming: { type: 'number' } // hours
}
},
collaborators: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
department: { type: 'string' },
interactionCount: { type: 'number' },
interactionType: { type: 'string' }
}
}
},
networkCentrality: {
type: 'number',
required: true,
min: 0,
max: 1
},
crossFunctionalScore: { type: 'number', required: true }
};
const result = await synth.generateStructured({
count: 300,
schema: collaborationSchema,
format: 'json',
context: `Generate realistic collaboration patterns:
- Engineers: 60% internal team, 40% cross-functional
- Managers: 80% cross-functional, 20% individual work
- Designers: 70% collaboration, 30% individual work
- Sales: 50% internal, 50% external
- Network effects: 20% of employees are high connectors
- Remote workers: 30% more async communication
- Include diversity in communication styles`
});
return result;
}
/**
* Generate meeting attendance and participation data
* Models realistic meeting behaviors and engagement
*/
async function generateMeetingBehavior() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const meetingSchema = {
meetingId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
meetingType: {
type: 'string',
required: true,
enum: ['standup', 'planning', 'review', 'one-on-one', 'all-hands', 'brainstorm', 'training']
},
attended: { type: 'boolean', required: true },
onTime: { type: 'boolean', required: true },
duration: { type: 'number', required: true }, // minutes
participationScore: {
type: 'number',
required: true,
min: 0,
max: 10
},
contributions: {
type: 'object',
required: true,
properties: {
questions: { type: 'number' },
comments: { type: 'number' },
actionItems: { type: 'number' }
}
},
multitasking: { type: 'boolean', required: true },
cameraOn: { type: 'boolean', required: true }
};
const result = await synth.generateEvents({
count: 2000,
eventTypes: ['standup', 'planning', 'review', 'one-on-one', 'all-hands', 'brainstorm', 'training'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days
end: new Date()
},
context: `Generate realistic meeting behaviors:
- 85% attendance rate overall
- 70% on-time arrival
- Higher participation in smaller meetings
- Standup: 15 mins, 60% participation
- Planning: 60 mins, 80% participation
- All-hands: 45 mins, 30% participation
- Remote meeting: 60% camera on
- 25% multitasking during meetings`
});
return result;
}
/**
* Generate task completion rates and patterns
* Models realistic work output and completion behaviors
*/
async function generateTaskCompletion() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const taskSchema = {
taskId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
createdAt: { type: 'string', required: true },
completedAt: { type: 'string', required: false },
estimatedHours: { type: 'number', required: true },
actualHours: { type: 'number', required: false },
priority: {
type: 'string',
required: true,
enum: ['critical', 'high', 'medium', 'low']
},
status: {
type: 'string',
required: true,
enum: ['todo', 'in_progress', 'review', 'done', 'blocked']
},
complexity: {
type: 'string',
required: true,
enum: ['simple', 'moderate', 'complex', 'very_complex']
},
blockedDays: { type: 'number', required: false },
qualityScore: { type: 'number', required: false }
};
const result = await synth.generateStructured({
count: 1000,
schema: taskSchema,
format: 'json',
context: `Generate realistic task completion patterns:
- 75% completion rate within sprint
- 15% variance from estimates
- Priority impact: Critical 95% done, Low 60% done
- 10% of tasks get blocked (avg 2.5 days)
- Complex tasks: 30% longer than estimate
- Quality score: 75-95% range with normal distribution
- Include edge cases: abandoned tasks, scope changes`
});
return result;
}
/**
* Generate work-from-home vs office patterns
* Models hybrid work preferences and patterns
*/
async function generateWorkLocationPatterns() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const locationSchema = {
employeeId: { type: 'string', required: true },
week: { type: 'string', required: true },
schedule: {
type: 'object',
required: true,
properties: {
monday: { type: 'string', enum: ['office', 'remote', 'off'] },
tuesday: { type: 'string', enum: ['office', 'remote', 'off'] },
wednesday: { type: 'string', enum: ['office', 'remote', 'off'] },
thursday: { type: 'string', enum: ['office', 'remote', 'off'] },
friday: { type: 'string', enum: ['office', 'remote', 'off'] }
}
},
officeCollaboration: { type: 'number', required: true },
remoteProductivity: { type: 'number', required: true },
commuteTime: { type: 'number', required: false }, // minutes
workLifeBalance: {
type: 'number',
required: true,
min: 1,
max: 10
}
};
const result = await synth.generateStructured({
count: 200,
schema: locationSchema,
format: 'json',
context: `Generate hybrid work patterns:
- 30% fully remote
- 20% fully office
- 50% hybrid (2-3 days office)
- Tuesday-Thursday most popular office days
- Friday: 70% remote
- Correlation: longer commute = more remote days
- Remote workers report 15% higher productivity
- Office workers report 20% more collaboration
- Include regional differences`
});
return result;
}
/**
* Run all workforce behavior examples
*/
async function runAllBehaviorExamples() {
console.log('=== Workforce Behavior Simulation Examples ===\n');
console.log('1. Generating Work Schedules...');
const schedules = await generateWorkSchedules();
console.log(`Generated ${schedules.data.length} work schedule records`);
console.log('Sample:', JSON.stringify(schedules.data[0], null, 2));
console.log('\n2. Generating Productivity Patterns...');
const productivity = await generateProductivityPatterns();
console.log(`Generated ${productivity.data.length} productivity data points`);
console.log('Sample:', JSON.stringify(productivity.data[0], null, 2));
console.log('\n3. Generating Collaboration Patterns...');
const collaboration = await generateCollaborationPatterns();
console.log(`Generated ${collaboration.data.length} collaboration records`);
console.log('Sample:', JSON.stringify(collaboration.data[0], null, 2));
console.log('\n4. Generating Meeting Behavior...');
const meetings = await generateMeetingBehavior();
console.log(`Generated ${meetings.data.length} meeting attendance records`);
console.log('Sample:', JSON.stringify(meetings.data[0], null, 2));
console.log('\n5. Generating Task Completion...');
const tasks = await generateTaskCompletion();
console.log(`Generated ${tasks.data.length} task records`);
console.log('Sample:', JSON.stringify(tasks.data[0], null, 2));
console.log('\n6. Generating Work Location Patterns...');
const locations = await generateWorkLocationPatterns();
console.log(`Generated ${locations.data.length} work location records`);
console.log('Sample:', JSON.stringify(locations.data[0], null, 2));
}
// Uncomment to run
// runAllBehaviorExamples().catch(console.error);
//# sourceMappingURL=workforce-behavior.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,383 @@
/**
* Employee Behavior Patterns Simulation
*
* Generates realistic daily work schedules, productivity patterns, collaboration,
* and communication behaviors for workforce modeling.
*
* PRIVACY NOTE: All data is synthetic. No real employee data is used or should
* be used to train these models without explicit consent and proper anonymization.
*/
import { createSynth } from '../../src/index.js';
/**
* Generate daily work schedule patterns
* Simulates diverse work hours including flexible schedules, remote work, etc.
*/
export async function generateWorkSchedules() {
const synth = createSynth({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const scheduleSchema = {
employeeId: { type: 'string', required: true },
date: { type: 'string', required: true },
workMode: {
type: 'string',
required: true,
enum: ['office', 'remote', 'hybrid']
},
checkIn: { type: 'string', required: true }, // ISO time
checkOut: { type: 'string', required: true },
breaks: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
start: { type: 'string' },
duration: { type: 'number' } // minutes
}
}
},
overtimeMinutes: { type: 'number', required: false },
timezone: { type: 'string', required: true }
};
const result = await synth.generateStructured({
count: 500,
schema: scheduleSchema,
format: 'json',
context: `Generate diverse work schedules representing:
- Different time zones (US, Europe, Asia)
- Various work modes (40% office, 30% remote, 30% hybrid)
- Flexible start times (7am-10am)
- Standard 8-hour days with realistic variations
- Cultural diversity in break patterns
- Occasional overtime (10% of records)`
});
return result;
}
/**
* Generate productivity patterns throughout the day
* Models realistic variations in focus and output
*/
export async function generateProductivityPatterns() {
const synth = createSynth({
provider: 'gemini'
});
const productivitySchema = {
employeeId: { type: 'string', required: true },
timestamp: { type: 'string', required: true },
productivityScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
focusLevel: {
type: 'string',
required: true,
enum: ['deep_work', 'moderate', 'distracted', 'break']
},
tasksCompleted: { type: 'number', required: true },
meetingsAttended: { type: 'number', required: true },
codeCommits: { type: 'number', required: false },
documentsEdited: { type: 'number', required: false },
emailsProcessed: { type: 'number', required: false },
energyLevel: {
type: 'string',
required: true,
enum: ['high', 'medium', 'low']
}
};
const result = await synth.generateTimeSeries({
count: 1000,
interval: '1h',
metrics: ['productivityScore', 'focusLevel', 'energyLevel'],
trend: 'cyclical', // Morning high, afternoon dip, late recovery pattern
seasonality: true,
context: `Model realistic productivity patterns:
- Morning peak (9am-11am): 70-90% productivity
- Post-lunch dip (1pm-3pm): 50-70% productivity
- Afternoon recovery (3pm-5pm): 60-80% productivity
- Individual variations based on chronotype
- Friday effect (10-15% lower average)
- Monday ramp-up period`
});
return result;
}
/**
* Generate collaboration and communication patterns
* Models team interactions, meeting participation, and communication frequency
*/
export async function generateCollaborationPatterns() {
const synth = createSynth({
provider: 'gemini'
});
const collaborationSchema = {
employeeId: { type: 'string', required: true },
date: { type: 'string', required: true },
interactions: {
type: 'object',
required: true,
properties: {
slackMessages: { type: 'number' },
emails: { type: 'number' },
meetings: { type: 'number' },
codeReviews: { type: 'number' },
pairProgramming: { type: 'number' } // hours
}
},
collaborators: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
department: { type: 'string' },
interactionCount: { type: 'number' },
interactionType: { type: 'string' }
}
}
},
networkCentrality: {
type: 'number',
required: true,
min: 0,
max: 1
},
crossFunctionalScore: { type: 'number', required: true }
};
const result = await synth.generateStructured({
count: 300,
schema: collaborationSchema,
format: 'json',
context: `Generate realistic collaboration patterns:
- Engineers: 60% internal team, 40% cross-functional
- Managers: 80% cross-functional, 20% individual work
- Designers: 70% collaboration, 30% individual work
- Sales: 50% internal, 50% external
- Network effects: 20% of employees are high connectors
- Remote workers: 30% more async communication
- Include diversity in communication styles`
});
return result;
}
/**
* Generate meeting attendance and participation data
* Models realistic meeting behaviors and engagement
*/
export async function generateMeetingBehavior() {
const synth = createSynth({
provider: 'gemini'
});
const meetingSchema = {
meetingId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
meetingType: {
type: 'string',
required: true,
enum: ['standup', 'planning', 'review', 'one-on-one', 'all-hands', 'brainstorm', 'training']
},
attended: { type: 'boolean', required: true },
onTime: { type: 'boolean', required: true },
duration: { type: 'number', required: true }, // minutes
participationScore: {
type: 'number',
required: true,
min: 0,
max: 10
},
contributions: {
type: 'object',
required: true,
properties: {
questions: { type: 'number' },
comments: { type: 'number' },
actionItems: { type: 'number' }
}
},
multitasking: { type: 'boolean', required: true },
cameraOn: { type: 'boolean', required: true }
};
const result = await synth.generateEvents({
count: 2000,
eventTypes: ['standup', 'planning', 'review', 'one-on-one', 'all-hands', 'brainstorm', 'training'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days
end: new Date()
},
context: `Generate realistic meeting behaviors:
- 85% attendance rate overall
- 70% on-time arrival
- Higher participation in smaller meetings
- Standup: 15 mins, 60% participation
- Planning: 60 mins, 80% participation
- All-hands: 45 mins, 30% participation
- Remote meeting: 60% camera on
- 25% multitasking during meetings`
});
return result;
}
/**
* Generate task completion rates and patterns
* Models realistic work output and completion behaviors
*/
export async function generateTaskCompletion() {
const synth = createSynth({
provider: 'gemini'
});
const taskSchema = {
taskId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
createdAt: { type: 'string', required: true },
completedAt: { type: 'string', required: false },
estimatedHours: { type: 'number', required: true },
actualHours: { type: 'number', required: false },
priority: {
type: 'string',
required: true,
enum: ['critical', 'high', 'medium', 'low']
},
status: {
type: 'string',
required: true,
enum: ['todo', 'in_progress', 'review', 'done', 'blocked']
},
complexity: {
type: 'string',
required: true,
enum: ['simple', 'moderate', 'complex', 'very_complex']
},
blockedDays: { type: 'number', required: false },
qualityScore: { type: 'number', required: false }
};
const result = await synth.generateStructured({
count: 1000,
schema: taskSchema,
format: 'json',
context: `Generate realistic task completion patterns:
- 75% completion rate within sprint
- 15% variance from estimates
- Priority impact: Critical 95% done, Low 60% done
- 10% of tasks get blocked (avg 2.5 days)
- Complex tasks: 30% longer than estimate
- Quality score: 75-95% range with normal distribution
- Include edge cases: abandoned tasks, scope changes`
});
return result;
}
/**
* Generate work-from-home vs office patterns
* Models hybrid work preferences and patterns
*/
export async function generateWorkLocationPatterns() {
const synth = createSynth({
provider: 'gemini'
});
const locationSchema = {
employeeId: { type: 'string', required: true },
week: { type: 'string', required: true },
schedule: {
type: 'object',
required: true,
properties: {
monday: { type: 'string', enum: ['office', 'remote', 'off'] },
tuesday: { type: 'string', enum: ['office', 'remote', 'off'] },
wednesday: { type: 'string', enum: ['office', 'remote', 'off'] },
thursday: { type: 'string', enum: ['office', 'remote', 'off'] },
friday: { type: 'string', enum: ['office', 'remote', 'off'] }
}
},
officeCollaboration: { type: 'number', required: true },
remoteProductivity: { type: 'number', required: true },
commuteTime: { type: 'number', required: false }, // minutes
workLifeBalance: {
type: 'number',
required: true,
min: 1,
max: 10
}
};
const result = await synth.generateStructured({
count: 200,
schema: locationSchema,
format: 'json',
context: `Generate hybrid work patterns:
- 30% fully remote
- 20% fully office
- 50% hybrid (2-3 days office)
- Tuesday-Thursday most popular office days
- Friday: 70% remote
- Correlation: longer commute = more remote days
- Remote workers report 15% higher productivity
- Office workers report 20% more collaboration
- Include regional differences`
});
return result;
}
/**
* Run all workforce behavior examples
*/
export async function runAllBehaviorExamples() {
console.log('=== Workforce Behavior Simulation Examples ===\n');
console.log('1. Generating Work Schedules...');
const schedules = await generateWorkSchedules();
console.log(`Generated ${schedules.data.length} work schedule records`);
console.log('Sample:', JSON.stringify(schedules.data[0], null, 2));
console.log('\n2. Generating Productivity Patterns...');
const productivity = await generateProductivityPatterns();
console.log(`Generated ${productivity.data.length} productivity data points`);
console.log('Sample:', JSON.stringify(productivity.data[0], null, 2));
console.log('\n3. Generating Collaboration Patterns...');
const collaboration = await generateCollaborationPatterns();
console.log(`Generated ${collaboration.data.length} collaboration records`);
console.log('Sample:', JSON.stringify(collaboration.data[0], null, 2));
console.log('\n4. Generating Meeting Behavior...');
const meetings = await generateMeetingBehavior();
console.log(`Generated ${meetings.data.length} meeting attendance records`);
console.log('Sample:', JSON.stringify(meetings.data[0], null, 2));
console.log('\n5. Generating Task Completion...');
const tasks = await generateTaskCompletion();
console.log(`Generated ${tasks.data.length} task records`);
console.log('Sample:', JSON.stringify(tasks.data[0], null, 2));
console.log('\n6. Generating Work Location Patterns...');
const locations = await generateWorkLocationPatterns();
console.log(`Generated ${locations.data.length} work location records`);
console.log('Sample:', JSON.stringify(locations.data[0], null, 2));
}
// Uncomment to run
// runAllBehaviorExamples().catch(console.error);

View File

@@ -0,0 +1,44 @@
/**
* Workforce Planning Data Simulation
*
* Generates realistic hiring forecasts, skill gap analysis, turnover predictions,
* compensation data, career paths, and diversity metrics for strategic HR planning.
*
* PRIVACY & ETHICS: This data is synthetic for planning purposes only.
* Never use for actual hiring decisions or to bias against protected groups.
*/
/**
* Generate hiring needs forecasting data
* Models future workforce requirements based on growth and attrition
*/
export declare function generateHiringForecast(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate skill gap analysis data
* Identifies current vs required skills for strategic planning
*/
export declare function generateSkillGapAnalysis(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate turnover prediction data
* Models attrition risk and retention strategies
*/
export declare function generateTurnoverPredictions(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate compensation analysis data
* Models pay equity, market positioning, and adjustment needs
*/
export declare function generateCompensationAnalysis(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate career progression path data
* Models typical career ladders and advancement timelines
*/
export declare function generateCareerPaths(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate workforce diversity metrics
* Models representation, inclusion, and equity indicators
*/
export declare function generateDiversityMetrics(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Run all workforce planning examples
*/
export declare function runAllWorkforcePlanningExamples(): Promise<void>;
//# sourceMappingURL=workforce-planning.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"workforce-planning.d.ts","sourceRoot":"","sources":["workforce-planning.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;GAGG;AACH,wBAAsB,sBAAsB,oEAoE3C;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,oEAkE7C;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,oEA4EhD;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,oEAyFjD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,oEA8FxC;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,oEAyI7C;AAED;;GAEG;AACH,wBAAsB,+BAA+B,kBAgCpD"}

View File

@@ -0,0 +1,594 @@
"use strict";
/**
* Workforce Planning Data Simulation
*
* Generates realistic hiring forecasts, skill gap analysis, turnover predictions,
* compensation data, career paths, and diversity metrics for strategic HR planning.
*
* PRIVACY & ETHICS: This data is synthetic for planning purposes only.
* Never use for actual hiring decisions or to bias against protected groups.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateHiringForecast = generateHiringForecast;
exports.generateSkillGapAnalysis = generateSkillGapAnalysis;
exports.generateTurnoverPredictions = generateTurnoverPredictions;
exports.generateCompensationAnalysis = generateCompensationAnalysis;
exports.generateCareerPaths = generateCareerPaths;
exports.generateDiversityMetrics = generateDiversityMetrics;
exports.runAllWorkforcePlanningExamples = runAllWorkforcePlanningExamples;
const index_js_1 = require("../../src/index.js");
/**
* Generate hiring needs forecasting data
* Models future workforce requirements based on growth and attrition
*/
async function generateHiringForecast() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const forecastSchema = {
forecastPeriod: { type: 'string', required: true },
department: { type: 'string', required: true },
currentHeadcount: { type: 'number', required: true },
projectedGrowth: { type: 'number', required: true }, // percentage
expectedAttrition: { type: 'number', required: true }, // percentage
hiringNeeds: {
type: 'object',
required: true,
properties: {
newRoles: { type: 'number' },
backfills: { type: 'number' },
total: { type: 'number' }
}
},
roleBreakdown: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
role: { type: 'string' },
level: { type: 'string', enum: ['junior', 'mid', 'senior', 'lead', 'principal'] },
count: { type: 'number' },
priority: { type: 'string', enum: ['critical', 'high', 'medium', 'low'] },
timeToFill: { type: 'number' }, // days
difficulty: { type: 'string', enum: ['easy', 'moderate', 'challenging', 'very_challenging'] }
}
}
},
budgetRequired: { type: 'number', required: true },
talentAvailability: {
type: 'string',
required: true,
enum: ['abundant', 'adequate', 'limited', 'scarce']
},
competingEmployers: { type: 'number', required: true },
risks: {
type: 'array',
required: true,
items: { type: 'string' }
}
};
const result = await synth.generateStructured({
count: 40,
schema: forecastSchema,
format: 'json',
context: `Generate hiring forecast data:
- Growth: 10-30% annual for growth companies, 0-10% for mature
- Attrition: 12-18% average (tech industry)
- Senior roles: 60-90 days to fill, very challenging
- Junior roles: 30-45 days to fill, moderate difficulty
- Critical roles: ML engineers, cybersecurity, senior backend
- Budget: $100K-$180K per engineer, $80K-$130K per designer
- Talent scarcity: ML/AI scarce, frontend moderate, support abundant
- Risks: competing offers, remote work expectations, skill gaps
- Seasonal patterns: Q1 high, Q3 low
- Include headcount changes month-by-month`
});
return result;
}
/**
* Generate skill gap analysis data
* Identifies current vs required skills for strategic planning
*/
async function generateSkillGapAnalysis() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const skillGapSchema = {
analysisDate: { type: 'string', required: true },
department: { type: 'string', required: true },
skillCategory: {
type: 'string',
required: true,
enum: ['technical', 'leadership', 'domain', 'soft_skills', 'tools']
},
skills: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
skillName: { type: 'string' },
currentLevel: { type: 'number', min: 1, max: 5 },
requiredLevel: { type: 'number', min: 1, max: 5 },
gap: { type: 'number' },
employeesWithSkill: { type: 'number' },
employeesNeedingSkill: { type: 'number' },
criticality: { type: 'string', enum: ['critical', 'important', 'nice_to_have'] }
}
}
},
gapImpact: {
type: 'string',
required: true,
enum: ['severe', 'moderate', 'minor', 'minimal']
},
closureStrategy: {
type: 'array',
required: true,
items: {
type: 'string',
enum: ['training', 'hiring', 'contracting', 'partnering', 'outsourcing']
}
},
timeToClose: { type: 'number', required: true }, // months
investmentRequired: { type: 'number', required: true }, // dollars
successProbability: { type: 'number', required: true } // percentage
};
const result = await synth.generateStructured({
count: 100,
schema: skillGapSchema,
format: 'json',
context: `Generate skill gap analysis:
- Critical gaps (20%): Cloud architecture, ML/AI, cybersecurity
- Important gaps (50%): Modern frameworks, data engineering, API design
- Nice-to-have gaps (30%): Additional languages, tools, certifications
- Average gap: 1.2 levels
- Severe impact: blocks strategic initiatives
- Training: 6-12 months for technical skills
- Hiring: 3-6 months to close gaps
- Contracting: immediate but expensive
- Success probability: Training 70%, Hiring 85%, Contract 95%
- Investment: $5K-$15K per person for training
- Include emerging skills (AI, Web3, etc.)`
});
return result;
}
/**
* Generate turnover prediction data
* Models attrition risk and retention strategies
*/
async function generateTurnoverPredictions() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const turnoverSchema = {
employeeId: { type: 'string', required: true },
predictionDate: { type: 'string', required: true },
tenure: { type: 'number', required: true }, // years
role: { type: 'string', required: true },
level: { type: 'string', required: true },
flightRiskScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
riskCategory: {
type: 'string',
required: true,
enum: ['low', 'medium', 'high', 'critical']
},
riskFactors: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
factor: { type: 'string' },
impact: { type: 'number', min: 0, max: 10 }
}
}
},
retentionActions: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
action: { type: 'string' },
effectiveness: { type: 'number', min: 0, max: 100 },
cost: { type: 'number' }
}
}
},
replacementCost: { type: 'number', required: true },
businessImpact: {
type: 'string',
required: true,
enum: ['critical', 'high', 'moderate', 'low']
},
probabilityOfLeaving: { type: 'number', required: true }, // 0-1
timeframe: {
type: 'string',
required: true,
enum: ['0-3_months', '3-6_months', '6-12_months', '12+_months']
}
};
const result = await synth.generateStructured({
count: 300,
schema: turnoverSchema,
format: 'json',
context: `Generate turnover prediction data:
- Overall risk: Low 60%, Medium 25%, High 12%, Critical 3%
- Risk factors: Compensation (30%), growth (25%), manager (20%), workload (15%), culture (10%)
- High risk: tenure 1-2 years or 5-7 years, below-market comp, low engagement
- Retention actions: compensation adjustment (60% effective), promotion (70%), project change (40%)
- Replacement cost: 1.5-2x annual salary
- Critical business impact: key person dependencies, unique skills
- Probability: High risk 60-80%, Medium 30-50%, Low <20%
- Time patterns: Q1 and post-review periods highest risk
- Include false positives and negatives for realism`
});
return result;
}
/**
* Generate compensation analysis data
* Models pay equity, market positioning, and adjustment needs
*/
async function generateCompensationAnalysis() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const compensationSchema = {
analysisId: { type: 'string', required: true },
analysisDate: { type: 'string', required: true },
jobFamily: { type: 'string', required: true },
level: { type: 'string', required: true },
location: { type: 'string', required: true },
employeeCount: { type: 'number', required: true },
salaryData: {
type: 'object',
required: true,
properties: {
min: { type: 'number' },
max: { type: 'number' },
median: { type: 'number' },
mean: { type: 'number' },
stddev: { type: 'number' }
}
},
marketData: {
type: 'object',
required: true,
properties: {
p25: { type: 'number' },
p50: { type: 'number' },
p75: { type: 'number' },
p90: { type: 'number' }
}
},
positioning: {
type: 'string',
required: true,
enum: ['below_market', 'at_market', 'above_market']
},
equityAnalysis: {
type: 'object',
required: true,
properties: {
genderPayGap: { type: 'number' }, // percentage
minorityPayGap: { type: 'number' },
tenureDisparity: { type: 'number' },
equitable: { type: 'boolean' }
}
},
adjustmentNeeds: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
currentSalary: { type: 'number' },
recommendedSalary: { type: 'number' },
adjustmentPercent: { type: 'number' },
reason: { type: 'string' }
}
}
},
budgetRequired: { type: 'number', required: true },
complianceStatus: {
type: 'string',
required: true,
enum: ['compliant', 'needs_review', 'non_compliant']
}
};
const result = await synth.generateStructured({
count: 50,
schema: compensationSchema,
format: 'json',
context: `Generate compensation analysis data:
- Market positioning: 40% at market, 35% below, 25% above
- Target: P50-P65 of market for most roles
- Critical roles: P75-P90
- Gender pay gap: 2-8% (raw), 0-2% (adjusted for role/tenure)
- Pay equity: Identify and flag >5% unexplained gaps
- Adjustment needs: 25% of employees (2-15% increases)
- Reasons: market adjustment, equity correction, retention risk
- Budget: 2-4% of total compensation budget
- Location variance: SF/NYC +30%, Austin +10%, Remote -5%
- Include both base salary and total compensation
- Flag compliance issues (pay transparency, equal pay)`
});
return result;
}
/**
* Generate career progression path data
* Models typical career ladders and advancement timelines
*/
async function generateCareerPaths() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const careerPathSchema = {
pathId: { type: 'string', required: true },
jobFamily: { type: 'string', required: true },
track: {
type: 'string',
required: true,
enum: ['individual_contributor', 'management', 'technical_leadership']
},
levels: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
level: { type: 'string' },
title: { type: 'string' },
typicalTenure: { type: 'number' }, // years at level
keyCompetencies: {
type: 'array',
items: { type: 'string' }
},
salaryRange: {
type: 'object',
properties: {
min: { type: 'number' },
max: { type: 'number' }
}
}
}
}
},
totalCareerLength: { type: 'number', required: true }, // years entry to senior
advancementRate: {
type: 'object',
required: true,
properties: {
fast: { type: 'number' }, // years
typical: { type: 'number' },
slow: { type: 'number' }
}
},
transitionPoints: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
from: { type: 'string' },
to: { type: 'string' },
successRate: { type: 'number' }, // percentage
requiredDevelopment: {
type: 'array',
items: { type: 'string' }
}
}
}
},
lateralMoves: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
toJobFamily: { type: 'string' },
feasibility: { type: 'string', enum: ['common', 'possible', 'rare'] },
skillTransfer: { type: 'number' } // percentage
}
}
}
};
const result = await synth.generateStructured({
count: 30,
schema: careerPathSchema,
format: 'json',
context: `Generate career path data:
- IC track: Junior (1-2y) → Mid (2-4y) → Senior (3-5y) → Staff (4-6y) → Principal (5+y)
- Management track: IC → Lead (3-5y) → Manager (2-3y) → Sr Mgr (3-4y) → Director (4-6y)
- Fast advancement: Top 15%, 50% faster than typical
- Slow advancement: Bottom 20%, 50% slower than typical
- IC to management: 40% attempt, 70% succeed
- Management to IC: 20% return, 90% succeed
- Lateral moves: Engineering ↔ Product (possible), Sales ↔ Marketing (common)
- Skill transfer: Same domain 80%, Adjacent 50%, Different 20%
- Salary growth: 8-12% per promotion, 3-5% annual merit
- Include diverse paths and non-linear progressions`
});
return result;
}
/**
* Generate workforce diversity metrics
* Models representation, inclusion, and equity indicators
*/
async function generateDiversityMetrics() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const diversitySchema = {
reportingPeriod: { type: 'string', required: true },
organizationLevel: {
type: 'string',
required: true,
enum: ['company', 'division', 'department', 'team']
},
entityName: { type: 'string', required: true },
headcount: { type: 'number', required: true },
demographics: {
type: 'object',
required: true,
properties: {
gender: {
type: 'object',
properties: {
women: { type: 'number' }, // percentage
men: { type: 'number' },
nonBinary: { type: 'number' },
undisclosed: { type: 'number' }
}
},
ethnicity: {
type: 'object',
properties: {
asian: { type: 'number' },
black: { type: 'number' },
hispanic: { type: 'number' },
white: { type: 'number' },
multiracial: { type: 'number' },
other: { type: 'number' },
undisclosed: { type: 'number' }
}
},
age: {
type: 'object',
properties: {
under30: { type: 'number' },
age30to40: { type: 'number' },
age40to50: { type: 'number' },
over50: { type: 'number' }
}
}
}
},
representation: {
type: 'object',
required: true,
properties: {
leadership: {
type: 'object',
properties: {
women: { type: 'number' },
minorities: { type: 'number' }
}
},
technical: {
type: 'object',
properties: {
women: { type: 'number' },
minorities: { type: 'number' }
}
},
hiring: {
type: 'object',
properties: {
women: { type: 'number' },
minorities: { type: 'number' }
}
},
promotions: {
type: 'object',
properties: {
women: { type: 'number' },
minorities: { type: 'number' }
}
}
}
},
inclusionMetrics: {
type: 'object',
required: true,
properties: {
belongingScore: { type: 'number', min: 0, max: 100 },
psychologicalSafety: { type: 'number', min: 0, max: 100 },
fairTreatment: { type: 'number', min: 0, max: 100 },
voiceHeard: { type: 'number', min: 0, max: 100 }
}
},
trends: {
type: 'object',
required: true,
properties: {
direction: { type: 'string', enum: ['improving', 'stable', 'declining'] },
yearOverYearChange: { type: 'number' } // percentage points
}
},
goals: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
metric: { type: 'string' },
current: { type: 'number' },
target: { type: 'number' },
deadline: { type: 'string' }
}
}
}
};
const result = await synth.generateStructured({
count: 60,
schema: diversitySchema,
format: 'json',
context: `Generate diversity metrics (based on tech industry benchmarks):
- Overall women: 25-35% (improving +1-2% annually)
- Technical women: 20-30%
- Leadership women: 25-40%
- Underrepresented minorities: 15-25%
- Age distribution: 40% under 30, 35% 30-40, 20% 40-50, 5% over 50
- Hiring: Should meet or exceed current representation
- Promotions: Within ±3% of representation (equity indicator)
- Inclusion scores: 70-85 range, correlates with diversity
- Belonging: Higher in diverse teams (+10-15 points)
- Pipeline challenge: Narrowing at senior levels
- Goals: 40% women in tech by 2025 (aspirational)
- Include intersectional data where appropriate`
});
return result;
}
/**
* Run all workforce planning examples
*/
async function runAllWorkforcePlanningExamples() {
console.log('=== Workforce Planning Simulation Examples ===\n');
console.log('1. Generating Hiring Forecasts...');
const hiring = await generateHiringForecast();
console.log(`Generated ${hiring.data.length} hiring forecast records`);
console.log('Sample:', JSON.stringify(hiring.data[0], null, 2));
console.log('\n2. Generating Skill Gap Analysis...');
const skills = await generateSkillGapAnalysis();
console.log(`Generated ${skills.data.length} skill gap records`);
console.log('Sample:', JSON.stringify(skills.data[0], null, 2));
console.log('\n3. Generating Turnover Predictions...');
const turnover = await generateTurnoverPredictions();
console.log(`Generated ${turnover.data.length} turnover prediction records`);
console.log('Sample:', JSON.stringify(turnover.data[0], null, 2));
console.log('\n4. Generating Compensation Analysis...');
const compensation = await generateCompensationAnalysis();
console.log(`Generated ${compensation.data.length} compensation analysis records`);
console.log('Sample:', JSON.stringify(compensation.data[0], null, 2));
console.log('\n5. Generating Career Paths...');
const careers = await generateCareerPaths();
console.log(`Generated ${careers.data.length} career path records`);
console.log('Sample:', JSON.stringify(careers.data[0], null, 2));
console.log('\n6. Generating Diversity Metrics...');
const diversity = await generateDiversityMetrics();
console.log(`Generated ${diversity.data.length} diversity metric records`);
console.log('Sample:', JSON.stringify(diversity.data[0], null, 2));
}
// Uncomment to run
// runAllWorkforcePlanningExamples().catch(console.error);
//# sourceMappingURL=workforce-planning.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,617 @@
/**
* Workforce Planning Data Simulation
*
* Generates realistic hiring forecasts, skill gap analysis, turnover predictions,
* compensation data, career paths, and diversity metrics for strategic HR planning.
*
* PRIVACY & ETHICS: This data is synthetic for planning purposes only.
* Never use for actual hiring decisions or to bias against protected groups.
*/
import { createSynth } from '../../src/index.js';
/**
* Generate hiring needs forecasting data
* Models future workforce requirements based on growth and attrition
*/
export async function generateHiringForecast() {
const synth = createSynth({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const forecastSchema = {
forecastPeriod: { type: 'string', required: true },
department: { type: 'string', required: true },
currentHeadcount: { type: 'number', required: true },
projectedGrowth: { type: 'number', required: true }, // percentage
expectedAttrition: { type: 'number', required: true }, // percentage
hiringNeeds: {
type: 'object',
required: true,
properties: {
newRoles: { type: 'number' },
backfills: { type: 'number' },
total: { type: 'number' }
}
},
roleBreakdown: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
role: { type: 'string' },
level: { type: 'string', enum: ['junior', 'mid', 'senior', 'lead', 'principal'] },
count: { type: 'number' },
priority: { type: 'string', enum: ['critical', 'high', 'medium', 'low'] },
timeToFill: { type: 'number' }, // days
difficulty: { type: 'string', enum: ['easy', 'moderate', 'challenging', 'very_challenging'] }
}
}
},
budgetRequired: { type: 'number', required: true },
talentAvailability: {
type: 'string',
required: true,
enum: ['abundant', 'adequate', 'limited', 'scarce']
},
competingEmployers: { type: 'number', required: true },
risks: {
type: 'array',
required: true,
items: { type: 'string' }
}
};
const result = await synth.generateStructured({
count: 40,
schema: forecastSchema,
format: 'json',
context: `Generate hiring forecast data:
- Growth: 10-30% annual for growth companies, 0-10% for mature
- Attrition: 12-18% average (tech industry)
- Senior roles: 60-90 days to fill, very challenging
- Junior roles: 30-45 days to fill, moderate difficulty
- Critical roles: ML engineers, cybersecurity, senior backend
- Budget: $100K-$180K per engineer, $80K-$130K per designer
- Talent scarcity: ML/AI scarce, frontend moderate, support abundant
- Risks: competing offers, remote work expectations, skill gaps
- Seasonal patterns: Q1 high, Q3 low
- Include headcount changes month-by-month`
});
return result;
}
/**
* Generate skill gap analysis data
* Identifies current vs required skills for strategic planning
*/
export async function generateSkillGapAnalysis() {
const synth = createSynth({
provider: 'gemini'
});
const skillGapSchema = {
analysisDate: { type: 'string', required: true },
department: { type: 'string', required: true },
skillCategory: {
type: 'string',
required: true,
enum: ['technical', 'leadership', 'domain', 'soft_skills', 'tools']
},
skills: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
skillName: { type: 'string' },
currentLevel: { type: 'number', min: 1, max: 5 },
requiredLevel: { type: 'number', min: 1, max: 5 },
gap: { type: 'number' },
employeesWithSkill: { type: 'number' },
employeesNeedingSkill: { type: 'number' },
criticality: { type: 'string', enum: ['critical', 'important', 'nice_to_have'] }
}
}
},
gapImpact: {
type: 'string',
required: true,
enum: ['severe', 'moderate', 'minor', 'minimal']
},
closureStrategy: {
type: 'array',
required: true,
items: {
type: 'string',
enum: ['training', 'hiring', 'contracting', 'partnering', 'outsourcing']
}
},
timeToClose: { type: 'number', required: true }, // months
investmentRequired: { type: 'number', required: true }, // dollars
successProbability: { type: 'number', required: true } // percentage
};
const result = await synth.generateStructured({
count: 100,
schema: skillGapSchema,
format: 'json',
context: `Generate skill gap analysis:
- Critical gaps (20%): Cloud architecture, ML/AI, cybersecurity
- Important gaps (50%): Modern frameworks, data engineering, API design
- Nice-to-have gaps (30%): Additional languages, tools, certifications
- Average gap: 1.2 levels
- Severe impact: blocks strategic initiatives
- Training: 6-12 months for technical skills
- Hiring: 3-6 months to close gaps
- Contracting: immediate but expensive
- Success probability: Training 70%, Hiring 85%, Contract 95%
- Investment: $5K-$15K per person for training
- Include emerging skills (AI, Web3, etc.)`
});
return result;
}
/**
* Generate turnover prediction data
* Models attrition risk and retention strategies
*/
export async function generateTurnoverPredictions() {
const synth = createSynth({
provider: 'gemini'
});
const turnoverSchema = {
employeeId: { type: 'string', required: true },
predictionDate: { type: 'string', required: true },
tenure: { type: 'number', required: true }, // years
role: { type: 'string', required: true },
level: { type: 'string', required: true },
flightRiskScore: {
type: 'number',
required: true,
min: 0,
max: 100
},
riskCategory: {
type: 'string',
required: true,
enum: ['low', 'medium', 'high', 'critical']
},
riskFactors: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
factor: { type: 'string' },
impact: { type: 'number', min: 0, max: 10 }
}
}
},
retentionActions: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
action: { type: 'string' },
effectiveness: { type: 'number', min: 0, max: 100 },
cost: { type: 'number' }
}
}
},
replacementCost: { type: 'number', required: true },
businessImpact: {
type: 'string',
required: true,
enum: ['critical', 'high', 'moderate', 'low']
},
probabilityOfLeaving: { type: 'number', required: true }, // 0-1
timeframe: {
type: 'string',
required: true,
enum: ['0-3_months', '3-6_months', '6-12_months', '12+_months']
}
};
const result = await synth.generateStructured({
count: 300,
schema: turnoverSchema,
format: 'json',
context: `Generate turnover prediction data:
- Overall risk: Low 60%, Medium 25%, High 12%, Critical 3%
- Risk factors: Compensation (30%), growth (25%), manager (20%), workload (15%), culture (10%)
- High risk: tenure 1-2 years or 5-7 years, below-market comp, low engagement
- Retention actions: compensation adjustment (60% effective), promotion (70%), project change (40%)
- Replacement cost: 1.5-2x annual salary
- Critical business impact: key person dependencies, unique skills
- Probability: High risk 60-80%, Medium 30-50%, Low <20%
- Time patterns: Q1 and post-review periods highest risk
- Include false positives and negatives for realism`
});
return result;
}
/**
* Generate compensation analysis data
* Models pay equity, market positioning, and adjustment needs
*/
export async function generateCompensationAnalysis() {
const synth = createSynth({
provider: 'gemini'
});
const compensationSchema = {
analysisId: { type: 'string', required: true },
analysisDate: { type: 'string', required: true },
jobFamily: { type: 'string', required: true },
level: { type: 'string', required: true },
location: { type: 'string', required: true },
employeeCount: { type: 'number', required: true },
salaryData: {
type: 'object',
required: true,
properties: {
min: { type: 'number' },
max: { type: 'number' },
median: { type: 'number' },
mean: { type: 'number' },
stddev: { type: 'number' }
}
},
marketData: {
type: 'object',
required: true,
properties: {
p25: { type: 'number' },
p50: { type: 'number' },
p75: { type: 'number' },
p90: { type: 'number' }
}
},
positioning: {
type: 'string',
required: true,
enum: ['below_market', 'at_market', 'above_market']
},
equityAnalysis: {
type: 'object',
required: true,
properties: {
genderPayGap: { type: 'number' }, // percentage
minorityPayGap: { type: 'number' },
tenureDisparity: { type: 'number' },
equitable: { type: 'boolean' }
}
},
adjustmentNeeds: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
currentSalary: { type: 'number' },
recommendedSalary: { type: 'number' },
adjustmentPercent: { type: 'number' },
reason: { type: 'string' }
}
}
},
budgetRequired: { type: 'number', required: true },
complianceStatus: {
type: 'string',
required: true,
enum: ['compliant', 'needs_review', 'non_compliant']
}
};
const result = await synth.generateStructured({
count: 50,
schema: compensationSchema,
format: 'json',
context: `Generate compensation analysis data:
- Market positioning: 40% at market, 35% below, 25% above
- Target: P50-P65 of market for most roles
- Critical roles: P75-P90
- Gender pay gap: 2-8% (raw), 0-2% (adjusted for role/tenure)
- Pay equity: Identify and flag >5% unexplained gaps
- Adjustment needs: 25% of employees (2-15% increases)
- Reasons: market adjustment, equity correction, retention risk
- Budget: 2-4% of total compensation budget
- Location variance: SF/NYC +30%, Austin +10%, Remote -5%
- Include both base salary and total compensation
- Flag compliance issues (pay transparency, equal pay)`
});
return result;
}
/**
* Generate career progression path data
* Models typical career ladders and advancement timelines
*/
export async function generateCareerPaths() {
const synth = createSynth({
provider: 'gemini'
});
const careerPathSchema = {
pathId: { type: 'string', required: true },
jobFamily: { type: 'string', required: true },
track: {
type: 'string',
required: true,
enum: ['individual_contributor', 'management', 'technical_leadership']
},
levels: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
level: { type: 'string' },
title: { type: 'string' },
typicalTenure: { type: 'number' }, // years at level
keyCompetencies: {
type: 'array',
items: { type: 'string' }
},
salaryRange: {
type: 'object',
properties: {
min: { type: 'number' },
max: { type: 'number' }
}
}
}
}
},
totalCareerLength: { type: 'number', required: true }, // years entry to senior
advancementRate: {
type: 'object',
required: true,
properties: {
fast: { type: 'number' }, // years
typical: { type: 'number' },
slow: { type: 'number' }
}
},
transitionPoints: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
from: { type: 'string' },
to: { type: 'string' },
successRate: { type: 'number' }, // percentage
requiredDevelopment: {
type: 'array',
items: { type: 'string' }
}
}
}
},
lateralMoves: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
toJobFamily: { type: 'string' },
feasibility: { type: 'string', enum: ['common', 'possible', 'rare'] },
skillTransfer: { type: 'number' } // percentage
}
}
}
};
const result = await synth.generateStructured({
count: 30,
schema: careerPathSchema,
format: 'json',
context: `Generate career path data:
- IC track: Junior (1-2y) → Mid (2-4y) → Senior (3-5y) → Staff (4-6y) → Principal (5+y)
- Management track: IC → Lead (3-5y) → Manager (2-3y) → Sr Mgr (3-4y) → Director (4-6y)
- Fast advancement: Top 15%, 50% faster than typical
- Slow advancement: Bottom 20%, 50% slower than typical
- IC to management: 40% attempt, 70% succeed
- Management to IC: 20% return, 90% succeed
- Lateral moves: Engineering ↔ Product (possible), Sales ↔ Marketing (common)
- Skill transfer: Same domain 80%, Adjacent 50%, Different 20%
- Salary growth: 8-12% per promotion, 3-5% annual merit
- Include diverse paths and non-linear progressions`
});
return result;
}
/**
* Generate workforce diversity metrics
* Models representation, inclusion, and equity indicators
*/
export async function generateDiversityMetrics() {
const synth = createSynth({
provider: 'gemini'
});
const diversitySchema = {
reportingPeriod: { type: 'string', required: true },
organizationLevel: {
type: 'string',
required: true,
enum: ['company', 'division', 'department', 'team']
},
entityName: { type: 'string', required: true },
headcount: { type: 'number', required: true },
demographics: {
type: 'object',
required: true,
properties: {
gender: {
type: 'object',
properties: {
women: { type: 'number' }, // percentage
men: { type: 'number' },
nonBinary: { type: 'number' },
undisclosed: { type: 'number' }
}
},
ethnicity: {
type: 'object',
properties: {
asian: { type: 'number' },
black: { type: 'number' },
hispanic: { type: 'number' },
white: { type: 'number' },
multiracial: { type: 'number' },
other: { type: 'number' },
undisclosed: { type: 'number' }
}
},
age: {
type: 'object',
properties: {
under30: { type: 'number' },
age30to40: { type: 'number' },
age40to50: { type: 'number' },
over50: { type: 'number' }
}
}
}
},
representation: {
type: 'object',
required: true,
properties: {
leadership: {
type: 'object',
properties: {
women: { type: 'number' },
minorities: { type: 'number' }
}
},
technical: {
type: 'object',
properties: {
women: { type: 'number' },
minorities: { type: 'number' }
}
},
hiring: {
type: 'object',
properties: {
women: { type: 'number' },
minorities: { type: 'number' }
}
},
promotions: {
type: 'object',
properties: {
women: { type: 'number' },
minorities: { type: 'number' }
}
}
}
},
inclusionMetrics: {
type: 'object',
required: true,
properties: {
belongingScore: { type: 'number', min: 0, max: 100 },
psychologicalSafety: { type: 'number', min: 0, max: 100 },
fairTreatment: { type: 'number', min: 0, max: 100 },
voiceHeard: { type: 'number', min: 0, max: 100 }
}
},
trends: {
type: 'object',
required: true,
properties: {
direction: { type: 'string', enum: ['improving', 'stable', 'declining'] },
yearOverYearChange: { type: 'number' } // percentage points
}
},
goals: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
metric: { type: 'string' },
current: { type: 'number' },
target: { type: 'number' },
deadline: { type: 'string' }
}
}
}
};
const result = await synth.generateStructured({
count: 60,
schema: diversitySchema,
format: 'json',
context: `Generate diversity metrics (based on tech industry benchmarks):
- Overall women: 25-35% (improving +1-2% annually)
- Technical women: 20-30%
- Leadership women: 25-40%
- Underrepresented minorities: 15-25%
- Age distribution: 40% under 30, 35% 30-40, 20% 40-50, 5% over 50
- Hiring: Should meet or exceed current representation
- Promotions: Within ±3% of representation (equity indicator)
- Inclusion scores: 70-85 range, correlates with diversity
- Belonging: Higher in diverse teams (+10-15 points)
- Pipeline challenge: Narrowing at senior levels
- Goals: 40% women in tech by 2025 (aspirational)
- Include intersectional data where appropriate`
});
return result;
}
/**
* Run all workforce planning examples
*/
export async function runAllWorkforcePlanningExamples() {
console.log('=== Workforce Planning Simulation Examples ===\n');
console.log('1. Generating Hiring Forecasts...');
const hiring = await generateHiringForecast();
console.log(`Generated ${hiring.data.length} hiring forecast records`);
console.log('Sample:', JSON.stringify(hiring.data[0], null, 2));
console.log('\n2. Generating Skill Gap Analysis...');
const skills = await generateSkillGapAnalysis();
console.log(`Generated ${skills.data.length} skill gap records`);
console.log('Sample:', JSON.stringify(skills.data[0], null, 2));
console.log('\n3. Generating Turnover Predictions...');
const turnover = await generateTurnoverPredictions();
console.log(`Generated ${turnover.data.length} turnover prediction records`);
console.log('Sample:', JSON.stringify(turnover.data[0], null, 2));
console.log('\n4. Generating Compensation Analysis...');
const compensation = await generateCompensationAnalysis();
console.log(`Generated ${compensation.data.length} compensation analysis records`);
console.log('Sample:', JSON.stringify(compensation.data[0], null, 2));
console.log('\n5. Generating Career Paths...');
const careers = await generateCareerPaths();
console.log(`Generated ${careers.data.length} career path records`);
console.log('Sample:', JSON.stringify(careers.data[0], null, 2));
console.log('\n6. Generating Diversity Metrics...');
const diversity = await generateDiversityMetrics();
console.log(`Generated ${diversity.data.length} diversity metric records`);
console.log('Sample:', JSON.stringify(diversity.data[0], null, 2));
}
// Uncomment to run
// runAllWorkforcePlanningExamples().catch(console.error);

View File

@@ -0,0 +1,49 @@
/**
* Workplace Events Simulation
*
* Generates realistic workplace events including onboarding, offboarding, promotions,
* performance reviews, training, team building, and conflict resolution scenarios.
*
* RESPONSIBLE USE: These simulations are for HR system testing and process optimization.
* Handle sensitive event data with appropriate privacy and security measures.
*/
/**
* Generate employee onboarding events
* Models the new hire journey and integration process
*/
export declare function generateOnboardingEvents(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate employee offboarding events
* Models departure process and exit analytics
*/
export declare function generateOffboardingEvents(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate promotion and transfer events
* Models career advancement and internal mobility
*/
export declare function generatePromotionEvents(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate performance review events
* Models the review cycle and feedback process
*/
export declare function generatePerformanceReviewEvents(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate training and development events
* Models learning activities and skill-building programs
*/
export declare function generateTrainingEvents(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate team building activity events
* Models team cohesion and morale activities
*/
export declare function generateTeamBuildingEvents(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Generate conflict resolution events
* Models workplace conflicts and resolution processes
*/
export declare function generateConflictResolutionEvents(): Promise<import("../../src/types.js").GenerationResult<unknown>>;
/**
* Run all workplace event examples
*/
export declare function runAllWorkplaceEventExamples(): Promise<void>;
//# sourceMappingURL=workplace-events.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"workplace-events.d.ts","sourceRoot":"","sources":["workplace-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;GAGG;AACH,wBAAsB,wBAAwB,oEAoG7C;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,oEAqF9C;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,oEA4F5C;AAED;;;GAGG;AACH,wBAAsB,+BAA+B,oEA8FpD;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,oEA0G3C;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,oEAwF/C;AAED;;;GAGG;AACH,wBAAsB,gCAAgC,oEAmGrD;AAED;;GAEG;AACH,wBAAsB,4BAA4B,kBAqCjD"}

View File

@@ -0,0 +1,735 @@
"use strict";
/**
* Workplace Events Simulation
*
* Generates realistic workplace events including onboarding, offboarding, promotions,
* performance reviews, training, team building, and conflict resolution scenarios.
*
* RESPONSIBLE USE: These simulations are for HR system testing and process optimization.
* Handle sensitive event data with appropriate privacy and security measures.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateOnboardingEvents = generateOnboardingEvents;
exports.generateOffboardingEvents = generateOffboardingEvents;
exports.generatePromotionEvents = generatePromotionEvents;
exports.generatePerformanceReviewEvents = generatePerformanceReviewEvents;
exports.generateTrainingEvents = generateTrainingEvents;
exports.generateTeamBuildingEvents = generateTeamBuildingEvents;
exports.generateConflictResolutionEvents = generateConflictResolutionEvents;
exports.runAllWorkplaceEventExamples = runAllWorkplaceEventExamples;
const index_js_1 = require("../../src/index.js");
/**
* Generate employee onboarding events
* Models the new hire journey and integration process
*/
async function generateOnboardingEvents() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const onboardingSchema = {
eventId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
startDate: { type: 'string', required: true },
role: { type: 'string', required: true },
department: { type: 'string', required: true },
workMode: {
type: 'string',
required: true,
enum: ['onsite', 'remote', 'hybrid']
},
onboardingPlan: {
type: 'object',
required: true,
properties: {
duration: { type: 'number' }, // days
checkpoints: {
type: 'array',
items: {
type: 'object',
properties: {
day: { type: 'number' },
milestone: { type: 'string' },
completed: { type: 'boolean' }
}
}
}
}
},
assignments: {
type: 'object',
required: true,
properties: {
buddy: { type: 'string' },
mentor: { type: 'string' },
manager: { type: 'string' },
team: { type: 'string' }
}
},
progress: {
type: 'object',
required: true,
properties: {
completionRate: { type: 'number' }, // percentage
firstWeekEngagement: { type: 'number' }, // 1-10
firstMonthPerformance: { type: 'number' }, // 1-10
buddyMeetings: { type: 'number' },
trainingCompleted: { type: 'number' }
}
},
feedback: {
type: 'object',
required: true,
properties: {
onboardingExperience: { type: 'number', min: 1, max: 5 },
clarityOfExpectations: { type: 'number', min: 1, max: 5 },
toolsReadiness: { type: 'number', min: 1, max: 5 },
teamWelcome: { type: 'number', min: 1, max: 5 }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
timeToProductivity: { type: 'number' }, // days
retainedAfter90Days: { type: 'boolean' },
retainedAfter1Year: { type: 'boolean' }
}
}
};
const result = await synth.generateEvents({
count: 200,
eventTypes: ['onboarding_start', 'day_1', 'week_1', 'month_1', 'day_90'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000), // 1 year
end: new Date()
},
context: `Generate onboarding events:
- Onboarding duration: 30-90 days (60 typical)
- Completion rate: 85% complete all milestones
- Time to productivity: Junior 60-90 days, Senior 30-45 days
- First week critical: High engagement predicts retention (+30%)
- Buddy program: 4-8 meetings in first month
- Remote onboarding: Requires more check-ins (+50%)
- 90-day retention: 92%
- 1-year retention: 78%
- Satisfaction: mean 4.2/5
- Common issues: Tools setup (20%), unclear expectations (15%)
- Include both smooth and challenging onboardings`
});
return result;
}
/**
* Generate employee offboarding events
* Models departure process and exit analytics
*/
async function generateOffboardingEvents() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const offboardingSchema = {
eventId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
lastDay: { type: 'string', required: true },
tenure: { type: 'number', required: true }, // years
role: { type: 'string', required: true },
department: { type: 'string', required: true },
separationType: {
type: 'string',
required: true,
enum: ['voluntary', 'involuntary', 'retirement', 'contract_end', 'relocation']
},
reason: {
type: 'string',
required: true,
enum: ['better_opportunity', 'compensation', 'career_growth', 'management', 'culture', 'work_life_balance', 'performance', 'restructuring', 'personal']
},
exitInterview: {
type: 'object',
required: true,
properties: {
completed: { type: 'boolean' },
overallSatisfaction: { type: 'number', min: 1, max: 5 },
wouldRecommend: { type: 'boolean' },
wouldReturn: { type: 'boolean' },
managerRating: { type: 'number', min: 1, max: 5 },
topPositive: { type: 'string' },
topImprovement: { type: 'string' }
}
},
notice: {
type: 'object',
required: true,
properties: {
givenDays: { type: 'number' },
standardDays: { type: 'number' },
counteroffer: { type: 'boolean' },
counterofferAccepted: { type: 'boolean' }
}
},
transition: {
type: 'object',
required: true,
properties: {
knowledgeTransfer: { type: 'number', min: 0, max: 100 }, // percentage
documentationComplete: { type: 'boolean' },
backfillIdentified: { type: 'boolean' },
teamImpact: { type: 'string', enum: ['minimal', 'moderate', 'significant', 'severe'] }
}
},
rehireEligibility: {
type: 'string',
required: true,
enum: ['yes', 'no', 'conditional']
}
};
const result = await synth.generateEvents({
count: 150,
eventTypes: ['resignation', 'termination', 'retirement', 'last_day'],
distribution: 'poisson',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate offboarding events:
- Voluntary: 75%, Involuntary: 20%, Retirement: 3%, Other: 2%
- Top reasons: Better opportunity (35%), compensation (25%), growth (20%), management (10%)
- Notice period: 2 weeks standard, 4 weeks for senior
- Counteroffer: Made for 30%, accepted 40% of those
- Exit interview completion: 65%
- Would recommend: 60% (high correlation with reason)
- Would return: 45% (boomerang candidates)
- Knowledge transfer: 70% complete average
- Tenure patterns: Peak at 1-2 years and 5-7 years
- Q1 spike: 25% higher than average
- Rehire eligible: 85% of voluntary departures`
});
return result;
}
/**
* Generate promotion and transfer events
* Models career advancement and internal mobility
*/
async function generatePromotionEvents() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const promotionSchema = {
eventId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
effectiveDate: { type: 'string', required: true },
eventType: {
type: 'string',
required: true,
enum: ['promotion', 'lateral_move', 'department_transfer', 'location_transfer']
},
from: {
type: 'object',
required: true,
properties: {
title: { type: 'string' },
level: { type: 'string' },
department: { type: 'string' },
salary: { type: 'number' }
}
},
to: {
type: 'object',
required: true,
properties: {
title: { type: 'string' },
level: { type: 'string' },
department: { type: 'string' },
salary: { type: 'number' }
}
},
tenureBeforeChange: { type: 'number', required: true }, // years
justification: {
type: 'array',
required: true,
items: { type: 'string' }
},
salaryChange: {
type: 'object',
required: true,
properties: {
amount: { type: 'number' },
percentage: { type: 'number' }
}
},
competitionConsidered: { type: 'number', required: true },
readinessAssessment: {
type: 'object',
required: true,
properties: {
score: { type: 'number', min: 0, max: 100 },
gapsClosed: { type: 'boolean' },
supportRequired: { type: 'boolean' }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
successful: { type: 'boolean' },
performanceAfter3Months: { type: 'number', min: 1, max: 5 },
performanceAfter6Months: { type: 'number', min: 1, max: 5 }
}
}
};
const result = await synth.generateEvents({
count: 180,
eventTypes: ['promotion', 'lateral_move', 'transfer'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate promotion/transfer events:
- Promotions: 60%, Lateral: 25%, Transfers: 15%
- Promotion rate: 15% of workforce annually
- Tenure before promotion: 2-4 years average
- Salary increase: Promotion 10-20%, Lateral 0-5%, Transfer varies
- Readiness: 80% meet criteria, 15% stretch assignments
- Competition: 2-5 candidates per role
- Success rate: 85% meet expectations in new role
- Performance dip in first 3 months (learning curve)
- Recovery by 6 months (90% at or above baseline)
- Year-end cycle: 70% of promotions
- Include diversity in advancement opportunities`
});
return result;
}
/**
* Generate performance review events
* Models the review cycle and feedback process
*/
async function generatePerformanceReviewEvents() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const reviewSchema = {
eventId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
reviewDate: { type: 'string', required: true },
reviewType: {
type: 'string',
required: true,
enum: ['annual', 'mid_year', 'quarterly', 'probation', 'pip']
},
reviewPeriod: { type: 'string', required: true },
process: {
type: 'object',
required: true,
properties: {
selfReviewComplete: { type: 'boolean' },
peerReviewsComplete: { type: 'number' }, // count
managerReviewComplete: { type: 'boolean' },
calibrationDone: { type: 'boolean' },
employeeMeetingDone: { type: 'boolean' }
}
},
ratings: {
type: 'object',
required: true,
properties: {
overall: { type: 'string', enum: ['exceeds', 'meets', 'developing', 'unsatisfactory'] },
selfRating: { type: 'string' },
managerRating: { type: 'string' },
calibratedRating: { type: 'string' }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
meritIncrease: { type: 'number' }, // percentage
bonus: { type: 'number' }, // dollars
equity: { type: 'number' }, // shares/units
promotionRecommended: { type: 'boolean' },
developmentPlan: { type: 'boolean' }
}
},
goalsForNextPeriod: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
goal: { type: 'string' },
measureable: { type: 'boolean' },
timeline: { type: 'string' }
}
}
},
employeeSatisfaction: {
type: 'object',
required: true,
properties: {
processFairness: { type: 'number', min: 1, max: 5 },
ratingAgreement: { type: 'boolean' },
feedbackQuality: { type: 'number', min: 1, max: 5 },
goalClarity: { type: 'number', min: 1, max: 5 }
}
}
};
const result = await synth.generateEvents({
count: 400,
eventTypes: ['annual_review', 'mid_year_review', 'quarterly_check_in'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate performance review events:
- Annual reviews: All employees once per year
- Mid-year: 70% of organizations
- Quarterly: 40% of organizations (check-ins)
- Completion: Self 95%, Manager 98%, Peers 85%
- Rating distribution: Exceeds 15%, Meets 70%, Developing 12%, Unsatisfactory 3%
- Self vs manager: 60% match, 30% self higher, 10% manager higher
- Calibration adjusts 25% of initial ratings
- Merit increase: Exceeds 4-6%, Meets 2-4%, Developing 0-2%
- Employee satisfaction: Mean 3.8/5 for process
- Agreement with rating: 75%
- Include review anxiety and bias patterns`
});
return result;
}
/**
* Generate training and development events
* Models learning activities and skill-building programs
*/
async function generateTrainingEvents() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const trainingSchema = {
eventId: { type: 'string', required: true },
eventName: { type: 'string', required: true },
eventType: {
type: 'string',
required: true,
enum: ['workshop', 'course', 'conference', 'certification', 'lunch_learn', 'hackathon', 'bootcamp']
},
date: { type: 'string', required: true },
duration: { type: 'number', required: true }, // hours
delivery: {
type: 'string',
required: true,
enum: ['in_person', 'virtual', 'hybrid', 'self_paced']
},
topic: {
type: 'string',
required: true,
enum: ['technical', 'leadership', 'soft_skills', 'compliance', 'product', 'industry', 'wellness']
},
participants: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
registered: { type: 'boolean' },
attended: { type: 'boolean' },
completed: { type: 'boolean' },
assessmentScore: { type: 'number' }
}
}
},
metrics: {
type: 'object',
required: true,
properties: {
capacity: { type: 'number' },
registered: { type: 'number' },
attended: { type: 'number' },
completed: { type: 'number' },
attendanceRate: { type: 'number' },
completionRate: { type: 'number' }
}
},
feedback: {
type: 'object',
required: true,
properties: {
relevance: { type: 'number', min: 1, max: 5 },
quality: { type: 'number', min: 1, max: 5 },
applicability: { type: 'number', min: 1, max: 5 },
wouldRecommend: { type: 'number' } // percentage
}
},
cost: {
type: 'object',
required: true,
properties: {
perParticipant: { type: 'number' },
total: { type: 'number' }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
skillsGained: {
type: 'array',
items: { type: 'string' }
},
applied: { type: 'number' }, // percentage who applied learning
impactRating: { type: 'number', min: 1, max: 5 }
}
}
};
const result = await synth.generateEvents({
count: 250,
eventTypes: ['workshop', 'course', 'conference', 'certification', 'lunch_learn'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate training events:
- Frequency: 2-4 events per month
- Duration: Workshops 2-4h, Courses 8-40h, Conferences 16-24h
- Attendance rate: 85% (virtual), 75% (in-person)
- Completion rate: 70% overall
- Technical training: Highest demand, 4.3/5 rating
- Compliance: Mandatory, 95% completion, 3.8/5 rating
- Leadership: 4.5/5 rating, high impact
- Lunch & learns: 30-60 mins, 65% attendance
- Application rate: 55% apply learning within 3 months
- Cost: $50-$500 per person (external), $0-$100 (internal)
- Include seasonal patterns (Q1 high, Q4 low)`
});
return result;
}
/**
* Generate team building activity events
* Models team cohesion and morale activities
*/
async function generateTeamBuildingEvents() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const teamBuildingSchema = {
eventId: { type: 'string', required: true },
eventName: { type: 'string', required: true },
activityType: {
type: 'string',
required: true,
enum: ['social', 'volunteer', 'offsite', 'workshop', 'competition', 'celebration', 'retreat']
},
date: { type: 'string', required: true },
duration: { type: 'number', required: true }, // hours
teamId: { type: 'string', required: true },
scope: {
type: 'string',
required: true,
enum: ['team', 'department', 'division', 'company']
},
participation: {
type: 'object',
required: true,
properties: {
invited: { type: 'number' },
attended: { type: 'number' },
rate: { type: 'number' } // percentage
}
},
objectives: {
type: 'array',
required: true,
items: {
type: 'string',
enum: ['bonding', 'trust', 'communication', 'collaboration', 'morale', 'recognition', 'fun']
}
},
outcomes: {
type: 'object',
required: true,
properties: {
enjoyment: { type: 'number', min: 1, max: 5 },
worthwhile: { type: 'number', min: 1, max: 5 },
teamCohesion: { type: 'number' }, // change score
moraleImpact: { type: 'string', enum: ['positive', 'neutral', 'negative'] }
}
},
cost: {
type: 'object',
required: true,
properties: {
budget: { type: 'number' },
perPerson: { type: 'number' }
}
},
timing: {
type: 'object',
required: true,
properties: {
duringWorkHours: { type: 'boolean' },
optional: { type: 'boolean' }
}
}
};
const result = await synth.generateEvents({
count: 100,
eventTypes: ['social', 'volunteer', 'offsite', 'celebration'],
distribution: 'poisson',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate team building events:
- Frequency: 1 per quarter per team (minimum)
- Popular: Happy hours, volunteer days, offsites, game nights
- Participation: During work hours 85%, After hours 55%
- Enjoyment: Mean 4.0/5
- Worthwhile: Mean 3.8/5 (lower for mandatory fun)
- Budget: $25-$75 per person for social, $500-$2000 for offsites
- Remote teams: Virtual events 40% participation
- Morale impact: 80% positive, 15% neutral, 5% negative
- Best timing: Mid-quarter, avoid month-end
- Include variety: Some prefer low-key, others adventure`
});
return result;
}
/**
* Generate conflict resolution events
* Models workplace conflicts and resolution processes
*/
async function generateConflictResolutionEvents() {
const synth = (0, index_js_1.createSynth)({
provider: 'gemini'
});
const conflictSchema = {
eventId: { type: 'string', required: true },
reportDate: { type: 'string', required: true },
conflictType: {
type: 'string',
required: true,
enum: ['interpersonal', 'performance', 'harassment', 'discrimination', 'policy', 'resource', 'communication']
},
severity: {
type: 'string',
required: true,
enum: ['low', 'medium', 'high', 'critical']
},
partiesInvolved: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
role: { type: 'string', enum: ['reporter', 'respondent', 'witness', 'affected'] }
}
}
},
reportedBy: {
type: 'string',
required: true,
enum: ['employee', 'manager', 'peer', 'hr', 'anonymous']
},
investigation: {
type: 'object',
required: true,
properties: {
required: { type: 'boolean' },
duration: { type: 'number' }, // days
interviewsConducted: { type: 'number' },
finding: { type: 'string', enum: ['substantiated', 'unsubstantiated', 'partially_substantiated', 'inconclusive'] }
}
},
resolution: {
type: 'object',
required: true,
properties: {
approach: {
type: 'string',
enum: ['mediation', 'coaching', 'training', 'policy_clarification', 'disciplinary', 'separation', 'team_restructure']
},
timeToResolve: { type: 'number' }, // days
outcome: { type: 'string', enum: ['resolved', 'improved', 'ongoing', 'escalated'] }
}
},
followUp: {
type: 'object',
required: true,
properties: {
required: { type: 'boolean' },
checkIns: { type: 'number' },
recurrence: { type: 'boolean' }
}
},
impact: {
type: 'object',
required: true,
properties: {
teamMoraleAffected: { type: 'boolean' },
productivityImpact: { type: 'number' }, // percentage
turnoverResult: { type: 'boolean' }
}
}
};
const result = await synth.generateEvents({
count: 80,
eventTypes: ['conflict_report', 'investigation', 'mediation', 'resolution'],
distribution: 'poisson',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate conflict resolution events:
- Rate: 5-10% of workforce involved annually
- Types: Interpersonal 40%, Performance 25%, Communication 20%, Policy 10%, Others 5%
- Severity: Low 50%, Medium 35%, High 12%, Critical 3%
- Investigation: Required for 30% of cases
- Time to resolve: Low 5-10 days, Medium 10-20 days, High 20-60 days
- Approaches: Mediation 40%, Coaching 30%, Training 15%, Other 15%
- Outcomes: Resolved 60%, Improved 25%, Ongoing 10%, Escalated 5%
- Recurrence: 15% have follow-up issues
- Turnover: 20% result in departure within 6 months
- Early intervention: 75% success rate
- Include sensitive handling and confidentiality`
});
return result;
}
/**
* Run all workplace event examples
*/
async function runAllWorkplaceEventExamples() {
console.log('=== Workplace Events Simulation Examples ===\n');
console.log('1. Generating Onboarding Events...');
const onboarding = await generateOnboardingEvents();
console.log(`Generated ${onboarding.data.length} onboarding event records`);
console.log('Sample:', JSON.stringify(onboarding.data[0], null, 2));
console.log('\n2. Generating Offboarding Events...');
const offboarding = await generateOffboardingEvents();
console.log(`Generated ${offboarding.data.length} offboarding event records`);
console.log('Sample:', JSON.stringify(offboarding.data[0], null, 2));
console.log('\n3. Generating Promotion Events...');
const promotions = await generatePromotionEvents();
console.log(`Generated ${promotions.data.length} promotion event records`);
console.log('Sample:', JSON.stringify(promotions.data[0], null, 2));
console.log('\n4. Generating Performance Review Events...');
const reviews = await generatePerformanceReviewEvents();
console.log(`Generated ${reviews.data.length} review event records`);
console.log('Sample:', JSON.stringify(reviews.data[0], null, 2));
console.log('\n5. Generating Training Events...');
const training = await generateTrainingEvents();
console.log(`Generated ${training.data.length} training event records`);
console.log('Sample:', JSON.stringify(training.data[0], null, 2));
console.log('\n6. Generating Team Building Events...');
const teamBuilding = await generateTeamBuildingEvents();
console.log(`Generated ${teamBuilding.data.length} team building event records`);
console.log('Sample:', JSON.stringify(teamBuilding.data[0], null, 2));
console.log('\n7. Generating Conflict Resolution Events...');
const conflicts = await generateConflictResolutionEvents();
console.log(`Generated ${conflicts.data.length} conflict resolution event records`);
console.log('Sample:', JSON.stringify(conflicts.data[0], null, 2));
}
// Uncomment to run
// runAllWorkplaceEventExamples().catch(console.error);
//# sourceMappingURL=workplace-events.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,762 @@
/**
* Workplace Events Simulation
*
* Generates realistic workplace events including onboarding, offboarding, promotions,
* performance reviews, training, team building, and conflict resolution scenarios.
*
* RESPONSIBLE USE: These simulations are for HR system testing and process optimization.
* Handle sensitive event data with appropriate privacy and security measures.
*/
import { createSynth } from '../../src/index.js';
/**
* Generate employee onboarding events
* Models the new hire journey and integration process
*/
export async function generateOnboardingEvents() {
const synth = createSynth({
provider: 'gemini',
apiKey: process.env.GEMINI_API_KEY
});
const onboardingSchema = {
eventId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
startDate: { type: 'string', required: true },
role: { type: 'string', required: true },
department: { type: 'string', required: true },
workMode: {
type: 'string',
required: true,
enum: ['onsite', 'remote', 'hybrid']
},
onboardingPlan: {
type: 'object',
required: true,
properties: {
duration: { type: 'number' }, // days
checkpoints: {
type: 'array',
items: {
type: 'object',
properties: {
day: { type: 'number' },
milestone: { type: 'string' },
completed: { type: 'boolean' }
}
}
}
}
},
assignments: {
type: 'object',
required: true,
properties: {
buddy: { type: 'string' },
mentor: { type: 'string' },
manager: { type: 'string' },
team: { type: 'string' }
}
},
progress: {
type: 'object',
required: true,
properties: {
completionRate: { type: 'number' }, // percentage
firstWeekEngagement: { type: 'number' }, // 1-10
firstMonthPerformance: { type: 'number' }, // 1-10
buddyMeetings: { type: 'number' },
trainingCompleted: { type: 'number' }
}
},
feedback: {
type: 'object',
required: true,
properties: {
onboardingExperience: { type: 'number', min: 1, max: 5 },
clarityOfExpectations: { type: 'number', min: 1, max: 5 },
toolsReadiness: { type: 'number', min: 1, max: 5 },
teamWelcome: { type: 'number', min: 1, max: 5 }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
timeToProductivity: { type: 'number' }, // days
retainedAfter90Days: { type: 'boolean' },
retainedAfter1Year: { type: 'boolean' }
}
}
};
const result = await synth.generateEvents({
count: 200,
eventTypes: ['onboarding_start', 'day_1', 'week_1', 'month_1', 'day_90'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000), // 1 year
end: new Date()
},
context: `Generate onboarding events:
- Onboarding duration: 30-90 days (60 typical)
- Completion rate: 85% complete all milestones
- Time to productivity: Junior 60-90 days, Senior 30-45 days
- First week critical: High engagement predicts retention (+30%)
- Buddy program: 4-8 meetings in first month
- Remote onboarding: Requires more check-ins (+50%)
- 90-day retention: 92%
- 1-year retention: 78%
- Satisfaction: mean 4.2/5
- Common issues: Tools setup (20%), unclear expectations (15%)
- Include both smooth and challenging onboardings`
});
return result;
}
/**
* Generate employee offboarding events
* Models departure process and exit analytics
*/
export async function generateOffboardingEvents() {
const synth = createSynth({
provider: 'gemini'
});
const offboardingSchema = {
eventId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
lastDay: { type: 'string', required: true },
tenure: { type: 'number', required: true }, // years
role: { type: 'string', required: true },
department: { type: 'string', required: true },
separationType: {
type: 'string',
required: true,
enum: ['voluntary', 'involuntary', 'retirement', 'contract_end', 'relocation']
},
reason: {
type: 'string',
required: true,
enum: ['better_opportunity', 'compensation', 'career_growth', 'management', 'culture', 'work_life_balance', 'performance', 'restructuring', 'personal']
},
exitInterview: {
type: 'object',
required: true,
properties: {
completed: { type: 'boolean' },
overallSatisfaction: { type: 'number', min: 1, max: 5 },
wouldRecommend: { type: 'boolean' },
wouldReturn: { type: 'boolean' },
managerRating: { type: 'number', min: 1, max: 5 },
topPositive: { type: 'string' },
topImprovement: { type: 'string' }
}
},
notice: {
type: 'object',
required: true,
properties: {
givenDays: { type: 'number' },
standardDays: { type: 'number' },
counteroffer: { type: 'boolean' },
counterofferAccepted: { type: 'boolean' }
}
},
transition: {
type: 'object',
required: true,
properties: {
knowledgeTransfer: { type: 'number', min: 0, max: 100 }, // percentage
documentationComplete: { type: 'boolean' },
backfillIdentified: { type: 'boolean' },
teamImpact: { type: 'string', enum: ['minimal', 'moderate', 'significant', 'severe'] }
}
},
rehireEligibility: {
type: 'string',
required: true,
enum: ['yes', 'no', 'conditional']
}
};
const result = await synth.generateEvents({
count: 150,
eventTypes: ['resignation', 'termination', 'retirement', 'last_day'],
distribution: 'poisson',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate offboarding events:
- Voluntary: 75%, Involuntary: 20%, Retirement: 3%, Other: 2%
- Top reasons: Better opportunity (35%), compensation (25%), growth (20%), management (10%)
- Notice period: 2 weeks standard, 4 weeks for senior
- Counteroffer: Made for 30%, accepted 40% of those
- Exit interview completion: 65%
- Would recommend: 60% (high correlation with reason)
- Would return: 45% (boomerang candidates)
- Knowledge transfer: 70% complete average
- Tenure patterns: Peak at 1-2 years and 5-7 years
- Q1 spike: 25% higher than average
- Rehire eligible: 85% of voluntary departures`
});
return result;
}
/**
* Generate promotion and transfer events
* Models career advancement and internal mobility
*/
export async function generatePromotionEvents() {
const synth = createSynth({
provider: 'gemini'
});
const promotionSchema = {
eventId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
effectiveDate: { type: 'string', required: true },
eventType: {
type: 'string',
required: true,
enum: ['promotion', 'lateral_move', 'department_transfer', 'location_transfer']
},
from: {
type: 'object',
required: true,
properties: {
title: { type: 'string' },
level: { type: 'string' },
department: { type: 'string' },
salary: { type: 'number' }
}
},
to: {
type: 'object',
required: true,
properties: {
title: { type: 'string' },
level: { type: 'string' },
department: { type: 'string' },
salary: { type: 'number' }
}
},
tenureBeforeChange: { type: 'number', required: true }, // years
justification: {
type: 'array',
required: true,
items: { type: 'string' }
},
salaryChange: {
type: 'object',
required: true,
properties: {
amount: { type: 'number' },
percentage: { type: 'number' }
}
},
competitionConsidered: { type: 'number', required: true },
readinessAssessment: {
type: 'object',
required: true,
properties: {
score: { type: 'number', min: 0, max: 100 },
gapsClosed: { type: 'boolean' },
supportRequired: { type: 'boolean' }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
successful: { type: 'boolean' },
performanceAfter3Months: { type: 'number', min: 1, max: 5 },
performanceAfter6Months: { type: 'number', min: 1, max: 5 }
}
}
};
const result = await synth.generateEvents({
count: 180,
eventTypes: ['promotion', 'lateral_move', 'transfer'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate promotion/transfer events:
- Promotions: 60%, Lateral: 25%, Transfers: 15%
- Promotion rate: 15% of workforce annually
- Tenure before promotion: 2-4 years average
- Salary increase: Promotion 10-20%, Lateral 0-5%, Transfer varies
- Readiness: 80% meet criteria, 15% stretch assignments
- Competition: 2-5 candidates per role
- Success rate: 85% meet expectations in new role
- Performance dip in first 3 months (learning curve)
- Recovery by 6 months (90% at or above baseline)
- Year-end cycle: 70% of promotions
- Include diversity in advancement opportunities`
});
return result;
}
/**
* Generate performance review events
* Models the review cycle and feedback process
*/
export async function generatePerformanceReviewEvents() {
const synth = createSynth({
provider: 'gemini'
});
const reviewSchema = {
eventId: { type: 'string', required: true },
employeeId: { type: 'string', required: true },
reviewDate: { type: 'string', required: true },
reviewType: {
type: 'string',
required: true,
enum: ['annual', 'mid_year', 'quarterly', 'probation', 'pip']
},
reviewPeriod: { type: 'string', required: true },
process: {
type: 'object',
required: true,
properties: {
selfReviewComplete: { type: 'boolean' },
peerReviewsComplete: { type: 'number' }, // count
managerReviewComplete: { type: 'boolean' },
calibrationDone: { type: 'boolean' },
employeeMeetingDone: { type: 'boolean' }
}
},
ratings: {
type: 'object',
required: true,
properties: {
overall: { type: 'string', enum: ['exceeds', 'meets', 'developing', 'unsatisfactory'] },
selfRating: { type: 'string' },
managerRating: { type: 'string' },
calibratedRating: { type: 'string' }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
meritIncrease: { type: 'number' }, // percentage
bonus: { type: 'number' }, // dollars
equity: { type: 'number' }, // shares/units
promotionRecommended: { type: 'boolean' },
developmentPlan: { type: 'boolean' }
}
},
goalsForNextPeriod: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
goal: { type: 'string' },
measureable: { type: 'boolean' },
timeline: { type: 'string' }
}
}
},
employeeSatisfaction: {
type: 'object',
required: true,
properties: {
processFairness: { type: 'number', min: 1, max: 5 },
ratingAgreement: { type: 'boolean' },
feedbackQuality: { type: 'number', min: 1, max: 5 },
goalClarity: { type: 'number', min: 1, max: 5 }
}
}
};
const result = await synth.generateEvents({
count: 400,
eventTypes: ['annual_review', 'mid_year_review', 'quarterly_check_in'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate performance review events:
- Annual reviews: All employees once per year
- Mid-year: 70% of organizations
- Quarterly: 40% of organizations (check-ins)
- Completion: Self 95%, Manager 98%, Peers 85%
- Rating distribution: Exceeds 15%, Meets 70%, Developing 12%, Unsatisfactory 3%
- Self vs manager: 60% match, 30% self higher, 10% manager higher
- Calibration adjusts 25% of initial ratings
- Merit increase: Exceeds 4-6%, Meets 2-4%, Developing 0-2%
- Employee satisfaction: Mean 3.8/5 for process
- Agreement with rating: 75%
- Include review anxiety and bias patterns`
});
return result;
}
/**
* Generate training and development events
* Models learning activities and skill-building programs
*/
export async function generateTrainingEvents() {
const synth = createSynth({
provider: 'gemini'
});
const trainingSchema = {
eventId: { type: 'string', required: true },
eventName: { type: 'string', required: true },
eventType: {
type: 'string',
required: true,
enum: ['workshop', 'course', 'conference', 'certification', 'lunch_learn', 'hackathon', 'bootcamp']
},
date: { type: 'string', required: true },
duration: { type: 'number', required: true }, // hours
delivery: {
type: 'string',
required: true,
enum: ['in_person', 'virtual', 'hybrid', 'self_paced']
},
topic: {
type: 'string',
required: true,
enum: ['technical', 'leadership', 'soft_skills', 'compliance', 'product', 'industry', 'wellness']
},
participants: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
registered: { type: 'boolean' },
attended: { type: 'boolean' },
completed: { type: 'boolean' },
assessmentScore: { type: 'number' }
}
}
},
metrics: {
type: 'object',
required: true,
properties: {
capacity: { type: 'number' },
registered: { type: 'number' },
attended: { type: 'number' },
completed: { type: 'number' },
attendanceRate: { type: 'number' },
completionRate: { type: 'number' }
}
},
feedback: {
type: 'object',
required: true,
properties: {
relevance: { type: 'number', min: 1, max: 5 },
quality: { type: 'number', min: 1, max: 5 },
applicability: { type: 'number', min: 1, max: 5 },
wouldRecommend: { type: 'number' } // percentage
}
},
cost: {
type: 'object',
required: true,
properties: {
perParticipant: { type: 'number' },
total: { type: 'number' }
}
},
outcomes: {
type: 'object',
required: true,
properties: {
skillsGained: {
type: 'array',
items: { type: 'string' }
},
applied: { type: 'number' }, // percentage who applied learning
impactRating: { type: 'number', min: 1, max: 5 }
}
}
};
const result = await synth.generateEvents({
count: 250,
eventTypes: ['workshop', 'course', 'conference', 'certification', 'lunch_learn'],
distribution: 'normal',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate training events:
- Frequency: 2-4 events per month
- Duration: Workshops 2-4h, Courses 8-40h, Conferences 16-24h
- Attendance rate: 85% (virtual), 75% (in-person)
- Completion rate: 70% overall
- Technical training: Highest demand, 4.3/5 rating
- Compliance: Mandatory, 95% completion, 3.8/5 rating
- Leadership: 4.5/5 rating, high impact
- Lunch & learns: 30-60 mins, 65% attendance
- Application rate: 55% apply learning within 3 months
- Cost: $50-$500 per person (external), $0-$100 (internal)
- Include seasonal patterns (Q1 high, Q4 low)`
});
return result;
}
/**
* Generate team building activity events
* Models team cohesion and morale activities
*/
export async function generateTeamBuildingEvents() {
const synth = createSynth({
provider: 'gemini'
});
const teamBuildingSchema = {
eventId: { type: 'string', required: true },
eventName: { type: 'string', required: true },
activityType: {
type: 'string',
required: true,
enum: ['social', 'volunteer', 'offsite', 'workshop', 'competition', 'celebration', 'retreat']
},
date: { type: 'string', required: true },
duration: { type: 'number', required: true }, // hours
teamId: { type: 'string', required: true },
scope: {
type: 'string',
required: true,
enum: ['team', 'department', 'division', 'company']
},
participation: {
type: 'object',
required: true,
properties: {
invited: { type: 'number' },
attended: { type: 'number' },
rate: { type: 'number' } // percentage
}
},
objectives: {
type: 'array',
required: true,
items: {
type: 'string',
enum: ['bonding', 'trust', 'communication', 'collaboration', 'morale', 'recognition', 'fun']
}
},
outcomes: {
type: 'object',
required: true,
properties: {
enjoyment: { type: 'number', min: 1, max: 5 },
worthwhile: { type: 'number', min: 1, max: 5 },
teamCohesion: { type: 'number' }, // change score
moraleImpact: { type: 'string', enum: ['positive', 'neutral', 'negative'] }
}
},
cost: {
type: 'object',
required: true,
properties: {
budget: { type: 'number' },
perPerson: { type: 'number' }
}
},
timing: {
type: 'object',
required: true,
properties: {
duringWorkHours: { type: 'boolean' },
optional: { type: 'boolean' }
}
}
};
const result = await synth.generateEvents({
count: 100,
eventTypes: ['social', 'volunteer', 'offsite', 'celebration'],
distribution: 'poisson',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate team building events:
- Frequency: 1 per quarter per team (minimum)
- Popular: Happy hours, volunteer days, offsites, game nights
- Participation: During work hours 85%, After hours 55%
- Enjoyment: Mean 4.0/5
- Worthwhile: Mean 3.8/5 (lower for mandatory fun)
- Budget: $25-$75 per person for social, $500-$2000 for offsites
- Remote teams: Virtual events 40% participation
- Morale impact: 80% positive, 15% neutral, 5% negative
- Best timing: Mid-quarter, avoid month-end
- Include variety: Some prefer low-key, others adventure`
});
return result;
}
/**
* Generate conflict resolution events
* Models workplace conflicts and resolution processes
*/
export async function generateConflictResolutionEvents() {
const synth = createSynth({
provider: 'gemini'
});
const conflictSchema = {
eventId: { type: 'string', required: true },
reportDate: { type: 'string', required: true },
conflictType: {
type: 'string',
required: true,
enum: ['interpersonal', 'performance', 'harassment', 'discrimination', 'policy', 'resource', 'communication']
},
severity: {
type: 'string',
required: true,
enum: ['low', 'medium', 'high', 'critical']
},
partiesInvolved: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
employeeId: { type: 'string' },
role: { type: 'string', enum: ['reporter', 'respondent', 'witness', 'affected'] }
}
}
},
reportedBy: {
type: 'string',
required: true,
enum: ['employee', 'manager', 'peer', 'hr', 'anonymous']
},
investigation: {
type: 'object',
required: true,
properties: {
required: { type: 'boolean' },
duration: { type: 'number' }, // days
interviewsConducted: { type: 'number' },
finding: { type: 'string', enum: ['substantiated', 'unsubstantiated', 'partially_substantiated', 'inconclusive'] }
}
},
resolution: {
type: 'object',
required: true,
properties: {
approach: {
type: 'string',
enum: ['mediation', 'coaching', 'training', 'policy_clarification', 'disciplinary', 'separation', 'team_restructure']
},
timeToResolve: { type: 'number' }, // days
outcome: { type: 'string', enum: ['resolved', 'improved', 'ongoing', 'escalated'] }
}
},
followUp: {
type: 'object',
required: true,
properties: {
required: { type: 'boolean' },
checkIns: { type: 'number' },
recurrence: { type: 'boolean' }
}
},
impact: {
type: 'object',
required: true,
properties: {
teamMoraleAffected: { type: 'boolean' },
productivityImpact: { type: 'number' }, // percentage
turnoverResult: { type: 'boolean' }
}
}
};
const result = await synth.generateEvents({
count: 80,
eventTypes: ['conflict_report', 'investigation', 'mediation', 'resolution'],
distribution: 'poisson',
timeRange: {
start: new Date(Date.now() - 365 * 24 * 60 * 60 * 1000),
end: new Date()
},
context: `Generate conflict resolution events:
- Rate: 5-10% of workforce involved annually
- Types: Interpersonal 40%, Performance 25%, Communication 20%, Policy 10%, Others 5%
- Severity: Low 50%, Medium 35%, High 12%, Critical 3%
- Investigation: Required for 30% of cases
- Time to resolve: Low 5-10 days, Medium 10-20 days, High 20-60 days
- Approaches: Mediation 40%, Coaching 30%, Training 15%, Other 15%
- Outcomes: Resolved 60%, Improved 25%, Ongoing 10%, Escalated 5%
- Recurrence: 15% have follow-up issues
- Turnover: 20% result in departure within 6 months
- Early intervention: 75% success rate
- Include sensitive handling and confidentiality`
});
return result;
}
/**
* Run all workplace event examples
*/
export async function runAllWorkplaceEventExamples() {
console.log('=== Workplace Events Simulation Examples ===\n');
console.log('1. Generating Onboarding Events...');
const onboarding = await generateOnboardingEvents();
console.log(`Generated ${onboarding.data.length} onboarding event records`);
console.log('Sample:', JSON.stringify(onboarding.data[0], null, 2));
console.log('\n2. Generating Offboarding Events...');
const offboarding = await generateOffboardingEvents();
console.log(`Generated ${offboarding.data.length} offboarding event records`);
console.log('Sample:', JSON.stringify(offboarding.data[0], null, 2));
console.log('\n3. Generating Promotion Events...');
const promotions = await generatePromotionEvents();
console.log(`Generated ${promotions.data.length} promotion event records`);
console.log('Sample:', JSON.stringify(promotions.data[0], null, 2));
console.log('\n4. Generating Performance Review Events...');
const reviews = await generatePerformanceReviewEvents();
console.log(`Generated ${reviews.data.length} review event records`);
console.log('Sample:', JSON.stringify(reviews.data[0], null, 2));
console.log('\n5. Generating Training Events...');
const training = await generateTrainingEvents();
console.log(`Generated ${training.data.length} training event records`);
console.log('Sample:', JSON.stringify(training.data[0], null, 2));
console.log('\n6. Generating Team Building Events...');
const teamBuilding = await generateTeamBuildingEvents();
console.log(`Generated ${teamBuilding.data.length} team building event records`);
console.log('Sample:', JSON.stringify(teamBuilding.data[0], null, 2));
console.log('\n7. Generating Conflict Resolution Events...');
const conflicts = await generateConflictResolutionEvents();
console.log(`Generated ${conflicts.data.length} conflict resolution event records`);
console.log('Sample:', JSON.stringify(conflicts.data[0], null, 2));
}
// Uncomment to run
// runAllWorkplaceEventExamples().catch(console.error);