-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from ttan06/tim_branch_test
Adding Tests and Additional Documentation
- Loading branch information
Showing
13 changed files
with
496 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Data | ||
|
||
## MLB Schedule | ||
|
||
For more details and to refresh the schedule for a future season, visit the notebook 'Schedule Scraping.ipynb' in the notebooks section of this repository. | ||
|
||
The MLB schedule dataset used by the app is 'final_mlb_schedule.csv' which contains nearly 3000 rows, each with the details of a game, including the teams, date, time, and coordinates of the stadium. | ||
|
||
## Cost Matrix | ||
|
||
The cost matrix is a csv 'cost_df.csv', which is created by running the following: | ||
|
||
```commandline | ||
python -m data.create_cost_matrix | ||
``` | ||
|
||
### Description | ||
It is 900 rows, with a from and to location, the cost of the trip, and the locations. | ||
The intended usage is to pull the route of from and to locations, and the "fare" column, which is based on cost and time. | ||
|
||
### Acquisition | ||
The script uses the file 'team_airport_key.csv', which is a mapping of the team stadium to the closest major airport. | ||
|
||
It also uses the file 'Consumer_Airfare_Report__Table_6_-_Contiguous_State_City-Pair_Markets_That_Average_At_Least_10_Passengers_Per_Day_20240309.csv' | ||
|
||
This file is obtained from the [Consumer Airfare Report](https://data.transportation.gov/Aviation/Consumer-Airfare-Report-Table-6-Contiguous-State-C/yj5y-b2ir/data). Since this downloaded csv is quite large, it is not included in the repository and must be downloaded prior to running the 'create_cost_matrix.py' file. | ||
|
||
### Other Details | ||
Since not every path between two teams has a flight, we fill in the missing cost data with a driving estimate. We use the average cost of a gallon of gas in 2023, which is $3.29 as of March 2024 [(Source)](https://www.finder.com/economics/gas-prices#:~:text=National%20average%3A%20The%20current%20national%20average%20cost,for%20gas%20is%20%243.23%20%28Feb.%2022%2C%202024%29%20%281%29). | ||
We also use the average miles per gallon, which was 36mpg [(Source)](https://www.caranddriver.com/research/a31518112/what-is-good-gas-milage/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
## Milestones | ||
|
||
Each section and subsection is listed in order of priority. | ||
|
||
### Data Processing | ||
* Scrape MLB schedule into table | ||
* Join home city coordinates to each game entry | ||
* Create distance matrix with average flight costs instead of distance | ||
1. Scrape MLB schedule into table | ||
2. Join home city coordinates to each game entry | ||
3. Create distance matrix with average flight costs instead of distance | ||
### User Interface | ||
* Decide on package or interface program | ||
* Create method for reading in user UI inputs and store as parameters | ||
* Method to display map on UI | ||
* Find way to host or create instructions on how to run UI | ||
1. Decide on package or interface program | ||
2. Create method for reading in user UI inputs and store as parameters | ||
3. Method to display map on UI | ||
4. Find way to host or create instructions on how to run UI | ||
### Schedule Creation | ||
* Method to check if user inputted parameters are legal | ||
* Method to create several potential routes ordered by optimality (lowest cost or distance) using python-tsp | ||
* Method to align routes with MLB schedule | ||
1. Method to check if user inputted parameters are legal | ||
2. Method to create potential routes | ||
3. Method to align routes with MLB schedule | ||
4. Method to order routes by user-chosen optimality | ||
### Map Creation | ||
* Method that takes in schedule and converts to graph | ||
* Method to visualize graph onto a US Map (Think about how to handle Toronto and international games) | ||
1. Method that takes in schedule and converts to graph | ||
2. Method to visualize graph onto a US Map (Think about how to handle Toronto and international games) | ||
3. Method to obtain additional information by hovering over graph (cost, coordinates) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Packages | ||
|
||
### Distance | ||
|
||
This file contains the functions used to calculate the distance between two points and build a distance matrix between several locations. | ||
|
||
### Search | ||
|
||
This file contains the functions used to create a schedule based on the desired teams and dates, optimized by cost, time or distance. | ||
|
||
![](../docs/images/schedule_builder_pipeline.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Baseball Stadium Travels | ||
|
||
## Testing | ||
|
||
This directory contains the test files for the baseball stadium travels project. | ||
|
||
|
||
### Unit Tests | ||
To run the unit tests for search and distance, run the following: | ||
|
||
```commandline | ||
python -m tests.test_search | ||
python -m tests.test_distance | ||
``` | ||
|
||
### Coverage | ||
|
||
To run the coverage tests, run: | ||
|
||
```commandline | ||
pip install coverage | ||
python -m coverage run -m unittest discover | ||
python -m coverage report | ||
``` | ||
|
||
#### Last Results | ||
|
||
![](../docs/images/Coverage_Test.png) | ||
|
Oops, something went wrong.