Skip to content

Commit

Permalink
author: bhelmer -- MTAD-087, MTAD-014 -- R operates between, then via…
Browse files Browse the repository at this point in the history
… F now corrected for archive #125. Added test to MTAD-014.
  • Loading branch information
Atomox committed Jun 3, 2018
1 parent 0c000e2 commit a740c35
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 2 deletions.
99 changes: 98 additions & 1 deletion server/data/test/test.messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2717,7 +2717,7 @@ let event_messages = {
date: {
start: "2018-01-27T00:00:00-05:00",
},
tag: ['MTAD-002', 'MTAD-040', 'MTAD-060'],
tag: ['MTAD-002', 'MTAD-030', 'MTAD-040', 'MTAD-060'],
type: null,
type_detail: [
"running_express",
Expand Down Expand Up @@ -3481,6 +3481,103 @@ let event_messages = {
{line: "MTA NYCT_N"},
],
},
{
id: "MTA NYCT_187265",
type: "Planned Work",
planned: true,
date: {fetched: "2018-05-25T00:00:00-04:00",},
type: {
tag: "skip_stations",
weight: 2
},
type_detail: [
"skip_stations",
"track_maintenance"
],
tag: ['MTAD-030'],
tags: {
incident_diversion: [
"skip_stations"
],
incident_planned: [
"track_maintenance"
]
},
durration: "11:45 PM Fri, May 25 to 5 AM Tue, May 29",
message: "TRACK REPLACEMENT | 11:45 PM Fri, May 25 to 5 AM Tue, May 29 Coney Island-bound [F] trains skip Sutphin Blvd, Briarwood and 75 Av in Queens For service to Sutphin Blvd , take the [F] to Union Tpke and transfer to a Jamaica-bound [F] or [R]*. For service to Briarwood and 75 Av , take the [F] to Union Tpke or 71 Av and transfer to a Jamaica Center-bound [E], Jamaica-bound [F] or [R]. For service from Sutphin Blvd and Briarwood , take the [F] or [R] to Parsons Blvd and transfer to a Coney Island-bound [F]. For service from 75 Av , take the [E] [F] or [R] to Union Tpke and transfer to a Coney Island-bound [F]. *[R] trains operate between 95 St and 71 Av and via the [F] to/from 179 St days and evenings.",
},
{
archive: 125,
id: "MTA NYCT_187265",
type: "Planned Work",
planned: true,
date: {fetched: "2018-05-25T00:00:00-04:00",},
type: {
tag: "skip_stations",
weight: 2
},
type_detail: [
"skip_stations",
"track_maintenance"
],
tag: ['MTAD-014', 'MTAD-087'],
tags: {
incident_diversion: [
"skip_stations"
],
incident_planned: [
"track_maintenance"
]
},
durration: "11:45 PM Fri, May 25 to 5 AM Tue, May 29",
message: "TRACK REPLACEMENT | 11:45 PM Fri, May 25 to 5 AM Tue, May 29 Coney Island-bound [F] trains skip Sutphin Blvd, Briarwood and 75 Av in Queens For service to Sutphin Blvd , take the [F] to Union Tpke and transfer to a Jamaica-bound [F] or [R]*. For service to Briarwood and 75 Av , take the [F] to Union Tpke or 71 Av and transfer to a Jamaica Center-bound [E], Jamaica-bound [F] or [R]. For service from Sutphin Blvd and Briarwood , take the [F] or [R] to Parsons Blvd and transfer to a Coney Island-bound [F]. For service from 75 Av , take the [E] [F] or [R] to Union Tpke and transfer to a Coney Island-bound [F]. *[R] trains operate between 95 St and 71 Av and via the [F] to/from 179 St days and evenings.",
alt_instructions: "For service to Sutphin Blvd , take the [F] to Union Tpke and transfer to a Jamaica-bound [F] or [R]*. For service to Briarwood and 75 Av , take the [F] to Union Tpke or 71 Av and transfer to a Jamaica Center-bound [E], Jamaica-bound [F] or [R]. For service from Sutphin Blvd and Briarwood , take the [F] or [R] to Parsons Blvd and transfer to a Coney Island-bound [F]. For service from 75 Av , take the [E] [F] or [R] to Union Tpke and transfer to a Coney Island-bound [F]. *[R] trains operate between 95 St and 71 Av and via the [F] to/from 179 St days and evenings.",
stations_bound: {},
route_change: {
message: "[Bk58-D43]-bound [F] trains skip [Qs257-F04], [Qs258-F05] and [Qs260-F07] in Queens ``` [R] trains operate between [Bk39-R45] and [Qs261-G08] and via the [F] to/from [Qs254-F01] days and evenings.",
tag: ['A-operates-then-overC'],
trains: ["F","R"],
route: [
{
allTrains: true,
dir: "[Bk58-D43]-bound",
lines: [
"F"
],
along: null,
bypass: [
"Qs257-F04",
"Qs258-F05",
"Qs260-F07"
],
action: "bypass",
parsed: "[Bk58-D43]-bound [F] trains skip [Qs257-F04], [Qs258-F05] and [Qs260-F07] ",
process: "RouteChangeBypass"
},
{
allTrains: true,
lines: ["R"],
along: null,
from: "Bk39-R45",
to: "Qs261-G08",
parsed: "[R] trains operate between [Bk39-R45] and [Qs261-G08] and",
process: "RouteChangeStandard"
},
{
allTrains: true,
lines: ["R"],
along: "F",
from: "Qs261-G08",
to: "Qs254-F01",
process: "RouteChangeStandard",
parsed: "via the [F] to/from [Qs254-F01]",
action: "via"
}
],
},
line: [ { line: "MTA NYCT_F", dir: "1" }]
},

],

