Skip to content

Commit e550daf

Browse files
authored
Added support for Mattapan Line (#130) (#254)
* Added support for Mattapan Line (#130) * Add "Mattapan" to stats * Added transithistory stats * Update Red Line Stats and Mattapan Lambda
1 parent 309a58e commit e550daf

5 files changed

Lines changed: 40 additions & 7 deletions

File tree

public/static_data.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"totalNewUndelivered": 10
77
},
88
"Red": {
9-
"totalOldActive": 162,
10-
"totalOldInactive": 2,
11-
"totalNewDelivered": 38,
12-
"totalNewUndelivered": 214
9+
"totalOldActive": 156,
10+
"totalOldInactive": 4,
11+
"totalNewDelivered": 42,
12+
"totalNewUndelivered": 210
1313
},
1414
"Green": {
1515
"totalOldActive": 165,
@@ -23,8 +23,12 @@
2323
"totalActive": 94,
2424
"totalInactive": 0
2525
},
26+
"Mattapan": {
27+
"totalActive": 6,
28+
"totalInactive": 4
29+
},
2630
"Sources": {
2731
"fleet_numbers": "http://roster.transithistory.org/"
2832
},
29-
"Updated": "2025-07-11"
33+
"Updated": "2025-08-17"
3034
}

server/chalicelib/fleet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
orange_is_new = lambda x: int(x) >= 1400 and int(x) <= 1551
1616
silver_is_new = lambda x: int(x) >= 1294 and int(x) <= 1299
1717
blue_is_new = lambda _: False
18+
mattapan_is_new = lambda x: False
1819

1920

2021
def get_route_test_function_dict(route_ids, test_fn):
@@ -28,6 +29,7 @@ def get_route_test_function_dict(route_ids, test_fn):
2829
**get_route_test_function_dict(GREEN_ROUTE_IDS, green_is_new),
2930
**get_route_test_function_dict(SILVER_ROUTE_IDS, silver_is_new),
3031
"Blue": blue_is_new,
32+
"Mattapan": mattapan_is_new,
3133
}
3234

3335

src/components/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useLayoutEffect } from 'react';
22
import Favicon from 'react-favicon';
33

4-
import { greenLine, orangeLine, redLine, blueLine } from '../lines';
4+
import { greenLine, orangeLine, redLine, blueLine, mattapanLine } from '../lines';
55
import { useMbtaApi } from '../hooks/useMbtaApi';
66

77
import { Line } from './Line';
@@ -24,6 +24,7 @@ const lineByTabId: Record<LineName, TLine> = {
2424
Orange: orangeLine,
2525
Red: redLine,
2626
Blue: blueLine,
27+
Mattapan: mattapanLine,
2728
};
2829

2930
export const App: React.FC = () => {

src/lines.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,29 @@ export const blueLine: Line = {
275275
},
276276
},
277277
};
278+
279+
const enum MattapanStations {
280+
Ashmont = 'place-asmnl',
281+
Mattapan = 'place-matt',
282+
}
283+
284+
export const mattapanLine: Line = {
285+
name: 'Mattapan',
286+
abbreviation: 'MT',
287+
color: '#E37C7C',
288+
colorSecondary: '#D13434',
289+
getStationLabelPosition: () => 'right',
290+
fixedTrainLabelPosition: 'right',
291+
routes: {
292+
Mattapan: {
293+
shape: [
294+
start(0, 0, 90),
295+
stationRange({
296+
start: MattapanStations.Ashmont,
297+
end: MattapanStations.Mattapan,
298+
commands: [line(150)],
299+
}),
300+
],
301+
},
302+
},
303+
};

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type LineName = 'Green' | 'Red' | 'Orange' | 'Blue';
1+
export type LineName = 'Green' | 'Red' | 'Orange' | 'Blue' | 'Mattapan';
22

33
export interface Line {
44
name: LineName;

0 commit comments

Comments
 (0)