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. Readable by any authenticated user.

The response always includes project_id, organization, status, title.

The lead field's shape depends on membership: members and admins get the full user record (includes email); non-members get a public record (unique_id, username, first_name, last_name — no email).

scientific_metadata is only ever populated for members/admins — include_metadata is silently ignored for non-members.

Parameters:

Name Type Description Default
project_id str

Unique project identifier

required
include_metadata bool

Whether to include scientific metadata (members/admins only)

False

Returns:

Name Type Description
Dict Dict

Project information, with membership-gated fields as described above

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, username=None)

Add a user to a project.

Requires admin permissions.

Provide one of orcid, email, or username to identify the user.

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

None
username str

User's username

None

Returns:

Type Description
List[Dict]

List[Dict]: Updated list of project users

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

Remove a user from a project.

Requires admin permissions.

Provide one of orcid, email, or username to identify the user.

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

None
username str

User's username

None

Returns:

Name Type Description
Dict Dict

Response message