Skip to content

Commit

Permalink
added secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik-Brown01 committed Nov 22, 2023
1 parent 4cf843f commit 6bf7f00
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/update_legislation_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ on:
jobs:
update-legislation-info:
runs-on: ubuntu-latest


env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LEGISLATION_INFO: ${{ secrets.LEGISLATION_INFO }}

steps:
- name: Check out repository
uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion scripts/legislation_info_generator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import pyairtable
import json
api = pyairtable.Api('patt3j0eKCfgvGLAl.b6233ad81bd1d9e1655704868e6fd8a6736d3f9d73f0e7b82a9210136ab0083b')
LEGISLATION_INFO = os.environ['LEGISLATION_INFO']
api = pyairtable.Api(LEGISLATION_INFO)
table = api.table('apps7I6q0g9Hyb6j9','tblydWhHOZeqjzycO')
legislation = table.all()
legislation_list = [x['fields'] for x in legislation]
Expand Down
6 changes: 3 additions & 3 deletions scripts/legislation_votes_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import json

senate_data = []
with open(r"..\public\senate.geo.json", 'r') as f:
with open("public/senate.geo.json", 'r') as f:
senate_data = json.load(f)
assembly_data = []
with open(r"..\public\assembly.geo.json", 'r') as f:
with open("public/assembly.geo.json", 'r') as f:
assembly_data = json.load(f)

# Function to extract unique bill names from "HCMC support"
Expand Down Expand Up @@ -63,7 +63,7 @@ def create_summary_data(counts, house):
final_summary_data = summary_data_senate + summary_data_assembly

# Path for the new JSON file
output_file_path_dynamic = r"..\public\legislation_votes.json"
output_file_path_dynamic = "public/legislation_votes.json"

# Writing the data to a new JSON file
with open(output_file_path_dynamic, 'w') as file:
Expand Down
8 changes: 4 additions & 4 deletions scripts/legislative_support_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
rows.append(row['fields'])
df = pd.DataFrame(rows)
# Load GeoJSONs
gdf_assembly = gpd.read_file(r"..\public\NYS_Assembly_Districts.geojson")
gdf_senate = gpd.read_file(r"..\public\NYS_Senate_Districts.geojson").rename(columns={'DISTRICT':'District'})
gdf_assembly = gpd.read_file("public/NYS_Assembly_Districts.geojson")
gdf_senate = gpd.read_file("public/NYS_Senate_Districts.geojson").rename(columns={'DISTRICT':'District'})

# Split your dataframe by house
df_assembly = df[df['House'] == 'Assembly']
Expand All @@ -36,5 +36,5 @@
gdf_assembly = gdf_assembly.rename(columns = {'Which HCMC legislation do they support?':'HCMC support'})

# Export the new GeoJSONs
gdf_assembly.to_file(r'..\public\assembly.geo.json', driver='GeoJSON')
gdf_senate.to_file(r'..\public\senate.geo.json', driver='GeoJSON')
gdf_assembly.to_file('public/assembly.geo.json', driver='GeoJSON')
gdf_senate.to_file('public/senate.geo.json', driver='GeoJSON')

0 comments on commit 6bf7f00

Please sign in to comment.