Skip to content

Commit

Permalink
Added two more cities
Browse files Browse the repository at this point in the history
  • Loading branch information
npanuhin committed Dec 9, 2024
1 parent 3f49228 commit c8b2d2c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
Binary file added data/raw/gtfs_milan.zip
Binary file not shown.
Binary file added data/raw/gtfs_stockholm.zip
Binary file not shown.
6 changes: 6 additions & 0 deletions scripts/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
SELECTED_DATASET = {} # {user_id: dataset_name}


def parse_message(message: str) -> str:
return message.replace('—', '--')


def run_command(dataset: str, command: str) -> str:
print(f'Running command: {command}')
result = ""
Expand Down Expand Up @@ -99,6 +103,8 @@ def route_command(message):

user_input = message.text.strip().removeprefix('/')

user_input = parse_message(user_input)

result = run_command(SELECTED_DATASET[message.chat.id], user_input)

bot.send_message(message.chat.id, result)
Expand Down
5 changes: 3 additions & 2 deletions scripts/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@

cities = [
('hamburg', date(2020, 3, 20)), # GTFS data date: 20 March 2020
# ('rome', date(2020, 3, 24)), # GTFS data date: 24 March 2020
('paris', date(2021, 3, 25)) # GTFS data date: 25 March 2021
('milan', date(2021, 9, 8)), # GTFS data date: 8 September 2021
('paris', date(2021, 3, 25)), # GTFS data date: 25 March 2021
('stockholm', date(2020, 2, 24)), # GTFS data date: 24 February 2020
]

# ====================================================== Settings ======================================================
Expand Down
4 changes: 2 additions & 2 deletions scripts/src/convert_trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
}
TRIPS_COLUMNS = {
'route_id': str,
'trip_id': 'int64'
'trip_id': str
}
STOP_TIMES_COLUMNS = {
'trip_id': 'int64',
'trip_id': str,
'stop_id': str,
'arrival_time': str,
'departure_time': str,
Expand Down
14 changes: 14 additions & 0 deletions test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ TEST_CASE("Pathfinder test") {
).check();
}
}

SUBCASE("Milan") {
TransportSystem milan(QDir(PROJECT_ROOT_PATH "/data/gtfs_milan"));
QDate milanDate(2020, 03, 24);

REQUIRE(milan.isValid());
}

SUBCASE("Stockholm") {
TransportSystem stockholm(QDir(PROJECT_ROOT_PATH "/data/gtfs_stockholm"));
QDate stockholmDate(2020, 03, 24);

REQUIRE(stockholm.isValid());
}
}

TEST_CASE("Substring find test") {
Expand Down

0 comments on commit c8b2d2c

Please sign in to comment.