Skip to content

Phases

Phase

Phase(
    id, project, name, index, status=PhaseStatus.NotStarted
)

Represent a Vectice phase.

Phases reflect the real-life phases of the project lifecycle (i.e., Business Understanding, Data Preparation, Modeling, Deployment, etc.). The Vectice admin creates the phases of a project.

Phases let you document the goals, assets, and outcomes along with the status to organize the project, enforce best practices, allow consistency, and capture knowledge.

Phases contain definitions of steps that are performed by data-scientists in order to complete iterations.

📁 phase 1
├── 📄 step definition 1
├── 📄 step definition 2
└── 📄 step definition 3

To get a project's phase:

my_phase = my_project.phase("Business Understanding")

Iterations can then be created for this phase, to complete the phase steps:

my_origin_dataset = ...
my_iteration = my_phase.iteration()
my_iteration.step_origin_dataset = my_origin_dataset

Phases and Steps Definitions are created in the Vectice App, Iterations are created from the Vectice Python API.

See the documentation of Iterations for more information about iterations.

Vectice users shouldn't need to instantiate Phases manually, but here are the phase parameters.

Parameters:

Name Type Description Default
id int

The phase identifier.

required
project Project

The project to which the phase belongs.

required
name str

The name of the phase.

required
index int

The index of the phase.

required
status PhaseStatus

The status of the phase.

PhaseStatus.NotStarted
Source code in src/vectice/models/phase.py
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
def __init__(
    self,
    id: int,
    project: Project,
    name: str,
    index: int,
    status: PhaseStatus = PhaseStatus.NotStarted,
):
    """Initialize a phase.

    Vectice users shouldn't need to instantiate Phases manually,
    but here are the phase parameters.

    Parameters:
        id: The phase identifier.
        project: The project to which the phase belongs.
        name: The name of the phase.
        index: The index of the phase.
        status: The status of the phase.
    """
    self._id = id
    self._project = project
    self._name = name
    self._index = index
    self._status = status
    self._client: Client = self._project._client
    self._current_iteration: Iteration | None = None

clean_dataset writable property

clean_dataset: None

Deprecated. Use steps' clean_dataset instead.

Raises:

Type Description
DeprecationError

Always.

connection property

connection: Connection

The connection to which this phase belongs.

Returns:

Type Description
Connection

The connection to which this phase belongs.

id writable property

id: int

The phase's id.

Returns:

Type Description
int

The phase's id.

index property

index: int

The phase's index.

Returns:

Type Description
int

The phase's index.

iterations property

iterations: list[Iteration]

The phase's iterations.

Returns:

Type Description
list[Iteration]

The phase's iterations.

name property

name: str

The phase's name.

Returns:

Type Description
str

The phase's name.

project property

project: Project

The project to which this phase belongs.

Returns:

Type Description
Project

The project to which this phase belongs.

properties property

properties: dict

The phase's name, id, and index.

Returns:

Type Description
dict

A dictionary containing the name, id, and index items.

status property

status: PhaseStatus

The phase's status.

Returns:

Type Description
PhaseStatus

The phase's status.

workspace property

workspace: Workspace

The workspace to which this phase belongs.

Returns:

Type Description
Workspace

The workspace to which this phase belongs.

iteration

iteration(index=None)

Get a (possibly new) iteration.

Fetch and return an iteration by index. If no index is provided, return a new iteration.

Parameters:

Name Type Description Default
index int | None

The id of an existing iteration.

None

Returns:

Type Description
Iteration

An iteration.

Source code in src/vectice/models/phase.py
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
def iteration(self, index: int | None = None) -> Iteration:
    """Get a (possibly new) iteration.

    Fetch and return an iteration by index. If no index is
    provided, return a new iteration.

    Parameters:
        index: The id of an existing iteration.

    Returns:
        An iteration.
    """
    if index:
        iteration_output = self._client.get_iteration_by_index(self.id, index)
    else:
        iteration_output = self._client.create_iteration(self.id)
        _logger.info(f"New Iteration number {iteration_output.index!r} created.")
    _logger.info(f"Iteration number {iteration_output.index!r} successfully retrieved.")
    iteration_object = Iteration(
        id=iteration_output.id,
        index=iteration_output.index,
        phase=self,
        status=iteration_output.status,
    )
    self._current_iteration = iteration_object
    return iteration_object

list_step_definitions

list_step_definitions()

Prints a list of step definitionss belonging to the phase in a tabular format, limited to the first 10 items. A link is provided to view the remaining step definitions.

Returns:

Type Description
None

None

Source code in src/vectice/models/phase.py
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
def list_step_definitions(self) -> None:
    """Prints a list of step definitionss belonging to the phase in a tabular format, limited to the first 10 items. A link is provided to view the remaining step definitions.

    Returns:
        None
    """
    steps_output = sorted(self._client.list_step_definitions(self.id), key=lambda x: x.index)
    user_name, _ = _get_last_user_and_default_workspace(self._client)

    rich_table = Table(expand=True, show_edge=False)

    rich_table.add_column("shortcut", justify="left", no_wrap=True, min_width=3, max_width=20)
    rich_table.add_column("name", justify="left", no_wrap=True, min_width=5, max_width=10)
    rich_table.add_column("description", justify="left", no_wrap=True, min_width=3, max_width=15)

    for count, step in enumerate(steps_output, 1):
        if count > 10:
            break
        rich_table.add_row(step.slug, step.name, format_description(step.description))
    description = f"""There are {len(steps_output)} steps required in the phase {self.name!r}."""
    link = dedent(
        f"""
    For quick access to the list of step definitions in the Vectice web app, visit:
    {self._client.auth._API_BASE_URL}/project/phase/steps?w={self.workspace.id}&pageId={self.id}"""
    ).lstrip()
    _temp_print(description)
    _temp_print(table=rich_table)
    _temp_print(link)