Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current Restore this Version View Page History

« Previous Version 18 Next »

Objective

This document provides the details of how the product workflow has been designed by considering the use cases of end users. This will explain the flow of the application starting from Injecting the events, dimensions & datasets.

Purpose: The purpose of the document is to provide how to ingest the data and access the end datasets.

Step-wise Ingestion process

The ingestion of the data can be done using the apis. To run the apis, please use postman as a tool. If postman tool already exists, skip the setting up program section or else install the postman by following steps

Setting up Postman

  • Download the postman application and import the collection.

  • Select the import option in the postman to import the collection. Please refer to the below screenshot.

The data can be ingested in two ways

  1. Ingestion of data using csv

  2. Ingestion of data using API

Ingestion of data using CSV

Ingestion of Dimension Data using CSV 

Select the csv_import folder in the postman collection.

Step 1: Open the specified request & add the details

API Endpoint: <domain_name>/ingestion/new_programs

HTTP Method: POST      

This API will import the dimension csv and upload it in to the combined_input folder in cloud if there are no errors. Then adapter will use the same files to breakdown the combined input into multiple input files. Later those files will be used by the Nifi processor to process and ingest the data into the database.

Step 2: Build the request body with reference to YAML file. The request body for the above api is attached in  Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml

 Provide the valid input details for the Parameters shown below.

  • file : Attach the csv file for the importing 

  • ingestion_type : Specify the type of ingestion

  • ingestion_name : Name of the dimension(dimension name should be present in the database)

Step 3: Click on the send button for the request and if the request is successful the user should see a response message. Please refer to the below screenshot.

After successful execution of the csv import api we get the response and we can see the file status indicating if the file is uploaded or not through GET file status API. If the file is successfully uploaded we will get the response as uploaded and if there is any error it will send us the response indicating there was an error in the file.

Ingestion of Event Data using CSV

  • Select the csv import folder from the postman collection.

Step 1: Open the specified request & add the details

API Endpoint: <domain_name>/ingestion/new_programs

HTTP Method: POST  

 This API will import the event csv and upload it in to the combined_input folder in cloud if there are no errors. Then adapter will use the same files to breakdown the combined input into multiple input files. Later those files will be used by the Nifi processor to process and ingest the data into the database.

Step 2: Build the request body with reference to YAML file. The request body for the above api is attached in  Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml

 Provide the valid input details for the Parameters shown below.

  • file : Attach the csv file for the importing 

  • ingestion_type : Specify the type of ingestion

  • ingestion_name : Name of the  event (event name should be present in the database)

Step 3: Click on the send button for the request and if the request is successful the user should see a response message. Please refer to the below screenshot.

After successful execution of the csv import api we get the response and we can see the file status indicating if the file is uploaded or not using GET file status API. If the file is successfully uploaded we will get the response as uploaded and if there are any errors it will send us the response indicating there was an error in the file.

Ingestion of Dataset data using CSV

  • Select the csv import folder from the postman collection.

Step 1: Open the specified request & add the details

API Endpoint: <domain_name>/ingestion/new_programs

HTTP Method: POST  

This API will import the event csv and upload it in to the combined_input folder in cloud if there are no errors. Then adapter will use the same files to breakdown the combined input into multiple input files. Later those files will be used by the Nifi processor to process and ingest the data into the database.

Step 2: Build the request body with reference to YAML file. The request body for the above api is attached in  Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml

 Provide the valid input details for the Parameters shown below.

  • file : Attach the csv file for the importing 

  • ingestion_type : Specify the type of ingestion

  • ingestion_name : Name of the  dataset(dataset name should be present in the database)

Step 3: Click on the send button for the request and if the request is successful the user should see a response message.

After successful execution of the csv import api we get the response and we can see the file status indicating if the file is uploaded or not using GET file status API. If the file is successfully uploaded we will get the response as uploaded and if there are any errors it will send us the response indicating there was an error in the file.

Ingestion of data using API

The data can also be ingested using API’s developed for event,dimension and dataset.

Ingestion of Events using API

Step 1: Open the specified request & add the details

API Endpoint: <domain_name>/ingestion/event

HTTP Method: POST  

This API will be used to write events into the csv file and upload it in to the combined_input folder in cloud if there are no errors. Then adapter will use the same files to breakdown the combined input into multiple input files. Later those files will then be used by the Nifi processor to ingest the data into the database. The API can be used to add individual events into csv.

Step 2: Build the request body with reference to YAML file. The request body for the above api is attached in  Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml

Provide the valid input details for the Parameters shown below. The request body should conform to the schema stored in the database for the particular event name.

Step 3: Click on the send button for the request and if the request is successful the user should see a response message. Please refer to the below screenshot.