complex: [
Expand Down
2 changes: 1 addition & 1 deletion server/mta.event.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ async function getRouteChange(text, lines, id) {
let c = await getMessageRouteChange(text),
op,
operate_sections = false,
reroute_pattern = /((Some)?\s*(Northbound|Southbound|Uptown|Downtown|(?:\[(?:Qs|Mn|Bx|Bk|SI)[0-9]{1,5}\-[A-z0-9]{1,5}\])\s*[\s-]\s*bound|\b.*\b[\s-]bound)?\s*\[([A-Z0-9]{1,2})\](?:\*|\s)*(?:(?:\s|and)*\[([A-Z0-9]{1,2})\])?\s*(Northbound|Southbound|Uptown|Downtown|(?:\[(?:Qs|Mn|Bx|Bk|SI)[0-9]{1,5}\-[A-z0-9]{1,5}\])\s*[\s-]\s*(?:bound)?|\b.*\b[\s-]bound)?\s*(?:(?:(?:trains)?(?:\s*are\s*(?:rerouted)?)?)|(?:([^`\[\]]*service\s*operates\s*b\s*etween|[^`\[\]]*No\s*service\s*b\s*etween|\[__operates-section-[0-9]__\]\s*(?:between)?)\s*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])[^\[\]`]*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])))[^\[\]`]*)((?:(?:and|then)?\s(?:stopping|run)?\s*(on|via|along|long|over|replace)+\s*(?:the)?\s*\[((?!\3\4)[A-Z0-9])\]|\s*(?:run(?:ning)?|make|making)\s*(express|local))[^\/\[\]`]*(express|local|to\/from|to|in|\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])[^\[\]`]*(Manhattan|Queens|Brooklyn|the\s* Bronx|\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])(?:\s*\(skipping.*\)\s*|\,\s*the\s*last\s*stop|\,\s*then\s*end)?[\.,\s]*)((?:(?:(?:and|then)?\s*(?:trains\s*(?:run)\s*)?(?:stopping|run|operat(?:e|ing))?\s*(via|along|over|replace|on)+ the)\s*(\[(?!\3\4)[A-Z0-9]\])?[^\[\]`]*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\]|to\/from|to)(?:[^\[\]`]*(?:(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])[\.]?))?)?)/i,
reroute_pattern = /((Some)?\s*(Northbound|Southbound|Uptown|Downtown|(?:\[(?:Qs|Mn|Bx|Bk|SI)[0-9]{1,5}\-[A-z0-9]{1,5}\])\s*[\s-]\s*bound|\b.*\b[\s-]bound)?\s*\[([A-Z0-9]{1,2})\](?:\*|\s)*(?:(?:\s|and)*\[([A-Z0-9]{1,2})\])?\s*(Northbound|Southbound|Uptown|Downtown|(?:\[(?:Qs|Mn|Bx|Bk|SI)[0-9]{1,5}\-[A-z0-9]{1,5}\])\s*[\s-]\s*(?:bound)?|\b.*\b[\s-]bound)?\s*(?:(?:(?:trains)?(?:\s*are\s*(?:rerouted)?)?)|(?:([^`\[\]]*service\s*operates\s*b\s*etween|\b(?:[^`\[\]]*trains\s*operate\s*b\s*etween)\b||[^`\[\]]*No\s*service\s*b\s*etween|\[__operates-section-[0-9]__\]\s*(?:between)?)\s*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])[^\[\]`]*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])))[^\[\]`]*)((?:(?:and|then)?\s(?:stopping|run)?\s*(on|via|along|long|over|replace)+\s*(?:the)?\s*\[((?!\3\4)[A-Z0-9])\]|\s*(?:run(?:ning)?|make|making)\s*(express|local))[^\/\[\]`]*(express|local|to\/from|to|in|\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])[^\[\]`]*(Manhattan|Queens|Brooklyn|the\s* Bronx|\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])(?:\s*\(skipping.*\)\s*|\,\s*the\s*last\s*stop|\,\s*then\s*end)?[\.,\s]*)((?:(?:(?:and|then)?\s*(?:trains\s*(?:run)\s*)?(?:stopping|run|operat(?:e|ing))?\s*(via|along|over|replace|on)+ the)\s*(\[(?!\3\4)[A-Z0-9]\])?[^\[\]`]*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\]|to\/from|to)(?:[^\[\]`]*(?:(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])[\.]?))?)?)/i,
no_trains_between_pattern = /(?:Service\s*is\s*(suspended)\s*(?:in\s*both\s*directions\s*)(?:on\s*the\s*)|(No)\s*)?\[([A-Z0-9]{1,2})\](?:\*|\s)*(?:(?:\s|and|or)*\[([A-Z0-9]{1,2})\])?\s*(?:train[s]?\s*(?:service)?\s*)?(?:(No)?\s*(?:trains|service)\s*between|(?:line\s*)?between)\s*(?:(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])\s*(?:and)?\s*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\]))/i,
bypass_pattern = /((Some)?\s*(Northbound|Southbound|Uptown|Downtown|(?:\[(?:Qs|Mn|Bx|Bk|SI)[0-9]{1,5}\-[A-z0-9]{1,5}\])\s*[\s-]\s*bound|\b.*\b[\s-]bound)?\s*\[([A-Z0-9]{1,2})\](?:\*|\s)*(?:(?:\s|and)*\[([A-Z0-9]{1,2})\])?\s*(Some)?\s*(Northbound|Southbound|Uptown|Downtown|(?:\[(?:Qs|Mn|Bx|Bk|SI)[0-9]{1,5}\-[A-z0-9]{1,5}\])\s*[\s-]\s*bound|\b.*\b[\s-]bound)?\s*(?:(?:trains|service)\s*(?:are|is)?\s*(skip(?:ping|s)?|bypass(?:ing|es)?)|(No\s*(?:trains|service))\s*at)\s*((?:\[(?:(?:Qs|Mn|Bx|Bk|SI)[0-9]{1,5}\-[A-z0-9]{1,5}[|]?)+\]\s*(?:,|and)*\s*)+))\s*((?:(?:trains|service)\s*(?:are|is)?\s*(skip(?:ping|s)?|bypass(?:ing|es)?)|(No\s*(?:trains|service))\s*at)\s*((?:\[(?:(?:Qs|Mn|Bx|Bk|SI)[0-9]{1,5}\-[A-z0-9]{1,5}[|]?)+\]\s*(?:,|and)*\s*)+))?/i,
operate_sections_pattern = /\[([A-Z0-9])\](?:(?:\s|and|\*)*\[([A-Z0-9])\])?\s*(?:(?:(?:\[__operates-section-([0-9])__\]|(?:(?:shuttle)?\s*(?:service|trains))\s*(?:operate(?:s)?|(?:are)?\s*run(?:ning)?))\s*(?:(?:(?:at)?\s*all\s*times)|weekend(?:s)?\s*(?:service)?)?\s*(?:between)?)\s*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\])(?:[^\[\]`]|\[[a-z0-9]\])*(\[(?:[A-Z]{2}[A-Z0-9]{1,4}\-[A-Z0-9]{2,5}[|]?)+\]))+/i,
Expand Down

0 comments on commit a740c35

Please sign in to comment.