Skip to content

Commit 5f922c7

Browse files
committed
deploy district digest to text index
1 parent f7d1a7d commit 5f922c7

17 files changed

+63
-35
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,6 @@ dmypy.json
137137

138138
# Macos
139139
.DS_Store
140+
141+
# Local Netlify folder
142+
.netlify

Makefile

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ build_portfolio_site:
77
#git rm portfolio/$(site)/ -rf
88
python portfolio/portfolio.py clean $(site)
99
python portfolio/portfolio.py build $(site) --deploy
10-
python portfolio/portfolio.py clean $(site)
1110
git add portfolio/sites/$(site).yml
1211
#make production_portfolio
1312

@@ -36,21 +35,21 @@ build_ntd_report:
3635

3736
build_gtfs_digest:
3837
$(eval export site = gtfs_digest)
39-
#cd data-analyses/rt_segment_speeds && pip install -r requirements.txt && cd ../_shared_utils && make setup_env && cd ..
38+
#cd rt_segment_speeds && pip install -r requirements.txt && cd ../_shared_utils && make setup_env && cd ..
4039
#cd gtfs_digest/ && python deploy_portfolio_yaml.py && make assemble_data && cd ..
4140
make build_portfolio_site
4241
make git_check_sections
4342

4443
build_district_digest:
4544
$(eval export site = district_digest)
46-
#cd data-analyses/rt_segment_speeds && pip install -r requirements.txt && cd ../_shared_utils && make setup_env && cd ..
47-
cd gtfs_digest/ && python deploy_district_yaml.py district && cd ..
45+
#cd rt_segment_speeds && pip install -r requirements.txt && cd ../_shared_utils && make setup_env && cd ..
46+
#cd gtfs_digest/ && python deploy_district_yaml.py district && cd ..
4847
make build_portfolio_site
4948
make git_check_no_sections
5049

5150
build_legislative_district_digest:
5251
$(eval export site = legislative_district_digest)
53-
#cd data-analyses/rt_segment_speeds && pip install -r requirements.txt && cd ../_shared_utils && make setup_env && cd ..
52+
#cd rt_segment_speeds && pip install -r requirements.txt && cd ../_shared_utils && make setup_env && cd ..
5453
cd gtfs_digest/ && python deploy_district_yaml.py legislative_district && cd ..
5554
make build_portfolio_site
5655
make git_check_no_sections

_shared_utils/requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ altair==5.3.0
33
altair-transform==0.2.0
44
gtfs-segments==0.1.0
55
pyairtable==2.2.2
6-
great_tables==0.6.1
6+
great_tables==0.14.0
77
omegaconf==2.3.0 # better yaml configuration
88
polars==0.20.29
99
quarto-cli==1.4.554
1010
quarto==0.1.0
11+
typing_extensions==4.12.2

gtfs_digest/_report_utils.py

+28
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pandas as pd
77
import yaml
88

9+
from great_tables import GT, loc, style
910

