|
| 1 | +Instructor Dashboard – Open Response Assessment (ORA) API Specification |
| 2 | +====================================================================== |
| 3 | + |
| 4 | +Status |
| 5 | +====== |
| 6 | +Accepted |
| 7 | + |
| 8 | +Context |
| 9 | +======= |
| 10 | + |
| 11 | +The Instructor Dashboard is being migrated to a Micro-Frontend (MFE) architecture, |
| 12 | +which requires stable, well-defined, and RESTful API endpoints. |
| 13 | + |
| 14 | +The existing Open Response Assessment (ORA) functionality exposes summary and |
| 15 | +detailed assessment data through legacy endpoints that are tightly coupled to |
| 16 | +server-rendered views. These endpoints do not meet the requirements for MFE |
| 17 | +consumption, including consistent URL patterns, centralized permission handling, |
| 18 | +and standardized API documentation. |
| 19 | + |
| 20 | +Additionally, ORA functionality is implemented in the edx-ora2 library, which |
| 21 | +is maintained as a separate Django app from the main platform. Historically, |
| 22 | +Instructor Dashboard APIs have been implemented directly in the platform and |
| 23 | +coupled to ORA data sources, rather than being owned by or exposed directly from |
| 24 | +edx-ora2. While edx-ora2 is expected to be installed in the platform, this |
| 25 | +cross-app coupling is not an ideal long-term pattern. |
| 26 | + |
| 27 | +As part of this work, the new versioned ORA APIs will continue to rely on the |
| 28 | +existing OraAggregateData interface to retrieve assessment data. This ensures |
| 29 | +consistency with current ORA behavior and avoids introducing tighter coupling or |
| 30 | +duplicate business logic as part of this migration. |
| 31 | + |
| 32 | +Refactoring or relocating these REST endpoints into the edx-ora2 library |
| 33 | +itself—so that the Instructor Dashboard consumes them as an external dependency— |
| 34 | +is acknowledged as a potential future improvement. However, this architectural |
| 35 | +change is explicitly out of scope for the current effort. |
| 36 | + |
| 37 | +To support the MFE migration in the short term, this work introduces a new |
| 38 | +versioned ORA API that follows RESTful principles and aligns with existing |
| 39 | +Instructor v2 APIs, while preserving current data access patterns and interfaces. |
| 40 | + |
| 41 | +Decisions |
| 42 | +========= |
| 43 | + |
| 44 | +1. RESTful Resource-Oriented Design |
| 45 | +---------------------------------- |
| 46 | + |
| 47 | +Introduce a versioned API under ``/api/instructor/v2/`` using resource-oriented |
| 48 | +URLs and clear HTTP semantics. |
| 49 | + |
| 50 | +**Summary endpoint** |
| 51 | + |
| 52 | +.. code-block:: http |
| 53 | +
|
| 54 | + GET /api/instructor/v2/courses/{course_key}/ora/summary/ |
| 55 | +
|
| 56 | +Returns aggregated ORA statistics for a course, including: |
| 57 | + |
| 58 | +- Total units |
| 59 | +- Total assessments |
| 60 | +- Total responses |
| 61 | +- Counts by assessment type (training, peer, self, waiting, staff) |
| 62 | +- Number of final grades received |
| 63 | + |
| 64 | +**Assessments list endpoint** |
| 65 | + |
| 66 | +.. code-block:: http |
| 67 | +
|
| 68 | + GET /api/instructor/v2/courses/{course_key}/ora/ |
| 69 | +
|
| 70 | +Returns a collection of Open Response Assessments (ORAs) for the specified course. |
| 71 | +Each item in the response represents a single assessment and includes |
| 72 | +per-assessment metrics such as response counts, grading progress, and assessment |
| 73 | +state. |
| 74 | + |
| 75 | +2. Permissions Aligned with Instructor Dashboard |
| 76 | +------------------------------------ |
| 77 | + |
| 78 | +The permission checks for these new API endpoints align with existing |
| 79 | +Instructor Dashboard permissions: |
| 80 | +- Only users with instructor or staff roles for the course can access these endpoints. |
| 81 | + |
| 82 | +3. Serializer-Based Business Logic |
| 83 | +--------------------------------- |
| 84 | + |
| 85 | +Use Django REST Framework serializers (``ORASummarySerializer`` and |
| 86 | +``ORASerializer``) to encapsulate business logic for data retrieval and formatting. |
| 87 | + |
| 88 | +Views remain thin and focused on request handling. |
| 89 | + |
| 90 | +4. OpenAPI Specification |
| 91 | +------------------------ |
| 92 | + |
| 93 | +Maintain an OpenAPI specification at ``../references/instructor-v2-ora-api-spec.yaml`` to guide implementation. |
| 94 | +This static specification serves as a reference during development, but ``/api-docs/`` is the source of truth for what is actually deployed. |
| 95 | +Once implementation is complete and the endpoints are live in ``/api-docs/``, the static spec file will be deleted to avoid maintaining outdated documentation. |
| 96 | + |
| 97 | +Consequences |
| 98 | +============ |
| 99 | + |
| 100 | +- Reduced the complexity of client-side code by providing structured data |
| 101 | + tailored for MFE consumption |
| 102 | +- Centralized business logic ensures consistent permission checks and data |
| 103 | + formatting |
| 104 | +- Simplified client-side logic for the Instructor Dashboard MFE |
| 105 | +- OpenAPI documentation enables type-safe client generation and easier |
| 106 | + integration |
| 107 | + |
| 108 | +References |
| 109 | +========== |
| 110 | + |
| 111 | +- OpenAPI Specification: ``../references/instructor-v2-ora-api-spec.yaml`` |
| 112 | +- Live API Documentation: ``/api-docs/`` |
0 commit comments