feat: add BADGE_GENERATION event and submit button#13
Conversation
af3bd6d to
e8d4c43
Compare
There was a problem hiding this comment.
Pull request overview
Adds an Open edX local event (BADGE_GENERATION) for AI-generated badge definitions and wires it into the existing badge workflow so downstream systems (e.g., Credentials/Credly) can consume the emitted event.
Changes:
- Introduces local event schema (
BadgeGenerationData) and signal definition (BADGE_GENERATION), plus a processor to build/emit the event. - Adds a new backend workflow action (
submit) and a frontend “Submit Badge” CTA to trigger emission. - Updates backend requirements to include
openedx-eventsand transitive pins across env requirement sets.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/messages.ts | Adds i18n strings for the new “Submit Badge” UI states. |
| frontend/src/hooks/useBadgeGeneration.ts | Adds submit state + handler to call the workflow submit action. |
| frontend/src/components/AIBadgesTab/BadgePreview.tsx | Renders submit button + success/error alerts in the preview pane. |
| frontend/src/components/AIBadgesTab/AIBadgesTab.tsx | Plumbs submit props from hook into BadgePreview. |
| backend/openedx_ai_badges/workflows/orchestrators.py | Adds submit action to emit BADGE_GENERATION from session badge data. |
| backend/openedx_ai_badges/processors/openedx_events_processor.py | New service to normalize inputs and send the Open edX event. |
| backend/openedx_ai_badges/events/data.py | Defines BadgeGenerationData attrs payload for the event. |
| backend/openedx_ai_badges/events/signals.py | Defines local BADGE_GENERATION signal using openedx-events tooling. |
| backend/openedx_ai_badges/events/init.py | Documents local event package purpose/conventions. |
| backend/requirements/base.in | Adds openedx-events dependency to base input requirements. |
| backend/requirements/base.txt | Compiled base requirements updated for openedx-events + transitive deps. |
| backend/requirements/test.txt | Compiled test requirements updated for openedx-events + transitive deps. |
| backend/requirements/quality.txt | Compiled lint/quality requirements updated for openedx-events + transitive deps. |
| backend/requirements/dev.txt | Compiled dev requirements updated for openedx-events + transitive deps. |
| backend/requirements/doc.txt | Compiled docs requirements updated for openedx-events + transitive deps. |
| backend/requirements/pip.txt | Minor metadata/comment adjustments for pip pin provenance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b34b9d3 to
38b2262
Compare
|
I know this PR will be updated to the new UI. In the most general sense, adding openedx-event is good. Having the UI change is expected and I commented inline about the backend implementation |
|
@felipemontoya The example of json event we are sending with this PR: |
felipemontoya
left a comment
There was a problem hiding this comment.
I looked it up, tested the orchestrator and reviewed in line with the #27. This looks good.
This pull request introduces a new local Open edX event for AI-generated badge definitions, enabling course-level badge generation events to be emitted and consumed by downstream systems. The changes include the definition of event data and signals, a processor for emitting the event, integration into the badge workflow, and the addition of required dependencies.
Open edX Event Integration for Badge Generation:
Event and Data Model Definitions
Introduced
BadgeGenerationData, a data class that extendsBadgeTemplateDatato includecourse_idandcriteria_narrative, following OEP-49 conventions. This enables course-level badge information to be included in events.Added local event and signal definitions for
BADGE_GENERATION, following OEP-41 naming conventions, to be contributed upstream in the future.Event Emission Processor
OpenEdXEventsProcessor, a service class responsible for building and emitting theBADGE_GENERATIONevent, including normalization of input and error handling.Workflow Integration
submitmethod, allowing the frontend to trigger badge event submission.Dependency Management
openedx-eventsand related dependencies to requirements files to support event emission and data modeling.