Skip to content

ProjectOperations

Access via client.projects.

crucible.resources.projects.ProjectOperations

Project-related API operations.

Access via: client.projects.get(), client.projects.list(), etc.

get(project_id, include_metadata=False)

Get details of a specific project.

The response includes a lead key with the project lead's full user record (orcid, first_name, last_name, email, lbl_email).

Parameters:

Name Type Description Default
project_id str

Unique project identifier

required
include_metadata bool

Whether to include scientific metadata

False

Returns:

Name Type Description
Dict Dict

Complete project information including embedded lead user

list(orcid=None, include_metadata=False, limit=DEFAULT_LIMIT, offset=0)

List all accessible projects.

Each project dict includes a lead key with the project lead's full user record (orcid, first_name, last_name, email, lbl_email).

Parameters:

Name Type Description Default
orcid str

Filter projects by those associated with a certain user

None
include_metadata bool

Include scientific metadata in results

False
limit int

Maximum number of results to return (default: 100)

DEFAULT_LIMIT
offset int

Starting position in the full result set (default: 0)

0

Returns:

Type Description
List[Dict]

List[Dict]: Project metadata including project_id, title, organization, lead

create(project, scientific_metadata=None)

Create a new project.

Requires admin permissions.

Parameters:

Name Type Description Default
project Union[Project, Dict]

A Project model instance or a dict with project_id, organization, and project_lead_email.

required
scientific_metadata Dict

Scientific metadata to attach after creation.

None

Returns:

Name Type Description
Dict Dict

Created project object

Example

from crucible.models import Project project = Project( ... project_id="my-project", ... organization="Molecular Foundry", ... project_lead_email="lead@lbl.gov" ... ) result = client.projects.create(project)

update(project_id, **kwargs)

Partially update a project record.

Requires admin permissions.

Parameters:

Name Type Description Default
project_id str

Unique project identifier

required
**kwargs

Fields to update. Accepted: organization, status, title, project_lead_email, project_lead_orcid.

{}

Returns:

Name Type Description
Dict Dict

Updated project object

get_users(project_id, limit=DEFAULT_LIMIT, offset=0)

Get users associated with a project.

Requires admin permissions.

Parameters:

Name Type Description Default
project_id str

Unique project identifier

required
limit int

Maximum number of results to return (default: 100)

DEFAULT_LIMIT
offset int

Starting position in the full result set (default: 0)

0

Returns:

Type Description
List[Dict]

List[Dict]: Project team members (excludes project lead)

add_user(orcid=None, project_id=None, email=None)

Add a user to a project.

Requires admin permissions.

Provide either orcid or email to identify the user. When email is given, the ORCID is resolved automatically.

Parameters:

Name Type Description Default
orcid str

User's ORCID identifier

None
project_id str

Unique project identifier

None
email str

User's email address (alternative to orcid)

None

Returns:

Type Description
List[Dict]

List[Dict]: Updated list of project users

remove_user(project_id, orcid=None, email=None)

Remove a user from a project.

Requires admin permissions.

Provide either orcid or email to identify the user. When email is given, the ORCID is resolved automatically.

Parameters:

Name Type Description Default
project_id str

Unique project identifier

required
orcid str

User's ORCID identifier

None
email str

User's email address (alternative to orcid)

None

Returns:

Name Type Description
Dict Dict

Response message