Skip to content

Commit

Permalink
Merge pull request #21 from srepetsk/feature/8-AddC11Station
Browse files Browse the repository at this point in the history
Feature/8 add c11 station
  • Loading branch information
srepetsk authored Jul 21, 2023
2 parents c703fc7 + 03b037d commit 3e47c40
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 15 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]

# Change these settings to your own preference
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
45 changes: 41 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,19 @@ The setup instructions below are for Ubuntu 16.04. They may work for newer versi
$ psql -f sql/station_to_station_travel_time.sql
```
9. Follow step 1 of the Usage section to populate your WMATA API keys
9. Run any additional numbered scripts in the `sql` directory, in the order they are numbered.
10. Get an SSL certificate for your installation. MetroHero will require a P12-format file with the private key and the public certificate available to the Java Spring application. This developer prefers LetsEncrypt, doing something like:
10. Follow step 1 of the Usage section to populate your WMATA API keys
11. Get an SSL certificate for your installation. MetroHero will require a P12-format file with the private key and the public certificate available to the Java Spring application. This developer prefers LetsEncrypt, doing something like:
`certbot certonly -d dcmetrohero.net --preferred-challenges dns --manual`
Note, that LetsEncrypt certificates are valid for 90 days and require fairly-frequent renewal.
11. Generate your combined P12 file: `pkcs12 -in /etc/letsencrypt/live/dcmetrohero.net/fullchain.pem -inkey /etc/letsencrypt/live/dcmetrohero.net/privkey.pem -export -out keystore.p12`
12. Generate your combined P12 file: `pkcs12 -in /etc/letsencrypt/live/dcmetrohero.net/fullchain.pem -inkey /etc/letsencrypt/live/dcmetrohero.net/privkey.pem -export -out keystore.p12`
12. Launch the server inside `screen` so you can attach to it after-the-fact:
13. Launch the server inside `screen` so you can attach to it after-the-fact:
```screen -U
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xmx8g"
```
Expand All @@ -82,3 +84,38 @@ Note, that LetsEncrypt certificates are valid for 90 days and require fairly-fre
5. If you're using IntelliJ or another fully-featured IDE, you can use the autoconfigured Spring configuration (targeting the `Application` Java class) to start the server for development purposes, otherwise you can use `sudo mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xmx16g"`, e.g. in a production environment.
6. If you're running the server locally, navigate to https://localhost:9443/ to start using the webapp with it connected to your server.
7. If the logs are a little too noisy for your use case, e.g. in production, consider setting the `logging.level.com.jamespizzurro.metrorailserver` property in src/main/resources/application.properties to WARN instead of INFO, or set it to DEBUG to get even more log output for debugging purposes.
## Adding a new infill station
When adding a new infill Metrorail station, such as Potomac Yard, there are a number of files that need to be updated.
Beginning with the Webapp frontend:
* Use [Rail Station Information](https://api.wmata.com/Rail.svc/json/jStationInfo?StationCode=C11) API endpoint in order to grab the info block about the new station(s). This will include Lat/Long, address, and other information needed for MetroHero.
* `src/{blue,yellow,silver,red,green,orange}_stations.json`
* Edit the relevant file(s). If a station is used by multiple lines, all files should be updated
* Use the WMATA Rail Station Information API endpoint to populate this
* src/components/Line.js
* For an infill station, the station links on either side may need to be updated; for instance, links from C10 to C12 need to be split and modified so C10-C11 and C11-C12, rather than C10-C12, for a C11 infill station
* src/stores/LineStore.js
* src/stores/MareyDiagramStore.js
Server repo:
* src/main/resources/stations.csv
* Add the new station to the list, along with names that the station is referenced as
* src/main/resources/StandardRoutes.json
* For each station platform track circuit, set the station code (i.e. "C11") to associate the two
* src/main/resources/station_durations.csv
* Use [WMATA Trip Planner](https://wmata.com) to determine the time in minutes between the new station and its left and right pairs. Insert this, using the station codes as columns 1 and 2, as the 3rd column
## Station location track circuits
(Look for the track circuits of 600' length)
* C10-C1: 1010
* C11-C1: 3493
* C12-C1: 976
* C10-C2: 1204
* C11-C2: 3512
* C12-C2: 1170
## Configure length of train tracking history
By default, MetroHero will attmept to store up to 24 months of historical train location data. This configuration can be found in `src/main/java/com/jamespizzurro/metrorailserver/repository/TrainStatusRepository.java`, and adjusted up or down as appropriate for your environment. A lower history setting is likely more appropriate for a dev, rather than a production, environment.
17 changes: 17 additions & 0 deletions sql/01_insert_c11.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
\c metrohero

--Original database additions:
--INSERT INTO public.station_to_station_travel_time (station_codes_key, distance, from_station_code, last_updated, to_station_code) VALUES ('C10_C12', 15483, 'C10', '2017-06-16 19:28:41.066000', 'C12') ON CONFLICT (station_codes_key) DO UPDATE SET distance = EXCLUDED.distance;
--INSERT INTO public.station_to_station_travel_time (station_codes_key, distance, from_station_code, last_updated, to_station_code) VALUES ('C12_C10', 15483, 'C12', '2017-09-16 10:07:13.434000', 'C10') ON CONFLICT (station_codes_key) DO UPDATE SET distance = EXCLUDED.distance;

-- Drop the old data
DELETE FROM public.station_to_station_travel_time WHERE station_codes_key = 'C10_C12';
DELETE FROM public.station_to_station_travel_time WHERE station_codes_key = 'C12_C10';

-- C1
INSERT INTO public.station_to_station_travel_time (station_codes_key, distance, from_station_code, last_updated, to_station_code) VALUES ('C12_C11', 6814, 'C12', '2023-07-09 16:49:00.000000', 'C11') ON CONFLICT (station_codes_key) DO UPDATE SET distance = EXCLUDED.distance;
INSERT INTO public.station_to_station_travel_time (station_codes_key, distance, from_station_code, last_updated, to_station_code) VALUES ('C11_C10', 8703, 'C11', '2023-07-09 16:49:00.000000', 'C10') ON CONFLICT (station_codes_key) DO UPDATE SET distance = EXCLUDED.distance;

-- C2
INSERT INTO public.station_to_station_travel_time (station_codes_key, distance, from_station_code, last_updated, to_station_code) VALUES ('C10_C11', 9137, 'C10', '2023-07-09 16:49:00.000000', 'C11') ON CONFLICT (station_codes_key) DO UPDATE SET distance = EXCLUDED.distance;
INSERT INTO public.station_to_station_travel_time (station_codes_key, distance, from_station_code, last_updated, to_station_code) VALUES ('C11_C12', 7579, 'C11', '2023-07-09 16:49:00.000000', 'C12') ON CONFLICT (station_codes_key) DO UPDATE SET distance = EXCLUDED.distance;
10 changes: 5 additions & 5 deletions src/main/resources/StandardRoutes.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
{
"SeqNum": 100,
"CircuitId": 3493,
"StationCode": null
"StationCode": "C11"
},
{
"SeqNum": 101,
Expand Down Expand Up @@ -2588,7 +2588,7 @@
{
"SeqNum": 103,
"CircuitId": 3512,
"StationCode": null
"StationCode": "C11"
},
{
"SeqNum": 104,
Expand Down Expand Up @@ -20422,7 +20422,7 @@
{
"SeqNum": 52,
"CircuitId": 3493,
"StationCode": null
"StationCode": "C11"
},
{
"SeqNum": 53,
Expand Down Expand Up @@ -21548,7 +21548,7 @@
{
"SeqNum": 51,
"CircuitId": 3512,
"StationCode": null
"StationCode": "C11"
},
{
"SeqNum": 52,
Expand Down Expand Up @@ -22463,4 +22463,4 @@
]
}
]
}
}
8 changes: 5 additions & 3 deletions src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="org.springframework.web" level="DEBUG"/>
</configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>

<logger name="org.springframework.web" level="WARN"/>
<logger name="com.jamespizzurro:metrorailserver" level="WARN"/>
</configuration>
5 changes: 3 additions & 2 deletions src/main/resources/station_durations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ G04,G05,3
J03,J02,6
J02,C13,5
C13,C12,2
C12,C10,5
C12,C11,3
C11,C10,3
C10,C09,2
C09,C08,2
C08,C07,1
Expand Down Expand Up @@ -96,4 +97,4 @@ F08,F07,2
F07,F06,3
F06,F05,2
F05,F04,2
F04,F03,2
F04,F03,2
3 changes: 2 additions & 1 deletion src/main/resources/stations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ N07,Rest,Reston Town Center
B04,Rhod,Rhode Island Avenue-Brentwood|Rhode Island Ave|Rhode Island|R.I. Ave|Brentwood|RIA
A14,Rock,Rockville
C10,DCA,Ronald Reagan Washington National Airport|DCA|National Airport|Reagan|Airport
C11,PoYd,Potomac Yard
C05,Ross,Rosslyn
A15,ShGr,Shady Grove
E02,Shaw,Shaw-Howard University|Shaw|Howard University|Howard
Expand All @@ -94,4 +95,4 @@ E07,WstH,West Hyattsville|Hyattsville|W Hyattsville
B10,Whtn,Wheaton
A12,NoBe,North Bethesda|White Flint
N06,WRE,Wiehle-Reston East|Wiehle-Reston|Wiehle|Reston
A04,WdPk,Woodley Park
A04,WdPk,Woodley Park

0 comments on commit 3e47c40

Please sign in to comment.