Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Background:
Jira issue: https://project-sunbird.atlassian.net/browse/SB-23374

Problem Statment:

How to upload bulk questions using CSV?
How to pass additional details to the API such as createdBy, Question Categories, Channel, etc… ?

  1. How to upload bulk questions using CSV?Approach 1 Design Enable Bulk question creation.

  2. Enable Bulk question creation and link them to sections(Units).

  3. Enable Bulk question creation with common metadata ex: questionType, channel, createdBy, status, licence and BGMS.

Solution 1:

Create a generate QuML API for various interaction types such that it takes required parameters as input and generates a QuML output. The API takes input as a CSV file and Question Category (For example MCQ, Subjective, etc.)JSON body. This API is responsible for validating and creating questions on the platform.

  • The endpoint for bulk upload of Question is /question/v1/bulkupload

  • Mandatory fields cannot be null or empty.

  • If the server doesn't support the media type, it should return HTTP status code 415 (Unsupported Media Type).

HEADER PARAMETERS:

Content-Type (*required)

string

Media types can be:-

  • Application/json

  • Multipart/form-data

X-Channel-ID (*required)

string

It the Unique Id to identify the root organization to which the user belongs

REQUEST BODY: multipart/form-data

file (*required)

string <binary>

This is a .csv file. Each line of the file is a data record, separated by commas
Here is the file format link: https://docs.google.com/spreadsheets/d/1ndzapGGV6q8698x-NQzK_ufln4YX1HQ09jsFsC7kA60/edit#gid=0

Here is an example of a POST request that includes multipart/form-data:

Code Block
curl --location --request POST '<HOST_URL>/question/v1/bulkupload' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'X-Channel-ID: sunbird' \
--form 'File=@"/qumlTest.csv"'
REQUEST BODY: application/JSON:

fileUrl (*required)

String <url>
This is a CSV file URL. It should be a publicly accessible file URL.

Additional Properties (Optional)

createdBy, questionType, author, stage OR status

Here is an example of a POST request that includes JSON data:

Code Block
curl --location --request POST '<HOST_URL>/question/v1/bulkupload' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'X-Channel-ID: sunbird' \
--header 'Content-Type: application/json' \
--data-raw '{
    "request" : {
        "fileUrl": "https://dockstaging.blob.com/do_123/test.csv",
        "questionType": "MCQ",
        "createdBy": "ae94b68c-a535-4dce-8e7a-fb9662b0ad68",
        "author": "SCERT Haryana",
        "status": "Live"
    }
}'

Response Samples:

Code Block
language`
{
    "id": "api.v1.bulkupload",
    "ver": "1.0",
    "ts": "2021-10-20T09:20:59.943Z",
    "params": {
        "resmsgid": "09faf370-3187-11ec-b57e-5ffde477525a",
        "msgid": "095a6db0-3187-11ec-b57e-5ffde477525a",
        "status": "successful",
        "err": null,
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "processId": "112ed159-c805-4df5-9da3-3fcd73122cc2",
    }
}


Solution 2:

Create a generate QuML API for various interaction types such that it takes required parameters as input and generates a QuML output. The API takes input as an array of questions.

  • The endpoint for bulk upload of Question is /question/v1/bulkUpload/{{questionSet_Identifier}}

...

  • /bulkupload

  • Mandatory fields cannot be null or empty.

HEADER PARAMETERS:

Content-Type (*required)

string

The possible media types can be:-

  • Application/json

X-Channel-ID (*required)

string

It the Unique Id to identify the root organization to which the user belongs

REQUEST BODY SCHEMA: application/JSON:

JSON The body is the representation of the resource object for creating questions, which is an array of parameters that describes the question.

Code Block
{
  "request": {
    "question": [
      {
        "metadata": {
          "framework": "ekstep_ncert_k-12",
          "channel": "01309282781705830427",
          "name": "TestQuestion",
          "code": "9ae33d1e-a682-f30c-04b5-9bda236650ac",
          "mimeType": "application/vnd.sunbird.question",
          "primaryCategory": "Multiple Choice Question",
        },
        "collection": [
          {
            "identifier": "do_11324642736155033614",
            "unitId": "do_11324642761348710417"
          }
        ],
        "stage": "Review"
      }
    ]
  }
}

Response Samples:

Code Block
language`
{
    "id": "api.v1.bulkupload",
    "ver": "1.0",
    "ts": "2021-10-20T09:20:59.943Z",
    "params": {
        "resmsgid": "09faf370-3187-11ec-b57e-5ffde477525a",
        "msgid": "095a6db0-3187-11ec-b57e-5ffde477525a",
        "status": "successful",
        "err": null,
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "processId": "112ed159-c805-4df5-9da3-3fcd73122cc2",
    }
}


Details to be pre-filled / derived by the system:

  1. Question Category will be Multiple Choice Question for this version.

  2. Additional Category is derived from the question set

  3. Target Question Set ID to be auto-derived when user is uploading questions within a question set. This will not be shown in the CSV upload format to the contributor.

  4. Taxonomy Framework Categories: These will derived from the Question set when questions are being uploaded within a question set. Questions can be uploaded in a question created for any framework - all available categories should be derived and tagged to questions. Below are sample categories for K-12 framework:

    1. Org_FW_Board

    2. Org_FW_Medium

    3. Org_FW_Class

    4. Org_FW_Subject

    5. Org_FW_Topic

    6. Org_FW_LearningOutcome is not supported in bulk upload sheet. User can edit from UI.

    7. Org_FW_Skill is not supported in bulk upload sheet. User can edit from UI.

  5. License