Skip to content

Commit

Permalink
Merge pull request #1302 from cal-itp/remove-quarterly-performance-po…
Browse files Browse the repository at this point in the history
…rtfolio

Remove `quarterly performance, atp, dla, competitive_corridors` portfolio
  • Loading branch information
tiffanychu90 authored Nov 22, 2024
2 parents f62b150 + 40562b7 commit a9d40b3
Show file tree
Hide file tree
Showing 81 changed files with 170 additions and 874 deletions.
36 changes: 11 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build_portfolio_site:
#git rm portfolio/$(site)/ -rf
python portfolio/portfolio.py clean $(site)
python portfolio/portfolio.py build $(site) --deploy
git add portfolio/$(site)/*.yml portfolio/$(site)/*.md
python portfolio/portfolio.py clean $(site)
git add portfolio/sites/$(site).yml
#make production_portfolio

Expand All @@ -16,24 +16,17 @@ git_check_sections:

git_check_no_sections:
git add portfolio/$(site)/district_*/*.ipynb # this one less common, but it's district pages only

build_competitive_corridors:
$(eval export site = competitive_corridors)
cd bus_service_increase/ && make setup_bus_service_utils && cd ..
python bus_service_increase/deploy_portfolio_yaml.py
make build_portfolio_site
#--config=./portfolio/test-analyses.yml

build_dla_reports:
$(eval export site = dla)
cd dla/ && pip install -r requirements.txt && cd ..
make build_portfolio_site
git add portfolio/dla/district_*/
build_quarterly_performance_metrics:
$(eval export site = quarterly_performance_metrics)
cd bus_service_increase/ && make setup_bus_service_utils && cd ..
make build_portfolio_site
remove_portfolio_site:
python portfolio/portfolio.py clean $(site)
git rm portfolio/sites/$(site).yml
git rm portfolio/$(site)/ -rf


remove_competitive_corridors:
$(eval export site = competitive_corridors)
make remove_portfolio_site


build_ntd_report:
$(eval export site = ntd_monthly_ridership)
Expand All @@ -47,13 +40,6 @@ build_gtfs_digest:
#cd gtfs_digest/ && python deploy_portfolio_yaml.py && make assemble_data && cd ..
make build_portfolio_site
make git_check_sections


build_gtfs_digest_testing:
$(eval export site = gtfs_digest_testing)
#cd data-analyses/rt_segment_speeds && pip install -r requirements.txt && cd ../_shared_utils && make setup_env && cd ..
#cd gtfs_digest/ && make assemble_data && cd ..
make build_portfolio_site

build_district_digest:
$(eval export site = district_digest)
Expand Down
11 changes: 7 additions & 4 deletions _shared_utils/shared_utils/portfolio_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def create_portfolio_yaml_chapters_no_sections(portfolio_site_yaml: Path, chapte
with open(portfolio_site_yaml) as f:
site_yaml_dict = yaml.load(f, yaml.Loader)

chapters_list = [{**{"params": {chapter_name: one_chapter_value}}} for one_chapter_value in chapter_values]
chapters_list = [{**{"params": {chapter_name: str(one_chapter_value)}}} for one_chapter_value in chapter_values]

# Make this into a list item
parts_list = [{"caption": "Introduction"}, {"chapters": chapters_list}]
Expand Down Expand Up @@ -129,13 +129,16 @@ def create_portfolio_yaml_chapters_with_sections(

# Loop through each chapter (district), grab the sections (operators)
section_col = section_info["column"]
caption_prefix = chapter_info["caption_prefix"]
caption_suffix = chapter_info["caption_suffix"]

chapters_list = [
{
**{
"caption": {chapter_info["name"]: f"{one_chapter_value}"},
"params": {chapter_info["name"]: one_chapter_value},
"caption": {chapter_info["name"]: f"{caption_prefix}{one_chapter_value}{caption_suffix}"},
"params": {chapter_info["name"]: str(one_chapter_value)},
"sections": [
{section_info["name"]: one_section_value}
{section_info["name"]: str(one_section_value)}
for one_section_value in df[df[chapter_col] == one_chapter_value][section_col].unique().tolist()
],
}
Expand Down
7 changes: 5 additions & 2 deletions gtfs_digest/deploy_district_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ def overwrite_yaml(
df = pd.read_parquet(
f"{RT_SCHED_GCS}{OPERATOR_FILE}.parquet",
columns = ["caltrans_district"]
).dropna("caltrans_district").drop_duplicates()
).dropna(subset="caltrans_district").drop_duplicates()

chapter_values_orig = sorted(list(df.caltrans_district))
chapter_values = [f"District {i}" for i in chapter_values_orig]

portfolio_utils.create_portfolio_yaml_chapters_no_sections(
DISTRICT_SITE,
chapter_name = "district",
chapter_values = sorted(list(df.caltrans_district))
chapter_values = chapter_values
)

elif name == "legislative_district":
Expand Down
36 changes: 16 additions & 20 deletions gtfs_digest/deploy_portfolio_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,20 @@

SITE_YML = "../portfolio/sites/gtfs_digest.yml"

df = operators_schd_vp_rt()
if __name__ == "__main__":
df = operators_schd_vp_rt()

portfolio_utils.create_portfolio_yaml_chapters_with_sections(
SITE_YML,
df,
chapter_info = {
"column": "caltrans_district",
"name": "district",
"caption_prefix": "District ",
"caption_suffix": "",
},
section_info = {
"column": "organization_name",
"name": "organization_name",
},
)

with open(SITE_YML) as f:
site_yaml = yaml.safe_load(f)

site_yaml
portfolio_utils.create_portfolio_yaml_chapters_with_sections(
SITE_YML,
df,
chapter_info = {
"column": "caltrans_district",
"name": "district",
"caption_prefix": "District ",
"caption_suffix": "",
},
section_info = {
"column": "organization_name",
"name": "organization_name",
},
)
3 changes: 0 additions & 3 deletions portfolio/ahsc/0__empty_nb__.ipynb

This file was deleted.

47 changes: 0 additions & 47 deletions portfolio/ahsc/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions portfolio/ahsc/_config.yml

This file was deleted.

6 changes: 0 additions & 6 deletions portfolio/ahsc/_toc.yml

This file was deleted.

5 changes: 0 additions & 5 deletions portfolio/atp/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions portfolio/atp/_config.yml

This file was deleted.

6 changes: 0 additions & 6 deletions portfolio/atp/_toc.yml

This file was deleted.

51 changes: 0 additions & 51 deletions portfolio/competitive_corridors/README.md

This file was deleted.

Loading

0 comments on commit a9d40b3

Please sign in to comment.