Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
802 changes: 802 additions & 0 deletions FEATURES_IMPLEMENTATION.md

Large diffs are not rendered by default.

21,626 changes: 21,626 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,10 @@
"engines": {
"node": ">=18.0.0",
"npm": ">=9.0.0"
,
"demo:event": "node scripts/demo-event.js",
"demo:ab": "node scripts/demo-ab.js",
"demo:autocomplete": "node scripts/demo-autocomplete.js",
"demo:subscription": "node scripts/demo-subscription.js"
}
}
82 changes: 82 additions & 0 deletions src/ab-testing/ab-testing.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,88 @@ export class ABTestingController {
private reportsService: ABTestingReportsService,
) {}

/**
* Get available experiment templates
*/
@Get('templates')
@ApiResponse({
status: 200,
description: 'Available experiment templates',
schema: {
example: [
{
name: 'Standard A/B Test',
description: 'Standard 50/50 A/B test with 95% confidence',
trafficAllocation: 50,
confidenceLevel: 0.95,
minimumSampleSize: 1000,
},
],
},
})
async getExperimentTemplates(): Promise<any> {
this.logger.log('Fetching experiment templates');
return this.abTestingService.getAvailableTemplates();
}

/**
* Analyze experiment and check for auto-stop conditions
*/
@Post('experiments/:id/analyze')
@HttpCode(HttpStatus.OK)
@Roles(UserRole.ADMIN)
@ApiResponse({
status: 200,
description: 'Analysis complete',
schema: {
example: {
results: [
{
variantId: 'variant-1',
sampleSize: 2500,
conversionRate: 0.085,
confidence: 0.97,
pValue: 0.03,
isSignificant: true,
uplift: 0.15,
upliftCI: { lower: 0.08, upper: 0.22 },
},
],
shouldStop: true,
reason: 'Statistical significance reached',
},
},
})
async analyzeAndAutoStop(@Param('id') experimentId: string): Promise<any> {
this.logger.log(`Analyzing experiment for auto-stop: ${experimentId}`);
return await this.abTestingService.analyzeAndAutoStop(experimentId);
}

/**
* Get comprehensive experiment results dashboard
*/
@Get('experiments/:id/dashboard')
@ApiResponse({
status: 200,
description: 'Experiment results dashboard',
schema: {
example: {
experiment: {},
variantResults: [],
summary: {
winner: 'variant-2',
confidence: 0.96,
estimatedUplift: 0.12,
sampleSizeReached: true,
},
},
},
})
async getResultsDashboard(@Param('id') experimentId: string): Promise<any> {
this.logger.log(`Fetching results dashboard for experiment: ${experimentId}`);
return await this.abTestingService.getExperimentResults(experimentId);
}

/**
* Returns all Experiments.
* @returns The operation result.
Expand Down
Loading
Loading