Merge commit 'd803bfe2b1fe7f5e219e50ac20d6801a0a58ac75' as 'vendor/ruvector'
This commit is contained in:
662
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/README.md
vendored
Normal file
662
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/README.md
vendored
Normal file
@@ -0,0 +1,662 @@
|
||||
# Business Management Simulation Examples
|
||||
|
||||
Comprehensive enterprise business management data generation examples using agentic-synth for ERP, CRM, HR, Financial, and Operations systems.
|
||||
|
||||
## Overview
|
||||
|
||||
This directory contains production-ready examples for generating synthetic data that simulates real enterprise systems including SAP, Salesforce, Microsoft Dynamics, Oracle, and other major business platforms.
|
||||
|
||||
## Files
|
||||
|
||||
### 1. ERP Data (`erp-data.ts`)
|
||||
Enterprise Resource Planning data generation including:
|
||||
- **Material Management** - SAP MM material master records
|
||||
- **Purchase Orders** - Complete PO workflows with line items
|
||||
- **Supply Chain Events** - Oracle-style supply chain event tracking
|
||||
- **Manufacturing Orders** - Microsoft Dynamics 365 production orders
|
||||
- **Warehouse Inventory** - Multi-location warehouse management
|
||||
- **Financial Transactions** - SAP FI/CO transaction documents
|
||||
|
||||
**Use Cases:**
|
||||
- SAP S/4HANA system testing
|
||||
- Oracle ERP Cloud integration testing
|
||||
- Microsoft Dynamics 365 data migration
|
||||
- Supply chain analytics development
|
||||
- Inventory management system testing
|
||||
|
||||
### 2. CRM Simulation (`crm-simulation.ts`)
|
||||
Customer Relationship Management data including:
|
||||
- **Lead Generation** - Salesforce lead qualification pipeline
|
||||
- **Sales Pipeline** - Opportunity management with forecasting
|
||||
- **Contact Interactions** - HubSpot-style engagement tracking
|
||||
- **Account Management** - Microsoft Dynamics 365 account hierarchies
|
||||
- **Support Tickets** - Service Cloud case management
|
||||
- **Customer LTV** - Lifetime value analysis and churn prediction
|
||||
|
||||
**Use Cases:**
|
||||
- Salesforce development and testing
|
||||
- Sales analytics dashboard development
|
||||
- Customer journey mapping
|
||||
- Marketing automation testing
|
||||
- Support team training data
|
||||
|
||||
### 3. HR Management (`hr-management.ts`)
|
||||
Human Resources data generation including:
|
||||
- **Employee Profiles** - Workday-style employee master data
|
||||
- **Recruitment Pipeline** - SAP SuccessFactors applicant tracking
|
||||
- **Performance Reviews** - Oracle HCM performance management
|
||||
- **Payroll Data** - Workday payroll processing records
|
||||
- **Time & Attendance** - Time tracking and shift management
|
||||
- **Training Records** - Learning and development tracking
|
||||
|
||||
**Use Cases:**
|
||||
- Workday system testing
|
||||
- SAP SuccessFactors integration
|
||||
- Oracle HCM Cloud development
|
||||
- HR analytics and reporting
|
||||
- Compliance testing (GDPR, SOC 2)
|
||||
|
||||
### 4. Financial Planning (`financial-planning.ts`)
|
||||
Financial management and FP&A data including:
|
||||
- **Budget Planning** - Departmental and project budgets
|
||||
- **Revenue Forecasting** - Multi-scenario revenue projections
|
||||
- **Expense Tracking** - Real-time expense monitoring with variance
|
||||
- **Cash Flow Projections** - Operating, investing, financing activities
|
||||
- **P&L Statements** - Income statements with YoY comparisons
|
||||
- **Balance Sheets** - Complete financial position statements
|
||||
- **KPI Dashboards** - Real-time financial metrics and alerts
|
||||
|
||||
**Use Cases:**
|
||||
- Financial system testing (SAP, Oracle Financials)
|
||||
- FP&A tool development
|
||||
- Business intelligence dashboards
|
||||
- Budget vs actual analysis
|
||||
- Financial modeling and forecasting
|
||||
|
||||
### 5. Operations (`operations.ts`)
|
||||
Business operations management including:
|
||||
- **Project Management** - Jira/MS Project style project tracking
|
||||
- **Resource Allocation** - Team member utilization and assignment
|
||||
- **Vendor Management** - Supplier performance and compliance
|
||||
- **Contract Lifecycle** - Complete CLM workflows
|
||||
- **Approval Workflows** - Multi-step approval processes
|
||||
- **Audit Trails** - Comprehensive activity logging
|
||||
|
||||
**Use Cases:**
|
||||
- Project management tool development
|
||||
- Procurement system testing
|
||||
- Contract management systems
|
||||
- Workflow automation testing
|
||||
- Compliance and audit reporting
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```typescript
|
||||
import { generateMaterialData } from './erp-data.js';
|
||||
import { generateLeads } from './crm-simulation.js';
|
||||
import { generateEmployeeProfiles } from './hr-management.js';
|
||||
import { generateBudgetPlans } from './financial-planning.js';
|
||||
import { generateProjects } from './operations.js';
|
||||
|
||||
// Generate 100 material master records
|
||||
const materials = await generateMaterialData(100);
|
||||
|
||||
// Generate 50 sales leads
|
||||
const leads = await generateLeads(50);
|
||||
|
||||
// Generate 200 employee profiles
|
||||
const employees = await generateEmployeeProfiles(200);
|
||||
|
||||
// Generate 25 budget plans
|
||||
const budgets = await generateBudgetPlans(25);
|
||||
|
||||
// Generate 30 project records
|
||||
const projects = await generateProjects(30);
|
||||
```
|
||||
|
||||
### Complete Dataset Generation
|
||||
|
||||
Generate entire business system datasets in parallel:
|
||||
|
||||
```typescript
|
||||
import { generateCompleteERPDataset } from './erp-data.js';
|
||||
import { generateCompleteCRMDataset } from './crm-simulation.js';
|
||||
import { generateCompleteHRDataset } from './hr-management.js';
|
||||
import { generateCompleteFinancialDataset } from './financial-planning.js';
|
||||
import { generateCompleteOperationsDataset } from './operations.js';
|
||||
|
||||
// Generate all datasets concurrently
|
||||
const [erp, crm, hr, financial, operations] = await Promise.all([
|
||||
generateCompleteERPDataset(),
|
||||
generateCompleteCRMDataset(),
|
||||
generateCompleteHRDataset(),
|
||||
generateCompleteFinancialDataset(),
|
||||
generateCompleteOperationsDataset()
|
||||
]);
|
||||
|
||||
console.log('Total records:',
|
||||
erp.metadata.totalRecords +
|
||||
crm.metadata.totalRecords +
|
||||
hr.metadata.totalRecords +
|
||||
financial.metadata.totalRecords +
|
||||
operations.metadata.totalRecords
|
||||
);
|
||||
```
|
||||
|
||||
### Streaming Large Datasets
|
||||
|
||||
For generating millions of records efficiently:
|
||||
|
||||
```typescript
|
||||
import { streamERPData } from './erp-data.js';
|
||||
import { streamCRMInteractions } from './crm-simulation.js';
|
||||
|
||||
// Stream 1 million material records
|
||||
await streamERPData('material', 1000000);
|
||||
|
||||
// Stream CRM interactions for 24 hours
|
||||
await streamCRMInteractions(86400); // 24 hours in seconds
|
||||
```
|
||||
|
||||
## Enterprise System Integrations
|
||||
|
||||
### SAP Integration
|
||||
|
||||
**SAP S/4HANA:**
|
||||
```typescript
|
||||
import { generateMaterialData, generatePurchaseOrders, generateFinancialTransactions } from './erp-data.js';
|
||||
|
||||
// Generate SAP MM data
|
||||
const materials = await generateMaterialData(1000);
|
||||
|
||||
// Generate SAP PO data
|
||||
const pos = await generatePurchaseOrders(500);
|
||||
|
||||
// Generate SAP FI/CO transactions
|
||||
const transactions = await generateFinancialTransactions(5000);
|
||||
|
||||
// Export to SAP IDoc format
|
||||
const idocs = materials.data.map(material => ({
|
||||
IDOC_TYPE: 'MATMAS',
|
||||
MATERIAL: material.materialNumber,
|
||||
// ... map to SAP structure
|
||||
}));
|
||||
```
|
||||
|
||||
**SAP SuccessFactors:**
|
||||
```typescript
|
||||
import { generateEmployeeProfiles, generatePerformanceReviews } from './hr-management.js';
|
||||
|
||||
// Generate employee data for SuccessFactors
|
||||
const employees = await generateEmployeeProfiles(500);
|
||||
|
||||
// Generate performance review data
|
||||
const reviews = await generatePerformanceReviews(500);
|
||||
|
||||
// Export to SuccessFactors OData format
|
||||
const odataEmployees = employees.data.map(emp => ({
|
||||
userId: emp.employeeId,
|
||||
firstName: emp.firstName,
|
||||
// ... map to SuccessFactors structure
|
||||
}));
|
||||
```
|
||||
|
||||
### Salesforce Integration
|
||||
|
||||
**Salesforce Sales Cloud:**
|
||||
```typescript
|
||||
import { generateLeads, generateOpportunities, generateAccounts } from './crm-simulation.js';
|
||||
|
||||
// Generate Salesforce data
|
||||
const leads = await generateLeads(1000);
|
||||
const opportunities = await generateOpportunities(500);
|
||||
const accounts = await generateAccounts(200);
|
||||
|
||||
// Export to Salesforce bulk API format
|
||||
const sfLeads = leads.data.map(lead => ({
|
||||
FirstName: lead.firstName,
|
||||
LastName: lead.lastName,
|
||||
Company: lead.company,
|
||||
Email: lead.email,
|
||||
LeadSource: lead.leadSource,
|
||||
Status: lead.status,
|
||||
Rating: lead.rating
|
||||
}));
|
||||
|
||||
// Use Salesforce Bulk API
|
||||
// await salesforce.bulk.load('Lead', 'insert', sfLeads);
|
||||
```
|
||||
|
||||
**Salesforce Service Cloud:**
|
||||
```typescript
|
||||
import { generateSupportTickets } from './crm-simulation.js';
|
||||
|
||||
// Generate Service Cloud cases
|
||||
const tickets = await generateSupportTickets(1000);
|
||||
|
||||
// Export to Salesforce Case format
|
||||
const sfCases = tickets.data.map(ticket => ({
|
||||
Subject: ticket.subject,
|
||||
Description: ticket.description,
|
||||
Status: ticket.status,
|
||||
Priority: ticket.priority,
|
||||
Origin: ticket.origin
|
||||
}));
|
||||
```
|
||||
|
||||
### Microsoft Dynamics Integration
|
||||
|
||||
**Dynamics 365 Finance & Operations:**
|
||||
```typescript
|
||||
import { generateManufacturingOrders } from './erp-data.js';
|
||||
import { generateBudgetPlans, generateProfitLossStatements } from './financial-planning.ts';
|
||||
|
||||
// Generate manufacturing data
|
||||
const prodOrders = await generateManufacturingOrders(200);
|
||||
|
||||
// Generate financial data
|
||||
const budgets = await generateBudgetPlans(50);
|
||||
const financials = await generateProfitLossStatements(12);
|
||||
|
||||
// Export to Dynamics 365 data entities
|
||||
const d365ProdOrders = prodOrders.data.map(order => ({
|
||||
ProductionOrderNumber: order.productionOrderId,
|
||||
ItemNumber: order.product.itemNumber,
|
||||
OrderedQuantity: order.quantity.ordered,
|
||||
// ... map to Dynamics structure
|
||||
}));
|
||||
```
|
||||
|
||||
**Dynamics 365 CRM:**
|
||||
```typescript
|
||||
import { generateAccounts, generateOpportunities } from './crm-simulation.js';
|
||||
|
||||
// Generate CRM data
|
||||
const accounts = await generateAccounts(500);
|
||||
const opportunities = await generateOpportunities(300);
|
||||
|
||||
// Export to Dynamics 365 format
|
||||
const d365Accounts = accounts.data.map(account => ({
|
||||
name: account.accountName,
|
||||
accountnumber: account.accountNumber,
|
||||
industrycode: account.industry,
|
||||
revenue: account.annualRevenue,
|
||||
// ... map to Dynamics structure
|
||||
}));
|
||||
```
|
||||
|
||||
### Oracle Integration
|
||||
|
||||
**Oracle ERP Cloud:**
|
||||
```typescript
|
||||
import { generateSupplyChainEvents, generatePurchaseOrders } from './erp-data.js';
|
||||
|
||||
// Generate Oracle ERP data
|
||||
const scEvents = await generateSupplyChainEvents(1000);
|
||||
const pos = await generatePurchaseOrders(500);
|
||||
|
||||
// Export to Oracle REST API format
|
||||
const oracleEvents = scEvents.data.map(event => ({
|
||||
EventId: event.eventId,
|
||||
EventType: event.eventType,
|
||||
EventTimestamp: event.timestamp,
|
||||
// ... map to Oracle structure
|
||||
}));
|
||||
```
|
||||
|
||||
**Oracle HCM Cloud:**
|
||||
```typescript
|
||||
import { generateEmployeeProfiles, generatePerformanceReviews } from './hr-management.js';
|
||||
|
||||
// Generate Oracle HCM data
|
||||
const employees = await generateEmployeeProfiles(1000);
|
||||
const reviews = await generatePerformanceReviews(800);
|
||||
|
||||
// Export to Oracle HCM REST API format
|
||||
const oracleWorkers = employees.data.map(emp => ({
|
||||
PersonNumber: emp.employeeNumber,
|
||||
FirstName: emp.firstName,
|
||||
LastName: emp.lastName,
|
||||
// ... map to Oracle structure
|
||||
}));
|
||||
```
|
||||
|
||||
### Workday Integration
|
||||
|
||||
```typescript
|
||||
import { generateEmployeeProfiles, generatePayrollData } from './hr-management.js';
|
||||
|
||||
// Generate Workday data
|
||||
const employees = await generateEmployeeProfiles(500);
|
||||
const payroll = await generatePayrollData(2000);
|
||||
|
||||
// Export to Workday Web Services format
|
||||
const workdayWorkers = employees.data.map(emp => ({
|
||||
Worker_Reference: {
|
||||
ID: {
|
||||
_: emp.employeeId,
|
||||
type: 'Employee_ID'
|
||||
}
|
||||
},
|
||||
Personal_Data: {
|
||||
Name_Data: {
|
||||
Legal_Name: {
|
||||
First_Name: emp.firstName,
|
||||
Last_Name: emp.lastName
|
||||
}
|
||||
}
|
||||
}
|
||||
// ... map to Workday XML structure
|
||||
}));
|
||||
```
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Custom Schema Extension
|
||||
|
||||
Extend existing schemas with custom fields:
|
||||
|
||||
```typescript
|
||||
import { createSynth } from '../../src/index.js';
|
||||
|
||||
// Custom extended employee schema
|
||||
const customEmployeeSchema = {
|
||||
...employeeProfileSchema,
|
||||
customFields: {
|
||||
type: 'object',
|
||||
required: false,
|
||||
properties: {
|
||||
securityClearance: { type: 'string' },
|
||||
badgeNumber: { type: 'string' },
|
||||
parkingSpot: { type: 'string' }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const synth = createSynth();
|
||||
const result = await synth.generateStructured({
|
||||
count: 100,
|
||||
schema: customEmployeeSchema,
|
||||
format: 'json'
|
||||
});
|
||||
```
|
||||
|
||||
### Multi-Tenant Data Generation
|
||||
|
||||
Generate data for multiple organizations:
|
||||
|
||||
```typescript
|
||||
const organizations = ['org1', 'org2', 'org3'];
|
||||
|
||||
const allData = await Promise.all(
|
||||
organizations.map(async (org) => {
|
||||
const [erp, crm, hr] = await Promise.all([
|
||||
generateCompleteERPDataset(),
|
||||
generateCompleteCRMDataset(),
|
||||
generateCompleteHRDataset()
|
||||
]);
|
||||
|
||||
return {
|
||||
organizationId: org,
|
||||
data: { erp, crm, hr }
|
||||
};
|
||||
})
|
||||
);
|
||||
```
|
||||
|
||||
### Real-Time Simulation
|
||||
|
||||
Simulate real-time business operations:
|
||||
|
||||
```typescript
|
||||
import { generateContactInteractions } from './crm-simulation.js';
|
||||
import { generateAuditTrail } from './operations.js';
|
||||
|
||||
// Simulate 24/7 operations
|
||||
async function simulateRealTime() {
|
||||
while (true) {
|
||||
// Generate interactions every 5 seconds
|
||||
const interactions = await generateContactInteractions(10);
|
||||
console.log(`Generated ${interactions.data.length} interactions`);
|
||||
|
||||
// Generate audit events
|
||||
const audit = await generateAuditTrail(20);
|
||||
console.log(`Logged ${audit.data.length} audit events`);
|
||||
|
||||
// Wait 5 seconds
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Data Validation
|
||||
|
||||
Validate generated data against business rules:
|
||||
|
||||
```typescript
|
||||
import { generatePurchaseOrders } from './erp-data.js';
|
||||
|
||||
const pos = await generatePurchaseOrders(100);
|
||||
|
||||
// Validate PO data
|
||||
const validPOs = pos.data.filter(po => {
|
||||
// Check totals match
|
||||
const itemsTotal = po.items.reduce((sum, item) => sum + item.netValue, 0);
|
||||
const totalMatch = Math.abs(itemsTotal - po.totalAmount) < 0.01;
|
||||
|
||||
// Check dates are logical
|
||||
const dateValid = new Date(po.poDate) <= new Date();
|
||||
|
||||
return totalMatch && dateValid;
|
||||
});
|
||||
|
||||
console.log(`Valid POs: ${validPOs.length}/${pos.data.length}`);
|
||||
```
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
### Batch Generation
|
||||
|
||||
For large datasets, use batch generation:
|
||||
|
||||
```typescript
|
||||
import { createSynth } from '../../src/index.js';
|
||||
|
||||
const synth = createSynth({
|
||||
cacheStrategy: 'memory',
|
||||
cacheTTL: 3600
|
||||
});
|
||||
|
||||
// Generate in batches of 1000
|
||||
const batchSize = 1000;
|
||||
const totalRecords = 100000;
|
||||
const batches = Math.ceil(totalRecords / batchSize);
|
||||
|
||||
for (let i = 0; i < batches; i++) {
|
||||
const batch = await synth.generateStructured({
|
||||
count: batchSize,
|
||||
schema: materialSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Batch ${i + 1}/${batches} complete`);
|
||||
|
||||
// Process or save batch
|
||||
// await saveToDB(batch.data);
|
||||
}
|
||||
```
|
||||
|
||||
### Memory Management
|
||||
|
||||
For very large datasets, use streaming:
|
||||
|
||||
```typescript
|
||||
import { streamERPData } from './erp-data.js';
|
||||
import fs from 'fs';
|
||||
|
||||
// Stream to file
|
||||
const writeStream = fs.createWriteStream('materials.jsonl');
|
||||
|
||||
let recordCount = 0;
|
||||
for await (const record of streamERPData('material', 1000000)) {
|
||||
writeStream.write(JSON.stringify(record) + '\n');
|
||||
recordCount++;
|
||||
|
||||
if (recordCount % 10000 === 0) {
|
||||
console.log(`Processed ${recordCount} records`);
|
||||
}
|
||||
}
|
||||
|
||||
writeStream.end();
|
||||
```
|
||||
|
||||
### Parallel Processing
|
||||
|
||||
Maximize throughput with parallel generation:
|
||||
|
||||
```typescript
|
||||
import pLimit from 'p-limit';
|
||||
|
||||
// Limit to 5 concurrent generations
|
||||
const limit = pLimit(5);
|
||||
|
||||
const tasks = [
|
||||
() => generateMaterialData(1000),
|
||||
() => generatePurchaseOrders(500),
|
||||
() => generateLeads(1000),
|
||||
() => generateEmployeeProfiles(500),
|
||||
() => generateProjects(200)
|
||||
];
|
||||
|
||||
const results = await Promise.all(
|
||||
tasks.map(task => limit(task))
|
||||
);
|
||||
|
||||
console.log('All generations complete');
|
||||
```
|
||||
|
||||
## Testing & Validation
|
||||
|
||||
### Unit Testing
|
||||
|
||||
```typescript
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { generateLeads } from './crm-simulation.js';
|
||||
|
||||
describe('CRM Lead Generation', () => {
|
||||
it('should generate specified number of leads', async () => {
|
||||
const result = await generateLeads(50);
|
||||
expect(result.data).toHaveLength(50);
|
||||
});
|
||||
|
||||
it('should have valid email addresses', async () => {
|
||||
const result = await generateLeads(10);
|
||||
result.data.forEach(lead => {
|
||||
expect(lead.email).toMatch(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);
|
||||
});
|
||||
});
|
||||
|
||||
it('should have lead scores between 0-100', async () => {
|
||||
const result = await generateLeads(10);
|
||||
result.data.forEach(lead => {
|
||||
expect(lead.leadScore).toBeGreaterThanOrEqual(0);
|
||||
expect(lead.leadScore).toBeLessThanOrEqual(100);
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Integration Testing
|
||||
|
||||
```typescript
|
||||
import { generateCompleteERPDataset } from './erp-data.js';
|
||||
|
||||
describe('ERP Dataset Integration', () => {
|
||||
it('should generate complete linked dataset', async () => {
|
||||
const dataset = await generateCompleteERPDataset();
|
||||
|
||||
// Verify data relationships
|
||||
expect(dataset.materials.length).toBeGreaterThan(0);
|
||||
expect(dataset.purchaseOrders.length).toBeGreaterThan(0);
|
||||
|
||||
// Verify total count
|
||||
expect(dataset.metadata.totalRecords).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
```bash
|
||||
# API Keys
|
||||
GEMINI_API_KEY=your_gemini_key
|
||||
OPENROUTER_API_KEY=your_openrouter_key
|
||||
|
||||
# Cache Configuration
|
||||
CACHE_STRATEGY=memory
|
||||
CACHE_TTL=3600
|
||||
|
||||
# Generation Settings
|
||||
DEFAULT_PROVIDER=gemini
|
||||
DEFAULT_MODEL=gemini-2.0-flash-exp
|
||||
STREAMING_ENABLED=false
|
||||
```
|
||||
|
||||
### Custom Configuration
|
||||
|
||||
```typescript
|
||||
import { createSynth } from '../../src/index.js';
|
||||
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY,
|
||||
model: 'gemini-2.0-flash-exp',
|
||||
cacheStrategy: 'memory',
|
||||
cacheTTL: 3600,
|
||||
maxRetries: 3,
|
||||
timeout: 30000,
|
||||
streaming: false
|
||||
});
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Start Small**: Generate small datasets first to validate schemas
|
||||
2. **Use Caching**: Enable caching for repeated operations
|
||||
3. **Batch Processing**: Use batches for large datasets
|
||||
4. **Validate Data**: Implement validation rules for business logic
|
||||
5. **Error Handling**: Wrap generations in try-catch blocks
|
||||
6. **Monitor Performance**: Track generation times and optimize
|
||||
7. **Version Control**: Track schema changes and data versions
|
||||
8. **Document Assumptions**: Document business rules and assumptions
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
**Issue**: Generation is slow
|
||||
- **Solution**: Enable caching, use batch processing, or parallel generation
|
||||
|
||||
**Issue**: Out of memory errors
|
||||
- **Solution**: Use streaming for large datasets, reduce batch sizes
|
||||
|
||||
**Issue**: Data doesn't match expected format
|
||||
- **Solution**: Validate schemas, check type definitions
|
||||
|
||||
**Issue**: API rate limits
|
||||
- **Solution**: Implement retry logic, use multiple API keys
|
||||
|
||||
## Support
|
||||
|
||||
For issues, questions, or contributions:
|
||||
- GitHub Issues: https://github.com/ruvnet/agentic-synth/issues
|
||||
- Documentation: https://github.com/ruvnet/agentic-synth/docs
|
||||
- Examples: https://github.com/ruvnet/agentic-synth/examples
|
||||
|
||||
## License
|
||||
|
||||
MIT License - see LICENSE file for details
|
||||
83
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/crm-simulation.d.ts
vendored
Normal file
83
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/crm-simulation.d.ts
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Customer Relationship Management (CRM) Data Generation
|
||||
* Simulates Salesforce, Microsoft Dynamics CRM, and HubSpot scenarios
|
||||
*/
|
||||
/**
|
||||
* Generate Salesforce Leads
|
||||
*/
|
||||
export declare function generateLeads(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Sales Pipeline (Opportunities)
|
||||
*/
|
||||
export declare function generateOpportunities(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate HubSpot Contact Interactions (time-series)
|
||||
*/
|
||||
export declare function generateContactInteractions(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Microsoft Dynamics 365 Accounts
|
||||
*/
|
||||
export declare function generateAccounts(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Salesforce Service Cloud Support Tickets
|
||||
*/
|
||||
export declare function generateSupportTickets(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Customer Lifetime Value Analysis
|
||||
*/
|
||||
export declare function generateCustomerLTV(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Simulate complete sales funnel with conversion metrics
|
||||
*/
|
||||
export declare function simulateSalesFunnel(): Promise<{
|
||||
leads: unknown[];
|
||||
opportunities: unknown[];
|
||||
accounts: unknown[];
|
||||
metrics: {
|
||||
leads: number;
|
||||
qualifiedLeads: number;
|
||||
opportunities: number;
|
||||
wonDeals: number;
|
||||
accounts: number;
|
||||
conversionRates: {
|
||||
leadToQualified: string;
|
||||
qualifiedToOpportunity: string;
|
||||
opportunityToWon: string;
|
||||
leadToCustomer: string;
|
||||
};
|
||||
totalPipelineValue: number;
|
||||
averageDealSize: number;
|
||||
};
|
||||
}>;
|
||||
/**
|
||||
* Generate complete CRM dataset in parallel
|
||||
*/
|
||||
export declare function generateCompleteCRMDataset(): Promise<{
|
||||
leads: unknown[];
|
||||
opportunities: unknown[];
|
||||
interactions: unknown[];
|
||||
accounts: unknown[];
|
||||
supportTickets: unknown[];
|
||||
customerLTV: unknown[];
|
||||
metadata: {
|
||||
totalRecords: number;
|
||||
generatedAt: string;
|
||||
};
|
||||
}>;
|
||||
/**
|
||||
* Stream CRM interactions for real-time analysis
|
||||
*/
|
||||
export declare function streamCRMInteractions(duration?: number): Promise<void>;
|
||||
declare const _default: {
|
||||
generateLeads: typeof generateLeads;
|
||||
generateOpportunities: typeof generateOpportunities;
|
||||
generateContactInteractions: typeof generateContactInteractions;
|
||||
generateAccounts: typeof generateAccounts;
|
||||
generateSupportTickets: typeof generateSupportTickets;
|
||||
generateCustomerLTV: typeof generateCustomerLTV;
|
||||
simulateSalesFunnel: typeof simulateSalesFunnel;
|
||||
generateCompleteCRMDataset: typeof generateCompleteCRMDataset;
|
||||
streamCRMInteractions: typeof streamCRMInteractions;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=crm-simulation.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"crm-simulation.d.ts","sourceRoot":"","sources":["crm-simulation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoPH;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,GAAE,MAAY,mEAkBtD;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,GAAE,MAAW,mEAiB7D;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,GAAE,MAAY,mEAqBpE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,GAAE,MAAW,mEAiBxD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,GAAE,MAAY,mEAiB/D;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,GAAE,MAAY,mEAiB5D;AAED;;GAEG;AACH,wBAAsB,mBAAmB;;;;;;;;;;;;;;;;;;;GA4CxC;AAED;;GAEG;AACH,wBAAsB,0BAA0B;;;;;;;;;;;GAmC/C;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,GAAE,MAAa,iBA0BlE;;;;;;;;;;;;AA2CD,wBAUE"}
|
||||
499
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/crm-simulation.js
vendored
Normal file
499
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/crm-simulation.js
vendored
Normal file
@@ -0,0 +1,499 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Customer Relationship Management (CRM) Data Generation
|
||||
* Simulates Salesforce, Microsoft Dynamics CRM, and HubSpot scenarios
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateLeads = generateLeads;
|
||||
exports.generateOpportunities = generateOpportunities;
|
||||
exports.generateContactInteractions = generateContactInteractions;
|
||||
exports.generateAccounts = generateAccounts;
|
||||
exports.generateSupportTickets = generateSupportTickets;
|
||||
exports.generateCustomerLTV = generateCustomerLTV;
|
||||
exports.simulateSalesFunnel = simulateSalesFunnel;
|
||||
exports.generateCompleteCRMDataset = generateCompleteCRMDataset;
|
||||
exports.streamCRMInteractions = streamCRMInteractions;
|
||||
const index_js_1 = require("../../src/index.js");
|
||||
// Salesforce Lead Schema
|
||||
const leadSchema = {
|
||||
leadId: { type: 'string', required: true },
|
||||
firstName: { type: 'string', required: true },
|
||||
lastName: { type: 'string', required: true },
|
||||
email: { type: 'string', required: true },
|
||||
phone: { type: 'string', required: false },
|
||||
company: { type: 'string', required: true },
|
||||
title: { type: 'string', required: true },
|
||||
industry: { type: 'string', required: true },
|
||||
numberOfEmployees: { type: 'number', required: false },
|
||||
annualRevenue: { type: 'number', required: false },
|
||||
leadSource: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
rating: { type: 'string', required: true },
|
||||
address: { type: 'object', required: false, properties: {
|
||||
street: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
postalCode: { type: 'string' },
|
||||
country: { type: 'string' }
|
||||
} },
|
||||
description: { type: 'string', required: false },
|
||||
website: { type: 'string', required: false },
|
||||
leadScore: { type: 'number', required: true },
|
||||
conversionProbability: { type: 'number', required: true },
|
||||
ownerId: { type: 'string', required: true },
|
||||
ownerName: { type: 'string', required: true },
|
||||
createdDate: { type: 'string', required: true },
|
||||
lastActivityDate: { type: 'string', required: false },
|
||||
convertedDate: { type: 'string', required: false },
|
||||
convertedAccountId: { type: 'string', required: false },
|
||||
convertedContactId: { type: 'string', required: false },
|
||||
convertedOpportunityId: { type: 'string', required: false }
|
||||
};
|
||||
// Salesforce Sales Pipeline (Opportunity) Schema
|
||||
const opportunitySchema = {
|
||||
opportunityId: { type: 'string', required: true },
|
||||
opportunityName: { type: 'string', required: true },
|
||||
accountId: { type: 'string', required: true },
|
||||
accountName: { type: 'string', required: true },
|
||||
type: { type: 'string', required: true },
|
||||
stage: { type: 'string', required: true },
|
||||
amount: { type: 'number', required: true },
|
||||
probability: { type: 'number', required: true },
|
||||
expectedRevenue: { type: 'number', required: true },
|
||||
closeDate: { type: 'string', required: true },
|
||||
nextStep: { type: 'string', required: false },
|
||||
leadSource: { type: 'string', required: true },
|
||||
campaignId: { type: 'string', required: false },
|
||||
ownerId: { type: 'string', required: true },
|
||||
ownerName: { type: 'string', required: true },
|
||||
createdDate: { type: 'string', required: true },
|
||||
lastModifiedDate: { type: 'string', required: true },
|
||||
products: { type: 'array', required: true, items: {
|
||||
productId: { type: 'string' },
|
||||
productName: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
listPrice: { type: 'number' },
|
||||
salesPrice: { type: 'number' },
|
||||
discount: { type: 'number' },
|
||||
totalPrice: { type: 'number' }
|
||||
} },
|
||||
competitors: { type: 'array', required: false },
|
||||
description: { type: 'string', required: false },
|
||||
isClosed: { type: 'boolean', required: true },
|
||||
isWon: { type: 'boolean', required: false },
|
||||
lostReason: { type: 'string', required: false },
|
||||
forecastCategory: { type: 'string', required: true }
|
||||
};
|
||||
// HubSpot Contact Interaction Schema
|
||||
const contactInteractionSchema = {
|
||||
interactionId: { type: 'string', required: true },
|
||||
contactId: { type: 'string', required: true },
|
||||
contactEmail: { type: 'string', required: true },
|
||||
interactionType: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
channel: { type: 'string', required: true },
|
||||
subject: { type: 'string', required: false },
|
||||
body: { type: 'string', required: false },
|
||||
duration: { type: 'number', required: false },
|
||||
outcome: { type: 'string', required: false },
|
||||
sentiment: { type: 'string', required: false },
|
||||
engagement: { type: 'object', required: true, properties: {
|
||||
opened: { type: 'boolean' },
|
||||
clicked: { type: 'boolean' },
|
||||
replied: { type: 'boolean' },
|
||||
bounced: { type: 'boolean' },
|
||||
unsubscribed: { type: 'boolean' }
|
||||
} },
|
||||
associatedDealId: { type: 'string', required: false },
|
||||
associatedTicketId: { type: 'string', required: false },
|
||||
ownerId: { type: 'string', required: true },
|
||||
properties: { type: 'object', required: false }
|
||||
};
|
||||
// Microsoft Dynamics 365 Account Management Schema
|
||||
const accountSchema = {
|
||||
accountId: { type: 'string', required: true },
|
||||
accountName: { type: 'string', required: true },
|
||||
accountNumber: { type: 'string', required: true },
|
||||
parentAccountId: { type: 'string', required: false },
|
||||
accountType: { type: 'string', required: true },
|
||||
industry: { type: 'string', required: true },
|
||||
subIndustry: { type: 'string', required: false },
|
||||
annualRevenue: { type: 'number', required: true },
|
||||
numberOfEmployees: { type: 'number', required: true },
|
||||
ownership: { type: 'string', required: true },
|
||||
website: { type: 'string', required: false },
|
||||
phone: { type: 'string', required: true },
|
||||
fax: { type: 'string', required: false },
|
||||
billingAddress: { type: 'object', required: true, properties: {
|
||||
street1: { type: 'string' },
|
||||
street2: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
stateProvince: { type: 'string' },
|
||||
postalCode: { type: 'string' },
|
||||
country: { type: 'string' }
|
||||
} },
|
||||
shippingAddress: { type: 'object', required: true, properties: {
|
||||
street1: { type: 'string' },
|
||||
street2: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
stateProvince: { type: 'string' },
|
||||
postalCode: { type: 'string' },
|
||||
country: { type: 'string' }
|
||||
} },
|
||||
primaryContact: { type: 'object', required: true, properties: {
|
||||
contactId: { type: 'string' },
|
||||
fullName: { type: 'string' },
|
||||
title: { type: 'string' },
|
||||
email: { type: 'string' },
|
||||
phone: { type: 'string' }
|
||||
} },
|
||||
accountRating: { type: 'string', required: true },
|
||||
creditLimit: { type: 'number', required: false },
|
||||
paymentTerms: { type: 'string', required: true },
|
||||
preferredContactMethod: { type: 'string', required: true },
|
||||
ownerId: { type: 'string', required: true },
|
||||
ownerName: { type: 'string', required: true },
|
||||
teamId: { type: 'string', required: false },
|
||||
territory: { type: 'string', required: true },
|
||||
createdOn: { type: 'string', required: true },
|
||||
modifiedOn: { type: 'string', required: true },
|
||||
lastInteractionDate: { type: 'string', required: false },
|
||||
description: { type: 'string', required: false }
|
||||
};
|
||||
// Salesforce Service Cloud Support Ticket Schema
|
||||
const supportTicketSchema = {
|
||||
caseId: { type: 'string', required: true },
|
||||
caseNumber: { type: 'string', required: true },
|
||||
subject: { type: 'string', required: true },
|
||||
description: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
priority: { type: 'string', required: true },
|
||||
severity: { type: 'string', required: true },
|
||||
type: { type: 'string', required: true },
|
||||
origin: { type: 'string', required: true },
|
||||
reason: { type: 'string', required: false },
|
||||
contactId: { type: 'string', required: true },
|
||||
contactName: { type: 'string', required: true },
|
||||
contactEmail: { type: 'string', required: true },
|
||||
contactPhone: { type: 'string', required: false },
|
||||
accountId: { type: 'string', required: true },
|
||||
accountName: { type: 'string', required: true },
|
||||
productId: { type: 'string', required: false },
|
||||
productName: { type: 'string', required: false },
|
||||
ownerId: { type: 'string', required: true },
|
||||
ownerName: { type: 'string', required: true },
|
||||
createdDate: { type: 'string', required: true },
|
||||
closedDate: { type: 'string', required: false },
|
||||
firstResponseDate: { type: 'string', required: false },
|
||||
firstResponseSLA: { type: 'number', required: true },
|
||||
resolutionSLA: { type: 'number', required: true },
|
||||
escalated: { type: 'boolean', required: true },
|
||||
escalationDate: { type: 'string', required: false },
|
||||
resolution: { type: 'string', required: false },
|
||||
comments: { type: 'array', required: false, items: {
|
||||
commentId: { type: 'string' },
|
||||
author: { type: 'string' },
|
||||
timestamp: { type: 'string' },
|
||||
text: { type: 'string' },
|
||||
isPublic: { type: 'boolean' }
|
||||
} },
|
||||
satisfaction: { type: 'object', required: false, properties: {
|
||||
score: { type: 'number' },
|
||||
feedback: { type: 'string' },
|
||||
surveyDate: { type: 'string' }
|
||||
} }
|
||||
};
|
||||
// Customer Lifetime Value Schema
|
||||
const customerLifetimeValueSchema = {
|
||||
customerId: { type: 'string', required: true },
|
||||
customerName: { type: 'string', required: true },
|
||||
segment: { type: 'string', required: true },
|
||||
acquisitionDate: { type: 'string', required: true },
|
||||
acquisitionChannel: { type: 'string', required: true },
|
||||
acquisitionCost: { type: 'number', required: true },
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
totalRevenue: { type: 'number' },
|
||||
totalOrders: { type: 'number' },
|
||||
averageOrderValue: { type: 'number' },
|
||||
totalProfit: { type: 'number' },
|
||||
profitMargin: { type: 'number' },
|
||||
retentionRate: { type: 'number' },
|
||||
churnProbability: { type: 'number' }
|
||||
} },
|
||||
ltv: { type: 'object', required: true, properties: {
|
||||
currentLTV: { type: 'number' },
|
||||
predictedLTV: { type: 'number' },
|
||||
ltvCACRatio: { type: 'number' },
|
||||
paybackPeriod: { type: 'number' },
|
||||
timeHorizon: { type: 'string' }
|
||||
} },
|
||||
engagement: { type: 'object', required: true, properties: {
|
||||
lastPurchaseDate: { type: 'string' },
|
||||
daysSinceLastPurchase: { type: 'number' },
|
||||
averageDaysBetweenPurchases: { type: 'number' },
|
||||
emailOpenRate: { type: 'number' },
|
||||
emailClickRate: { type: 'number' },
|
||||
websiteVisits: { type: 'number' },
|
||||
supportTickets: { type: 'number' },
|
||||
npsScore: { type: 'number' }
|
||||
} },
|
||||
crossSell: { type: 'array', required: false, items: {
|
||||
productCategory: { type: 'string' },
|
||||
probability: { type: 'number' },
|
||||
potentialRevenue: { type: 'number' }
|
||||
} },
|
||||
churnRisk: { type: 'object', required: true, properties: {
|
||||
score: { type: 'number' },
|
||||
factors: { type: 'array' },
|
||||
mitigationActions: { type: 'array' }
|
||||
} }
|
||||
};
|
||||
/**
|
||||
* Generate Salesforce Leads
|
||||
*/
|
||||
async function generateLeads(count = 100) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
console.log(`Generating ${count} Salesforce leads...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: leadSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} leads in ${result.metadata.duration}ms`);
|
||||
console.log('Sample lead:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Sales Pipeline (Opportunities)
|
||||
*/
|
||||
async function generateOpportunities(count = 75) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} sales opportunities...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: opportunitySchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} opportunities in ${result.metadata.duration}ms`);
|
||||
console.log('Sample opportunity:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate HubSpot Contact Interactions (time-series)
|
||||
*/
|
||||
async function generateContactInteractions(count = 500) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} contact interactions...`);
|
||||
const result = await synth.generateEvents({
|
||||
count,
|
||||
eventTypes: ['email', 'call', 'meeting', 'chat', 'website_visit', 'form_submission', 'social_media'],
|
||||
distribution: 'poisson',
|
||||
timeRange: {
|
||||
start: new Date(Date.now() - 90 * 24 * 60 * 60 * 1000), // 90 days ago
|
||||
end: new Date()
|
||||
}
|
||||
});
|
||||
console.log(`Generated ${result.data.length} interactions in ${result.metadata.duration}ms`);
|
||||
console.log('Sample interaction:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Microsoft Dynamics 365 Accounts
|
||||
*/
|
||||
async function generateAccounts(count = 50) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} CRM accounts...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: accountSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} accounts in ${result.metadata.duration}ms`);
|
||||
console.log('Sample account:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Salesforce Service Cloud Support Tickets
|
||||
*/
|
||||
async function generateSupportTickets(count = 200) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} support tickets...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: supportTicketSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} tickets in ${result.metadata.duration}ms`);
|
||||
console.log('Sample ticket:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Customer Lifetime Value Analysis
|
||||
*/
|
||||
async function generateCustomerLTV(count = 100) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} customer LTV records...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: customerLifetimeValueSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} LTV records in ${result.metadata.duration}ms`);
|
||||
console.log('Sample LTV:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Simulate complete sales funnel with conversion metrics
|
||||
*/
|
||||
async function simulateSalesFunnel() {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
console.log('Simulating complete sales funnel...');
|
||||
console.time('Sales funnel simulation');
|
||||
// Generate funnel stages in sequence to maintain conversion logic
|
||||
const leads = await generateLeads(1000);
|
||||
const qualifiedLeadCount = Math.floor(leads.data.length * 0.4); // 40% qualification rate
|
||||
const opportunities = await generateOpportunities(qualifiedLeadCount);
|
||||
const wonOpportunityCount = Math.floor(opportunities.data.length * 0.25); // 25% win rate
|
||||
const accounts = await generateAccounts(wonOpportunityCount);
|
||||
console.timeEnd('Sales funnel simulation');
|
||||
const metrics = {
|
||||
leads: leads.data.length,
|
||||
qualifiedLeads: qualifiedLeadCount,
|
||||
opportunities: opportunities.data.length,
|
||||
wonDeals: wonOpportunityCount,
|
||||
accounts: accounts.data.length,
|
||||
conversionRates: {
|
||||
leadToQualified: (qualifiedLeadCount / leads.data.length * 100).toFixed(2) + '%',
|
||||
qualifiedToOpportunity: '100%', // By design
|
||||
opportunityToWon: (wonOpportunityCount / opportunities.data.length * 100).toFixed(2) + '%',
|
||||
leadToCustomer: (accounts.data.length / leads.data.length * 100).toFixed(2) + '%'
|
||||
},
|
||||
totalPipelineValue: opportunities.data.reduce((sum, opp) => sum + (opp.amount || 0), 0),
|
||||
averageDealSize: opportunities.data.reduce((sum, opp) => sum + (opp.amount || 0), 0) / opportunities.data.length
|
||||
};
|
||||
console.log('Sales Funnel Metrics:', metrics);
|
||||
return {
|
||||
leads: leads.data,
|
||||
opportunities: opportunities.data,
|
||||
accounts: accounts.data,
|
||||
metrics
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Generate complete CRM dataset in parallel
|
||||
*/
|
||||
async function generateCompleteCRMDataset() {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
console.log('Generating complete CRM dataset in parallel...');
|
||||
console.time('Total CRM generation');
|
||||
const [leads, opportunities, interactions, accounts, tickets, ltv] = await Promise.all([
|
||||
generateLeads(100),
|
||||
generateOpportunities(50),
|
||||
generateContactInteractions(300),
|
||||
generateAccounts(30),
|
||||
generateSupportTickets(100),
|
||||
generateCustomerLTV(50)
|
||||
]);
|
||||
console.timeEnd('Total CRM generation');
|
||||
return {
|
||||
leads: leads.data,
|
||||
opportunities: opportunities.data,
|
||||
interactions: interactions.data,
|
||||
accounts: accounts.data,
|
||||
supportTickets: tickets.data,
|
||||
customerLTV: ltv.data,
|
||||
metadata: {
|
||||
totalRecords: leads.data.length + opportunities.data.length +
|
||||
interactions.data.length + accounts.data.length +
|
||||
tickets.data.length + ltv.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Stream CRM interactions for real-time analysis
|
||||
*/
|
||||
async function streamCRMInteractions(duration = 3600) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
streaming: true
|
||||
});
|
||||
console.log(`Streaming CRM interactions for ${duration} seconds...`);
|
||||
const endTime = Date.now() + (duration * 1000);
|
||||
let interactionCount = 0;
|
||||
while (Date.now() < endTime) {
|
||||
for await (const interaction of synth.generateStream('events', {
|
||||
count: 10,
|
||||
eventTypes: ['email', 'call', 'meeting', 'chat'],
|
||||
distribution: 'poisson'
|
||||
})) {
|
||||
interactionCount++;
|
||||
console.log(`[${new Date().toISOString()}] Interaction ${interactionCount}:`, interaction);
|
||||
// Simulate real-time processing delay
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
}
|
||||
console.log(`Completed streaming ${interactionCount} interactions`);
|
||||
}
|
||||
// Example usage
|
||||
async function runCRMExamples() {
|
||||
console.log('=== CRM Data Generation Examples ===\n');
|
||||
// Example 1: Lead Generation
|
||||
console.log('1. Lead Generation (Salesforce)');
|
||||
await generateLeads(10);
|
||||
// Example 2: Sales Pipeline
|
||||
console.log('\n2. Sales Pipeline (Opportunities)');
|
||||
await generateOpportunities(10);
|
||||
// Example 3: Contact Interactions
|
||||
console.log('\n3. Contact Interactions (HubSpot)');
|
||||
await generateContactInteractions(50);
|
||||
// Example 4: Account Management
|
||||
console.log('\n4. Account Management (Dynamics 365)');
|
||||
await generateAccounts(5);
|
||||
// Example 5: Support Tickets
|
||||
console.log('\n5. Support Tickets (Service Cloud)');
|
||||
await generateSupportTickets(20);
|
||||
// Example 6: Customer LTV
|
||||
console.log('\n6. Customer Lifetime Value');
|
||||
await generateCustomerLTV(10);
|
||||
// Example 7: Sales Funnel Simulation
|
||||
console.log('\n7. Complete Sales Funnel Simulation');
|
||||
await simulateSalesFunnel();
|
||||
// Example 8: Complete CRM dataset
|
||||
console.log('\n8. Complete CRM Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteCRMDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
// Uncomment to run
|
||||
// runCRMExamples().catch(console.error);
|
||||
exports.default = {
|
||||
generateLeads,
|
||||
generateOpportunities,
|
||||
generateContactInteractions,
|
||||
generateAccounts,
|
||||
generateSupportTickets,
|
||||
generateCustomerLTV,
|
||||
simulateSalesFunnel,
|
||||
generateCompleteCRMDataset,
|
||||
streamCRMInteractions
|
||||
};
|
||||
//# sourceMappingURL=crm-simulation.js.map
|
||||
File diff suppressed because one or more lines are too long
556
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/crm-simulation.ts
vendored
Normal file
556
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/crm-simulation.ts
vendored
Normal file
@@ -0,0 +1,556 @@
|
||||
/**
|
||||
* Customer Relationship Management (CRM) Data Generation
|
||||
* Simulates Salesforce, Microsoft Dynamics CRM, and HubSpot scenarios
|
||||
*/
|
||||
|
||||
import { createSynth } from '../../src/index.js';
|
||||
|
||||
// Salesforce Lead Schema
|
||||
const leadSchema = {
|
||||
leadId: { type: 'string', required: true },
|
||||
firstName: { type: 'string', required: true },
|
||||
lastName: { type: 'string', required: true },
|
||||
email: { type: 'string', required: true },
|
||||
phone: { type: 'string', required: false },
|
||||
company: { type: 'string', required: true },
|
||||
title: { type: 'string', required: true },
|
||||
industry: { type: 'string', required: true },
|
||||
numberOfEmployees: { type: 'number', required: false },
|
||||
annualRevenue: { type: 'number', required: false },
|
||||
leadSource: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
rating: { type: 'string', required: true },
|
||||
address: { type: 'object', required: false, properties: {
|
||||
street: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
postalCode: { type: 'string' },
|
||||
country: { type: 'string' }
|
||||
}},
|
||||
description: { type: 'string', required: false },
|
||||
website: { type: 'string', required: false },
|
||||
leadScore: { type: 'number', required: true },
|
||||
conversionProbability: { type: 'number', required: true },
|
||||
ownerId: { type: 'string', required: true },
|
||||
ownerName: { type: 'string', required: true },
|
||||
createdDate: { type: 'string', required: true },
|
||||
lastActivityDate: { type: 'string', required: false },
|
||||
convertedDate: { type: 'string', required: false },
|
||||
convertedAccountId: { type: 'string', required: false },
|
||||
convertedContactId: { type: 'string', required: false },
|
||||
convertedOpportunityId: { type: 'string', required: false }
|
||||
};
|
||||
|
||||
// Salesforce Sales Pipeline (Opportunity) Schema
|
||||
const opportunitySchema = {
|
||||
opportunityId: { type: 'string', required: true },
|
||||
opportunityName: { type: 'string', required: true },
|
||||
accountId: { type: 'string', required: true },
|
||||
accountName: { type: 'string', required: true },
|
||||
type: { type: 'string', required: true },
|
||||
stage: { type: 'string', required: true },
|
||||
amount: { type: 'number', required: true },
|
||||
probability: { type: 'number', required: true },
|
||||
expectedRevenue: { type: 'number', required: true },
|
||||
closeDate: { type: 'string', required: true },
|
||||
nextStep: { type: 'string', required: false },
|
||||
leadSource: { type: 'string', required: true },
|
||||
campaignId: { type: 'string', required: false },
|
||||
ownerId: { type: 'string', required: true },
|
||||
ownerName: { type: 'string', required: true },
|
||||
createdDate: { type: 'string', required: true },
|
||||
lastModifiedDate: { type: 'string', required: true },
|
||||
products: { type: 'array', required: true, items: {
|
||||
productId: { type: 'string' },
|
||||
productName: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
listPrice: { type: 'number' },
|
||||
salesPrice: { type: 'number' },
|
||||
discount: { type: 'number' },
|
||||
totalPrice: { type: 'number' }
|
||||
}},
|
||||
competitors: { type: 'array', required: false },
|
||||
description: { type: 'string', required: false },
|
||||
isClosed: { type: 'boolean', required: true },
|
||||
isWon: { type: 'boolean', required: false },
|
||||
lostReason: { type: 'string', required: false },
|
||||
forecastCategory: { type: 'string', required: true }
|
||||
};
|
||||
|
||||
// HubSpot Contact Interaction Schema
|
||||
const contactInteractionSchema = {
|
||||
interactionId: { type: 'string', required: true },
|
||||
contactId: { type: 'string', required: true },
|
||||
contactEmail: { type: 'string', required: true },
|
||||
interactionType: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
channel: { type: 'string', required: true },
|
||||
subject: { type: 'string', required: false },
|
||||
body: { type: 'string', required: false },
|
||||
duration: { type: 'number', required: false },
|
||||
outcome: { type: 'string', required: false },
|
||||
sentiment: { type: 'string', required: false },
|
||||
engagement: { type: 'object', required: true, properties: {
|
||||
opened: { type: 'boolean' },
|
||||
clicked: { type: 'boolean' },
|
||||
replied: { type: 'boolean' },
|
||||
bounced: { type: 'boolean' },
|
||||
unsubscribed: { type: 'boolean' }
|
||||
}},
|
||||
associatedDealId: { type: 'string', required: false },
|
||||
associatedTicketId: { type: 'string', required: false },
|
||||
ownerId: { type: 'string', required: true },
|
||||
properties: { type: 'object', required: false }
|
||||
};
|
||||
|
||||
// Microsoft Dynamics 365 Account Management Schema
|
||||
const accountSchema = {
|
||||
accountId: { type: 'string', required: true },
|
||||
accountName: { type: 'string', required: true },
|
||||
accountNumber: { type: 'string', required: true },
|
||||
parentAccountId: { type: 'string', required: false },
|
||||
accountType: { type: 'string', required: true },
|
||||
industry: { type: 'string', required: true },
|
||||
subIndustry: { type: 'string', required: false },
|
||||
annualRevenue: { type: 'number', required: true },
|
||||
numberOfEmployees: { type: 'number', required: true },
|
||||
ownership: { type: 'string', required: true },
|
||||
website: { type: 'string', required: false },
|
||||
phone: { type: 'string', required: true },
|
||||
fax: { type: 'string', required: false },
|
||||
billingAddress: { type: 'object', required: true, properties: {
|
||||
street1: { type: 'string' },
|
||||
street2: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
stateProvince: { type: 'string' },
|
||||
postalCode: { type: 'string' },
|
||||
country: { type: 'string' }
|
||||
}},
|
||||
shippingAddress: { type: 'object', required: true, properties: {
|
||||
street1: { type: 'string' },
|
||||
street2: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
stateProvince: { type: 'string' },
|
||||
postalCode: { type: 'string' },
|
||||
country: { type: 'string' }
|
||||
}},
|
||||
primaryContact: { type: 'object', required: true, properties: {
|
||||
contactId: { type: 'string' },
|
||||
fullName: { type: 'string' },
|
||||
title: { type: 'string' },
|
||||
email: { type: 'string' },
|
||||
phone: { type: 'string' }
|
||||
}},
|
||||
accountRating: { type: 'string', required: true },
|
||||
creditLimit: { type: 'number', required: false },
|
||||
paymentTerms: { type: 'string', required: true },
|
||||
preferredContactMethod: { type: 'string', required: true },
|
||||
ownerId: { type: 'string', required: true },
|
||||
ownerName: { type: 'string', required: true },
|
||||
teamId: { type: 'string', required: false },
|
||||
territory: { type: 'string', required: true },
|
||||
createdOn: { type: 'string', required: true },
|
||||
modifiedOn: { type: 'string', required: true },
|
||||
lastInteractionDate: { type: 'string', required: false },
|
||||
description: { type: 'string', required: false }
|
||||
};
|
||||
|
||||
// Salesforce Service Cloud Support Ticket Schema
|
||||
const supportTicketSchema = {
|
||||
caseId: { type: 'string', required: true },
|
||||
caseNumber: { type: 'string', required: true },
|
||||
subject: { type: 'string', required: true },
|
||||
description: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
priority: { type: 'string', required: true },
|
||||
severity: { type: 'string', required: true },
|
||||
type: { type: 'string', required: true },
|
||||
origin: { type: 'string', required: true },
|
||||
reason: { type: 'string', required: false },
|
||||
contactId: { type: 'string', required: true },
|
||||
contactName: { type: 'string', required: true },
|
||||
contactEmail: { type: 'string', required: true },
|
||||
contactPhone: { type: 'string', required: false },
|
||||
accountId: { type: 'string', required: true },
|
||||
accountName: { type: 'string', required: true },
|
||||
productId: { type: 'string', required: false },
|
||||
productName: { type: 'string', required: false },
|
||||
ownerId: { type: 'string', required: true },
|
||||
ownerName: { type: 'string', required: true },
|
||||
createdDate: { type: 'string', required: true },
|
||||
closedDate: { type: 'string', required: false },
|
||||
firstResponseDate: { type: 'string', required: false },
|
||||
firstResponseSLA: { type: 'number', required: true },
|
||||
resolutionSLA: { type: 'number', required: true },
|
||||
escalated: { type: 'boolean', required: true },
|
||||
escalationDate: { type: 'string', required: false },
|
||||
resolution: { type: 'string', required: false },
|
||||
comments: { type: 'array', required: false, items: {
|
||||
commentId: { type: 'string' },
|
||||
author: { type: 'string' },
|
||||
timestamp: { type: 'string' },
|
||||
text: { type: 'string' },
|
||||
isPublic: { type: 'boolean' }
|
||||
}},
|
||||
satisfaction: { type: 'object', required: false, properties: {
|
||||
score: { type: 'number' },
|
||||
feedback: { type: 'string' },
|
||||
surveyDate: { type: 'string' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Customer Lifetime Value Schema
|
||||
const customerLifetimeValueSchema = {
|
||||
customerId: { type: 'string', required: true },
|
||||
customerName: { type: 'string', required: true },
|
||||
segment: { type: 'string', required: true },
|
||||
acquisitionDate: { type: 'string', required: true },
|
||||
acquisitionChannel: { type: 'string', required: true },
|
||||
acquisitionCost: { type: 'number', required: true },
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
totalRevenue: { type: 'number' },
|
||||
totalOrders: { type: 'number' },
|
||||
averageOrderValue: { type: 'number' },
|
||||
totalProfit: { type: 'number' },
|
||||
profitMargin: { type: 'number' },
|
||||
retentionRate: { type: 'number' },
|
||||
churnProbability: { type: 'number' }
|
||||
}},
|
||||
ltv: { type: 'object', required: true, properties: {
|
||||
currentLTV: { type: 'number' },
|
||||
predictedLTV: { type: 'number' },
|
||||
ltvCACRatio: { type: 'number' },
|
||||
paybackPeriod: { type: 'number' },
|
||||
timeHorizon: { type: 'string' }
|
||||
}},
|
||||
engagement: { type: 'object', required: true, properties: {
|
||||
lastPurchaseDate: { type: 'string' },
|
||||
daysSinceLastPurchase: { type: 'number' },
|
||||
averageDaysBetweenPurchases: { type: 'number' },
|
||||
emailOpenRate: { type: 'number' },
|
||||
emailClickRate: { type: 'number' },
|
||||
websiteVisits: { type: 'number' },
|
||||
supportTickets: { type: 'number' },
|
||||
npsScore: { type: 'number' }
|
||||
}},
|
||||
crossSell: { type: 'array', required: false, items: {
|
||||
productCategory: { type: 'string' },
|
||||
probability: { type: 'number' },
|
||||
potentialRevenue: { type: 'number' }
|
||||
}},
|
||||
churnRisk: { type: 'object', required: true, properties: {
|
||||
score: { type: 'number' },
|
||||
factors: { type: 'array' },
|
||||
mitigationActions: { type: 'array' }
|
||||
}}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate Salesforce Leads
|
||||
*/
|
||||
export async function generateLeads(count: number = 100) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} Salesforce leads...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: leadSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} leads in ${result.metadata.duration}ms`);
|
||||
console.log('Sample lead:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Sales Pipeline (Opportunities)
|
||||
*/
|
||||
export async function generateOpportunities(count: number = 75) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} sales opportunities...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: opportunitySchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} opportunities in ${result.metadata.duration}ms`);
|
||||
console.log('Sample opportunity:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate HubSpot Contact Interactions (time-series)
|
||||
*/
|
||||
export async function generateContactInteractions(count: number = 500) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} contact interactions...`);
|
||||
|
||||
const result = await synth.generateEvents({
|
||||
count,
|
||||
eventTypes: ['email', 'call', 'meeting', 'chat', 'website_visit', 'form_submission', 'social_media'],
|
||||
distribution: 'poisson',
|
||||
timeRange: {
|
||||
start: new Date(Date.now() - 90 * 24 * 60 * 60 * 1000), // 90 days ago
|
||||
end: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} interactions in ${result.metadata.duration}ms`);
|
||||
console.log('Sample interaction:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Microsoft Dynamics 365 Accounts
|
||||
*/
|
||||
export async function generateAccounts(count: number = 50) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} CRM accounts...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: accountSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} accounts in ${result.metadata.duration}ms`);
|
||||
console.log('Sample account:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Salesforce Service Cloud Support Tickets
|
||||
*/
|
||||
export async function generateSupportTickets(count: number = 200) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} support tickets...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: supportTicketSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} tickets in ${result.metadata.duration}ms`);
|
||||
console.log('Sample ticket:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Customer Lifetime Value Analysis
|
||||
*/
|
||||
export async function generateCustomerLTV(count: number = 100) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} customer LTV records...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: customerLifetimeValueSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} LTV records in ${result.metadata.duration}ms`);
|
||||
console.log('Sample LTV:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate complete sales funnel with conversion metrics
|
||||
*/
|
||||
export async function simulateSalesFunnel() {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
|
||||
console.log('Simulating complete sales funnel...');
|
||||
console.time('Sales funnel simulation');
|
||||
|
||||
// Generate funnel stages in sequence to maintain conversion logic
|
||||
const leads = await generateLeads(1000);
|
||||
const qualifiedLeadCount = Math.floor(leads.data.length * 0.4); // 40% qualification rate
|
||||
|
||||
const opportunities = await generateOpportunities(qualifiedLeadCount);
|
||||
const wonOpportunityCount = Math.floor(opportunities.data.length * 0.25); // 25% win rate
|
||||
|
||||
const accounts = await generateAccounts(wonOpportunityCount);
|
||||
|
||||
console.timeEnd('Sales funnel simulation');
|
||||
|
||||
const metrics = {
|
||||
leads: leads.data.length,
|
||||
qualifiedLeads: qualifiedLeadCount,
|
||||
opportunities: opportunities.data.length,
|
||||
wonDeals: wonOpportunityCount,
|
||||
accounts: accounts.data.length,
|
||||
conversionRates: {
|
||||
leadToQualified: (qualifiedLeadCount / leads.data.length * 100).toFixed(2) + '%',
|
||||
qualifiedToOpportunity: '100%', // By design
|
||||
opportunityToWon: (wonOpportunityCount / opportunities.data.length * 100).toFixed(2) + '%',
|
||||
leadToCustomer: (accounts.data.length / leads.data.length * 100).toFixed(2) + '%'
|
||||
},
|
||||
totalPipelineValue: opportunities.data.reduce((sum: number, opp: any) => sum + (opp.amount || 0), 0),
|
||||
averageDealSize: opportunities.data.reduce((sum: number, opp: any) => sum + (opp.amount || 0), 0) / opportunities.data.length
|
||||
};
|
||||
|
||||
console.log('Sales Funnel Metrics:', metrics);
|
||||
|
||||
return {
|
||||
leads: leads.data,
|
||||
opportunities: opportunities.data,
|
||||
accounts: accounts.data,
|
||||
metrics
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate complete CRM dataset in parallel
|
||||
*/
|
||||
export async function generateCompleteCRMDataset() {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
|
||||
console.log('Generating complete CRM dataset in parallel...');
|
||||
console.time('Total CRM generation');
|
||||
|
||||
const [leads, opportunities, interactions, accounts, tickets, ltv] =
|
||||
await Promise.all([
|
||||
generateLeads(100),
|
||||
generateOpportunities(50),
|
||||
generateContactInteractions(300),
|
||||
generateAccounts(30),
|
||||
generateSupportTickets(100),
|
||||
generateCustomerLTV(50)
|
||||
]);
|
||||
|
||||
console.timeEnd('Total CRM generation');
|
||||
|
||||
return {
|
||||
leads: leads.data,
|
||||
opportunities: opportunities.data,
|
||||
interactions: interactions.data,
|
||||
accounts: accounts.data,
|
||||
supportTickets: tickets.data,
|
||||
customerLTV: ltv.data,
|
||||
metadata: {
|
||||
totalRecords: leads.data.length + opportunities.data.length +
|
||||
interactions.data.length + accounts.data.length +
|
||||
tickets.data.length + ltv.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream CRM interactions for real-time analysis
|
||||
*/
|
||||
export async function streamCRMInteractions(duration: number = 3600) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
streaming: true
|
||||
});
|
||||
|
||||
console.log(`Streaming CRM interactions for ${duration} seconds...`);
|
||||
|
||||
const endTime = Date.now() + (duration * 1000);
|
||||
let interactionCount = 0;
|
||||
|
||||
while (Date.now() < endTime) {
|
||||
for await (const interaction of synth.generateStream('events', {
|
||||
count: 10,
|
||||
eventTypes: ['email', 'call', 'meeting', 'chat'],
|
||||
distribution: 'poisson'
|
||||
})) {
|
||||
interactionCount++;
|
||||
console.log(`[${new Date().toISOString()}] Interaction ${interactionCount}:`, interaction);
|
||||
|
||||
// Simulate real-time processing delay
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Completed streaming ${interactionCount} interactions`);
|
||||
}
|
||||
|
||||
// Example usage
|
||||
async function runCRMExamples() {
|
||||
console.log('=== CRM Data Generation Examples ===\n');
|
||||
|
||||
// Example 1: Lead Generation
|
||||
console.log('1. Lead Generation (Salesforce)');
|
||||
await generateLeads(10);
|
||||
|
||||
// Example 2: Sales Pipeline
|
||||
console.log('\n2. Sales Pipeline (Opportunities)');
|
||||
await generateOpportunities(10);
|
||||
|
||||
// Example 3: Contact Interactions
|
||||
console.log('\n3. Contact Interactions (HubSpot)');
|
||||
await generateContactInteractions(50);
|
||||
|
||||
// Example 4: Account Management
|
||||
console.log('\n4. Account Management (Dynamics 365)');
|
||||
await generateAccounts(5);
|
||||
|
||||
// Example 5: Support Tickets
|
||||
console.log('\n5. Support Tickets (Service Cloud)');
|
||||
await generateSupportTickets(20);
|
||||
|
||||
// Example 6: Customer LTV
|
||||
console.log('\n6. Customer Lifetime Value');
|
||||
await generateCustomerLTV(10);
|
||||
|
||||
// Example 7: Sales Funnel Simulation
|
||||
console.log('\n7. Complete Sales Funnel Simulation');
|
||||
await simulateSalesFunnel();
|
||||
|
||||
// Example 8: Complete CRM dataset
|
||||
console.log('\n8. Complete CRM Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteCRMDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
|
||||
// Uncomment to run
|
||||
// runCRMExamples().catch(console.error);
|
||||
|
||||
export default {
|
||||
generateLeads,
|
||||
generateOpportunities,
|
||||
generateContactInteractions,
|
||||
generateAccounts,
|
||||
generateSupportTickets,
|
||||
generateCustomerLTV,
|
||||
simulateSalesFunnel,
|
||||
generateCompleteCRMDataset,
|
||||
streamCRMInteractions
|
||||
};
|
||||
59
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.d.ts
vendored
Normal file
59
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.d.ts
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Enterprise Resource Planning (ERP) Data Generation
|
||||
* Simulates SAP, Oracle ERP, and Microsoft Dynamics integration scenarios
|
||||
*/
|
||||
/**
|
||||
* Generate SAP Material Management data
|
||||
*/
|
||||
export declare function generateMaterialData(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate SAP Purchase Orders
|
||||
*/
|
||||
export declare function generatePurchaseOrders(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Oracle Supply Chain Events (time-series)
|
||||
*/
|
||||
export declare function generateSupplyChainEvents(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Microsoft Dynamics 365 Manufacturing Orders
|
||||
*/
|
||||
export declare function generateManufacturingOrders(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate multi-location warehouse inventory snapshots
|
||||
*/
|
||||
export declare function generateWarehouseInventory(warehouseCount?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate SAP Financial Transactions (FI/CO)
|
||||
*/
|
||||
export declare function generateFinancialTransactions(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate complete ERP dataset in parallel
|
||||
*/
|
||||
export declare function generateCompleteERPDataset(): Promise<{
|
||||
materials: unknown[];
|
||||
purchaseOrders: unknown[];
|
||||
supplyChainEvents: unknown[];
|
||||
manufacturingOrders: unknown[];
|
||||
warehouseInventory: unknown[];
|
||||
financialTransactions: unknown[];
|
||||
metadata: {
|
||||
totalRecords: number;
|
||||
generatedAt: string;
|
||||
};
|
||||
}>;
|
||||
/**
|
||||
* Stream ERP data generation for large datasets
|
||||
*/
|
||||
export declare function streamERPData(type: 'material' | 'po' | 'transaction', count?: number): Promise<void>;
|
||||
declare const _default: {
|
||||
generateMaterialData: typeof generateMaterialData;
|
||||
generatePurchaseOrders: typeof generatePurchaseOrders;
|
||||
generateSupplyChainEvents: typeof generateSupplyChainEvents;
|
||||
generateManufacturingOrders: typeof generateManufacturingOrders;
|
||||
generateWarehouseInventory: typeof generateWarehouseInventory;
|
||||
generateFinancialTransactions: typeof generateFinancialTransactions;
|
||||
generateCompleteERPDataset: typeof generateCompleteERPDataset;
|
||||
streamERPData: typeof streamERPData;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=erp-data.d.ts.map
|
||||
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.d.ts.map
vendored
Normal file
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.d.ts.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"erp-data.d.ts","sourceRoot":"","sources":["erp-data.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwPH;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,GAAE,MAAY,mEAkB7D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,GAAE,MAAW,mEAiB9D;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,GAAE,MAAY,mEAsBlE;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,GAAE,MAAW,mEAiBnE;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,cAAc,GAAE,MAAU,mEAiB1E;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,GAAE,MAAY,mEAiBtE;AAED;;GAEG;AACH,wBAAsB,0BAA0B;;;;;;;;;;;GAmC/C;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,aAAa,EAAE,KAAK,GAAE,MAAa,iBA2BhG;;;;;;;;;;;AAuCD,wBASE"}
|
||||
461
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.js
vendored
Normal file
461
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.js
vendored
Normal file
@@ -0,0 +1,461 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Enterprise Resource Planning (ERP) Data Generation
|
||||
* Simulates SAP, Oracle ERP, and Microsoft Dynamics integration scenarios
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateMaterialData = generateMaterialData;
|
||||
exports.generatePurchaseOrders = generatePurchaseOrders;
|
||||
exports.generateSupplyChainEvents = generateSupplyChainEvents;
|
||||
exports.generateManufacturingOrders = generateManufacturingOrders;
|
||||
exports.generateWarehouseInventory = generateWarehouseInventory;
|
||||
exports.generateFinancialTransactions = generateFinancialTransactions;
|
||||
exports.generateCompleteERPDataset = generateCompleteERPDataset;
|
||||
exports.streamERPData = streamERPData;
|
||||
const index_js_1 = require("../../src/index.js");
|
||||
// SAP S/4HANA Material Management Schema
|
||||
const materialSchema = {
|
||||
materialNumber: { type: 'string', required: true },
|
||||
description: { type: 'string', required: true },
|
||||
materialType: { type: 'string', required: true },
|
||||
baseUnitOfMeasure: { type: 'string', required: true },
|
||||
materialGroup: { type: 'string', required: true },
|
||||
grossWeight: { type: 'number', required: true },
|
||||
netWeight: { type: 'number', required: true },
|
||||
weightUnit: { type: 'string', required: true },
|
||||
division: { type: 'string', required: false },
|
||||
plant: { type: 'string', required: true },
|
||||
storageLocation: { type: 'string', required: true },
|
||||
stockQuantity: { type: 'number', required: true },
|
||||
reservedQuantity: { type: 'number', required: true },
|
||||
availableQuantity: { type: 'number', required: true },
|
||||
valuationClass: { type: 'string', required: true },
|
||||
priceControl: { type: 'string', required: true },
|
||||
standardPrice: { type: 'number', required: true },
|
||||
movingAveragePrice: { type: 'number', required: true },
|
||||
priceUnit: { type: 'number', required: true },
|
||||
currency: { type: 'string', required: true }
|
||||
};
|
||||
// SAP Purchase Order Schema
|
||||
const purchaseOrderSchema = {
|
||||
poNumber: { type: 'string', required: true },
|
||||
poDate: { type: 'string', required: true },
|
||||
vendor: { type: 'object', required: true, properties: {
|
||||
vendorId: { type: 'string' },
|
||||
vendorName: { type: 'string' },
|
||||
country: { type: 'string' },
|
||||
paymentTerms: { type: 'string' }
|
||||
} },
|
||||
companyCode: { type: 'string', required: true },
|
||||
purchasingOrg: { type: 'string', required: true },
|
||||
purchasingGroup: { type: 'string', required: true },
|
||||
documentType: { type: 'string', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
exchangeRate: { type: 'number', required: true },
|
||||
items: { type: 'array', required: true, items: {
|
||||
itemNumber: { type: 'string' },
|
||||
materialNumber: { type: 'string' },
|
||||
shortText: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
unit: { type: 'string' },
|
||||
netPrice: { type: 'number' },
|
||||
priceUnit: { type: 'number' },
|
||||
netValue: { type: 'number' },
|
||||
taxCode: { type: 'string' },
|
||||
plant: { type: 'string' },
|
||||
storageLocation: { type: 'string' },
|
||||
deliveryDate: { type: 'string' },
|
||||
accountAssignment: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
glAccount: { type: 'string' }
|
||||
} },
|
||||
totalAmount: { type: 'number', required: true },
|
||||
taxAmount: { type: 'number', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
createdBy: { type: 'string', required: true },
|
||||
changedBy: { type: 'string', required: false }
|
||||
};
|
||||
// Oracle ERP Supply Chain Event Schema
|
||||
const supplyChainEventSchema = {
|
||||
eventId: { type: 'string', required: true },
|
||||
eventType: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
organizationId: { type: 'string', required: true },
|
||||
location: { type: 'object', required: true, properties: {
|
||||
locationId: { type: 'string' },
|
||||
locationName: { type: 'string' },
|
||||
locationType: { type: 'string' },
|
||||
address: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
country: { type: 'string' },
|
||||
postalCode: { type: 'string' }
|
||||
} },
|
||||
shipment: { type: 'object', required: false, properties: {
|
||||
shipmentNumber: { type: 'string' },
|
||||
carrier: { type: 'string' },
|
||||
trackingNumber: { type: 'string' },
|
||||
expectedDelivery: { type: 'string' },
|
||||
actualDelivery: { type: 'string' },
|
||||
status: { type: 'string' }
|
||||
} },
|
||||
inventory: { type: 'object', required: false, properties: {
|
||||
itemId: { type: 'string' },
|
||||
itemDescription: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
uom: { type: 'string' },
|
||||
lotNumber: { type: 'string' },
|
||||
serialNumbers: { type: 'array' }
|
||||
} },
|
||||
impact: { type: 'string', required: true },
|
||||
severity: { type: 'string', required: true },
|
||||
resolution: { type: 'string', required: false }
|
||||
};
|
||||
// Microsoft Dynamics 365 Manufacturing Process Schema
|
||||
const manufacturingProcessSchema = {
|
||||
productionOrderId: { type: 'string', required: true },
|
||||
orderType: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
priority: { type: 'number', required: true },
|
||||
plannedStartDate: { type: 'string', required: true },
|
||||
plannedEndDate: { type: 'string', required: true },
|
||||
actualStartDate: { type: 'string', required: false },
|
||||
actualEndDate: { type: 'string', required: false },
|
||||
product: { type: 'object', required: true, properties: {
|
||||
itemNumber: { type: 'string' },
|
||||
productName: { type: 'string' },
|
||||
configurationId: { type: 'string' },
|
||||
bom: { type: 'string' },
|
||||
routingNumber: { type: 'string' }
|
||||
} },
|
||||
quantity: { type: 'object', required: true, properties: {
|
||||
ordered: { type: 'number' },
|
||||
started: { type: 'number' },
|
||||
completed: { type: 'number' },
|
||||
scrapped: { type: 'number' },
|
||||
remaining: { type: 'number' },
|
||||
unit: { type: 'string' }
|
||||
} },
|
||||
warehouse: { type: 'string', required: true },
|
||||
site: { type: 'string', required: true },
|
||||
resourceGroup: { type: 'string', required: true },
|
||||
costingLotSize: { type: 'number', required: true },
|
||||
operations: { type: 'array', required: true, items: {
|
||||
operationNumber: { type: 'string' },
|
||||
operationName: { type: 'string' },
|
||||
workCenter: { type: 'string' },
|
||||
setupTime: { type: 'number' },
|
||||
processTime: { type: 'number' },
|
||||
queueTime: { type: 'number' },
|
||||
laborCost: { type: 'number' },
|
||||
machineCost: { type: 'number' },
|
||||
status: { type: 'string' }
|
||||
} },
|
||||
materials: { type: 'array', required: true, items: {
|
||||
lineNumber: { type: 'string' },
|
||||
itemNumber: { type: 'string' },
|
||||
itemName: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
consumed: { type: 'number' },
|
||||
unit: { type: 'string' },
|
||||
warehouse: { type: 'string' },
|
||||
batchNumber: { type: 'string' }
|
||||
} }
|
||||
};
|
||||
// Multi-location Warehouse Management Schema
|
||||
const warehouseInventorySchema = {
|
||||
inventoryId: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
warehouse: { type: 'object', required: true, properties: {
|
||||
warehouseId: { type: 'string' },
|
||||
warehouseName: { type: 'string' },
|
||||
type: { type: 'string' },
|
||||
capacity: { type: 'number' },
|
||||
utilization: { type: 'number' },
|
||||
address: { type: 'object', properties: {
|
||||
street: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
country: { type: 'string' },
|
||||
postalCode: { type: 'string' }
|
||||
} }
|
||||
} },
|
||||
zones: { type: 'array', required: true, items: {
|
||||
zoneId: { type: 'string' },
|
||||
zoneName: { type: 'string' },
|
||||
zoneType: { type: 'string' },
|
||||
temperature: { type: 'number' },
|
||||
humidity: { type: 'number' },
|
||||
items: { type: 'array', items: {
|
||||
sku: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
unit: { type: 'string' },
|
||||
location: { type: 'string' },
|
||||
lotNumber: { type: 'string' },
|
||||
expiryDate: { type: 'string' },
|
||||
value: { type: 'number' }
|
||||
} }
|
||||
} },
|
||||
movements: { type: 'array', required: true, items: {
|
||||
movementId: { type: 'string' },
|
||||
timestamp: { type: 'string' },
|
||||
type: { type: 'string' },
|
||||
fromLocation: { type: 'string' },
|
||||
toLocation: { type: 'string' },
|
||||
sku: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
operator: { type: 'string' },
|
||||
reason: { type: 'string' }
|
||||
} },
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
totalItems: { type: 'number' },
|
||||
totalValue: { type: 'number' },
|
||||
turnoverRate: { type: 'number' },
|
||||
fillRate: { type: 'number' },
|
||||
accuracyRate: { type: 'number' }
|
||||
} }
|
||||
};
|
||||
// Financial Transaction Schema (SAP FI/CO)
|
||||
const financialTransactionSchema = {
|
||||
documentNumber: { type: 'string', required: true },
|
||||
fiscalYear: { type: 'string', required: true },
|
||||
companyCode: { type: 'string', required: true },
|
||||
documentType: { type: 'string', required: true },
|
||||
documentDate: { type: 'string', required: true },
|
||||
postingDate: { type: 'string', required: true },
|
||||
period: { type: 'number', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
exchangeRate: { type: 'number', required: true },
|
||||
reference: { type: 'string', required: false },
|
||||
headerText: { type: 'string', required: false },
|
||||
lineItems: { type: 'array', required: true, items: {
|
||||
lineNumber: { type: 'string' },
|
||||
glAccount: { type: 'string' },
|
||||
accountDescription: { type: 'string' },
|
||||
debitCredit: { type: 'string' },
|
||||
amount: { type: 'number' },
|
||||
taxCode: { type: 'string' },
|
||||
taxAmount: { type: 'number' },
|
||||
costCenter: { type: 'string' },
|
||||
profitCenter: { type: 'string' },
|
||||
segment: { type: 'string' },
|
||||
assignment: { type: 'string' },
|
||||
text: { type: 'string' },
|
||||
businessArea: { type: 'string' }
|
||||
} },
|
||||
totalDebit: { type: 'number', required: true },
|
||||
totalCredit: { type: 'number', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
parkedBy: { type: 'string', required: false },
|
||||
postedBy: { type: 'string', required: false },
|
||||
reversalDocument: { type: 'string', required: false }
|
||||
};
|
||||
/**
|
||||
* Generate SAP Material Management data
|
||||
*/
|
||||
async function generateMaterialData(count = 100) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
console.log(`Generating ${count} SAP material master records...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: materialSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} materials in ${result.metadata.duration}ms`);
|
||||
console.log('Sample material:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate SAP Purchase Orders
|
||||
*/
|
||||
async function generatePurchaseOrders(count = 50) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} SAP purchase orders...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: purchaseOrderSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} POs in ${result.metadata.duration}ms`);
|
||||
console.log('Sample PO:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Oracle Supply Chain Events (time-series)
|
||||
*/
|
||||
async function generateSupplyChainEvents(count = 200) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} supply chain events...`);
|
||||
const result = await synth.generateEvents({
|
||||
count,
|
||||
eventTypes: ['shipment_departure', 'shipment_arrival', 'inventory_adjustment',
|
||||
'quality_check', 'customs_clearance', 'delivery_exception'],
|
||||
distribution: 'poisson',
|
||||
timeRange: {
|
||||
start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days ago
|
||||
end: new Date()
|
||||
}
|
||||
});
|
||||
console.log(`Generated ${result.data.length} events in ${result.metadata.duration}ms`);
|
||||
console.log('Sample event:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Microsoft Dynamics 365 Manufacturing Orders
|
||||
*/
|
||||
async function generateManufacturingOrders(count = 75) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} manufacturing orders...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: manufacturingProcessSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} orders in ${result.metadata.duration}ms`);
|
||||
console.log('Sample order:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate multi-location warehouse inventory snapshots
|
||||
*/
|
||||
async function generateWarehouseInventory(warehouseCount = 5) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating inventory for ${warehouseCount} warehouses...`);
|
||||
const result = await synth.generateStructured({
|
||||
count: warehouseCount,
|
||||
schema: warehouseInventorySchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} warehouse snapshots in ${result.metadata.duration}ms`);
|
||||
console.log('Sample warehouse:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate SAP Financial Transactions (FI/CO)
|
||||
*/
|
||||
async function generateFinancialTransactions(count = 500) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} financial transactions...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: financialTransactionSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} transactions in ${result.metadata.duration}ms`);
|
||||
console.log('Sample transaction:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate complete ERP dataset in parallel
|
||||
*/
|
||||
async function generateCompleteERPDataset() {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
console.log('Generating complete ERP dataset in parallel...');
|
||||
console.time('Total ERP generation');
|
||||
const [materials, purchaseOrders, supplyChain, manufacturing, warehouses, financial] = await Promise.all([
|
||||
generateMaterialData(50),
|
||||
generatePurchaseOrders(25),
|
||||
generateSupplyChainEvents(100),
|
||||
generateManufacturingOrders(30),
|
||||
generateWarehouseInventory(3),
|
||||
generateFinancialTransactions(200)
|
||||
]);
|
||||
console.timeEnd('Total ERP generation');
|
||||
return {
|
||||
materials: materials.data,
|
||||
purchaseOrders: purchaseOrders.data,
|
||||
supplyChainEvents: supplyChain.data,
|
||||
manufacturingOrders: manufacturing.data,
|
||||
warehouseInventory: warehouses.data,
|
||||
financialTransactions: financial.data,
|
||||
metadata: {
|
||||
totalRecords: materials.data.length + purchaseOrders.data.length +
|
||||
supplyChain.data.length + manufacturing.data.length +
|
||||
warehouses.data.length + financial.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Stream ERP data generation for large datasets
|
||||
*/
|
||||
async function streamERPData(type, count = 1000) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
streaming: true
|
||||
});
|
||||
const schemaMap = {
|
||||
material: materialSchema,
|
||||
po: purchaseOrderSchema,
|
||||
transaction: financialTransactionSchema
|
||||
};
|
||||
console.log(`Streaming ${count} ${type} records...`);
|
||||
let recordCount = 0;
|
||||
for await (const record of synth.generateStream('structured', {
|
||||
count,
|
||||
schema: schemaMap[type],
|
||||
format: 'json'
|
||||
})) {
|
||||
recordCount++;
|
||||
if (recordCount % 100 === 0) {
|
||||
console.log(`Streamed ${recordCount} records...`);
|
||||
}
|
||||
}
|
||||
console.log(`Completed streaming ${recordCount} ${type} records`);
|
||||
}
|
||||
// Example usage
|
||||
async function runERPExamples() {
|
||||
console.log('=== ERP Data Generation Examples ===\n');
|
||||
// Example 1: Material Master Data
|
||||
console.log('1. Material Master Data (SAP MM)');
|
||||
await generateMaterialData(10);
|
||||
// Example 2: Purchase Orders
|
||||
console.log('\n2. Purchase Orders (SAP MM)');
|
||||
await generatePurchaseOrders(5);
|
||||
// Example 3: Supply Chain Events
|
||||
console.log('\n3. Supply Chain Events (Oracle)');
|
||||
await generateSupplyChainEvents(20);
|
||||
// Example 4: Manufacturing Orders
|
||||
console.log('\n4. Manufacturing Orders (Dynamics 365)');
|
||||
await generateManufacturingOrders(10);
|
||||
// Example 5: Warehouse Inventory
|
||||
console.log('\n5. Multi-location Warehouse Inventory');
|
||||
await generateWarehouseInventory(2);
|
||||
// Example 6: Financial Transactions
|
||||
console.log('\n6. Financial Transactions (SAP FI/CO)');
|
||||
await generateFinancialTransactions(25);
|
||||
// Example 7: Complete dataset in parallel
|
||||
console.log('\n7. Complete ERP Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteERPDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
// Uncomment to run
|
||||
// runERPExamples().catch(console.error);
|
||||
exports.default = {
|
||||
generateMaterialData,
|
||||
generatePurchaseOrders,
|
||||
generateSupplyChainEvents,
|
||||
generateManufacturingOrders,
|
||||
generateWarehouseInventory,
|
||||
generateFinancialTransactions,
|
||||
generateCompleteERPDataset,
|
||||
streamERPData
|
||||
};
|
||||
//# sourceMappingURL=erp-data.js.map
|
||||
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.js.map
vendored
Normal file
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
508
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.ts
vendored
Normal file
508
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/erp-data.ts
vendored
Normal file
@@ -0,0 +1,508 @@
|
||||
/**
|
||||
* Enterprise Resource Planning (ERP) Data Generation
|
||||
* Simulates SAP, Oracle ERP, and Microsoft Dynamics integration scenarios
|
||||
*/
|
||||
|
||||
import { createSynth } from '../../src/index.js';
|
||||
|
||||
// SAP S/4HANA Material Management Schema
|
||||
const materialSchema = {
|
||||
materialNumber: { type: 'string', required: true },
|
||||
description: { type: 'string', required: true },
|
||||
materialType: { type: 'string', required: true },
|
||||
baseUnitOfMeasure: { type: 'string', required: true },
|
||||
materialGroup: { type: 'string', required: true },
|
||||
grossWeight: { type: 'number', required: true },
|
||||
netWeight: { type: 'number', required: true },
|
||||
weightUnit: { type: 'string', required: true },
|
||||
division: { type: 'string', required: false },
|
||||
plant: { type: 'string', required: true },
|
||||
storageLocation: { type: 'string', required: true },
|
||||
stockQuantity: { type: 'number', required: true },
|
||||
reservedQuantity: { type: 'number', required: true },
|
||||
availableQuantity: { type: 'number', required: true },
|
||||
valuationClass: { type: 'string', required: true },
|
||||
priceControl: { type: 'string', required: true },
|
||||
standardPrice: { type: 'number', required: true },
|
||||
movingAveragePrice: { type: 'number', required: true },
|
||||
priceUnit: { type: 'number', required: true },
|
||||
currency: { type: 'string', required: true }
|
||||
};
|
||||
|
||||
// SAP Purchase Order Schema
|
||||
const purchaseOrderSchema = {
|
||||
poNumber: { type: 'string', required: true },
|
||||
poDate: { type: 'string', required: true },
|
||||
vendor: { type: 'object', required: true, properties: {
|
||||
vendorId: { type: 'string' },
|
||||
vendorName: { type: 'string' },
|
||||
country: { type: 'string' },
|
||||
paymentTerms: { type: 'string' }
|
||||
}},
|
||||
companyCode: { type: 'string', required: true },
|
||||
purchasingOrg: { type: 'string', required: true },
|
||||
purchasingGroup: { type: 'string', required: true },
|
||||
documentType: { type: 'string', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
exchangeRate: { type: 'number', required: true },
|
||||
items: { type: 'array', required: true, items: {
|
||||
itemNumber: { type: 'string' },
|
||||
materialNumber: { type: 'string' },
|
||||
shortText: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
unit: { type: 'string' },
|
||||
netPrice: { type: 'number' },
|
||||
priceUnit: { type: 'number' },
|
||||
netValue: { type: 'number' },
|
||||
taxCode: { type: 'string' },
|
||||
plant: { type: 'string' },
|
||||
storageLocation: { type: 'string' },
|
||||
deliveryDate: { type: 'string' },
|
||||
accountAssignment: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
glAccount: { type: 'string' }
|
||||
}},
|
||||
totalAmount: { type: 'number', required: true },
|
||||
taxAmount: { type: 'number', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
createdBy: { type: 'string', required: true },
|
||||
changedBy: { type: 'string', required: false }
|
||||
};
|
||||
|
||||
// Oracle ERP Supply Chain Event Schema
|
||||
const supplyChainEventSchema = {
|
||||
eventId: { type: 'string', required: true },
|
||||
eventType: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
organizationId: { type: 'string', required: true },
|
||||
location: { type: 'object', required: true, properties: {
|
||||
locationId: { type: 'string' },
|
||||
locationName: { type: 'string' },
|
||||
locationType: { type: 'string' },
|
||||
address: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
country: { type: 'string' },
|
||||
postalCode: { type: 'string' }
|
||||
}},
|
||||
shipment: { type: 'object', required: false, properties: {
|
||||
shipmentNumber: { type: 'string' },
|
||||
carrier: { type: 'string' },
|
||||
trackingNumber: { type: 'string' },
|
||||
expectedDelivery: { type: 'string' },
|
||||
actualDelivery: { type: 'string' },
|
||||
status: { type: 'string' }
|
||||
}},
|
||||
inventory: { type: 'object', required: false, properties: {
|
||||
itemId: { type: 'string' },
|
||||
itemDescription: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
uom: { type: 'string' },
|
||||
lotNumber: { type: 'string' },
|
||||
serialNumbers: { type: 'array' }
|
||||
}},
|
||||
impact: { type: 'string', required: true },
|
||||
severity: { type: 'string', required: true },
|
||||
resolution: { type: 'string', required: false }
|
||||
};
|
||||
|
||||
// Microsoft Dynamics 365 Manufacturing Process Schema
|
||||
const manufacturingProcessSchema = {
|
||||
productionOrderId: { type: 'string', required: true },
|
||||
orderType: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
priority: { type: 'number', required: true },
|
||||
plannedStartDate: { type: 'string', required: true },
|
||||
plannedEndDate: { type: 'string', required: true },
|
||||
actualStartDate: { type: 'string', required: false },
|
||||
actualEndDate: { type: 'string', required: false },
|
||||
product: { type: 'object', required: true, properties: {
|
||||
itemNumber: { type: 'string' },
|
||||
productName: { type: 'string' },
|
||||
configurationId: { type: 'string' },
|
||||
bom: { type: 'string' },
|
||||
routingNumber: { type: 'string' }
|
||||
}},
|
||||
quantity: { type: 'object', required: true, properties: {
|
||||
ordered: { type: 'number' },
|
||||
started: { type: 'number' },
|
||||
completed: { type: 'number' },
|
||||
scrapped: { type: 'number' },
|
||||
remaining: { type: 'number' },
|
||||
unit: { type: 'string' }
|
||||
}},
|
||||
warehouse: { type: 'string', required: true },
|
||||
site: { type: 'string', required: true },
|
||||
resourceGroup: { type: 'string', required: true },
|
||||
costingLotSize: { type: 'number', required: true },
|
||||
operations: { type: 'array', required: true, items: {
|
||||
operationNumber: { type: 'string' },
|
||||
operationName: { type: 'string' },
|
||||
workCenter: { type: 'string' },
|
||||
setupTime: { type: 'number' },
|
||||
processTime: { type: 'number' },
|
||||
queueTime: { type: 'number' },
|
||||
laborCost: { type: 'number' },
|
||||
machineCost: { type: 'number' },
|
||||
status: { type: 'string' }
|
||||
}},
|
||||
materials: { type: 'array', required: true, items: {
|
||||
lineNumber: { type: 'string' },
|
||||
itemNumber: { type: 'string' },
|
||||
itemName: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
consumed: { type: 'number' },
|
||||
unit: { type: 'string' },
|
||||
warehouse: { type: 'string' },
|
||||
batchNumber: { type: 'string' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Multi-location Warehouse Management Schema
|
||||
const warehouseInventorySchema = {
|
||||
inventoryId: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
warehouse: { type: 'object', required: true, properties: {
|
||||
warehouseId: { type: 'string' },
|
||||
warehouseName: { type: 'string' },
|
||||
type: { type: 'string' },
|
||||
capacity: { type: 'number' },
|
||||
utilization: { type: 'number' },
|
||||
address: { type: 'object', properties: {
|
||||
street: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
country: { type: 'string' },
|
||||
postalCode: { type: 'string' }
|
||||
}}
|
||||
}},
|
||||
zones: { type: 'array', required: true, items: {
|
||||
zoneId: { type: 'string' },
|
||||
zoneName: { type: 'string' },
|
||||
zoneType: { type: 'string' },
|
||||
temperature: { type: 'number' },
|
||||
humidity: { type: 'number' },
|
||||
items: { type: 'array', items: {
|
||||
sku: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
unit: { type: 'string' },
|
||||
location: { type: 'string' },
|
||||
lotNumber: { type: 'string' },
|
||||
expiryDate: { type: 'string' },
|
||||
value: { type: 'number' }
|
||||
}}
|
||||
}},
|
||||
movements: { type: 'array', required: true, items: {
|
||||
movementId: { type: 'string' },
|
||||
timestamp: { type: 'string' },
|
||||
type: { type: 'string' },
|
||||
fromLocation: { type: 'string' },
|
||||
toLocation: { type: 'string' },
|
||||
sku: { type: 'string' },
|
||||
quantity: { type: 'number' },
|
||||
operator: { type: 'string' },
|
||||
reason: { type: 'string' }
|
||||
}},
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
totalItems: { type: 'number' },
|
||||
totalValue: { type: 'number' },
|
||||
turnoverRate: { type: 'number' },
|
||||
fillRate: { type: 'number' },
|
||||
accuracyRate: { type: 'number' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Financial Transaction Schema (SAP FI/CO)
|
||||
const financialTransactionSchema = {
|
||||
documentNumber: { type: 'string', required: true },
|
||||
fiscalYear: { type: 'string', required: true },
|
||||
companyCode: { type: 'string', required: true },
|
||||
documentType: { type: 'string', required: true },
|
||||
documentDate: { type: 'string', required: true },
|
||||
postingDate: { type: 'string', required: true },
|
||||
period: { type: 'number', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
exchangeRate: { type: 'number', required: true },
|
||||
reference: { type: 'string', required: false },
|
||||
headerText: { type: 'string', required: false },
|
||||
lineItems: { type: 'array', required: true, items: {
|
||||
lineNumber: { type: 'string' },
|
||||
glAccount: { type: 'string' },
|
||||
accountDescription: { type: 'string' },
|
||||
debitCredit: { type: 'string' },
|
||||
amount: { type: 'number' },
|
||||
taxCode: { type: 'string' },
|
||||
taxAmount: { type: 'number' },
|
||||
costCenter: { type: 'string' },
|
||||
profitCenter: { type: 'string' },
|
||||
segment: { type: 'string' },
|
||||
assignment: { type: 'string' },
|
||||
text: { type: 'string' },
|
||||
businessArea: { type: 'string' }
|
||||
}},
|
||||
totalDebit: { type: 'number', required: true },
|
||||
totalCredit: { type: 'number', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
parkedBy: { type: 'string', required: false },
|
||||
postedBy: { type: 'string', required: false },
|
||||
reversalDocument: { type: 'string', required: false }
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate SAP Material Management data
|
||||
*/
|
||||
export async function generateMaterialData(count: number = 100) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} SAP material master records...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: materialSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} materials in ${result.metadata.duration}ms`);
|
||||
console.log('Sample material:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SAP Purchase Orders
|
||||
*/
|
||||
export async function generatePurchaseOrders(count: number = 50) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} SAP purchase orders...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: purchaseOrderSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} POs in ${result.metadata.duration}ms`);
|
||||
console.log('Sample PO:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Oracle Supply Chain Events (time-series)
|
||||
*/
|
||||
export async function generateSupplyChainEvents(count: number = 200) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} supply chain events...`);
|
||||
|
||||
const result = await synth.generateEvents({
|
||||
count,
|
||||
eventTypes: ['shipment_departure', 'shipment_arrival', 'inventory_adjustment',
|
||||
'quality_check', 'customs_clearance', 'delivery_exception'],
|
||||
distribution: 'poisson',
|
||||
timeRange: {
|
||||
start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days ago
|
||||
end: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} events in ${result.metadata.duration}ms`);
|
||||
console.log('Sample event:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Microsoft Dynamics 365 Manufacturing Orders
|
||||
*/
|
||||
export async function generateManufacturingOrders(count: number = 75) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} manufacturing orders...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: manufacturingProcessSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} orders in ${result.metadata.duration}ms`);
|
||||
console.log('Sample order:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate multi-location warehouse inventory snapshots
|
||||
*/
|
||||
export async function generateWarehouseInventory(warehouseCount: number = 5) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating inventory for ${warehouseCount} warehouses...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count: warehouseCount,
|
||||
schema: warehouseInventorySchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} warehouse snapshots in ${result.metadata.duration}ms`);
|
||||
console.log('Sample warehouse:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SAP Financial Transactions (FI/CO)
|
||||
*/
|
||||
export async function generateFinancialTransactions(count: number = 500) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} financial transactions...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: financialTransactionSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} transactions in ${result.metadata.duration}ms`);
|
||||
console.log('Sample transaction:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate complete ERP dataset in parallel
|
||||
*/
|
||||
export async function generateCompleteERPDataset() {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
|
||||
console.log('Generating complete ERP dataset in parallel...');
|
||||
console.time('Total ERP generation');
|
||||
|
||||
const [materials, purchaseOrders, supplyChain, manufacturing, warehouses, financial] =
|
||||
await Promise.all([
|
||||
generateMaterialData(50),
|
||||
generatePurchaseOrders(25),
|
||||
generateSupplyChainEvents(100),
|
||||
generateManufacturingOrders(30),
|
||||
generateWarehouseInventory(3),
|
||||
generateFinancialTransactions(200)
|
||||
]);
|
||||
|
||||
console.timeEnd('Total ERP generation');
|
||||
|
||||
return {
|
||||
materials: materials.data,
|
||||
purchaseOrders: purchaseOrders.data,
|
||||
supplyChainEvents: supplyChain.data,
|
||||
manufacturingOrders: manufacturing.data,
|
||||
warehouseInventory: warehouses.data,
|
||||
financialTransactions: financial.data,
|
||||
metadata: {
|
||||
totalRecords: materials.data.length + purchaseOrders.data.length +
|
||||
supplyChain.data.length + manufacturing.data.length +
|
||||
warehouses.data.length + financial.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream ERP data generation for large datasets
|
||||
*/
|
||||
export async function streamERPData(type: 'material' | 'po' | 'transaction', count: number = 1000) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
streaming: true
|
||||
});
|
||||
|
||||
const schemaMap = {
|
||||
material: materialSchema,
|
||||
po: purchaseOrderSchema,
|
||||
transaction: financialTransactionSchema
|
||||
};
|
||||
|
||||
console.log(`Streaming ${count} ${type} records...`);
|
||||
|
||||
let recordCount = 0;
|
||||
for await (const record of synth.generateStream('structured', {
|
||||
count,
|
||||
schema: schemaMap[type],
|
||||
format: 'json'
|
||||
})) {
|
||||
recordCount++;
|
||||
if (recordCount % 100 === 0) {
|
||||
console.log(`Streamed ${recordCount} records...`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Completed streaming ${recordCount} ${type} records`);
|
||||
}
|
||||
|
||||
// Example usage
|
||||
async function runERPExamples() {
|
||||
console.log('=== ERP Data Generation Examples ===\n');
|
||||
|
||||
// Example 1: Material Master Data
|
||||
console.log('1. Material Master Data (SAP MM)');
|
||||
await generateMaterialData(10);
|
||||
|
||||
// Example 2: Purchase Orders
|
||||
console.log('\n2. Purchase Orders (SAP MM)');
|
||||
await generatePurchaseOrders(5);
|
||||
|
||||
// Example 3: Supply Chain Events
|
||||
console.log('\n3. Supply Chain Events (Oracle)');
|
||||
await generateSupplyChainEvents(20);
|
||||
|
||||
// Example 4: Manufacturing Orders
|
||||
console.log('\n4. Manufacturing Orders (Dynamics 365)');
|
||||
await generateManufacturingOrders(10);
|
||||
|
||||
// Example 5: Warehouse Inventory
|
||||
console.log('\n5. Multi-location Warehouse Inventory');
|
||||
await generateWarehouseInventory(2);
|
||||
|
||||
// Example 6: Financial Transactions
|
||||
console.log('\n6. Financial Transactions (SAP FI/CO)');
|
||||
await generateFinancialTransactions(25);
|
||||
|
||||
// Example 7: Complete dataset in parallel
|
||||
console.log('\n7. Complete ERP Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteERPDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
|
||||
// Uncomment to run
|
||||
// runERPExamples().catch(console.error);
|
||||
|
||||
export default {
|
||||
generateMaterialData,
|
||||
generatePurchaseOrders,
|
||||
generateSupplyChainEvents,
|
||||
generateManufacturingOrders,
|
||||
generateWarehouseInventory,
|
||||
generateFinancialTransactions,
|
||||
generateCompleteERPDataset,
|
||||
streamERPData
|
||||
};
|
||||
60
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/financial-planning.d.ts
vendored
Normal file
60
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/financial-planning.d.ts
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Financial Planning and Analysis Data Generation
|
||||
* Simulates enterprise financial systems, budgeting, forecasting, and reporting
|
||||
*/
|
||||
/**
|
||||
* Generate Budget Planning Data
|
||||
*/
|
||||
export declare function generateBudgetPlans(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Revenue Forecasts
|
||||
*/
|
||||
export declare function generateRevenueForecasts(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Expense Tracking Data (time-series)
|
||||
*/
|
||||
export declare function generateExpenseTracking(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Cash Flow Projections
|
||||
*/
|
||||
export declare function generateCashFlowProjections(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate P&L Statements
|
||||
*/
|
||||
export declare function generateProfitLossStatements(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Balance Sheets
|
||||
*/
|
||||
export declare function generateBalanceSheets(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate KPI Dashboard Data (time-series)
|
||||
*/
|
||||
export declare function generateKPIDashboards(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate complete financial dataset in parallel
|
||||
*/
|
||||
export declare function generateCompleteFinancialDataset(): Promise<{
|
||||
budgets: unknown[];
|
||||
revenueForecasts: unknown[];
|
||||
expenses: unknown[];
|
||||
cashFlowProjections: unknown[];
|
||||
profitLossStatements: unknown[];
|
||||
balanceSheets: unknown[];
|
||||
kpiDashboards: unknown[];
|
||||
metadata: {
|
||||
totalRecords: number;
|
||||
generatedAt: string;
|
||||
};
|
||||
}>;
|
||||
declare const _default: {
|
||||
generateBudgetPlans: typeof generateBudgetPlans;
|
||||
generateRevenueForecasts: typeof generateRevenueForecasts;
|
||||
generateExpenseTracking: typeof generateExpenseTracking;
|
||||
generateCashFlowProjections: typeof generateCashFlowProjections;
|
||||
generateProfitLossStatements: typeof generateProfitLossStatements;
|
||||
generateBalanceSheets: typeof generateBalanceSheets;
|
||||
generateKPIDashboards: typeof generateKPIDashboards;
|
||||
generateCompleteFinancialDataset: typeof generateCompleteFinancialDataset;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=financial-planning.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"financial-planning.d.ts","sourceRoot":"","sources":["financial-planning.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4aH;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,GAAE,MAAW,mEAkB3D;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,KAAK,GAAE,MAAW,mEAiBhE;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,GAAE,MAAY,mEAiBhE;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,GAAE,MAAW,mEAiBnE;AAED;;GAEG;AACH,wBAAsB,4BAA4B,CAAC,KAAK,GAAE,MAAW,mEAiBpE;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,GAAE,MAAW,mEAiB7D;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,GAAE,MAAY,mEAmB9D;AAED;;GAEG;AACH,wBAAsB,gCAAgC;;;;;;;;;;;;GAsCrD;;;;;;;;;;;AA2CD,wBASE"}
|
||||
633
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/financial-planning.js
vendored
Normal file
633
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/financial-planning.js
vendored
Normal file
@@ -0,0 +1,633 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Financial Planning and Analysis Data Generation
|
||||
* Simulates enterprise financial systems, budgeting, forecasting, and reporting
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateBudgetPlans = generateBudgetPlans;
|
||||
exports.generateRevenueForecasts = generateRevenueForecasts;
|
||||
exports.generateExpenseTracking = generateExpenseTracking;
|
||||
exports.generateCashFlowProjections = generateCashFlowProjections;
|
||||
exports.generateProfitLossStatements = generateProfitLossStatements;
|
||||
exports.generateBalanceSheets = generateBalanceSheets;
|
||||
exports.generateKPIDashboards = generateKPIDashboards;
|
||||
exports.generateCompleteFinancialDataset = generateCompleteFinancialDataset;
|
||||
const index_js_1 = require("../../src/index.js");
|
||||
// Budget Planning Schema
|
||||
const budgetPlanningSchema = {
|
||||
budgetId: { type: 'string', required: true },
|
||||
fiscalYear: { type: 'number', required: true },
|
||||
fiscalPeriod: { type: 'string', required: true },
|
||||
organization: { type: 'object', required: true, properties: {
|
||||
companyCode: { type: 'string' },
|
||||
businessUnit: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
profitCenter: { type: 'string' }
|
||||
} },
|
||||
budgetType: { type: 'string', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
version: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
revenue: { type: 'object', required: true, properties: {
|
||||
productSales: { type: 'number' },
|
||||
serviceSales: { type: 'number' },
|
||||
subscriptionRevenue: { type: 'number' },
|
||||
otherRevenue: { type: 'number' },
|
||||
totalRevenue: { type: 'number' }
|
||||
} },
|
||||
costOfGoodsSold: { type: 'object', required: true, properties: {
|
||||
materials: { type: 'number' },
|
||||
labor: { type: 'number' },
|
||||
overhead: { type: 'number' },
|
||||
totalCOGS: { type: 'number' }
|
||||
} },
|
||||
operatingExpenses: { type: 'object', required: true, properties: {
|
||||
salaries: { type: 'number' },
|
||||
benefits: { type: 'number' },
|
||||
rent: { type: 'number' },
|
||||
utilities: { type: 'number' },
|
||||
marketing: { type: 'number' },
|
||||
travelExpenses: { type: 'number' },
|
||||
professionalFees: { type: 'number' },
|
||||
technology: { type: 'number' },
|
||||
depreciation: { type: 'number' },
|
||||
other: { type: 'number' },
|
||||
totalOpEx: { type: 'number' }
|
||||
} },
|
||||
capitalExpenditure: { type: 'object', required: false, properties: {
|
||||
equipment: { type: 'number' },
|
||||
infrastructure: { type: 'number' },
|
||||
technology: { type: 'number' },
|
||||
totalCapEx: { type: 'number' }
|
||||
} },
|
||||
calculations: { type: 'object', required: true, properties: {
|
||||
grossProfit: { type: 'number' },
|
||||
grossMargin: { type: 'number' },
|
||||
operatingIncome: { type: 'number' },
|
||||
operatingMargin: { type: 'number' },
|
||||
ebitda: { type: 'number' },
|
||||
netIncome: { type: 'number' },
|
||||
netMargin: { type: 'number' }
|
||||
} },
|
||||
owners: { type: 'object', required: true, properties: {
|
||||
preparedBy: { type: 'string' },
|
||||
reviewedBy: { type: 'string' },
|
||||
approvedBy: { type: 'string' }
|
||||
} },
|
||||
createdDate: { type: 'string', required: true },
|
||||
lastModifiedDate: { type: 'string', required: true }
|
||||
};
|
||||
// Revenue Forecasting Schema
|
||||
const revenueForecastSchema = {
|
||||
forecastId: { type: 'string', required: true },
|
||||
forecastDate: { type: 'string', required: true },
|
||||
forecastPeriod: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
periodType: { type: 'string' }
|
||||
} },
|
||||
businessUnit: { type: 'string', required: true },
|
||||
region: { type: 'string', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
forecastType: { type: 'string', required: true },
|
||||
methodology: { type: 'string', required: true },
|
||||
confidence: { type: 'number', required: true },
|
||||
revenueStreams: { type: 'array', required: true, items: {
|
||||
streamId: { type: 'string' },
|
||||
streamName: { type: 'string' },
|
||||
category: { type: 'string' },
|
||||
forecast: { type: 'object', properties: {
|
||||
conservative: { type: 'number' },
|
||||
expected: { type: 'number' },
|
||||
optimistic: { type: 'number' }
|
||||
} },
|
||||
assumptions: { type: 'array' },
|
||||
drivers: { type: 'array' },
|
||||
risks: { type: 'array' }
|
||||
} },
|
||||
totals: { type: 'object', required: true, properties: {
|
||||
conservativeTotal: { type: 'number' },
|
||||
expectedTotal: { type: 'number' },
|
||||
optimisticTotal: { type: 'number' }
|
||||
} },
|
||||
comparisonMetrics: { type: 'object', required: true, properties: {
|
||||
priorYearActual: { type: 'number' },
|
||||
yoyGrowth: { type: 'number' },
|
||||
budgetVariance: { type: 'number' },
|
||||
lastForecastVariance: { type: 'number' }
|
||||
} },
|
||||
modelInputs: { type: 'object', required: false, properties: {
|
||||
marketGrowthRate: { type: 'number' },
|
||||
pricingAssumptions: { type: 'number' },
|
||||
volumeAssumptions: { type: 'number' },
|
||||
marketShareTarget: { type: 'number' },
|
||||
newCustomerAcquisition: { type: 'number' },
|
||||
churnRate: { type: 'number' }
|
||||
} },
|
||||
preparedBy: { type: 'string', required: true },
|
||||
approvedBy: { type: 'string', required: false },
|
||||
lastUpdated: { type: 'string', required: true }
|
||||
};
|
||||
// Expense Tracking Schema
|
||||
const expenseTrackingSchema = {
|
||||
expenseId: { type: 'string', required: true },
|
||||
transactionDate: { type: 'string', required: true },
|
||||
postingDate: { type: 'string', required: true },
|
||||
fiscalPeriod: { type: 'string', required: true },
|
||||
organization: { type: 'object', required: true, properties: {
|
||||
companyCode: { type: 'string' },
|
||||
businessUnit: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
costCenter: { type: 'string' }
|
||||
} },
|
||||
expenseCategory: { type: 'string', required: true },
|
||||
expenseType: { type: 'string', required: true },
|
||||
glAccount: { type: 'string', required: true },
|
||||
accountDescription: { type: 'string', required: true },
|
||||
amount: { type: 'number', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
vendor: { type: 'object', required: false, properties: {
|
||||
vendorId: { type: 'string' },
|
||||
vendorName: { type: 'string' }
|
||||
} },
|
||||
budgetInfo: { type: 'object', required: true, properties: {
|
||||
budgetedAmount: { type: 'number' },
|
||||
spentToDate: { type: 'number' },
|
||||
remainingBudget: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
variancePercent: { type: 'number' }
|
||||
} },
|
||||
approval: { type: 'object', required: true, properties: {
|
||||
requestedBy: { type: 'string' },
|
||||
approvedBy: { type: 'string' },
|
||||
approvalDate: { type: 'string' },
|
||||
status: { type: 'string' }
|
||||
} },
|
||||
project: { type: 'object', required: false, properties: {
|
||||
projectId: { type: 'string' },
|
||||
projectName: { type: 'string' },
|
||||
workPackage: { type: 'string' }
|
||||
} },
|
||||
description: { type: 'string', required: true },
|
||||
reference: { type: 'string', required: false },
|
||||
tags: { type: 'array', required: false }
|
||||
};
|
||||
// Cash Flow Projection Schema
|
||||
const cashFlowProjectionSchema = {
|
||||
projectionId: { type: 'string', required: true },
|
||||
projectionDate: { type: 'string', required: true },
|
||||
period: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
frequency: { type: 'string' }
|
||||
} },
|
||||
currency: { type: 'string', required: true },
|
||||
openingBalance: { type: 'number', required: true },
|
||||
operatingActivities: { type: 'object', required: true, properties: {
|
||||
cashFromCustomers: { type: 'number' },
|
||||
cashToSuppliers: { type: 'number' },
|
||||
cashToEmployees: { type: 'number' },
|
||||
operatingExpenses: { type: 'number' },
|
||||
interestPaid: { type: 'number' },
|
||||
taxesPaid: { type: 'number' },
|
||||
netOperatingCashFlow: { type: 'number' }
|
||||
} },
|
||||
investingActivities: { type: 'object', required: true, properties: {
|
||||
capitalExpenditures: { type: 'number' },
|
||||
assetPurchases: { type: 'number' },
|
||||
assetSales: { type: 'number' },
|
||||
investments: { type: 'number' },
|
||||
netInvestingCashFlow: { type: 'number' }
|
||||
} },
|
||||
financingActivities: { type: 'object', required: true, properties: {
|
||||
debtProceeds: { type: 'number' },
|
||||
debtRepayments: { type: 'number' },
|
||||
equityIssuance: { type: 'number' },
|
||||
dividendsPaid: { type: 'number' },
|
||||
netFinancingCashFlow: { type: 'number' }
|
||||
} },
|
||||
netCashFlow: { type: 'number', required: true },
|
||||
closingBalance: { type: 'number', required: true },
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
cashConversionCycle: { type: 'number' },
|
||||
daysReceivablesOutstanding: { type: 'number' },
|
||||
daysPayablesOutstanding: { type: 'number' },
|
||||
daysInventoryOutstanding: { type: 'number' },
|
||||
operatingCashFlowRatio: { type: 'number' }
|
||||
} },
|
||||
scenarios: { type: 'object', required: false, properties: {
|
||||
baseline: { type: 'number' },
|
||||
bestCase: { type: 'number' },
|
||||
worstCase: { type: 'number' }
|
||||
} },
|
||||
assumptions: { type: 'array', required: false },
|
||||
risks: { type: 'array', required: false }
|
||||
};
|
||||
// Profit & Loss Statement Schema
|
||||
const profitLossSchema = {
|
||||
statementId: { type: 'string', required: true },
|
||||
statementDate: { type: 'string', required: true },
|
||||
period: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
fiscalYear: { type: 'number' },
|
||||
fiscalQuarter: { type: 'string' },
|
||||
fiscalMonth: { type: 'string' }
|
||||
} },
|
||||
organization: { type: 'object', required: true, properties: {
|
||||
companyCode: { type: 'string' },
|
||||
companyName: { type: 'string' },
|
||||
businessUnit: { type: 'string' },
|
||||
segment: { type: 'string' }
|
||||
} },
|
||||
currency: { type: 'string', required: true },
|
||||
revenue: { type: 'object', required: true, properties: {
|
||||
productRevenue: { type: 'number' },
|
||||
serviceRevenue: { type: 'number' },
|
||||
otherRevenue: { type: 'number' },
|
||||
totalRevenue: { type: 'number' }
|
||||
} },
|
||||
costOfRevenue: { type: 'object', required: true, properties: {
|
||||
directMaterials: { type: 'number' },
|
||||
directLabor: { type: 'number' },
|
||||
manufacturingOverhead: { type: 'number' },
|
||||
totalCostOfRevenue: { type: 'number' }
|
||||
} },
|
||||
grossProfit: { type: 'number', required: true },
|
||||
grossMargin: { type: 'number', required: true },
|
||||
operatingExpenses: { type: 'object', required: true, properties: {
|
||||
salesAndMarketing: { type: 'number' },
|
||||
researchAndDevelopment: { type: 'number' },
|
||||
generalAndAdministrative: { type: 'number' },
|
||||
totalOperatingExpenses: { type: 'number' }
|
||||
} },
|
||||
operatingIncome: { type: 'number', required: true },
|
||||
operatingMargin: { type: 'number', required: true },
|
||||
nonOperating: { type: 'object', required: false, properties: {
|
||||
interestIncome: { type: 'number' },
|
||||
interestExpense: { type: 'number' },
|
||||
otherIncome: { type: 'number' },
|
||||
otherExpenses: { type: 'number' },
|
||||
netNonOperating: { type: 'number' }
|
||||
} },
|
||||
incomeBeforeTax: { type: 'number', required: true },
|
||||
incomeTaxExpense: { type: 'number', required: true },
|
||||
effectiveTaxRate: { type: 'number', required: true },
|
||||
netIncome: { type: 'number', required: true },
|
||||
netMargin: { type: 'number', required: true },
|
||||
earningsPerShare: { type: 'object', required: false, properties: {
|
||||
basic: { type: 'number' },
|
||||
diluted: { type: 'number' }
|
||||
} },
|
||||
comparisonPeriod: { type: 'object', required: false, properties: {
|
||||
priorPeriodRevenue: { type: 'number' },
|
||||
priorPeriodNetIncome: { type: 'number' },
|
||||
revenueGrowth: { type: 'number' },
|
||||
incomeGrowth: { type: 'number' }
|
||||
} }
|
||||
};
|
||||
// Balance Sheet Schema
|
||||
const balanceSheetSchema = {
|
||||
statementId: { type: 'string', required: true },
|
||||
asOfDate: { type: 'string', required: true },
|
||||
fiscalPeriod: { type: 'string', required: true },
|
||||
organization: { type: 'object', required: true, properties: {
|
||||
companyCode: { type: 'string' },
|
||||
companyName: { type: 'string' }
|
||||
} },
|
||||
currency: { type: 'string', required: true },
|
||||
assets: { type: 'object', required: true, properties: {
|
||||
currentAssets: { type: 'object', properties: {
|
||||
cashAndEquivalents: { type: 'number' },
|
||||
shortTermInvestments: { type: 'number' },
|
||||
accountsReceivable: { type: 'number' },
|
||||
inventory: { type: 'number' },
|
||||
prepaidExpenses: { type: 'number' },
|
||||
otherCurrentAssets: { type: 'number' },
|
||||
totalCurrentAssets: { type: 'number' }
|
||||
} },
|
||||
nonCurrentAssets: { type: 'object', properties: {
|
||||
propertyPlantEquipment: { type: 'number' },
|
||||
accumulatedDepreciation: { type: 'number' },
|
||||
netPPE: { type: 'number' },
|
||||
intangibleAssets: { type: 'number' },
|
||||
goodwill: { type: 'number' },
|
||||
longTermInvestments: { type: 'number' },
|
||||
otherNonCurrentAssets: { type: 'number' },
|
||||
totalNonCurrentAssets: { type: 'number' }
|
||||
} },
|
||||
totalAssets: { type: 'number' }
|
||||
} },
|
||||
liabilities: { type: 'object', required: true, properties: {
|
||||
currentLiabilities: { type: 'object', properties: {
|
||||
accountsPayable: { type: 'number' },
|
||||
accruedExpenses: { type: 'number' },
|
||||
shortTermDebt: { type: 'number' },
|
||||
currentPortionLongTermDebt: { type: 'number' },
|
||||
deferredRevenue: { type: 'number' },
|
||||
otherCurrentLiabilities: { type: 'number' },
|
||||
totalCurrentLiabilities: { type: 'number' }
|
||||
} },
|
||||
nonCurrentLiabilities: { type: 'object', properties: {
|
||||
longTermDebt: { type: 'number' },
|
||||
deferredTaxLiabilities: { type: 'number' },
|
||||
pensionObligations: { type: 'number' },
|
||||
otherNonCurrentLiabilities: { type: 'number' },
|
||||
totalNonCurrentLiabilities: { type: 'number' }
|
||||
} },
|
||||
totalLiabilities: { type: 'number' }
|
||||
} },
|
||||
equity: { type: 'object', required: true, properties: {
|
||||
commonStock: { type: 'number' },
|
||||
preferredStock: { type: 'number' },
|
||||
additionalPaidInCapital: { type: 'number' },
|
||||
retainedEarnings: { type: 'number' },
|
||||
treasuryStock: { type: 'number' },
|
||||
accumulatedOtherComprehensiveIncome: { type: 'number' },
|
||||
totalEquity: { type: 'number' }
|
||||
} },
|
||||
totalLiabilitiesAndEquity: { type: 'number', required: true },
|
||||
ratios: { type: 'object', required: true, properties: {
|
||||
currentRatio: { type: 'number' },
|
||||
quickRatio: { type: 'number' },
|
||||
debtToEquity: { type: 'number' },
|
||||
workingCapital: { type: 'number' },
|
||||
returnOnAssets: { type: 'number' },
|
||||
returnOnEquity: { type: 'number' }
|
||||
} }
|
||||
};
|
||||
// KPI Dashboard Data Schema
|
||||
const kpiDashboardSchema = {
|
||||
dashboardId: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
period: { type: 'string', required: true },
|
||||
businessUnit: { type: 'string', required: true },
|
||||
financialKPIs: { type: 'object', required: true, properties: {
|
||||
revenue: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
} },
|
||||
profitMargin: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
} },
|
||||
ebitdaMargin: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
} },
|
||||
returnOnInvestment: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
} },
|
||||
cashFlowFromOperations: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
} }
|
||||
} },
|
||||
operationalKPIs: { type: 'object', required: true, properties: {
|
||||
revenuePerEmployee: { type: 'number' },
|
||||
operatingExpenseRatio: { type: 'number' },
|
||||
inventoryTurnover: { type: 'number' },
|
||||
daysInventoryOutstanding: { type: 'number' },
|
||||
assetTurnover: { type: 'number' }
|
||||
} },
|
||||
liquidityKPIs: { type: 'object', required: true, properties: {
|
||||
currentRatio: { type: 'number' },
|
||||
quickRatio: { type: 'number' },
|
||||
cashRatio: { type: 'number' },
|
||||
workingCapital: { type: 'number' },
|
||||
daysWorkingCapital: { type: 'number' }
|
||||
} },
|
||||
leverageKPIs: { type: 'object', required: true, properties: {
|
||||
debtToEquity: { type: 'number' },
|
||||
debtToAssets: { type: 'number' },
|
||||
interestCoverageRatio: { type: 'number' },
|
||||
debtServiceCoverageRatio: { type: 'number' }
|
||||
} },
|
||||
efficiencyKPIs: { type: 'object', required: true, properties: {
|
||||
daysReceivablesOutstanding: { type: 'number' },
|
||||
daysPayablesOutstanding: { type: 'number' },
|
||||
cashConversionCycle: { type: 'number' },
|
||||
burnRate: { type: 'number' },
|
||||
runwayMonths: { type: 'number' }
|
||||
} },
|
||||
alerts: { type: 'array', required: false, items: {
|
||||
kpiName: { type: 'string' },
|
||||
severity: { type: 'string' },
|
||||
message: { type: 'string' },
|
||||
threshold: { type: 'number' },
|
||||
actualValue: { type: 'number' }
|
||||
} }
|
||||
};
|
||||
/**
|
||||
* Generate Budget Planning Data
|
||||
*/
|
||||
async function generateBudgetPlans(count = 50) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
console.log(`Generating ${count} budget plans...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: budgetPlanningSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} budgets in ${result.metadata.duration}ms`);
|
||||
console.log('Sample budget:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Revenue Forecasts
|
||||
*/
|
||||
async function generateRevenueForecasts(count = 25) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} revenue forecasts...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: revenueForecastSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} forecasts in ${result.metadata.duration}ms`);
|
||||
console.log('Sample forecast:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Expense Tracking Data (time-series)
|
||||
*/
|
||||
async function generateExpenseTracking(count = 500) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} expense records...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: expenseTrackingSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} expenses in ${result.metadata.duration}ms`);
|
||||
console.log('Sample expense:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Cash Flow Projections
|
||||
*/
|
||||
async function generateCashFlowProjections(count = 12) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} cash flow projections...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: cashFlowProjectionSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} projections in ${result.metadata.duration}ms`);
|
||||
console.log('Sample projection:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate P&L Statements
|
||||
*/
|
||||
async function generateProfitLossStatements(count = 12) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} P&L statements...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: profitLossSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} statements in ${result.metadata.duration}ms`);
|
||||
console.log('Sample P&L:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Balance Sheets
|
||||
*/
|
||||
async function generateBalanceSheets(count = 12) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} balance sheets...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: balanceSheetSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} balance sheets in ${result.metadata.duration}ms`);
|
||||
console.log('Sample balance sheet:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate KPI Dashboard Data (time-series)
|
||||
*/
|
||||
async function generateKPIDashboards(count = 365) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} KPI dashboard snapshots...`);
|
||||
const result = await synth.generateTimeSeries({
|
||||
count,
|
||||
interval: '1d',
|
||||
metrics: ['revenue', 'expenses', 'profitMargin', 'cashFlow'],
|
||||
trend: 'up',
|
||||
seasonality: true
|
||||
});
|
||||
console.log(`Generated ${result.data.length} KPI snapshots in ${result.metadata.duration}ms`);
|
||||
console.log('Sample KPI:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate complete financial dataset in parallel
|
||||
*/
|
||||
async function generateCompleteFinancialDataset() {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
console.log('Generating complete financial dataset in parallel...');
|
||||
console.time('Total financial generation');
|
||||
const [budgets, forecasts, expenses, cashFlow, profitLoss, balanceSheets, kpis] = await Promise.all([
|
||||
generateBudgetPlans(20),
|
||||
generateRevenueForecasts(12),
|
||||
generateExpenseTracking(200),
|
||||
generateCashFlowProjections(12),
|
||||
generateProfitLossStatements(12),
|
||||
generateBalanceSheets(12),
|
||||
generateKPIDashboards(90)
|
||||
]);
|
||||
console.timeEnd('Total financial generation');
|
||||
return {
|
||||
budgets: budgets.data,
|
||||
revenueForecasts: forecasts.data,
|
||||
expenses: expenses.data,
|
||||
cashFlowProjections: cashFlow.data,
|
||||
profitLossStatements: profitLoss.data,
|
||||
balanceSheets: balanceSheets.data,
|
||||
kpiDashboards: kpis.data,
|
||||
metadata: {
|
||||
totalRecords: budgets.data.length + forecasts.data.length +
|
||||
expenses.data.length + cashFlow.data.length +
|
||||
profitLoss.data.length + balanceSheets.data.length +
|
||||
kpis.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
// Example usage
|
||||
async function runFinancialExamples() {
|
||||
console.log('=== Financial Planning Data Generation Examples ===\n');
|
||||
// Example 1: Budget Planning
|
||||
console.log('1. Budget Planning');
|
||||
await generateBudgetPlans(5);
|
||||
// Example 2: Revenue Forecasting
|
||||
console.log('\n2. Revenue Forecasting');
|
||||
await generateRevenueForecasts(5);
|
||||
// Example 3: Expense Tracking
|
||||
console.log('\n3. Expense Tracking');
|
||||
await generateExpenseTracking(25);
|
||||
// Example 4: Cash Flow Projections
|
||||
console.log('\n4. Cash Flow Projections');
|
||||
await generateCashFlowProjections(12);
|
||||
// Example 5: P&L Statements
|
||||
console.log('\n5. Profit & Loss Statements');
|
||||
await generateProfitLossStatements(4);
|
||||
// Example 6: Balance Sheets
|
||||
console.log('\n6. Balance Sheets');
|
||||
await generateBalanceSheets(4);
|
||||
// Example 7: KPI Dashboards
|
||||
console.log('\n7. KPI Dashboards');
|
||||
await generateKPIDashboards(30);
|
||||
// Example 8: Complete financial dataset
|
||||
console.log('\n8. Complete Financial Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteFinancialDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
// Uncomment to run
|
||||
// runFinancialExamples().catch(console.error);
|
||||
exports.default = {
|
||||
generateBudgetPlans,
|
||||
generateRevenueForecasts,
|
||||
generateExpenseTracking,
|
||||
generateCashFlowProjections,
|
||||
generateProfitLossStatements,
|
||||
generateBalanceSheets,
|
||||
generateKPIDashboards,
|
||||
generateCompleteFinancialDataset
|
||||
};
|
||||
//# sourceMappingURL=financial-planning.js.map
|
||||
File diff suppressed because one or more lines are too long
682
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/financial-planning.ts
vendored
Normal file
682
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/financial-planning.ts
vendored
Normal file
@@ -0,0 +1,682 @@
|
||||
/**
|
||||
* Financial Planning and Analysis Data Generation
|
||||
* Simulates enterprise financial systems, budgeting, forecasting, and reporting
|
||||
*/
|
||||
|
||||
import { createSynth } from '../../src/index.js';
|
||||
|
||||
// Budget Planning Schema
|
||||
const budgetPlanningSchema = {
|
||||
budgetId: { type: 'string', required: true },
|
||||
fiscalYear: { type: 'number', required: true },
|
||||
fiscalPeriod: { type: 'string', required: true },
|
||||
organization: { type: 'object', required: true, properties: {
|
||||
companyCode: { type: 'string' },
|
||||
businessUnit: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
profitCenter: { type: 'string' }
|
||||
}},
|
||||
budgetType: { type: 'string', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
version: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
revenue: { type: 'object', required: true, properties: {
|
||||
productSales: { type: 'number' },
|
||||
serviceSales: { type: 'number' },
|
||||
subscriptionRevenue: { type: 'number' },
|
||||
otherRevenue: { type: 'number' },
|
||||
totalRevenue: { type: 'number' }
|
||||
}},
|
||||
costOfGoodsSold: { type: 'object', required: true, properties: {
|
||||
materials: { type: 'number' },
|
||||
labor: { type: 'number' },
|
||||
overhead: { type: 'number' },
|
||||
totalCOGS: { type: 'number' }
|
||||
}},
|
||||
operatingExpenses: { type: 'object', required: true, properties: {
|
||||
salaries: { type: 'number' },
|
||||
benefits: { type: 'number' },
|
||||
rent: { type: 'number' },
|
||||
utilities: { type: 'number' },
|
||||
marketing: { type: 'number' },
|
||||
travelExpenses: { type: 'number' },
|
||||
professionalFees: { type: 'number' },
|
||||
technology: { type: 'number' },
|
||||
depreciation: { type: 'number' },
|
||||
other: { type: 'number' },
|
||||
totalOpEx: { type: 'number' }
|
||||
}},
|
||||
capitalExpenditure: { type: 'object', required: false, properties: {
|
||||
equipment: { type: 'number' },
|
||||
infrastructure: { type: 'number' },
|
||||
technology: { type: 'number' },
|
||||
totalCapEx: { type: 'number' }
|
||||
}},
|
||||
calculations: { type: 'object', required: true, properties: {
|
||||
grossProfit: { type: 'number' },
|
||||
grossMargin: { type: 'number' },
|
||||
operatingIncome: { type: 'number' },
|
||||
operatingMargin: { type: 'number' },
|
||||
ebitda: { type: 'number' },
|
||||
netIncome: { type: 'number' },
|
||||
netMargin: { type: 'number' }
|
||||
}},
|
||||
owners: { type: 'object', required: true, properties: {
|
||||
preparedBy: { type: 'string' },
|
||||
reviewedBy: { type: 'string' },
|
||||
approvedBy: { type: 'string' }
|
||||
}},
|
||||
createdDate: { type: 'string', required: true },
|
||||
lastModifiedDate: { type: 'string', required: true }
|
||||
};
|
||||
|
||||
// Revenue Forecasting Schema
|
||||
const revenueForecastSchema = {
|
||||
forecastId: { type: 'string', required: true },
|
||||
forecastDate: { type: 'string', required: true },
|
||||
forecastPeriod: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
periodType: { type: 'string' }
|
||||
}},
|
||||
businessUnit: { type: 'string', required: true },
|
||||
region: { type: 'string', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
forecastType: { type: 'string', required: true },
|
||||
methodology: { type: 'string', required: true },
|
||||
confidence: { type: 'number', required: true },
|
||||
revenueStreams: { type: 'array', required: true, items: {
|
||||
streamId: { type: 'string' },
|
||||
streamName: { type: 'string' },
|
||||
category: { type: 'string' },
|
||||
forecast: { type: 'object', properties: {
|
||||
conservative: { type: 'number' },
|
||||
expected: { type: 'number' },
|
||||
optimistic: { type: 'number' }
|
||||
}},
|
||||
assumptions: { type: 'array' },
|
||||
drivers: { type: 'array' },
|
||||
risks: { type: 'array' }
|
||||
}},
|
||||
totals: { type: 'object', required: true, properties: {
|
||||
conservativeTotal: { type: 'number' },
|
||||
expectedTotal: { type: 'number' },
|
||||
optimisticTotal: { type: 'number' }
|
||||
}},
|
||||
comparisonMetrics: { type: 'object', required: true, properties: {
|
||||
priorYearActual: { type: 'number' },
|
||||
yoyGrowth: { type: 'number' },
|
||||
budgetVariance: { type: 'number' },
|
||||
lastForecastVariance: { type: 'number' }
|
||||
}},
|
||||
modelInputs: { type: 'object', required: false, properties: {
|
||||
marketGrowthRate: { type: 'number' },
|
||||
pricingAssumptions: { type: 'number' },
|
||||
volumeAssumptions: { type: 'number' },
|
||||
marketShareTarget: { type: 'number' },
|
||||
newCustomerAcquisition: { type: 'number' },
|
||||
churnRate: { type: 'number' }
|
||||
}},
|
||||
preparedBy: { type: 'string', required: true },
|
||||
approvedBy: { type: 'string', required: false },
|
||||
lastUpdated: { type: 'string', required: true }
|
||||
};
|
||||
|
||||
// Expense Tracking Schema
|
||||
const expenseTrackingSchema = {
|
||||
expenseId: { type: 'string', required: true },
|
||||
transactionDate: { type: 'string', required: true },
|
||||
postingDate: { type: 'string', required: true },
|
||||
fiscalPeriod: { type: 'string', required: true },
|
||||
organization: { type: 'object', required: true, properties: {
|
||||
companyCode: { type: 'string' },
|
||||
businessUnit: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
costCenter: { type: 'string' }
|
||||
}},
|
||||
expenseCategory: { type: 'string', required: true },
|
||||
expenseType: { type: 'string', required: true },
|
||||
glAccount: { type: 'string', required: true },
|
||||
accountDescription: { type: 'string', required: true },
|
||||
amount: { type: 'number', required: true },
|
||||
currency: { type: 'string', required: true },
|
||||
vendor: { type: 'object', required: false, properties: {
|
||||
vendorId: { type: 'string' },
|
||||
vendorName: { type: 'string' }
|
||||
}},
|
||||
budgetInfo: { type: 'object', required: true, properties: {
|
||||
budgetedAmount: { type: 'number' },
|
||||
spentToDate: { type: 'number' },
|
||||
remainingBudget: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
variancePercent: { type: 'number' }
|
||||
}},
|
||||
approval: { type: 'object', required: true, properties: {
|
||||
requestedBy: { type: 'string' },
|
||||
approvedBy: { type: 'string' },
|
||||
approvalDate: { type: 'string' },
|
||||
status: { type: 'string' }
|
||||
}},
|
||||
project: { type: 'object', required: false, properties: {
|
||||
projectId: { type: 'string' },
|
||||
projectName: { type: 'string' },
|
||||
workPackage: { type: 'string' }
|
||||
}},
|
||||
description: { type: 'string', required: true },
|
||||
reference: { type: 'string', required: false },
|
||||
tags: { type: 'array', required: false }
|
||||
};
|
||||
|
||||
// Cash Flow Projection Schema
|
||||
const cashFlowProjectionSchema = {
|
||||
projectionId: { type: 'string', required: true },
|
||||
projectionDate: { type: 'string', required: true },
|
||||
period: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
frequency: { type: 'string' }
|
||||
}},
|
||||
currency: { type: 'string', required: true },
|
||||
openingBalance: { type: 'number', required: true },
|
||||
operatingActivities: { type: 'object', required: true, properties: {
|
||||
cashFromCustomers: { type: 'number' },
|
||||
cashToSuppliers: { type: 'number' },
|
||||
cashToEmployees: { type: 'number' },
|
||||
operatingExpenses: { type: 'number' },
|
||||
interestPaid: { type: 'number' },
|
||||
taxesPaid: { type: 'number' },
|
||||
netOperatingCashFlow: { type: 'number' }
|
||||
}},
|
||||
investingActivities: { type: 'object', required: true, properties: {
|
||||
capitalExpenditures: { type: 'number' },
|
||||
assetPurchases: { type: 'number' },
|
||||
assetSales: { type: 'number' },
|
||||
investments: { type: 'number' },
|
||||
netInvestingCashFlow: { type: 'number' }
|
||||
}},
|
||||
financingActivities: { type: 'object', required: true, properties: {
|
||||
debtProceeds: { type: 'number' },
|
||||
debtRepayments: { type: 'number' },
|
||||
equityIssuance: { type: 'number' },
|
||||
dividendsPaid: { type: 'number' },
|
||||
netFinancingCashFlow: { type: 'number' }
|
||||
}},
|
||||
netCashFlow: { type: 'number', required: true },
|
||||
closingBalance: { type: 'number', required: true },
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
cashConversionCycle: { type: 'number' },
|
||||
daysReceivablesOutstanding: { type: 'number' },
|
||||
daysPayablesOutstanding: { type: 'number' },
|
||||
daysInventoryOutstanding: { type: 'number' },
|
||||
operatingCashFlowRatio: { type: 'number' }
|
||||
}},
|
||||
scenarios: { type: 'object', required: false, properties: {
|
||||
baseline: { type: 'number' },
|
||||
bestCase: { type: 'number' },
|
||||
worstCase: { type: 'number' }
|
||||
}},
|
||||
assumptions: { type: 'array', required: false },
|
||||
risks: { type: 'array', required: false }
|
||||
};
|
||||
|
||||
// Profit & Loss Statement Schema
|
||||
const profitLossSchema = {
|
||||
statementId: { type: 'string', required: true },
|
||||
statementDate: { type: 'string', required: true },
|
||||
period: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
fiscalYear: { type: 'number' },
|
||||
fiscalQuarter: { type: 'string' },
|
||||
fiscalMonth: { type: 'string' }
|
||||
}},
|
||||
organization: { type: 'object', required: true, properties: {
|
||||
companyCode: { type: 'string' },
|
||||
companyName: { type: 'string' },
|
||||
businessUnit: { type: 'string' },
|
||||
segment: { type: 'string' }
|
||||
}},
|
||||
currency: { type: 'string', required: true },
|
||||
revenue: { type: 'object', required: true, properties: {
|
||||
productRevenue: { type: 'number' },
|
||||
serviceRevenue: { type: 'number' },
|
||||
otherRevenue: { type: 'number' },
|
||||
totalRevenue: { type: 'number' }
|
||||
}},
|
||||
costOfRevenue: { type: 'object', required: true, properties: {
|
||||
directMaterials: { type: 'number' },
|
||||
directLabor: { type: 'number' },
|
||||
manufacturingOverhead: { type: 'number' },
|
||||
totalCostOfRevenue: { type: 'number' }
|
||||
}},
|
||||
grossProfit: { type: 'number', required: true },
|
||||
grossMargin: { type: 'number', required: true },
|
||||
operatingExpenses: { type: 'object', required: true, properties: {
|
||||
salesAndMarketing: { type: 'number' },
|
||||
researchAndDevelopment: { type: 'number' },
|
||||
generalAndAdministrative: { type: 'number' },
|
||||
totalOperatingExpenses: { type: 'number' }
|
||||
}},
|
||||
operatingIncome: { type: 'number', required: true },
|
||||
operatingMargin: { type: 'number', required: true },
|
||||
nonOperating: { type: 'object', required: false, properties: {
|
||||
interestIncome: { type: 'number' },
|
||||
interestExpense: { type: 'number' },
|
||||
otherIncome: { type: 'number' },
|
||||
otherExpenses: { type: 'number' },
|
||||
netNonOperating: { type: 'number' }
|
||||
}},
|
||||
incomeBeforeTax: { type: 'number', required: true },
|
||||
incomeTaxExpense: { type: 'number', required: true },
|
||||
effectiveTaxRate: { type: 'number', required: true },
|
||||
netIncome: { type: 'number', required: true },
|
||||
netMargin: { type: 'number', required: true },
|
||||
earningsPerShare: { type: 'object', required: false, properties: {
|
||||
basic: { type: 'number' },
|
||||
diluted: { type: 'number' }
|
||||
}},
|
||||
comparisonPeriod: { type: 'object', required: false, properties: {
|
||||
priorPeriodRevenue: { type: 'number' },
|
||||
priorPeriodNetIncome: { type: 'number' },
|
||||
revenueGrowth: { type: 'number' },
|
||||
incomeGrowth: { type: 'number' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Balance Sheet Schema
|
||||
const balanceSheetSchema = {
|
||||
statementId: { type: 'string', required: true },
|
||||
asOfDate: { type: 'string', required: true },
|
||||
fiscalPeriod: { type: 'string', required: true },
|
||||
organization: { type: 'object', required: true, properties: {
|
||||
companyCode: { type: 'string' },
|
||||
companyName: { type: 'string' }
|
||||
}},
|
||||
currency: { type: 'string', required: true },
|
||||
assets: { type: 'object', required: true, properties: {
|
||||
currentAssets: { type: 'object', properties: {
|
||||
cashAndEquivalents: { type: 'number' },
|
||||
shortTermInvestments: { type: 'number' },
|
||||
accountsReceivable: { type: 'number' },
|
||||
inventory: { type: 'number' },
|
||||
prepaidExpenses: { type: 'number' },
|
||||
otherCurrentAssets: { type: 'number' },
|
||||
totalCurrentAssets: { type: 'number' }
|
||||
}},
|
||||
nonCurrentAssets: { type: 'object', properties: {
|
||||
propertyPlantEquipment: { type: 'number' },
|
||||
accumulatedDepreciation: { type: 'number' },
|
||||
netPPE: { type: 'number' },
|
||||
intangibleAssets: { type: 'number' },
|
||||
goodwill: { type: 'number' },
|
||||
longTermInvestments: { type: 'number' },
|
||||
otherNonCurrentAssets: { type: 'number' },
|
||||
totalNonCurrentAssets: { type: 'number' }
|
||||
}},
|
||||
totalAssets: { type: 'number' }
|
||||
}},
|
||||
liabilities: { type: 'object', required: true, properties: {
|
||||
currentLiabilities: { type: 'object', properties: {
|
||||
accountsPayable: { type: 'number' },
|
||||
accruedExpenses: { type: 'number' },
|
||||
shortTermDebt: { type: 'number' },
|
||||
currentPortionLongTermDebt: { type: 'number' },
|
||||
deferredRevenue: { type: 'number' },
|
||||
otherCurrentLiabilities: { type: 'number' },
|
||||
totalCurrentLiabilities: { type: 'number' }
|
||||
}},
|
||||
nonCurrentLiabilities: { type: 'object', properties: {
|
||||
longTermDebt: { type: 'number' },
|
||||
deferredTaxLiabilities: { type: 'number' },
|
||||
pensionObligations: { type: 'number' },
|
||||
otherNonCurrentLiabilities: { type: 'number' },
|
||||
totalNonCurrentLiabilities: { type: 'number' }
|
||||
}},
|
||||
totalLiabilities: { type: 'number' }
|
||||
}},
|
||||
equity: { type: 'object', required: true, properties: {
|
||||
commonStock: { type: 'number' },
|
||||
preferredStock: { type: 'number' },
|
||||
additionalPaidInCapital: { type: 'number' },
|
||||
retainedEarnings: { type: 'number' },
|
||||
treasuryStock: { type: 'number' },
|
||||
accumulatedOtherComprehensiveIncome: { type: 'number' },
|
||||
totalEquity: { type: 'number' }
|
||||
}},
|
||||
totalLiabilitiesAndEquity: { type: 'number', required: true },
|
||||
ratios: { type: 'object', required: true, properties: {
|
||||
currentRatio: { type: 'number' },
|
||||
quickRatio: { type: 'number' },
|
||||
debtToEquity: { type: 'number' },
|
||||
workingCapital: { type: 'number' },
|
||||
returnOnAssets: { type: 'number' },
|
||||
returnOnEquity: { type: 'number' }
|
||||
}}
|
||||
};
|
||||
|
||||
// KPI Dashboard Data Schema
|
||||
const kpiDashboardSchema = {
|
||||
dashboardId: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
period: { type: 'string', required: true },
|
||||
businessUnit: { type: 'string', required: true },
|
||||
financialKPIs: { type: 'object', required: true, properties: {
|
||||
revenue: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
}},
|
||||
profitMargin: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
}},
|
||||
ebitdaMargin: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
}},
|
||||
returnOnInvestment: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
}},
|
||||
cashFlowFromOperations: { type: 'object', properties: {
|
||||
value: { type: 'number' },
|
||||
target: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
trend: { type: 'string' }
|
||||
}}
|
||||
}},
|
||||
operationalKPIs: { type: 'object', required: true, properties: {
|
||||
revenuePerEmployee: { type: 'number' },
|
||||
operatingExpenseRatio: { type: 'number' },
|
||||
inventoryTurnover: { type: 'number' },
|
||||
daysInventoryOutstanding: { type: 'number' },
|
||||
assetTurnover: { type: 'number' }
|
||||
}},
|
||||
liquidityKPIs: { type: 'object', required: true, properties: {
|
||||
currentRatio: { type: 'number' },
|
||||
quickRatio: { type: 'number' },
|
||||
cashRatio: { type: 'number' },
|
||||
workingCapital: { type: 'number' },
|
||||
daysWorkingCapital: { type: 'number' }
|
||||
}},
|
||||
leverageKPIs: { type: 'object', required: true, properties: {
|
||||
debtToEquity: { type: 'number' },
|
||||
debtToAssets: { type: 'number' },
|
||||
interestCoverageRatio: { type: 'number' },
|
||||
debtServiceCoverageRatio: { type: 'number' }
|
||||
}},
|
||||
efficiencyKPIs: { type: 'object', required: true, properties: {
|
||||
daysReceivablesOutstanding: { type: 'number' },
|
||||
daysPayablesOutstanding: { type: 'number' },
|
||||
cashConversionCycle: { type: 'number' },
|
||||
burnRate: { type: 'number' },
|
||||
runwayMonths: { type: 'number' }
|
||||
}},
|
||||
alerts: { type: 'array', required: false, items: {
|
||||
kpiName: { type: 'string' },
|
||||
severity: { type: 'string' },
|
||||
message: { type: 'string' },
|
||||
threshold: { type: 'number' },
|
||||
actualValue: { type: 'number' }
|
||||
}}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate Budget Planning Data
|
||||
*/
|
||||
export async function generateBudgetPlans(count: number = 50) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} budget plans...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: budgetPlanningSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} budgets in ${result.metadata.duration}ms`);
|
||||
console.log('Sample budget:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Revenue Forecasts
|
||||
*/
|
||||
export async function generateRevenueForecasts(count: number = 25) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} revenue forecasts...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: revenueForecastSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} forecasts in ${result.metadata.duration}ms`);
|
||||
console.log('Sample forecast:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Expense Tracking Data (time-series)
|
||||
*/
|
||||
export async function generateExpenseTracking(count: number = 500) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} expense records...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: expenseTrackingSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} expenses in ${result.metadata.duration}ms`);
|
||||
console.log('Sample expense:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Cash Flow Projections
|
||||
*/
|
||||
export async function generateCashFlowProjections(count: number = 12) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} cash flow projections...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: cashFlowProjectionSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} projections in ${result.metadata.duration}ms`);
|
||||
console.log('Sample projection:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate P&L Statements
|
||||
*/
|
||||
export async function generateProfitLossStatements(count: number = 12) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} P&L statements...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: profitLossSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} statements in ${result.metadata.duration}ms`);
|
||||
console.log('Sample P&L:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Balance Sheets
|
||||
*/
|
||||
export async function generateBalanceSheets(count: number = 12) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} balance sheets...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: balanceSheetSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} balance sheets in ${result.metadata.duration}ms`);
|
||||
console.log('Sample balance sheet:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate KPI Dashboard Data (time-series)
|
||||
*/
|
||||
export async function generateKPIDashboards(count: number = 365) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} KPI dashboard snapshots...`);
|
||||
|
||||
const result = await synth.generateTimeSeries({
|
||||
count,
|
||||
interval: '1d',
|
||||
metrics: ['revenue', 'expenses', 'profitMargin', 'cashFlow'],
|
||||
trend: 'up',
|
||||
seasonality: true
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} KPI snapshots in ${result.metadata.duration}ms`);
|
||||
console.log('Sample KPI:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate complete financial dataset in parallel
|
||||
*/
|
||||
export async function generateCompleteFinancialDataset() {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
|
||||
console.log('Generating complete financial dataset in parallel...');
|
||||
console.time('Total financial generation');
|
||||
|
||||
const [budgets, forecasts, expenses, cashFlow, profitLoss, balanceSheets, kpis] =
|
||||
await Promise.all([
|
||||
generateBudgetPlans(20),
|
||||
generateRevenueForecasts(12),
|
||||
generateExpenseTracking(200),
|
||||
generateCashFlowProjections(12),
|
||||
generateProfitLossStatements(12),
|
||||
generateBalanceSheets(12),
|
||||
generateKPIDashboards(90)
|
||||
]);
|
||||
|
||||
console.timeEnd('Total financial generation');
|
||||
|
||||
return {
|
||||
budgets: budgets.data,
|
||||
revenueForecasts: forecasts.data,
|
||||
expenses: expenses.data,
|
||||
cashFlowProjections: cashFlow.data,
|
||||
profitLossStatements: profitLoss.data,
|
||||
balanceSheets: balanceSheets.data,
|
||||
kpiDashboards: kpis.data,
|
||||
metadata: {
|
||||
totalRecords: budgets.data.length + forecasts.data.length +
|
||||
expenses.data.length + cashFlow.data.length +
|
||||
profitLoss.data.length + balanceSheets.data.length +
|
||||
kpis.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Example usage
|
||||
async function runFinancialExamples() {
|
||||
console.log('=== Financial Planning Data Generation Examples ===\n');
|
||||
|
||||
// Example 1: Budget Planning
|
||||
console.log('1. Budget Planning');
|
||||
await generateBudgetPlans(5);
|
||||
|
||||
// Example 2: Revenue Forecasting
|
||||
console.log('\n2. Revenue Forecasting');
|
||||
await generateRevenueForecasts(5);
|
||||
|
||||
// Example 3: Expense Tracking
|
||||
console.log('\n3. Expense Tracking');
|
||||
await generateExpenseTracking(25);
|
||||
|
||||
// Example 4: Cash Flow Projections
|
||||
console.log('\n4. Cash Flow Projections');
|
||||
await generateCashFlowProjections(12);
|
||||
|
||||
// Example 5: P&L Statements
|
||||
console.log('\n5. Profit & Loss Statements');
|
||||
await generateProfitLossStatements(4);
|
||||
|
||||
// Example 6: Balance Sheets
|
||||
console.log('\n6. Balance Sheets');
|
||||
await generateBalanceSheets(4);
|
||||
|
||||
// Example 7: KPI Dashboards
|
||||
console.log('\n7. KPI Dashboards');
|
||||
await generateKPIDashboards(30);
|
||||
|
||||
// Example 8: Complete financial dataset
|
||||
console.log('\n8. Complete Financial Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteFinancialDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
|
||||
// Uncomment to run
|
||||
// runFinancialExamples().catch(console.error);
|
||||
|
||||
export default {
|
||||
generateBudgetPlans,
|
||||
generateRevenueForecasts,
|
||||
generateExpenseTracking,
|
||||
generateCashFlowProjections,
|
||||
generateProfitLossStatements,
|
||||
generateBalanceSheets,
|
||||
generateKPIDashboards,
|
||||
generateCompleteFinancialDataset
|
||||
};
|
||||
54
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/hr-management.d.ts
vendored
Normal file
54
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/hr-management.d.ts
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Human Resources Management Data Generation
|
||||
* Simulates Workday, SAP SuccessFactors, and Oracle HCM Cloud scenarios
|
||||
*/
|
||||
/**
|
||||
* Generate Workday Employee Profiles
|
||||
*/
|
||||
export declare function generateEmployeeProfiles(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate SAP SuccessFactors Recruitment Pipeline
|
||||
*/
|
||||
export declare function generateRecruitmentPipeline(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Oracle HCM Performance Reviews
|
||||
*/
|
||||
export declare function generatePerformanceReviews(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Workday Payroll Data
|
||||
*/
|
||||
export declare function generatePayrollData(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Time Tracking and Attendance Data (time-series)
|
||||
*/
|
||||
export declare function generateTimeAttendance(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Training and Development Records
|
||||
*/
|
||||
export declare function generateTrainingRecords(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate complete HR dataset in parallel
|
||||
*/
|
||||
export declare function generateCompleteHRDataset(): Promise<{
|
||||
employees: unknown[];
|
||||
recruitment: unknown[];
|
||||
performanceReviews: unknown[];
|
||||
payroll: unknown[];
|
||||
timeAttendance: unknown[];
|
||||
training: unknown[];
|
||||
metadata: {
|
||||
totalRecords: number;
|
||||
generatedAt: string;
|
||||
};
|
||||
}>;
|
||||
declare const _default: {
|
||||
generateEmployeeProfiles: typeof generateEmployeeProfiles;
|
||||
generateRecruitmentPipeline: typeof generateRecruitmentPipeline;
|
||||
generatePerformanceReviews: typeof generatePerformanceReviews;
|
||||
generatePayrollData: typeof generatePayrollData;
|
||||
generateTimeAttendance: typeof generateTimeAttendance;
|
||||
generateTrainingRecords: typeof generateTrainingRecords;
|
||||
generateCompleteHRDataset: typeof generateCompleteHRDataset;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=hr-management.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hr-management.d.ts","sourceRoot":"","sources":["hr-management.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoXH;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,KAAK,GAAE,MAAY,mEAkBjE;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,GAAE,MAAW,mEAiBnE;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,KAAK,GAAE,MAAW,mEAiBlE;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,GAAE,MAAY,mEAiB5D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,GAAE,MAAa,mEAmBhE;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,GAAE,MAAY,mEAiBhE;AAED;;GAEG;AACH,wBAAsB,yBAAyB;;;;;;;;;;;GAmC9C;;;;;;;;;;AAuCD,wBAQE"}
|
||||
553
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/hr-management.js
vendored
Normal file
553
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/hr-management.js
vendored
Normal file
@@ -0,0 +1,553 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Human Resources Management Data Generation
|
||||
* Simulates Workday, SAP SuccessFactors, and Oracle HCM Cloud scenarios
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateEmployeeProfiles = generateEmployeeProfiles;
|
||||
exports.generateRecruitmentPipeline = generateRecruitmentPipeline;
|
||||
exports.generatePerformanceReviews = generatePerformanceReviews;
|
||||
exports.generatePayrollData = generatePayrollData;
|
||||
exports.generateTimeAttendance = generateTimeAttendance;
|
||||
exports.generateTrainingRecords = generateTrainingRecords;
|
||||
exports.generateCompleteHRDataset = generateCompleteHRDataset;
|
||||
const index_js_1 = require("../../src/index.js");
|
||||
// Workday Employee Profile Schema
|
||||
const employeeProfileSchema = {
|
||||
employeeId: { type: 'string', required: true },
|
||||
employeeNumber: { type: 'string', required: true },
|
||||
firstName: { type: 'string', required: true },
|
||||
middleName: { type: 'string', required: false },
|
||||
lastName: { type: 'string', required: true },
|
||||
preferredName: { type: 'string', required: false },
|
||||
dateOfBirth: { type: 'string', required: true },
|
||||
gender: { type: 'string', required: true },
|
||||
maritalStatus: { type: 'string', required: false },
|
||||
nationality: { type: 'string', required: true },
|
||||
ethnicity: { type: 'string', required: false },
|
||||
contactInfo: { type: 'object', required: true, properties: {
|
||||
personalEmail: { type: 'string' },
|
||||
workEmail: { type: 'string' },
|
||||
personalPhone: { type: 'string' },
|
||||
workPhone: { type: 'string' },
|
||||
mobile: { type: 'string' }
|
||||
} },
|
||||
address: { type: 'object', required: true, properties: {
|
||||
street1: { type: 'string' },
|
||||
street2: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
postalCode: { type: 'string' },
|
||||
country: { type: 'string' }
|
||||
} },
|
||||
employment: { type: 'object', required: true, properties: {
|
||||
hireDate: { type: 'string' },
|
||||
originalHireDate: { type: 'string' },
|
||||
employmentType: { type: 'string' },
|
||||
employmentStatus: { type: 'string' },
|
||||
workSchedule: { type: 'string' },
|
||||
fullTimeEquivalent: { type: 'number' },
|
||||
terminationDate: { type: 'string' },
|
||||
terminationReason: { type: 'string' }
|
||||
} },
|
||||
jobInfo: { type: 'object', required: true, properties: {
|
||||
jobTitle: { type: 'string' },
|
||||
jobCode: { type: 'string' },
|
||||
jobFamily: { type: 'string' },
|
||||
jobLevel: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
division: { type: 'string' },
|
||||
businessUnit: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
location: { type: 'string' },
|
||||
workSite: { type: 'string' }
|
||||
} },
|
||||
reportingStructure: { type: 'object', required: true, properties: {
|
||||
managerId: { type: 'string' },
|
||||
managerName: { type: 'string' },
|
||||
dotted, LineManagerId: { type: 'string' },
|
||||
dottedLineManagerName: { type: 'string' },
|
||||
seniorManagerId: { type: 'string' },
|
||||
seniorManagerName: { type: 'string' }
|
||||
} },
|
||||
compensation: { type: 'object', required: true, properties: {
|
||||
baseSalary: { type: 'number' },
|
||||
currency: { type: 'string' },
|
||||
payGrade: { type: 'string' },
|
||||
payGroup: { type: 'string' },
|
||||
payFrequency: { type: 'string' },
|
||||
overtimeEligible: { type: 'boolean' },
|
||||
bonusTarget: { type: 'number' },
|
||||
equityGrants: { type: 'array' }
|
||||
} },
|
||||
benefits: { type: 'object', required: false, properties: {
|
||||
healthPlan: { type: 'string' },
|
||||
dentalPlan: { type: 'string' },
|
||||
visionPlan: { type: 'string' },
|
||||
retirement401k: { type: 'boolean' },
|
||||
stockPurchasePlan: { type: 'boolean' }
|
||||
} },
|
||||
skills: { type: 'array', required: false },
|
||||
certifications: { type: 'array', required: false },
|
||||
education: { type: 'array', required: false, items: {
|
||||
degree: { type: 'string' },
|
||||
institution: { type: 'string' },
|
||||
major: { type: 'string' },
|
||||
graduationYear: { type: 'number' }
|
||||
} }
|
||||
};
|
||||
// SAP SuccessFactors Recruitment Pipeline Schema
|
||||
const recruitmentPipelineSchema = {
|
||||
requisitionId: { type: 'string', required: true },
|
||||
jobPostingId: { type: 'string', required: true },
|
||||
requisitionTitle: { type: 'string', required: true },
|
||||
department: { type: 'string', required: true },
|
||||
location: { type: 'string', required: true },
|
||||
hiringManager: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
} },
|
||||
recruiter: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
} },
|
||||
jobDetails: { type: 'object', required: true, properties: {
|
||||
jobFamily: { type: 'string' },
|
||||
jobLevel: { type: 'string' },
|
||||
employmentType: { type: 'string' },
|
||||
experienceRequired: { type: 'string' },
|
||||
educationRequired: { type: 'string' },
|
||||
skillsRequired: { type: 'array' }
|
||||
} },
|
||||
compensation: { type: 'object', required: true, properties: {
|
||||
salaryRangeMin: { type: 'number' },
|
||||
salaryRangeMax: { type: 'number' },
|
||||
currency: { type: 'string' },
|
||||
bonusEligible: { type: 'boolean' },
|
||||
equityEligible: { type: 'boolean' }
|
||||
} },
|
||||
openDate: { type: 'string', required: true },
|
||||
targetFillDate: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
candidates: { type: 'array', required: true, items: {
|
||||
candidateId: { type: 'string' },
|
||||
candidateName: { type: 'string' },
|
||||
email: { type: 'string' },
|
||||
phone: { type: 'string' },
|
||||
source: { type: 'string' },
|
||||
appliedDate: { type: 'string' },
|
||||
stage: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
rating: { type: 'number' },
|
||||
interviews: { type: 'array' },
|
||||
offer: { type: 'object' }
|
||||
} },
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
totalCandidates: { type: 'number' },
|
||||
screenedCandidates: { type: 'number' },
|
||||
interviewedCandidates: { type: 'number' },
|
||||
offersExtended: { type: 'number' },
|
||||
offersAccepted: { type: 'number' },
|
||||
daysToFill: { type: 'number' },
|
||||
timeToHire: { type: 'number' }
|
||||
} }
|
||||
};
|
||||
// Oracle HCM Performance Review Schema
|
||||
const performanceReviewSchema = {
|
||||
reviewId: { type: 'string', required: true },
|
||||
reviewPeriod: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
reviewType: { type: 'string' },
|
||||
reviewCycle: { type: 'string' }
|
||||
} },
|
||||
employee: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
jobTitle: { type: 'string' },
|
||||
department: { type: 'string' }
|
||||
} },
|
||||
reviewer: { type: 'object', required: true, properties: {
|
||||
reviewerId: { type: 'string' },
|
||||
reviewerName: { type: 'string' },
|
||||
relationship: { type: 'string' }
|
||||
} },
|
||||
goals: { type: 'array', required: true, items: {
|
||||
goalId: { type: 'string' },
|
||||
goalName: { type: 'string' },
|
||||
goalDescription: { type: 'string' },
|
||||
goalType: { type: 'string' },
|
||||
weight: { type: 'number' },
|
||||
targetDate: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
achievement: { type: 'number' },
|
||||
rating: { type: 'string' }
|
||||
} },
|
||||
competencies: { type: 'array', required: true, items: {
|
||||
competencyId: { type: 'string' },
|
||||
competencyName: { type: 'string' },
|
||||
expectedLevel: { type: 'string' },
|
||||
actualLevel: { type: 'string' },
|
||||
rating: { type: 'number' },
|
||||
evidence: { type: 'string' }
|
||||
} },
|
||||
overallRating: { type: 'object', required: true, properties: {
|
||||
rating: { type: 'number' },
|
||||
ratingLabel: { type: 'string' },
|
||||
percentile: { type: 'number' },
|
||||
distribution: { type: 'string' }
|
||||
} },
|
||||
feedback: { type: 'object', required: true, properties: {
|
||||
strengths: { type: 'array' },
|
||||
areasForImprovement: { type: 'array' },
|
||||
managerComments: { type: 'string' },
|
||||
employeeComments: { type: 'string' }
|
||||
} },
|
||||
developmentPlan: { type: 'array', required: false, items: {
|
||||
action: { type: 'string' },
|
||||
targetDate: { type: 'string' },
|
||||
status: { type: 'string' }
|
||||
} },
|
||||
compensation: { type: 'object', required: false, properties: {
|
||||
salaryIncreasePercent: { type: 'number' },
|
||||
bonusPercent: { type: 'number' },
|
||||
promotionRecommended: { type: 'boolean' },
|
||||
newJobTitle: { type: 'string' }
|
||||
} },
|
||||
status: { type: 'string', required: true },
|
||||
submittedDate: { type: 'string', required: false },
|
||||
approvedDate: { type: 'string', required: false }
|
||||
};
|
||||
// Workday Payroll Data Schema
|
||||
const payrollDataSchema = {
|
||||
payrollId: { type: 'string', required: true },
|
||||
payPeriod: { type: 'object', required: true, properties: {
|
||||
periodStartDate: { type: 'string' },
|
||||
periodEndDate: { type: 'string' },
|
||||
payDate: { type: 'string' },
|
||||
periodNumber: { type: 'number' },
|
||||
fiscalYear: { type: 'number' }
|
||||
} },
|
||||
employee: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
employeeNumber: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
costCenter: { type: 'string' }
|
||||
} },
|
||||
earnings: { type: 'array', required: true, items: {
|
||||
earningCode: { type: 'string' },
|
||||
earningDescription: { type: 'string' },
|
||||
hours: { type: 'number' },
|
||||
rate: { type: 'number' },
|
||||
amount: { type: 'number' },
|
||||
earningCategory: { type: 'string' }
|
||||
} },
|
||||
deductions: { type: 'array', required: true, items: {
|
||||
deductionCode: { type: 'string' },
|
||||
deductionDescription: { type: 'string' },
|
||||
amount: { type: 'number' },
|
||||
deductionCategory: { type: 'string' },
|
||||
employerContribution: { type: 'number' }
|
||||
} },
|
||||
taxes: { type: 'array', required: true, items: {
|
||||
taxCode: { type: 'string' },
|
||||
taxDescription: { type: 'string' },
|
||||
taxableWages: { type: 'number' },
|
||||
taxAmount: { type: 'number' },
|
||||
taxAuthority: { type: 'string' }
|
||||
} },
|
||||
summary: { type: 'object', required: true, properties: {
|
||||
grossPay: { type: 'number' },
|
||||
totalDeductions: { type: 'number' },
|
||||
totalTaxes: { type: 'number' },
|
||||
netPay: { type: 'number' },
|
||||
currency: { type: 'string' }
|
||||
} },
|
||||
paymentMethod: { type: 'object', required: true, properties: {
|
||||
method: { type: 'string' },
|
||||
bankName: { type: 'string' },
|
||||
accountNumber: { type: 'string' },
|
||||
routingNumber: { type: 'string' }
|
||||
} },
|
||||
yearToDate: { type: 'object', required: true, properties: {
|
||||
ytdGrossPay: { type: 'number' },
|
||||
ytdDeductions: { type: 'number' },
|
||||
ytdTaxes: { type: 'number' },
|
||||
ytdNetPay: { type: 'number' }
|
||||
} }
|
||||
};
|
||||
// Time Tracking and Attendance Schema
|
||||
const timeAttendanceSchema = {
|
||||
recordId: { type: 'string', required: true },
|
||||
employee: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
department: { type: 'string' }
|
||||
} },
|
||||
date: { type: 'string', required: true },
|
||||
shift: { type: 'object', required: true, properties: {
|
||||
shiftId: { type: 'string' },
|
||||
shiftName: { type: 'string' },
|
||||
scheduledStart: { type: 'string' },
|
||||
scheduledEnd: { type: 'string' },
|
||||
breakDuration: { type: 'number' }
|
||||
} },
|
||||
actual: { type: 'object', required: true, properties: {
|
||||
clockIn: { type: 'string' },
|
||||
clockOut: { type: 'string' },
|
||||
breakStart: { type: 'string' },
|
||||
breakEnd: { type: 'string' },
|
||||
totalHours: { type: 'number' }
|
||||
} },
|
||||
hoursBreakdown: { type: 'object', required: true, properties: {
|
||||
regularHours: { type: 'number' },
|
||||
overtimeHours: { type: 'number' },
|
||||
doubleTimeHours: { type: 'number' },
|
||||
ptoHours: { type: 'number' },
|
||||
sickHours: { type: 'number' },
|
||||
holidayHours: { type: 'number' }
|
||||
} },
|
||||
attendance: { type: 'object', required: true, properties: {
|
||||
status: { type: 'string' },
|
||||
late: { type: 'boolean' },
|
||||
lateMinutes: { type: 'number' },
|
||||
earlyDeparture: { type: 'boolean' },
|
||||
absent: { type: 'boolean' },
|
||||
excused: { type: 'boolean' }
|
||||
} },
|
||||
location: { type: 'object', required: false, properties: {
|
||||
site: { type: 'string' },
|
||||
gpsCoordinates: { type: 'object' }
|
||||
} },
|
||||
approver: { type: 'object', required: false, properties: {
|
||||
approverId: { type: 'string' },
|
||||
approverName: { type: 'string' },
|
||||
approvedDate: { type: 'string' }
|
||||
} }
|
||||
};
|
||||
// Training and Development Schema
|
||||
const trainingDevelopmentSchema = {
|
||||
trainingId: { type: 'string', required: true },
|
||||
employee: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
jobTitle: { type: 'string' }
|
||||
} },
|
||||
course: { type: 'object', required: true, properties: {
|
||||
courseId: { type: 'string' },
|
||||
courseName: { type: 'string' },
|
||||
courseType: { type: 'string' },
|
||||
provider: { type: 'string' },
|
||||
deliveryMethod: { type: 'string' },
|
||||
duration: { type: 'number' },
|
||||
cost: { type: 'number' }
|
||||
} },
|
||||
schedule: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
completionDate: { type: 'string' },
|
||||
expirationDate: { type: 'string' }
|
||||
} },
|
||||
status: { type: 'string', required: true },
|
||||
completion: { type: 'object', required: false, properties: {
|
||||
completed: { type: 'boolean' },
|
||||
score: { type: 'number' },
|
||||
grade: { type: 'string' },
|
||||
certificateIssued: { type: 'boolean' },
|
||||
certificateNumber: { type: 'string' }
|
||||
} },
|
||||
evaluation: { type: 'object', required: false, properties: {
|
||||
satisfaction: { type: 'number' },
|
||||
relevance: { type: 'number' },
|
||||
effectiveness: { type: 'number' },
|
||||
feedback: { type: 'string' }
|
||||
} },
|
||||
linkedCompetencies: { type: 'array', required: false },
|
||||
developmentPlanId: { type: 'string', required: false },
|
||||
requiredFor: { type: 'object', required: false, properties: {
|
||||
compliance: { type: 'boolean' },
|
||||
certification: { type: 'boolean' },
|
||||
promotion: { type: 'boolean' }
|
||||
} }
|
||||
};
|
||||
/**
|
||||
* Generate Workday Employee Profiles
|
||||
*/
|
||||
async function generateEmployeeProfiles(count = 100) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
console.log(`Generating ${count} employee profiles...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: employeeProfileSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} profiles in ${result.metadata.duration}ms`);
|
||||
console.log('Sample profile:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate SAP SuccessFactors Recruitment Pipeline
|
||||
*/
|
||||
async function generateRecruitmentPipeline(count = 25) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} recruitment requisitions...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: recruitmentPipelineSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} requisitions in ${result.metadata.duration}ms`);
|
||||
console.log('Sample requisition:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Oracle HCM Performance Reviews
|
||||
*/
|
||||
async function generatePerformanceReviews(count = 75) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} performance reviews...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: performanceReviewSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} reviews in ${result.metadata.duration}ms`);
|
||||
console.log('Sample review:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Workday Payroll Data
|
||||
*/
|
||||
async function generatePayrollData(count = 500) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} payroll records...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: payrollDataSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} payroll records in ${result.metadata.duration}ms`);
|
||||
console.log('Sample payroll:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Time Tracking and Attendance Data (time-series)
|
||||
*/
|
||||
async function generateTimeAttendance(count = 1000) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} time & attendance records...`);
|
||||
const result = await synth.generateTimeSeries({
|
||||
count,
|
||||
interval: '1d',
|
||||
metrics: ['hoursWorked', 'overtimeHours', 'attendance'],
|
||||
trend: 'stable',
|
||||
seasonality: true
|
||||
});
|
||||
console.log(`Generated ${result.data.length} records in ${result.metadata.duration}ms`);
|
||||
console.log('Sample record:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Training and Development Records
|
||||
*/
|
||||
async function generateTrainingRecords(count = 200) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} training records...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: trainingDevelopmentSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} training records in ${result.metadata.duration}ms`);
|
||||
console.log('Sample record:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate complete HR dataset in parallel
|
||||
*/
|
||||
async function generateCompleteHRDataset() {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
console.log('Generating complete HR dataset in parallel...');
|
||||
console.time('Total HR generation');
|
||||
const [employees, recruitment, performance, payroll, timeAttendance, training] = await Promise.all([
|
||||
generateEmployeeProfiles(100),
|
||||
generateRecruitmentPipeline(20),
|
||||
generatePerformanceReviews(50),
|
||||
generatePayrollData(200),
|
||||
generateTimeAttendance(500),
|
||||
generateTrainingRecords(100)
|
||||
]);
|
||||
console.timeEnd('Total HR generation');
|
||||
return {
|
||||
employees: employees.data,
|
||||
recruitment: recruitment.data,
|
||||
performanceReviews: performance.data,
|
||||
payroll: payroll.data,
|
||||
timeAttendance: timeAttendance.data,
|
||||
training: training.data,
|
||||
metadata: {
|
||||
totalRecords: employees.data.length + recruitment.data.length +
|
||||
performance.data.length + payroll.data.length +
|
||||
timeAttendance.data.length + training.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
// Example usage
|
||||
async function runHRExamples() {
|
||||
console.log('=== HR Management Data Generation Examples ===\n');
|
||||
// Example 1: Employee Profiles
|
||||
console.log('1. Employee Profiles (Workday)');
|
||||
await generateEmployeeProfiles(10);
|
||||
// Example 2: Recruitment Pipeline
|
||||
console.log('\n2. Recruitment Pipeline (SuccessFactors)');
|
||||
await generateRecruitmentPipeline(5);
|
||||
// Example 3: Performance Reviews
|
||||
console.log('\n3. Performance Reviews (Oracle HCM)');
|
||||
await generatePerformanceReviews(10);
|
||||
// Example 4: Payroll Data
|
||||
console.log('\n4. Payroll Data (Workday)');
|
||||
await generatePayrollData(25);
|
||||
// Example 5: Time & Attendance
|
||||
console.log('\n5. Time & Attendance');
|
||||
await generateTimeAttendance(50);
|
||||
// Example 6: Training Records
|
||||
console.log('\n6. Training & Development');
|
||||
await generateTrainingRecords(20);
|
||||
// Example 7: Complete HR dataset
|
||||
console.log('\n7. Complete HR Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteHRDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
// Uncomment to run
|
||||
// runHRExamples().catch(console.error);
|
||||
exports.default = {
|
||||
generateEmployeeProfiles,
|
||||
generateRecruitmentPipeline,
|
||||
generatePerformanceReviews,
|
||||
generatePayrollData,
|
||||
generateTimeAttendance,
|
||||
generateTrainingRecords,
|
||||
generateCompleteHRDataset
|
||||
};
|
||||
//# sourceMappingURL=hr-management.js.map
|
||||
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/hr-management.js.map
vendored
Normal file
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/hr-management.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
596
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/hr-management.ts
vendored
Normal file
596
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/hr-management.ts
vendored
Normal file
@@ -0,0 +1,596 @@
|
||||
/**
|
||||
* Human Resources Management Data Generation
|
||||
* Simulates Workday, SAP SuccessFactors, and Oracle HCM Cloud scenarios
|
||||
*/
|
||||
|
||||
import { createSynth } from '../../src/index.js';
|
||||
|
||||
// Workday Employee Profile Schema
|
||||
const employeeProfileSchema = {
|
||||
employeeId: { type: 'string', required: true },
|
||||
employeeNumber: { type: 'string', required: true },
|
||||
firstName: { type: 'string', required: true },
|
||||
middleName: { type: 'string', required: false },
|
||||
lastName: { type: 'string', required: true },
|
||||
preferredName: { type: 'string', required: false },
|
||||
dateOfBirth: { type: 'string', required: true },
|
||||
gender: { type: 'string', required: true },
|
||||
maritalStatus: { type: 'string', required: false },
|
||||
nationality: { type: 'string', required: true },
|
||||
ethnicity: { type: 'string', required: false },
|
||||
contactInfo: { type: 'object', required: true, properties: {
|
||||
personalEmail: { type: 'string' },
|
||||
workEmail: { type: 'string' },
|
||||
personalPhone: { type: 'string' },
|
||||
workPhone: { type: 'string' },
|
||||
mobile: { type: 'string' }
|
||||
}},
|
||||
address: { type: 'object', required: true, properties: {
|
||||
street1: { type: 'string' },
|
||||
street2: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
postalCode: { type: 'string' },
|
||||
country: { type: 'string' }
|
||||
}},
|
||||
employment: { type: 'object', required: true, properties: {
|
||||
hireDate: { type: 'string' },
|
||||
originalHireDate: { type: 'string' },
|
||||
employmentType: { type: 'string' },
|
||||
employmentStatus: { type: 'string' },
|
||||
workSchedule: { type: 'string' },
|
||||
fullTimeEquivalent: { type: 'number' },
|
||||
terminationDate: { type: 'string' },
|
||||
terminationReason: { type: 'string' }
|
||||
}},
|
||||
jobInfo: { type: 'object', required: true, properties: {
|
||||
jobTitle: { type: 'string' },
|
||||
jobCode: { type: 'string' },
|
||||
jobFamily: { type: 'string' },
|
||||
jobLevel: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
division: { type: 'string' },
|
||||
businessUnit: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
location: { type: 'string' },
|
||||
workSite: { type: 'string' }
|
||||
}},
|
||||
reportingStructure: { type: 'object', required: true, properties: {
|
||||
managerId: { type: 'string' },
|
||||
managerName: { type: 'string' },
|
||||
dotted LineManagerId: { type: 'string' },
|
||||
dottedLineManagerName: { type: 'string' },
|
||||
seniorManagerId: { type: 'string' },
|
||||
seniorManagerName: { type: 'string' }
|
||||
}},
|
||||
compensation: { type: 'object', required: true, properties: {
|
||||
baseSalary: { type: 'number' },
|
||||
currency: { type: 'string' },
|
||||
payGrade: { type: 'string' },
|
||||
payGroup: { type: 'string' },
|
||||
payFrequency: { type: 'string' },
|
||||
overtimeEligible: { type: 'boolean' },
|
||||
bonusTarget: { type: 'number' },
|
||||
equityGrants: { type: 'array' }
|
||||
}},
|
||||
benefits: { type: 'object', required: false, properties: {
|
||||
healthPlan: { type: 'string' },
|
||||
dentalPlan: { type: 'string' },
|
||||
visionPlan: { type: 'string' },
|
||||
retirement401k: { type: 'boolean' },
|
||||
stockPurchasePlan: { type: 'boolean' }
|
||||
}},
|
||||
skills: { type: 'array', required: false },
|
||||
certifications: { type: 'array', required: false },
|
||||
education: { type: 'array', required: false, items: {
|
||||
degree: { type: 'string' },
|
||||
institution: { type: 'string' },
|
||||
major: { type: 'string' },
|
||||
graduationYear: { type: 'number' }
|
||||
}}
|
||||
};
|
||||
|
||||
// SAP SuccessFactors Recruitment Pipeline Schema
|
||||
const recruitmentPipelineSchema = {
|
||||
requisitionId: { type: 'string', required: true },
|
||||
jobPostingId: { type: 'string', required: true },
|
||||
requisitionTitle: { type: 'string', required: true },
|
||||
department: { type: 'string', required: true },
|
||||
location: { type: 'string', required: true },
|
||||
hiringManager: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
}},
|
||||
recruiter: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
}},
|
||||
jobDetails: { type: 'object', required: true, properties: {
|
||||
jobFamily: { type: 'string' },
|
||||
jobLevel: { type: 'string' },
|
||||
employmentType: { type: 'string' },
|
||||
experienceRequired: { type: 'string' },
|
||||
educationRequired: { type: 'string' },
|
||||
skillsRequired: { type: 'array' }
|
||||
}},
|
||||
compensation: { type: 'object', required: true, properties: {
|
||||
salaryRangeMin: { type: 'number' },
|
||||
salaryRangeMax: { type: 'number' },
|
||||
currency: { type: 'string' },
|
||||
bonusEligible: { type: 'boolean' },
|
||||
equityEligible: { type: 'boolean' }
|
||||
}},
|
||||
openDate: { type: 'string', required: true },
|
||||
targetFillDate: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
candidates: { type: 'array', required: true, items: {
|
||||
candidateId: { type: 'string' },
|
||||
candidateName: { type: 'string' },
|
||||
email: { type: 'string' },
|
||||
phone: { type: 'string' },
|
||||
source: { type: 'string' },
|
||||
appliedDate: { type: 'string' },
|
||||
stage: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
rating: { type: 'number' },
|
||||
interviews: { type: 'array' },
|
||||
offer: { type: 'object' }
|
||||
}},
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
totalCandidates: { type: 'number' },
|
||||
screenedCandidates: { type: 'number' },
|
||||
interviewedCandidates: { type: 'number' },
|
||||
offersExtended: { type: 'number' },
|
||||
offersAccepted: { type: 'number' },
|
||||
daysToFill: { type: 'number' },
|
||||
timeToHire: { type: 'number' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Oracle HCM Performance Review Schema
|
||||
const performanceReviewSchema = {
|
||||
reviewId: { type: 'string', required: true },
|
||||
reviewPeriod: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
reviewType: { type: 'string' },
|
||||
reviewCycle: { type: 'string' }
|
||||
}},
|
||||
employee: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
jobTitle: { type: 'string' },
|
||||
department: { type: 'string' }
|
||||
}},
|
||||
reviewer: { type: 'object', required: true, properties: {
|
||||
reviewerId: { type: 'string' },
|
||||
reviewerName: { type: 'string' },
|
||||
relationship: { type: 'string' }
|
||||
}},
|
||||
goals: { type: 'array', required: true, items: {
|
||||
goalId: { type: 'string' },
|
||||
goalName: { type: 'string' },
|
||||
goalDescription: { type: 'string' },
|
||||
goalType: { type: 'string' },
|
||||
weight: { type: 'number' },
|
||||
targetDate: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
achievement: { type: 'number' },
|
||||
rating: { type: 'string' }
|
||||
}},
|
||||
competencies: { type: 'array', required: true, items: {
|
||||
competencyId: { type: 'string' },
|
||||
competencyName: { type: 'string' },
|
||||
expectedLevel: { type: 'string' },
|
||||
actualLevel: { type: 'string' },
|
||||
rating: { type: 'number' },
|
||||
evidence: { type: 'string' }
|
||||
}},
|
||||
overallRating: { type: 'object', required: true, properties: {
|
||||
rating: { type: 'number' },
|
||||
ratingLabel: { type: 'string' },
|
||||
percentile: { type: 'number' },
|
||||
distribution: { type: 'string' }
|
||||
}},
|
||||
feedback: { type: 'object', required: true, properties: {
|
||||
strengths: { type: 'array' },
|
||||
areasForImprovement: { type: 'array' },
|
||||
managerComments: { type: 'string' },
|
||||
employeeComments: { type: 'string' }
|
||||
}},
|
||||
developmentPlan: { type: 'array', required: false, items: {
|
||||
action: { type: 'string' },
|
||||
targetDate: { type: 'string' },
|
||||
status: { type: 'string' }
|
||||
}},
|
||||
compensation: { type: 'object', required: false, properties: {
|
||||
salaryIncreasePercent: { type: 'number' },
|
||||
bonusPercent: { type: 'number' },
|
||||
promotionRecommended: { type: 'boolean' },
|
||||
newJobTitle: { type: 'string' }
|
||||
}},
|
||||
status: { type: 'string', required: true },
|
||||
submittedDate: { type: 'string', required: false },
|
||||
approvedDate: { type: 'string', required: false }
|
||||
};
|
||||
|
||||
// Workday Payroll Data Schema
|
||||
const payrollDataSchema = {
|
||||
payrollId: { type: 'string', required: true },
|
||||
payPeriod: { type: 'object', required: true, properties: {
|
||||
periodStartDate: { type: 'string' },
|
||||
periodEndDate: { type: 'string' },
|
||||
payDate: { type: 'string' },
|
||||
periodNumber: { type: 'number' },
|
||||
fiscalYear: { type: 'number' }
|
||||
}},
|
||||
employee: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
employeeNumber: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
costCenter: { type: 'string' }
|
||||
}},
|
||||
earnings: { type: 'array', required: true, items: {
|
||||
earningCode: { type: 'string' },
|
||||
earningDescription: { type: 'string' },
|
||||
hours: { type: 'number' },
|
||||
rate: { type: 'number' },
|
||||
amount: { type: 'number' },
|
||||
earningCategory: { type: 'string' }
|
||||
}},
|
||||
deductions: { type: 'array', required: true, items: {
|
||||
deductionCode: { type: 'string' },
|
||||
deductionDescription: { type: 'string' },
|
||||
amount: { type: 'number' },
|
||||
deductionCategory: { type: 'string' },
|
||||
employerContribution: { type: 'number' }
|
||||
}},
|
||||
taxes: { type: 'array', required: true, items: {
|
||||
taxCode: { type: 'string' },
|
||||
taxDescription: { type: 'string' },
|
||||
taxableWages: { type: 'number' },
|
||||
taxAmount: { type: 'number' },
|
||||
taxAuthority: { type: 'string' }
|
||||
}},
|
||||
summary: { type: 'object', required: true, properties: {
|
||||
grossPay: { type: 'number' },
|
||||
totalDeductions: { type: 'number' },
|
||||
totalTaxes: { type: 'number' },
|
||||
netPay: { type: 'number' },
|
||||
currency: { type: 'string' }
|
||||
}},
|
||||
paymentMethod: { type: 'object', required: true, properties: {
|
||||
method: { type: 'string' },
|
||||
bankName: { type: 'string' },
|
||||
accountNumber: { type: 'string' },
|
||||
routingNumber: { type: 'string' }
|
||||
}},
|
||||
yearToDate: { type: 'object', required: true, properties: {
|
||||
ytdGrossPay: { type: 'number' },
|
||||
ytdDeductions: { type: 'number' },
|
||||
ytdTaxes: { type: 'number' },
|
||||
ytdNetPay: { type: 'number' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Time Tracking and Attendance Schema
|
||||
const timeAttendanceSchema = {
|
||||
recordId: { type: 'string', required: true },
|
||||
employee: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
department: { type: 'string' }
|
||||
}},
|
||||
date: { type: 'string', required: true },
|
||||
shift: { type: 'object', required: true, properties: {
|
||||
shiftId: { type: 'string' },
|
||||
shiftName: { type: 'string' },
|
||||
scheduledStart: { type: 'string' },
|
||||
scheduledEnd: { type: 'string' },
|
||||
breakDuration: { type: 'number' }
|
||||
}},
|
||||
actual: { type: 'object', required: true, properties: {
|
||||
clockIn: { type: 'string' },
|
||||
clockOut: { type: 'string' },
|
||||
breakStart: { type: 'string' },
|
||||
breakEnd: { type: 'string' },
|
||||
totalHours: { type: 'number' }
|
||||
}},
|
||||
hoursBreakdown: { type: 'object', required: true, properties: {
|
||||
regularHours: { type: 'number' },
|
||||
overtimeHours: { type: 'number' },
|
||||
doubleTimeHours: { type: 'number' },
|
||||
ptoHours: { type: 'number' },
|
||||
sickHours: { type: 'number' },
|
||||
holidayHours: { type: 'number' }
|
||||
}},
|
||||
attendance: { type: 'object', required: true, properties: {
|
||||
status: { type: 'string' },
|
||||
late: { type: 'boolean' },
|
||||
lateMinutes: { type: 'number' },
|
||||
earlyDeparture: { type: 'boolean' },
|
||||
absent: { type: 'boolean' },
|
||||
excused: { type: 'boolean' }
|
||||
}},
|
||||
location: { type: 'object', required: false, properties: {
|
||||
site: { type: 'string' },
|
||||
gpsCoordinates: { type: 'object' }
|
||||
}},
|
||||
approver: { type: 'object', required: false, properties: {
|
||||
approverId: { type: 'string' },
|
||||
approverName: { type: 'string' },
|
||||
approvedDate: { type: 'string' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Training and Development Schema
|
||||
const trainingDevelopmentSchema = {
|
||||
trainingId: { type: 'string', required: true },
|
||||
employee: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
jobTitle: { type: 'string' }
|
||||
}},
|
||||
course: { type: 'object', required: true, properties: {
|
||||
courseId: { type: 'string' },
|
||||
courseName: { type: 'string' },
|
||||
courseType: { type: 'string' },
|
||||
provider: { type: 'string' },
|
||||
deliveryMethod: { type: 'string' },
|
||||
duration: { type: 'number' },
|
||||
cost: { type: 'number' }
|
||||
}},
|
||||
schedule: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
completionDate: { type: 'string' },
|
||||
expirationDate: { type: 'string' }
|
||||
}},
|
||||
status: { type: 'string', required: true },
|
||||
completion: { type: 'object', required: false, properties: {
|
||||
completed: { type: 'boolean' },
|
||||
score: { type: 'number' },
|
||||
grade: { type: 'string' },
|
||||
certificateIssued: { type: 'boolean' },
|
||||
certificateNumber: { type: 'string' }
|
||||
}},
|
||||
evaluation: { type: 'object', required: false, properties: {
|
||||
satisfaction: { type: 'number' },
|
||||
relevance: { type: 'number' },
|
||||
effectiveness: { type: 'number' },
|
||||
feedback: { type: 'string' }
|
||||
}},
|
||||
linkedCompetencies: { type: 'array', required: false },
|
||||
developmentPlanId: { type: 'string', required: false },
|
||||
requiredFor: { type: 'object', required: false, properties: {
|
||||
compliance: { type: 'boolean' },
|
||||
certification: { type: 'boolean' },
|
||||
promotion: { type: 'boolean' }
|
||||
}}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate Workday Employee Profiles
|
||||
*/
|
||||
export async function generateEmployeeProfiles(count: number = 100) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} employee profiles...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: employeeProfileSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} profiles in ${result.metadata.duration}ms`);
|
||||
console.log('Sample profile:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SAP SuccessFactors Recruitment Pipeline
|
||||
*/
|
||||
export async function generateRecruitmentPipeline(count: number = 25) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} recruitment requisitions...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: recruitmentPipelineSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} requisitions in ${result.metadata.duration}ms`);
|
||||
console.log('Sample requisition:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Oracle HCM Performance Reviews
|
||||
*/
|
||||
export async function generatePerformanceReviews(count: number = 75) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} performance reviews...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: performanceReviewSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} reviews in ${result.metadata.duration}ms`);
|
||||
console.log('Sample review:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Workday Payroll Data
|
||||
*/
|
||||
export async function generatePayrollData(count: number = 500) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} payroll records...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: payrollDataSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} payroll records in ${result.metadata.duration}ms`);
|
||||
console.log('Sample payroll:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Time Tracking and Attendance Data (time-series)
|
||||
*/
|
||||
export async function generateTimeAttendance(count: number = 1000) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} time & attendance records...`);
|
||||
|
||||
const result = await synth.generateTimeSeries({
|
||||
count,
|
||||
interval: '1d',
|
||||
metrics: ['hoursWorked', 'overtimeHours', 'attendance'],
|
||||
trend: 'stable',
|
||||
seasonality: true
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} records in ${result.metadata.duration}ms`);
|
||||
console.log('Sample record:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Training and Development Records
|
||||
*/
|
||||
export async function generateTrainingRecords(count: number = 200) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} training records...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: trainingDevelopmentSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} training records in ${result.metadata.duration}ms`);
|
||||
console.log('Sample record:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate complete HR dataset in parallel
|
||||
*/
|
||||
export async function generateCompleteHRDataset() {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
|
||||
console.log('Generating complete HR dataset in parallel...');
|
||||
console.time('Total HR generation');
|
||||
|
||||
const [employees, recruitment, performance, payroll, timeAttendance, training] =
|
||||
await Promise.all([
|
||||
generateEmployeeProfiles(100),
|
||||
generateRecruitmentPipeline(20),
|
||||
generatePerformanceReviews(50),
|
||||
generatePayrollData(200),
|
||||
generateTimeAttendance(500),
|
||||
generateTrainingRecords(100)
|
||||
]);
|
||||
|
||||
console.timeEnd('Total HR generation');
|
||||
|
||||
return {
|
||||
employees: employees.data,
|
||||
recruitment: recruitment.data,
|
||||
performanceReviews: performance.data,
|
||||
payroll: payroll.data,
|
||||
timeAttendance: timeAttendance.data,
|
||||
training: training.data,
|
||||
metadata: {
|
||||
totalRecords: employees.data.length + recruitment.data.length +
|
||||
performance.data.length + payroll.data.length +
|
||||
timeAttendance.data.length + training.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Example usage
|
||||
async function runHRExamples() {
|
||||
console.log('=== HR Management Data Generation Examples ===\n');
|
||||
|
||||
// Example 1: Employee Profiles
|
||||
console.log('1. Employee Profiles (Workday)');
|
||||
await generateEmployeeProfiles(10);
|
||||
|
||||
// Example 2: Recruitment Pipeline
|
||||
console.log('\n2. Recruitment Pipeline (SuccessFactors)');
|
||||
await generateRecruitmentPipeline(5);
|
||||
|
||||
// Example 3: Performance Reviews
|
||||
console.log('\n3. Performance Reviews (Oracle HCM)');
|
||||
await generatePerformanceReviews(10);
|
||||
|
||||
// Example 4: Payroll Data
|
||||
console.log('\n4. Payroll Data (Workday)');
|
||||
await generatePayrollData(25);
|
||||
|
||||
// Example 5: Time & Attendance
|
||||
console.log('\n5. Time & Attendance');
|
||||
await generateTimeAttendance(50);
|
||||
|
||||
// Example 6: Training Records
|
||||
console.log('\n6. Training & Development');
|
||||
await generateTrainingRecords(20);
|
||||
|
||||
// Example 7: Complete HR dataset
|
||||
console.log('\n7. Complete HR Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteHRDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
|
||||
// Uncomment to run
|
||||
// runHRExamples().catch(console.error);
|
||||
|
||||
export default {
|
||||
generateEmployeeProfiles,
|
||||
generateRecruitmentPipeline,
|
||||
generatePerformanceReviews,
|
||||
generatePayrollData,
|
||||
generateTimeAttendance,
|
||||
generateTrainingRecords,
|
||||
generateCompleteHRDataset
|
||||
};
|
||||
70
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.d.ts
vendored
Normal file
70
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.d.ts
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Business Operations Management Data Generation
|
||||
* Simulates project management, vendor management, contract lifecycle, and approval workflows
|
||||
*/
|
||||
/**
|
||||
* Generate Project Management Data
|
||||
*/
|
||||
export declare function generateProjects(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Resource Allocation Data
|
||||
*/
|
||||
export declare function generateResourceAllocations(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Vendor Management Data
|
||||
*/
|
||||
export declare function generateVendors(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Contract Lifecycle Data
|
||||
*/
|
||||
export declare function generateContracts(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Approval Workflow Data
|
||||
*/
|
||||
export declare function generateApprovalWorkflows(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate Audit Trail Data (time-series)
|
||||
*/
|
||||
export declare function generateAuditTrail(count?: number): Promise<import("../../src/types.js").GenerationResult<unknown>>;
|
||||
/**
|
||||
* Generate complete operations dataset in parallel
|
||||
*/
|
||||
export declare function generateCompleteOperationsDataset(): Promise<{
|
||||
projects: unknown[];
|
||||
resourceAllocations: unknown[];
|
||||
vendors: unknown[];
|
||||
contracts: unknown[];
|
||||
approvalWorkflows: unknown[];
|
||||
auditTrail: unknown[];
|
||||
metadata: {
|
||||
totalRecords: number;
|
||||
generatedAt: string;
|
||||
};
|
||||
}>;
|
||||
/**
|
||||
* Simulate end-to-end procurement workflow
|
||||
*/
|
||||
export declare function simulateProcurementWorkflow(): Promise<{
|
||||
vendors: unknown[];
|
||||
contracts: unknown[];
|
||||
approvals: unknown[];
|
||||
auditTrail: unknown[];
|
||||
summary: {
|
||||
vendorsOnboarded: number;
|
||||
contractsCreated: number;
|
||||
approvalsProcessed: number;
|
||||
auditEvents: number;
|
||||
};
|
||||
}>;
|
||||
declare const _default: {
|
||||
generateProjects: typeof generateProjects;
|
||||
generateResourceAllocations: typeof generateResourceAllocations;
|
||||
generateVendors: typeof generateVendors;
|
||||
generateContracts: typeof generateContracts;
|
||||
generateApprovalWorkflows: typeof generateApprovalWorkflows;
|
||||
generateAuditTrail: typeof generateAuditTrail;
|
||||
generateCompleteOperationsDataset: typeof generateCompleteOperationsDataset;
|
||||
simulateProcurementWorkflow: typeof simulateProcurementWorkflow;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=operations.d.ts.map
|
||||
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.d.ts.map
vendored
Normal file
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.d.ts.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["operations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkaH;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,GAAE,MAAW,mEAkBxD;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,GAAE,MAAY,mEAiBpE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,KAAK,GAAE,MAAW,mEAiBvD;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,GAAE,MAAY,mEAiB1D;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,GAAE,MAAY,mEAiBlE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,GAAE,MAAa,mEAqB5D;AAED;;GAEG;AACH,wBAAsB,iCAAiC;;;;;;;;;;;GAmCtD;AAED;;GAEG;AACH,wBAAsB,2BAA2B;;;;;;;;;;;GAkChD;;;;;;;;;;;AA2CD,wBASE"}
|
||||
638
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.js
vendored
Normal file
638
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.js
vendored
Normal file
@@ -0,0 +1,638 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Business Operations Management Data Generation
|
||||
* Simulates project management, vendor management, contract lifecycle, and approval workflows
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateProjects = generateProjects;
|
||||
exports.generateResourceAllocations = generateResourceAllocations;
|
||||
exports.generateVendors = generateVendors;
|
||||
exports.generateContracts = generateContracts;
|
||||
exports.generateApprovalWorkflows = generateApprovalWorkflows;
|
||||
exports.generateAuditTrail = generateAuditTrail;
|
||||
exports.generateCompleteOperationsDataset = generateCompleteOperationsDataset;
|
||||
exports.simulateProcurementWorkflow = simulateProcurementWorkflow;
|
||||
const index_js_1 = require("../../src/index.js");
|
||||
// Project Management Schema (Jira/Asana/MS Project style)
|
||||
const projectManagementSchema = {
|
||||
projectId: { type: 'string', required: true },
|
||||
projectName: { type: 'string', required: true },
|
||||
projectCode: { type: 'string', required: true },
|
||||
description: { type: 'string', required: true },
|
||||
projectType: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
priority: { type: 'string', required: true },
|
||||
businessUnit: { type: 'string', required: true },
|
||||
department: { type: 'string', required: true },
|
||||
timeline: { type: 'object', required: true, properties: {
|
||||
plannedStartDate: { type: 'string' },
|
||||
plannedEndDate: { type: 'string' },
|
||||
actualStartDate: { type: 'string' },
|
||||
actualEndDate: { type: 'string' },
|
||||
duration: { type: 'number' },
|
||||
percentComplete: { type: 'number' }
|
||||
} },
|
||||
team: { type: 'object', required: true, properties: {
|
||||
projectManager: { type: 'object', properties: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
} },
|
||||
sponsor: { type: 'object', properties: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
department: { type: 'string' }
|
||||
} },
|
||||
teamMembers: { type: 'array', items: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
role: { type: 'string' },
|
||||
allocation: { type: 'number' }
|
||||
} },
|
||||
stakeholders: { type: 'array' }
|
||||
} },
|
||||
budget: { type: 'object', required: true, properties: {
|
||||
plannedBudget: { type: 'number' },
|
||||
actualCost: { type: 'number' },
|
||||
committedCost: { type: 'number' },
|
||||
remainingBudget: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
variancePercent: { type: 'number' },
|
||||
currency: { type: 'string' }
|
||||
} },
|
||||
phases: { type: 'array', required: true, items: {
|
||||
phaseId: { type: 'string' },
|
||||
phaseName: { type: 'string' },
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
deliverables: { type: 'array' }
|
||||
} },
|
||||
tasks: { type: 'array', required: true, items: {
|
||||
taskId: { type: 'string' },
|
||||
taskName: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
assignee: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
priority: { type: 'string' },
|
||||
startDate: { type: 'string' },
|
||||
dueDate: { type: 'string' },
|
||||
completedDate: { type: 'string' },
|
||||
estimatedHours: { type: 'number' },
|
||||
actualHours: { type: 'number' },
|
||||
dependencies: { type: 'array' }
|
||||
} },
|
||||
risks: { type: 'array', required: false, items: {
|
||||
riskId: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
probability: { type: 'string' },
|
||||
impact: { type: 'string' },
|
||||
mitigation: { type: 'string' },
|
||||
owner: { type: 'string' },
|
||||
status: { type: 'string' }
|
||||
} },
|
||||
issues: { type: 'array', required: false, items: {
|
||||
issueId: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
severity: { type: 'string' },
|
||||
reportedBy: { type: 'string' },
|
||||
assignedTo: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
resolution: { type: 'string' }
|
||||
} },
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
schedulePerformanceIndex: { type: 'number' },
|
||||
costPerformanceIndex: { type: 'number' },
|
||||
earnedValue: { type: 'number' },
|
||||
plannedValue: { type: 'number' },
|
||||
actualCost: { type: 'number' },
|
||||
estimateAtCompletion: { type: 'number' }
|
||||
} }
|
||||
};
|
||||
// Resource Allocation Schema
|
||||
const resourceAllocationSchema = {
|
||||
allocationId: { type: 'string', required: true },
|
||||
allocationDate: { type: 'string', required: true },
|
||||
period: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' }
|
||||
} },
|
||||
resource: { type: 'object', required: true, properties: {
|
||||
resourceId: { type: 'string' },
|
||||
resourceName: { type: 'string' },
|
||||
resourceType: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
skillSet: { type: 'array' },
|
||||
seniorityLevel: { type: 'string' }
|
||||
} },
|
||||
project: { type: 'object', required: true, properties: {
|
||||
projectId: { type: 'string' },
|
||||
projectName: { type: 'string' },
|
||||
projectManager: { type: 'string' }
|
||||
} },
|
||||
allocation: { type: 'object', required: true, properties: {
|
||||
allocationPercent: { type: 'number' },
|
||||
hoursPerWeek: { type: 'number' },
|
||||
totalHours: { type: 'number' },
|
||||
billableRate: { type: 'number' },
|
||||
internalRate: { type: 'number' },
|
||||
currency: { type: 'string' }
|
||||
} },
|
||||
utilization: { type: 'object', required: true, properties: {
|
||||
totalCapacity: { type: 'number' },
|
||||
allocatedHours: { type: 'number' },
|
||||
availableHours: { type: 'number' },
|
||||
utilizationRate: { type: 'number' },
|
||||
overallocationHours: { type: 'number' }
|
||||
} },
|
||||
status: { type: 'string', required: true },
|
||||
approvedBy: { type: 'string', required: false },
|
||||
approvalDate: { type: 'string', required: false }
|
||||
};
|
||||
// Vendor Management Schema
|
||||
const vendorManagementSchema = {
|
||||
vendorId: { type: 'string', required: true },
|
||||
vendorName: { type: 'string', required: true },
|
||||
vendorType: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
tier: { type: 'string', required: true },
|
||||
contactInfo: { type: 'object', required: true, properties: {
|
||||
primaryContact: { type: 'object', properties: {
|
||||
name: { type: 'string' },
|
||||
title: { type: 'string' },
|
||||
email: { type: 'string' },
|
||||
phone: { type: 'string' }
|
||||
} },
|
||||
accountManager: { type: 'object', properties: {
|
||||
name: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
} },
|
||||
address: { type: 'object', properties: {
|
||||
street: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
country: { type: 'string' },
|
||||
postalCode: { type: 'string' }
|
||||
} },
|
||||
website: { type: 'string' },
|
||||
taxId: { type: 'string' }
|
||||
} },
|
||||
businessDetails: { type: 'object', required: true, properties: {
|
||||
industry: { type: 'string' },
|
||||
yearEstablished: { type: 'number' },
|
||||
numberOfEmployees: { type: 'number' },
|
||||
annualRevenue: { type: 'number' },
|
||||
certifications: { type: 'array' },
|
||||
servicesProvided: { type: 'array' }
|
||||
} },
|
||||
contractInfo: { type: 'object', required: true, properties: {
|
||||
activeContracts: { type: 'number' },
|
||||
totalContractValue: { type: 'number' },
|
||||
contractStartDate: { type: 'string' },
|
||||
contractEndDate: { type: 'string' },
|
||||
renewalDate: { type: 'string' },
|
||||
paymentTerms: { type: 'string' },
|
||||
currency: { type: 'string' }
|
||||
} },
|
||||
performance: { type: 'object', required: true, properties: {
|
||||
overallScore: { type: 'number' },
|
||||
qualityScore: { type: 'number' },
|
||||
deliveryScore: { type: 'number' },
|
||||
complianceScore: { type: 'number' },
|
||||
responsiveScore: { type: 'number' },
|
||||
lastReviewDate: { type: 'string' },
|
||||
nextReviewDate: { type: 'string' }
|
||||
} },
|
||||
riskAssessment: { type: 'object', required: true, properties: {
|
||||
riskLevel: { type: 'string' },
|
||||
financialRisk: { type: 'string' },
|
||||
operationalRisk: { type: 'string' },
|
||||
complianceRisk: { type: 'string' },
|
||||
cyberSecurityRisk: { type: 'string' },
|
||||
lastAuditDate: { type: 'string' }
|
||||
} },
|
||||
spending: { type: 'object', required: true, properties: {
|
||||
ytdSpending: { type: 'number' },
|
||||
lifetimeSpending: { type: 'number' },
|
||||
averageInvoiceAmount: { type: 'number' },
|
||||
paymentHistory: { type: 'object', properties: {
|
||||
onTimePaymentRate: { type: 'number' },
|
||||
averageDaysToPay: { type: 'number' }
|
||||
} }
|
||||
} },
|
||||
compliance: { type: 'object', required: false, properties: {
|
||||
insuranceCertificate: { type: 'boolean' },
|
||||
w9Form: { type: 'boolean' },
|
||||
nda: { type: 'boolean' },
|
||||
backgroundCheckCompleted: { type: 'boolean' },
|
||||
lastComplianceCheck: { type: 'string' }
|
||||
} },
|
||||
documents: { type: 'array', required: false }
|
||||
};
|
||||
// Contract Lifecycle Management Schema
|
||||
const contractLifecycleSchema = {
|
||||
contractId: { type: 'string', required: true },
|
||||
contractNumber: { type: 'string', required: true },
|
||||
contractName: { type: 'string', required: true },
|
||||
contractType: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
parties: { type: 'object', required: true, properties: {
|
||||
buyer: { type: 'object', properties: {
|
||||
companyCode: { type: 'string' },
|
||||
companyName: { type: 'string' },
|
||||
legalEntity: { type: 'string' },
|
||||
signatoryName: { type: 'string' },
|
||||
signatoryTitle: { type: 'string' }
|
||||
} },
|
||||
seller: { type: 'object', properties: {
|
||||
vendorId: { type: 'string' },
|
||||
vendorName: { type: 'string' },
|
||||
legalEntity: { type: 'string' },
|
||||
signatoryName: { type: 'string' },
|
||||
signatoryTitle: { type: 'string' }
|
||||
} }
|
||||
} },
|
||||
timeline: { type: 'object', required: true, properties: {
|
||||
requestDate: { type: 'string' },
|
||||
approvalDate: { type: 'string' },
|
||||
executionDate: { type: 'string' },
|
||||
effectiveDate: { type: 'string' },
|
||||
expirationDate: { type: 'string' },
|
||||
autoRenewal: { type: 'boolean' },
|
||||
renewalNoticeDays: { type: 'number' },
|
||||
terminationNoticeDays: { type: 'number' }
|
||||
} },
|
||||
financial: { type: 'object', required: true, properties: {
|
||||
totalContractValue: { type: 'number' },
|
||||
currency: { type: 'string' },
|
||||
billingFrequency: { type: 'string' },
|
||||
paymentTerms: { type: 'string' },
|
||||
annualValue: { type: 'number' },
|
||||
invoicedToDate: { type: 'number' },
|
||||
paidToDate: { type: 'number' },
|
||||
outstandingBalance: { type: 'number' }
|
||||
} },
|
||||
terms: { type: 'object', required: true, properties: {
|
||||
scopeOfWork: { type: 'string' },
|
||||
deliverables: { type: 'array' },
|
||||
serviceLevelAgreements: { type: 'array' },
|
||||
penaltyClause: { type: 'boolean' },
|
||||
warrantyPeriod: { type: 'number' },
|
||||
liabilityLimit: { type: 'number' },
|
||||
confidentialityClause: { type: 'boolean' },
|
||||
nonCompeteClause: { type: 'boolean' }
|
||||
} },
|
||||
obligations: { type: 'array', required: true, items: {
|
||||
obligationId: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
responsibleParty: { type: 'string' },
|
||||
dueDate: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
completedDate: { type: 'string' }
|
||||
} },
|
||||
amendments: { type: 'array', required: false, items: {
|
||||
amendmentNumber: { type: 'string' },
|
||||
amendmentDate: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
financialImpact: { type: 'number' }
|
||||
} },
|
||||
owners: { type: 'object', required: true, properties: {
|
||||
contractOwner: { type: 'string' },
|
||||
businessOwner: { type: 'string' },
|
||||
legalReviewer: { type: 'string' },
|
||||
financeApprover: { type: 'string' }
|
||||
} },
|
||||
compliance: { type: 'object', required: true, properties: {
|
||||
regulatoryCompliance: { type: 'boolean' },
|
||||
dataPrivacyCompliance: { type: 'boolean' },
|
||||
lastAuditDate: { type: 'string' },
|
||||
nextReviewDate: { type: 'string' }
|
||||
} },
|
||||
risks: { type: 'array', required: false },
|
||||
documents: { type: 'array', required: false }
|
||||
};
|
||||
// Approval Workflow Schema
|
||||
const approvalWorkflowSchema = {
|
||||
workflowId: { type: 'string', required: true },
|
||||
requestId: { type: 'string', required: true },
|
||||
requestType: { type: 'string', required: true },
|
||||
requestDate: { type: 'string', required: true },
|
||||
currentStatus: { type: 'string', required: true },
|
||||
priority: { type: 'string', required: true },
|
||||
requester: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
} },
|
||||
requestDetails: { type: 'object', required: true, properties: {
|
||||
subject: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
category: { type: 'string' },
|
||||
subcategory: { type: 'string' },
|
||||
businessJustification: { type: 'string' },
|
||||
urgency: { type: 'string' }
|
||||
} },
|
||||
financialDetails: { type: 'object', required: false, properties: {
|
||||
amount: { type: 'number' },
|
||||
currency: { type: 'string' },
|
||||
budgetCode: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
budgetAvailable: { type: 'boolean' }
|
||||
} },
|
||||
approvalChain: { type: 'array', required: true, items: {
|
||||
stepNumber: { type: 'number' },
|
||||
approverRole: { type: 'string' },
|
||||
approverId: { type: 'string' },
|
||||
approverName: { type: 'string' },
|
||||
approverEmail: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
assignedDate: { type: 'string' },
|
||||
responseDate: { type: 'string' },
|
||||
decision: { type: 'string' },
|
||||
comments: { type: 'string' },
|
||||
durationHours: { type: 'number' }
|
||||
} },
|
||||
routing: { type: 'object', required: true, properties: {
|
||||
routingType: { type: 'string' },
|
||||
parallelApprovals: { type: 'boolean' },
|
||||
escalationEnabled: { type: 'boolean' },
|
||||
escalationAfterHours: { type: 'number' },
|
||||
notificationEnabled: { type: 'boolean' }
|
||||
} },
|
||||
timeline: { type: 'object', required: true, properties: {
|
||||
submittedDate: { type: 'string' },
|
||||
firstApprovalDate: { type: 'string' },
|
||||
finalApprovalDate: { type: 'string' },
|
||||
completedDate: { type: 'string' },
|
||||
totalDurationHours: { type: 'number' },
|
||||
slaTarget: { type: 'number' },
|
||||
slaBreached: { type: 'boolean' }
|
||||
} },
|
||||
attachments: { type: 'array', required: false },
|
||||
audit: { type: 'array', required: true, items: {
|
||||
timestamp: { type: 'string' },
|
||||
action: { type: 'string' },
|
||||
performedBy: { type: 'string' },
|
||||
details: { type: 'string' }
|
||||
} }
|
||||
};
|
||||
// Audit Trail Schema
|
||||
const auditTrailSchema = {
|
||||
auditId: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
eventType: { type: 'string', required: true },
|
||||
entity: { type: 'object', required: true, properties: {
|
||||
entityType: { type: 'string' },
|
||||
entityId: { type: 'string' },
|
||||
entityName: { type: 'string' }
|
||||
} },
|
||||
action: { type: 'string', required: true },
|
||||
actor: { type: 'object', required: true, properties: {
|
||||
userId: { type: 'string' },
|
||||
userName: { type: 'string' },
|
||||
userRole: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
ipAddress: { type: 'string' },
|
||||
sessionId: { type: 'string' }
|
||||
} },
|
||||
changes: { type: 'array', required: false, items: {
|
||||
fieldName: { type: 'string' },
|
||||
oldValue: { type: 'string' },
|
||||
newValue: { type: 'string' },
|
||||
dataType: { type: 'string' }
|
||||
} },
|
||||
metadata: { type: 'object', required: true, properties: {
|
||||
source: { type: 'string' },
|
||||
application: { type: 'string' },
|
||||
module: { type: 'string' },
|
||||
transactionId: { type: 'string' },
|
||||
severity: { type: 'string' }
|
||||
} },
|
||||
compliance: { type: 'object', required: false, properties: {
|
||||
regulationApplicable: { type: 'array' },
|
||||
retentionYears: { type: 'number' },
|
||||
classification: { type: 'string' }
|
||||
} },
|
||||
result: { type: 'object', required: true, properties: {
|
||||
status: { type: 'string' },
|
||||
errorCode: { type: 'string' },
|
||||
errorMessage: { type: 'string' }
|
||||
} }
|
||||
};
|
||||
/**
|
||||
* Generate Project Management Data
|
||||
*/
|
||||
async function generateProjects(count = 50) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
console.log(`Generating ${count} project records...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: projectManagementSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} projects in ${result.metadata.duration}ms`);
|
||||
console.log('Sample project:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Resource Allocation Data
|
||||
*/
|
||||
async function generateResourceAllocations(count = 200) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} resource allocations...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: resourceAllocationSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} allocations in ${result.metadata.duration}ms`);
|
||||
console.log('Sample allocation:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Vendor Management Data
|
||||
*/
|
||||
async function generateVendors(count = 75) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} vendor records...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: vendorManagementSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} vendors in ${result.metadata.duration}ms`);
|
||||
console.log('Sample vendor:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Contract Lifecycle Data
|
||||
*/
|
||||
async function generateContracts(count = 100) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} contracts...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: contractLifecycleSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} contracts in ${result.metadata.duration}ms`);
|
||||
console.log('Sample contract:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Approval Workflow Data
|
||||
*/
|
||||
async function generateApprovalWorkflows(count = 300) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} approval workflows...`);
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: approvalWorkflowSchema,
|
||||
format: 'json'
|
||||
});
|
||||
console.log(`Generated ${result.data.length} workflows in ${result.metadata.duration}ms`);
|
||||
console.log('Sample workflow:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate Audit Trail Data (time-series)
|
||||
*/
|
||||
async function generateAuditTrail(count = 1000) {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini'
|
||||
});
|
||||
console.log(`Generating ${count} audit trail entries...`);
|
||||
const result = await synth.generateEvents({
|
||||
count,
|
||||
eventTypes: ['create', 'read', 'update', 'delete', 'approve', 'reject', 'login', 'logout'],
|
||||
distribution: 'poisson',
|
||||
timeRange: {
|
||||
start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days ago
|
||||
end: new Date()
|
||||
}
|
||||
});
|
||||
console.log(`Generated ${result.data.length} audit entries in ${result.metadata.duration}ms`);
|
||||
console.log('Sample audit entry:', result.data[0]);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Generate complete operations dataset in parallel
|
||||
*/
|
||||
async function generateCompleteOperationsDataset() {
|
||||
const synth = (0, index_js_1.createSynth)({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
console.log('Generating complete operations dataset in parallel...');
|
||||
console.time('Total operations generation');
|
||||
const [projects, resources, vendors, contracts, workflows, audit] = await Promise.all([
|
||||
generateProjects(30),
|
||||
generateResourceAllocations(100),
|
||||
generateVendors(50),
|
||||
generateContracts(60),
|
||||
generateApprovalWorkflows(150),
|
||||
generateAuditTrail(500)
|
||||
]);
|
||||
console.timeEnd('Total operations generation');
|
||||
return {
|
||||
projects: projects.data,
|
||||
resourceAllocations: resources.data,
|
||||
vendors: vendors.data,
|
||||
contracts: contracts.data,
|
||||
approvalWorkflows: workflows.data,
|
||||
auditTrail: audit.data,
|
||||
metadata: {
|
||||
totalRecords: projects.data.length + resources.data.length +
|
||||
vendors.data.length + contracts.data.length +
|
||||
workflows.data.length + audit.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Simulate end-to-end procurement workflow
|
||||
*/
|
||||
async function simulateProcurementWorkflow() {
|
||||
console.log('Simulating complete procurement workflow...');
|
||||
console.time('Procurement workflow');
|
||||
// Step 1: Vendor onboarding
|
||||
const vendors = await generateVendors(5);
|
||||
console.log(`✓ Onboarded ${vendors.data.length} vendors`);
|
||||
// Step 2: Contract creation
|
||||
const contracts = await generateContracts(5);
|
||||
console.log(`✓ Created ${contracts.data.length} contracts`);
|
||||
// Step 3: Approval workflows for contracts
|
||||
const approvals = await generateApprovalWorkflows(10);
|
||||
console.log(`✓ Processed ${approvals.data.length} approval workflows`);
|
||||
// Step 4: Audit trail
|
||||
const audit = await generateAuditTrail(50);
|
||||
console.log(`✓ Logged ${audit.data.length} audit events`);
|
||||
console.timeEnd('Procurement workflow');
|
||||
return {
|
||||
vendors: vendors.data,
|
||||
contracts: contracts.data,
|
||||
approvals: approvals.data,
|
||||
auditTrail: audit.data,
|
||||
summary: {
|
||||
vendorsOnboarded: vendors.data.length,
|
||||
contractsCreated: contracts.data.length,
|
||||
approvalsProcessed: approvals.data.length,
|
||||
auditEvents: audit.data.length
|
||||
}
|
||||
};
|
||||
}
|
||||
// Example usage
|
||||
async function runOperationsExamples() {
|
||||
console.log('=== Business Operations Data Generation Examples ===\n');
|
||||
// Example 1: Project Management
|
||||
console.log('1. Project Management');
|
||||
await generateProjects(5);
|
||||
// Example 2: Resource Allocation
|
||||
console.log('\n2. Resource Allocation');
|
||||
await generateResourceAllocations(20);
|
||||
// Example 3: Vendor Management
|
||||
console.log('\n3. Vendor Management');
|
||||
await generateVendors(10);
|
||||
// Example 4: Contract Lifecycle
|
||||
console.log('\n4. Contract Lifecycle Management');
|
||||
await generateContracts(10);
|
||||
// Example 5: Approval Workflows
|
||||
console.log('\n5. Approval Workflows');
|
||||
await generateApprovalWorkflows(30);
|
||||
// Example 6: Audit Trail
|
||||
console.log('\n6. Audit Trail');
|
||||
await generateAuditTrail(100);
|
||||
// Example 7: Procurement Workflow Simulation
|
||||
console.log('\n7. Procurement Workflow Simulation');
|
||||
await simulateProcurementWorkflow();
|
||||
// Example 8: Complete operations dataset
|
||||
console.log('\n8. Complete Operations Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteOperationsDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
// Uncomment to run
|
||||
// runOperationsExamples().catch(console.error);
|
||||
exports.default = {
|
||||
generateProjects,
|
||||
generateResourceAllocations,
|
||||
generateVendors,
|
||||
generateContracts,
|
||||
generateApprovalWorkflows,
|
||||
generateAuditTrail,
|
||||
generateCompleteOperationsDataset,
|
||||
simulateProcurementWorkflow
|
||||
};
|
||||
//# sourceMappingURL=operations.js.map
|
||||
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.js.map
vendored
Normal file
1
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
688
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.ts
vendored
Normal file
688
vendor/ruvector/npm/packages/agentic-synth/examples/business-management/operations.ts
vendored
Normal file
@@ -0,0 +1,688 @@
|
||||
/**
|
||||
* Business Operations Management Data Generation
|
||||
* Simulates project management, vendor management, contract lifecycle, and approval workflows
|
||||
*/
|
||||
|
||||
import { createSynth } from '../../src/index.js';
|
||||
|
||||
// Project Management Schema (Jira/Asana/MS Project style)
|
||||
const projectManagementSchema = {
|
||||
projectId: { type: 'string', required: true },
|
||||
projectName: { type: 'string', required: true },
|
||||
projectCode: { type: 'string', required: true },
|
||||
description: { type: 'string', required: true },
|
||||
projectType: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
priority: { type: 'string', required: true },
|
||||
businessUnit: { type: 'string', required: true },
|
||||
department: { type: 'string', required: true },
|
||||
timeline: { type: 'object', required: true, properties: {
|
||||
plannedStartDate: { type: 'string' },
|
||||
plannedEndDate: { type: 'string' },
|
||||
actualStartDate: { type: 'string' },
|
||||
actualEndDate: { type: 'string' },
|
||||
duration: { type: 'number' },
|
||||
percentComplete: { type: 'number' }
|
||||
}},
|
||||
team: { type: 'object', required: true, properties: {
|
||||
projectManager: { type: 'object', properties: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
}},
|
||||
sponsor: { type: 'object', properties: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
department: { type: 'string' }
|
||||
}},
|
||||
teamMembers: { type: 'array', items: {
|
||||
employeeId: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
role: { type: 'string' },
|
||||
allocation: { type: 'number' }
|
||||
}},
|
||||
stakeholders: { type: 'array' }
|
||||
}},
|
||||
budget: { type: 'object', required: true, properties: {
|
||||
plannedBudget: { type: 'number' },
|
||||
actualCost: { type: 'number' },
|
||||
committedCost: { type: 'number' },
|
||||
remainingBudget: { type: 'number' },
|
||||
variance: { type: 'number' },
|
||||
variancePercent: { type: 'number' },
|
||||
currency: { type: 'string' }
|
||||
}},
|
||||
phases: { type: 'array', required: true, items: {
|
||||
phaseId: { type: 'string' },
|
||||
phaseName: { type: 'string' },
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
deliverables: { type: 'array' }
|
||||
}},
|
||||
tasks: { type: 'array', required: true, items: {
|
||||
taskId: { type: 'string' },
|
||||
taskName: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
assignee: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
priority: { type: 'string' },
|
||||
startDate: { type: 'string' },
|
||||
dueDate: { type: 'string' },
|
||||
completedDate: { type: 'string' },
|
||||
estimatedHours: { type: 'number' },
|
||||
actualHours: { type: 'number' },
|
||||
dependencies: { type: 'array' }
|
||||
}},
|
||||
risks: { type: 'array', required: false, items: {
|
||||
riskId: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
probability: { type: 'string' },
|
||||
impact: { type: 'string' },
|
||||
mitigation: { type: 'string' },
|
||||
owner: { type: 'string' },
|
||||
status: { type: 'string' }
|
||||
}},
|
||||
issues: { type: 'array', required: false, items: {
|
||||
issueId: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
severity: { type: 'string' },
|
||||
reportedBy: { type: 'string' },
|
||||
assignedTo: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
resolution: { type: 'string' }
|
||||
}},
|
||||
metrics: { type: 'object', required: true, properties: {
|
||||
schedulePerformanceIndex: { type: 'number' },
|
||||
costPerformanceIndex: { type: 'number' },
|
||||
earnedValue: { type: 'number' },
|
||||
plannedValue: { type: 'number' },
|
||||
actualCost: { type: 'number' },
|
||||
estimateAtCompletion: { type: 'number' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Resource Allocation Schema
|
||||
const resourceAllocationSchema = {
|
||||
allocationId: { type: 'string', required: true },
|
||||
allocationDate: { type: 'string', required: true },
|
||||
period: { type: 'object', required: true, properties: {
|
||||
startDate: { type: 'string' },
|
||||
endDate: { type: 'string' }
|
||||
}},
|
||||
resource: { type: 'object', required: true, properties: {
|
||||
resourceId: { type: 'string' },
|
||||
resourceName: { type: 'string' },
|
||||
resourceType: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
skillSet: { type: 'array' },
|
||||
seniorityLevel: { type: 'string' }
|
||||
}},
|
||||
project: { type: 'object', required: true, properties: {
|
||||
projectId: { type: 'string' },
|
||||
projectName: { type: 'string' },
|
||||
projectManager: { type: 'string' }
|
||||
}},
|
||||
allocation: { type: 'object', required: true, properties: {
|
||||
allocationPercent: { type: 'number' },
|
||||
hoursPerWeek: { type: 'number' },
|
||||
totalHours: { type: 'number' },
|
||||
billableRate: { type: 'number' },
|
||||
internalRate: { type: 'number' },
|
||||
currency: { type: 'string' }
|
||||
}},
|
||||
utilization: { type: 'object', required: true, properties: {
|
||||
totalCapacity: { type: 'number' },
|
||||
allocatedHours: { type: 'number' },
|
||||
availableHours: { type: 'number' },
|
||||
utilizationRate: { type: 'number' },
|
||||
overallocationHours: { type: 'number' }
|
||||
}},
|
||||
status: { type: 'string', required: true },
|
||||
approvedBy: { type: 'string', required: false },
|
||||
approvalDate: { type: 'string', required: false }
|
||||
};
|
||||
|
||||
// Vendor Management Schema
|
||||
const vendorManagementSchema = {
|
||||
vendorId: { type: 'string', required: true },
|
||||
vendorName: { type: 'string', required: true },
|
||||
vendorType: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
tier: { type: 'string', required: true },
|
||||
contactInfo: { type: 'object', required: true, properties: {
|
||||
primaryContact: { type: 'object', properties: {
|
||||
name: { type: 'string' },
|
||||
title: { type: 'string' },
|
||||
email: { type: 'string' },
|
||||
phone: { type: 'string' }
|
||||
}},
|
||||
accountManager: { type: 'object', properties: {
|
||||
name: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
}},
|
||||
address: { type: 'object', properties: {
|
||||
street: { type: 'string' },
|
||||
city: { type: 'string' },
|
||||
state: { type: 'string' },
|
||||
country: { type: 'string' },
|
||||
postalCode: { type: 'string' }
|
||||
}},
|
||||
website: { type: 'string' },
|
||||
taxId: { type: 'string' }
|
||||
}},
|
||||
businessDetails: { type: 'object', required: true, properties: {
|
||||
industry: { type: 'string' },
|
||||
yearEstablished: { type: 'number' },
|
||||
numberOfEmployees: { type: 'number' },
|
||||
annualRevenue: { type: 'number' },
|
||||
certifications: { type: 'array' },
|
||||
servicesProvided: { type: 'array' }
|
||||
}},
|
||||
contractInfo: { type: 'object', required: true, properties: {
|
||||
activeContracts: { type: 'number' },
|
||||
totalContractValue: { type: 'number' },
|
||||
contractStartDate: { type: 'string' },
|
||||
contractEndDate: { type: 'string' },
|
||||
renewalDate: { type: 'string' },
|
||||
paymentTerms: { type: 'string' },
|
||||
currency: { type: 'string' }
|
||||
}},
|
||||
performance: { type: 'object', required: true, properties: {
|
||||
overallScore: { type: 'number' },
|
||||
qualityScore: { type: 'number' },
|
||||
deliveryScore: { type: 'number' },
|
||||
complianceScore: { type: 'number' },
|
||||
responsiveScore: { type: 'number' },
|
||||
lastReviewDate: { type: 'string' },
|
||||
nextReviewDate: { type: 'string' }
|
||||
}},
|
||||
riskAssessment: { type: 'object', required: true, properties: {
|
||||
riskLevel: { type: 'string' },
|
||||
financialRisk: { type: 'string' },
|
||||
operationalRisk: { type: 'string' },
|
||||
complianceRisk: { type: 'string' },
|
||||
cyberSecurityRisk: { type: 'string' },
|
||||
lastAuditDate: { type: 'string' }
|
||||
}},
|
||||
spending: { type: 'object', required: true, properties: {
|
||||
ytdSpending: { type: 'number' },
|
||||
lifetimeSpending: { type: 'number' },
|
||||
averageInvoiceAmount: { type: 'number' },
|
||||
paymentHistory: { type: 'object', properties: {
|
||||
onTimePaymentRate: { type: 'number' },
|
||||
averageDaysToPay: { type: 'number' }
|
||||
}}
|
||||
}},
|
||||
compliance: { type: 'object', required: false, properties: {
|
||||
insuranceCertificate: { type: 'boolean' },
|
||||
w9Form: { type: 'boolean' },
|
||||
nda: { type: 'boolean' },
|
||||
backgroundCheckCompleted: { type: 'boolean' },
|
||||
lastComplianceCheck: { type: 'string' }
|
||||
}},
|
||||
documents: { type: 'array', required: false }
|
||||
};
|
||||
|
||||
// Contract Lifecycle Management Schema
|
||||
const contractLifecycleSchema = {
|
||||
contractId: { type: 'string', required: true },
|
||||
contractNumber: { type: 'string', required: true },
|
||||
contractName: { type: 'string', required: true },
|
||||
contractType: { type: 'string', required: true },
|
||||
status: { type: 'string', required: true },
|
||||
parties: { type: 'object', required: true, properties: {
|
||||
buyer: { type: 'object', properties: {
|
||||
companyCode: { type: 'string' },
|
||||
companyName: { type: 'string' },
|
||||
legalEntity: { type: 'string' },
|
||||
signatoryName: { type: 'string' },
|
||||
signatoryTitle: { type: 'string' }
|
||||
}},
|
||||
seller: { type: 'object', properties: {
|
||||
vendorId: { type: 'string' },
|
||||
vendorName: { type: 'string' },
|
||||
legalEntity: { type: 'string' },
|
||||
signatoryName: { type: 'string' },
|
||||
signatoryTitle: { type: 'string' }
|
||||
}}
|
||||
}},
|
||||
timeline: { type: 'object', required: true, properties: {
|
||||
requestDate: { type: 'string' },
|
||||
approvalDate: { type: 'string' },
|
||||
executionDate: { type: 'string' },
|
||||
effectiveDate: { type: 'string' },
|
||||
expirationDate: { type: 'string' },
|
||||
autoRenewal: { type: 'boolean' },
|
||||
renewalNoticeDays: { type: 'number' },
|
||||
terminationNoticeDays: { type: 'number' }
|
||||
}},
|
||||
financial: { type: 'object', required: true, properties: {
|
||||
totalContractValue: { type: 'number' },
|
||||
currency: { type: 'string' },
|
||||
billingFrequency: { type: 'string' },
|
||||
paymentTerms: { type: 'string' },
|
||||
annualValue: { type: 'number' },
|
||||
invoicedToDate: { type: 'number' },
|
||||
paidToDate: { type: 'number' },
|
||||
outstandingBalance: { type: 'number' }
|
||||
}},
|
||||
terms: { type: 'object', required: true, properties: {
|
||||
scopeOfWork: { type: 'string' },
|
||||
deliverables: { type: 'array' },
|
||||
serviceLevelAgreements: { type: 'array' },
|
||||
penaltyClause: { type: 'boolean' },
|
||||
warrantyPeriod: { type: 'number' },
|
||||
liabilityLimit: { type: 'number' },
|
||||
confidentialityClause: { type: 'boolean' },
|
||||
nonCompeteClause: { type: 'boolean' }
|
||||
}},
|
||||
obligations: { type: 'array', required: true, items: {
|
||||
obligationId: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
responsibleParty: { type: 'string' },
|
||||
dueDate: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
completedDate: { type: 'string' }
|
||||
}},
|
||||
amendments: { type: 'array', required: false, items: {
|
||||
amendmentNumber: { type: 'string' },
|
||||
amendmentDate: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
financialImpact: { type: 'number' }
|
||||
}},
|
||||
owners: { type: 'object', required: true, properties: {
|
||||
contractOwner: { type: 'string' },
|
||||
businessOwner: { type: 'string' },
|
||||
legalReviewer: { type: 'string' },
|
||||
financeApprover: { type: 'string' }
|
||||
}},
|
||||
compliance: { type: 'object', required: true, properties: {
|
||||
regulatoryCompliance: { type: 'boolean' },
|
||||
dataPrivacyCompliance: { type: 'boolean' },
|
||||
lastAuditDate: { type: 'string' },
|
||||
nextReviewDate: { type: 'string' }
|
||||
}},
|
||||
risks: { type: 'array', required: false },
|
||||
documents: { type: 'array', required: false }
|
||||
};
|
||||
|
||||
// Approval Workflow Schema
|
||||
const approvalWorkflowSchema = {
|
||||
workflowId: { type: 'string', required: true },
|
||||
requestId: { type: 'string', required: true },
|
||||
requestType: { type: 'string', required: true },
|
||||
requestDate: { type: 'string', required: true },
|
||||
currentStatus: { type: 'string', required: true },
|
||||
priority: { type: 'string', required: true },
|
||||
requester: { type: 'object', required: true, properties: {
|
||||
employeeId: { type: 'string' },
|
||||
employeeName: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
email: { type: 'string' }
|
||||
}},
|
||||
requestDetails: { type: 'object', required: true, properties: {
|
||||
subject: { type: 'string' },
|
||||
description: { type: 'string' },
|
||||
category: { type: 'string' },
|
||||
subcategory: { type: 'string' },
|
||||
businessJustification: { type: 'string' },
|
||||
urgency: { type: 'string' }
|
||||
}},
|
||||
financialDetails: { type: 'object', required: false, properties: {
|
||||
amount: { type: 'number' },
|
||||
currency: { type: 'string' },
|
||||
budgetCode: { type: 'string' },
|
||||
costCenter: { type: 'string' },
|
||||
budgetAvailable: { type: 'boolean' }
|
||||
}},
|
||||
approvalChain: { type: 'array', required: true, items: {
|
||||
stepNumber: { type: 'number' },
|
||||
approverRole: { type: 'string' },
|
||||
approverId: { type: 'string' },
|
||||
approverName: { type: 'string' },
|
||||
approverEmail: { type: 'string' },
|
||||
status: { type: 'string' },
|
||||
assignedDate: { type: 'string' },
|
||||
responseDate: { type: 'string' },
|
||||
decision: { type: 'string' },
|
||||
comments: { type: 'string' },
|
||||
durationHours: { type: 'number' }
|
||||
}},
|
||||
routing: { type: 'object', required: true, properties: {
|
||||
routingType: { type: 'string' },
|
||||
parallelApprovals: { type: 'boolean' },
|
||||
escalationEnabled: { type: 'boolean' },
|
||||
escalationAfterHours: { type: 'number' },
|
||||
notificationEnabled: { type: 'boolean' }
|
||||
}},
|
||||
timeline: { type: 'object', required: true, properties: {
|
||||
submittedDate: { type: 'string' },
|
||||
firstApprovalDate: { type: 'string' },
|
||||
finalApprovalDate: { type: 'string' },
|
||||
completedDate: { type: 'string' },
|
||||
totalDurationHours: { type: 'number' },
|
||||
slaTarget: { type: 'number' },
|
||||
slaBreached: { type: 'boolean' }
|
||||
}},
|
||||
attachments: { type: 'array', required: false },
|
||||
audit: { type: 'array', required: true, items: {
|
||||
timestamp: { type: 'string' },
|
||||
action: { type: 'string' },
|
||||
performedBy: { type: 'string' },
|
||||
details: { type: 'string' }
|
||||
}}
|
||||
};
|
||||
|
||||
// Audit Trail Schema
|
||||
const auditTrailSchema = {
|
||||
auditId: { type: 'string', required: true },
|
||||
timestamp: { type: 'string', required: true },
|
||||
eventType: { type: 'string', required: true },
|
||||
entity: { type: 'object', required: true, properties: {
|
||||
entityType: { type: 'string' },
|
||||
entityId: { type: 'string' },
|
||||
entityName: { type: 'string' }
|
||||
}},
|
||||
action: { type: 'string', required: true },
|
||||
actor: { type: 'object', required: true, properties: {
|
||||
userId: { type: 'string' },
|
||||
userName: { type: 'string' },
|
||||
userRole: { type: 'string' },
|
||||
department: { type: 'string' },
|
||||
ipAddress: { type: 'string' },
|
||||
sessionId: { type: 'string' }
|
||||
}},
|
||||
changes: { type: 'array', required: false, items: {
|
||||
fieldName: { type: 'string' },
|
||||
oldValue: { type: 'string' },
|
||||
newValue: { type: 'string' },
|
||||
dataType: { type: 'string' }
|
||||
}},
|
||||
metadata: { type: 'object', required: true, properties: {
|
||||
source: { type: 'string' },
|
||||
application: { type: 'string' },
|
||||
module: { type: 'string' },
|
||||
transactionId: { type: 'string' },
|
||||
severity: { type: 'string' }
|
||||
}},
|
||||
compliance: { type: 'object', required: false, properties: {
|
||||
regulationApplicable: { type: 'array' },
|
||||
retentionYears: { type: 'number' },
|
||||
classification: { type: 'string' }
|
||||
}},
|
||||
result: { type: 'object', required: true, properties: {
|
||||
status: { type: 'string' },
|
||||
errorCode: { type: 'string' },
|
||||
errorMessage: { type: 'string' }
|
||||
}}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate Project Management Data
|
||||
*/
|
||||
export async function generateProjects(count: number = 50) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
apiKey: process.env.GEMINI_API_KEY
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} project records...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: projectManagementSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} projects in ${result.metadata.duration}ms`);
|
||||
console.log('Sample project:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Resource Allocation Data
|
||||
*/
|
||||
export async function generateResourceAllocations(count: number = 200) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} resource allocations...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: resourceAllocationSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} allocations in ${result.metadata.duration}ms`);
|
||||
console.log('Sample allocation:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Vendor Management Data
|
||||
*/
|
||||
export async function generateVendors(count: number = 75) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} vendor records...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: vendorManagementSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} vendors in ${result.metadata.duration}ms`);
|
||||
console.log('Sample vendor:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Contract Lifecycle Data
|
||||
*/
|
||||
export async function generateContracts(count: number = 100) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} contracts...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: contractLifecycleSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} contracts in ${result.metadata.duration}ms`);
|
||||
console.log('Sample contract:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Approval Workflow Data
|
||||
*/
|
||||
export async function generateApprovalWorkflows(count: number = 300) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} approval workflows...`);
|
||||
|
||||
const result = await synth.generateStructured({
|
||||
count,
|
||||
schema: approvalWorkflowSchema,
|
||||
format: 'json'
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} workflows in ${result.metadata.duration}ms`);
|
||||
console.log('Sample workflow:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Audit Trail Data (time-series)
|
||||
*/
|
||||
export async function generateAuditTrail(count: number = 1000) {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini'
|
||||
});
|
||||
|
||||
console.log(`Generating ${count} audit trail entries...`);
|
||||
|
||||
const result = await synth.generateEvents({
|
||||
count,
|
||||
eventTypes: ['create', 'read', 'update', 'delete', 'approve', 'reject', 'login', 'logout'],
|
||||
distribution: 'poisson',
|
||||
timeRange: {
|
||||
start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // 30 days ago
|
||||
end: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Generated ${result.data.length} audit entries in ${result.metadata.duration}ms`);
|
||||
console.log('Sample audit entry:', result.data[0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate complete operations dataset in parallel
|
||||
*/
|
||||
export async function generateCompleteOperationsDataset() {
|
||||
const synth = createSynth({
|
||||
provider: 'gemini',
|
||||
cacheStrategy: 'memory'
|
||||
});
|
||||
|
||||
console.log('Generating complete operations dataset in parallel...');
|
||||
console.time('Total operations generation');
|
||||
|
||||
const [projects, resources, vendors, contracts, workflows, audit] =
|
||||
await Promise.all([
|
||||
generateProjects(30),
|
||||
generateResourceAllocations(100),
|
||||
generateVendors(50),
|
||||
generateContracts(60),
|
||||
generateApprovalWorkflows(150),
|
||||
generateAuditTrail(500)
|
||||
]);
|
||||
|
||||
console.timeEnd('Total operations generation');
|
||||
|
||||
return {
|
||||
projects: projects.data,
|
||||
resourceAllocations: resources.data,
|
||||
vendors: vendors.data,
|
||||
contracts: contracts.data,
|
||||
approvalWorkflows: workflows.data,
|
||||
auditTrail: audit.data,
|
||||
metadata: {
|
||||
totalRecords: projects.data.length + resources.data.length +
|
||||
vendors.data.length + contracts.data.length +
|
||||
workflows.data.length + audit.data.length,
|
||||
generatedAt: new Date().toISOString()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulate end-to-end procurement workflow
|
||||
*/
|
||||
export async function simulateProcurementWorkflow() {
|
||||
console.log('Simulating complete procurement workflow...');
|
||||
console.time('Procurement workflow');
|
||||
|
||||
// Step 1: Vendor onboarding
|
||||
const vendors = await generateVendors(5);
|
||||
console.log(`✓ Onboarded ${vendors.data.length} vendors`);
|
||||
|
||||
// Step 2: Contract creation
|
||||
const contracts = await generateContracts(5);
|
||||
console.log(`✓ Created ${contracts.data.length} contracts`);
|
||||
|
||||
// Step 3: Approval workflows for contracts
|
||||
const approvals = await generateApprovalWorkflows(10);
|
||||
console.log(`✓ Processed ${approvals.data.length} approval workflows`);
|
||||
|
||||
// Step 4: Audit trail
|
||||
const audit = await generateAuditTrail(50);
|
||||
console.log(`✓ Logged ${audit.data.length} audit events`);
|
||||
|
||||
console.timeEnd('Procurement workflow');
|
||||
|
||||
return {
|
||||
vendors: vendors.data,
|
||||
contracts: contracts.data,
|
||||
approvals: approvals.data,
|
||||
auditTrail: audit.data,
|
||||
summary: {
|
||||
vendorsOnboarded: vendors.data.length,
|
||||
contractsCreated: contracts.data.length,
|
||||
approvalsProcessed: approvals.data.length,
|
||||
auditEvents: audit.data.length
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Example usage
|
||||
async function runOperationsExamples() {
|
||||
console.log('=== Business Operations Data Generation Examples ===\n');
|
||||
|
||||
// Example 1: Project Management
|
||||
console.log('1. Project Management');
|
||||
await generateProjects(5);
|
||||
|
||||
// Example 2: Resource Allocation
|
||||
console.log('\n2. Resource Allocation');
|
||||
await generateResourceAllocations(20);
|
||||
|
||||
// Example 3: Vendor Management
|
||||
console.log('\n3. Vendor Management');
|
||||
await generateVendors(10);
|
||||
|
||||
// Example 4: Contract Lifecycle
|
||||
console.log('\n4. Contract Lifecycle Management');
|
||||
await generateContracts(10);
|
||||
|
||||
// Example 5: Approval Workflows
|
||||
console.log('\n5. Approval Workflows');
|
||||
await generateApprovalWorkflows(30);
|
||||
|
||||
// Example 6: Audit Trail
|
||||
console.log('\n6. Audit Trail');
|
||||
await generateAuditTrail(100);
|
||||
|
||||
// Example 7: Procurement Workflow Simulation
|
||||
console.log('\n7. Procurement Workflow Simulation');
|
||||
await simulateProcurementWorkflow();
|
||||
|
||||
// Example 8: Complete operations dataset
|
||||
console.log('\n8. Complete Operations Dataset (Parallel)');
|
||||
const completeDataset = await generateCompleteOperationsDataset();
|
||||
console.log('Total records generated:', completeDataset.metadata.totalRecords);
|
||||
}
|
||||
|
||||
// Uncomment to run
|
||||
// runOperationsExamples().catch(console.error);
|
||||
|
||||
export default {
|
||||
generateProjects,
|
||||
generateResourceAllocations,
|
||||
generateVendors,
|
||||
generateContracts,
|
||||
generateApprovalWorkflows,
|
||||
generateAuditTrail,
|
||||
generateCompleteOperationsDataset,
|
||||
simulateProcurementWorkflow
|
||||
};
|
||||
Reference in New Issue
Block a user