summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2014-02-07 17:35:20 +0000
committerNathan Kinkade <nath@nkinka.de>2014-02-07 17:35:20 +0000
commit679a95e4e08855b5b5d376a124b8ea6304edbce1 (patch)
tree2f050e928d09a8a49f5755eecb305b6741114347
parent298b1a1e34ac72b845473d0ff7704bb14caf600f (diff)
Script and lists for filtering out interesting defendants.
-rw-r--r--interesting_defendants/excludable_charges440
-rw-r--r--interesting_defendants/fatal_dispositions62
-rw-r--r--interesting_defendants/interesting_defendants.php147
-rw-r--r--interesting_defendants/safe_dispositions43
4 files changed, 692 insertions, 0 deletions
diff --git a/interesting_defendants/excludable_charges b/interesting_defendants/excludable_charges
new file mode 100644
index 0000000..fd51e6e
--- /dev/null
+++ b/interesting_defendants/excludable_charges
@@ -0,0 +1,440 @@
+ARSON
+ARSON1D/CONSPIRACY
+ARSON1ST DEGREE
+ARSON1ST/ATTEMPT
+ARSON2ND DEGREE
+ARSON/2D/CONSPIRE
+ARSON/2D/SOLICIT
+ARSON/2ND/ATTEMPT
+ARSON/BODILYHARM
+ARSON/GREATBOD HARM
+ASSAGG/PO/FF/ATTEMP
+ASS/AGG/BYPRISONER
+ASS/AGG/OFFICIALEMP
+ASS/AGG/RELIGINSTI
+ASS/AGGR/CONSP
+ASS/AGG/RELIGINSTI
+ASS/AGGR/CONSP
+ASSAULT/AGG/DW/MASK
+ASSAULT/AGG/DWEAP
+ASSAULT/AGG/ELDER/DW
+ASSAULT/AGG/FELONY
+ASSAULT/AGG/FIREARM
+ASSAULT/AGG/LEO
+ASSAULT/AGG/POL/FIRE
+ASSAULT/AGG/PRINCIPL
+ASSAULT/AGGRAVATED
+ASSLT/AGG/6/FIREAR
+ASSLT/AGG/FEL/FARM
+ASSLT/AGG/LEO/FA/ATT
+ASSLT/AGG/LEO/FIRERM
+ATT2D MURDER/FIREAR
+ATTFEL MUR/DLY WEA
+ATTFEL MUR/FIREARM
+ATTFEL MURDER - PBL
+ATTFEL MURDER/IN/AR
+ATTFEL MURDER/INJUR
+ATTSEX ACTIV/MINOR
+ATTSOL 1ST DEG FEL
+ATTSOL 2ND DEG FEL
+ATTEMPTFEL MURDER
+BATT/AGG/BODHRM/WEAP
+BATT/AGG/BYPRISONER
+BATT/AGG/DDYWPN/ATT
+BATT/AGG/HARM/DWEAP
+BATT/AGG/OFFICIAL
+BATT/AGG/PREJ/WEA/HR
+BATT/AGG/WEA/FA/MASK
+BATT/AGG/WEAP/GANG
+BATT/AGG/WEAP/PRE/AT
+BATTERY/AGG/ATT
+BATTERY/AGG/BODHARM
+BATTERY/AGG/CONSPIRE
+BATTERY/AGG/DWEAP
+BATTERY/AGG/ELDERLY
+BATTERY/AGG/FIREARM
+BATTERY/AGG/HRM/WEAP
+BATTERY/AGG/LEO
+BATTERY/AGG/POL/FIRE
+BATTERY/AGG/PREGNANT
+BATTERY/AGG/PRIN
+BATTERY/AGGRAVATED
+BOMB/ATT/FALSRPT/ST
+BOMB/BODILYHARM
+BOMB/DESTRDEV/CONSP
+BOMB/DESTRDEV/SOLIC
+BOMB/DISRUPTION
+BOMB/FALSEREPORT
+BOMB/FALSERPT/STATE
+BOMB/GREATBOD HARM
+BOMB/MAKE/POSN/THROW
+BOMB/THREATTO THROW
+BUR/ASLT/BAT/ARD/SOL
+BUR/ASS/BAT/ARMD/CON
+BURG/ARMED/SOLICIT
+BURG/ASLT/BATT- PBL
+BURG/ASS/BAT/>7/1/01
+BURG/ASS/BAT/ARM/ATT
+BURG/DWL/STR/DAM-PBL
+BURG/DWL/STR/VEH-PBL
+BURG/OCCDWELL/SOLIC
+BURG/OCCDWL/MASK
+BURG/OCC/DWELL/ATT
+BURG/OCC/MASKED
+BURG/UNOCDWEL/GANG
+BURG/UNOCCDWEL/PREJ
+BURG/UNOCCDWELL/ATT
+BURG/UNOCCDWELL/CON
+BURG/UNOCC/DWL/MASK
+BURGLARY/ARMED- PBL
+BURGLARY/ARMED/ATT
+BURGLARY/ARMED/CONSP
+BURGLARY/ASSLT/ARMED
+BURGLARY/DWELL/CONSP
+BURGLARY/OCC/DWELL
+BURGLARY/UNOCCD/ATT
+BURGLARY/UNOCCDWELL
+BURGLARY/UNOCC/DWELL
+BURGLARY/WASSLT/ATT
+BUY/SELLMINOR/SEX T
+CANN/TRF/10K>LBS
+CANN/TRF/25-2000LBS
+CANN/TRF/2K-10KLBS
+CANN/TRF/ARMD/ATTEMT
+CANNABIS/TRAFFICK
+CANNABIS/TRFK/10
+CANNABIS/TRFK/2-10K
+CANNABIS/TRFK/50-2K
+CANNABIS/TRFK/ARMED
+CANNABIS/TRFK/ATT
+CHILDAB/NO HARM/ATT
+CHILDABU/NO HARM/FA
+CHILDABUSE/AGG
+CHILDABUSE/AGGRAV
+CHILDABUSE/ATT
+CHILDABUSE/BOD HARM
+CHILDABUSE/FAIL RPT
+CHILDABUSE/IMPREGNA
+CHILDABUSE/INJURY
+CHILDABUSE/NO HARM
+CHILDPORN/TRANSMIT
+CHILD/INFLICTPAIN
+CHLDAB/AGG/GRT HARM
+CHLDAB/HRM/AG BT/FA
+CHLDABS/FAIL TO REP
+CHLDABS/FALSE REPT
+CHLDABS/NEG/FLS RPT
+CHLDABS/REQ REPORT
+CHLDABUSE/FALSE RPT
+CHLDNEG/GREAT HARM
+CHLDNEG/NO GRT HRM
+CHLDPORN/FRM O/S FL
+CHILDPORN/TRANSMIT
+CHLDAB/AGG/GRT HARM
+CHLDAB/HRM/AG BT/FA
+CHLDPORN/FRM O/S FL
+COCAINE/TRAF/CONSP
+COCAINE/TRAF/CONSPIR
+COCAINE/TRAFF/CONSP
+COCAINE/TRAFF/SOLIC
+COCAINE/TRAFFIC/ATT
+COCAINE/TRAFFICK
+COCAINE/TRF/200-400
+COCAINE/TRFK/10
+COCAINE/TRFK/2-10K
+COCAINE/TRFK/40
+COCAINE/TRFK/400-2K
+COCAINE/TRFK/400/ARM
+COKE/TRAF/40/CONSP
+COKE/TRAF/400>/<150K
+COKE/TRAFF/200>/<400
+COKE/TRAFF/28>/<200
+COKE/TRAFFICK/40
+COKE/TRF/150-300/PBL
+COKE/TRFK/28>/<150K
+COKE/TRFK/ARMED
+COKE/TRFK/ATTEMPT
+COKE/TRFK/CONSPIRACY
+COKE/TRFK/SOLICIT
+COKE/TRK/150K>/ARMED
+COMPUTERPORNOGRAPHY
+DRUGS/TRAFFICK/ATT
+DRUGS/TRAFFICKING
+DRUGS/TRFK/CONSPIRE
+DUI/MANSLAUGHTER
+DWI/MANSLAUGHTER
+ENGSEX/CHILD/ATTEMP
+ENGAGE/CHILDFAM SEX
+EXPLO/POSN/W/O/LICEN
+EXPLOSIVE/POSN
+EXPLOSIVE/TRANSPORT
+EXPLOSIVE/UNLPOSN
+ECSTASY/TRF/10>/<200
+FLUNI/TRF/14>/<28GR
+FLUNI/TRF/4G>/<14GR
+FLUNOTRAZ/TRAFF/CONS
+GBL/TRAFF/1K><5K
+GBL/TRAFFICK/10K>
+FELMUR/1ST/LEO/ATT
+HOME/INVASION
+HMINV/ROBB/W/O WEAP
+ILLDRG/TRAF/28/SOLI
+ILLDRG/TRF/30K>/DTH
+ILLDRG/TRFK/ARMED
+ILLDRGS/TRF/14>/<28
+ILLDRGS/TRF/4>/<14
+ILLDRGS/TRF/4>/<14G
+ILLDRUGS/TRAF/ARMED
+ILLDRUGS/TRAFF/2
+ILLDRUGS/TRAFFICK
+ILLDRUGS/TRF/ARM/AT
+ILLDRUGS/TRF/ATT
+ILLDRUGS/TRF/ATTEMP
+ILLDRUGS/TRFK/2
+ILLDRUGS/TRFK/30K>
+ILLDRUGS/TRFK/CONSP
+ILLDRG/TRF/28G>/<30K
+ILLDRG/TRF14>/<28SOL
+KID/CHLD<13/ARMD/ATT
+KIDNAP/-13/LL/SB
+KIDNAP/CHILD-13/ATT
+KIDNAP/FA/AGGB/CONSP
+KIDNAP/SOLIC
+KIDNAP/WEAP/FA/AGGB
+KIDNAP/WEAPON/CONSP
+KIDNAP/WP/FA/AGB/LEO
+KIDNAP/WP/FA/AGGB/AT
+KIDNAPPINGŠ PBL
+KIDNAPPING/ATTEMPT
+KIDNAPPING/CHLD/GANG
+KIDNAPPING/CONSPIRE
+KIDNAPPING/DWEAP/LEO
+KIDNAPPING/LEOŠ PBL
+KIDNAPPING/MASKED
+KIDNAPPING/WEAP/AGGB
+KIDNAPPING/WEAPN/ATT
+L&L;ASS/CHILD/SOLICT
+L&L;ASSAULT/CHILD
+L&L;ASSLT/CHILD/ATT
+L&L;BATT ON CHILD
+L&L;BATT/ELD/DIS/ADL
+L&L;BEHAVIOR
+L&L;CD/<16/DF<18
+L&L;CHILD/ATT
+L&L;CHLD 12-16/DF<18
+L&L;CHLD <16/ARMED
+L&L;CHLD<12/D18>/ATT
+L&L;CHLD<12/DEF 18>
+L&L;CONDUCT/CHLD <16
+L&L;EXH/CLD<16/DF<18
+L&L;EXHI/ELD/DIS/ADL
+L&L;EXHIB <16 BY 18>
+L&L;EXHIB ON<16BY<18
+L&L;EXHIB/CHLD/<16
+L&L;EXHIB/CHLD/ONLIN
+L&L;MOL CHLD 12-16
+L&L;MOL/ELD/DISAB/AD
+L&L;MOLEST/CHILD/<12
+L&L;ON CHILD<16/ATTM
+L&L;/CH<12/DEF<18/ATT
+L&L;/CHD<12/DEF<18
+L&L;/CHILD/ARMED
+L&L;/EXHIB/CORR/FACIL
+L&LCHLD;<12/D18>/ATT
+LWDACT/<16/<10/99
+LWDASLT CHLD/<10/99
+LWDASLT/<16/<10/99
+LWDASLT/CHLD/<10/99
+MENHLTH/SEX MISCND
+MANS/AGG/ELD/DISADL
+MANS/DWEAP/ATTEMPT
+MANSL/AGG/CHILD
+MANSLAUGHTER
+MANSLAUGHTER/ATTEMPT
+MANSLAUGHTER/DWEAP
+MANSLAUGHTER/LEO
+MANSLAUGHTER/LEO/ATT
+MR2D/LEO/AT/DW/FA/B
+MUR1D/DLY WEA/CONSP
+MUR2/ATT/WEA/PREJ
+MUR2/WEAP/AG BAT/AT
+MUR/PREMED/ATTEMPT
+MUR2D/ATTMP/DDLYWPN
+MURDER1ST DEG/ATT
+MURDER1ST DEG/CONSP
+MURDER1ST DEG/LEO
+MURDER1ST DEGREE
+MURDER1ST/DWEAP/AT
+MURDER1ST/DWEAP/ATT
+MURDER1ST/PRIN/ATT
+MURDER1ST/SOLICIT
+MURDER2 DEG/FEL/PBL
+MURDER2 DEG/LEO/PBL
+MURDER2/FIREARM/ATT
+MURDER2D/LEO/ATT/DW
+MURDER2ND DEG - PBL
+MURDER2ND DEG/ATT
+MURDER2ND DEG/DWEAP
+MURDER2ND DEG/PRIN
+MURDER2ND DEGREE
+MURDER2ND/ATT/WEAPN
+MURDER2ND/DWEAP/LEO
+MURDER2ND/FIREARM
+MURDER2ND/LEO/ATT
+MURDER2ND/PRIN/ATT
+MURDER3RD DEG/ATT
+MURDER3RD DEG/LEO
+MURDER3RD DEGREE
+MURDER3RD/DEA WEAPN
+MURDER/2D/CONSPIRAC
+MURDER/ATT/POL/FIRE
+MURDER/PREMED/ATT/FA
+OBSCENEMAT/MIN/ATT
+OBSCENEMAT/MINOR
+OBSCENESHOW/MINOR
+ORGSCEME DEFR/CONSP
+ORGSCH FRD/50 ATT
+ORGSCHEME TO DEFRD
+ORGSCHM DEF/CONSPIR
+ORGANIZEDFRAUD
+ORGANIZEDFRAUD/50
+ORGANIZEDFRD/0-20K
+ORGANIZEDFRD/20-50K
+PCP/TRAF/28GR>/<200G
+PCP/TRAFF/400GR>
+PCP/TRAFFICK/40
+PCP/TRF/200G>/<400G
+PCP/TRFK/CONSPIRE
+PHEN/TRAFF/CONSP/ARM
+PHEN/TRAFF/CONSPIRE
+PHEN/TRF/10G><200G/A
+PHEN/TRF/10G><200GR
+PHEN/TRF/10GR>/SOLIC
+PHEN/TRF/200G><400G
+PHEN/TRF/400G>
+PHEN/TRF/ARMED
+PHENETHY/TRAFF/ARMED
+PREMED/MURDER1/LEO/A
+
+PROCUR-18 PROST/ATT
+PROCURMINOR
+PROST/PROC<18/SOLIC
+PROST/PROCUREUN/18
+PROST/PROCURE<18/ARM
+
+RBRY/ARM/FA/DW- PBL
+RBRY/HMINV/FA - PBL
+ROB/HMINV/AGG BATT
+ROB/HOMEINV/ARM/ATT
+ROB/SNAT/WEA/ATTEMPT
+ROBB/ARM/SOLIC
+ROBB/ARMED/ATT/MASK
+ROBB/ARMED/PREJUDICE
+ROBB/CARJACK/ARM/ATT
+ROBB/CARJACK/ATTEMPT
+ROBB/CARJACK/CONSPIR
+ROBB/CRJCK/ARM- PBL
+ROBB/HOMENV/ARM/CO
+ROBB/HOMEINV/ATT
+ROBB/HOMEINV/CONSP
+ROBB/HOMEINVA/SOLIC
+ROBB/SA/W/ABATT/ATT
+ROBB/SDN/SNTCH/ATT
+ROBB/SNAT/F/A/DLYWE
+ROBB/STR/ARM/MASKED
+ROBB/STR/ATT/W/PREJU
+ROBB/STRARM/MASK/ATT
+ROBB/STRGARM/MASK
+ROBB/SUDDENSNATCH
+ROBB/W/AGGBATT
+ROBB/W/AGGBATT
+ROBBERY
+ROBBERY/ARMED/ATT
+ROBBERY/ARMED/CONSP
+ROBBERY/ARMED/MASK
+ROBBERY/ARMED/PRIN
+ROBBERY/ARMED/WEAPON
+ROBBERY/CARJACK/ATT
+ROBBERY/CARJACKING
+ROBBERY/DWEAP/ATT
+ROBBERY/FORCE
+ROBBERY/HMINV/ARMED
+ROBBERY/SA/SOLICIT
+ROBBERY/STRARM/CONSP
+ROBBERY/STRARM/PRIN
+ROBBERY/STRGARM/PREJ
+ROBBERY/STRNGARM/ATT
+ROBBERY/STRONGARM
+ROBBRY/ARMD/PRIN/ATT
+SEXACT/FAMCHLD/ATT
+SEXACT/W/CHILD/SOLI
+SEXACTIVITY/MINOR
+SEXBAT/BY THREATS
+SEXBAT/DWEAP/ATT
+SEXBAT/MULTPERP/F1
+SEXBAT/MULTPERP/F2
+SEXBAT/NOFORCE/ATT
+SEXBAT/NOHRM/ARMED
+SEXBAT/ON MINOR/ADT
+SEXBAT/ON MINOR/ATT
+SEXBAT/ON MINOR/MNR
+SEXBAT/THREATS/ATT
+SEXBATT/1/MENTAL
+SEXBATT/12>/COERCE
+SEXBATT/ARM/ATT/GNG
+SEXBATT/ARMED/GANG
+SEXBATT/BY LEO/CO
+SEXBATT/COERCE
+SEXBATT/FORCE/ATT
+SEXBATT/HLPLESS/ATT
+SEXBATT/LEO/ARM/ATT
+SEXBATT/LEO/CO/ARMD
+SEXBATT/MINOR/SOLIC
+SEXBATT/NO SER INJU
+SEXBATT/PHYS INCAP
+SEXBATT/VIC HELPLES
+SEXBATT/WEA/SOLICIT
+SEXBATTERY/ARMED
+SEXBATTERY/DRUGGED
+SEXOFF/CHNG ADDR
+SEXOFF/REP REQUIRED
+SEXOFF/RESD VIOL
+SEXOFFN/REG/COMPLY
+SEXOFFND/FAIL TO RE
+SEXOFFNDR/HAR/CON
+SEXOFND/PRED/RES/PR
+SEXOFND/RES VIOL
+SEXOFND/RPT STATE
+SEXOFND/VIOL REGIST
+SEXPERF/CH/PRO/ATT
+SEXPERF/CHILD/ATTEM
+SEXPERF/CHILD/POSN
+SEXPERF/CHILD/POSSN
+SEXPERF/CHILD/PROMO
+SEXPERF/CHILD/PROMT
+SEXPERF/CHILD/USE
+SEXW/FAM CHLD/ARMED
+SEXBAT/NOSER INJ AT
+SEXBAT/SERINJ/ATT
+SEXBAT/WEA/SERINJ/A
+SEXBAT/WEAP/SERINJ
+SEXBATT/NOSER INJ/C
+SEXBATT/NOSER INJ/G
+SOLIC/CHILDFAM SEX
+SOLIC/CHILDSEX ATT
+STALK/AGG/CYBER
+STALK/AGGRAV/MINOR
+STALKING
+STALKING/AGG/CTORDR
+STALKING/AGG/FIREARM
+STALKING/AGG/PREJUDI
+STALKING/AGGRAVATED
+VIDVOY/18> RESP <16
+VIDVOY/24>/CHILD<16
+VIDEOVOYEUR/7/1/12
+VIDEOVOYEUR/DISSEM
+VIDEOVOYEURISM/ATT
+VIDEOVOYEURISM/D>18
+VIOINJ PRO AGT STAL
+VIOLINJ/DOM VIOLENC
+VOYEURISM
diff --git a/interesting_defendants/fatal_dispositions b/interesting_defendants/fatal_dispositions
new file mode 100644
index 0000000..c752622
--- /dev/null
+++ b/interesting_defendants/fatal_dispositions
@@ -0,0 +1,62 @@
+ADJ DEL COM HRS/FEL
+ADJ DEL COMM CTL/FEL
+ADJ DELINQ PROB/FEL
+ADJ DELINQ-COMT DJJ
+ADJ DEQ CC/PROB/FEL
+ADJUDGED DELINQUENT
+ADJUDGED GUILTY
+CNV & SNT-SORT GRAD
+CNV 364 TASC/COM CNT
+CNV-364 TASC/364 SRT
+CNV/PRB/SPL SNT/CONC
+CNV/PROB SP CND SORT
+CNV/SNT-SORT FAILED
+CNV/SNT-SORT/TRM VOL
+CONV & SENT W/TASC
+CONV & SENT-CONCUR
+CONV & SENT-CONSEC
+CONV & SENT-SORT
+CONV - COMM SERVICE
+CONV - PROB CONSEC
+CONV - RESTITUTION
+CONV 364 TASC/PROB
+CONV AND SENT
+CONV C.C./PROBATION
+CONV CONC-PROB CONS
+CONV FN/CST-SUSP POR
+CONV PRB SP CD HART
+CONV PROB SP CD/TASC
+CONV PROB SP CND-PEG
+CONV PROB/BOOT CAMP
+CONV PROB/SPLIT SENT
+CONV SPLIT SENT-SORT
+CONV W/COMM CONTROL
+CONV W/CTS
+CONV W/FINE & COST
+CONV W/FINE OR SENT
+CONV W/FINE SUSP SEN
+CONV- REHAB PROGRAM
+CONV-C.C./SPEC COND
+CONV-PROB SPEC COND
+CONV-SENT/SUSP POR
+CONV-SUSP ENTRY SENT
+CONV-YOUTHFUL OFFNDR
+CONV/CTS/FINE/COST
+CONV/SALV ARMY PROB
+CONV/SPLIT SENTENCE
+CONVICTION - JAIL
+CONVICTION W/FINE
+CONVICTION W/PROB
+CONVICTION-JAIL/FINE
+CONVICTION/BOOT CAMP
+D. V. I. PROGRAM
+DECEASED
+EXTRADITED
+FINDING OF GUILT
+FND INCOMP\\PROB VIOL
+FND/GUILT \\PROB VIOL
+JRA/ADJ SAFE TO REL
+JRA/ADJ TO REM COMMT
+ON APPEAL
+SVP/ADJ SAFE TO REL
+SVP/ADJ TO REMAIN CO
diff --git a/interesting_defendants/interesting_defendants.php b/interesting_defendants/interesting_defendants.php
new file mode 100644
index 0000000..1bff4a7
--- /dev/null
+++ b/interesting_defendants/interesting_defendants.php
@@ -0,0 +1,147 @@
+<?php
+
+error_reporting(E_ALL ^ E_NOTICE);
+
+$dbh = new PDO('mysql:host=localhost;dbname=mdcc', 'mdcc', 'Mdcc.');
+
+$fatal_dispositions = file('./fatal_dispositions', FILE_IGNORE_NEW_LINES);
+$excludable_charges = file('./excludable_charges', FILE_IGNORE_NEW_LINES);
+$safe_dispositions = file('./safe_dispositions', FILE_IGNORE_NEW_LINES);
+
+// CSV files
+$interesting_defendants_csv = fopen('./output/interesting_defendants.csv', 'w');
+$interesting_defendants_with_multiple_cases_csv = fopen('./output/interesting_defendants_with_multiple_cases.csv', 'w');
+$interesting_defendants_with_akas_csv = fopen('./output/interesting_defendants_with_akas.csv', 'w');
+$interesting_defendants_with_akas_and_multiple_cases_csv = fopen('./output/interesting_defendants_with_akas_and_multiple_cases.csv', 'w');
+
+// HTML files
+$interesting_defendants_html = fopen('./output/interesting_defendants.html', 'w');
+$interesting_defendants_with_multiple_cases_html = fopen('./output/interesting_defendants_with_multiple_cases.html', 'w');
+$interesting_defendants_with_akas_html = fopen('./output/interesting_defendants_with_akas.html', 'w');
+$interesting_defendants_with_akas_and_multiple_cases_html = fopen('./output/interesting_defendants_with_akas_and_multiple_cases.html', 'w');
+
+// HTML template start
+$html_start = <<<HTML
+<html>
+<head>
+ <title>Interesting defendants</title>
+</head>
+<body>
+<table border="1">
+HTML;
+
+// HTML template end
+$html_end = <<<HTML
+</table>
+</body>
+</html>
+HTML;
+
+// Initialize the HTML files
+fwrite($interesting_defendants_html, $html_start);
+fwrite($interesting_defendants_with_multiple_cases_html, $html_start);
+fwrite($interesting_defendants_with_akas_html, $html_start);
+
+$sql = "SELECT * FROM cases";
+
+$st = $dbh->prepare($sql);
+if ( $st->execute() ) {
+ while ( $case = $st->fetch(PDO::FETCH_ASSOC) ) {
+
+ $has_multiple_cases = false;
+ $has_akas = false;
+
+ $defendant_csv = array(
+ $case['court_case_no'],
+ $case['name'],
+ $case['date_birth'],
+ );
+
+ $defendant_html = <<<HTML
+
+<tr>
+ <td>
+ <a href='http://li554-21.members.linode.com/search.php?case_id={$case['id']}'>{$case['court_case_no']}</a>
+ </td>
+ <td>{$case['name']}</td>
+ <td>{$case['date_birth']}</td>
+</tr>
+
+HTML;
+
+ $sql_charge = "SELECT * FROM charges WHERE case_id = '{$case['id']}'";
+ $st_charge = $dbh->prepare($sql_charge);
+ $st_charge->execute();
+ $charges = $st_charge->fetchAll(PDO::FETCH_ASSOC);
+ foreach ( $charges as $charge ) {
+
+ // If the disposition is a "fatal" one then go to next case
+ if ( in_array( $charge['disposition'], $fatal_dispositions) ) {
+ continue(2);
+ }
+
+ // If the charge is excludable and the disposition is not a safe one then go to the next case
+ if ( in_array($charge['charge'], $excludable_charges) && ! in_array($charge['disposition'], $safe_dispositions) ) {
+ continue(2);
+ }
+
+ }
+
+ // Does this person have multiple cases, based on the same name and date of birth?
+ $sql_def = "SELECT count(*) from cases WHERE name = '{$case['name']}' AND date_birth = '{$case['date_birth']}' AND id != '{$case['id']}'";
+ $st_def = $dbh->prepare($sql_def);
+ $st_def->execute();
+ $case_count = $st_def->fetchColumn();
+ if ( $case_count != '0' ) {
+ $has_multiple_cases = true;
+ }
+
+ // Does this person has any AKAs?
+ $sql_akas = "SELECT count(*) FROM akas WHERE case_id = '{$case['id']}'";
+ $st_akas = $dbh->prepare($sql_akas);
+ $st_akas->execute();
+ if ( $st_akas->fetchColumn() != '0' ) {
+ $has_akas = true;
+ }
+
+ if ( $has_multiple_cases ) {
+ fputcsv($interesting_defendants_with_multiple_cases_csv, $defendant_csv);
+ fwrite($interesting_defendants_with_multiple_cases_html, $defendant_html);
+ }
+
+ if ( $has_akas ) {
+ fputcsv($interesting_defendants_with_akas_csv, $defendant_csv);
+ fwrite($interesting_defendants_with_akas_html, $defendant_html);
+ }
+
+ if ( $has_multiple_cases && $has_akas ) {
+ fputcsv($interesting_defendants_with_akas_and_multiple_cases_csv, $defendant_csv);
+ fwrite($interesting_defendants_with_akas_and_multiple_cases_html, $defendant_html);
+ }
+
+
+ // The highest quality list
+ if ( ! $has_multiple_cases && ! $has_akas ) {
+ fputcsv($interesting_defendants_csv, $defendant_csv);
+ fwrite($interesting_defendants_html, $defendant_html);
+ }
+
+ }
+}
+
+// Finalize HTML files
+fwrite($interesting_defendants_html, $html_stop);
+fwrite($interesting_defendants_with_multiple_cases_html, $html_stop);
+fwrite($interesting_defendants_with_akas, $html_stop);
+fwrite($interesting_defendants_with_akas_and_multiple_cases, $html_stop);
+
+fclose($interesting_defendants_csv);
+fclose($interesting_defendants_with_multiple_cases_csv);
+fclose($interesting_defendants_with_akas_csv);
+fclose($interesting_defendants_with_akas_and_multiple_cases_csv);
+fclose($interesting_defendants_html);
+fclose($interesting_defendants_with_multiple_cases_html);
+fclose($interesting_defendants_with_akas_html);
+fclose($interesting_defendants_with_akas_and_multiple_cases_html);
+
+?>
diff --git a/interesting_defendants/safe_dispositions b/interesting_defendants/safe_dispositions
new file mode 100644
index 0000000..4be60b1
--- /dev/null
+++ b/interesting_defendants/safe_dispositions
@@ -0,0 +1,43 @@
+ABANDONED
+ACQUITTAL/INSANITY
+ACQUITTED BY COURT
+ACQUITTED BY JURY
+CASE FILED IN ERROR
+CLOSED ADMIN JUDGE
+CLOSED/PER ADM MEMO
+DEF PROSECUTION PGM
+DEFER DRUG PROGRAM
+DEFER FIRE ARM PGM
+DISCHARGE
+DISM - SPEEDY TRIAL
+DISM W/O PREJUDICE
+DISM WITH PREJUDICE
+DISM-LACK OF PROS
+DISM/NO PROB CAUSE
+DISMISS/MODIFY
+DISMISS/TERM
+DISMISSED
+DISMISSED BY COURT
+DISMISSED-WITNESS
+DIV DEFR DRUG PGM
+DRUG COURT PRG PLEA
+NO ACTION
+NO ACTION - FIL CTY
+NO ACTION - FIL TRAF
+NO ACTION FILED TRF
+NO INFORMATION
+NO TRUE BILL
+NOLLE PROS
+NOLLE PROS - ADMIN
+NOLLE PROS - REST
+NOLLE PROS FILED TRF
+NOLLE PROS JDP
+NOLLE PROS- USAO/INS
+NOLLE PROS-ADM/WRNT
+NOLLE PROS-COMP 'DVI
+NOLLE PROS-COMP PTI
+NOLLE PROS-DRUG PGM
+NOLLE PROS-F/A PGM
+NOLLE PROS-WITNESS
+NOLLE PROS/FILED CC
+NON JUDICIAL ACTION