Skip to content

feat: add BADGE_GENERATION event and submit button#13

Merged
felipemontoya merged 12 commits intomainfrom
hpg/send-event
Apr 7, 2026
Merged

feat: add BADGE_GENERATION event and submit button#13
felipemontoya merged 12 commits intomainfrom
hpg/send-event

Conversation

@Henrrypg
Copy link
Copy Markdown
Collaborator

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 extends BadgeTemplateData to include course_id and criteria_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

  • Implemented OpenEdXEventsProcessor, a service class responsible for building and emitting the BADGE_GENERATION event, including normalization of input and error handling.

Workflow Integration

  • Integrated the event emission into the badge workflow orchestrator via a new submit method, allowing the frontend to trigger badge event submission.

Dependency Management

  • Added openedx-events and related dependencies to requirements files to support event emission and data modeling.

@Henrrypg Henrrypg changed the title Hpg/send event feat: add BADGE_GENERATION event and submit button Mar 10, 2026
@Henrrypg Henrrypg requested a review from Copilot March 10, 2026 20:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-events and 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.

Comment thread backend/requirements/base.in Outdated
Comment thread frontend/src/hooks/useBadgeGeneration.ts Outdated
Comment thread backend/openedx_ai_badges/processors/openedx_events_processor.py
Comment thread backend/openedx_ai_badges/processors/openedx_events_processor.py Outdated
Comment thread frontend/src/components/AIBadgesTab/AIBadgesTab.tsx Outdated
Comment thread backend/openedx_ai_badges/workflows/orchestrators.py
Comment thread backend/openedx_ai_badges/processors/openedx_events_processor.py Outdated
Comment thread backend/openedx_ai_badges/events/data.py Outdated
Comment thread backend/openedx_ai_badges/workflows/orchestrators.py Outdated
Comment thread backend/openedx_ai_badges/workflows/orchestrators.py Outdated
Comment thread backend/openedx_ai_badges/workflows/orchestrators.py Outdated
Comment thread backend/openedx_ai_badges/events/data.py Outdated
Comment thread backend/openedx_ai_badges/events/signals.py Outdated
@felipemontoya
Copy link
Copy Markdown
Member

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

Comment thread backend/openedx_ai_badges/events/data.py Outdated
Comment thread backend/openedx_ai_badges/events/data.py Outdated
@Henrrypg Henrrypg requested a review from felipemontoya April 7, 2026 22:04
@Henrrypg
Copy link
Copy Markdown
Collaborator Author

Henrrypg commented Apr 7, 2026

@felipemontoya The example of json event we are sending with this PR:

{
   "@context":[
      "https://www.w3.org/ns/credentials/v2",
      "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json"
   ],
   "id":"urn:uuid:01b93b45-da9f-4b87-8f9c-9ad709365c05",
   "type":[
      "VerifiableCredential",
      "OpenBadgeCredential"
   ],
   "name":"Open edX Platform Essentials V1",
   "image":{
      "type":"Image",
      "id":"",
      "caption":"Open edX Platform Essentials V1"
   },
   "credentialSubject":{
      "id":"urn:uuid:5036d89f-dce8-46d7-bbf2-8bb038c414f9",
      "type":[
         "AchievementSubject"
      ],
      "achievement":{
         "id":"urn:uuid:0e0e99a6-7544-4ba2-9f56-5bc8aa91d3d8",
         "type":[
            "Achievement"
         ],
         "name":"Open edX Platform Essentials V1",
         "description":"This badge recognizes completion of an intermediate overview of the Open edX platform’s core capabilities. Earners demonstrate essential skills in platform navigation, content authoring, assessment configuration, and social learning features, along with familiarity with key community resources.",
         "criteria":{
            "narrative":"Earn course completion status for the Open edX Demo Course as recorded by the LMS. Requirements include completing all five required modules—Platform Overview, Content Authoring, Assessments, Social Learning, and Community—viewing all required units/pages, and completing all embedded activities and knowledge checks. Completion is validated automatically by the platform."
         },
         "alignment":[
            {
               "type":[
                  "Alignment"
               ],
               "targetName":"Learning Management System (LMS) Operations",
               "targetUrl":"https://www.onetonline.org/find/descriptor/result/Use%20learning%20management%20system%20%28LMS%29%20software",
               "targetType":"CF:Skill",
               "targetDescription":"Configure and operate LMS features such as course settings, enrollments, grading, and tool integrations to deliver and manage online courses. Applied in Open edX to manage course runs, grading policies, and basic site tools."
            },
            {
               "type":[
                  "Alignment"
               ],
               "targetName":"E-learning Content Authoring",
               "targetUrl":"https://www.onetonline.org/find/descriptor/result/Create%20instructional%20materials",
               "targetType":"CF:Skill",
               "targetDescription":"Create and publish multimedia learning components (text, video, and interactive elements) optimized for online delivery. Applied in Open edX Studio to build units, components, and course pages."
            },
            {
               "type":[
                  "Alignment"
               ],
               "targetName":"Assessment Design and Item Development",
               "targetUrl":"https://www.onetonline.org/find/descriptor/result/Develop%20tests%20to%20assess%20student%20learning",
               "targetType":"CF:Skill",
               "targetDescription":"Design valid assessments, question banks, rubrics, and grading schemes aligned to learning outcomes. Applied in Open edX to configure quizzes, problems, and graded activities."
            },
            {
               "type":[
                  "Alignment"
               ],
               "targetName":"Online Discussion Facilitation",
               "targetUrl":"https://www.onetonline.org/find/descriptor/result/Facilitate%20group%20discussions",
               "targetType":"CF:Skill",
               "targetDescription":"Guide and moderate learner interactions to promote engagement, collaboration, and peer learning. Applied in Open edX to manage discussion forums and social learning activities."
            },
            {
               "type":[
                  "Alignment"
               ],
               "targetName":"Learning Analytics and Reporting",
               "targetUrl":"https://www.onetonline.org/find/descriptor/result/Evaluate%20program%20effectiveness%20using%20data",
               "targetType":"CF:Skill",
               "targetDescription":"Collect and interpret learner activity and performance data to inform course improvements and targeted support. Applied in Open edX using platform reports and analytics dashboards."
            }
         ],
         "image":{
            "type":"Image",
            "id":"",
            "caption":"Open edX Platform Essentials V1"
         }
      }
   },
   "issuer":{
      "id":"urn:uuid:issuer-6f23419c-ca44-4d93-9b8c-269e16e74dde",
      "type":"Profile",
      "name":"edunext"
   },
   "validFrom":"2026-04-07T21:15:29.516851+00:00"
}

Copy link
Copy Markdown
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked it up, tested the orchestrator and reviewed in line with the #27. This looks good.

@felipemontoya felipemontoya merged commit e5f54cd into main Apr 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants