gtfs_df 0.10.2 โ 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/gtfs_df/base_gtfs_table.rb +1 -1
- data/lib/gtfs_df/feed.rb +16 -13
- data/lib/gtfs_df/utils.rb +6 -6
- data/lib/gtfs_df/version.rb +1 -1
- metadata +3 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 70a7d05d5600baac0b36b21d0ebdd8fd0719cfe572844e44ae710c25fbf353f8
|
|
4
|
+
data.tar.gz: df2b5f47cd19bfe213644dcda42b22778acf98d8f104bf71c4e231eaa4860bba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee94819792b5c1389783a7844ce23af40de13264c5c069e608ae9c2383254c3fdcdc09915f5c33348d204675e5e373f8c26b039ff97144be37721aa7f4bc1b49
|
|
7
|
+
data.tar.gz: 28f28bb69a62738c817dafbc36c756a96f56f9f96d4d587aab2b9dffa8df5b6948b25d6b024e70856639cc2a97c75c49ff510bb7695c825f54405bf23701582d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [0.11.1] - 2026-04-28
|
|
2
|
+
|
|
3
|
+
### ๐ Bug Fixes
|
|
4
|
+
|
|
5
|
+
- Account for unreferenced calendar entries
|
|
6
|
+
|
|
7
|
+
### ๐งช Testing
|
|
8
|
+
|
|
9
|
+
- Validate filtering from feed with empty calendar
|
|
10
|
+
- Validate unreferenced calendar dates
|
|
11
|
+
## [0.11.0] - 2026-03-30
|
|
12
|
+
|
|
13
|
+
### โ๏ธ Miscellaneous Tasks
|
|
14
|
+
|
|
15
|
+
- [**breaking**] Update ruby-polars dependency
|
|
16
|
+
- Bump version to 0.11.0
|
|
1
17
|
## [0.10.2] - 2026-03-20
|
|
2
18
|
|
|
3
19
|
### ๐ Bug Fixes
|
|
@@ -7,6 +23,7 @@
|
|
|
7
23
|
### โ๏ธ Miscellaneous Tasks
|
|
8
24
|
|
|
9
25
|
- Raise clear message for multi-feed inputs
|
|
26
|
+
- Bump version to 0.10.2
|
|
10
27
|
## [0.10.1] - 2026-03-18
|
|
11
28
|
|
|
12
29
|
### ๐ Bug Fixes
|
|
@@ -22,7 +22,7 @@ module GtfsDf
|
|
|
22
22
|
dtypes = self.class::SCHEMA.slice(*df.columns)
|
|
23
23
|
df
|
|
24
24
|
.with_columns(dtypes.keys.map do |col|
|
|
25
|
-
stripped = Polars.col(col).str.
|
|
25
|
+
stripped = Polars.col(col).str.strip_chars
|
|
26
26
|
Polars.when(stripped.str.len_chars.gt(0))
|
|
27
27
|
.then(stripped)
|
|
28
28
|
.otherwise(Polars.lit(nil))
|
data/lib/gtfs_df/feed.rb
CHANGED
|
@@ -128,12 +128,12 @@ module GtfsDf
|
|
|
128
128
|
trip_ids = if trip_ids.empty?
|
|
129
129
|
new_filtered["trips"]["trip_id"]
|
|
130
130
|
else
|
|
131
|
-
trip_ids.filter(trip_ids.is_in(new_filtered["trips"]["trip_id"]))
|
|
131
|
+
trip_ids.filter(trip_ids.is_in(new_filtered["trips"]["trip_id"].implode))
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
if trip_ids
|
|
136
|
-
filtered = filter!("trips", {"trip_id" => trip_ids
|
|
136
|
+
filtered = filter!("trips", {"trip_id" => trip_ids}, filtered.dup)
|
|
137
137
|
end
|
|
138
138
|
end
|
|
139
139
|
|
|
@@ -330,7 +330,7 @@ module GtfsDf
|
|
|
330
330
|
|
|
331
331
|
# Get the week with max trips
|
|
332
332
|
# Sort by total_trips descending, then date ascending to pick the earliest date in case of a tie
|
|
333
|
-
sorted_weeks = weekly_agg.sort(["total_trips", "week_start"],
|
|
333
|
+
sorted_weeks = weekly_agg.sort(["total_trips", "week_start"], descending: [true, false])
|
|
334
334
|
best_week = sorted_weeks.head(1)
|
|
335
335
|
|
|
336
336
|
return nil if best_week.height == 0
|
|
@@ -346,7 +346,9 @@ module GtfsDf
|
|
|
346
346
|
df = filtered[file]
|
|
347
347
|
|
|
348
348
|
filters.each do |col, val|
|
|
349
|
-
df = if val.is_a?(Polars::Series)
|
|
349
|
+
df = if val.is_a?(Polars::Series)
|
|
350
|
+
df.filter(Polars.col(col).is_in(val.implode))
|
|
351
|
+
elsif val.is_a?(Array)
|
|
350
352
|
df.filter(Polars.col(col).is_in(val))
|
|
351
353
|
elsif val.respond_to?(:call)
|
|
352
354
|
df.filter(val.call(Polars.col(col)))
|
|
@@ -430,21 +432,22 @@ module GtfsDf
|
|
|
430
432
|
# union semantics across those two parents (a trip is valid if it appears in
|
|
431
433
|
# either).
|
|
432
434
|
#
|
|
433
|
-
#
|
|
434
|
-
#
|
|
435
|
+
# Accumulate service_ids from each calendar source, then apply the filter.
|
|
436
|
+
# If the filter results in 0 trips, we continue accumulating to allow the next
|
|
437
|
+
# calendar edge to add valid service_ids. This handles feeds where
|
|
438
|
+
# calendar.txt has unreferenced service_ids but all trips use
|
|
439
|
+
# calendar_dates.txt service_ids.
|
|
435
440
|
accumulated_service_ids = Polars.concat([accumulated_service_ids, valid_values]).unique
|
|
436
|
-
|
|
437
|
-
# Determine the base pool of trips:
|
|
438
|
-
# - If we've already restricted trips via structural parents (routes,
|
|
439
|
-
# stop_times, shapes, etc), use that as the base.
|
|
440
|
-
# - Otherwise, like when filtering directly on trips, use the current
|
|
441
|
-
# trips dataframe.
|
|
442
441
|
trips_base_df ||= filtered[child_node.fetch(:file)]
|
|
443
442
|
next unless trips_base_df && trips_base_df.height > 0
|
|
444
443
|
|
|
445
|
-
|
|
444
|
+
filtered_trips = trips_base_df.filter(
|
|
446
445
|
Polars.col("service_id").is_in(accumulated_service_ids.implode)
|
|
447
446
|
)
|
|
447
|
+
|
|
448
|
+
if filtered_trips.height > 0
|
|
449
|
+
filtered[child_node.fetch(:file)] = filtered_trips
|
|
450
|
+
end
|
|
448
451
|
else
|
|
449
452
|
# Original single-edge logic for all other nodes
|
|
450
453
|
before = child_df.height
|
data/lib/gtfs_df/utils.rb
CHANGED
|
@@ -17,9 +17,9 @@ module GtfsDf
|
|
|
17
17
|
def as_seconds_since_midnight(col_name)
|
|
18
18
|
parts = Polars.col(col_name).str.split(":")
|
|
19
19
|
|
|
20
|
-
hours = parts.list.get(0).cast(
|
|
21
|
-
minutes = parts.list.get(1).cast(
|
|
22
|
-
seconds = parts.list.get(2).cast(
|
|
20
|
+
hours = parts.list.get(0).cast(Polars::Int64)
|
|
21
|
+
minutes = parts.list.get(1).cast(Polars::Int64)
|
|
22
|
+
seconds = parts.list.get(2).cast(Polars::Int64)
|
|
23
23
|
|
|
24
24
|
(hours * SECONDS_IN_HOUR) +
|
|
25
25
|
(minutes * SECONDS_IN_MINUTE) +
|
|
@@ -42,9 +42,9 @@ module GtfsDf
|
|
|
42
42
|
|
|
43
43
|
Polars.format(
|
|
44
44
|
"{}:{}:{}",
|
|
45
|
-
hours.cast(
|
|
46
|
-
minutes.cast(
|
|
47
|
-
seconds.cast(
|
|
45
|
+
hours.cast(Polars::String).str.zfill(2),
|
|
46
|
+
minutes.cast(Polars::String).str.zfill(2),
|
|
47
|
+
seconds.cast(Polars::String).str.zfill(2)
|
|
48
48
|
)
|
|
49
49
|
end
|
|
50
50
|
|
data/lib/gtfs_df/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gtfs_df
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Mejorado
|
|
@@ -30,20 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0.
|
|
34
|
-
- - "<"
|
|
35
|
-
- !ruby/object:Gem::Version
|
|
36
|
-
version: '0.24'
|
|
33
|
+
version: '0.25'
|
|
37
34
|
type: :runtime
|
|
38
35
|
prerelease: false
|
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
37
|
requirements:
|
|
41
38
|
- - "~>"
|
|
42
39
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '0.
|
|
44
|
-
- - "<"
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0.24'
|
|
40
|
+
version: '0.25'
|
|
47
41
|
- !ruby/object:Gem::Dependency
|
|
48
42
|
name: rubyzip
|
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|