Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.time.LocalDate;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.opentripplanner.apis.transmodel.mapping.OccupancyStatusMapper;
import org.opentripplanner.apis.transmodel.model.EnumTypes;
Expand Down Expand Up @@ -259,6 +260,21 @@ public static GraphQLObjectType create(
.dataFetcher(environment -> ((TripTimeOnDate) environment.getSource()).getServiceDay())
.build()
)
.field(
GraphQLFieldDefinition.newFieldDefinition()
.name("serviceJourneyEstimatedCalls")
.type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(REF))))
.description("All estimated calls for the ServiceJourney on this date.")
.dataFetcher(environment -> {
return GqlUtil.getTransitService(environment)
.findTripTimesOnDate(
environment.<TripTimeOnDate>getSource().getTrip(),
environment.<TripTimeOnDate>getSource().getServiceDay()
)
.orElse(List.of());
})
.build()
)
.field(
GraphQLFieldDefinition.newFieldDefinition()
.name("serviceJourney")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ type EstimatedCall {
"Whether vehicle will only stop on request."
requestStop: Boolean!
serviceJourney: ServiceJourney!
"All estimated calls for the ServiceJourney on this date."
serviceJourneyEstimatedCalls: [EstimatedCall!]!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not make sense to return the ServiceJourney on a specific day? I see that you already have a field for the DatedServiceJourney which does something similar.

(I don't know if you already have a type for this in the schema...)

Copy link
Contributor Author

@lassetyr lassetyr Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose to add this as serviceJourneyEstimatedCalls because a field with the same name, type and functionality already exists in leg for a similar purpose.
(https://github.com/opentripplanner/OpenTripPlanner/blob/dev-2.x/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql#L388)

For a ServiceJourney on a specific day, the only part that is dependent on the operating-date will be the estimatedCalls-part.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see something like this:

serviceJourneyEstimatedCalls : SJEstimatedCalls!

type SJEstimatedCalls {
  first : EstimatedCall
  last : EstimatedCall
  next(antall : Int) : [EstimatedCall!]!
  previous(antall : Int) : [EstimatedCall!]!
}

"Get all relevant situations for this EstimatedCall."
situations: [PtSituationElement!]! @timingData
stopPositionInPattern: Int!
Expand Down
Loading