Schedule Builtins
All schedule builtins operate on Polars DataFrames in ctx.datasets["filename.txt"].
MatchCondition
Used by RemoveRows, UpdateFields, and ClearField to select which rows to operate on.
from continuous_gtfs.builtins.schedule import MatchCondition
# Exact match
MatchCondition("route_id", value="100479")
# Regex match
MatchCondition("service_id", regex=r"^LLR.*")
Multiple conditions are combined with AND logic — all must match for a row to be selected.
RemoveRows
Delete rows matching conditions from a GTFS file.
from continuous_gtfs.builtins.schedule import RemoveRows, MatchCondition
remove_route = RemoveRows(
"routes.txt", # which file
[MatchCondition("route_id", value="OLD_ROUTE")], # match conditions (AND)
description="Remove deprecated route", # optional
)
With exclude
Protect specific rows from removal:
# Remove all LLR services, EXCEPT the Spring 2026 one
remove_llr = RemoveRows(
"calendar.txt",
[MatchCondition("service_id", regex=r"^LLR.*")],
exclude=[
[MatchCondition("service_id", value="LLR_SP26")],
],
)
Each entry in exclude is a list of conditions (AND within each, OR across entries).
Edge cases
- If the file doesn't exist in
ctx.datasets, the step is a no-op. - If a condition references a column that doesn't exist, the step is a no-op.
UpdateFields
Modify field values on rows matching conditions.
from continuous_gtfs.builtins.schedule import UpdateFields, MatchCondition
update_2line = UpdateFields(
"routes.txt",
[MatchCondition("route_id", value="2LINE")],
{
"route_long_name": "South Bellevue - Downtown Redmond",
"route_color": "007CAD",
"route_text_color": "FFFFFF",
},
description="Update 2 Line route metadata",
)
Only columns that already exist in the DataFrame are updated. Unknown column names in the updates dict are silently ignored.
ClearField
Set a field to empty string on matching rows. Convenience wrapper around UpdateFields for the common case.
from continuous_gtfs.builtins.schedule import ClearField, MatchCondition
clear_blocks = ClearField(
"trips.txt",
"block_id",
[MatchCondition("route_id", value="SNDR_TL")],
description="Clear block_id for Sounder Tacoma-Lakewood",
)
UpdateFeedInfo
Update feed_info.txt metadata fields. Applies to all rows (no conditions needed).
from continuous_gtfs.builtins.schedule import UpdateFeedInfo
update_feed = UpdateFeedInfo(
publisher_name="Sound Transit",
publisher_url="https://soundtransit.org",
feed_lang="en",
)
All parameters are optional — only specified fields are updated.
Common parameters
All schedule builtins accept these keyword arguments:
| Parameter | Type | Default | Description |
|---|---|---|---|
after |
list[Step] |
[] |
Steps that must run before this one |
before |
list[Step] |
[] |
Steps that must run after this one |
priority |
int |
100 |
Tiebreak for steps at the same DAG level (lower = earlier) |
enabled |
bool |
True |
Set to False to skip this step |
tags |
list[str] |
[] |
Arbitrary labels for categorization |
data_owner |
str |
None |
Email of responsible staff member |
description |
str |
auto-generated | Human-readable label for DAG display |