Last Updated: June 22nd 2018
If you are not a developer, you can start with the beginning docs: How to search, Google, and collect information into a simple document.
If you are a developer, you can see the "Data Collection" section for detailed instructions on manual data entry (recommended) and Python scraping (not recommended).
The U.S. Prosecutor Database is a collection of .csv and .json data for currently elected and appointed government attorneys at the local, state, and federal level. This includes Attorney Generals, U.S. Attorneys, District/State Attorneys, and Municipal/County/City Attorneys.
Our goal is to showcase prosecutorial demographics, culture, and history. This goal is in service to the Post-Carceral mission, which is to:
- Cultivate a community of holding prosecutors accountable as a voting public
- Change the political and cultural landscape of this nation's real lawmakers
- Assisting prosecutors who aim to end mass incarceration and commit to decarceration
Unfortunately, this prosecutor data does not already exist. The Post-Carceral vision is to collect this information so that we can not only showcase reality using open-source, collaborative methods, but contribute to radically shifting this political picture for future generations, as well.
Our online community, Post-Carceral, has created a separate web app which renders this data for easy access. Though this repository is dedicated to housing the USPD Data (and NOT the USPD App), please contact Billimarie if you are interested in learning more.
The purpose of this repository is to share the USPD data we are aiming to collect.
The Basic Prosecutor Profile consists of 7 fields:
- Name
- Location (State, County)
- Role
- Website
- Office Info (Address)
- Contact Info (Phone, Fax, Email)
- Optional: headshot / profile image
The Full Prosecutor Profile has several additional fields, including Demographics (Age, Race, Gender, Party). Though it would be extremely helpful for each pull request to include a Full Prosecutor Profile, it is not expected.
Here are detailed instructions on how you can collect and contribute data to the project.
git clone git@github.com:billimarie/prosecutor-database.git
git checkout -b [state]-[role]
npm install
npm install -g csvtojson
As previously noted, a dataset of all U.S. Prosecutors does not exist. Therefore, in order to create it, we work in a narrow scope: LOCATION (State) and ROLE (ex: District Attorney). You will see this emphasized repeatedly as State-Role. Your branch should only consist of data from one state, one role. It is okay to submit multiple pull requests, as long as you keep your work isolated in this manner.
There are one of two options you can choose for cultivating your dataset:
- Manually collecting prosecutor names by hand
- Creating a Python script to scrape the data
To manually collect prosecutor names by hand, complete the steps, below.
It is not recommended to go the data scraping route, as there is no uniform data to scrape from. This method is often not ideal as it will require more energy than simply collecting the data by hand. However, this is a good avenue to try if you come across some semblance of uniformity and/or want to see how scraping works. To scrape data, complete the steps below after running the Python script.
Create a new .csv file as [state]-[role].csv
. Add the Basic Prosecutor Profile columns:
- Name
- Location (State, County)
- Role
- Website
- Office Info (Address)
- Contact Info (Phone, Fax, Email)
- Optional: headshot / profile image
Note: You can always add additional columns, as long as it conforms to the Full Prosecutor Profile (Demographics: Age, Race, Gender, Party).
Google your chosen state's prosecutor association.
Collect the data in your .csv file. Remember: One State, One Role, One Branch.
Run the csvtojson Node module (ex: ny-da.csv > ny-da.json
):
csvtojson [state-role].csv > [state-role].json
Be mindful of isolating your work. As always: One State, One Role, One Branch.
Add, Commit, and Submit a Pull Request:
git add .
git commit -m "Added [state] [role] as .csv and .json"
git push origin [branch]
Again, it is highly recommended you collect the data by hand. If you are adamant on data scraping, here is the Python script I've been tweaking for each state:
#!/usr/bin/python3
from pyquery import PyQuery as pq
import requests as req
urls = [
'https://www.nypti.org/DA Htmls/stlawrence.html',
'https://www.nypti.org/DA Htmls/franklin.html',
'https://www.nypti.org/DA Htmls/clinton.html',
...
'https://www.nypti.org/DA Htmls/orleans.html',
'https://www.nypti.org/DA Htmls/niagara.html',
'https://www.nypti.org/DA Htmls/chautauqua.html'
]
for url in urls:
page = req.get(url)
doc = pq(page.text)
link = doc('a')
website = pq(link).attr('href')
da = doc('div').text()
print(da)
print(website)
Please feel free to submit a pull request if you can enhance this script (or provide a newer, better, faster version).
If a new method for collecting this data is discovered, please create a new issue where we can discuss it as a community.
Post-Carceral is a digital community group of volunteers working on civic tech projects (like the US Prosecutor Database) in service of working toward a post-carceral ("beyond prison") world.
- Sign up for our weekly mailing list. I send emails to everyone every Monday, after our remote Sunday sessions.
- You can also find USPD updates on our Twitter: @USProsecutorDB.
- To get involved in a remote Sunday session, follow @postcarceral. This is our general prisoners' rights group responsible for housing the USPD project.
You don't have to be a developer or a prisoners' rights activist to join. We're looking for all types of people with all types of expertise to collaborate with.
Every Sunday, we meet via Skype for a group session where we:
- Discuss recent prosecutor news, primary results, and campaigns
- Brainstorm ways to hold prosecutors accountable
- Collect data
If you'd like to join our Sunday group sessions, send an email to Billimarie.
This project would not be possible without the support of many individuals and organizations, including, but not limited to: