Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters for GTFS's planConnection #6239

Open
leonardehrenfried opened this issue Nov 7, 2024 · 0 comments
Open

Filters for GTFS's planConnection #6239

leonardehrenfried opened this issue Nov 7, 2024 · 0 comments

Comments

@leonardehrenfried
Copy link
Member

We met today to discuss the filter API for the planConnection query of the GTFS API.

We concluded that we want to keep the semantic structure of the the Transmodel API's filtering API. However, one crucial difference is that we want to ban the empty lists for all cases because we couldn't come up with a use case where it meant something different than null. This also keeps the door open to allowing it at a later stage (but the other way round is much harder).

The API schema from Transmodel is here:

"A collection of selectors for what lines/trips should be included in / excluded from search"
input TripFilterInput {
"A list of selectors for what lines/trips should be excluded during the search. If line/trip matches with at least one selector it will be excluded."
not: [TripFilterSelectInput!]
"A list of selectors for what lines/trips should be allowed during search. In order to be accepted a trip/line has to match with at least one selector. An empty list means that everything should be allowed. "
select: [TripFilterSelectInput!]
}
"A list of selectors for filter allow-list / exclude-list. An empty list means that everything is allowed. A trip/line will match with selectors if it matches with all non-empty lists. The `select` is always applied first, then `not`. If only `not` not is present, the exclude is applied to the existing set of lines. "
input TripFilterSelectInput {
"Set of ids for authorities that should be included in/excluded from search"
authorities: [ID!]
"Set of ids for group of lines that should be included in/excluded from the search"
groupOfLines: [ID!]
"Set of ids for lines that should be included in/excluded from search"
lines: [ID!]
"Set of ids for service journeys that should be included in/excluded from search"
serviceJourneys: [ID!]
"The allowed modes for the transit part of the trip. Use an empty list to disallow transit for this search. If the element is not present or null, it will default to all transport modes."
transportModes: [TransportModes!]
}

In the GTFS API we will not need groupOfLine, submodes or serviceJourneys.

Here is a sketch that @t2gran made during the meeting.

# [] => ban empty(GTFS) or mean nothing(Transmodel)  
# (select) minus (not)
filters: [
		# Union
  {
		  select : [
      # Union 
      {
        # Intersection
        authorities: [ 
           #Union
           "VY", "RUT" 
        ]
        lines : [
           "Line:A", "Line:B"
        ] 
        transportModes : [
          # Union
          {
            # Intersection
            transportMode : rail
            transportSubModes : [ local ]
          }
          {
            # Intersection
            transportMode : bus
          }
          {
            # Intersection
            transportMode : flex
            transportSubModes : [ flex_bus, flex_taxi ]
          }
        ]

      }
    ]      
    not : [
      # Union
    ]
	}
		# Union
  {
		  select : [
      # Union 
      {
        # Intersection
        authorities: [ 
           #Union
           "VY", "RUT" 
        ]
        lines : [
           "Line:A", "Line:B"
        ] 
        transportMode : [ bus ]
        transportSubModes : [ localRail ]
      }
    ]      
    not : [
      # Union
    ]
	}
  # Except airportRail
  {
		  not : [
      # Union 
      {
        transportModes : [
          # Union
          {
            # Intersection
            transportSubModes : [ airportLinkRail ]
          }
        ]

      }
    ]      
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant