Steps¶
Steps are the building blocks of Virtualitics apps. Each step represents a discrete unit of work in your workflow.
Step Lifecycle¶
- Initialization: Step is created with metadata (title, description, type)
- run(): Called when step first executes, returns initial Page
- action(): Called when user interacts with inputs (optional)
- Completion: Step completes and control moves to next step
Step Types¶
INPUT¶
Steps that collect user input (forms, file uploads, configuration).
load_step = LoadDataStep(
title="Load Data",
description="Upload or select data",
parent="Data",
type=StepType.INPUT,
page=Page(...)
)
DATA_LAB¶
Steps for data exploration and preparation.
RESULTS¶
Steps that display results and outputs.
DASHBOARD¶
Steps containing dashboards and visualizations.
Data Flow Between Steps¶
Steps pass data via Links:
# In Step 1 - store data
def run(self, flow_metadata):
dataset = Dataset(name="Data", data=df)
self._outLink.dataset = dataset
return Page(...)
# In Step 2 - retrieve data
def run(self, flow_metadata):
dataset = self._inLink.dataset
df = dataset.data
# Process df...
Progress Tracking¶
Update progress for long-running operations:
def run(self, flow_metadata):
total = len(items)
for i, item in enumerate(items):
self._progress = int((i / total) * 100)
self._message = f"Processing {i+1}/{total}"
process(item)
Error Handling¶
Handle errors gracefully:
def run(self, flow_metadata):
try:
result = risky_operation()
return success_page(result)
except Exception as e:
return error_page(f"Operation failed: {str(e)}")