import sys
from utils.rc.client.requests import Requests
from utils.rc.client.auth import AuthClient
from utils.rc.dtos.project import Project
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
Requests.setRootHost("http://staging.dev.rapidcanvas.net/api/")
AuthClient.setToken(token="") # you can find your token in RapidCanvas UI under tools/tokenf
Note: If you are opening the Notebook editor from the UI, you do not have to pass any token.
Project creation
Project creation needs to have an associated environment. Ensure to create an environment before creating a project because you have to pass the env.id in which you want to execute this project.
If you want to run the project in an environment, create an environment and use its ID in the project. For more information to create an environment, see creating an environment.
Parameters
Parameter name
Parameter description
Data type
Required
Example
name
The name of the project.
String
Yes
Employee
description
The description for the project.
String
No
Employee_promotion
createEmpty
Indicates if a new project should be created deleting the existing project with the same name
Boolean
Yes
True or False
envId
The environment in which you want to execute the project. For this, you have to provide the ID of the environment.
String
Yes
'4dae540d-1717-4b87-8c1e-e60357c7f7f4'
Deleting a project
The following code block must be used to delete a project.
Use this code block to get the list of projects in a tenant.
project.getAllProjects()
Example response:
{
'featureselection': <utils.rc.dtos.project.Project at 0x7f779ad889a0>,
'dropduplicates': <utils.rc.dtos.project.Project at 0x7f779ad882b0>,
'onehotencoding': <utils.rc.dtos.project.Project at 0x7f779ad88a90>,
'tsfresh': <utils.rc.dtos.project.Project at 0x7f77a03d9540>,
'Timetoevent': <utils.rc.dtos.project.Project at 0x7f77a03d83a0>,
'forwardfill': <utils.rc.dtos.project.Project at 0x7f77a03d9180>,
'project1test': <utils.rc.dtos.project.Project at 0x7f779acb7b20>,
'newproject1': <utils.rc.dtos.project.Project at 0x7f779acb7c10>,
'test': <utils.rc.dtos.project.Project at 0x7f779acb7d30>,
'newtimeseries': <utils.rc.dtos.project.Project at 0x7f779acb7ca0>,
'Employee': <utils.rc.dtos.project.Project at 0x7f779acb7cd0>,
'Employeepromotion': <utils.rc.dtos.project.Project at 0x7f779acb7be0>
}
Fetching all datasets in a project
Use this code block to get all the datasets in a project.
project.getAllDatasets()
Example response:
{
'view_Recipe': <utils.rc.dtos.dataset.Dataset at 0x7f779ab0d3f0>,
'output_duplicate ': <utils.rc.dtos.dataset.Dataset at 0x7f779ab308b0>,
'dataset_new1': <utils.rc.dtos.dataset.Dataset at 0x7f779ab31db0>,
'output_duplicates': <utils.rc.dtos.dataset.Dataset at 0x7f779ab31a20>,
'raw_w_drop_bad_cols': <utils.rc.dtos.dataset.Dataset at 0x7f779ab32d40>
}
Fetching all scenarios in a project
Use this code block to fetch all scenarios in a project.
Use this code block to add a dataset to a project.
employee = project.addDataset(
dataset_name='employee',
dataset_description='Employee Promotion Dataset',
dataset_file_path='Car_Price.csv' # path as per your folder structure in Jupyter
)
Example response:
INFO:Creating new dataset by name:employee1
INFO:Uploading file Car_Price.csv ....
INFO:Uploading Done
Parameters
The following table describes each parameter you must pass in the code block to add a dataset to a project.
Parameter name
Parameter description
Data type
Required
Example
dataset_name
The name of the dataset.
String
Yes
employee
dataset_description
The description for the dataset.
String
No
Employee Promotion Dataset
dataset_file_path
The path of the file. This should be as per the folder structure in Jupyter.
String
Yes
Car_Price.csv
Deleting a dataset in a project
Use this code block to delete a dataset from the project.
Use this code block to fetch all input and output datasets in a project.
project.getAllDatasets()
Example response:
{
'view_Recipe': <utils.rc.dtos.dataset.Dataset at 0x7fe7a55c2b00>,
'employee1': <utils.rc.dtos.dataset.Dataset at 0x7fe7a55c1c00>,
'output_duplicate ': <utils.rc.dtos.dataset.Dataset at 0x7fe7a55c3490>,
'dataset_new1': <utils.rc.dtos.dataset.Dataset at 0x7fe7a55c0e80>,
'output_duplicates': <utils.rc.dtos.dataset.Dataset at 0x7fe7a55c3b80>,
'raw_w_drop_bad_cols': <utils.rc.dtos.dataset.Dataset at 0x7fe7a55c1c30>,
'employee': <utils.rc.dtos.dataset.Dataset at 0x7fe7e85dc4c0>
}