AI Bill Parser
Introduction
Today, I developed a python program that searches through US Congress bill data to find and extract bills related to artificial intelligence.
Development Notes
I started by installing pandas and openpyxl in order to create data frames and output my data into a excel file
pip install pandas openpyxl
I downloaded JSON files of all congressional bill from 116th-119th Congress from Legiscan and placed them in the “US” folder
Then, I developed a simple code to (1) parse through all the JSON files (2) identify bills with the String “Artificial Intelligence” (3) Export them to an excel file
First, I created a method to walk through all the JSON files by using the loop “file in files.” Then, I extract the bill title and description to check for “Artificial Intelligence.” If the bill contains that string, I then append the ai_bills list with other information.
With the saved ai_bills, I create a data frame in the save_to_excel method to print all the bills in the excel file using pandas.
In my main, I simply call on both methods and designate the bill directory and the output file
As a result I extracted 222 AI bills. Check it out on my repo