-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Add a service-based analytics API to the RL module that enables both Drush commands and other Drupal modules (like ai_content_strategy) to access experiment performance data, insights, and recommendations.
Motivation
Currently, analyzing RL experiment data requires direct database queries. This makes it difficult for:
- AI tools (like Claude Code) to provide experiment insights via Drush
- Other Drupal modules to integrate with RL data
- Automation of experiment analysis and reporting
Proposed Solution
1. Service Layer (RlAnalyzer)
Create a service implementing RlAnalyzerInterface with methods:
listExperiments()- All experiments with summary statsgetStatus($experimentId)- Detailed experiment statusgetPerformance($experimentId, $options)- Arm performance with human-readable labelsgetTrends($experimentId, $options)- Historical dataexport($experimentId)- Full JSON export
2. Drush Commands
Thin CLI wrappers around the service:
rl:list- List all experimentsrl:status <experiment>- Experiment statusrl:performance <experiment>- Arm performancerl:trends <experiment>- Historical trendsrl:export <experiment>- Full data export
Key Features
- Human-readable labels - Resolve entity IDs to titles/names
- Pre-computed insights - vs_average, confidence levels, trends
- JSON output - Structured data for AI consumption
- Self-documenting - Rich help text for AI discoverability
Technical Approach
Following Drupal core patterns (like StateInterface/State):
- Interface defines API contract
- Service contains all business logic
- Drush commands are thin wrappers
- Other modules inject service via DI
Tasks
- Create
RlAnalyzerInterface - Create
RlAnalyzerservice - Register in
rl.services.yml - Create
RlCommandsDrush class - Implement all commands
- Update README.md
- Update docs/rl_project_desc.html
Metadata
Metadata
Assignees
Labels
No labels