> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crazygoldfish.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GET - Get Worksheet Explanations

> Retrieves all questions with their explanations for a given worksheet.  
The response includes worksheet metadata along with questions that have an `explanation` key added to each question object.

**Prerequisites:**
- The worksheet must exist.
- The question generation step must be completed.
- The explanation generation step must be completed.

**How to Use:**
 1. Call `GET /worksheet/v1/generate-explanations/{work_sheet_id}` with the worksheet ID.
 2. On success, you will receive worksheet metadata along with questions and their explanations.
 3. If the worksheet or any required step is missing, a `404` error is returned.
 4. If the generation steps are not yet completed, a `400` error is returned with the current status.
 5. If explanation generation failed, a `400` error is returned with the failure message.

**Path Parameters:**
- `work_sheet_id` (UUID, required): The unique ID of the worksheet.

**Response Data:**
- `id`: Worksheet ID.
- `board`: Board details (id and name).
- `grade`: Grade details (id and name).
- `section`: Worksheet section.
- `subject`: Subject details (id and name).
- `status`: Current status of the explanation generation step.
- `number_of_questions`: Total number of questions in the worksheet.
- `topic`: Topic of the worksheet.
- `documents`: List of document URLs associated with the worksheet.
- `audio`: Audio URL if available.
- `questions`: Array of questions with explanations merged.

**Response Codes:**
- `200 OK`: Questions with explanations returned successfully.
- `400 Bad Request`: Questions or explanations not yet generated, or generation failed.
- `404 Not Found`: Worksheet, questions, or explanations not found.
- `500 Internal Server Error`: Unexpected error occurred.




## OpenAPI

````yaml GET /worksheet/v1/generate-explanations/{work_sheet_id}
openapi: 3.0.1
info:
  title: Worksheet Explanation API
  description: An API for generating and retrieving worksheet question explanations.
  version: 1.0.0
servers:
  - url: https://api-staging.crazygoldfish.com
    description: SandBox endpoint
  - url: https://api.crazygoldfish.com
    description: Prod End Point
