From 55df6bdb16500596b5db8074d740f1cf38a43849 Mon Sep 17 00:00:00 2001 From: Nicholas Orlowsky Date: Fri, 12 Sep 2025 19:34:35 -0400 Subject: [PATCH] just add data loader here --- data_loader | 1 - data_loader/.gitignore | 2 + data_loader/Cargo.lock | 2738 +++++++++++++++++++ data_loader/Cargo.toml | 19 + data_loader/src/fetchers/mod.rs | 12 + data_loader/src/fetchers/septa.rs | 246 ++ data_loader/src/main.rs | 74 + data_loader/src/septa/direction.rs | 84 + data_loader/src/septa/mod.rs | 7 + data_loader/src/septa/ridership.rs | 216 ++ data_loader/src/septa/route.rs | 122 + data_loader/src/septa/route_stop.rs | 78 + data_loader/src/septa/schedule_day.rs | 70 + data_loader/src/septa/stop.rs | 108 + data_loader/src/septa/stop_schedule.rs | 118 + data_loader/src/septa_json/direction.rs | 19 + data_loader/src/septa_json/mod.rs | 6 + data_loader/src/septa_json/ridership.rs | 37 + data_loader/src/septa_json/route.rs | 42 + data_loader/src/septa_json/route_stop.rs | 31 + data_loader/src/septa_json/schedule_day.rs | 18 + data_loader/src/septa_json/stop_schedule.rs | 27 + data_loader/src/traits.rs | 23 + 23 files changed, 4097 insertions(+), 1 deletion(-) delete mode 160000 data_loader create mode 100644 data_loader/.gitignore create mode 100644 data_loader/Cargo.lock create mode 100644 data_loader/Cargo.toml create mode 100644 data_loader/src/fetchers/mod.rs create mode 100644 data_loader/src/fetchers/septa.rs create mode 100644 data_loader/src/main.rs create mode 100644 data_loader/src/septa/direction.rs create mode 100644 data_loader/src/septa/mod.rs create mode 100644 data_loader/src/septa/ridership.rs create mode 100644 data_loader/src/septa/route.rs create mode 100644 data_loader/src/septa/route_stop.rs create mode 100644 data_loader/src/septa/schedule_day.rs create mode 100644 data_loader/src/septa/stop.rs create mode 100644 data_loader/src/septa/stop_schedule.rs create mode 100644 data_loader/src/septa_json/direction.rs create mode 100644 data_loader/src/septa_json/mod.rs create mode 100644 data_loader/src/septa_json/ridership.rs create mode 100644 data_loader/src/septa_json/route.rs create mode 100644 data_loader/src/septa_json/route_stop.rs create mode 100644 data_loader/src/septa_json/schedule_day.rs create mode 100644 data_loader/src/septa_json/stop_schedule.rs create mode 100644 data_loader/src/traits.rs diff --git a/data_loader b/data_loader deleted file mode 160000 index 87fe4e8..0000000 --- a/data_loader +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 87fe4e881329c0d45fa4adcc5b8cb09d17f018fb diff --git a/data_loader/.gitignore b/data_loader/.gitignore new file mode 100644 index 0000000..14ee500 --- /dev/null +++ b/data_loader/.gitignore @@ -0,0 +1,2 @@ +target/ +.env diff --git a/data_loader/Cargo.lock b/data_loader/Cargo.lock new file mode 100644 index 0000000..51ba98b --- /dev/null +++ b/data_loader/Cargo.lock @@ -0,0 +1,2738 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "anstream" +version = "0.6.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.59.0", +] + +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +dependencies = [ + "serde", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cc" +version = "1.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "data_loader" +version = "0.1.0" +dependencies = [ + "anyhow", + "dotenv", + "env_logger", + "libseptastic", + "log", + "reqwest", + "serde", + "serde-map-to-array", + "serde_json", + "serde_repr", + "sqlx", + "thiserror", + "tokio", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +dependencies = [ + "serde", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "env_filter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + +[[package]] +name = "event-listener" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "h2" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17da50a276f1e01e0ba6c029e47b7100754904ee8a278f886546e98575380785" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f66d5bd4c6f02bf0542fad85d626775bab9258cf795a4256dcaf3161114d1df" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jiff" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "libm" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9627da5196e5d8ed0b0495e61e518847578da83483c37288316d9b2e03a7f72" + +[[package]] +name = "libseptastic" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "sqlx", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" +dependencies = [ + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "litemap" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.52.0", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "openssl" +version = "0.10.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "redox_syscall" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f103c6d277498fbceb16e84d317e2a400f160f46904d5f5410848c829511a3" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reqwest" +version = "0.12.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rsa" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustls" +version = "0.23.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-map-to-array" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c14b52efc56c711e0dbae3f26e0cc233f5dac336c1bf0b07e1b7dc2dca3b2cc7" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlx" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" +dependencies = [ + "base64", + "bytes", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashbrown", + "hashlink", + "indexmap", + "log", + "memchr", + "once_cell", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", +] + +[[package]] +name = "sqlx-macros" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" +dependencies = [ + "atoi", + "base64", + "bitflags", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" +dependencies = [ + "atoi", + "base64", + "bitflags", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "serde_urlencoded", + "sqlx-core", + "thiserror", + "tracing", + "url", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.44.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "whoami" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6994d13118ab492c3c80c1f81928718159254c53c472bf9ce36f8dae4add02a7" +dependencies = [ + "redox_syscall", + "wasite", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-registry" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/data_loader/Cargo.toml b/data_loader/Cargo.toml new file mode 100644 index 0000000..00ecaa0 --- /dev/null +++ b/data_loader/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "data_loader" +version = "0.1.0" +edition = "2024" + +[dependencies] +anyhow = "1.0.98" +dotenv = "0.15.0" +serde = { version = "1.0.219", features = [ "derive" ] } +serde-map-to-array = "1.1.1" +serde_json = "1.0.140" +serde_repr = "0.1.20" +sqlx = { version = "0.8", features = [ "runtime-tokio", "postgres" ] } +thiserror = "2.0.12" +tokio = { version = "1.44.2", features = [ "full" ] } +libseptastic = { path = "../libseptastic/" } +env_logger = "0.11.8" +log = "0.4.27" +reqwest = { version = "0.12.22", features = [ "json", "blocking" ] } diff --git a/data_loader/src/fetchers/mod.rs b/data_loader/src/fetchers/mod.rs new file mode 100644 index 0000000..7edc9ae --- /dev/null +++ b/data_loader/src/fetchers/mod.rs @@ -0,0 +1,12 @@ +use libseptastic::{direction::Direction, route::Route, route_stop::RouteStop, schedule_day::ScheduleDay, stop::Stop, stop_schedule::StopSchedule}; + +pub mod septa; + +pub struct AuthorityInfo { + pub routes: Vec, + pub stops: Vec, + pub route_stops: Vec, + pub stop_schedules: Vec, + pub schedule_days: Vec, + pub directions: Vec +} diff --git a/data_loader/src/fetchers/septa.rs b/data_loader/src/fetchers/septa.rs new file mode 100644 index 0000000..7b7e2eb --- /dev/null +++ b/data_loader/src/fetchers/septa.rs @@ -0,0 +1,246 @@ +use dotenv::dotenv; +use libseptastic::stop::Stop; +use crate::septa::route_stop; +use crate::septa_json::direction::Direction; +use crate::septa_json::route::Route; +use crate::septa_json::route_stop::RouteStop; +use crate::septa_json::schedule_day::{Calendar, ScheduleDay}; +use crate::septa_json::stop_schedule::StopSchedule; +use sqlx::postgres::PgPoolOptions; +use std::collections::{HashMap, HashSet, VecDeque}; +use std::sync::{Arc, Mutex}; +use std::{fs, thread}; +use std::path::Path; +use std::time::SystemTime; +use env_logger::{Builder, Env}; +use log::{error, info, warn}; +use crate::traits::*; + +use super::AuthorityInfo; + +async fn convert_routes(json_data: Vec) -> ::anyhow::Result> { + let mut parsed_data: Vec = Vec::new(); + + for json_single in json_data { + parsed_data.push(*libseptastic::route::Route::from_septa_json(json_single)?); + } + + Ok(parsed_data) +} + +async fn convert_stops(json_data: Vec) -> ::anyhow::Result> { + let mut parsed_data: Vec = Vec::new(); + + for json_single in json_data { + parsed_data.push(*libseptastic::stop::Stop::from_septa_json(json_single)?); + } + + Ok(parsed_data) +} + +async fn convert_route_stops(json_data: Vec) -> ::anyhow::Result> { + let mut parsed_data: Vec = Vec::new(); + + for json_single in json_data { + parsed_data.push(*libseptastic::route_stop::RouteStop::from_septa_json(json_single)?); + } + + Ok(parsed_data) +} + +async fn convert_stop_schedules(json_data:Vec) -> ::anyhow::Result> { + let mut parsed_data: Vec = Vec::new(); + + for json_single in json_data { + parsed_data.push(*libseptastic::stop_schedule::StopSchedule::from_septa_json(json_single)?); + } + + Ok(parsed_data) +} + + +async fn convert_schedule_days(json_data: crate::septa_json::schedule_day::Calendar) -> ::anyhow::Result> { + let mut parsed_data: Vec = Vec::new(); + + parsed_data.append(&mut *Vec::::from_septa_json(json_data)?); + + Ok(parsed_data) +} + +async fn convert_directions(json_data: Vec) -> ::anyhow::Result> { + let mut parsed_data: Vec = Vec::new(); + + for json_single in json_data { + parsed_data.push(*libseptastic::direction::Direction::from_septa_json(json_single)?); + } + + Ok(parsed_data) +} + + +pub struct SeptaFetcher{ +} + +impl SeptaFetcher { + const HOST: &str = "https://flat-api.septa.org"; + + async fn fetch_version() -> ::anyhow::Result { + let unix_seconds = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)?.as_secs(); + let mut version = reqwest::get(format!("{}/version.txt?t={}", Self::HOST, unix_seconds)).await?.text().await?; + version = version.trim().to_string(); + Ok(version) + } + + async fn fetch_routes(version: &String) -> ::anyhow::Result> { + Ok(reqwest::get(format!("{}/routes.json?v={}", Self::HOST, version)).await?.json::>().await?) + } + + async fn fetch_route_stops(routes: &mut Vec, version: &String) -> ::anyhow::Result> { + let mut all_route_stops: Vec = Vec::new(); + + let mut i = 0; + while i < routes.len() { + let route = &routes[i]; + if let Ok(route_stops_json) = reqwest::get(format!("{}/stops/{}/stops.json?v={}", Self::HOST, route.route_id, version)).await { + if let Ok(mut route_stops) = route_stops_json.json::>().await { + all_route_stops.append(&mut route_stops); + i += 1; + continue; + } + } + + warn!("Encountered failure downloading route stops for Route {}, removing", route.route_id); + routes.swap_remove(i); + } + + if routes.len() == 0 { + error!("Unable to download SEPTA routes"); + return Err(anyhow::anyhow!("Unable to successfully download any SEPTA routes")); + } + + Ok(all_route_stops) + } + + async fn fetch_directions(version: &String) -> ::anyhow::Result> { + Ok(reqwest::get(format!("{}/directions.json?v={}", Self::HOST, version)).await?.json::>().await?) + } + + async fn fetch_calendar(version: &String) -> ::anyhow::Result { + Ok(reqwest::get(format!("{}/calendar.json?v={}", Self::HOST, version)).await?.json::().await?) + } + + + async fn fetch_schedules(stops: &Vec, version: &String) -> ::anyhow::Result> { + const NUM_THREADS: usize = 10; + + let mut threads = Vec::with_capacity(NUM_THREADS); + let mut stop_ids: HashSet = HashSet::new(); + let results = Arc::new(Mutex::new(Vec::new())); + let mut worker_queues: Vec> = Vec::with_capacity(NUM_THREADS); + + for _ in 0..NUM_THREADS { + worker_queues.push(VecDeque::new()); + } + + for stop in stops { + stop_ids.insert(stop.stop_id); + } + + let mut cur_thread_no = 0; + for stop_id in stop_ids { + worker_queues[cur_thread_no].push_back((stop_id, 0)); + cur_thread_no = (cur_thread_no + 1) % NUM_THREADS; + } + + + for thread_no in 0..NUM_THREADS { + let mut worker_queue = worker_queues[thread_no].clone(); + let local_result = results.clone(); + let local_version = version.clone(); + + threads.push(thread::spawn(move || { + let mut stop_schedules: Vec = Vec::new(); + + while let Some(stop_id) = worker_queue.pop_front() { + let uri = format!("{}/schedules/stop_schedule/{}.json?v={}", Self::HOST, stop_id.0, local_version); + + match (||{reqwest::blocking::get(uri)?.json::>()})() { + Ok(mut element) => (stop_schedules.append(&mut element)), + Err(_) => { + if stop_id.1 < 5 { + error!("Error downloading stop schedule for {} (try {}). Retrying.", stop_id.0, stop_id.1); + worker_queue.push_back((stop_id.0, stop_id.1 + 1)); + } else { + error!("Error downloading stop schedule for {} (try {}). Giving up.", stop_id.0, stop_id.1); + } + } + } + } + + if let Ok(mut res) = local_result.lock() { + res.append(&mut stop_schedules); + } + })); + } + + for thread in threads { + thread.join(); + } + + Ok(results.lock().unwrap().clone()) + } + + pub async fn fetch_septa_data() -> ::anyhow::Result { + let version = Self::fetch_version().await?; + info!("Got SEPTA schedule version {}", version); + + let mut routes = Self::fetch_routes(&version).await?; + info!("Discovered {} SEPTA routes", routes.len()); + + let route_stops = Self::fetch_route_stops(&mut routes, &version).await?; + info!("Stop data for {} stops on {} routes successfully downloaded", route_stops.len(), routes.len()); + + let directions = Self::fetch_directions(&version).await?; + info!("Directions data successfully downloaded for {} route directions", directions.len()); + + let calendar = Self::fetch_calendar(&version).await?; + info!("Calendar data successfully downloaded for {} days", calendar.len()); + + let schedule_stops = Self::fetch_schedules(&route_stops, &version).await?; + info!("Schedule data downloaded for {} scheduled stops", schedule_stops.len()); + + let mut stop_map: HashMap = HashMap::new(); + let mut stop_set: HashSet = HashSet::new(); + + for stop in route_stops.iter() { + stop_map.insert(stop.stop_name.clone(), stop.stop_id); + stop_set.insert(stop.stop_id); + } + + + let mut route_map: HashSet = HashSet::new(); + + for route in routes.iter() { + route_map.insert(route.route_id.clone()); + } + + let filtered_directions: Vec<_> = directions.iter() + .filter(|direction| { + let keep = route_map.contains(&direction.route); + if !keep { + warn!( + "Removing route '{}' from direction data (This data has old and new wayfinding values)", + direction.route + ); + } + keep + }) + .cloned() + .collect(); + + info!("Data is valid"); + + + Ok(AuthorityInfo { routes: convert_routes(routes).await?, stops: convert_stops(route_stops.clone()).await?, route_stops: convert_route_stops(route_stops).await?, stop_schedules: convert_stop_schedules(schedule_stops).await?, schedule_days: convert_schedule_days(calendar).await?, directions: convert_directions(filtered_directions).await? }) + } +} diff --git a/data_loader/src/main.rs b/data_loader/src/main.rs new file mode 100644 index 0000000..e51f72b --- /dev/null +++ b/data_loader/src/main.rs @@ -0,0 +1,74 @@ +use dotenv::dotenv; +use libseptastic::stop::Stop; +use septa::route_stop; +use septa_json::direction::Direction; +use septa_json::route::Route; +use septa_json::route_stop::RouteStop; +use septa_json::schedule_day::{Calendar, ScheduleDay}; +use septa_json::stop_schedule::StopSchedule; +use sqlx::postgres::PgPoolOptions; +use std::collections::{HashMap, HashSet}; +use std::sync::{Arc, Mutex}; +use std::{fs, thread}; +use std::path::Path; +use std::time::SystemTime; +use env_logger::{Builder, Env}; +use log::{error, info, warn}; + +pub mod traits; +use traits::*; + +pub mod septa_json; +pub mod septa; +pub mod fetchers; + + +#[tokio::main] +async fn main() -> ::anyhow::Result<()> { + dotenv().ok(); + + let env = Env::new().filter_or("RUST_LOG", "data_loader=info"); + Builder::from_env(env).init(); + let database_url = std::env::var("DATABASE_URL").expect("Database URL"); + let pool = PgPoolOptions::new() + .max_connections(5) + .connect(&database_url) + .await?; + + let septa_data = fetchers::septa::SeptaFetcher::fetch_septa_data().await?; + + let mut tx = pool.begin().await?; + + libseptastic::route::Route::create_table(&mut tx).await?; + libseptastic::direction::Direction::create_table(&mut tx).await?; + libseptastic::stop::Stop::create_table(&mut tx).await?; + libseptastic::route_stop::RouteStop::create_table(&mut tx).await?; + libseptastic::stop_schedule::StopSchedule::create_table(&mut tx).await?; + libseptastic::schedule_day::ScheduleDay::create_table(&mut tx).await?; + + + + info!("Inserting Route Data"); + libseptastic::route::Route::insert_many(septa_data.routes, &mut tx).await?; + + info!("Inserting Direction Data"); + libseptastic::direction::Direction::insert_many(septa_data.directions, &mut tx).await?; + + info!("Inserting Stop Data"); + libseptastic::stop::Stop::insert_many(septa_data.stops, &mut tx).await?; + + info!("Inserting Route-Stop Data"); + libseptastic::route_stop::RouteStop::insert_many(septa_data.route_stops, &mut tx).await?; + + info!("Inserting Stop Schedule Data"); + libseptastic::stop_schedule::StopSchedule::insert_many(septa_data.stop_schedules, &mut tx).await?; + + info!("Inserting Schedule Day Data"); + libseptastic::schedule_day::ScheduleDay::insert_many(septa_data.schedule_days, &mut tx).await?; + + + tx.commit().await?; + pool.close().await; + + Ok(()) +} diff --git a/data_loader/src/septa/direction.rs b/data_loader/src/septa/direction.rs new file mode 100644 index 0000000..d532362 --- /dev/null +++ b/data_loader/src/septa/direction.rs @@ -0,0 +1,84 @@ +use libseptastic::direction::{CardinalDirection, Direction}; +use sqlx::{Postgres, Transaction}; +use crate::traits::{DbObj, FromSeptaJson}; +use crate::septa_json; + + +impl DbObj for Direction { + async fn create_table(tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + sqlx::query(" + CREATE TABLE IF NOT EXISTS septa_directions ( + route_id TEXT NOT NULL, + direction_id BIGINT NOT NULL, + direction septa_direction_type NOT NULL, + direction_destination TEXT NOT NULL, + + FOREIGN KEY (route_id) REFERENCES septa_routes(id) ON DELETE CASCADE, + PRIMARY KEY (route_id, direction_id) + + ); + ") + .execute(&mut **tx) + .await?; + + Ok(()) + } + async fn insert_many(dirs: Vec, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + let mut route_ids: Vec = Vec::new(); + let mut direction_ids: Vec = Vec::new(); + let mut directions: Vec = Vec::new(); + let mut direction_destinations: Vec = Vec::new(); + + for dir in dirs { + route_ids.push(dir.route_id); + direction_ids.push(dir.direction_id); + directions.push(dir.direction); + direction_destinations.push(dir.direction_destination); + } + + sqlx::query(" + INSERT INTO septa_directions ( + route_id, + direction_id, + direction, + direction_destination + ) + SELECT * FROM UNNEST( + $1::text[], + $2::bigint[], + $3::septa_direction_type[], + $4::text[] + ); + ") + .bind(&route_ids[..]) + .bind(&direction_ids[..]) + .bind(&directions[..]) + .bind(&direction_destinations[..]) + .execute(&mut **tx) + .await?; + + Ok(()) + } + + async fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + Self::insert_many(vec![self.clone()], tx).await?; + Ok(()) + } +} + +impl FromSeptaJson for Direction { + fn from_septa_json(json_dir: septa_json::direction::Direction) -> ::anyhow::Result> { + Ok(Box::new(Direction { route_id: json_dir.route, direction_id: json_dir.direction.parse::()?, + direction: match json_dir.true_direction.as_str() { + "Eastbound" => Ok(libseptastic::direction::CardinalDirection::Eastbound), + "Westbound" => Ok(libseptastic::direction::CardinalDirection::Westbound), + "Outbound" => Ok(libseptastic::direction::CardinalDirection::Outbound), + "Inbound" => Ok(libseptastic::direction::CardinalDirection::Inbound), + "Southbound" => Ok(libseptastic::direction::CardinalDirection::Southbound), + "Northbound" => Ok(libseptastic::direction::CardinalDirection::Northbound), + "LOOP" => Ok(libseptastic::direction::CardinalDirection::Loop), + _ => Err(anyhow::anyhow!("Unable to find right direction")) + }? + , direction_destination: json_dir.direction_destination })) + } +} diff --git a/data_loader/src/septa/mod.rs b/data_loader/src/septa/mod.rs new file mode 100644 index 0000000..07ad21e --- /dev/null +++ b/data_loader/src/septa/mod.rs @@ -0,0 +1,7 @@ +pub mod route; +pub mod direction; +pub mod stop; +pub mod route_stop; +pub mod stop_schedule; +pub mod schedule_day; +pub mod ridership; diff --git a/data_loader/src/septa/ridership.rs b/data_loader/src/septa/ridership.rs new file mode 100644 index 0000000..4049608 --- /dev/null +++ b/data_loader/src/septa/ridership.rs @@ -0,0 +1,216 @@ +use std::collections::HashMap; + +use libseptastic::direction::CardinalDirection; +use libseptastic::ridership::Ridership; +use sqlx::{Postgres, Transaction}; +use crate::traits::{DbObj, FromSeptaJson, FromSeptaJsonAndStations}; +use crate::septa_json; + + +impl DbObj for Ridership { + async fn create_table(tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + sqlx::query(" + CREATE TABLE IF NOT EXISTS septa_ridership ( + route_id TEXT NOT NULL, + stop_id bigint NOT NULL, + direction septa_direction_type, + exp_ons bigint, + exp_offs bigint, + ons bigint, + offs bigint, + year bigint, + + PRIMARY KEY (route_id, stop_id, direction), + + FOREIGN KEY (route_id) REFERENCES septa_routes(id) ON DELETE CASCADE, + FOREIGN KEY (stop_id) REFERENCES septa_stops(id) ON DELETE CASCADE + ); + ") + .execute(&mut **tx) + .await?; + + Ok(()) + } + + async fn insert_many(dirs: Vec, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + let mut route_ids: Vec = Vec::new(); + let mut stop_ids: Vec = Vec::new(); + let mut directions: Vec = Vec::new(); + let mut exp_onss: Vec = Vec::new(); + let mut exp_offss: Vec = Vec::new(); + let mut onss: Vec = Vec::new(); + let mut offss: Vec = Vec::new(); + let mut years: Vec = Vec::new(); + + for dir in dirs { + route_ids.push(dir.route_id); + stop_ids.push(dir.stop_id); + directions.push(dir.direction); + exp_onss.push(dir.exp_ons); + exp_offss.push(dir.exp_offs); + onss.push(dir.ons); + offss.push(dir.offs); + years.push(dir.year); + } + + sqlx::query(" + INSERT INTO + septa_ridership + ( + route_id, + stop_id, + direction, + exp_ons, + exp_offs, + ons, + offs, + year + ) + SELECT * FROM UNNEST( + $1::text[], + $2::bigint[], + $3::septa_direction_type[], + $4::bigint[], + $5::bigint[], + $6::bigint[], + $7::bigint[], + $8::bigint[] + ) + ON CONFLICT DO NOTHING + ; + ") + .bind(&route_ids[..]) + .bind(&stop_ids[..]) + .bind(&directions[..]) + .bind(&exp_onss[..]) + .bind(&exp_offss[..]) + .bind(&onss[..]) + .bind(&offss[..]) + .bind(&years[..]) + .execute(&mut **tx) + .await?; + + Ok(()) + } + + async fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + Self::insert_many(vec![self.clone()], tx).await?; + Ok(()) + } +} + +impl FromSeptaJsonAndStations for Ridership { + fn from_septa_json(json_rider: septa_json::ridership::Ridership, stop_map: &HashMap) -> ::anyhow::Result> { + Ok(Box::new(Ridership { + route_id: match json_rider.route_id.as_str() { + // SEPTA Metro + "MFL" => "L1", + "BSL" => "B1", + "MFO" => "L1 OWL", + "BSO" => "B1 OWL", + "J" => "41", + "L" => "51", + "G" => "63", + "H" => "71", + "XH" => "81", + "R" => "82", + "101" => "D1", + "102" => "D2", + "15" => "G1", + "NHSL" => "M1", + "10" => "T1", + "34" => "T2", + "13" => "T3", + "11" => "T4", + "36" => "T5", + // Regional Rail Remap + "Airport" => "AIR", + "Chestnut Hill West" => "CHW", + "Chestnut Hill East" => "CHE", + "Cynwyd" => "CYN", + "Fox Chase" => "FOX", + "Lansdale/Doylestown" => "LAN", + "Media/Wawa" => "MED", + "Manyunk/Norristown" => "NOR", + "Paoli/Thorndale" => "PAO", + "Trenton" => "TRE", + "Warminster" => "WAR", + "Wilmington/Newark" => "WIL", + "West Trenton" => "WTR", + any => any + }.to_string(), + stop_id: { + if json_rider.stop_code != "" { + Ok(json_rider.stop_code.parse::()?) + } else { + if let Some(sid) = stop_map.get(&(match json_rider.stop_name.as_str() { + "Churchmans Crossing" => "Churchman's Crossing", + "Prospect Park" => "Prospect Park - Moore", + "Highland Ave." => "Highland Avenue", + "Chester TC" => "Chester Transit Center", + "University City" => "Penn Medicine Station", + "Wynnefield" => "Wynnefield Avenue", + "Temple" => "Temple University", + "Fern Rock" => "Fern Rock T C", + "Jenkintown" => "Jenkintown Wyncote", + "Cornwells Height" => "Cornwells Heights", + "Levittown" => "Levittown Station", + "9th Street" => "9th Street Lansdale", + "Del Val College" => "Delaware Valley College", + "Sedwick" => "Sedgwick", + "Allen Lane" => "Richard Allen Lane", + "Elm Street" => "Norristown - Elm Street", + "Norristown" => "Norristown Transit Center", + "Neshaminy Falls" => "Neshaminy", + "Moylan Rose Valley" => "Moylan-Rose Valley", + "Morton" => "Morton-Rutledge", + "Easwick" => "Eastwick", + "30th Street Station" => "Gray 30th Street", + "Holmesburg Jct" => "Holmesburg Junction", + any => any + }.to_string())) { + Ok(sid.clone()) + } else { + Err(::anyhow::anyhow!("Station {} not found", json_rider.stop_name)) + } + } + }?, + exp_ons: json_rider.exp_ons.parse()?, + exp_offs: json_rider.exp_offs.parse()?, + ons: json_rider.ons.parse()?, + offs: json_rider.offs.parse()?, + year: 2024, //FIXME FIXME! Actually parse + direction: match json_rider.direction.as_str() { + "Eastbound" => Ok(CardinalDirection::Eastbound), + "Westbound" => Ok(CardinalDirection::Westbound), + "Northbound" => Ok(CardinalDirection::Northbound), + "Southbound" => Ok(CardinalDirection::Southbound), + "Inbound" => Ok(CardinalDirection::Inbound), + "Outbound" => Ok(CardinalDirection::Outbound), + "Loop" => Ok(CardinalDirection::Loop), + "" => match json_rider.route_id.as_str() { + "AIR" => Ok(CardinalDirection::Inbound), + "CHE" => Ok(CardinalDirection::Outbound), + "CHW" => Ok(CardinalDirection::Inbound), + "CYN" => Ok(CardinalDirection::Inbound), + "FOX" => Ok(CardinalDirection::Outbound), + "LAN" => Ok(CardinalDirection::Outbound), + "NOR" => Ok(CardinalDirection::Outbound), + "MED" => Ok(CardinalDirection::Inbound), + "PAO" => Ok(CardinalDirection::Inbound), + "TRE" => Ok(CardinalDirection::Inbound), + "WAR" => Ok(CardinalDirection::Outbound), + "WTR" => Ok(CardinalDirection::Outbound), + "WIL" => Ok(CardinalDirection::Inbound), + _ => Err(anyhow::anyhow!("Bad dir value RR route id {}", json_rider.route_id)) + }, + _ => Err( + ::anyhow::anyhow!( + "Unknown true direction {} for Route {}", + json_rider.direction, + json_rider.route_id + ) + ) + }?})) + } +} diff --git a/data_loader/src/septa/route.rs b/data_loader/src/septa/route.rs new file mode 100644 index 0000000..1ba77bd --- /dev/null +++ b/data_loader/src/septa/route.rs @@ -0,0 +1,122 @@ +use sqlx::{Postgres, Transaction}; +use crate::traits::{DbObj, FromSeptaJson}; +use crate::septa_json; +use libseptastic::route::{Route, RouteType}; + +impl DbObj for Route { + + async fn create_table(tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + sqlx::query(" + CREATE TYPE septa_route_type AS ENUM ( + 'trolley', + 'subway_elevated', + 'regional_rail', + 'bus', + 'trackless_trolley' + ); + ") + .execute(&mut **tx) + .await?; + + sqlx::query(" + CREATE TYPE septa_direction_type AS ENUM ( + 'northbound', + 'southbound', + 'eastbound', + 'westbound', + 'inbound', + 'outbound', + 'loop' + ); + ") + .execute(&mut **tx) + .await?; + + sqlx::query(" + CREATE TABLE IF NOT EXISTS septa_routes ( + id VARCHAR(8) PRIMARY KEY, + name VARCHAR(64) NOT NULL, + short_name VARCHAR(32) NOT NULL, + color_hex VARCHAR(6) NOT NULL, + route_type septa_route_type NOT NULL + ); + ") + .execute(&mut **tx) + .await?; + + Ok(()) + } + +async fn insert_many(routes: Vec, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + let mut names = Vec::new(); + let mut short_names = Vec::new(); + let mut color_hexes = Vec::new(); + let mut route_types: Vec = Vec::new(); + let mut ids = Vec::new(); + + for route in routes { + ids.push(route.id); + names.push(route.name); + short_names.push(route.short_name); + color_hexes.push(route.color_hex); + route_types.push(route.route_type); + } + + sqlx::query(" + INSERT INTO + septa_routes + ( + id, + name, + short_name, + color_hex, + route_type + ) + SELECT * FROM UNNEST( + $1::text[], + $2::text[], + $3::text[], + $4::text[], + $5::septa_route_type[] + ); + ") + .bind(&ids) + .bind(&names) + .bind(&short_names) + .bind(&color_hexes) + .bind(&route_types) + .execute(&mut **tx) + .await?; + + Ok(()) +} + async fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + Self::insert_many(vec![self.clone()], tx).await?; + Ok(()) + } +} + +impl FromSeptaJson for RouteType { + fn from_septa_json(json_rt: septa_json::route::RouteType) -> ::anyhow::Result> { + Ok(Box::new(match json_rt { + septa_json::route::RouteType::Trolley => RouteType::Trolley, + septa_json::route::RouteType::SubwayElevated => RouteType::SubwayElevated, + septa_json::route::RouteType::RegionalRail => RouteType::RegionalRail, + septa_json::route::RouteType::Bus => RouteType::Bus, + septa_json::route::RouteType::TracklessTrolley => RouteType::TracklessTrolley, + })) + } +} + +impl FromSeptaJson for Route { + fn from_septa_json(json_route: septa_json::route::Route) -> ::anyhow::Result> { + Ok(Box::new(Route { + name: json_route.route_long_name, + short_name: json_route.route_short_name, + color_hex: json_route.route_color, + route_type: *RouteType::from_septa_json(json_route.route_type)?, + id: json_route.route_id, + // FIXME: Actually get direction + })) + } +} diff --git a/data_loader/src/septa/route_stop.rs b/data_loader/src/septa/route_stop.rs new file mode 100644 index 0000000..a626346 --- /dev/null +++ b/data_loader/src/septa/route_stop.rs @@ -0,0 +1,78 @@ +use sqlx::{Postgres, Transaction}; +use crate::traits::{DbObj, FromSeptaJson}; +use crate::septa_json; + +use libseptastic::route_stop::RouteStop; + + +impl DbObj for RouteStop { + async fn create_table(tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + sqlx::query(" + CREATE TABLE IF NOT EXISTS septa_route_stops ( + route_id TEXT NOT NULL, + stop_id BIGINT NOT NULL, + direction_id BIGINT NOT NULL, + stop_sequence BIGINT NOT NULL, + + PRIMARY KEY (route_id, stop_id, direction_id), + + FOREIGN KEY (route_id) REFERENCES septa_routes(id) ON DELETE CASCADE, + FOREIGN KEY (stop_id) REFERENCES septa_stops(id) ON DELETE CASCADE + ); + ") + .execute(&mut **tx) + .await?; + + Ok(()) + } + async fn insert_many(rses: Vec, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + let mut route_ids: Vec = Vec::new(); + let mut stop_ids: Vec = Vec::new(); + let mut direction_ids: Vec = Vec::new(); + let mut stop_sequences: Vec = Vec::new(); + + for rs in rses { + route_ids.push(rs.route_id.clone()); + stop_ids.push(rs.stop_id.clone()); + direction_ids.push(rs.direction_id.clone()); + stop_sequences.push(rs.stop_sequence.clone()); + } + + sqlx::query(" + INSERT INTO + septa_route_stops + ( + route_id, + stop_id, + direction_id, + stop_sequence + ) + SELECT * FROM UNNEST($1::text[], $2::bigint[], $3::bigint[], $4::bigint[]) + ON CONFLICT DO NOTHING + ; + ") + .bind(&route_ids[..]) + .bind(&stop_ids[..]) + .bind(&direction_ids[..]) + .bind(&stop_sequences[..]) + .execute(&mut **tx) + .await?; + Ok(()) + } + + async fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + Self::insert_many(vec![self.clone()], tx).await?; + Ok(()) + } +} + +impl FromSeptaJson for RouteStop { + fn from_septa_json(json_stops: septa_json::route_stop::RouteStop) -> ::anyhow::Result> { + Ok(Box::new(RouteStop{ + route_id: json_stops.route_id, + stop_id: json_stops.stop_id, + direction_id: json_stops.direction_id, + stop_sequence: json_stops.stop_sequence + })) + } +} diff --git a/data_loader/src/septa/schedule_day.rs b/data_loader/src/septa/schedule_day.rs new file mode 100644 index 0000000..6c1b816 --- /dev/null +++ b/data_loader/src/septa/schedule_day.rs @@ -0,0 +1,70 @@ +use sqlx::{Postgres, Transaction}; +use crate::traits::{DbObj, FromSeptaJson}; +use crate::septa_json; + +use libseptastic::schedule_day::ScheduleDay; + +impl DbObj for ScheduleDay { + async fn create_table(tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + sqlx::query(" + CREATE TABLE IF NOT EXISTS septa_schedule_days ( + date TEXT NOT NULL, + service_id TEXT NOT NULL, + PRIMARY KEY (date, service_id) + ); + ") + .execute(&mut **tx) + .await?; + + Ok(()) + } + async fn insert_many(scheds: Vec, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + let mut dates: Vec = Vec::new(); + let mut service_ids: Vec = Vec::new(); + + for sched in scheds { + dates.push(sched.date); + service_ids.push(sched.service_id); + } + + sqlx::query(" + + INSERT INTO septa_schedule_days ( + date, + service_id + ) + SELECT * FROM UNNEST( + $1::text[], + $2::text[] + ) + ON CONFLICT DO NOTHING + ; + ") + .bind(&dates[..]) + .bind(&service_ids[..]) + .execute(&mut **tx) + .await?; + + Ok(()) + } + + async fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + Self::insert_many(vec![self.clone()], tx).await?; + Ok(()) + } +} + + +impl FromSeptaJson for Vec { + fn from_septa_json(json_sched: septa_json::schedule_day::Calendar) -> ::anyhow::Result>> { + let mut res: Vec = Vec::new(); + + for (day, sched) in json_sched { + for svc in sched.service_id { + res.push(ScheduleDay { date: day.clone(), service_id: svc }); + } + } + + Ok(Box::new(res)) + } +} diff --git a/data_loader/src/septa/stop.rs b/data_loader/src/septa/stop.rs new file mode 100644 index 0000000..d01f53c --- /dev/null +++ b/data_loader/src/septa/stop.rs @@ -0,0 +1,108 @@ +use sqlx::{Postgres, Transaction}; +use crate::traits::{DbObj, FromSeptaJson}; +use crate::septa_json; + +use libseptastic::stop::{Stop, StopType}; + +impl DbObj for Stop { + async fn create_table(tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + sqlx::query(" + CREATE TYPE septa_stop_type AS ENUM ( + 'far_side', + 'middle_block_near_side', + 'normal' + ); + ") + .execute(&mut **tx) + .await?; + + sqlx::query(" + CREATE TABLE IF NOT EXISTS septa_stops ( + id BIGINT PRIMARY KEY, + name VARCHAR(128) NOT NULL, + lat DOUBLE PRECISION NOT NULL, + lng DOUBLE PRECISION NOT NULL, + stop_type septa_stop_type NOT NULL + ); + ") + .execute(&mut **tx) + .await?; + + Ok(()) + } + async fn insert_many(stations: Vec, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + let mut ids: Vec = Vec::new(); + let mut names: Vec = Vec::new(); + let mut lats: Vec = Vec::new(); + let mut lngs: Vec = Vec::new(); + let mut stop_types: Vec = Vec::new(); + + for station in stations { + ids.push(station.id); + names.push(station.name); + lats.push(station.lat); + lngs.push(station.lng); + stop_types.push(station.stop_type); + } + + sqlx::query(" + INSERT INTO + septa_stops + ( + id, + name, + lat, + lng, + stop_type + ) + SELECT * FROM UNNEST( + $1::bigint[], + $2::text[], + $3::double precision[], + $4::double precision[], + $5::septa_stop_type[] + ) + ON CONFLICT DO NOTHING + ; + ") + .bind(&ids[..]) + .bind(&names[..]) + .bind(&lats[..]) + .bind(&lngs[..]) + .bind(&stop_types[..]) + .execute(&mut **tx) + .await?; + + Ok(()) + } + + async fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + Self::insert_many(vec![self.clone()], tx).await?; + Ok(()) + } +} + +impl FromSeptaJson for Stop { + fn from_septa_json(json_station: septa_json::route_stop::RouteStop) -> ::anyhow::Result> { + let mut name = json_station.stop_name; + let mut stop_type = StopType::Normal; + + if let Some(new_name) = name.strip_suffix("- MNBS") { + stop_type = StopType::MiddleBlockNearSide; + name = new_name.to_string(); + } + + if let Some(new_name) = name.strip_suffix("- FS") { + stop_type = StopType::FarSide; + name = new_name.to_string(); + } + + Ok(Box::new(Stop { + name, + id: json_station.stop_id, + lat: json_station.stop_lat, + lng: json_station.stop_lon, + stop_type + })) + } +} diff --git a/data_loader/src/septa/stop_schedule.rs b/data_loader/src/septa/stop_schedule.rs new file mode 100644 index 0000000..1aa1980 --- /dev/null +++ b/data_loader/src/septa/stop_schedule.rs @@ -0,0 +1,118 @@ +use sqlx::{Postgres, Transaction}; +use crate::traits::{DbObj, FromSeptaJson}; +use crate::septa_json; + +use libseptastic::stop_schedule::StopSchedule; + +impl DbObj for StopSchedule { + async fn create_table(tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + sqlx::query(" + CREATE TABLE IF NOT EXISTS septa_stop_schedules ( + route_id TEXT NOT NULL, + trip_id TEXT NOT NULL, + service_id TEXT NOT NULL, + direction_id BIGINT NOT NULL, + arrival_time BIGINT NOT NULL, + stop_id BIGINT NOT NULL, + stop_sequence BIGINT NOT NULL, + + PRIMARY KEY (trip_id, stop_id), + + FOREIGN KEY (route_id) REFERENCES septa_routes(id) ON DELETE CASCADE, + FOREIGN KEY (stop_id) REFERENCES septa_stops(id) ON DELETE CASCADE + ); + ") + //FOREIGN KEY (route_id, direction_id) REFERENCES septa_directions(route_id, direction_id) ON DELETE CASCADE, + .execute(&mut **tx) + .await?; + + Ok(()) + } + async fn insert_many(scheds: Vec, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + let mut route_ids: Vec = Vec::new(); + let mut trip_ids: Vec = Vec::new(); + let mut service_ids: Vec = Vec::new(); + let mut direction_ids: Vec = Vec::new(); + let mut arrival_times: Vec = Vec::new(); + let mut stop_ids: Vec = Vec::new(); + let mut stop_sequences: Vec = Vec::new(); + + for sched in scheds { + route_ids.push(sched.route_id); + trip_ids.push(sched.trip_id); + service_ids.push(sched.service_id); + direction_ids.push(sched.direction_id); + arrival_times.push(sched.arrival_time); + stop_ids.push(sched.stop_id); + stop_sequences.push(sched.stop_sequence); + } + + sqlx::query(" + + INSERT INTO septa_stop_schedules ( + route_id, + trip_id, + service_id, + direction_id, + arrival_time, + stop_id, + stop_sequence + ) + SELECT * FROM UNNEST( + $1::text[], + $2::text[], + $3::text[], + $4::bigint[], + $5::bigint[], + $6::bigint[], + $7::bigint[] + ) + ON CONFLICT DO NOTHING + ; + ") + .bind(&route_ids[..]) + .bind(&trip_ids[..]) + .bind(&service_ids[..]) + .bind(&direction_ids[..]) + .bind(&arrival_times[..]) + .bind(&stop_ids[..]) + .bind(&stop_sequences[..]) + .execute(&mut **tx) + .await?; + + Ok(()) + } + + async fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> anyhow::Result<()> { + Self::insert_many(vec![self.clone()], tx).await?; + Ok(()) + } +} + +impl FromSeptaJson for StopSchedule { + fn from_septa_json(json_sched: septa_json::stop_schedule::StopSchedule) -> ::anyhow::Result> { + let time_parts: Vec<&str> = json_sched.arrival_time.split(":").collect(); + + let arrival_time: i64 = { + let hour: i64 = time_parts[0].parse::()?; + let minute: i64 = time_parts[1].parse::()?; + let second: i64 = time_parts[2].parse::()?; + + (hour*3600) + (minute * 60) + second + }; + + Ok(Box::new(StopSchedule { + route_id: json_sched.route_id, + trip_id: match json_sched.trip_id{ + septa_json::stop_schedule::TripId::RegionalRail(x) => x, + septa_json::stop_schedule::TripId::Other(y) => y.to_string() + }, + service_id: json_sched.service_id, + // FIXME: Actually get direction + direction_id: json_sched.direction_id, + arrival_time, + stop_id: json_sched.stop_id, + stop_sequence: json_sched.stop_sequence + })) + } +} diff --git a/data_loader/src/septa_json/direction.rs b/data_loader/src/septa_json/direction.rs new file mode 100644 index 0000000..ce15bc6 --- /dev/null +++ b/data_loader/src/septa_json/direction.rs @@ -0,0 +1,19 @@ +use crate::traits::*; +use serde::Deserialize; + + +#[derive(Debug, Clone, Deserialize)] +pub struct Direction { + #[serde(rename="Route")] + pub route: String, + #[serde(rename="DirectionDescription")] + pub direction_destination: String, + #[serde(rename="Direction")] + pub direction: String, + #[serde(rename="TrueDirection")] + pub true_direction: String, + #[serde(rename="Mode")] + pub mode: String +} + +impl SeptaJson for Direction {} diff --git a/data_loader/src/septa_json/mod.rs b/data_loader/src/septa_json/mod.rs new file mode 100644 index 0000000..d28e3e1 --- /dev/null +++ b/data_loader/src/septa_json/mod.rs @@ -0,0 +1,6 @@ +pub mod route; +pub mod route_stop; +pub mod stop_schedule; +pub mod schedule_day; +pub mod direction; +pub mod ridership; diff --git a/data_loader/src/septa_json/ridership.rs b/data_loader/src/septa_json/ridership.rs new file mode 100644 index 0000000..bc9dd33 --- /dev/null +++ b/data_loader/src/septa_json/ridership.rs @@ -0,0 +1,37 @@ +use crate::traits::*; +use serde::Deserialize; + +#[derive(Debug, Clone, Deserialize)] +pub struct Ridership { + #[serde(rename = "Stop ID")] + pub stop_id: Option, + + #[serde(rename = "Stop Code")] + pub stop_code: String, + + #[serde(rename = "Stop")] + pub stop_name: String, + + #[serde(rename = "Route")] + pub route_id: String, + + #[serde(rename = "Direction")] + pub direction: String, + + #[serde(rename = "Ons")] + pub ons: String, + + #[serde(rename = "Offs")] + pub offs: String, + + #[serde(rename = "Exp_Ons")] + pub exp_ons: String, + + #[serde(rename = "Exp_Offs")] + pub exp_offs: String, + + #[serde(rename = "Year")] + pub year: String +} + +impl SeptaJson for Ridership {} diff --git a/data_loader/src/septa_json/route.rs b/data_loader/src/septa_json/route.rs new file mode 100644 index 0000000..93e6967 --- /dev/null +++ b/data_loader/src/septa_json/route.rs @@ -0,0 +1,42 @@ +use crate::traits::*; +use serde_repr::*; +use serde::Deserialize; + +#[derive(Serialize_repr, Deserialize_repr, PartialEq, Debug)] +#[repr(u8)] +pub enum RouteType { + Trolley= 0, + SubwayElevated = 1, + RegionalRail = 2, + Bus = 3, + TracklessTrolley = 11 +} + + +#[derive(Debug, Deserialize)] +pub struct Document { + #[serde(rename = "type")] + pub doc_type: String, + pub title: String, + pub url: String, + pub link_label: Option, +} + +#[derive(Debug, Deserialize)] +pub struct Route { + pub release_name: String, + pub route_id: String, + pub route_short_name: String, + pub route_long_name: String, + pub route_type: RouteType, + pub route_color: String, + pub route_text_color: String, + pub route_frequency_text: String, + pub is_frequent_bus: bool, + pub route_color_dark: String, + pub route_color_text_dark: String, + pub documents: Vec +} + +impl SeptaJson for Route {} +impl SeptaJson for RouteType {} diff --git a/data_loader/src/septa_json/route_stop.rs b/data_loader/src/septa_json/route_stop.rs new file mode 100644 index 0000000..2eca64d --- /dev/null +++ b/data_loader/src/septa_json/route_stop.rs @@ -0,0 +1,31 @@ +use crate::traits::*; +use serde::{self, Deserialize, Deserializer}; + +pub fn de_string_or_int<'de, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + use serde::de::Error; + use serde_json::Value; + + match Value::deserialize(deserializer)? { + Value::Number(n) => n.as_i64().ok_or_else(|| Error::custom("Invalid number")), + Value::String(s) => s.parse::().map_err(|_| Error::custom("Invalid string number")), + _ => Err(Error::custom("Expected a string or number")), + } +} + +#[derive(Debug, Clone, Deserialize)] +pub struct RouteStop { + pub route_id: String, + pub direction_id: i64, + #[serde(deserialize_with = "de_string_or_int")] + pub stop_id: i64, + pub stop_name: String, + pub stop_sequence: i64, + pub stop_lat: f64, + pub stop_lon: f64, +} + +impl SeptaJson for RouteStop {} +impl SeptaJson for Vec {} diff --git a/data_loader/src/septa_json/schedule_day.rs b/data_loader/src/septa_json/schedule_day.rs new file mode 100644 index 0000000..c7cb2cd --- /dev/null +++ b/data_loader/src/septa_json/schedule_day.rs @@ -0,0 +1,18 @@ +use std::collections::{BTreeMap, HashMap, HashSet}; + +use crate::traits::*; +use serde::{Deserialize, Serialize}; + + +#[derive(Default, Debug, Serialize, Deserialize)] +pub struct ScheduleDay { + pub release_name: String, + pub special: bool, + pub service_id: Vec, + pub service_added: Vec, + pub service_removed: Vec +} + +pub type Calendar = BTreeMap; + +impl SeptaJson for Calendar {} diff --git a/data_loader/src/septa_json/stop_schedule.rs b/data_loader/src/septa_json/stop_schedule.rs new file mode 100644 index 0000000..65a98bf --- /dev/null +++ b/data_loader/src/septa_json/stop_schedule.rs @@ -0,0 +1,27 @@ +use crate::traits::*; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum TripId { + RegionalRail(String), + Other(i64) +} + +#[derive(Debug, Clone, Deserialize)] +pub struct StopSchedule { + pub route_id: String, + pub block_id: i64, + pub release_name: String, + pub trip_id: TripId, + pub service_id: String, + pub trip_headsign: Option, + pub direction_id: i64, + pub arrival_time: String, + pub stop_id: i64, + pub stop_name: String, + pub stop_sequence: i64, + pub last_stop_id: i64 +} + +impl SeptaJson for StopSchedule {} diff --git a/data_loader/src/traits.rs b/data_loader/src/traits.rs new file mode 100644 index 0000000..20eb2cc --- /dev/null +++ b/data_loader/src/traits.rs @@ -0,0 +1,23 @@ +use std::collections::HashMap; + +use sqlx::{Postgres, Transaction}; + + + +pub trait SeptaJson {} + +pub trait FromSeptaJson { + fn from_septa_json(septa_json: T) -> ::anyhow::Result>; +} + +pub trait FromSeptaJsonAndStations { + fn from_septa_json(septa_json: T, stop_map: &HashMap) -> ::anyhow::Result>; +} + +pub trait DbObj { + fn create_table(tx: &mut Transaction<'_, Postgres>) -> impl std::future::Future< Output = ::anyhow::Result<()>> + Send; + fn insert(&self, tx: &mut Transaction<'_, Postgres>) -> impl std::future::Future< Output = ::anyhow::Result<()>> + Send; + fn insert_many(s: Vec, tx: &mut Transaction<'_, Postgres>) -> impl std::future::Future< Output = ::anyhow::Result<()>> + Send; +} + +pub trait Fetchable {}