Versions Compared

Key

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

Problem Statement:

In sun-bird Sunbird system classification of terms and identify the relations (association) between terms belongs to different categories and show that in visual representation help user to creation and publishing of framework with categories.

...

  1. Install latest version of angular.

    npm i sb-taxonomy-editor

  2. Add below element in sunbird-Ed-portal

<sb <lib-taxonomy-editor view [environment]="environment" [taxonomyConfig]="taxonomyConfig"></sblib-taxonomy-editor> view>

  1. Save below "environment" and "taxonomyConfig" in local storage before initialize above library. (this need to change as input to a library) / Default configuration is available.

    Code Block
             environment =  {
                     frameworkName: string,   
                     channelId: string,
                     authToken: string,
                     isApprovalRequired:  boolen  // set default to false,
              }
    
             taxonomyConfig = {
                        frameworkId: string,
                        config: [
                            {
                                index:number,
                                category:string,
                                icon: 'string',
                                color: 'string'
                            }
                        ]
            }

...

Example:- Education Taxonomy would look as below.

...

API’s Used:

  1. Framework Read 

{{domain}} – should be replaced with the host address of the target environment. 

{{frameworkId}} – should be replaced with the framework identifier which is created. 

{{channelId}} - channel Id which the framework belongs to.  

{{apiKey}} - Kong Gateway API Key for the target environment. 

Code Block
curl --location --request GET 'https://{{domain}}/api/framework/v1/read/{{frameworkId}} \ 

--header 'Content-Type: application/json' \ 

--header 'X-Channel-Id: {{channelId}}' \ 

--header 'Authorization: Bearer {{apiKey}}' 

  1. Framework Publish 

Code Block
curl --location --request POST 'https://{{domain}}/api/framework/v1/publish/{{frameworkId}}' \ 

--header 'Content-Type: application/json' \ 

--header 'Authorization: Bearer {{apiKey}}' \ 

--header 'X-Channel-Id: {{channelId}}' \ 

--data-raw '{}' 

  1. Term Create 

{{domain}} - Host address of the target environment 

{{frameworkId}} – Framework identifier from the target environment. 

{{newUUID}} - provide newly generated UUID value from client. 

Code Block
curl --location --request POST 'https://{{domain}}/api/framework/v1/term/create?framework={{frameworkId}}&category={{categoryId}}' \ 

--header 'Content-Type: application/json' \ 

--header 'Authorization: Bearer {{apiKey}}' \ 

--data-raw '{ 

    "request": { 

        "term": { 

            "code": "{{newUUID}}", 

            "name": "Noting and Drafting", 

            "description": "Draft and analyse a note, in order to move a proposal for decision making based on the availability of evidence and existing rules and precedents", 

            "status": "Draft", 

            "parents": [ 

                { 

                    "identifier": "{{frameworkId}}_{{categoryId}}" 

                } 

            ], 

           “approvalStatus" : “Draft”, 

            "additionalProperties": { 

                "competencyType": "Domain", 

                "competencyArea": "Office Management", 

                "sourceId": "CID02755" 

            } 

        } 

    } 

}' 

  1. Term Update 

{{domain}} - Host address of the target environment 

{{termCode}} - Term code value which needs to be updated. 

{{frameworkId}} – Framework identifier from the target environment. 

{{categoryId}} - Category code from the selected object group. 

{{targetTermIdentifier}} - provide the target term object identifier which the association should be created. 

 

Code Block
curl --location --request PATCH 'https://{{domain}}/api/framework/v1/term/update/{{termCode}}?framework={{frameworkId}}&category={{categoryId}}' \ 

--header 'Content-Type: application/json' \ 

--header 'Authorization: Bearer {{apiKey}}' \ 

--data '{ 

    "request": { 

        "term": { 

            "associations": [ 

                { 

                    "identifier": {{targetTermIdentifier}}, 

                     “approvalStatus" : “Draft”, 

                } 

            ] 

        } 

    } 

}' 

Note : “associations” array contain all the term object identifiers – which are previously created associations.  

Approval flow (TODO)

  1. Workflow Create 

{{domain}} - Host address of the target environment 

             {{userToken}} - User Auth token 

              {{TermObject}} -  Term objects 

Code Block
curl --location '{{domain}}/api//workflow/taxonomy/create' \ 

--header 'userToken: {{userToken}} '\ 

--header 'Authorization: bearer {{api-key}}' \ 

--header 'Content-Type: application/json' \ 

--data '{ 

    "state": "INITIATE", 

    "action": "INITIATE", 

    "serviceName": "taxonomy", 

    "updateFieldValues": [ {{TermObjects}} ] 

}' 

  1. Workflow Application Search 

{{status of the application}} - Status of the application we want to search  

Code Block
curl --location 'https://portal.igot-dev.in/api/workflow/taxonomy/search' \  

--header 'userToken: {{userToken}}' \  

--header 'Authorization: bearer {{api-key}}' \ 

--header 'Content-Type: application/json' \ 

 --data '{    

             "serviceName": "taxonomy",  

              "applicationStatus": "{{status of the application}}"  

}' 

  1. Workflow Application Read 

{{wfId}} - wfId of the application 

Code Block
curl --location 'https://portal.igot-dev.in/api/workflow/taxonomy/read/{{wfId}}' \ 

--header 'userToken: {{userAuthToken}}' \ 

--header 'Authorization: bearer {{api-key}}' 
  1. Workflow Transition

{{wfId}} - wfId of the application \

  1. Approve Level 2 

Code Block
curl --location --request PATCH 'https://portal.igot-dev.in/api/workflow/taxonomy/update' \ 

--header 'userToken: {{userAuthToken}}' \ 

--header 'Authorization: bearer {{api-key}}' \ 

--header 'Content-Type: application/json' \ 

--data '{ 

    "wfId": "{{wfId}}", 

    "state": "SEND_FOR_REVIEW_L1", 

    "action": "APPROVE",  

    "serviceName": "taxonomy" 

}'  
  1. Approve Level 2 

Code Block
curl --location --request PATCH 'https://portal.igot-dev.in/api/workflow/taxonomy/update' \ 

--header 'userToken: {{userAuthToken}}' \ 

--header 'Authorization: bearer {{api-key}}' \ 

--header 'Content-Type: application/json' \ 

--data '{ 

    "wfId": "{{wfId}}", 

    "state": "SEND_FOR_REVIEW_L2", 

    "action": "APPROVE", 

    "serviceName": "taxonomy" 

}' 

  1. Publish 

Code Block
curl --location --request PATCH 'https://portal.igot-dev.in/api/workflow/taxonomy/update' \ 

--header 'userToken: {{userAuthToken}}' \ 

--header 'Authorization: bearer {{api-key}}' \ 

--header 'Content-Type: application/json' \ 

--data '{ 

    "wfId": "{{wfId}}", 

    "state": "SEND_FOR_PUBLISH", 

    "action": "APPROVE", 

    "serviceName": "taxonomy" 

}'