Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,168 changes: 50 additions & 1,118 deletions ntd/annual_ridership_report/annual_ridership_report.ipynb

Large diffs are not rendered by default.

24 changes: 7 additions & 17 deletions ntd/annual_ridership_report/deploy_portfolio_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,21 @@
sys.path.append("../") # up one level

from pathlib import Path

from calitp_data_analysis.tables import tbls
import pandas as pd
from shared_utils import portfolio_utils
from siuba import _, collect, filter, select, show_query
from update_vars import GCS_FILE_PATH
from annual_ridership_module import ntd_id_to_rtpa_crosswalk

PORTFOLIO_SITE_YAML = Path("../../portfolio/sites/ntd_annual_ridership_report.yml")

# read in rtpa data from dim_orgs
if __name__ == "__main__":
df = (
(
tbls.mart_transit_database.dim_organizations()
>> filter(
_._is_current == True,
# _.ntd_id_2022.notna(),
_.rtpa_name.notna(),
)
>> select(_.name, _.ntd_id_2022, _.rtpa_name, _.mpo_name)
>> collect()
)["rtpa_name"]
.sort_values()
.drop_duplicates()
.reset_index(drop=True)
)

df = ntd_id_to_rtpa_crosswalk(split_scag=True)["rtpa_name"].drop_duplicates().to_frame()
# add row for LADPW
ladpw= pd.DataFrame({"rtpa_name":["Los Angeles County Department of Public Works"]})
df = pd.concat([df, ladpw], ignore_index=True).sort_values(by="rtpa_name")
portfolio_utils.create_portfolio_yaml_chapters_no_sections(
PORTFOLIO_SITE_YAML, chapter_name="rtpa", chapter_values=list(df.rtpa_name)
)
Loading
Loading