1011
def labeling(word: str) -> str:
1112
"""
@@ -107,3 +108,30 @@ def transpose_summary_stats(
107108
}).T.reset_index().rename(columns = {0: "value"})
108109

109110
return subset_df2
111+
112+
113+
def great_table_formatting(my_table: GT) -> GT:
114+
"""
115+
Common great table formatting needed for district
116+
and legislative district digest.
117+
"""
118+
my_table = (
119+
my_table
120+
.opt_align_table_header(align="center")
121+
.tab_style(
122+
style=style.text(size="14px"),
123+
locations=loc.body())
124+
.tab_options(
125+
container_width = "100%",
126+
table_background_color="white",
127+
table_body_hlines_style="none",
128+
table_body_vlines_style="none",
129+
heading_background_color="white",
130+
column_labels_background_color="white",
131+
row_group_background_color="white",
132+
stub_background_color="white",
133+
source_notes_background_color="white"
134+
)
135+
)
136+
137+
return my_table

gtfs_digest/deploy_district_yaml.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,11 @@ def overwrite_yaml(
4141
f"{RT_SCHED_GCS}{OPERATOR_FILE}.parquet",
4242
columns = ["caltrans_district"]
4343
).dropna(subset="caltrans_district").drop_duplicates()
44-
45-
chapter_values_orig = sorted(list(df.caltrans_district))
46-
chapter_values = [f"District {i}" for i in chapter_values_orig]
47-
44+
4845
portfolio_utils.create_portfolio_yaml_chapters_no_sections(
4946
DISTRICT_SITE,
5047
chapter_name = "district",
51-
chapter_values = chapter_values
48+
chapter_values = sorted(list(df.caltrans_district))
5249
)
5350

5451
elif name == "legislative_district":
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:2e905a0d6496ca4f3588a49b747e8ac9b1939073a198e96a0ccc7cf13bf75602
3-
size 2859811
2+
oid sha256:cf010a74ae17077dbfa2f0450b2abda6c456211d7b687fc184f90a01094cac7b
3+
size 3055005
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:553d19610d30f11f72b2aead18a04d5fda617b4840293ba6e8a26ab167f00955
3-
size 2207183
2+
oid sha256:b2128e7ef992890b9168f7ab1c8bfff7a8d13f1cf2e1cdadb5be0bb75505548a
3+
size 2194724
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:7c2db2af9befdf47628af65530bae2d8b07d899c3b1134b026b874d98e2b7696
3-
size 9090417
2+
oid sha256:e3f5a46f9247f17b47ce79968aa4b60046afa5bce639ad22f958425fd433cf61
3+
size 8955417
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:caf5003cdb7dcee60d41b8eb5d5250e777518e9360dda7248619e3f559fe9541
3-
size 22719969
2+
oid sha256:4632e60561af2904873a8c09af6de3bffddcbb743173f1d1e02295fa889baca9
3+
size 22801090
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:0d8d43843a95fe8868c48b22fc0955ce222b6bef568858b7e4f9f1f608fa36a0
3-
size 6519020
2+
oid sha256:6bd6f8c075efa735bff704cf57c954befa2c638e5c1fc834a3defef2efee4e22
3+
size 6769998
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:8bb11255a58bbc1777b3c6f60caf574528c48d6889a059ec4546f7f2c9a77bd9
3-
size 2433114
2+
oid sha256:e529d5deec6cf49776cf895c691f843e4185e718a1108a3069b78541617eb5ad
3+
size 2434792
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:ec9300c3cc8bed20e31589b1657a63462ebadd7eaeeb62575291d0265b0ad020
3-
size 17984333
2+
oid sha256:aea305d81c602e5a65d1c2878d64f82a81d8117faca512fae9f1fc93cd01d1f9
3+
size 20025268
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:6d4d669de890c28776f4030cdc55f672fae71978fa2a82e948d572c69afbb667
3-
size 10707876
2+
oid sha256:7eef5ebf531f63919b2b325500c325e0c8a784b40c43fe99d826f0fb05f07ba2
3+
size 11114016
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:8680e2178a6d2c901e3c3b7755a5eaf306cc38c9b3ea2d44e3a99a37ed803969
3-
size 526008
2+
oid sha256:930b68247c0d95fa6455e44101a4d0de46e224d6676db62099b6dab811862865
3+
size 522458
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:44c6d9a9e0ab2f4b1fe8e0d4afc0c06c705fb5934e4bba83ae0f9106596517e4
3-
size 4903262
2+
oid sha256:b5ef18b90f7f3cbeaefca874d80948b9f475bc1a2bff8ac5471cdf3252cae869
3+
size 4909406
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:6513a0b1c46934dab35a9d23679635ae878b795a3f8c19b88eaabda8e413ae6c
3-
size 2231960
2+
oid sha256:73ec8739e49b1c19c6ec5d8e01d3bbf9646816980c043fd426f5d5a2d53ee91f
3+
size 2232896
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:7284be367d43e58da244d801eeab676b35d7babd00e207ae15745ec24434943b
3-
size 1998531
2+
oid sha256:0a4d51b99cbaceab43cd09661fb3f516b3c49e68e9b6f8fd529dc71902852652
3+
size 1999012

0 commit comments

Comments
 (0)