- Dito Legislative Insights - Quickstart
Dito Legislative Insights - Quickstart
How to install and run Dito Legislative Insights on a Virtual Machine. This guide is intended for a technical user setting up an evaluation environment.
Before you begin
-
Make sure you have a firewall rule that will allow ssh access to the VM you are about to create. For example, if you are planning to access the VM using Cloud Identity-Aware Proxy (IAP) you will need a rule that allows TCP ingress traffic from the IP range 35.235.240.0/20, port: 22.
-
Install the application from the Google Cloud Marketplace Console
Post install setup
-
Wait for the VM to start and then use the Cloud Console or
gcloud compute ssh
to ssh into to it. -
Add your user to the docker group and create a
.bash_profile
file in your home directorysudo usermod -aG docker $USER sudo setfacl --modify user:$USER:rw /var/run/docker.sock echo -e "# Source .bashrc if it exists\nif [ -f ~/.bashrc ]; then\n source ~/.bashrc\nfi" > ~/.bash_profile
-
Create aliases for update-insights and docker-compose
echo "source /home/insights/alias.env" >> ~/.bashrc
-
Logout and log back in again
-
Check for updates
update-insights latest: Pulling from docker/compose Digest: sha256:b60a020c0f68047b353a4a747f27f5e5ddb17116b7b018762edfb6f7a6439a82 Status: Image is up to date for docker/compose:latest docker.io/docker/compose:latest latest: Pulling from library/redis Digest: sha256:5d434317c873086669bf10332f4d4084820431ae2e017a91ea675bf65f49e54f Status: Image is up to date for redis:latest docker.io/library/redis:latest 1.0: Pulling from dito-dev-430219/legislative-insights/insights Digest: sha256:9e2d45be8a7746b78930254875f82eecaa2682dc7c633f49cd5bee0572837c3b Status: Image is up to date for us-east1-docker.pkg.dev/dito-dev-430219/legislative-insights/insights:1.0 us-east1-docker.pkg.dev/dito-dev-430219/legislative-insights/insights:1.0
Start Legislative Insights
The application is delivered as a series of docker containers using a docker compose file located in the /home/insights
directory. Navigate to that directory and run docker-compose up -d
to start the application.
cd /home/insights
docker-compose up -d
The GOOGLE_API_KEY variable is not set. Defaulting to a blank string.
Starting redis ... done
Starting insights ... done
Wait a few minutes then verify both containers (legislative-insights and redis) are running:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f77915c5534 us-east1-docker.pkg.dev/dito-dev-430219/legislative-insights/insights:1.0 "gunicorn -b :8000 -…" 15 minutes ago Up 23 seconds 0.0.0.0:80->8000/tcp, :::80->8000/tcp insights
625971bd1d5a redis:latest "docker-entrypoint.s…" 15 minutes ago Up 23 seconds 6379/tcp redis
Open a firewall port to allow access on port 80
Use network tags or other mechanisms to open the VM for http traffic.
Verify the instance
Navigate to the public IP address of the VM in a browser window
Create a Google AI Studio API key
Click on the Powered by Dito link on the right of the page to open the Settings form
Follow the instructions on the API Key Registration page to create a Google AI Studio API key and copy its value. Paste the API key into the Google AI Studio API Key field and press the Save
button
Test the LLM
Enter the URL for a bill that you would like to review into the Bill URL field. For example, the following URL is for HB 241 from the Florida 2024 session:
https://flsenate.gov/Session/Bill/2024/241/BillText/Filed/PDF
Press the Display Bill
button to show the bill:
Press the Summarize Bill
button to send the bill to the LLM for analysis:
This will send a request to an API server for processing. The server parses the pdf to extract its text and then forwards the text to the LLM for summarization. This process typically takes 20 to 30 seconds depending on the length of the bill.
The LLM’s response will appear below the pdf display. Use the Ask a question … field to ask follow-on questions related to the bill.
Enter Write a press release for this bill and hit the Submit
button
Wait for the LLM to respond then enter translate into Spanish and hit the Submit
button
Create an OpenStates API key
Dito Legislative Insights includes an OpenStates integration. This can be used to search for bills by legislative session. OpenStates requires an API key for access.
Click on the settings icon at the top of the page.
Follow the Register for an OpenStates account link to navigate to the OpenStates website
Follow the instructions on the API Key Registration page to register an OpenStates API key and copy its value. Paste the value into the Open States API Key field and hit the Save
button.
Test the Session Query Form
Adding an OpenStates API key enables the Session Query form. Use the State dropdown to select the State you want to query.
This will open a form which can be used to query for bills by legislative session. Press the Search
button to find all bills from the most recent session.
Experiment with the fields on the form and resubmit the form to filter the bill list. For example, the date fields can be used to search for bills based on their creation, or last action dates.
The search result shows a summary of the bill and lists each version. Click on a link to select the URL for a bill and submit it for analysis. Alternatively use the check boxes to select 2 version of a bill and identify differences between the.
Troubleshooting
Common issues and their resolution
Connection via Cloud Identity-Aware Proxy Failed
-
Issue: you are unable to ssh into to the Legislative Insights VM. The connection appears to hang and ultimately fails with the error shown below.
-
Resolution: Create a firewall rule to allow access to the VM
Internal Error
-
Issue: request to display or compare bills results in an internal error. The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
-
Resolution: verify the Google API has been set correctly. Open the settings page:
Verify the Google AI Studio API key has been set correctly
State, Legislative Session, and API key are required
-
Issue: a popup appears after hitting the Search button:
-
Resolution: verify the OpenStates API key has been set correctly
Next Steps
- Setup a production deployment. Modify the deployment to restrict access to it. Remove the public IP address from the VM. Create load balancer endpoints to expose the application. Place the load balanced resources behind an Identity Aware Proxy (IAP). Grant user access to the IAP protected resources and confirm they are only accessible to users who have been granted access.
- Delete the VM. If this is a test environment that you no longer require, delete the VM.
Copyright © Dito LLC, 2022, 2025