Skip to content

Commit

Permalink
Updated README with CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
npanuhin committed Dec 9, 2024
1 parent d0dee21 commit 96e668d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ jobs:
python3 scripts/convert.py
- name: Run tests
working-directory: build
run: |
ctest -V --output-on-failure
ctest --test-dir build -V --output-on-failure
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,40 @@ cmake --build build --parallel

## Running

Running the project consists of two steps:
Running the project consists of three steps:

1. First we need to prepare the data:
```bash
python3 scripts/convert.py
```

2. TODO: ещё не понятно, что запускать
<!-- 2. Now we run the main program:
2. We can now choose a city from the `data` folder and run the program. For example, let's choose Hamburg (GTFS folder: `data/gtfs_hamburg`):
```bash
./build/sdt-navigator
``` -->
./build/sdt-navigator gtfs_hamburg
```

3. When the application is loaded, we can search for routes between two stops. For example, let's find a route between the "Bremen Hbf" and "Hamburg Airport (Flughafen)":
```bash
$ ./build/sdt-navigator gtfs_hamburg
Loading transport system from directory "gtfs_hamburg"...
Transport system loaded

[SDT Navigator]$ route --start "Bremen Hbf" --end "Hamburg Airport (Flughafen)" --date 2024-03-20 --time 6:00
Journey from Bremen Hbf to Hamburg Airport (Flughafen)
Fri Mar 20 00:15:00 2020 - Fri Mar 20 04:09:00 2020

RAIL RB41
Bremen Hbf -> Hamburg Hbf
Fri Mar 20 00:15:00 2020 - Fri Mar 20 01:44:00 2020

RAIL S1
Hamburg Hbf -> Sülldorf
Fri Mar 20 02:38:00 2020 - Fri Mar 20 03:11:00 2020

RAIL S1
Sülldorf -> Hamburg Airport (Flughafen)
Fri Mar 20 03:11:00 2020 - Fri Mar 20 04:09:00 2020
```

## Testing

Expand All @@ -62,7 +84,7 @@ Tests are [automatically run by GitHub Actions](../../actions). To run them loca

2. Run the tests:
```bash
ctest -V --output-on-failure
ctest --test-dir build -V --output-on-failure
```

## License
Expand Down
4 changes: 2 additions & 2 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void handleRouteCommand(const sdtmaps::TransportSystem &transportSystem, std::ve

int main(int argc, char** argv) {
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationName("MNS");
QCoreApplication::setApplicationName("SDT Navigator");
QCoreApplication::setApplicationVersion("1.0");
QCommandLineParser parser;
parser.addVersionOption();
Expand All @@ -85,7 +85,7 @@ int main(int argc, char** argv) {
}

std::string input;
cout << "[" + QCoreApplication::applicationName() + "]$ " << Qt::flush;
cout << "\n[" + QCoreApplication::applicationName() + "]$ " << Qt::flush;
while (std::getline(std::cin, input)) {
std::vector<std::string> args = CLI::detail::split_up(input);
if (args.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion models/src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ DateTime Ride::endTime() const {
}

std::map<int, QString> routeTypeNames = {
{0, "TRAM"},
{0, "TRAM"},
{1, "SUBWAY"},
{2, "RAIL"},
{3, "BUS"},
Expand Down
8 changes: 1 addition & 7 deletions scripts/src/convert_trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,7 @@ def convert_trips(raw_data_path: str, data_path: str, data_date: date):
route_name = ''
print(f'Route {row.route_id} has no name')

route_type = row.route_type
if route_type == 109:
route_type = 2

assert route_type in (0, 1, 2, 3, 4, 5, 6, 7, 11, 12), f'Route {row.route_id} has unknown type {route_type}'

route_data_by_id[row.route_id] = (route_name, route_type)
route_data_by_id[row.route_id] = (route_name, row.route_type)

print(f'Splitting similar trips in each route...')

Expand Down

0 comments on commit 96e668d

Please sign in to comment.