Quick start
This example reads laboratory observations, removes rows without an OD600 measurement, summarizes the remaining values by sample, and publishes a new Arrow table.
1. Declare the block ports
Create a Python processing block with these ports:
| Direction | Name | Type |
|---|---|---|
| Input | rows |
Arrow table |
| Output | summary |
Arrow table |
Port names are part of the block's contract. Use letters, numbers, and underscores; do not use spaces or hyphens.
2. Add the processing script
import pyarrow.compute as pc
import flasktrack as ft
rows = ft.input_table("rows")
required = {"sample_id", "od600"}
missing = required.difference(rows.column_names)
if missing:
raise ValueError(f"Missing required columns: {sorted(missing)}")
clean = rows.filter(pc.is_valid(rows["od600"]))
summary = clean.group_by("sample_id").aggregate(
[
("od600", "mean"),
("od600", "stddev"),
("od600", "count"),
]
)
ft.output_table("summary", summary)
ft.log(f"Published {summary.num_rows} sample summaries")
3. Connect the block
Connect an Arrow table output from a source or earlier processing block to
rows. Connect summary to a compatible downstream block or output.
The connection type must match at both ends. An Arrow table cannot be connected directly to a JSON or file port.
4. Test with representative data
Before publishing the pipeline version, test with data that includes:
- several sample identifiers;
- at least one missing OD600 value;
- repeated observations for a sample; and
- the same column names and types expected in production.
Confirm that the output row count, column names, calculated values, and missing value behavior are correct.
5. Review before publishing
Check that the script:
- reads every declared input;
- publishes every declared output;
- uses literal port names exactly as declared;
- does not assume columns that are absent from the input schema; and
- raises a useful error instead of publishing misleading empty output.
For different dataframe libraries, see Tables and dataframes.