Skip to content

Instantly share code, notes, and snippets.

@chrislkeller
Last active December 11, 2015 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrislkeller/4668929 to your computer and use it in GitHub Desktop.
Save chrislkeller/4668929 to your computer and use it in GitHub Desktop.
Super simple shell script to take boilerplate FOIA language and create a markdown file.

Snippets: Creating a FOIA

This is a super simple shell script that takes boilerplate FOIA language and creates a markdown file that can be addressed to a particular agency.

You will still have to add the address, city, state and zip code of the agency, and the type of data being requested, but this is a step up from having a file that I copy and paste from.

The script takes a filename as an argument. That filename will have the date prepended to it so you can see at a glance which were sent out when.

Usage

  • Drop the script in your $HOME directory or in a scripts directory if you have one.

  • I created an alias in my .bashrc pointing to the script:

      alias foia='cd ~/Programming/2kpcc/data-projects/1_foia_letters && ~/Programming/1personal/9shell-scripts/foia-generator.sh'
    
  • To run, I open a terminal and type foia name-of-data-being-requested

Webpage

I tried converting this concept to a webform, and I think it might work a bit better. I plan on abstracting it out a bit further so it's useful to more people.

#!/bin/bash
# date variable
DATE="$(date +"%m-%d-%y")"
# input for newfile
NAME_OF_FOIA_LETTER="$1"
# name for newfile
OUTPUT_FILE="$DATE-$NAME_OF_FOIA_LETTER.md"
# create markdown FOIA
echo "Creating $NAME_OF_FOIA_LETTER FOIA letter"
cat <<EOF >$OUTPUT_FILE
**$DATE**
ADDRESS $line
STREET $line
CITY, STATE, ZIP CODE $line
**RE**: Public records request for NAME OF RECORD
**To Whom It May Concern**:
Under the California Public Records Act (Government Code Section 6250 et seq.), I ask to obtain a copy of the following records or data sets which I understand to be held by your agency:
>*DATA TO BE REQUESTED HERE*
I ask for a determination on this request within 10 days of receipt, or sooner should you make a determination without review of the record(s) in question.
If you determine that any or all or the information if exempt, I would like to know if the exemption is discretionary, if it's necessary to exercise discretion in this case and a signed notification citing the legal authorities used to determine the records are exempt.
Should some but not all of the information be exempt from disclosure -- and you intend to withhold it -- I ask that you redact it for the time being and make the rest available as requested.
Please notify me of any duplication costs that will exceed \$10.00. If I can provide any clarification or answer any questions, my contact information is below.
Thanks in advance and take care.
Sincerely:
Chris Keller $line
Data Journalist/News Applications Developer $line
Southern California Public Radio $line
**Web**: scpr.org $line
**Email**: ckeller@scpr.org $line
**Desk**: (626) 583-5214 $line
EOF
open $OUTPUT_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment