Versions Compared

Key

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


Problem Statement :

Course Creator should be able to attach more than one certificate template to a course or course-batch so that users receive different certificates based on the defined filter criteria for each template. The creator should also be able to delete one or more certificate templates from the course. After addition or deletion of certificates, the course creator should also be able to view the list the certificate templates attached to a particular course.

Jira Legacy
serverSystem JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId2207a759-5bc8-39c5-9cd2-aa9ccc1f65dd
keySB-14845

Solution Approach :

1. Add Certificate Template Template 

       API Specification : API should take the course details id , batch id (optional), certificate name, filters and the metadata of the certificate template which has to be attached for that particular course. Course creator can add new certificate template to the course by specifying  the filter criteria for issuing the            the certificate, in the filters field of the API.The filters field will be added as a new entry in the metadata section of the certificate.All the certificate templates for a particular course will be stored in the database as a Key-Value pair where certificate name would be the key and its would     metadata would be the value.


2. Delete Certificate Template 

       API Specification : API should take the course details id, batch id(optional) and  name of the certificate which the course creator wants to delete.After the certificate template gets deleted, its respective entry in database stored as a Key-Value pair will get deleted.

3. Get Certificate Template

       API Specification : API should take the course id and  batch id(optional) and return the list of certificate templates attached to the course.

Table Structure

Certificate templates would be stored in Cassandra table. Below is the table structure with details of each column


Panel
bgColor#fdfdfd
borderStyledashed
titlecertificate_templates

CREATE TABLE IF NOT EXISTS sunbird_courses.certificate_templates (
  courseid text,  // course id
  batchid text,   // batch id, empty if template is applicable for all the course batches
  name text,  // name of the certificate template
  template text,  // template metadata as a string, contains issuer, signatory and other information
  filters text,  // filters for the certificate
  addedby text,  // user id
  lastupdatedon timestamp, // timestamp of certificate update
  PRIMARY KEY (courseid, name)
);



API Design :

  • Add Certificate Template API


    Code Block
    languagejs
    POST /v1/course/batch/cert/v1/addtemplate
    
    Request :      
    
           {
           "requestparams": {
            
        },
        "request": {
             "courseId": "do_12347787978775440",
            "batchId": "2364563546476343",           //optional field
            "certificateNamename": "Merit-Certificate100PercentCompletionCertificate",
            "filters": {
                       "template"status":{ "2",
                "assessmentScore": {
                               "name"<": "100PercentCompletionCertificate0.8",
                }
            },
                        "issuer"template": {
                "issuer":  {
                                        "name": "Gujarat Council of Educational Research and Training",
             
                                             "url": "https://gcert.gujarat.gov.in/gcert/",
                                                       "publicKey": [
            
                                                           "7",
      
                                                                 "8"
                            
                                    ]
            
                                                },
    
                                            "signatoryList": [
           
                                       {
              
                                   "name": "CEO Gujarat",
                 
                                "id": "CEO",
                    
                             "designation": "CEO",
      
                                           "image": "https://cdn.pixabay.com/photo/2014/11/09/08/06/signature-523237__340.jpg"
                          
                        }
                                              ],
                                            "keys": {
          
                                       "id": "9"
              
                                   },
    
                                         "htmlTemplate": "https://drive.google.com/uc?authuser=1&id=1ryB71i0Oqn2c3aqf9N6Lwvet-MZKytoM&export=download",
                             
                "notifyTemplate": {
                            
                    "subject": "Course completion certificate for Course 03092019 Course",
      
                                          "stateImgUrl": "https://sunbirddev.blob.core.windows.net/orgemailtemplate/img/File-0128212938260643843.png",
                                             "regardsperson": "Chairperson",
                            
                    "regards": "Minister of Gujarat",
                            
                    "emailTemplateType": "defaultCertTemp"
                }
            }
        }   
                 },     



  • Delete  Certificate Template API

    Code Block
    DELETE  /course/batch/cert/v1/template
    
           Request : 
                        "filters":{
      
                                         "status":"2",
     "params": { },
                                          "assessmentScore"request": {
        
                                                    "<" : "0.8""courseId": "do_12347787978775440",
                                         "name": "Merit-Certificate"
                }                                            }                     
                                                }                                                     }                                   
    
    

    Delete  Certificate Template API

    Code Block
    DELETE /v1 }


                 

  • Get Certificate List API

    Code Block
    POST  /course/batch/cert/delete/v1/template/list
      
    Request : 
                       {
                         "params": { },
                         "request":{
                                 "courseId": "do_12347787978775440", 
                               }
    "certificateName": "Merit-Certificate"                            }
    
    
                     }