security: []
paths:
  /worksheet/v1/generate-explanations/{work_sheet_id}:
    get:
      summary: Get Worksheet Questions with Explanations
      description: >-
        Retrieves all questions with their explanations for a given worksheet.
        The response includes worksheet metadata along with questions that have
        an 'explanation' key added to each question object.
      operationId: getWorksheetExplanations
      parameters:
        - name: work_sheet_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Unique identifier of the worksheet
      responses:
        '200':
          description: Worksheet questions with explanations retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Unique identifier of the worksheet
                      board:
                        type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                          name:
                            type: string
                      grade:
                        type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                          name:
                            type: string
                      section:
                        type: string
                        nullable: true
                      subject:
                        type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                          name:
                            type: string
                      status:
                        type: string
                        description: Current status of the explanation generation step
                        enum:
                          - Pending
                          - In Progress
                          - Completed
                          - Failed
                      number_of_questions:
                        type: integer
                        description: Total number of questions in the worksheet
                      topic:
                        type: string
                        description: Topic of the worksheet
                      documents:
                        type: array
                        items:
                          type: string
                        description: List of document URLs associated with the worksheet
                      audio:
                        type: string
                        nullable: true
                        description: Audio URL if available
                      questions:
                        type: object
                        description: Questions grouped by type with explanations
                        additionalProperties:
                          type: array
                          items:
                            type: object
                            properties:
                              question:
                                type: string
                                description: The question text
                              options:
                                type: array
                                items:
                                  type: string
                                description: Answer options for MCQ type questions
                              answer:
                                type: string
                                description: Correct answer for the question
                              tags:
                                type: object
                                properties:
                                  learning_objectives:
                                    type: string
                                  bloom:
                                    type: string
                                  difficulty:
                                    type: string
                              explanations:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    learning_objective:
                                      type: string
                                      description: >-
                                        Learning objective addressed by this
                                        explanation
                                    explanation:
                                      type: string
                                      description: Detailed explanation of the answer
                                    key_concepts:
                                      type: array
                                      items:
                                        type: string
                                      description: Key concepts covered in the question
                                    common_mistakes:
                                      type: string
                                      description: Common mistakes students make
                                    real_world_application:
                                      type: string
                                      description: Real-world application of the concept
              example:
                data:
                  id: d7494c99-0539-ce2-92e0c2ede6d1
                  board:
                    id: 087c80b0-ac25-40ee-8657-28b694882ba8
                    name: CBSE
                  grade:
                    id: 65955148-e106-461b-a9a6-e0c3294f6734
                    name: Grade 10
                  section: null
                  subject:
                    id: abf49127-253c-4dc9-9bf5-eb66360e5592
                    name: Mathematics
                  status: Completed
                  number_of_questions: 10
                  topic: Probability
                  documents: []
                  audio: null
                  questions:
                    mcq_single_answer:
                      - question: >-
                          A bag contains 1 red ball, 1 blue ball, and 1 yellow
                          ball. Kritika picks one ball without looking. What is
                          the probability that she picks a red ball? Choose the
                          ONE best answer.
                        options:
                          - A. 1/3
                          - B. 1/2
                          - C. 1/4
                          - D. 1/6
                        answer: A
                        tags:
                          learning_objectives: >-
                            Calculate the probability of simple events in
                            everyday scenarios (Application)
                          bloom: Apply
                          difficulty: Easy
                        explanations:
                          - learning_objective: >-
                              Calculate the probability of simple events in
                              everyday scenarios by determining favorable
                              outcomes over total possible outcomes.
                            explanation: >-
                              The bag has three balls: red, blue, and yellow,
                              each equally likely to be picked. Total possible
                              outcomes = 3. Favorable outcome for picking a red
                              ball = 1 (only one red ball). Probability =
                              favorable outcomes ÷ total outcomes = 1 ÷ 3.
                              Hence, option A (1/3) is correct. Options B (1/2),
                              C (1/4), and D (1/6) are incorrect because they
                              represent probabilities for different or
                              impossible scenarios with this setup. This
                              requires applying the probability formula, fitting
                              Bloom's Apply level for Grade 10.
                            key_concepts:
                              - Probability formula
                              - Total possible outcomes
                              - Favorable outcomes
                              - Equally likely events
                            common_mistakes: >-
                              Students may incorrectly count the total number of
                              balls or confuse the favorable outcomes, leading
                              to wrong denominators or numerators. Some might
                              pick half or quarter without accounting for total
                              outcomes properly.
                            real_world_application: >-
                              This concept helps in predicting outcomes in
                              random selection scenarios, like drawing a colored
                              ball from a bag or choosing items randomly,
                              fundamental in games, lotteries, and risk
                              assessment.
                      - question: >-
                          A fair six-sided die is rolled once. What is the
                          probability of getting a number greater than 4? Choose
                          the ONE best answer.
                        options:
                          - A. 1/3
                          - B. 1/2
                          - C. 2/3
                          - D. 1/6
                        answer: A
                        tags:
                          learning_objectives: >-
                            Calculate the probability of simple events in
                            everyday scenarios (Application)
                          bloom: Apply
                          difficulty: Easy
                        explanations:
                          - learning_objective: >-
                              Calculate the probability of an event by
                              identifying favorable outcomes from possible
                              outcomes in real-life scenarios.
                            explanation: >-
                              A six-sided die has outcomes 1 through 6. Numbers
                              greater than 4 are 5 and 6, so favorable outcomes
                              = 2. Total outcomes = 6. Probability = favorable
                              outcomes ÷ total outcomes = 2 ÷ 6 = 1/3.
                              Therefore, option A is correct. Option B (1/2)
                              suggests 3 favorable outcomes, which is incorrect.
                              Option C (2/3) is too high, implying 4 favorable
                              outcomes, and D (1/6) implies only one favorable
                              outcome, both incorrect here. This question
                              applies simple counting and probability
                              calculation.
                            key_concepts:
                              - Sample space
                              - Favorable outcomes
                              - Probability calculation
                              - Properties of a fair die
                            common_mistakes: >-
                              A common error is miscounting favorable numbers,
                              such as including 4 or missing 5 and 6. Others may
                              simplify fractions incorrectly or confuse total
                              outcomes with favorable outcomes.
                            real_world_application: >-
                              Understanding die probabilities is essential in
                              games and decision-making processes involving
                              chance, helping to predict outcomes and make
                              informed choices.
        '400':
          description: Bad request due to incomplete prerequisites or generation failure.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                        status:
                          type: string
                        msg:
                          type: string
              examples:
                questionsNotGenerated:
                  summary: Questions not yet generated
                  value:
                    detail:
                      - id: d7494c99-0539-ce2-92e0c2ede6d1
                        status: In Progress
                        msg: Questions are not yet generated.
                explanationsNotGenerated:
                  summary: Explanations not yet generated
                  value:
                    detail:
                      - id: d7494c99-0539-ce2-92e0c2ede6d1
                        status: In Progress
                        msg: Explanations are not yet generated.
                explanationGenerationFailed:
                  summary: Explanation generation failed
                  value:
                    detail:
                      - id: d7494c99-0539-ce2-92e0c2ede6d1
                        status: Failed
                        msg: Explanation generation failed.
        '404':
          description: Worksheet, questions, or explanations not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        msg:
                          type: string
              examples:
                worksheetNotFound:
                  summary: Worksheet not found
                  value:
                    detail:
                      - msg: Worksheet not found.
                questionsNotFound:
                  summary: Questions not found
                  value:
                    detail:
                      - msg: >-
                          Worksheet questions not found. Please generate
                          questions first.
                explanationsNotFound:
                  summary: Explanations not found
                  value:
                    detail:
                      - msg: >-
                          Worksheet explanations not found. Please generate
                          explanations first.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        msg:
                          type: string
              example:
                detail:
                  - msg: An unexpected error occurred.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````