Skip to content

Commit 3da3ae3

Browse files
author
tiffanychu90
committed
shared_utils to calitp_data_analysis for quarterly_performance_objective/
1 parent 888c473 commit 3da3ae3

10 files changed

+23
-20
lines changed

quarterly_performance_objective/A1_scheduled_route_level_df.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
from loguru import logger
1414
from typing import Literal
1515

16-
from shared_utils import geography_utils, utils
16+
from calitp_data_analysis import geography_utils, utils
17+
from shared_utils import portfolio_utils
1718
from bus_service_utils import create_parallel_corridors
1819
from segment_speed_utils import helpers, gtfs_schedule_wrangling
1920
from update_vars import (BUS_SERVICE_GCS, COMPILED_CACHED_GCS,
@@ -72,7 +73,7 @@ def aggregate_trip_service_to_route_level(
7273
get_pandas = True
7374
)
7475

75-
route_service_hours = geography_utils.aggregate_by_geography(
76+
route_service_hours = portfolio_utils.aggregate_by_geography(
7677
trips,
7778
group_cols = route_cols,
7879
sum_cols = ["service_hours"]

quarterly_performance_objective/A2_generate_routes_on_shn_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from loguru import logger
1010

1111
from bus_service_utils import create_parallel_corridors
12-
from shared_utils import geography_utils
12+
from calitp_data_analysis import geography_utils
1313
from update_vars import (BUS_SERVICE_GCS,
1414
ANALYSIS_DATE, VERSION)
1515

quarterly_performance_objective/A3_categorize_routes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from loguru import logger
1111

12-
from shared_utils import geography_utils, utils
12+
from calitp_data_analysis import geography_utils, utils
1313
from update_vars import (BUS_SERVICE_GCS,
1414
ANALYSIS_DATE, VERSION)
1515

quarterly_performance_objective/B2_route_service_hours_delay.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from update_vars import (BUS_SERVICE_GCS, COMPILED_CACHED_GCS,
1313
ANALYSIS_DATE, VERSION
1414
)
15-
from shared_utils import geography_utils, utils
15+
from shared_utils import portfolio_utils
16+
from calitp_data_analysis import utils
1617

1718
def calculate_route_level_delays(selected_date: str,
1819
route_cols: list) -> pd.DataFrame:
@@ -28,7 +29,7 @@ def calculate_route_level_delays(selected_date: str,
2829
delay_df2 = delay_df.drop_duplicates(
2930
subset=route_cols + ["trip_id"])
3031

31-
route_delay = geography_utils.aggregate_by_geography(
32+
route_delay = portfolio_utils.aggregate_by_geography(
3233
delay_df2,
3334
group_cols = route_cols,
3435
sum_cols = ["delay_seconds"]

quarterly_performance_objective/C1_report_metrics.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from typing import Literal
1313

14-
from shared_utils import geography_utils
14+
from shared_utils import portfolio_utils
1515

1616
catalog = intake.open_catalog("*.yml")
1717

@@ -22,7 +22,7 @@ def aggregate_calculate_percent_and_average(
2222
"""
2323
Create columns with pct values.
2424
"""
25-
agg_df = geography_utils.aggregate_by_geography(
25+
agg_df = portfolio_utils.aggregate_by_geography(
2626
df,
2727
group_cols = group_cols,
2828
sum_cols = sum_cols,

quarterly_performance_objective/C2_report_charts.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
from typing import List, Literal
55

6-
from shared_utils import styleguide
7-
from shared_utils import calitp_color_palette as cp
6+
from calitp_data_analysis import styleguide
7+
from calitp_data_analysis import calitp_color_palette as cp
88

99
def base_bar(df: pd.DataFrame, x_col: str) -> alt.Chart:
1010
chart = (alt.Chart(df)

quarterly_performance_objective/check-route-categories.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@
337337
"name": "python",
338338
"nbconvert_exporter": "python",
339339
"pygments_lexer": "ipython3",
340-
"version": "3.10.5"
340+
"version": "3.9.13"
341341
}
342342
},
343343
"nbformat": 4,

quarterly_performance_objective/current_quarter_report.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
"import C1_report_metrics as report_metrics\n",
4747
"import C2_report_charts as report_charts\n",
4848
"from update_vars import BUS_SERVICE_GCS, CURRENT_QUARTER, ANALYSIS_DATE\n",
49-
"from shared_utils import geography_utils, portfolio_utils, rt_dates\n",
50-
"from shared_utils import calitp_color_palette as cp\n",
51-
"from shared_utils import styleguide\n",
49+
"from shared_utils import portfolio_utils, rt_dates\n",
50+
"from calitp_data_analysis import calitp_color_palette as cp\n",
51+
"from calitp_data_analysis import styleguide\n",
5252
"\n",
5353
"hq_catalog = intake.open_catalog(\"../high_quality_transit_areas/*.yml\")"
5454
]
@@ -114,7 +114,7 @@
114114
"metadata": {},
115115
"outputs": [],
116116
"source": [
117-
"all_hours = geography_utils.aggregate_by_geography(\n",
117+
"all_hours = portfolio_utils.aggregate_by_geography(\n",
118118
" summary.assign(category=\"All\"),\n",
119119
" group_cols = [\"category\"],\n",
120120
" sum_cols = [\"unique_route\", \"service_hours\"]\n",

quarterly_performance_objective/download_trips_v2_backfill.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
from loguru import logger
1616

1717
from shared_utils import (gtfs_utils_v2, gtfs_utils,
18-
rt_dates, utils, geography_utils)
18+
rt_dates)
19+
from calitp_data_analysis import utils, geography_utils
1920
from update_vars import COMPILED_CACHED_GCS
2021

2122
def scheduled_operators(analysis_date: str):

quarterly_performance_objective/historical_report.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
"import pandas as pd\n",
3939
"\n",
4040
"import C1_report_metrics as report_metrics\n",
41-
"from shared_utils import rt_dates, geography_utils\n",
42-
"from shared_utils import calitp_color_palette as cp\n",
43-
"from shared_utils import styleguide\n",
41+
"from shared_utils import rt_dates, portfolio_utils\n",
42+
"from calitp_data_analysis import calitp_color_palette as cp\n",
43+
"from calitp_data_analysis import styleguide\n",
4444
"from bus_service_utils import chart_utils"
4545
]
4646
},
@@ -72,7 +72,7 @@
7272
"\n",
7373
" group_cols = [\"year_quarter\", \"service_date\", \"year\", \"quarter\"]\n",
7474
"\n",
75-
" all_routes = geography_utils.aggregate_by_geography(\n",
75+
" all_routes = portfolio_utils.aggregate_by_geography(\n",
7676
" df[df.variable.isin(var_list)],\n",
7777
" group_cols + [\"variable\"],\n",
7878
" sum_cols = [\"value\"]\n",

0 commit comments

Comments
 (0)