After successful execution of the event api we get the response and the data sent in the request body will be written to the csv file. If there are any errors it will be written to the separate csv file and valid data will be written to the other csv file.

Ingestion of Dimensions using API

Step 1: Open the specified request & add the details

API Endpoint: <domain_name>/ingestion/dimension

HTTP Method: POST  

This API will be used to write dimensions into the csv file and upload it in to the combined_input folder in cloud if there are no errors. Then adapter will use the same files to breakdown the combined input into multiple input files. Later those files will then be used by the Nifi processor to ingest the data into the database. This API can be used to add individual dimensions into csv.

Step 2: Build the request body with reference to YAML file. The request body for the above api is attached in  Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml . Provide the valid input details for the Parameters shown below. The request body should conform to the schema stored in the database for the particular dimension name.

Step 3: Click on the send button for the request and if the request is successful the user should see a response message. Please refer to the below screenshot.

After successful execution of the dimension api we get the response and the data sent in the request body will be written to the csv file. If there are any errors it will be written to the separate csv file and valid data will be written to the other csv file.

Ingestion of Datasets using API

Step 1: Open the specified request & add the details

API Endpoint: <domain_name>/ingestion/dataset

HTTP Method: POST 

This API will be used to write datasets into the csv file and upload it in to the combined_input folder in cloud if there are no errors. Then adapter will use the same files to breakdown the combined input into multiple input files. Later those files will then be used by the Nifi processor to ingest the data into the database. This API can be used to add individual datasets into csv.

Step 2: Build the request body with reference to YAML file. The request body for the above api is attached in  Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml

Provide the valid input details for the Parameters shown below. The request body should conform to the schema stored in the database for the particular dataset name.

Step 3: Click on the send button for the request and if the request is successful the user should see a response message. Please refer to the below screenshot.

After successful execution of the dataset api we get the response and the data sent in the request body will be written to the csv file. If there are any errors it will be written to the separate csv file and valid data will be written to the other csv file.

Error Monitoring

The error file csv which will store all the error records during the ingestion process will be uploaded to the appropriate cloud storage. The user can login to the respective cloud storage the cQube is using and download the file to take a look at the error records present in the csv.

File Status API 

  • GET file status API

GET file status API

Step 1:  Open the specified request & add the details

API Endpoint: <domain_name>/ingestion/file-status

HTTP Method: GET 

Step 2: Send the query parameters with reference to the YAML file. The query parameters for the above api is attached in  Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml

Provide the valid input details for the parameters shown below. 

Step 3: Click on the send button for the request and if the request is successful the user should see a response message which contains the status of the file.

If the csv files are too large in size, the upload process of those files will take more time which will make users wait for longer duration to receive the response from the API. As a result, the upload process will be running asynchronously and we have developed this api to know the status of the file at any particular time.

Schedule API

This API helps to schedule the processor group at any particular time and ingest the data into the database.

Step 1: Open the specified request & add the details

API Endpoint: <domain_name>/spec/schedule

HTTP Method: POST

Step 2: Build the request body with reference to YAML file. The request body for the above api is attached in Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml . Provide the valid input details for the Parameters shown below. The pipeline name passed in the request body should be present in the database.

Step 3: Click on the send button for the request and if the request is successful the user should see a response message. The schedule time will be updated in the processor group.

The schedule api helps to run the processor group in Nifi at a scheduled time. The schedule time can be updated by changing the cron expression for scheduled_at property in the request body. The processor group processes the csv file at a scheduled time and ingests the data into the database.

V4-Data Emission API

This API are used for data migration. It will help to migrate the data in cQube 4.0 version.

Step 1: Open the specified request and add the details.

API Endpoint: <domain_name>/ingestion/v4-data-emission

HTTP Method: GET

Step 2: Click on the send button for the request and if the request is successful the user should see a response message as “FIles uploaded successfully”. The files will be uploaded to the emission folder created in the respective cloud storage.

National Programs API

This API accepts the event data in the zip file format and adds it to the emission folder in the respective cloud storage.

Step 1: Open the specified request and add the details.

API Endpoint: <domain_name>/ingestion/national_programs

HTTP Method: POST

Step 2: Build the request body with reference to YAML file. The request body for the above api is attached in Link for yaml: https://github.com/Sunbird-cQube/spec-ms/blob/march-release/spec.yaml . Provide the valid input details for the Parameters shown below.

Step 3: Click on the send button for the request and if the request is successful the user should see a response message as “FIle uploaded successfully”. The files will be uploaded to the emission folder created in the respective cloud storage.

The zip file will be extracted and will be read by the adaptors and then moved into the input folders.