-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f70aa2c
commit 3854c4c
Showing
4 changed files
with
64 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Database Notes | ||
|
||
## TrainView Schema | ||
|
||
```sql lite | ||
CREATE TABLE trainview ( | ||
day date NOT NULL, | ||
train varchar(4) NOT NULL, | ||
time time NOT NULL, | ||
lateness smallint(6) NOT NULL, | ||
PRIMARY KEY (day,train,time) | ||
); | ||
CREATE INDEX train ON trainview (train,time); | ||
CREATE INDEX trains ON trainview (train); | ||
``` | ||
|
||
Note: We store data with separate `day` and `time`. If `time` is before `03:00` then this represents a time during `day` plus one day. This is because service calculations reset at 3am. | ||
|
||
## Schedule Schema | ||
|
||
See schema definition in `sqliteGTFSImport.txt`. | ||
|
||
## Load SEPTA GTFS Data | ||
|
||
1. Set up | ||
|
||
```sh | ||
rm -rf tmp | ||
mkdir tmp | ||
cd tmp | ||
``` | ||
|
||
2. Download the release from https://github.com/septadev/GTFS/releases into there | ||
|
||
3. Extract | ||
|
||
```sh | ||
unzip gtfs_public.zip | ||
unzip google_rail.zip | ||
cd .. | ||
``` | ||
|
||
4. Load this into a SQLite database | ||
|
||
```sh | ||
rm -f septaSchedules.db | ||
sqlite3 septaSchedules.db < sqliteGTFSImport.txt | ||
``` | ||
|
||
5. Copy this database into your `databases` folder | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters