-
Notifications
You must be signed in to change notification settings - Fork 4.2k
docs: instructor grading api spec #37743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wgu-taylor-payne
merged 9 commits into
openedx:master
from
WGU-Open-edX:docs/37647-instructor-grading-api
Dec 17, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f27b95f
docs: add adr and spec files for instructor dashboard api
wgu-jesse-stewart d44f30f
Merge branch 'openedx:master' into docs/37647-instructor-grading-api
wgu-jesse-stewart 58eaa24
Merge branch 'openedx:master' into docs/37647-instructor-grading-api
wgu-jesse-stewart 3c0c8fa
docs: update Problems to use path for location
wgu-jesse-stewart a5baf91
Merge branch 'docs/37647-instructor-grading-api' of https://github.co…
wgu-jesse-stewart 0ce537b
docs: pr feedback
wgu-jesse-stewart e7215f7
docs: clarify auth and purpose of docs
wgu-jesse-stewart df9d426
docs: clarify OpenAPI spec lifecycle
wgu-jesse-stewart 5a220a2
Merge branch 'master' into docs/37647-instructor-grading-api
wgu-jesse-stewart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
lms/djangoapps/instructor/docs/decisions/0001-course-info-api-spec.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| Instructor Course Information API Specification | ||
| ----------------------------------------------- | ||
|
|
||
| Status | ||
| ====== | ||
|
|
||
| **Accepted** *2025-10-30* | ||
|
|
||
| Context | ||
| ======= | ||
|
|
||
| The instructor dashboard requires comprehensive course metadata, enrollment statistics, user | ||
| permissions, and navigation configuration. This information was previously scattered across | ||
| multiple endpoints, requiring multiple round-trip requests and complex client-side data | ||
| aggregation for MFEs. | ||
|
|
||
| Decisions | ||
| ========= | ||
|
|
||
| #. **Consolidated Course Metadata Endpoint** | ||
|
|
||
| Create ``GET /api/instructor/v2/courses/{course_id}`` that returns comprehensive course | ||
| information in a single request, including course identity, timing, enrollment statistics, | ||
| user permissions, dashboard tab configuration, and operational information. | ||
|
|
||
| #. **Permission-Based Tab Configuration** | ||
|
|
||
| Server-side logic determines which dashboard tabs the current user can access based on | ||
| their roles, course features, and system configuration. Tabs are returned with URLs | ||
| pointing to the appropriate MFE routes. | ||
|
|
||
| #. **Serializer-Based Business Logic** | ||
|
|
||
| Use Django REST Framework serializers (``CourseInformationSerializer``) to encapsulate | ||
| all business logic for data gathering, permission checks, enrollment queries, and | ||
| formatting. Keep views thin. | ||
|
|
||
| #. **OpenAPI Specification** | ||
|
|
||
| Maintain an OpenAPI specification at ``../references/instructor-v2-course-info-spec.yaml`` to guide implementation. This static specification serves as a reference during development, but ``/api-docs/`` is the source of truth for what is actually deployed. Once implementation is complete and the endpoints are live in ``/api-docs/``, the static spec file will be deleted to avoid maintaining outdated documentation. | ||
|
|
||
| Consequences | ||
| ============ | ||
|
|
||
| Positive | ||
| ~~~~~~~~ | ||
|
|
||
| * Single request replaces multiple round-trips, reducing latency for MFE page loads | ||
| * Centralized business logic ensures consistent permission checks and data formatting | ||
| * Simplified client code with all course information available in one call | ||
| * OpenAPI specification enables type-safe client generation | ||
|
|
||
| Negative | ||
| ~~~~~~~~ | ||
|
|
||
| * Larger response payload (though offset by eliminating multiple requests) | ||
| * Some over-fetching when clients don't need all information | ||
| * Permission-based data prevents simple course-level caching | ||
| * Enrollment queries and permission checks run on every request | ||
|
|
||
| References | ||
| ========== | ||
|
|
||
| * OpenAPI Specification: ``../references/instructor-v2-course-info-spec.yaml`` | ||
| * Implementation: ``lms/djangoapps/instructor/views/api_v2.py`` | ||
| * Live API Documentation: ``/api-docs/`` |
77 changes: 77 additions & 0 deletions
77
lms/djangoapps/instructor/docs/decisions/0002-instructor-grading-api-spec.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| Instructor Grading API Specification | ||
| ------------------------------------- | ||
|
|
||
| Status | ||
| ====== | ||
|
|
||
| **Draft** (=> **Provisional**) | ||
|
|
||
| Context | ||
| ======= | ||
|
|
||
| The instructor dashboard is being migrated to a Micro-Frontend (MFE) architecture, which requires RESTful API endpoints. The current implementation provides grading operations (reset attempts, rescore, override scores, delete state) through legacy endpoints. | ||
|
|
||
| The MFE migration requires a modern, RESTful API with consistent URL patterns, clear synchronous vs asynchronous behavior, comprehensive task monitoring, and proper documentation. These operations need to support both single-learner (synchronous) and all-learners (asynchronous) execution models. | ||
|
|
||
| Decisions | ||
| ========= | ||
|
|
||
| #. **RESTful Resource-Oriented Design** | ||
|
|
||
| Use resource-oriented URLs: ``/api/instructor/v2/courses/{course_key}/{problem}/grading/{resource}`` | ||
|
|
||
| Use appropriate HTTP methods: | ||
|
|
||
| * ``GET`` for read operations (learner info, problem metadata, task status) | ||
| * ``POST`` for actions (reset attempts, rescore) | ||
| * ``PUT`` for replacements (score overrides) | ||
| * ``DELETE`` for removals (delete learner state) | ||
|
|
||
| #. **Synchronous vs Asynchronous Execution** | ||
|
|
||
| * Operations targeting a single learner (with ``learner`` parameter) execute synchronously | ||
| and return ``200 OK`` with immediate results (< 5s typical) | ||
| * Operations targeting all learners (no ``learner`` parameter) queue a background task | ||
| and return ``202 Accepted`` with task tracking information | ||
| * Provide task status endpoint: ``GET /api/instructor/v2/courses/{course_key}/tasks/{task_id}`` | ||
|
|
||
| #. **Clear Operation Semantics** | ||
|
|
||
| * **Reset Attempts**: Resets counter to zero, preserves answers/state | ||
| * **Delete State**: Permanently removes all learner data (requires ``learner`` parameter) | ||
| * **Rescore**: Re-evaluates submissions with current grading logic (supports ``only_if_higher``) | ||
| * **Override Score**: Manually sets specific score (requires ``learner`` parameter) | ||
|
|
||
| #. **Consistent Response Formats** | ||
|
|
||
| * Synchronous operations return ``SyncOperationResult`` with success, learner, problem_location, message | ||
| * Asynchronous operations return ``AsyncOperationResult`` with task_id, status_url, scope | ||
| * Task status responses include task_id, state, progress, result/error, timestamps | ||
|
|
||
| #. **OpenAPI Specification** | ||
|
|
||
| Maintain an OpenAPI specification at ``../references/instructor-v2-grading-api-spec.yaml`` to guide implementation. This static specification serves as a reference during development, but ``/api-docs/`` is the source of truth for what is actually deployed. Once implementation is complete and the endpoints are live in ``/api-docs/``, the static spec file will be deleted to avoid maintaining outdated documentation. | ||
|
|
||
| Consequences | ||
| ============ | ||
|
|
||
| Positive | ||
| ~~~~~~~~ | ||
|
|
||
| * Consistent URL patterns and response formats make the API predictable | ||
| * Explicit sync/async behavior allows proper UI feedback | ||
| * OpenAPI specification enables automated validation, testing, and type-safe client generation | ||
| * Resource-oriented design makes it easy to add new operations | ||
|
|
||
| Negative | ||
| ~~~~~~~~ | ||
|
|
||
| * Existing clients using legacy endpoints need to be updated | ||
| * Dual maintenance during transition period | ||
| * Developers familiar with legacy endpoints need to learn new patterns | ||
|
|
||
| References | ||
| ========== | ||
|
|
||
| * OpenAPI Specification: ``../references/instructor-v2-grading-api-spec.yaml`` | ||
| * Live API Documentation: ``/api-docs/`` | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.