Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev-2.x' into upstream-merge-2…
Browse files Browse the repository at this point in the history
…023-10-20
  • Loading branch information
leonardehrenfried committed Oct 20, 2023
2 parents ec48631 + 0c97ab9 commit 2539af7
Show file tree
Hide file tree
Showing 127 changed files with 3,503 additions and 1,294 deletions.
15 changes: 11 additions & 4 deletions ISSUE_TEMPLATE → .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
---
name: Bug report
about: Report a bug or issue
title: ''
labels: ''
assignees: ''

---

**NOTE:** this issue system is intended for reporting bugs and tracking progress in software
development. For all other usage and software development questions or discussion, please write to
the user mailing list(https://groups.google.com/forum/#!forum/opentripplanner-users) or post a
question in the developer chat: https://gitter.im/opentripplanner/OpenTripPlanner.
development. For all other usage and software development questions or discussion, please post a
question in our chat room: https://gitter.im/opentripplanner/OpenTripPlanner.


## Expected behavior
Expand All @@ -17,4 +25,3 @@ question in the developer chat: https://gitter.im/opentripplanner/OpenTripPlanne
## Router config and graph build config JSON

## Steps to reproduce the problem

24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest a feature or improvement for OTP
title: ''
labels: new feature
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Goal / high level use-case**
<!-- Describe the the goal, high level use-case or epic this is is part of. Link to roadmap epic -->
<!-- Roadmap: #1234 -->

**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/roadmap_epic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Roadmap Epic
about: Suggest an idea for the Roadmap
title: ''
labels: Roadmap
assignees: ''

---

### Describe expected behavior:
- What: <!-- Clearly state what the desired changes or new features could look like. -->
- Why: <!-- Clearly state the effect/outcome of this change. -->
- When: <!-- Provide a timeline or timeframe for when these changes should be implemented, preferably on a quarterly basis (e.g., Y24 Q3). -->

### Linked issue(s)
<!-- Add a checkbox by typing “- [] ”. Then, link to an issue by typing “#” and searching for the issue by text or issue number, or create a new issue. -->

### OTP PO Discussion meeting details:
- Date: <!-- Specify the date when the discussion meeting took place. -->
- Link(s): <!-- Provide a link or location where the discussion notes or details can be found. This could be a meeting link or another document. -->

### Extra Comments (Optional)
3 changes: 3 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle
- Fix fare calculation for combined interlined legs [#5408](https://github.com/opentripplanner/OpenTripPlanner/pull/5408)
- Fix board slack list mapping in Transmodel API [#5420](https://github.com/opentripplanner/OpenTripPlanner/pull/5420)
- Fix flexible quay querying in Transmodel API [#5417](https://github.com/opentripplanner/OpenTripPlanner/pull/5417)
- Add validation for missing calls in SIRI update [#5403](https://github.com/opentripplanner/OpenTripPlanner/pull/5403)
- Import Occupancy Status from GTFS-RT Vehicle Positions [#5372](https://github.com/opentripplanner/OpenTripPlanner/pull/5372)
- Add Roadmap epic template [#5413](https://github.com/opentripplanner/OpenTripPlanner/pull/5413)
[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE)

## 2.4.0 (2023-09-13)
Expand Down
6 changes: 5 additions & 1 deletion docs/RouterConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,11 @@ Used to group requests when monitoring OTP.
"frequency" : "1m",
"headers" : {
"Header-Name" : "Header-Value"
}
},
"fuzzyTripMatching" : false,
"features" : [
"position"
]
},
{
"type" : "websocket-gtfs-rt-updater"
Expand Down
30 changes: 22 additions & 8 deletions docs/UpdaterConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,27 @@ The information is downloaded in a single HTTP request and polled regularly.
<!-- vehicle-positions BEGIN -->
<!-- NOTE! This section is auto-generated. Do not change, change doc in code instead. -->

| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since |
|----------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:|
| type = "vehicle-positions" | `enum` | The type of the updater. | *Required* | | 1.5 |
| feedId | `string` | Feed ID to which the update should be applied. | *Required* | | 2.2 |
| frequency | `duration` | How often the positions should be updated. | *Optional* | `"PT1M"` | 2.2 |
| url | `uri` | The URL of GTFS-RT protobuf HTTP resource to download the positions from. | *Required* | | 2.2 |
| [headers](#u__6__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 |
| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since |
|-----------------------------|:---------------:|----------------------------------------------------------------------------|:----------:|---------------|:-----:|
| type = "vehicle-positions" | `enum` | The type of the updater. | *Required* | | 1.5 |
| feedId | `string` | Feed ID to which the update should be applied. | *Required* | | 2.2 |
| frequency | `duration` | How often the positions should be updated. | *Optional* | `"PT1M"` | 2.2 |
| fuzzyTripMatching | `boolean` | Whether to match trips fuzzily. | *Optional* | `false` | 2.5 |
| url | `uri` | The URL of GTFS-RT protobuf HTTP resource to download the positions from. | *Required* | | 2.2 |
| [features](#u__6__features) | `enum set` | Which features of GTFS RT vehicle positions should be loaded into OTP. | *Optional* | | 2.5 |
| [headers](#u__6__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.3 |


##### Parameter details

<h4 id="u__6__features">features</h4>

**Since version:** `2.5`**Type:** `enum set`**Cardinality:** `Optional`
**Path:** /updaters/[6]
**Enum values:** `position` | `stop-position` | `occupancy`

Which features of GTFS RT vehicle positions should be loaded into OTP.

<h4 id="u__6__headers">headers</h4>

**Since version:** `2.3`**Type:** `map of string`**Cardinality:** `Optional`
Expand All @@ -256,7 +266,11 @@ HTTP headers to add to the request. Any header key, value can be inserted.
"frequency" : "1m",
"headers" : {
"Header-Name" : "Header-Value"
}
},
"fuzzyTripMatching" : false,
"features" : [
"position"
]
}
]
}
Expand Down
1 change: 0 additions & 1 deletion docs/sandbox/GeocoderAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ It supports the following URL parameters:
| `autocomplete` | Whether we should use the query string to do a prefix match |
| `stops` | Search for stops, either by name or stop code |
| `clusters` | Search for clusters by their name |
| `corners` | Search for street corners using at least one of the street names |

#### Stop clusters

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<version>0.8.11</version>
</plugin>
<plugin>
<!-- Get current Git commit information for use in MavenVersion class.
Expand Down Expand Up @@ -913,7 +913,7 @@
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>21.1</version>
<version>21.2</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package org.opentripplanner.ext.geocoder;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.junit.jupiter.api.Test;

class EnglishNgramAnalyzerTest {

@Test
void ngram() throws IOException {
var analyzer = new EnglishNGramAnalyzer();
List<String> result = analyze("Alexanderplatz", analyzer);

//System.out.println(result.stream().collect(Collectors.joining("\",\"", "\"", "\"")));
assertEquals(
List.of(
"Alex",
"Alexa",
"Alexan",
"Alexand",
"Alexande",
"Alexander",
"Alexanderp",
"lexa",
"lexan",
"lexand",
"lexande",
"lexander",
"lexanderp",
"lexanderpl",
"exan",
"exand",
"exande",
"exander",
"exanderp",
"exanderpl",
"exanderpla",
"xand",
"xande",
"xander",
"xanderp",
"xanderpl",
"xanderpla",
"xanderplat",
"ande",
"ander",
"anderp",
"anderpl",
"anderpla",
"anderplat",
"anderplatz",
"nder",
"nderp",
"nderpl",
"nderpla",
"nderplat",
"nderplatz",
"derp",
"derpl",
"derpla",
"derplat",
"derplatz",
"erpl",
"erpla",
"erplat",
"erplatz",
"rpla",
"rplat",
"rplatz",
"plat",
"platz",
"latz",
"Alexanderplatz"
),
result
);
}

public List<String> analyze(String text, Analyzer analyzer) throws IOException {
List<String> result = new ArrayList<>();
TokenStream tokenStream = analyzer.tokenStream("name", text);
CharTermAttribute attr = tokenStream.addAttribute(CharTermAttribute.class);
tokenStream.reset();
while (tokenStream.incrementToken()) {
result.add(attr.toString());
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.transit.model.basic.TransitMode;
import org.opentripplanner.transit.model.framework.Deduplicator;
import org.opentripplanner.transit.model.site.RegularStop;
Expand All @@ -29,8 +28,6 @@

class LuceneIndexTest {

static Graph graph = new Graph();

// Berlin
static Station BERLIN_HAUPTBAHNHOF_STATION = station("Hauptbahnhof")
.withCoordinate(52.52495, 13.36952)
Expand Down Expand Up @@ -113,7 +110,7 @@ public List<TransitMode> getModesOfStopLocation(StopLocation stop) {
}
}
};
index = new LuceneIndex(graph, transitService);
index = new LuceneIndex(transitService);
mapper = new StopClusterMapper(transitService);
}

Expand Down Expand Up @@ -145,9 +142,29 @@ void stopLocationGroupsWithSpace() {
@Nested
class StopClusters {

@Test
void stopClusters() {
var result1 = index.queryStopClusters("alex").toList();
@ParameterizedTest
@ValueSource(
strings = {
"Alexanderplatz",
"Alexa",
"alex",
"aleyanderplazt",
"alexnderplazt",
"Alexnderplatz",
"Alexnaderplatz",
"xande",
"xanderpla",
"alexnaderplaz",
"Alexanderplat",
"alexanderplat",
"alexand",
"alexander platz",
"alexander-platz",
"alexander",
}
)
void stopClustersWithTypos(String searchTerm) {
var result1 = index.queryStopClusters(searchTerm).toList();
assertEquals(List.of(mapper.map(ALEXANDERPLATZ_STATION)), result1);
}

Expand All @@ -167,17 +184,40 @@ void deduplicatedStopClusters() {
@ParameterizedTest
@ValueSource(
strings = {
"five", "five ", "five p", "five po", "five poi", "five poin", "five point", "five points",
"five",
"five ",
"five p",
"five po",
"five poi",
"five poin",
"five point",
"five points",
"fife point",
"five poits",
"fife",
"points",
"ife points",
"the five points",
"five @ points",
"five @ the points",
"five@points",
"five at points",
"five&points",
"five & points",
"five and the points",
"points five",
"points fife",
}
)
void stopClustersWithSpace(String query) {
var result = index.queryStopClusters(query).toList();
assertEquals(List.of(mapper.map(FIVE_POINTS_STATION)), result);
}

@Test
void stopCode() {
var result = index.queryStopClusters(ARTS_CENTER.getCode()).toList();
@ParameterizedTest
@ValueSource(strings = { "4456", "445" })
void fuzzyStopCode(String query) {
var result = index.queryStopClusters(query).toList();
assertEquals(1, result.size());
assertEquals(ARTS_CENTER.getName().toString(), result.get(0).name());
}
Expand Down
Loading

0 comments on commit 2539af7

Please sign in to comment.