Workgroups and Projects
The first step of using the iGrafx P360 Live Mining SDK will be to create a workgroup, using the credentials you copied from Process Explorer 360:
w_id = "<Your Workgroup ID>"
w_key = "<Your Workgroup KEY>"
api_url = "<Your Mining Platform API URL>"
auth_url = "<Your Mining Platform Auth URL>"
wg = igx.Workgroup(w_id, w_key, api_url, auth_url)
Once the workgroup is created, you can access the list of
projects associated
with the workgroup through the get_project_list()
method:
project_list = wg.get_project_list()
The list of project IDs associated with the workgroup can be accessed with:
project_id_list = [p.id for p in project_list]
A specific project ID can be accessed from the list by specifying its index:
project_id_list[0]
The project ID can also be found in the URL:
https://<Mining Platform URL>>/workgroups/<Workgroup ID>/projects/<Project ID>/data
On top of that, if you already know the ID of the project you want to work with you can use:
my_project = wg.project_from_id("<Your Project ID>")
Once you have the project you want to use, several actions can be taken.
You can check if the project exists
and get its name
:
my_project.exists
my_project.get_project_name()
Furthermore, the mapping infos
of the project can be retrieved:
my_project.get_mapping_infos()
The project can also be deleted
:
my_project.delete_project()
Its variants
and completed cases
can also be retrieved:
my_project.get_project_variants(<Page Index>, <Limit>, "<Search>" )
my_project.get_project_completed_cases(<Page Index>, <Limit>, "<Search Case ID>")
Where Page Index
is the page index for pagination, Limit
is the maximum number of items to return per page,
Search
is the search query to filter variants by name (optional) and Search Case ID
is the search
query to filter cases by ID (also optional).
Moreover, you can reset
the project if needed:
my_project.reset
Alternatively, if you wish to create your own project, you can do so as follows:
w = Workgroup(w_id, w_key, api_url, auth_url)
project_name = "<Your Project name>"
project_description = "<Your Project description>"
created_project = w.create_project(project_name, project_description)
Note that the description is optional. If not needed, you can do the following:
created_project = w.create_project(project_name)