Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
04693b1
鉄道GTFSインテグレーション設計書を追加
claude Jan 9, 2026
e76f4de
複数GTFSソース対応と鉄道GTFS統合機能を実装
claude Jan 9, 2026
be5bd57
cargo fmtによるフォーマット修正
claude Jan 9, 2026
a04261b
未使用のimport_gtfs_routes関数を削除
claude Jan 9, 2026
68673ca
DockerfileのPORT環境変数のハードコードを削除
claude Jan 9, 2026
42275e8
Dockerfileを元に戻す
claude Jan 9, 2026
6f6b2e9
import_gtfs_tripsのroute_idにsource_idプレフィックスを追加
claude Jan 9, 2026
07db203
設計書を停車パターン差分検知システムに更新
claude Jan 10, 2026
48ab15b
停車パターン差分検知システムを実装
claude Jan 10, 2026
605f00c
.envサンプル更新
TinyKitten Jan 10, 2026
a914935
ビルドエラーとclippy fix
TinyKitten Jan 10, 2026
e7e45db
エラー修正
TinyKitten Jan 10, 2026
c5993d9
バグ修正とGitHub Action追加
TinyKitten Jan 11, 2026
cbfd09d
cargo fmt
TinyKitten Jan 11, 2026
67efdb2
Merge branch 'dev' into claude/railway-schedule-updates-DJBVg
TinyKitten Jan 11, 2026
840ac27
脆弱性修正
TinyKitten Jan 11, 2026
65725d0
追加の脆弱性修正
TinyKitten Jan 11, 2026
b41988d
追加の脆弱性修正
TinyKitten Jan 11, 2026
943216a
不要な変更戻し
TinyKitten Jan 11, 2026
e153aa5
追加の脆弱性修正
TinyKitten Jan 11, 2026
fbe8c84
バグ修正
TinyKitten Jan 11, 2026
fcff565
レビュー対応
TinyKitten Jan 11, 2026
b1e50a9
cargo fmt
TinyKitten Jan 11, 2026
e7b1fb8
レビュー対応
TinyKitten Jan 11, 2026
42f3774
エラー処理の改善
TinyKitten Jan 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
DATABASE_URL=postgresql://stationapi:stationapi@localhost/stationapi
DISABLE_BUS_FEATURE=false
DISABLE_GRPC_WEB=false
ODPT_API_KEY=
ENABLE_RAIL_GTFS=true
70 changes: 67 additions & 3 deletions data/create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ ALTER TABLE public.gtfs_agencies OWNER TO stationapi;

--
-- Name: gtfs_routes; Type: TABLE; Schema: public
-- GTFS route information (bus lines)
-- GTFS route information (bus lines and rail lines from GTFS sources)
--

CREATE UNLOGGED TABLE public.gtfs_routes (
Expand All @@ -656,18 +656,23 @@ CREATE UNLOGGED TABLE public.gtfs_routes (
route_long_name_zh TEXT,
route_long_name_ko TEXT,
route_desc TEXT,
route_type INTEGER NOT NULL DEFAULT 3, -- 3 = Bus
route_type INTEGER NOT NULL DEFAULT 3, -- 3 = Bus, 1 = Subway, 2 = Rail
route_url TEXT,
route_color VARCHAR(6),
route_text_color VARCHAR(6),
route_sort_order INTEGER,
line_cd INTEGER REFERENCES public.lines(line_cd)
line_cd INTEGER REFERENCES public.lines(line_cd),
transport_type INTEGER DEFAULT 1, -- 1: Bus, 2: Rail (GTFS)
company_cd INTEGER REFERENCES public.companies(company_cd),
source_id VARCHAR(50) -- GTFS source identifier (e.g., "toei_bus", "tokyo_metro")
);

ALTER TABLE public.gtfs_routes OWNER TO stationapi;

CREATE INDEX idx_gtfs_routes_agency_id ON public.gtfs_routes USING btree (agency_id);
CREATE INDEX idx_gtfs_routes_line_cd ON public.gtfs_routes USING btree (line_cd);
CREATE INDEX idx_gtfs_routes_transport_type ON public.gtfs_routes USING btree (transport_type);
CREATE INDEX idx_gtfs_routes_source_id ON public.gtfs_routes USING btree (source_id);

--
-- Name: gtfs_stops; Type: TABLE; Schema: public
Expand Down Expand Up @@ -856,3 +861,62 @@ ALTER TABLE public.gtfs_feed_info OWNER TO stationapi;
-- ============================================================
-- End of GTFS Bus Integration Schema
-- ============================================================

-- ============================================================
-- Stop Pattern Detection Schema
-- For detecting train type stop pattern changes from ODPT API
-- ============================================================

--
-- Name: stop_pattern_snapshots; Type: TABLE; Schema: public
-- Snapshots of stop patterns extracted from ODPT TrainTimetable
--

CREATE TABLE public.stop_pattern_snapshots (
id SERIAL PRIMARY KEY,
operator_id VARCHAR(100) NOT NULL, -- odpt.Operator:TokyoMetro
railway_id VARCHAR(100) NOT NULL, -- odpt.Railway:TokyoMetro.Marunouchi
train_type_id VARCHAR(100) NOT NULL, -- odpt.TrainType:TokyoMetro.Local
train_type_name VARCHAR(100), -- 各停
station_ids TEXT[] NOT NULL, -- Array of station IDs
station_names TEXT[], -- Array of station names (for reference)
captured_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
captured_date DATE DEFAULT CURRENT_DATE,
UNIQUE(railway_id, train_type_id, captured_date)
);

ALTER TABLE public.stop_pattern_snapshots OWNER TO stationapi;

CREATE INDEX idx_stop_pattern_snapshots_railway ON public.stop_pattern_snapshots USING btree (railway_id, train_type_id);
CREATE INDEX idx_stop_pattern_snapshots_operator ON public.stop_pattern_snapshots USING btree (operator_id);
CREATE INDEX idx_stop_pattern_snapshots_captured ON public.stop_pattern_snapshots USING btree (captured_at DESC);

--
-- Name: stop_pattern_changes; Type: TABLE; Schema: public
-- Log of detected stop pattern changes
--

CREATE TABLE public.stop_pattern_changes (
id SERIAL PRIMARY KEY,
operator_id VARCHAR(100) NOT NULL,
railway_id VARCHAR(100) NOT NULL,
railway_name VARCHAR(100), -- 丸ノ内線
train_type_id VARCHAR(100) NOT NULL,
train_type_name VARCHAR(100), -- 各停
change_type VARCHAR(20) NOT NULL, -- 'added' or 'removed'
station_id VARCHAR(100) NOT NULL,
station_name VARCHAR(100),
detected_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
acknowledged BOOLEAN DEFAULT FALSE,
acknowledged_at TIMESTAMP
);

ALTER TABLE public.stop_pattern_changes OWNER TO stationapi;

CREATE INDEX idx_stop_pattern_changes_detected ON public.stop_pattern_changes USING btree (detected_at DESC);
CREATE INDEX idx_stop_pattern_changes_unack ON public.stop_pattern_changes (acknowledged) WHERE acknowledged = FALSE;
CREATE INDEX idx_stop_pattern_changes_railway ON public.stop_pattern_changes USING btree (railway_id, train_type_id);

-- ============================================================
-- End of Stop Pattern Detection Schema
-- ============================================================
Loading