How openedx/edx-when works
Main Components
• edx-when Application: At the core, this is a Django app that provides API endpoints, manages data models, and interacts with templates (for rendering views).
• Database: The app uses the same database as edx-platform, so the shared datastore is a central component.
• edx-platform Integration Points:
• Studio Interface: Where course publication triggers writing dates via signals.
• LMS: Where various components read the course scheduling information.
• External Dependencies: Include the shared configuration and possibly third-party Django libraries (highlighted in the requirements files) that support security, migrations, and API interactions.
• Supporting Infrastructure: Build system (Makefile, setup.py), CI workflows (GitHub workflows for testing, linting, publishing), and testing setups all support robust development and deployment.
Relationships and Interactions
• The edx-when Django app receives signals (from the course_date_signals handlers in Studio) to create or update course dates.
• When a course is published, Studio writes to the app (likely via a direct API call) which then stores the timing information in the shared database.
• The LMS reads these dates from the database in various locations to control course scheduling and display.
• Migration files in the “edx_when/migrations” directory indicate versioned changes to the DB schema over time. These add to the lifecycle management of data versioning.
• The app also exposes an admin interface (via admin.py) and an API (via api.py) to handle internal management and programmatic access respectively.
Architectural Patterns and Design Principles
• Modular Django App: The application follows Django’s standard practices with distinct directories for models, views, admin, migrations, and templates.
• Integration via Signals/Events: The architecture leverages Django signals or similar mechanisms to interface with course publishing events in Studio.
• Shared Data Model: Emphasis on a shared database across multiple parts of the edX platform, ensuring consistency of course-dates.
Relevant Technologies and Frameworks
• Python/Django (for the app, models, views, and migration system)
• GitHub Actions (CI workflows for linting, testing, and deployment)
• PyTest or Django’s Test Framework (as seen in the tests/ directories)
• Documentation build processes (Sphinx, Makefile under docs), ensuring clarity on API usage and architectural decisions.