Create Projects

To create a Project using the SDK:
  1. Create a Workflow template in the Encord platform.
  2. Use the Workflow template ID, highlighted in the screenshot below, as a parameters to the create_project() method.
To use an existing template when creating a Project, users must have Admin privileges on the template. We recommend creating a copy of the Workflow template before Project creation, to ensure you have Admin privileges.
Projects cannot be deleted using the SDK or the API. Use the Encord platform to delete Projects.
# Import dependencies
from encord.user_client import EncordUserClient

#Authenticate using the path to your private key
user_client = EncordUserClient.create_with_ssh_private_key(
    ssh_private_key_path="<private_key_path>"
    )

# Create a project. Substitute a project title, and dataset hashes of the datasets you'd like to attach, as well as the has of the template you want to use
project = user_client.create_project(
    project_title="<project_title>",
    dataset_hashes=["<dataset_hash_1>", "<dataset_hash_2>"],
    workflow_template_hash="<template_hash>"
)

# Prints the hash of the project you've just created
print(project)

View Project Details

The following example shows how to retrieve a Project’s status. You can access other Project details in a similar way. For a complete list of available methods, refer to our SDK reference for the project class. In the following script replace <project_hash> with the unique ID of your Project.
The project ID can be found within the URL once a project has been selected:
app.encord.com/projects/view/<project_hash>/summary
app.us.encord.com/projects/view/<project_hash>/summary

# Import dependencies 
from encord import EncordUserClient

# Authenticate using the path to your private key
user_client = EncordUserClient.create_with_ssh_private_key(ssh_private_key_path="<private_key_path>")

# Get Project details using the "<project_hash>" as an identifier
project = user_client.get_project("<project_hash>")

# Get Project status
project_status = project.status

# Print Project status
print (project.status)

View Collaborator Session Information

This endpoint is deprecated and retrieves collaborator timers from the Legacy Performance Dashboards, not the Upgraded Analytics Dashboard.If you want to access the new Analytics Dashboards using the API or SDK contact your Encord team.
Use the list_collaborator_timers() method on a ‘project’ object to obtain session information for each collaborator that has worked on the project within a specified range of dates.

import datetime

from encord import EncordUserClient, Project

user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
    "<your_private_key>"
)
project: Project = user_client.get_project("<project_hash>")

for timer in project.list_collaborator_timers(
    after=datetime.datetime.now(datetime.timezone.utc)
    - datetime.timedelta(weeks=1)
):
    print(f"Collaborator session: {timer}")