diff --git a/.github/workflows/update_legislation_info.yml b/.github/workflows/update_legislation_info.yml index d32fb67..2954f3c 100644 --- a/.github/workflows/update_legislation_info.yml +++ b/.github/workflows/update_legislation_info.yml @@ -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 diff --git a/scripts/legislation_info_generator.py b/scripts/legislation_info_generator.py index 83dfc6e..fc4acf0 100644 --- a/scripts/legislation_info_generator.py +++ b/scripts/legislation_info_generator.py @@ -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] diff --git a/scripts/legislation_votes_generator.py b/scripts/legislation_votes_generator.py index 51407b3..5f8a1b3 100644 --- a/scripts/legislation_votes_generator.py +++ b/scripts/legislation_votes_generator.py @@ -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" @@ -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: diff --git a/scripts/legislative_support_generator.py b/scripts/legislative_support_generator.py index dd20ea8..3556c54 100644 --- a/scripts/legislative_support_generator.py +++ b/scripts/legislative_support_generator.py @@ -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'] @@ -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') \ No newline at end of file +gdf_assembly.to_file('public/assembly.geo.json', driver='GeoJSON') +gdf_senate.to_file('public/senate.geo.json', driver='GeoJSON') \ No newline at end of file