[Design] Bulk Upload Questions

Introduction

This wiki explains the design and implementation of bulk upload of questions.
Jira issue: SB-23374: Bulk upload questions (MCQ) in prescribed format - Part 1Ready for Release

Problem Statement:

  1. 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 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

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

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:

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:

{ "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", } }

 

Scenario

API

Scenario

API

Bulk upload Questions only

  1. Using CSV file

    1. API will expect CSV file

  2. Using fileUrl publicly accessible fileUrl

    1. API will expect json request.

Bulk upload Questions and link them to QuestionSet

  1. Using CSV file

    1. API will expect CSV file

    2. CSV should have questionSet identifier

  2. Using fileUrl publicly accessible fileUrl

    1. API will expect fileUrl in request body.

    2. questionSet identifier need pass in request body.

Bulk upload Questions and link them to section under QuestionSet

  1. Using CSV file

    1. API will expect CSV file

    2. CSV should have questionSet identifier & section name

  2. Using fileUrl publicly accessible fileUrl

    1. API will expect fileUrl in request body.

    2. questionSet identifier need pass in request body.

Bulk upload Questions with common metadata

  1. Using CSV file

    1. API will expect CSV file

    2. User need to make sure common metadata in CSV.

  2. Using fileUrl publicly accessible fileUrl

    1. API will expect fileUrl in request body.

    2. questionSet identifier need pass in request body.

    3. Pass common metadata in request body.


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

  • 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.

Response Samples:

 

Conclusion:


<TODO>