How to use ln method in Nose2

Best Python code snippet using nose2

state_court_scraper_final_10-22.py

Source:state_court_scraper_final_10-22.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2## reads and extracts info from txt files of published opinions from USCOA3## downloaded from LexisNexis4## written for python 2.6.*5##6## modified version of LexisOpinionParse.py by7## Kevin Quinn8## UC Berkeley9## 5/13/201010##11## modifications by12## Rachael Hinkle13## 9/19/201114##15## modified for state courts by16## Michael Nelson17## Summer, 201718import os19import re20import csv21import string22import operator23import datetime24import time25#mydir = "C:/Users/Steve/Dropbox/PSU2018-2019/RA/Scraper/"26mydir = "C:/Users/sum410/Dropbox/PSU2018-2019/RA/Scraper/" ########### Where state master file csv is located27#mydir = "C:/Users/steve/Dropbox/PSU2018-2019/RA/Scraper/"28#mydir = "C:/Users/steve/OneDrive/Desktop/"29def expandmonth(mstring2):30 mstring2 = re.sub("Jan\.", "January", mstring2)31 mstring2 = re.sub("Feb\.", "February", mstring2)32 mstring2 = re.sub("Mar\.", "March", mstring2)33 mstring2 = re.sub("Apr\.", "April", mstring2)34 mstring2 = re.sub("Aug\.", "August", mstring2)35 mstring2 = re.sub("Sept\.", "September", mstring2)36 mstring2 = re.sub("Oct\.", "October", mstring2)37 mstring2 = re.sub("Nov\.", "November", mstring2)38 mstring2 = re.sub("Dec\.", "December", mstring2)39 return mstring240def month2number(mstring):41 mnumber = -99942 if (mstring == "January"):43 mnumber = "01"44 if (mstring == "February"):45 mnumber = "02"46 if (mstring == "March"):47 mnumber = "03"48 if (mstring == "April"):49 mnumber = "04"50 if (mstring == "May"):51 mnumber = "05"52 if (mstring == "June"):53 mnumber = "06"54 if (mstring == "July"):55 mnumber = "07"56 if (mstring == "August"):57 mnumber = "08"58 if (mstring == "September"):59 mnumber = "09"60 if (mstring == "October"):61 mnumber = "10"62 if (mstring == "November"):63 mnumber = "11"64 if (mstring == "December"):65 mnumber = "12"66 return mnumber67def Capitalize(nstring):68 if(len(nstring) > 1 and not re.match("MC|Mc|Mac|MAC", nstring)): #O'|Van|VAN69 nstring = string.upper(nstring[0]) + string.lower(nstring[1:])70 if(re.match("MC|Mc|mc", nstring)):71 nstring = string.upper(nstring[0]) + string.lower(nstring[1]) + string.upper(nstring[2]) + string.lower(nstring[3:])72 if(re.match("MAC|Mac", nstring)):73 nstring = string.upper(nstring[0]) + string.lower(nstring[1:3]) + string.upper(nstring[3]) + string.lower(nstring[4:])74 if(re.match("MACY|Macy|MacY", nstring)):75 nstring = string.upper(nstring[0]) + string.lower(nstring[1]) + string.upper(nstring[2]) + string.lower(nstring[3:])76 if(re.match("Van\s|VAN\s", nstring)):77 nstring = string.upper(nstring[0]) + string.lower(nstring[1:4]) + string.upper(nstring[4]) + string.lower(nstring[5:])78 if(len(nstring) == 1):79 nstring = string.upper(nstring)80 return nstring81def lastname(nstring):82 last_name = ""83 nstring = re.sub(",", "", nstring)84 nstring = string.strip(nstring)85 nstring = re.sub("BY THE COURT", "", nstring)86 nstring = re.sub("PER CURIAM[;]*", "", nstring)87 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)88 names_holder = re.split("\s", nstring)89 if(len(names_holder) == 1):90 last_name = names_holder[0]91 if(len(names_holder) == 2): #and not re.search(",", nstring)):92 last_name = names_holder[1]93 if(len(names_holder) == 3 and not re.search(",", nstring)):94 last_name = names_holder[2]95 if(len(names_holder) == 3 and re.search(",", nstring)):96 last_name = names_holder[2]97 if(len(names_holder) == 4): #and not re.search(",", nstring)):98 last_name = names_holder[2] + " " + names_holder[3]99 if(len(names_holder) == 4 and re.search(",", nstring)):100 last_name = names_holder[0] + " " + names_holder[1]101 last_name = re.sub(",", "", last_name)102 last_name = re.sub("\.", "", last_name)103 last_name = Capitalize(last_name)104 return last_name105def firstname(nstring):106 first_name = ""107 nstring = nstring.strip()108 nstring = re.sub("BY THE COURT", "", nstring)109 nstring = re.sub("PER CURIAM[;]*", "", nstring)110 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)111 names_holder = re.split("\s", nstring)112 if(len(names_holder) == 2 and not re.search(",", nstring)):113 first_name = names_holder[0]114 if(len(names_holder) == 2 and re.search(",", nstring)):115 first_name = names_holder[1]116 if(len(names_holder) == 3 and not re.search(",", nstring)):117 first_name = names_holder[0]118 if(len(names_holder) == 3 and re.search(",", nstring)):119 first_name = names_holder[1]120 if(len(names_holder) == 4 and not re.search(",", nstring)):121 first_name = names_holder[0]122 if(len(names_holder) == 4 and re.search(",", nstring)):123 first_name = names_holder[2]124 first_name = re.sub(",", "", first_name)125 first_name = Capitalize(first_name)126 return first_name127def middlename(nstring):128 middle_name = ""129 nstring = string.strip(nstring)130 nstring = re.sub("BY THE COURT", "", nstring)131 nstring = re.sub("PER CURIAM[;]*", "", nstring)132 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)133 names_holder = re.split("\s", nstring)134 if(len(names_holder) == 3 and not re.search(",", nstring)):135 middle_name = names_holder[1]136 if(len(names_holder) == 3 and re.search(",", nstring)):137 middle_name = names_holder[2]138 if(len(names_holder) == 4 and not re.search(",", nstring)):139 middle_name = names_holder[1]140 if(len(names_holder) == 4 and re.search(",", nstring)):141 middle_name = names_holder[3]142 middle_name = re.sub(",", "", middle_name)143 middle_name = Capitalize(middle_name)144 return middle_name145def namesuffix(nstring):146 suffix = ""147 nstring = string.strip(nstring)148 nstring = re.sub("BY THE COURT", "", nstring)149 nstring = re.sub("PER CURIAM[;]*", "", nstring)150 if(re.search("Jr\.|JR\.", nstring)):151 suffix = "Jr."152 if(re.search("III", nstring)):153 suffix = "III"154 if(re.search("II", nstring)):155 suffix = "II"156 if(re.search("Sr\.|SR\.", nstring)):157 suffix = "Sr."158 return suffix159def first_sentence(value):160 """ Take just the first sentence of the HTML passed in.161 """162 words = value.split()163 # Collect words until the result is a sentence.164 sentence = ""165 while words:166 if sentence:167 sentence += " "168 sentence += words.pop(0)169 if not re.search(r'[.?!][)"]*$', sentence):170 # End of sentence doesn't end with punctuation.171 continue172 #if words and not re.search(r'^[("]*[A-Z0-9]', words[0]):173 # Next sentence has to start with upper case.174 continue175 if re.search(r'(Mr\.|Mrs\.|Ms\.|Dr\.| [A-Z]\.)$', sentence):176 # If the "sentence" ends with a title or initial, then it probably177 # isn't the end of the sentence.178 continue179 if sentence.count('(') != sentence.count(')'):180 # A sentence has to have balanced parens.181 continue182 if sentence.count('"') % 2:183 # A sentence has to have an even number of quotes.184 continue185 break186 return sentence187def state_ab(value):188 if(re.search("Alabama", value)):189 state_abbr = "AL"190 return state_abbr191 elif (re.search("Alaska", value)):192 state_abbr = "AK"193 return state_abbr194 elif (re.search("Arkansas", value)):195 state_abbr = "AR"196 return state_abbr197 elif (re.search("Arizona", value)):198 state_abbr = "AZ"199 return state_abbr200 elif (re.search("California", value)):201 state_abbr = "CA"202 return state_abbr203 elif (re.search("Colorado", value)):204 state_abbr = "CO"205 return state_abbr206 elif (re.search("Connecticut", value)):207 state_abbr = "CT"208 return state_abbr209 elif (re.search("Delaware", value)):210 state_abbr = "DE"211 return state_abbr212 elif (re.search("Florida", value)):213 state_abbr = "FL"214 return state_abbr215 elif (re.search("Georgia", value)):216 state_abbr = "GA"217 return state_abbr218 elif (re.search("Hawaii", value)):219 state_abbr = "HI"220 return state_abbr221 elif (re.search("Hawai'i", value)):222 state_abbr = "HI"223 return state_abbr224 elif (re.search("Idaho", value)):225 state_abbr = "ID"226 return state_abbr227 elif (re.search("Illinois", value)):228 state_abbr = "IL"229 return state_abbr230 elif (re.search("Indiana", value)):231 state_abbr = "IN"232 return state_abbr233 elif (re.search("Iowa", value)):234 state_abbr = "IA"235 return state_abbr236 elif (re.search("Kansas", value)):237 state_abbr = "KS"238 return state_abbr239 elif (re.search("Kentucky", value)):240 state_abbr = "KY"241 return state_abbr242 elif (re.search("Louisiana", value)):243 state_abbr = "LA"244 return state_abbr245 elif (re.search("Maine", value)):246 state_abbr = "ME"247 return state_abbr248 elif (re.search("Maryland", value)):249 state_abbr = "MD"250 return state_abbr251 elif (re.search("Massachusetts", value)):252 state_abbr = "MA"253 return state_abbr254 elif (re.search("Michigan", value)):255 state_abbr = "MI"256 return state_abbr257 elif (re.search("Minnesota", value)):258 state_abbr = "MN"259 return state_abbr260 elif (re.search("Mississippi", value)):261 state_abbr = "MS"262 return state_abbr263 elif (re.search("Missouri", value)):264 state_abbr = "MO"265 return state_abbr266 elif (re.search("Montana", value)):267 state_abbr = "MT"268 return state_abbr269 elif (re.search("Nebraska", value)):270 state_abbr = "NE"271 return state_abbr272 elif (re.search("Nevada", value)):273 state_abbr = "NV"274 return state_abbr275 elif (re.search("New Hampshire", value)):276 state_abbr = "NH"277 return state_abbr278 elif (re.search("New Jersey", value)):279 state_abbr = "NJ"280 return state_abbr281 elif (re.search("New Mexico", value)):282 state_abbr = "NM"283 return state_abbr284 elif (re.search("New York", value)):285 state_abbr = "NY"286 return state_abbr287 elif (re.search("North Carolina", value)):288 state_abbr = "NC"289 return state_abbr290 elif (re.search("North Dakota", value)):291 state_abbr = "ND"292 return state_abbr293 elif (re.search("Ohio", value)):294 state_abbr = "OH"295 return state_abbr296 elif (re.search("Supreme Court of Oklahoma", value)):297 state_abbr = "OK-SC"298 return state_abbr299 elif (re.search("Oregon", value)):300 state_abbr = "OR"301 return state_abbr302 elif (re.search("Pennsylvania", value)):303 state_abbr = "PA"304 return state_abbr305 elif (re.search("Rhode Island", value)):306 state_abbr = "RI"307 return state_abbr308 elif (re.search("South Carolina", value)):309 state_abbr = "SC"310 return state_abbr311 elif (re.search("Tennessee", value)):312 state_abbr = "TN"313 return state_abbr314 elif (re.search("Texas", value)):315 state_abbr = "TX-SC"316 return state_abbr317 elif (re.search("Utah", value)):318 state_abbr = "UT"319 return state_abbr320 elif (re.search("Vermont", value)):321 state_abbr = "VT"322 return state_abbr323 elif (re.search("Washington", value)):324 state_abbr = "WA"325 return state_abbr326 elif (re.search("West Virginia", value)):327 state_abbr = "WV"328 return state_abbr329 elif (re.search("Wisconsin", value)):330 state_abbr = "WI"331 return state_abbr332 elif (re.search("Wyoming", value)):333 state_abbr = "WY"334 return state_abbr335#time.sleep(600)336# .csv file where extracted metadata will be stored337mydir2 = 'C:/Users/sum410/Dropbox/PSU2018-2019/Summer/MN/' ########### Change to where csv will be saved to338#mydir2 = 'C:/Users/steve/OneDrive/Desktop/'339#mydir2 = 'C:/Users/steve/Dropbox/PSU2018-2019/Summer/MN/'340fout = open(mydir2 + "DCKnownPost1990_9-7.csv", "wb") ########### Name csv file (parsing output)341outfilehandle = csv.writer(fout,342 delimiter=",",343 quotechar='"',344 quoting=csv.QUOTE_NONNUMERIC)345check = open(mydir2 + "check_recusals_DCKnownPost1990_9-7.csv", "wb") ########### Name csv file (recusals)346recuse_handle = csv.writer(check,347 delimiter=",",348 quotechar='"',349 quoting=csv.QUOTE_NONNUMERIC)350master = open(mydir + "States_MasterFile_Import.csv", "rb")351# Create your own label for each column of the metadata .csv file352localrow = []353localrow.append("Email")354localrow.append("FirstName")355localrow.append("LastName")356localrow.append("court")357localrow.append("date")358localrow.append("state")359localrow.append("panel_state")360localrow.append("parties")361localrow.append("docket")362localrow.append("citestring")363localrow.append("LexisCite")364localrow.append("WestLaw")365localrow.append("attorneys")366localrow.append("judges")367localrow.append("judgeNP")368localrow.append("Judge1_Last_Name")369localrow.append("Judge1_Vote")370localrow.append("Judge1_code")371localrow.append("Judge2_Last_Name")372localrow.append("Judge2_Vote")373localrow.append("Judge2_code")374localrow.append("Judge3_Last_Name")375localrow.append("Judge3_Vote")376localrow.append("Judge3_code")377localrow.append("Judge4_Last_Name")378localrow.append("Judge4_Vote")379localrow.append("Judge4_code")380localrow.append("Judge5_Last_Name")381localrow.append("Judge5_Vote")382localrow.append("Judge5_code")383localrow.append("Judge6_Last_Name")384localrow.append("Judge6_Vote")385localrow.append("Judge6_code")386localrow.append("Judge7_Last_Name")387localrow.append("Judge7_Vote")388localrow.append("Judge7_code")389localrow.append("Judge8_Last_Name")390localrow.append("Judge8_Vote")391localrow.append("Judge8_code")392localrow.append("Judge9_Last_Name")393localrow.append("Judge9_Vote")394localrow.append("Judge9_code")395localrow.append("Judge10_Last_Name")396localrow.append("Judge10_Vote")397localrow.append("Judge10_code")398localrow.append("Judge11_Last_Name")399localrow.append("Judge11_Vote")400localrow.append("Judge11_code")401localrow.append("dissent")402localrow.append("dissent_no")403localrow.append("dissent_name")404localrow.append("dissent_1")405localrow.append("dissent_2")406localrow.append("dissent_3")407localrow.append("dissent_4")408localrow.append("dissent_5")409localrow.append("concurrence")410localrow.append("concur_no")411localrow.append("concur_name")412localrow.append("check")413outfilehandle.writerow(localrow)414recuse_handle.writerow(localrow)415# Name of folder where all cases are located (and nothing else)416dirname = mydir + "DCKnownPost1990/" ########### Change to where txt files are located417dirlist = os.listdir(dirname)418cleandirlist = []419for entry in dirlist:420 matchresult = re.match('.+\\.txt$', entry)421 if matchresult != None:422 cleandirlist.append(matchresult.group())423#dirlist = [file for file in dirlist if len(file) > 20]424# Use (uncomment) following line to test code on a small handful of cases425#cleandirlist = cleandirlist[838:872]426for entry in cleandirlist: ## each entry is a txt file with an opinion 0:1025427 # initialize all variables to be used428 infilepath = dirname + entry429 infilehandle = open(infilepath)430 txtlines = infilehandle.readlines()431 action_number = 0432 case_with_preamble = False433 searchterms_line = False434 blank_after_searchterms = False435 parties_line = False436 blank_after_parties = False437 docket_line = False438 blank_after_docket = False439 court_line = False440 blank_after_court = False441 fn_line = False442 cite_line = False443 blank_after_cite = False444 action_line = False445 disposition_line = False446 prior_history_line = False447 headnotes_line = False448 trunc_text = False449 judges_line = False450 opin_by_line = False451 opinion_line = False452 dissent_by_line = False453 concur_by_line = False454 blank_after_appellant_attorney = False455 jud_dissent = 0456 opinion_word_count = 0457 amicus = 0458 localrow = []459 action_number = 0460 judges_part_string = ""461 searchterms_string = ""462 shep_treat = ""463 parties_string = ""464 docketnum = ""465 court_string = ""466 cite_string = ""467 Fed_cite = ""468 Lexis_cite = ""469 West_cite = ""470 action_string = ""471 per_curiam = 0472 unanimous = 0473 action1 = ""474 date = ""475 action1_month = ""476 action1_day = ""477 action1_year = ""478 action1_date = ""479 action1_action = ""480 action2 = ""481 action2_month = ""482 action2_day = ""483 action2_year = ""484 action2_date = ""485 action2_action = ""486 prior_history_string = ""487 sub_history_string = ""488 disposition_string = ""489 pubdef = 0490 prose = 0491 attorney_string = ""492 pc_holder = ""493 judges_string = ""494 judge1_ln = ""495 judge1_fn = ""496 judge1_mn = ""497 judge1_suf = ""498 judge1_full = ""499 judge2_ln = ""500 judge2_fn = ""501 judge2_mn = ""502 judge2_suf = ""503 judge2_full = ""504 judge3_ln = ""505 judge3_fn = ""506 judge3_mn = ""507 judge3_suf = ""508 judge3_full = ""509 judge4_ln = ""510 judge4_fn = ""511 judge4_mn = ""512 judge4_suf = ""513 judge4_full = ""514 judge5_ln = ""515 judge5_fn = ""516 judge5_mn = ""517 judge5_suf = ""518 judge5_full = ""519 judge6_ln = ""520 judge6_fn = ""521 judge6_mn = ""522 judge6_suf = ""523 judge6_full = ""524 judge7_ln = ""525 judge7_fn = ""526 judge7_mn = ""527 judge7_suf = ""528 judge7_full = ""529 judge8_ln = ""530 judge8_fn = ""531 judge8_mn = ""532 judge8_suf = ""533 judge8_full = ""534 judge9_ln = ""535 judge9_fn = ""536 judge9_mn = ""537 judge9_suf = ""538 judge9_full = ""539 judge10_ln = ""540 judge10_fn = ""541 judge10_mn = ""542 judge10_suf = ""543 judge10_full = ""544 judge11_ln = ""545 judge11_fn = ""546 judge11_mn = ""547 judge11_suf = ""548 judge11_full = ""549 opin_by_string = ""550 author_ln = ""551 author_fn = ""552 author_mn = ""553 author_suf = ""554 author_full = ""555 dissent1_ln = ""556 dissent1_fn = ""557 dissent1_mn = ""558 dissent1_suf = ""559 dissent1_full = ""560 dissent2_ln = ""561 dissent2_fn = ""562 dissent2_mn = ""563 dissent2_suf = ""564 dissent2_full = ""565 dissent3_ln = ""566 dissent3_fn = ""567 dissent3_mn = ""568 dissent3_suf = ""569 dissent3_full = ""570 dissent4_ln = ""571 dissent4_fn = ""572 dissent4_mn = ""573 dissent4_suf = ""574 dissent4_full = ""575 dissent5_ln = ""576 dissent5_fn = ""577 dissent5_mn = ""578 dissent5_suf = ""579 dissent5_full = ""580 concur1_ln = ""581 concur1_fn = ""582 concur1_mn = ""583 concur1_suf = ""584 concur1_full = ""585 concur2_ln = ""586 concur2_fn = ""587 concur2_mn = ""588 concur2_suf = ""589 concur2_full = ""590 concur3_ln = ""591 concur3_fn = ""592 concur3_mn = ""593 concur3_suf = ""594 concur3_full = ""595 concur4_ln = ""596 concur4_fn = ""597 concur4_mn = ""598 concur4_suf = ""599 concur4_full = ""600 concur5_ln = ""601 concur5_fn = ""602 concur5_mn = ""603 concur5_suf = ""604 concur5_full = ""605 concur6_ln = ""606 concur6_fn = ""607 concur6_mn = ""608 concur6_suf = ""609 concur6_full = ""610 concur7_ln = ""611 concur7_fn = ""612 concur7_mn = ""613 concur7_suf = ""614 concur7_full = ""615 concur_by_string = ""616 dissent_by_string = ""617 no_part_list = [] ####618 no_part_string = "" ####619 full_judges_holder = []620 judges_holder = []621 dissent_holder = []622 concur_holder = []623 no_part = False624 no_part_dich = 0625 shep_line = False626 blank_after_shep = False627 court_line = False628 blank_after_court = False629 cite_line = False630 blank_after_cite = False631 action_line = False632 disposition_line = False633 prior_history_line = False634 headnotes_line = False635 sub_history_line = False636 judges_line = False637 attorney_line = False638 #appellee_attorney_line = False639 opin_by_line = False640 opinion_line = False641 dissent_by_line = False642 concur_by_line = False643 dissent_author_1 = ""644 dissent_author_2 = ""645 dissent_author_3 = ""646 dissent_author_4 = ""647 dissent_author_5 = ""648 opinion_word_count = 0649 circuit = 0650 en_banc = ""651 dissent = 0652 concur = 0653 rehearing = ""654 check_case = 0655 op_string = ""656 unpublished = 0657 num_dissent = 0658 num_concur = 0659 unwritten_dissent = 0660 firstcite_line = False661 firstcite_string = ""662 blank_after_firstcite = False663 caseid = str(re.split("\.", entry)[0])664 print "\n" + entry665 pet_str = ""666 res_str = ""667 opinion_start = False668 dissent_line = False669 concur_line = False670 blank_after_action = False671 line_before_first = False672 judge1_vote = ""673 judge2_vote = ""674 judge3_vote = ""675 judge4_vote = ""676 judge5_vote = ""677 judge6_vote = ""678 judge7_vote = ""679 judge8_vote = ""680 judge9_vote = ""681 judge10_vote = ""682 judge11_vote = ""683 panel = 0684 judges_np = ""685 state_abbr = ""686 judge_np_list = []687 judge_np1 = ""688 judge_np2 = ""689 judge_np3 = ""690 judge_np4 = ""691 other_dissent_string = ""692 other_dissent_judges = []693 silent_dissent = False694 silent_judge1 = ""695 silent_judge2 = ""696 silent_judge3 = ""697 silent_judge4 = ""698 silent_judge5 = ""699 first_dissent = False700 other_dissent = ""701 new_date = ""702 date_bool = False703 between = False704 non_panel_judge_string = ""705 other_dissent_holder = []706 part_judges = ""707 judge1_code = ""708 judge2_code = ""709 judge3_code = ""710 judge4_code = ""711 judge5_code = ""712 judge6_code = ""713 judge7_code = ""714 judge8_code = ""715 judge9_code = ""716 judge10_code = ""717 judge11_code = ""718 one_month = datetime.timedelta(365*3) #/12719 judges_AL = []720 MD_date = False721 dock = False722 docket = False723 check_recuse = False724 check_recuse_case = 0725 start = datetime.datetime.strptime('1/1/1800', '%m/%d/%Y').date()726 end = datetime.datetime.strptime('12/31/2100', '%m/%d/%Y').date()727 date_format = datetime.datetime.strptime('1/1/1800', '%m/%d/%Y').date()728 # each txtline is one "line" in the text file: the end of a line is determined by \n729 for txtline in txtlines:730 # proceeding logic of script based on boolean operators causes all text prior to the line beginning with "Copy Citation" to be ignored731 if (re.search("^Copy Citation",txtline)):732 line_before_first = True733 if (line_before_first and re.search("(COURT|Court)", txtline) and not re.search("^1 ", txtline)):734 ## the court in which the case was heard735 line_before_first = False736 court_line = True737 court_string = court_string + txtline738 court_string = court_string.strip()739 print court_string740 state_abbr = state_ab(court_string) ###function to return state abbreviations741 if (re.search("Alabama|Arizona|Connecticut|Delaware|Florida|Idaho|Massachusetts|Mississippi|Montana|Nevada|New Hampshire|Virginia", court_string)):742 # all cases in states that hear cases in panels are given a value of 1743 panel = 1744 if re.search("West Virginia", court_string):745 # the prior if statement matches "Virginia" in "West Virginia"; this corrects the incorrect panel assignment value746 panel = 0747 if(court_line and re.search("Jan|Feb|Mar|Apr|May|June|July|Aug|Sep|Oct|Nov|Dec|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC", txtline)) and state_abbr != "MD" and not re.search("Argued$", txtline): #re.match("^[\s]+$", txtline)):748 ## this is the blank line after court749 # stores date and action of court (i.e. Decided, Released, Filed)750 blank_after_firstcite = False751 court_line = False752 blank_after_court = True753 #print txtline754 action_line = True755 if (len(action_string) < 1):756 action_string = action_string + txtline757 dock = True758 if len(action_string) < 2:759 MD_date = True760 if state_abbr == "MD" and re.match("Jan|Feb|Mar|Apr|May|June|July|Aug|Sep|Oct|Nov|Dec", txtline) and MD_date == True:761 action_string = txtline762 MD_date = False763 blank_after_firstcite = False764 court_line = False765 blank_after_court = True766 #print txtline767 action_line = True768 if(action_line): #and re.match("^[\s]+$", txtline)):769 # parse out unnecessary text from action string (Date and Procedural Documentation of Publication) for only the date to remain770 blank_after_court = False771 blank_after_action = True772 action_line = False773 if re.search("Argued; ;", action_string):774 action_string = action_string.split("Argued; ;", 1)[1]775 if re.search("Argued ;", action_string):776 action_string = action_string.split("Argued ;", 1)[1]777 if re.search("Argued;", action_string):778 action_string = action_string.split("Argued;", 1)[1]779 if re.search("Argued and submitted ;", action_string):780 action_string = action_string.split("Argued and submitted ;", 1)[1]781 if re.search("Argued and submitted;", action_string):782 action_string = action_string.split("Argued and submitted;", 1)[1]783 if re.search("Submitted ;", action_string):784 action_string = action_string.split("Submitted ;", 1)[1]785 if re.search("Submitted;", action_string):786 action_string = action_string.split("Submitted;", 1)[1]787 if re.search("Submitted on Briefs ;", action_string):788 action_string = action_string.split("Submitted on Briefs ;", 1)[1]789 if re.search("Submitted on Briefs;", action_string):790 action_string = action_string.split("Submitted on Briefs;", 1)[1]791 if re.search("Heard in the Supreme Court ;", action_string):792 action_string = action_string.split("Heard in the Supreme Court ;", 1)[1]793 if re.search("Heard in the Supreme Court;", action_string):794 action_string = action_string.split("Heard in the Supreme Court;", 1)[1]795 if re.search("Heard ;", action_string):796 action_string = action_string.split("Heard ;", 1)[1]797 if re.search("Heard;", action_string):798 action_string = action_string.split("Heard;", 1)[1]799 if re.search("Session;", action_string):800 action_string = action_string.split("Session;", 1)[1]801 if re.search("Session ;", action_string):802 action_string = action_string.split("Session ;", 1)[1]803 if re.search("Argument ;", action_string):804 action_string = action_string.split("Argument ;", 1)[1]805 if re.search("Argument;", action_string):806 action_string = action_string.split("Argument;", 1)[1]807 print action_string808 action_string = expandmonth(action_string)809 action_string = re.sub(":", ",", action_string)810 action_string = re.sub(";", ",", action_string)811 action_string = re.sub("\*", "", action_string)812 action_string = re.sub("Argued and Submitted ", "Argued and Submitted, ", action_string)813 action_string = re.sub("Argued ", "Argued, ", action_string)814 action_string = re.sub(", Decided ", "", action_string)815 action_string = re.sub("Supplemental Briefing Submitted ", "Supplemental Briefing Submitted, ", action_string)816 action_string = re.sub(", Released", "", action_string)817 action_string = re.sub(", RELEASED", "", action_string)818 action_string = re.sub(", Filed", "", action_string)819 action_string = re.sub("Submitted Under Third Circuit Rule 12\(6\) ", "Submitted Under Third Circuit Rule 12(6), ", action_string)820 action_string = re.sub("Cause argued ", "Cause argued, ", action_string)821 split_action = re.split("\n", action_string)822 action1 = string.strip(split_action[0])823 action2 = string.strip(split_action[1])824 action2 = re.split(", ", action2)825 action1 = re.split(", ", action1)826 if(len(split_action) < 2):827 action1[1] = re.sub("\.", "", action1[1])828 action1[1] = re.sub(",", "", action1[1])829 action1[0] = re.sub("Argued ", "", action1[0])830 action1[0] = re.sub("Submitted ", "", action1[0])831 date = date + action1[0] + ", " + action1[1]832 if(len(action1) > 2 and len(date) == 0 and re.search("Decided|DECIDED", action1[2])):833 date = date + action1[0] + ", " + action1[1]834 if(len(action1) > 2 and len(date) == 0 and re.search("Filed|FILED", action1[2])):835 date = date + action1[0] + ", " + action1[1]836 if(len(action2) > 2 and len(date) == 0 and re.search("Decided|DECIDED", action2[2])):837 date = date + action2[0] + ", " + action2[1]838 if(len(action2) > 2 and len(date) == 0 and re.search("Filed|FILED", action2[2])):839 date = date + action2[0] + ", " + action2[1]840 if(len(action2) > 1 and len(date)==0):841 date = date + action2[0] + ", " + action2[1]842 date = re.sub(",$", "", date)843 date = re.sub("\*", "", date)844 date = re.sub("\.", "", date)845 if(len(action2) > 1 and len(date)==0):846 date = date + action2[0] + ", " + action2[1]847 date = re.sub(",$", "", date)848 date = re.sub("\.", "", date)849 action_string = string.strip(action_string)850 action_string = re.sub("[\s]+", " ", action_string)851 action_string = re.sub("Decided|decided|DECIDED", " ", action_string)852 action_string = re.sub("Filed|filed|FILED", " ", action_string)853 # one case has incorrect formatting of the date and it causes the program to break when calling teh strptime function854 if action_string == "December 22 1995":855 action_string = "December 22, 1995"856 # Dates from Maryland cases do not parse correctly857 if action_string != "Court of Appeals of Maryland":858 x = re.search("\d{4}", action_string)859 # store in x the position of the last digit of the year860 try:861 x = x.end()862 except:863 pass864 if new_date == "":865 date_bool = True866 if(x != -1 and date_bool):867 new_date = action_string[:x]868 date_bool = False869 if(x == -1):870 new_date = action_string871 if state_abbr != "MC":872 # format dates so they match the format from the state judge master file873 new_date = re.sub("April,", "April", new_date)874 new_date = re.sub("On ", "", new_date)875 try:876 date_format = datetime.datetime.strptime(new_date, '%B %d, %Y').date()877 except:878 date_format = datetime.datetime.strptime('1/1/1800', '%m/%d/%Y').date()879 elif state_abbr == "MC":880 date_format = datetime.datetime.strptime('1/1/1800', '%m/%d/%Y').date()881 # match state abbrevation and date decided from case and state master file to produce a list of judges who were on the bench at time of decision for cases heard in non-panel state882 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:883 reader = csv.reader(f)884 next(f)885 for row in reader:886 state = row[0]887 name = row[3]888 if len(row[4]) == 4 and row[0] != "MC":889 row[4] = "1/1/" + row[4]890 if len(row[5]) == 4 and row[0] != "MC": #and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL"))) and len(judge6_ln) > 2 and len(judge9_ln) < 2:891 row[5] = "1/1/" + row[5]892 #print state_abbr893 #print(len(row[4]))894 if len(row[4]) != 4 and row[0] != "MC" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH"))) and ((len(judge6_ln) > 2 or len(judge3_ln) < 2) and len(judge9_ln) < 2) and state_abbr:895 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()896 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date()897 if ((panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and state_abbr != "AK" and (len(judge6_ln) > 2) and len(judge9_ln) < 2)) and start <= date_format <= end):898 between = True899 #print state_abbr900 if ((state == state_abbr) and between and row[0] != "MC" and row[2] == 0 and state_abbr != "AK" and (panel == 0 or (state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH")) and (len(judge6_ln) > 2 or len(judge3_ln) < 2) and len(judge9_ln) < 2):901 if non_panel_judge_string == "":902 non_panel_judge_string = non_panel_judge_string + row[3]903 else:904 non_panel_judge_string = non_panel_judge_string + ", " + row[3]905 if row[3] == judge1_ln:906 judge1_code = row[1]907 between = False908 #judges_string = judges_string + ", " + non_panel_judge_string909 non_panel_list = non_panel_judge_string.split(",")910 non_panel_list.sort()911 master.close()912 if (docketnum == "") or not re.search("[0-9]", docketnum):913 if(not re.search("LEXIS", txtline) and re.search("^([\d]+$|Docket|Misc|No\.|Nos\.|SC |File Nos. |File No. |Arizona Supreme Court No. |L. A. Nos. |SCWC-|Cause No. |Supreme Court Cause Number |S[\d][\d]|A[\d][\d]|S. Ct. NO. |[\d] Div. |CASE NO.:|L.A. No. |\[NO NUMBER|\[No number in original|[\w]-|Supreme Court Case |Supreme Court No. |Supreme Court No. |Supreme Court Case No. |Law Docket No. |SUPREME COURT DOCKET NO. |Record No. |SUPREME COURT DOCKET NO. |Sac. No. |\([\d]+\)|\(SC |NO|C\.A\.|\# [\d]|[\d][\d][\d][\d]-|SJC-|Decision No. |DA |CA |[\d][\d]-|91-|Opinion No\.|DOCKET|Case No|[\d][\d][\d][\d][\d][\d][\d], [\d][\d][\d][\d][\d][\d][\d]|S[\d][\d][\d][\d][\d][\d]|Yor-[\d][\d]|Cum-[\d][\d]|C[\d]-[\d]|Case Number:|S.C. No. |NO.|Appeal No. |Supreme Court Nos. |S.F. No. |SCCQ-[\d]|[\d][\d][\d][\d][\d]-|Indiana Supreme Court Cause No. |[\d]|[\d][\d][\d][\d][\d][\d][\d])", txtline) and not re.search("Supreme Court of Pennsylvania",txtline) and not re.search("Supreme Court of Delaware",txtline) and not re.search("Court of Appeals of New York",txtline) and not re.search("^1. ",txtline) and not re.search("^2. ",txtline) and not re.search("^3. ",txtline) and not re.search("^4. ",txtline) and not re.search("^5. ",txtline)):914 ## the docket number915 docket_line = True916 action_line = False917 blank_after_action = True918 docketnum = docketnum + txtline919 ##OLDER PA (and some DE) CASES DON'T HAVE DOCKETS. THIS FIXES THE ISSUE920 elif(blank_after_action and not re.search("^([\d]+$|Docket|Misc|No\.|Nos\.|SC |File Nos. |File No. |Arizona Supreme Court No. |L. A. Nos. |SCWC-|Cause No. |Supreme Court Cause Number |S[\d][\d]|A[\d][\d]|S. Ct. NO. |[\d] Div. |CASE NO.:|L.A. No. |\[NO NUMBER|\[No number in original|[\w]-|Supreme Court Case |Supreme Court No. |Supreme Court No. |Supreme Court Case No. |Law Docket No. |SUPREME COURT DOCKET NO. |Record No. |SUPREME COURT DOCKET NO. |Sac. No. |\([\d]+\)|\(SC |NO|C\.A\.|\# [\d]|[\d][\d][\d][\d]-|SJC-|Decision No. |DA |CA |[\d][\d]-|91-|Opinion No\.|DOCKET|Case No|[\d][\d][\d][\d][\d][\d][\d], [\d][\d][\d][\d][\d][\d][\d]|S[\d][\d][\d][\d][\d][\d]|Yor-[\d][\d]|Cum-[\d][\d]|C[\d]-[\d]|Case Number:|S.C. No. |NO.|Appeal No. |Supreme Court Nos. |S.F. No. |SCCQ-[\d]|[\d][\d][\d][\d][\d]-|Indiana Supreme Court Cause No. |[\d]|[\d][\d][\d][\d][\d][\d].)", txtline) and re.search("Supreme Court of Pennsylvania",txtline) or re.search("Supreme Court of Delaware",txtline) or re.search("Court of Appeals of New York",txtline)):921 ## the docket number922 docketnum = docketnum + txtline923 docket_line = True924 action_line = False925 blank_after_docket = True926 if(re.match("^Reporter", txtline) and not opinion_start):927 ## this is the "Reporter" line after docket number928 blank_after_action = False929 docket_line = False930 blank_after_docket = True931 if(re.search(" > ", docketnum)):932 docketnum = ""933 # Store all citations listed by Lexis934 if((blank_after_docket) and re.search("LEXIS", txtline) and re.search("[\w]+", txtline) and not opinion_start):935 ## the citation block936 cite_line = True937 cite_string = cite_string + txtline938 cite_string = re.sub("[\s]+", " ", cite_string)939 cite_string = re.sub("[\*]+", "", cite_string)940 cite_string = re.sub("\xc2", "", cite_string)941 cite_string = re.sub("\xa0", "", cite_string)942 West_cite = cite_string.split("|")[0]943 #print West_cite944 if(cite_line and re.match("^[\s]+$", txtline)):945 ## done with citation block946 blank_after_docket = False947 cite_line = False948 blank_after_cite = True949 all_cites = re.split(" [\|] ", cite_string)950 ####print all_cites951 ##Fed_cite = [cite for cite in all_cites if re.search("[\s]F\.(2|3)d", cite)]952 Lexis_cite = [cite for cite in all_cites if re.search("LEXIS", cite)]953 try:954 ## Fed_cite = string.strip(Fed_cite[0])955 Lexis_cite = string.strip(Lexis_cite[0])956 except:957 print "Problem with citation"958 if(blank_after_cite and re.match("[\w]+", txtline)):959 ## the parties960 parties_line = True961 parties_string = parties_string + txtline962 #print txtline.replace("\n", "")963 # Store names of parties to the case964 if (parties_line and re.match("^[\s]+$", txtline)):965 ## done with parties block966 blank_after_cite = False967 parties_line = False968 blank_after_parties = True969 parties_string = re.sub("[\s]+", " ", parties_string)970 # Store text in Prior and Subsequent History lines971 if(re.match("^Subsequent History:", txtline)):972 sub_history_line = True973 parties_line = False974 if(sub_history_line and re.search("[\w]+", txtline)):975 sub_history_string = sub_history_string + txtline976 if (prior_history_line and re.match("^[\s]+$", txtline)):977 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)978 prior_history_string = re.sub("Prior History:", "", prior_history_string)979 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)980 prior_history_string = re.sub("\xa0", " ", prior_history_string)981 prior_history_string = re.sub("\n|\r", " ", prior_history_string)982 prior_history_string = string.strip(prior_history_string)983 sub_history_line = False984 if(re.match("^Prior History:", txtline)):985 prior_history_line = True986 parties_line = False987 if(prior_history_line and re.search("[\w]+", txtline)):988 prior_history_string = prior_history_string + txtline989 if (prior_history_line and re.match("^[\s]+$", txtline)):990 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)991 prior_history_string = re.sub("Prior History:", "", prior_history_string)992 prior_history_string = re.sub("Procedural Posture:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)993 prior_history_string = re.sub("Procedural Posture:", "", prior_history_string)994 prior_history_string = re.sub("\xa0", " ", prior_history_string)995 prior_history_string = re.sub("\n|\r", " ", prior_history_string)996 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)997 prior_history_string = string.strip(prior_history_string)998 prior_history_line = False999 if(re.match("^Procedural Posture:", txtline) and prior_history_string == ""):1000 prior_history_line = True1001 parties_line = False1002 if(prior_history_line and re.search("[\w]+", txtline)):1003 prior_history_string = prior_history_string + txtline1004 if (prior_history_line and re.match("^[\s]+$", txtline)):1005 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)1006 prior_history_string = re.sub("Prior History:", "", prior_history_string)1007 prior_history_string = re.sub("Procedural Posture:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)1008 prior_history_string = re.sub("Procedural Posture:", "", prior_history_string)1009 prior_history_string = re.sub("\xa0", " ", prior_history_string)1010 prior_history_string = re.sub("\n|\r", " ", prior_history_string)1011 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)1012 prior_history_string = string.strip(prior_history_string)1013 prior_history_line = False1014 ###RKH USES OUTCOME instead of DISPOSITION because not every case has a DISPOSITION1015 if (re.match("^Disposition:", txtline) and disposition_string == ""):1016 ## disposition of case1017 disposition_line = True1018 #print disposition_string1019 if (disposition_line and re.search("[\w]+", txtline)):1020 ## disposition lines with text1021 disposition_string = disposition_string + txtline1022 #print disposition_string1023 if (disposition_line and re.match("^[\s]+$", txtline)):1024 ## blank line after disposition line1025 disposition_string = re.sub("Disposition:", "", disposition_string)1026 disposition_string = re.sub("Outcome:", "", disposition_string)1027 disposition_string = re.sub("\xa0", " ", disposition_string)1028 disposition_string = re.sub("\n|\r", " ", disposition_string)1029 disposition_string = re.sub("\[.+\]", "", disposition_string)1030 disposition_string = string.strip(disposition_string)1031 #print disposition_string1032 disposition_line = False1033 # Store outcome of case1034 if (re.match("^Outcome:", txtline)):1035 ## disposition of case1036 disposition_line = True1037 #print disposition_string1038 if (disposition_line and re.search("[\w]+", txtline)):1039 ## disposition lines with text1040 disposition_string = disposition_string + txtline1041 #print disposition_string1042 if (disposition_line and re.match("^[\s]+$", txtline)):1043 ## blank line after disposition line1044 disposition_string = re.sub("Outcome:", "", disposition_string)1045 disposition_string = re.sub("Disposition:", "", disposition_string)1046 disposition_string = re.sub("\xa0", " ", disposition_string)1047 disposition_string = re.sub("\n|\r", " ", disposition_string)1048 disposition_string = re.sub("\[.+\]", "", disposition_string)1049 disposition_string = re.sub("\[\**\d*\]", "", disposition_string)1050 disposition_string = string.strip(disposition_string)1051 #print disposition_string1052 disposition_line = False1053 # Search for presence of Per Curiam opinion1054 if re.search("^Opinion", txtline):1055 first_dissent = True1056 if (re.search("Opinion By: (PER CURIAM)|(Per Curiam)", txtline)):1057 #pc_holder = pc_holder + "Per Curiam. "1058 per_curiam = 11059 if (re.search("PER CURIAM", txtline)):1060 #pc_holder = pc_holder + "Per Curiam. "1061 per_curiam = per_curiam + 11062 if (re.search("^[\s]*Per Curiam[\.:\s]*$", txtline)):1063 per_curiam = 11064 #print pc_holder + "\n"1065 # Search for judges that join in dissenting opinions but are not listed as such in the judge line1066 if((first_dissent == True and re.search("dissents\.$|dissent\.$|dissenting\.$", txtline) and len(txtline) < 100 and not re.search("I respectfully dissent\.|I dissent\.|I therefore respectfully dissent\.", txtline)) or (re.search("joined\.$", txtline) and re.search("dissent", txtline))):1067 #print repr(txtline)1068 first_dissent = False1069 other_dissent = re.sub(" and", ",", txtline)1070 other_dissent = re.sub("filed a dissenting opinion", "", other_dissent)1071 other_dissent = re.sub("delivered the Opinion of the Court", "", other_dissent)1072 other_dissent = re.sub("All the Justices concur", "", other_dissent)1073 other_dissent = re.sub("\[\**\d\]", "", other_dissent)1074 other_dissent = re.sub("C\.J\.", "", other_dissent)1075 other_dissent = re.sub(" C\.", "", other_dissent)1076 other_dissent = re.sub("\[\*\*[0-9]+\]", "", other_dissent)1077 other_dissent = re.sub("For those reasons", "", other_dissent)1078 other_dissent = re.sub("dissenting", "", other_dissent)1079 other_dissent = re.sub("dissents\.|dissent\.|dissents|dissent", "", other_dissent)1080 other_dissent = re.sub("J\.;", "", other_dissent)1081 other_dissent = re.sub("C\.J\.|JJ\.|J\.J\.|J\.|C\. J\.", "", other_dissent)1082 #print other_dissent1083 if re.search("deliver", other_dissent):1084 other_dissent = other_dissent.split(".", 1)[1]1085 if re.search("filed a concurring opinion", other_dissent):1086 other_dissent = other_dissent.split(".", 1)[1]1087 #print other_dissent1088 other_dissent = re.sub("joined\.|joined|joins|join|JOINS|JOIN", "", other_dissent)1089 other_dissent = re.sub("in the|IN THE", "", other_dissent)1090 other_dissent = re.sub("in this", "", other_dissent)1091 other_dissent = re.sub("in which", "", other_dissent)1092 other_dissent = re.sub("Special Justice", "", other_dissent)1093 other_dissent = re.sub("JUSTICES|Justices|justices|JUSTICE|Justice|justice", "", other_dissent)1094 other_dissent = re.sub("\xc2", "", other_dissent)1095 other_dissent = re.sub("CHIEF|Chief|chief", "", other_dissent)1096 other_dissent = re.sub("Order affirmed, with costs", "", other_dissent)1097 other_dissent = re.sub("Opinion by|opinion by|OPINION BY", "", other_dissent)1098 other_dissent = re.sub("Judges|judges|JUDGES|judge|Judge|JUDGE", "", other_dissent)1099 other_dissent = re.sub("concurs|CONCURS|concur|CONCUR", "", other_dissent)1100 other_dissent = re.sub("\xa0", "", other_dissent)1101 other_dissent = re.sub("In Part", "", other_dissent)1102 other_dissent = re.sub("in part\.", "", other_dissent)1103 other_dissent = re.sub("in part", "", other_dissent)1104 other_dissent = re.sub("\[\*\*\*[\w]+\]", "", other_dissent)1105 other_dissent = re.sub("I respectfully", "", other_dissent)1106 other_dissent = re.sub("respectfully|RESPECTFULLY|Respectfully", "", other_dissent)1107 #other_dissent = re.sub("")1108# other_dissent = re.sub("\s", "", other_dissent)1109 other_dissent = re.sub("this", "", other_dissent)1110 other_dissent = re.sub("with whom", "", other_dissent)1111 other_dissent = re.sub("except", "", other_dissent)1112 other_dissent = re.sub(" who", "", other_dissent)1113 other_dissent = re.sub("reversed|REVERSED|reverse|REVERSE", "", other_dissent)1114 other_dissent = re.sub("authorizes me to state", "", other_dissent)1115 other_dissent = re.sub("that she", "", other_dissent)1116 other_dissent = re.sub("the views expressed", "", other_dissent)1117 other_dissent = re.sub("foregoing", "", other_dissent)1118 other_dissent = re.sub(" JR\.| JR", "", other_dissent)1119 other_dissent = re.sub(" SR\.| SR", "", other_dissent)1120 other_dissent = re.sub("specially|Specially|SPECIALLY", "", other_dissent)1121 other_dissent = re.sub("Order affirmed, with costs", "", other_dissent)1122 other_dissent = re.sub("affirmed|AFFIRMED", "", other_dissent)1123 other_dissent = re.sub("reason|reasons", "", other_dissent)1124 other_dissent = re.sub("'", "", other_dissent)1125 other_dissent = re.sub("Justice", "", other_dissent)1126 other_dissent = re.sub("filed an opinion", "", other_dissent)1127 other_dissent = re.sub("concurring in part", "", other_dissent)1128 other_dissent = re.sub("Part I", "", other_dissent)1129 other_dissent = re.sub("in part", "", other_dissent)1130 other_dissent = re.sub("Part|part", "", other_dissent)1131 dissent = 11132 other_dissent_holder = other_dissent.split(",")1133 other_dissent_holder = filter(None, other_dissent_holder)1134 if (re.search("^<truncate>", txtline)):1135 trunc_text = True1136 if (re.search("^</truncate>", txtline)):1137 trunc_text = False1138 if (re.match("^Counsel:", txtline) and not opinion_line):1139 attorney_line = True1140 # Store attorneys for appellee and appellant1141 if (attorney_line and re.search("^Judges|^Opinion", txtline) and not opinion_start and not re.search("^Opinion No.",txtline)):1142 attorney_line = False1143 attorney_string = re.sub("Counsel:\[\**\d*\]", "", attorney_string)1144 attorney_string = re.sub("Counsel:", "", attorney_string)1145 attorney_string = re.sub("\[\**\d*\]", "", attorney_string)1146 attorney_string = re.sub("\xa0", " ", attorney_string)1147 attorney_string = re.sub("\xc2", " ", attorney_string)1148 attorney_string = re.sub("\n|\r", " ", attorney_string)1149 attorney_string = string.strip(attorney_string)1150 attorney_line = False1151 if(attorney_line):1152 attorney_string = attorney_string + txtline1153 attorney_string = re.sub("Counsel:\[\**\d*\]", "", attorney_string)1154 attorney_string = re.sub("Counsel:", "", attorney_string)1155 attorney_string = re.sub("\[\**\d*\]", "", attorney_string)1156 attorney_string = re.sub("\xa0", " ", attorney_string)1157 attorney_string = re.sub("\xc2", " ", attorney_string)1158 attorney_string = re.sub("\n|\r", " ", attorney_string)1159 attorney_string = string.strip(attorney_string)1160 attorney_line = False1161 if (re.search("Public|public|PUBLIC|defender|DEFENDER|Defender", attorney_string)):1162 pubdef = 11163 if (re.search("(pro se)|(Pro se)|(Pro Se)|(pro Se)", attorney_string)):1164 prose = 11165 if (re.match("^Judges:", txtline) and not trunc_text):1166 ## judges hearing case1167 judges_line = True1168 if (judges_line and re.search("[\w]+", txtline)):1169 ## judges lines with text1170 judges_string = judges_string + txtline #+ ", " + non_panel_judge_string1171 if (judges_line and re.match("^[\s]+$", txtline)):1172 # new line or some whitespace after judges line1173 # Store and parse text of judges that recused themselves from the case1174 if (re.search("((N|n)ot (P|p)articipat(e|ing)|(R|r)ecus(e|es|ed)|RECUSED|(T|t)ak(e|es) no part| sitting for| disqualified|took no part|NOT PARTICIPATING|sitting in lieu of|sitting for)", judges_string)):1175 no_part = True1176 no_part_dich = 11177 if len(re.findall('not participating|recusal|recused|disqualif|sitting for', judges_string)) > 1 or (re.search('not participating|recusal|recused|disqualif|sitting for', judges_string) and len(judges_string) > 300):1178 check_recuse = True1179 check_recuse_case = 11180 full_judges_holder = re.sub(", (J|JJ)\.", " ", judges_string)1181 full_judges_holder = re.sub(" O\.", "", full_judges_holder)1182 full_judges_holder = re.sub(" C\.", "", full_judges_holder)1183 full_judges_holder = re.sub(" W\.", "", full_judges_holder)1184 full_judges_holder = re.split("\. ", full_judges_holder)1185 no_part_string = [sentence for sentence in full_judges_holder if re.search("((N|n)ot (P|p)articipat(e|ing)|(R|r)ecus(e|es|ed)|RECUSED| sitting for| disqualified|took no part|(T|t)ak(e|es) no part)|NOT PARTICIPATING|sitting in lieu of", sentence)]1186 no_part_string = str(no_part_string)1187 no_part_string = re.sub("(N|n)ot (P|p)articipat(e|ing).*", "", no_part_string)1188 no_part_string = re.sub("NOT PARTICIPATING", "", no_part_string)1189 no_part_string = re.sub("Recus(es|ed|e)", "", no_part_string)1190 no_part_string = re.sub("took no part in the consideration or decision of this case", "", no_part_string)1191 no_part_string = re.sub("took no part in the decison", "", no_part_string)1192 no_part_string = re.sub('sat but', '', no_part_string)1193 if re.search("except", no_part_string):1194 no_part_string = no_part_string.split("except", 1)[1]1195 if re.search("in place of", no_part_string):1196 no_part_string = no_part_string.split("in place of", 1)[1]1197 if re.search("IN PLACE OF", no_part_string):1198 no_part_string = no_part_string.split("IN PLACE OF", 1)[1]1199 if re.search("sitting for", no_part_string):1200 no_part_string = no_part_string.split("sitting for", 1)[1]1201 if re.search("sitting in lieu of", no_part_string):1202 no_part_string = no_part_string.split("sitting in lieu of", 1)[1]1203 if re.search("Concurring", no_part_string):1204 no_part_string = no_part_string.split("Concurring", 1)[1]1205 no_part_string = re.sub("who is disqualified", "", no_part_string)1206 no_part_string = re.sub(", sitting for Justice", "", no_part_string)1207 no_part_string = re.sub("recus(es|ed|e)|RECUSED\n|RECUSED", "", no_part_string)1208 no_part_string = re.sub("^[\s]+", "", no_part_string)1209 no_part_string = re.sub("[\s]*\*[\s]*", "", no_part_string)1210 no_part_string = re.sub("'", "", no_part_string)1211 no_part_string = re.sub("\[", "", no_part_string)1212 no_part_string = re.sub("Spaulding", "", no_part_string)1213 no_part_string = re.sub("District Court Judge", "", no_part_string)1214 no_part_string = re.sub("John McKeon|JOHN McKEON", "", no_part_string)1215 no_part_string = re.sub("\]", "", no_part_string)1216 no_part_string = re.sub("(Him|him|Her|her|Them|them)sel(f|ves)", "", no_part_string)1217 no_part_string = re.sub("All the Justices concur, except", "", no_part_string)1218 no_part_string = re.sub("(J|j)ustices,*", "", no_part_string)1219 no_part_string = re.sub("(J|j)ustice,*", "", no_part_string)1220 no_part_string = re.sub("JUSTIC(E|ES),*", "", no_part_string)1221 no_part_string = re.sub("Former Chief", "", no_part_string)1222 no_part_string = re.sub("Former", "", no_part_string)1223 no_part_string = re.sub("[\s]*(did|does)[\s]*", "", no_part_string)1224 no_part_string = re.sub("CJ\.", "", no_part_string)1225 no_part_string = re.sub(", (J|JJ|C\.J)\.,*", "", no_part_string)1226 no_part_string = re.sub("[\s] s[\s]*", "", no_part_string)1227 no_part_string = re.sub("J\.", " ", no_part_string)1228 no_part_string = re.sub("[\s]$", "", no_part_string)1229 no_part_string = re.sub(",[\s]+(,|\.)$", "", no_part_string)1230 no_part_string = re.sub("\.[\s]*$", "", no_part_string)1231 no_part_string = re.sub(",[\s]*$", "", no_part_string)1232 no_part_string = re.sub("\\xc2\\xa0", "", no_part_string)1233 no_part_string = re.sub(" s ", "", no_part_string)1234 no_part_string = re.sub("\xc2|\\xc2", "", no_part_string)1235 no_part_string = re.sub("\xa0|\\xa0", "", no_part_string)1236 no_part_string = re.sub("\xc2\xa0GLAZE", "", no_part_string)1237 no_part_string = re.sub("Judges:", "", no_part_string)1238 no_part_string = re.sub("AND", "and", no_part_string)1239 no_part_string = re.sub("Boucier", "Bourcier", no_part_string)1240 no_part_string = re.sub(", ,", ",", no_part_string)1241 no_part_string = re.sub(",", "", no_part_string)1242 no_part_string = re.sub("\.", "", no_part_string)1243 no_part_string = re.sub("Chief|CHIEF", "", no_part_string)1244 no_part_string = re.sub("\n|\\n", "", no_part_string)1245 no_part_string = re.sub("who take no part", "", no_part_string)1246 no_part_string = no_part_string.rstrip('\\n')1247 no_part_string = re.sub(' and', ',', no_part_string)1248 no_part_string = re.sub('deeming', '', no_part_string)1249 no_part_string = re.sub('disqualified', '', no_part_string)1250 no_part_string = re.sub('retired', '', no_part_string)1251 no_part_string = no_part_string.strip()1252 no_part_string = no_part_string.upper()1253 judges_np = no_part_string1254 judges_np = re.sub("\\xc2", "", judges_np)1255 judges_np = re.sub("\xc2\xa0", "", judges_np)1256 judges_np = re.sub(" and", "", judges_np )1257 judge_np_list = judges_np.split(" ")1258 judge_np_list = filter(None, judge_np_list)1259 if len(judge_np_list) > 4:1260 judge_np_list = judge_np_list[2]1261 judges_np = judge_np_list1262 judge_np1 = ""1263 judge_np2 = ""1264 judge_np3 = ""1265 judge_np4 = ""1266 # Parse judges text and store list of judges that decided case1267 judges_string = re.sub("Judges:|Judges|JUDGES", "", judges_string)1268 judges_string = re.sub("judge|Judge|JUDGE", "", judges_string)1269 judges_string = re.sub(" delivered the Opinion of the Court\.| DELIVERED THE OPINION OF THE COURT\.|Delivered the Opinion of the Court\.", ",", judges_string)1270 judges_string = re.sub("BEFORE THE ENTIRE", "", judges_string)1271 judges_string = re.sub("Supreme Court", "", judges_string)1272 judges_string = re.sub("Court", "", judges_string)1273 judges_string = re.sub("court", "", judges_string)1274 judges_string = re.sub("\xc3\x8d", "i", judges_string)1275 judges_string = re.sub(" Sr\.| SR\.", "", judges_string)1276 judges_string = re.sub(" Jr\.| JR\.", "", judges_string)1277 judges_string = re.sub(" Mr\.| MR\.", "", judges_string)1278 judges_string = re.sub(" Sr| SR", "", judges_string)1279 judges_string = re.sub(" Jr| JR", "", judges_string)1280 judges_string = re.sub(" at the", "", judges_string)1281 judges_string = re.sub('S94X1612', '', judges_string)1282 judges_string = re.sub('CDK, BJJ, JPV', '', judges_string)1283 judges_string = re.sub('AD HOC|Ad Hoc|ad hoc', '', judges_string)1284 judges_string = re.sub('all who sat', '', judges_string)1285 judges_string = re.sub('reasons to be assigned|reason to be assigned', '', judges_string)1286 judges_string = re.sub('grant the application', '', judges_string)1287 judges_string = re.sub('Procedural Due Process', '', judges_string)1288 judges_string = re.sub(" Mr| MR", "", judges_string)1289 judges_string = re.sub("F\.X\. HENNESSEY", "HENNESSY", judges_string)1290 judges_string = re.sub("are of the opinion", "", judges_string)1291 judges_string = re.sub("should be granted", "", judges_string)1292 judges_string = re.sub("and in the judgment", "", judges_string)1293 judges_string = re.sub("and the judgment", "", judges_string)1294 judges_string = re.sub("was an appointed", "", judges_string)1295 judges_string = re.sub("S93A0786", "", judges_string)1296 judges_string = re.sub("S93X0787", "", judges_string)1297 judges_string = re.sub("III-A", "", judges_string)1298 judges_string = re.sub("I-V", "", judges_string)1299 judges_string = re.sub(" VII", "", judges_string)1300 judges_string = re.sub("Parts V\(C\), VI, VII and VIII", "", judges_string)1301 judges_string = re.sub("Parts V\(C\), VI, VII, and VIII", "", judges_string)1302 judges_string = re.sub("Parts I, II, IV and V\(A\)", "", judges_string)1303 judges_string = re.sub("Part III and V\(B\)", "", judges_string)1304 judges_string = re.sub("Parts V\(C\), VI, VII and VIII", "", judges_string)1305 judges_string = re.sub("Messrs\.", "", judges_string)1306 judges_string = re.sub("stead", "", judges_string)1307 judges_string = re.sub("MOTION FOR EXPEDITED APPEAL IS GRANTED", "", judges_string)1308 judges_string = re.sub("REQUEST FOR ORAL ARGUMENT IS DENIED", "", judges_string)1309 judges_string = re.sub("Section IV\(D\)", "", judges_string)1310 judges_string = re.sub('part one|Part one|Part One', '', judges_string)1311 judges_string = re.sub("parts I, II, and III", "", judges_string)1312 judges_string = re.sub("respect|RESPECT|Respect", "", judges_string)1313 judges_string = re.sub('Whistle-Blower Act', '', judges_string)1314 judges_string = re.sub('Arkansas', '', judges_string)1315 judges_string = re.sub("action was submitted", "", judges_string)1316 judges_string = re.sub("Subscribing to the Opinion and Assigning Additional Reasons", "", judges_string)1317 judges_string = re.sub("Pursuant to Ariz\. Const\. art\. VI|pursuant to Ariz\. Const\. art\. VI|Pursuant to Ariz\. Const\. art\. 6|pursuant to Ariz\. Const\. art\. 6", "", judges_string)1318 judges_string = re.sub("Arizona Constitution", "", judges_string)1319 judges_string = re.sub("Pursuant to art\. VI\.|Pursuant to article VI", "", judges_string)1320 judges_string = re.sub("pursuant|Pursuant", "", judges_string)1321 judges_string = re.sub(" and Justices", ",", judges_string)1322 judges_string = re.sub("None", "", judges_string)1323 judges_string = re.sub("\xe2\x80\x94", "", judges_string)1324 judges_string = re.sub("PANEL: ", "", judges_string)1325 judges_string = re.sub("\$110W\.", "", judges_string)1326 judges_string = re.sub(" but, on administrative leave,", "", judges_string)1327 judges_string = re.sub("et al.", "", judges_string)1328 judges_string = re.sub("Ex parte Reneau L\. Gates \(re\: v\. Palm Harbor Homes\, Inc\.\, et al\.\)", "", judges_string)1329 judges_string = re.sub("We Concur|WE CONCUR|We concur", ", ", judges_string)1330 judges_string = re.sub("All the|all the|ALL THE", "", judges_string)1331 judges_string = re.sub("Circuit|circuit|CIRCUIT", "", judges_string)1332 judges_string = re.sub("except", "", judges_string)1333 judges_string = re.sub("Special Justices", "", judges_string)1334 judges_string = re.sub("Terminix International v\. Jackson", "", judges_string)1335 judges_string = re.sub("Special Justice", "", judges_string)1336 judges_string = re.sub("Associate Justice", "", judges_string)1337 judges_string = re.sub("Point II", "", judges_string)1338 judges_string = re.sub("Special Chief Justice", "", judges_string)1339 judges_string = re.sub("Chief Justice", "", judges_string)1340 judges_string = re.sub("Justice\.", "", judges_string)1341 judges_string = re.sub("for affirmance|For affirmance", "", judges_string)1342 judges_string = re.sub("affirmance|Affirmance|AFFIRMANCE", "", judges_string)1343 judges_string = re.sub("'s|'S", "", judges_string)1344 judges_string = re.sub("\(No\.\s\d*\)", "", judges_string)1345 judges_string = re.sub("AFFIRMED|Affirmed|affirmed", "", judges_string)1346 judges_string = re.sub("AFFIRM|Affirm|affirm", "", judges_string)1347 judges_string = re.sub("grant the petition", "", judges_string)1348 judges_string = re.sub("petition|Petition|PETITION", "", judges_string)1349 judges_string = re.sub("Granted|granted|GRANTED", "", judges_string)1350 judges_string = re.sub("abstaining|Abstaining|ABSTAINING", "", judges_string)1351 judges_string = re.sub("No\.\s\d*", "", judges_string)1352 judges_string = re.sub("Senior", "", judges_string)1353 judges_string = re.sub("Supr\.|Supr", "", judges_string)1354 judges_string = re.sub("\xe2\x80\x94", "", judges_string)1355 judges_string = re.sub("Chief Justice", ",", judges_string)1356 judges_string = re.sub("Chief Judge", "", judges_string)1357 judges_string = re.sub("--", ",", judges_string)1358 judges_string = re.sub(" but ", "", judges_string)1359 judges_string = re.sub("Justices|JUSTICES|justices", "", judges_string)1360 judges_string = re.sub("JUSTICE\.", "", judges_string)1361 judges_string = re.sub("JUSTICE|Justice|justice", "", judges_string)1362 judges_string = re.sub("announced|Announced|ANNOUNCED", "", judges_string)1363 judges_string = re.sub("\*Link to the text of the note", "", judges_string)1364 judges_string = re.sub("Ariz\.Const\.", "", judges_string)1365 judges_string = re.sub("art\. VI", "", judges_string)1366 judges_string = re.sub(" art\.", "", judges_string)1367 judges_string = re.sub("Link to the text of the note", "", judges_string)1368 judges_string = re.sub("to the", "", judges_string)1369 judges_string = re.sub("prior", "", judges_string)1370 judges_string = re.sub("oral argument|argument", "", judges_string)1371 judges_string = re.sub("resigned", "", judges_string)1372 judges_string = re.sub("chief|Chief|CHIEF", "", judges_string)1373 judges_string = re.sub("AUTHOR", "", judges_string)1374 judges_string = re.sub("nonrecusal|NONRECUSAL|Nonrecusal", "", judges_string)1375 judges_string = re.sub("deeming", "", judges_string)1376 judges_string = re.sub("temporary", "", judges_string)1377 judges_string = re.sub("has filed", "", judges_string)1378 judges_string = re.sub("filed:", "", judges_string)1379 judges_string = re.sub("filed a|file a", "", judges_string)1380 judges_string = re.sub("President", "", judges_string)1381 judges_string = re.sub("Intermediate|intermediate|INTERMEDIATE", "", judges_string)1382 judges_string = re.sub("Associate|ASSOCIATE|associate", "", judges_string)1383 judges_string = re.sub("reasons|REASONS|Reasons|reason|REASON|Reason", "", judges_string)1384 judges_string = re.sub("Superior", "", judges_string)1385 judges_string = re.sub("constituting the", "", judges_string)1386 judges_string = re.sub("En Banc|en Banc", "", judges_string)1387 judges_string = re.sub("In Banc", "", judges_string)1388 judges_string = re.sub("cases|Cases|CASES", "", judges_string)1389 judges_string = re.sub("disagreeing|disagreement|disagree", "", judges_string)1390 judges_string = re.sub("agreement|Agreement|AGREEMENT", "", judges_string)1391 judges_string = re.sub('"', "", judges_string)1392 judges_string = re.sub(" all | All | ALL ", "", judges_string)1393 judges_string = re.sub("Present|PRESENT|present", "", judges_string)1394 judges_string = re.sub("APPEALS", "", judges_string)1395 judges_string = re.sub(" THE", "", judges_string)1396 judges_string = re.sub("\xc3\x81", "a", judges_string)1397 judges_string = re.sub("WITHOUT", "", judges_string)1398 judges_string = re.sub("WITH", "", judges_string)1399 judges_string = re.sub("ASSIGNED BY REASON OF VACANCY|VACANCY|Vacancy", "", judges_string)1400 judges_string = re.sub("THIS", "", judges_string)1401 judges_string = re.sub("PELICONES|Pelicones", "", judges_string)1402 judges_string = re.sub("member|Member|MEMBER", "", judges_string)1403 judges_string = re.sub("disposition|Disposition|DISPOSITION", "", judges_string)1404 judges_string = re.sub(" right| Right| RIGHT", "", judges_string)1405 judges_string = re.sub("DISSENTS", "", judges_string)1406 judges_string = re.sub("WRITTEN|written|Written", "", judges_string)1407 judges_string = re.sub("WITHOUT|without", "", judges_string)1408 judges_string = re.sub("\xc3\xa9", "e", judges_string)1409 judges_string = re.sub(" took| TOOK| Took", "", judges_string)1410 judges_string = re.sub("Rule IV", "", judges_string)1411 judges_string = re.sub(" IV", "", judges_string)1412 judges_string = re.sub("C\. J\.,", "", judges_string)1413 judges_string = re.sub(" J\.,", "", judges_string)1414 judges_string = re.sub("assignment|Assignment|ASSIGNMENT", "", judges_string)1415 judges_string = re.sub("assigning", "", judges_string)1416 judges_string = re.sub("assigned", "", judges_string)1417 judges_string = re.sub("assigns", "", judges_string)1418 judges_string = re.sub("assign", "", judges_string)1419 judges_string = re.sub("assigned|Assigned|ASSIGNED|ASSIGNS|Assigns|assigns", "", judges_string)1420 judges_string = re.sub(" as ", "", judges_string)1421 judges_string = re.sub('"Agreement to Arbitrate"', "", judges_string)1422 judges_string = re.sub("Arbitrate\"", "", judges_string)1423 judges_string = re.sub("files a", "", judges_string)1424 judges_string = re.sub("former|Former|FORMER", "", judges_string)1425 judges_string = re.sub("Honor|honor|HONOR", "", judges_string)1426 judges_string = re.sub(" Hon.", "", judges_string)1427 judges_string = re.sub("Hon\. J\.", "", judges_string)1428 judges_string = re.sub("C\.J\.,|Sp\.JJ|Sp\.J\.|Sp\. J\.|C\.J,|J\.P\.T\.|CJ,||A\.J\.V\.C\.J\.,|JJ\.,|Sp\.J\.|Js,|JS,|JJ\.,|JJ,|D\.J\.,|P\.J\.,|P\.\sJ\.,|C\.J\.,|J\.,|J\.| J,|C\. J\.,", "", judges_string)1429 judges_string = re.sub("C\.J\.|C\.J|CJ|JJ\.|Js|JS|JJ\.|JJ|D\.J\.|P\.J\.|P\.\sJ\.|C\.J\.|J\.|J\.|C\. J\.", "", judges_string)1430 judges_string = re.sub("C\.J\.|C\.J|CJ|JJ\.|Js|JS|JJ\.|JJ|D\.J\.|P\.J\.|P\.\sJ\.|C\.J\.|J\.|J\.|C\. J\.", "", judges_string)1431 judges_string = re.sub("Sp\.J\.", "", judges_string)1432 judges_string = re.sub("Part II\.A", "", judges_string)1433 judges_string = re.sub("Part II\.B", "", judges_string)1434 judges_string = re.sub("Parts II", "", judges_string)1435 judges_string = re.sub("Parts I", "", judges_string)1436 judges_string = re.sub("Part II", "", judges_string)1437 judges_string = re.sub("Part I", "", judges_string)1438 judges_string = re.sub("Part XII", "", judges_string)1439 judges_string = re.sub("WoWe", "", judges_string)1440 judges_string = re.sub("foregoing|Foregoing|FOREGOING", "", judges_string)1441 judges_string = re.sub(" for| For| FOR", "", judges_string)1442 judges_string = re.sub("", "", judges_string)1443 judges_string = re.sub("[\(\[].*?[\)\]]", "", judges_string)1444 judges_string = re.sub("III", "", judges_string)1445 judges_string = re.sub("II\(\w\)", "", judges_string)1446 judges_string = re.sub("III\(\w\)", "", judges_string)1447 judges_string = re.sub(" II", "", judges_string)1448 judges_string = re.sub("III", "", judges_string)1449 judges_string = re.sub("Associate", "", judges_string)1450 judges_string = re.sub("Vice", "", judges_string)1451 judges_string = re.sub("\[\**\d*\]", "", judges_string)1452 judges_string = re.sub("Arbitrate|arbitrate|ARBITRATE", "", judges_string)1453 judges_string = re.sub("\xc2", "", judges_string)1454 judges_string = re.sub("BENCH|Bench|bench", "", judges_string)1455 judges_string = re.sub("(Before: |BEFORE: )", "", judges_string)1456 judges_string = re.sub("\xa0", " ", judges_string)1457 judges_string = re.sub("\/", "", judges_string)1458 judges_string = re.sub("\n|\r", " ", judges_string)1459 judges_string = re.sub("\(see p", " ", judges_string)1460 judges_string = re.sub("\(\d\)", "", judges_string)1461 judges_string = re.sub("\d", "", judges_string)1462 judges_string = re.sub("\(", "", judges_string)1463 judges_string = re.sub("\)", "", judges_string)1464 judges_string = re.sub("\sI,", "", judges_string)1465 judges_string = re.sub(" or ", "", judges_string)1466 judges_string = re.sub("Saylor|SAYLOR", "Saylor, ", judges_string)1467 judges_string = re.sub(" BY", "", judges_string)1468 judges_string = re.sub(" FOR", "", judges_string)1469 judges_string = re.sub("I;", "", judges_string)1470 judges_string = re.sub("Voting|VOTING|voting", "", judges_string)1471 judges_string = re.sub("Surrogate", "", judges_string)1472 judges_string = re.sub("\'", "", judges_string) #makes matching of judge names possible: O'Connor -> OConnor1473 judges_string = re.sub("judgment|JUDGMENT", "", judges_string)1474 judges_string = re.sub("SeeStuart|seestuart", "See, Stuart", judges_string)1475 if(re.search("unanimous view of the court|unanimous", judges_string)):1476 unanimous = 11477 judges_string = re.sub("unanimous view of the court", "", judges_string)1478 judges_string = re.sub("unanimous", "", judges_string)1479 judges_string = re.sub("Took no|Took No|took no|TOOK NO", "", judges_string)1480 judges_string = re.sub(" No,", "", judges_string)1481 judges_string = re.sub("separately|Separately|SEPARATELY", "", judges_string)1482 judges_string = re.sub("separate|Separate|SEPARATE", "", judges_string)1483 judges_string = re.sub("in place of", "", judges_string)1484 judges_string = re.sub("sections,", "", judges_string)1485 judges_string = re.sub("Sections,", "", judges_string)1486 judges_string = re.sub("sections", "", judges_string)1487 judges_string = re.sub("section,", "", judges_string)1488 judges_string = re.sub("Section,", "", judges_string)1489 judges_string = re.sub("section", "", judges_string)1490 judges_string = re.sub("constituting,", "", judges_string)1491 judges_string = re.sub("en banc,|en banc|En banc|En Banc|EN BANC", "", judges_string)1492 judges_string = re.sub("\[", "", judges_string)1493 judges_string = re.sub("\]", ",", judges_string)1494 judges_string = re.sub("concur in part and dissent in part|CONCUR IN PART AND DISSENT IN PART", " ", judges_string)1495 judges_string = re.sub("concurs in part and dissents in part|CONCURS IN PART AND DISSENTS IN PART", " ", judges_string)1496 judges_string = re.sub("concurs in the result, without opinion\.", "", judges_string)1497 judges_string = re.sub("all concurring", "", judges_string)1498 judges_string = re.sub("III-D", "", judges_string)1499 judges_string = re.sub("See separate opinion", "", judges_string)1500 judges_string = re.sub("concurring|Concurring|CONCURRING", "", judges_string)1501 judges_string = re.sub("concurrence|Concurrence|CONCURRENCE|Concurrence:", "", judges_string)1502 judges_string = re.sub("concurs", ",", judges_string)1503 judges_string = re.sub("concurred", ",", judges_string)1504 judges_string = re.sub("concur in", "", judges_string)1505 judges_string = re.sub("Concurs:|CONCURs:", "", judges_string)1506 judges_string = re.sub("concurs|Concurs|CONCURS", "", judges_string)1507 judges_string = re.sub("concur\.", ",", judges_string)1508 judges_string = re.sub("concur|Concur", "", judges_string)1509 judges_string = re.sub("CONCUR", ",", judges_string)1510 judges_string = re.sub("does", "", judges_string)1511 judges_string = re.sub("consideration", "", judges_string)1512 judges_string = re.sub("Md\.", "", judges_string)1513 judges_string = re.sub("Temporarily", "", judges_string)1514 judges_string = re.sub("Link to, text thee", "", judges_string)1515 judges_string = re.sub("assigns reasons", "", judges_string)1516 judges_string = re.sub("Appeals", "", judges_string)1517 judges_string = re.sub("retired|RETIRED|Retired|Ret|ret\.", "", judges_string)1518 judges_string = re.sub("assigned|Assigned|ASSIGNED|assignment|Assignment|ASSIGNNMENT", "", judges_string)1519 judges_string = re.sub("The ", "", judges_string)1520 judges_string = re.sub(" sat", "", judges_string)1521 judges_string = re.sub("delivered|delivers|Delivers|Delivered", "", judges_string)1522 judges_string = re.sub("PARTICIPATING", "", judges_string)1523 judges_string = re.sub("participating", "", judges_string)1524 judges_string = re.sub("PARTICIPATING", "", judges_string)1525 judges_string = re.sub("participating", "", judges_string)1526 judges_string = re.sub("Participating", "", judges_string)1527 judges_string = re.sub("did not participate", "", judges_string)1528 judges_string = re.sub("did not sit", "", judges_string)1529 judges_string = re.sub("did not", "", judges_string)1530 judges_string = re.sub("Maricopa County", "", judges_string)1531 judges_string = re.sub("County", "", judges_string)1532 judges_string = re.sub("WRITTEN BY:|Written by:", "", judges_string)1533 judges_string = re.sub("herein", "", judges_string)1534 judges_string = re.sub("not participate", "", judges_string)1535 judges_string = re.sub("participate", "", judges_string)1536 judges_string = re.sub("Presiding|PRESIDING", "", judges_string)1537 judges_string = re.sub("specially|Specially|SPECIALLY", "", judges_string)1538 judges_string = re.sub("special|Special|SPECIAL", "", judges_string)1539 judges_string = re.sub("Pro Tempore", "", judges_string)1540 judges_string = re.sub("pro-tem|Pro-Tem|PRO-TEM", "", judges_string)1541 judges_string = re.sub("concurring", "", judges_string)1542 judges_string = re.sub("Concurring", "", judges_string)1543 judges_string = re.sub("concurs in the result, without opinion\.", "", judges_string)1544 judges_string = re.sub("no opinion", "", judges_string)1545 judges_string = re.sub("opinion\.", ",", judges_string)1546 judges_string = re.sub("OPINIONS|OPINIONs|opinions|Opinions", "", judges_string)1547 judges_string = re.sub("opinion", "", judges_string)1548 judges_string = re.sub("Opinion", "", judges_string)1549 judges_string = re.sub(" full ", "", judges_string)1550 judges_string = re.sub("statement", "", judges_string)1551 judges_string = re.sub("files|file|FILES|FILE", "", judges_string)1552 judges_string = re.sub("Judicial Circuit", "", judges_string)1553 judges_string = re.sub("Part III", "", judges_string)1554 judges_string = re.sub("parties", "", judges_string)1555 judges_string = re.sub("no part|NO PART|No Part", "", judges_string)1556 judges_string = re.sub("partial", "", judges_string)1557 judges_string = re.sub("part", "", judges_string)1558 judges_string = re.sub("Part", "", judges_string)1559 judges_string = re.sub("PART", "", judges_string)1560 if not re.search('WHICHARD', judges_string):1561 judges_string = re.sub("which|Which|WHICH", "", judges_string)1562 judges_string = re.sub("DENIED|denied", "", judges_string)1563 judges_string = re.sub("Majority|majority|MAJORITY", "", judges_string)1564 judges_string = re.sub("Heard|heard|HEARD", "", judges_string)1565 judges_string = re.sub("joining|JOINING|Joining", "", judges_string)1566 judges_string = re.sub("joined|JOINED|Joined", "", judges_string)1567 judges_string = re.sub("joins|JOINS|Joins", "", judges_string)1568 judges_string = re.sub("join|JOIN|Join", "", judges_string)1569 judges_string = re.sub("takes|taking|Taking|TAKING", "", judges_string)1570 judges_string = re.sub(" that", "", judges_string)1571 judges_string = re.sub("as to the rationale", "", judges_string)1572 judges_string = re.sub("the judgment", "", judges_string)1573 judges_string = re.sub("rationale", "", judges_string)1574 judges_string = re.sub("T\.Y\.|T\. Y\.", "", judges_string)1575 judges_string = re.sub("A\.M\.", "", judges_string)1576 judges_string = re.sub("F\.E\.", "", judges_string)1577 judges_string = re.sub("N\.C\.", "", judges_string)1578 judges_string = re.sub("Paul H\.", "", judges_string)1579 judges_string = re.sub("Russell A\.", "", judges_string)1580 judges_string = re.sub("G\. Barry", "", judges_string)1581 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1582 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1583 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1584 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1585 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1586 judges_string = re.sub("\.", ",", judges_string)1587 judges_string = re.sub("BEFORE", "", judges_string)1588 judges_string = re.sub("would", "", judges_string)1589 judges_string = re.sub("this", "", judges_string)1590 judges_string = re.sub("only", "", judges_string)1591 judges_string = re.sub("without", "", judges_string)1592 judges_string = re.sub("with", "", judges_string)1593 judges_string = re.sub(" out", "", judges_string)1594 judges_string = re.sub("also", "", judges_string)1595 judges_string = re.sub(" of", "", judges_string)1596 judges_string = re.sub(" view", "", judges_string)1597 judges_string = re.sub(" Not", "", judges_string)1598 judges_string = re.sub(" not", "", judges_string)1599 judges_string = re.sub(" NOT", "", judges_string)1600 judges_string = re.sub(" whom", "", judges_string)1601 judges_string = re.sub(" who", "", judges_string)1602 judges_string = re.sub("filed", "", judges_string)1603 judges_string = re.sub("expressing", "", judges_string)1604 judges_string = re.sub("but dissents", "", judges_string)1605 judges_string = re.sub("but dissent", "", judges_string)1606 judges_string = re.sub("but not the dissent", "", judges_string)1607 judges_string = re.sub("dissented", "", judges_string)1608 judges_string = re.sub("issued", ",", judges_string)1609 judges_string = re.sub("foregoing", "", judges_string)1610 judges_string = re.sub("agree", "", judges_string)1611 judges_string = re.sub("Opposed|opposed|OPPOSED", "", judges_string)1612 judges_string = re.sub("dissents", "", judges_string)1613 judges_string = re.sub("dissenting", "", judges_string)1614 judges_string = re.sub("DISSENTING", "", judges_string)1615 judges_string = re.sub("ENTIRE COURT", "", judges_string)1616 judges_string = re.sub(" as", "", judges_string)1617 judges_string = re.sub("reversal", "", judges_string)1618 judges_string = re.sub("none", "", judges_string)1619 judges_string = re.sub("Twelfth|Eleventh|Fifth|Tenth|Ninth|Eigth|Seventh|Sixth", "", judges_string)1620 judges_string = re.sub("Mr", "", judges_string)1621 judges_string = re.sub('remandment', '', judges_string)1622 judges_string = re.sub("remand", "", judges_string)1623 judges_string = re.sub("overruling", "", judges_string)1624 judges_string = re.sub("rehearing", "", judges_string)1625 judges_string = re.sub("OPINION", "", judges_string)1626 judges_string = re.sub("COURT", "", judges_string)1627 judges_string = re.sub("ONLY", "", judges_string)1628 judges_string = re.sub("IN RESULT", "", judges_string)1629 judges_string = re.sub(" IN ", "", judges_string)1630 judges_string = re.sub("Dissenting", "", judges_string)1631 judges_string = re.sub("Dissents", "", judges_string)1632 judges_string = re.sub("dissent\.", ",", judges_string)1633 judges_string = re.sub("dissent", "", judges_string)1634 judges_string = re.sub("Dissent", "", judges_string)1635 judges_string = re.sub("recuses|RECUSES|Recuses", "", judges_string)1636 judges_string = re.sub("recused|RECUSED|Recused", "", judges_string)1637 judges_string = re.sub("recuse|RECUSE|Recuse", "", judges_string)1638 judges_string = re.sub("SEPARATELY", "", judges_string)1639 judges_string = re.sub("PRO-TEM", "", judges_string)1640 judges_string = re.sub("reserves", "", judges_string)1641 judges_string = re.sub("is disqualified|disqualified|disqualification", "", judges_string)1642 judges_string = re.sub("recused themselves", "", judges_string)1643 judges_string = re.sub("recused", "", judges_string)1644 judges_string = re.sub("Recused", "", judges_string)1645 judges_string = re.sub("deceased", "", judges_string)1646 judges_string = re.sub("in the result", "", judges_string)1647 judges_string = re.sub("the result", "", judges_string)1648 judges_string = re.sub("result|Result|RESULT", "", judges_string)1649 judges_string = re.sub(" acting ", "", judges_string)1650 judges_string = re.sub(" and ", ",", judges_string)1651 judges_string = re.sub(" AND ", ",", judges_string)1652 judges_string = re.sub(" an", ",", judges_string)1653 judges_string = re.sub("application|Application|APPLICATION", ", ", judges_string)1654 judges_string = re.sub("dismissed|Dismissed|DISMISSED", ", ", judges_string)1655 judges_string = re.sub("entitled|Entitled|ENTITLED", ", ", judges_string)1656 judges_string = re.sub("appeal|Appeal|APPEAL", ", ", judges_string)1657 judges_string = re.sub(" the ", ", ", judges_string)1658 judges_string = re.sub(" as to", ", ", judges_string)1659 judges_string = re.sub("decision", ", ", judges_string)1660 judges_string = re.sub("final", ", ", judges_string)1661 judges_string = re.sub(" in a", "", judges_string)1662 judges_string = re.sub("in the", "", judges_string)1663 judges_string = re.sub(" In | in ", "", judges_string)1664 judges_string = re.sub(" in,", "", judges_string)1665 judges_string = re.sub(" of", "", judges_string)1666 judges_string = re.sub(" OF", "", judges_string)1667 judges_string = re.sub(" from", "", judges_string)1668 judges_string = re.sub("herself", "", judges_string)1669 judges_string = re.sub("himself", "", judges_string)1670 judges_string = re.sub("themselves", "", judges_string)1671 judges_string = re.sub("expresses", "", judges_string)1672 judges_string = re.sub("ii", "", judges_string)1673 judges_string = re.sub(" cases| Cases", "", judges_string)1674 judges_string = re.sub("case", "", judges_string)1675 judges_string = re.sub("Case", "", judges_string)1676 judges_string = re.sub(" by", "", judges_string)1677 judges_string = re.sub("heard", "", judges_string)1678 judges_string = re.sub("DENVIRSTITH", "STITH", judges_string)1679 judges_string = re.sub("considered", "", judges_string)1680 judges_string = re.sub("decided", "", judges_string)1681 judges_string = re.sub("time", "", judges_string)1682 judges_string = re.sub("submission", "", judges_string)1683 judges_string = re.sub("\&", "", judges_string)1684 judges_string = re.sub("were designated", "", judges_string)1685 judges_string = re.sub("is designated|designated|designation", "", judges_string)1686 judges_string = re.sub(" All |ALL ", "", judges_string)1687 judges_string = re.sub("is sitting", "", judges_string)1688 judges_string = re.sub("sitting|SITTING|Sitting", "", judges_string)1689 judges_string = re.sub(" sit", "", judges_string)1690 judges_string = re.sub(" superior", "", judges_string)1691 judges_string = re.sub(" under", "", judges_string)1692 judges_string = re.sub("Cavanaugh|CAVANAUGH", "Cavanagh", judges_string)1693 judges_string = re.sub("WHOLE|Whole|whole", "", judges_string)1694 judges_string = re.sub("deny", "", judges_string)1695 judges_string = re.sub("Matter|MATTER|matter", "", judges_string)1696 judges_string = re.sub(" otherwise|Otherwise|OTHERWISE", "", judges_string)1697 judges_string = re.sub(" leave", "", judges_string)1698 judges_string = re.sub(" others| other| Other| OTHER", "", judges_string)1699 judges_string = re.sub(" vote|votes to", "", judges_string)1700 judges_string = re.sub("RSA", "", judges_string)1701 judges_string = re.sub("memorandum", "", judges_string)1702 judges_string = re.sub("took no", "", judges_string)1703 judges_string = re.sub("syllabus", "", judges_string)1704 judges_string = re.sub("Appellate District", "", judges_string)1705 judges_string = re.sub("District|district", "", judges_string)1706 judges_string = re.sub("Administrative", "", judges_string)1707 judges_string = re.sub("i-v", "", judges_string)1708 judges_string = re.sub("follows", "", judges_string)1709 judges_string = re.sub("Judicial", "", judges_string)1710 judges_string = re.sub("By:", "", judges_string)1711 judges_string = re.sub("Panel:", "", judges_string)1712 judges_string = re.sub(":\s", "", judges_string)1713 judges_string = re.sub(":", "", judges_string)1714 judges_string = re.sub("authored|Authored|AUTHORED", "", judges_string)1715 judges_string = re.sub(" to ", "", judges_string)1716 judges_string = re.sub("DISSENT", "", judges_string)1717 judges_string = re.sub(" each", "", judges_string)1718 judges_string = re.sub("Jr|jr|JR", "", judges_string)1719 judges_string = re.sub("denial", "", judges_string)1720 judges_string = re.sub("Sr|sr|SR", "", judges_string)1721 judges_string = re.sub("Deceased|deceased|DECEASED", "", judges_string)1722 judges_string = re.sub("lead|LEAD|Lead", "", judges_string)1723 judges_string = re.sub(" was | WAS | Was", "", judges_string)1724 judges_string = re.sub(" other", "", judges_string)1725 judges_string = re.sub("writing", "", judges_string)1726 judges_string = re.sub("Writ|writ|WRIT", "", judges_string)1727 judges_string = re.sub("take|TAKE|Take", "", judges_string)1728 judges_string = re.sub("Issued|issued|ISSUED", "", judges_string)1729 judges_string = re.sub("Madame|MADAME|madame", "", judges_string)1730 judges_string = re.sub("Visiting|VISITING|visiting", "", judges_string)1731 judges_string = re.sub("acting|ACTING|Acting", "", judges_string)1732 judges_string = re.sub("having|Having|HAVING", "", judges_string)1733 judges_string = re.sub("reverse", "", judges_string)1734 judges_string = re.sub("O'NEILL to|O'NEILLto", "O'NEILL", judges_string)1735 judges_string = re.sub(" is ", "", judges_string)1736 judges_string = re.sub("Third", "", judges_string)1737 judges_string = re.sub(" John ", "", judges_string)1738 judges_string = re.sub("Boucier", "Bourcier", judges_string)1739 judges_string = re.sub(" to ", "", judges_string)1740 judges_string = re.sub(",to ", "", judges_string)1741 judges_string = re.sub("Ralmon", "Almon", judges_string)1742 judges_string = re.sub("Fabec", "Fabe", judges_string)1743 judges_string = re.sub(" ir ", "", judges_string)1744 judges_string = re.sub("Estaugh", "Eastaugh", judges_string)1745 judges_string = re.sub("Modification", "", judges_string)1746 judges_string = re.sub("Vacation", "", judges_string)1747 judges_string = re.sub(",d,", "", judges_string)1748 judges_string = re.sub("Division Two|Two", "", judges_string)1749 judges_string = re.sub("Division Six", "", judges_string)1750 judges_string = re.sub("dS", "", judges_string)1751 judges_string = re.sub("NOTE", "", judges_string)1752 judges_string = re.sub("dI", "", judges_string)1753 judges_string = re.sub("dX", "", judges_string)1754 judges_string = re.sub("were", "", judges_string)1755 judges_string = re.sub("pursuant", "", judges_string)1756 judges_string = re.sub("determination ", "", judges_string)1757 judges_string = re.sub("Division One", "", judges_string)1758 judges_string = re.sub("article IV", "", judges_string)1759 judges_string = re.sub("Article|ARTICLE|article", "", judges_string)1760 judges_string = re.sub("Arizona", "", judges_string)1761 judges_string = re.sub("Second", "", judges_string)1762 judges_string = re.sub("Council", "", judges_string)1763 judges_string = re.sub("Chairperson", "", judges_string)1764 judges_string = re.sub("not on panel|on panel|panel", "", judges_string)1765 judges_string = re.sub("Division Four", "", judges_string)1766 judges_string = re.sub("to conviction|conviction", "", judges_string)1767 judges_string = re.sub("to sentence|sentence", "", judges_string)1768 judges_string = re.sub("additional", "", judges_string)1769 judges_string = re.sub("following", "", judges_string)1770 judges_string = re.sub("subscribes|subscribe", "", judges_string)1771 judges_string = re.sub("ORAL ARGUMENT", "", judges_string)1772 judges_string = re.sub("DENIAL", "", judges_string)1773 judges_string = re.sub(" ONE ", "", judges_string)1774 judges_string = re.sub("TWO", "", judges_string)1775 judges_string = re.sub("THREE", "", judges_string)1776 judges_string = re.sub(" have", "", judges_string)1777 judges_string = re.sub("unconstitutional", "", judges_string)1778 judges_string = re.sub("follow", "", judges_string)1779 judges_string = re.sub("chapter", "", judges_string)1780 judges_string = re.sub("Lesson", "Leeson", judges_string)1781 judges_string = re.sub("Before", "", judges_string)1782 judges_string = re.sub("Per Curiam|Curiam", "", judges_string)1783 judges_string = re.sub("causesubmitted", "", judges_string)1784 judges_string = re.sub("on briefs|briefs|brief", "", judges_string)1785 judges_string = re.sub("Division", "", judges_string)1786 judges_string = re.sub("absent", "", judges_string)1787 judges_string = re.sub(" IV,", "", judges_string)1788 judges_string = re.sub(" when", "", judges_string)1789 judges_string = re.sub(" inof", "", judges_string)1790 judges_string = re.sub("Order", "", judges_string)1791 judges_string = re.sub("absent", "", judges_string)1792 judges_string = re.sub(" to ", "", judges_string)1793 judges_string = re.sub("tohis ", "", judges_string)1794 judges_string = re.sub("toother|TOOTHER|to other", "", judges_string)1795 judges_string = string.strip(judges_string)1796 judges_string = re.sub(", ,", ",", judges_string)1797 judges_string = re.sub("s V", "", judges_string)1798 judges_string = re.sub(" VI,", "", judges_string)1799 judges_string = re.sub('DENVIR STITH', 'Stith', judges_string)1800 judges_string = re.sub('remainder|Remainder|REMAINDER', '', judges_string)1801 judges_string = re.sub(' Wo,', '', judges_string)1802 judges_string = re.sub(' Eighth', '', judges_string)1803 judges_string = re.sub('its entirety', '', judges_string)1804 judges_string = re.sub('entirety', '', judges_string)1805 judges_string = re.sub('holdings', '', judges_string)1806 judges_string = re.sub(' SPL,', '', judges_string)1807 judges_string = re.sub(' Five', '', judges_string)1808 judges_string = re.sub('APPENDIX', '', judges_string)1809 judges_string = re.sub(' Votes', '', judges_string)1810 judges_string = re.sub('Chancellor', '', judges_string)1811 judges_string = re.sub(' guilt', '', judges_string)1812 judges_string = re.sub(' the ', '', judges_string)1813 judges_string = re.sub(' the,', '', judges_string)1814 judges_string = re.sub('issuance', '', judges_string)1815 judges_string = re.sub(' inin', '', judges_string)1816 judges_string = re.sub('Process', '', judges_string)1817 judges_string = re.sub('transfer', '', judges_string)1818 judges_string = re.sub('Indiana', '', judges_string)1819 judges_string = re.sub('emphasize', '', judges_string)1820 judges_string = re.sub('non-hearsay', '', judges_string)1821 judges_string = re.sub('hearsay', '', judges_string)1822 judges_string = re.sub('Section II|Section', '', judges_string)1823 judges_string = re.sub('section|SECTION', '', judges_string)1824 judges_string = re.sub('impermissible', '', judges_string)1825 judges_string = re.sub('excellent|Excellent|Excellence|excellence', '', judges_string)1826 judges_string = re.sub('sexually predatory', '', judges_string)1827 judges_string = re.sub('Ten Broeck', '', judges_string)1828 judges_string = re.sub(' First', '', judges_string)1829 judges_string = re.sub('error', '', judges_string)1830 judges_string = re.sub('believings|believing', '', judges_string)1831 judges_string = re.sub('Doctor|doctor', '', judges_string)1832 judges_string = re.sub('dsigning', '', judges_string)1833 judges_string = re.sub('Plurality', '', judges_string)1834 judges_string = re.sub('Maryland', '', judges_string)1835 judges_string = re.sub('question|Question|QUESTION', '', judges_string)1836 judges_string = re.sub('before|Before|BEFORE', '', judges_string)1837 judges_string = re.sub(' Yes | yes ', '', judges_string)1838 judges_string = re.sub(' Yes,| yes,', '', judges_string)1839 judges_string = re.sub('unanimouns', '', judges_string)1840 judges_string = re.sub('circumstance|Circumstances|CIRCUMSTANCES', '', judges_string)1841 judges_string = re.sub(' action', '', judges_string)1842 judges_string = re.sub('concludes', '', judges_string)1843 judges_string = re.sub('addressed', '', judges_string)1844 judges_string = re.sub(' commit', '', judges_string)1845 judges_string = re.sub(' was | was,', '', judges_string)1846 judges_string = re.sub(' and ', '', judges_string)1847 judges_string = re.sub(' trial', '', judges_string)1848 judges_string = re.sub('captioned|caption', '', judges_string)1849 judges_string = re.sub(' swer,| swer ', '', judges_string)1850 judges_string = re.sub('directions|direction', '', judges_string)1851 judges_string = re.sub(' enter', '', judges_string)1852 judges_string = re.sub('against', '', judges_string)1853 judges_string = re.sub('summary', '', judges_string)1854 judges_string = re.sub('Considered', '', judges_string)1855 judges_string = re.sub('proceedings', '', judges_string)1856 judges_string = re.sub(' entire', '', judges_string)1857 judges_string = re.sub(' favor', '', judges_string)1858 judges_string = re.sub('discrimination', '', judges_string)1859 judges_string = re.sub('claim', '', judges_string)1860 judges_string = re.sub('further', '', judges_string)1861 judges_string = re.sub('expressed', '', judges_string)1862 judges_string = re.sub('discussion', '', judges_string)1863 judges_string = re.sub('submitted', '', judges_string)1864 judges_string = re.sub('consent', '', judges_string)1865 judges_string = re.sub('stating', '', judges_string)1866 judges_string = re.sub('NYCRR', '', judges_string)1867 judges_string = re.sub('accepted', '', judges_string)1868 judges_string = re.sub('dismiss', '', judges_string)1869 judges_string = re.sub('granting', '', judges_string)1870 judges_string = re.sub('relator', '', judges_string)1871 judges_string = re.sub('pronouncement', '', judges_string)1872 judges_string = re.sub('reversal', '', judges_string)1873 judges_string = re.sub('balance', '', judges_string)1874 judges_string = re.sub(' two', '', judges_string)1875 judges_string = re.sub('answers', '', judges_string)1876 judges_string = re.sub('counsel', '', judges_string)1877 judges_string = re.sub('record', '', judges_string)1878 judges_string = re.sub('boxertrain', '', judges_string)1879 judges_string = re.sub(' rule', '', judges_string)1880 judges_string = re.sub(' Rules', '', judges_string)1881 judges_string = re.sub('improvidently', '', judges_string)1882 judges_string = re.sub(' text', '', judges_string)1883 judges_string = re.sub(' after', '', judges_string)1884 judges_string = re.sub('February', '', judges_string)1885 judges_string = re.sub('reserve', '', judges_string)1886 1887 judges_string = re.sub('EXPRESSED', '', judges_string)1888 judges_string = re.sub('expressed', '', judges_string)1889 judges_string = re.sub('Expressed', '', judges_string)1890 judges_string = re.sub('icipation', '', judges_string)1891 judges_string = re.sub('ICIPATION', '', judges_string)1892 judges_string = re.sub('issues', '', judges_string)1893 judges_string = re.sub('Issues', '', judges_string)1894 judges_string = re.sub('ISSUES', '', judges_string)1895 judges_string = re.sub('issue', '', judges_string)1896 judges_string = re.sub('Issue', '', judges_string)1897 judges_string = re.sub('ISSUE', '', judges_string)1898 judges_string = re.sub(' the ', '', judges_string)1899 judges_string = re.sub(' The ', '', judges_string)1900 judges_string = re.sub(' The ', '', judges_string)1901 judges_string = re.sub(' THE,', '', judges_string)1902 judges_string = re.sub(' the,', '', judges_string)1903 judges_string = re.sub(' THE,', '', judges_string)1904 judges_string = re.sub(',the ', '', judges_string)1905 judges_string = re.sub(',The ', '', judges_string)1906 judges_string = re.sub(',THE ', '', judges_string)1907 judges_string = re.sub(' has ', '', judges_string)1908 judges_string = re.sub(' Has ', '', judges_string)1909 judges_string = re.sub(' HAS ', '', judges_string)1910 judges_string = re.sub(' Has,', '', judges_string)1911 judges_string = re.sub(' has,', '', judges_string)1912 judges_string = re.sub(' HAS,', '', judges_string)1913 judges_string = re.sub(',has ', '', judges_string)1914 judges_string = re.sub(',Has ', '', judges_string)1915 judges_string = re.sub(',HAS ', '', judges_string)1916 judges_string = re.sub('judgment', '', judges_string)1917 judges_string = re.sub('Judgment', '', judges_string)1918 judges_string = re.sub('JUDGMENT', '', judges_string)1919 judges_string = re.sub('subscribing', '', judges_string)1920 judges_string = re.sub('Subscribing', '', judges_string)1921 judges_string = re.sub('SUBSCRIBING', '', judges_string)1922 judges_string = re.sub('additional', '', judges_string)1923 judges_string = re.sub('Additional', '', judges_string)1924 judges_string = re.sub('ADDITIONAL', '', judges_string)1925 judges_string = re.sub(' fees', '', judges_string)1926 judges_string = re.sub(' Fees', '', judges_string)1927 judges_string = re.sub(' FEES', '', judges_string)1928 judges_string = re.sub(' IALS ', '', judges_string)1929 judges_string = re.sub(' ials ', '', judges_string)1930 judges_string = re.sub(' IALS,', '', judges_string)1931 judges_string = re.sub(' ials,', '', judges_string)1932 judges_string = re.sub('D-D', '', judges_string)1933 judges_string = re.sub('d-d', '', judges_string)1934 judges_string = re.sub('I-', '', judges_string)1935 judges_string = re.sub('i-', '', judges_string)1936 judges_string = re.sub('V-V', '', judges_string)1937 judges_string = re.sub('v-v', '', judges_string)1938 judges_string = re.sub('FOURTH', '', judges_string)1939 judges_string = re.sub('fourth', '', judges_string)1940 judges_string = re.sub('Fourth', '', judges_string)1941 judges_string = re.sub('Designation', '', judges_string)1942 judges_string = re.sub('designation', '', judges_string)1943 judges_string = re.sub('DESIGNATION', '', judges_string)1944 judges_string = re.sub('appellate', '', judges_string)1945 judges_string = re.sub('Appellate', '', judges_string)1946 judges_string = re.sub('APPELLATE', '', judges_string)1947 judges_string = re.sub('opinon', '', judges_string)1948 judges_string = re.sub('Opinon', '', judges_string)1949 judges_string = re.sub('OPINON', '', judges_string)1950 judges_string = re.sub('TEMPORARILY', '', judges_string)1951 judges_string = re.sub('temporarily', '', judges_string)1952 judges_string = re.sub('Temporarily', '', judges_string)1953 judges_string = re.sub(' for ', '', judges_string)1954 judges_string = re.sub(' For ', '', judges_string)1955 judges_string = re.sub(' FOR ', '', judges_string)1956 judges_string = re.sub(' For,', '', judges_string)1957 judges_string = re.sub(' for,', '', judges_string)1958 judges_string = re.sub(' FOR,', '', judges_string)1959 judges_string = re.sub(',for ', '', judges_string)1960 judges_string = re.sub(',For ', '', judges_string)1961 judges_string = re.sub(',FOR ', '', judges_string)1962 judges_string = re.sub(' will ', '', judges_string)1963 judges_string = re.sub(' Will ', '', judges_string)1964 judges_string = re.sub(' WILL ', '', judges_string)1965 judges_string = re.sub(' Will,', '', judges_string)1966 judges_string = re.sub(' will,', '', judges_string)1967 judges_string = re.sub(' WILL,', '', judges_string)1968 judges_string = re.sub(',will ', '', judges_string)1969 judges_string = re.sub(',Will ', '', judges_string)1970 judges_string = re.sub(',WILL ', '', judges_string)1971 judges_string = re.sub(' adds ', '', judges_string)1972 judges_string = re.sub(' Adds ', '', judges_string)1973 judges_string = re.sub(' ADDS ', '', judges_string)1974 judges_string = re.sub(' Adds,', '', judges_string)1975 judges_string = re.sub(' adds,', '', judges_string)1976 judges_string = re.sub(' ADDS,', '', judges_string)1977 judges_string = re.sub(',adds ', '', judges_string)1978 judges_string = re.sub(',Adds ', '', judges_string)1979 judges_string = re.sub(',ADDS ', '', judges_string)1980 judges_string = re.sub('settlements', '', judges_string)1981 judges_string = re.sub('Settlements', '', judges_string)1982 judges_string = re.sub('SETTLEMENTS', '', judges_string)1983 judges_string = re.sub('notes', '', judges_string)1984 judges_string = re.sub('Notes', '', judges_string)1985 judges_string = re.sub('NOTES', '', judges_string)1986 judges_string = re.sub('--', '', judges_string)1987 judges_string = re.sub(' ity ', '', judges_string)1988 judges_string = re.sub(' ITY ', '', judges_string)1989 judges_string = re.sub(' Ity ', '', judges_string)1990 judges_string = re.sub(' Ity,', '', judges_string)1991 judges_string = re.sub(' ity,', '', judges_string)1992 judges_string = re.sub(' ITY,', '', judges_string)1993 judges_string = re.sub(',ity ', '', judges_string)1994 judges_string = re.sub(',Ity ', '', judges_string)1995 judges_string = re.sub(',ITY ', '', judges_string)1996 judges_string = re.sub(' on ', '', judges_string)1997 judges_string = re.sub(' ON ', '', judges_string)1998 judges_string = re.sub(' On ', '', judges_string)1999 judges_string = re.sub(' On,', '', judges_string)2000 judges_string = re.sub(' on,', '', judges_string)2001 judges_string = re.sub(' ON,', '', judges_string)2002 judges_string = re.sub(',on ', '', judges_string)2003 judges_string = re.sub(',On ', '', judges_string)2004 judges_string = re.sub(',ON ', '', judges_string)2005 judges_string = re.sub('settlement', '', judges_string)2006 judges_string = re.sub('Settlement', '', judges_string)2007 judges_string = re.sub('SETTLEMENT', '', judges_string)2008 judges_string = re.sub('order', '', judges_string)2009 judges_string = re.sub('Order', '', judges_string)2010 judges_string = re.sub('ORDER', '', judges_string)2011 judges_string = re.sub('adopt', '', judges_string)2012 judges_string = re.sub('Adopt', '', judges_string)2013 judges_string = re.sub('ADOPT', '', judges_string)2014 judges_string = re.sub('THERABLEMCCLINTOCK', '', judges_string.upper())2015 judges_string = re.sub(' ins ', '', judges_string)2016 judges_string = re.sub(' INS ', '', judges_string)2017 judges_string = re.sub(' Ins ', '', judges_string)2018 judges_string = re.sub(' Ins,', '', judges_string)2019 judges_string = re.sub(' ins,', '', judges_string)2020 judges_string = re.sub(' INS,', '', judges_string)2021 judges_string = re.sub(',ins ', '', judges_string)2022 judges_string = re.sub(',Ins ', '', judges_string)2023 judges_string = re.sub(',INS ', '', judges_string)2024 judges_string = re.sub('docket', '', judges_string)2025 judges_string = re.sub('Docket', '', judges_string)2026 judges_string = re.sub('DOCKET', '', judges_string)2027 judges_string = re.sub('retirement', '', judges_string)2028 judges_string = re.sub('Retirement', '', judges_string)2029 judges_string = re.sub('RETIREMENT', '', judges_string)2030 judges_string = re.sub(' ard ', '', judges_string)2031 judges_string = re.sub(' ARD ', '', judges_string)2032 judges_string = re.sub(' Ard ', '', judges_string)2033 judges_string = re.sub(' Ard,', '', judges_string)2034 judges_string = re.sub(' ard,', '', judges_string)2035 judges_string = re.sub(' ARD,', '', judges_string)2036 judges_string = re.sub(',ard ', '', judges_string)2037 judges_string = re.sub(',Ard ', '', judges_string)2038 judges_string = re.sub(',ARD ', '', judges_string)2039 judges_string = re.sub(' to ', '', judges_string)2040 judges_string = re.sub(' TO ', '', judges_string)2041 judges_string = re.sub(' To ', '', judges_string)2042 judges_string = re.sub(' To,', '', judges_string)2043 judges_string = re.sub(' to,', '', judges_string)2044 judges_string = re.sub(' TO,', '', judges_string)2045 judges_string = re.sub(',to ', '', judges_string)2046 judges_string = re.sub(',To ', '', judges_string)2047 judges_string = re.sub(',TO ', '', judges_string)2048 judges_string = re.sub(' likes ', '', judges_string)2049 judges_string = re.sub(' LIKES ', '', judges_string)2050 judges_string = re.sub(' Likes ', '', judges_string)2051 judges_string = re.sub(' Likes,', '', judges_string)2052 judges_string = re.sub(' likes,', '', judges_string)2053 judges_string = re.sub(' LIKES,', '', judges_string)2054 judges_string = re.sub(',likes ', '', judges_string)2055 judges_string = re.sub(',Likes ', '', judges_string)2056 judges_string = re.sub(',LIKES ', '', judges_string)2057 judges_string = re.sub('VI-XI', '', judges_string)2058 judges_string = re.sub('vi-xi', '', judges_string)2059 judges_string = re.sub('I-IV', '', judges_string)2060 judges_string = re.sub('i-iv', '', judges_string)2061 judges_string = re.sub('heard', '', judges_string)2062 judges_string = re.sub('Heard', '', judges_string)2063 judges_string = re.sub('HEARD', '', judges_string)2064 judges_string = re.sub(' not ', '', judges_string)2065 judges_string = re.sub(' NOT ', '', judges_string)2066 judges_string = re.sub(' Not ', '', judges_string)2067 judges_string = re.sub(' Not,', '', judges_string)2068 judges_string = re.sub(' not,', '', judges_string)2069 judges_string = re.sub(' NOT,', '', judges_string)2070 judges_string = re.sub(',not ', '', judges_string)2071 judges_string = re.sub(',Not ', '', judges_string)2072 judges_string = re.sub(',NOT ', '', judges_string)2073 judges_string = re.sub('chief', '', judges_string)2074 judges_string = re.sub('Chief', '', judges_string)2075 judges_string = re.sub('CHIEF', '', judges_string)2076 judges_string = re.sub(' sp ', '', judges_string)2077 judges_string = re.sub(' SP ', '', judges_string)2078 judges_string = re.sub(' Sp ', '', judges_string)2079 judges_string = re.sub(' Sp,', '', judges_string)2080 judges_string = re.sub(' sp,', '', judges_string)2081 judges_string = re.sub(' SP,', '', judges_string)2082 judges_string = re.sub(',sp ', '', judges_string)2083 judges_string = re.sub(',Sp ', '', judges_string)2084 judges_string = re.sub(',SP ', '', judges_string)2085 judges_string = re.sub('associate', '', judges_string)2086 judges_string = re.sub('Associate', '', judges_string)2087 judges_string = re.sub('ASSOCIATE', '', judges_string)2088 judges_string = re.sub(' j ', '', judges_string)2089 judges_string = re.sub(' J ', '', judges_string)2090 judges_string = re.sub(' j,', '', judges_string)2091 judges_string = re.sub(' J,', '', judges_string)2092 judges_string = re.sub(',j ', '', judges_string)2093 judges_string = re.sub(',J ', '', judges_string)2094 judges_string = re.sub('bear', '', judges_string)2095 judges_string = re.sub('Bear', '', judges_string)2096 judges_string = re.sub('BEAR', '', judges_string)2097 judges_string = re.sub('vacancy', '', judges_string)2098 judges_string = re.sub('Vacancy', '', judges_string)2099 judges_string = re.sub('VACANCY', '', judges_string)2100 judges_string = re.sub('modification', '', judges_string)2101 judges_string = re.sub('Modification', '', judges_string)2102 judges_string = re.sub('MODIFICATION', '', judges_string)2103 judges_string = re.sub('acceptance', '', judges_string)2104 judges_string = re.sub('Acceptance', '', judges_string)2105 judges_string = re.sub('ACCEPTANCE', '', judges_string)2106 judges_string = re.sub('professional', '', judges_string)2107 judges_string = re.sub('Professional', '', judges_string)2108 judges_string = re.sub('PROFESSIONAL', '', judges_string)2109 judges_string = re.sub('at-will', '', judges_string)2110 judges_string = re.sub('AT-WILL', '', judges_string)2111 judges_string = re.sub('At-Will', '', judges_string) 2112 judges_string = re.sub('At-will', '', judges_string) 2113 judges_string = re.sub(' the ', '', judges_string)2114 judges_string = re.sub(' THE ', '', judges_string)2115 judges_string = re.sub(' The ', '', judges_string)2116 judges_string = re.sub(' The,', '', judges_string)2117 judges_string = re.sub(' the,', '', judges_string)2118 judges_string = re.sub(' THE,', '', judges_string)2119 judges_string = re.sub(',the ', '', judges_string)2120 judges_string = re.sub(',The ', '', judges_string)2121 judges_string = re.sub(',THE ', '', judges_string) 2122 judges_string = re.sub(' BEEN ', '', judges_string.upper())2123 judges_string = re.sub(' BEEN,', '', judges_string.upper())2124 judges_string = re.sub(',BEEN ', '', judges_string.upper())2125 judges_string = re.sub('ACCORDINGLY', '', judges_string.upper())2126 judges_string = re.sub('APPOINTMENT', '', judges_string.upper())2127 judges_string = re.sub('AGREE', '', judges_string.upper())2128 judges_string = re.sub(' MENT ', '', judges_string.upper())2129 judges_string = re.sub(' MENT,', '', judges_string.upper())2130 judges_string = re.sub(',MENT ', '', judges_string.upper())2131 judges_string = re.sub(' BY ', '', judges_string.upper())2132 judges_string = re.sub(' BY,', '', judges_string.upper())2133 judges_string = re.sub(',BY ', '', judges_string.upper())2134 judges_string = re.sub(' IS ', '', judges_string.upper())2135 judges_string = re.sub(' IS,', '', judges_string.upper())2136 judges_string = re.sub(',IS ', '', judges_string.upper()) 2137 judges_string = re.sub('ATTACHED', '', judges_string.upper())2138 judges_string = re.sub('ORDER', '', judges_string.upper())2139 judges_string = re.sub('CONSTITUTIONALITY', '', judges_string.upper())2140 if state != 'Georgia':2141 judges_string = re.sub('grant|Grant|GRANT', '', judges_string)2142 if state != 'Alabama':2143 judges_string = re.sub(' See| see', '', judges_string)2144 #print judges_string2145 judges_line = False2146 judges_part_string = first_sentence(judges_string)2147 judges_holder = re.sub("\*|\d", "", judges_part_string)2148 judges_holder = re.sub("Before:* ", "", judges_holder)2149 judges_holder = re.sub(", (Circuit|Circuit) (J|j)udge[s]?\.?", "", judges_holder)2150 judges_holder = re.sub(", (District|DISTRICT) (J|j)udge[s]?\.?", "", judges_holder)2151 judges_holder = re.sub("Chief Judge", "", judges_holder)2152 judges_holder = re.sub("Senior Judge", "", judges_holder)2153 judges_holder = re.sub("Justice[s]", "", judges_holder)2154 judges_holder = re.sub("Chief District Judge", "", judges_holder)2155 judges_holder = re.sub("Associate Justice", "", judges_holder)2156 judges_holder = re.sub("Administrative Justice", "", judges_holder)2157 judges_holder = re.sub("Administrative Judge", "", judges_holder)2158 judges_holder = re.sub("(P|p)ro (T|t)em", "", judges_holder)2159 judges_holder = re.sub(", (Jr\.|JR\.|Jr|jr)", "", judges_holder)2160 judges_holder = re.sub(", (Sr\.|SR\.)", "Sr.", judges_holder)2161 judges_holder = re.sub(", III", "III", judges_holder)2162 judges_holder = re.sub(", II", "II", judges_holder)2163 judges_holder = re.sub(";", ",", judges_holder)2164 judges_holder = re.sub(",[\s]*,", ",", judges_holder)2165 judges_holder = re.sub(" and ", ", ", judges_holder)2166 judges_holder = re.sub(" \. ", " ", judges_holder)2167 judges_holder = re.sub("[\s]+", " ", judges_holder)2168 judges_holder = re.sub("C\.J\.,|Supr\. J\.|J\.P\.T\.|Sp\.J\.|S\.J\.|P\.JJ\.|JJ\.,|JJ\.|D\.J\.,|P\.J\.,|C\.J\.|J\.,|J\.|C\. J\.", ",", judges_holder)2169 judges_holder = re.sub("\xc3\xa1", "a", judges_holder)2170 judges_holder = re.split(",", judges_holder)2171 judges_holder = judges_holder + non_panel_list2172 judges_holder = [word for word in judges_holder if word != ""]2173 judges_holder = [word.strip() for word in judges_holder]2174 judges_holder = [word.upper() for word in judges_holder]2175 judges_holder = [word for word in judges_holder if len(word) > 2]2176 judges_holder = list(set(judges_holder))2177 # Apply functions to judge names to format the names of each justice uniformly2178 if (len(judges_holder) == 1):2179 judge1_ln = lastname(judges_holder[0])2180 judge1_fn = firstname(judges_holder[0])2181 judge1_mn = middlename(judges_holder[0])2182 judge1_suf = namesuffix(judges_holder[0])2183 judge1_full = judge1_ln + ", " + judge1_fn + " " + judge1_mn + " " + judge1_suf2184 judge1_full = re.sub("[\s]+", " ", judge1_full)2185 judge1_full = re.sub(", $", "", judge1_full)2186 if len(judge1_ln) < 2:2187 judge1_ln = ""2188 judge1_vote = ""2189 if (len(judges_holder) > 1):2190 judge1_ln = lastname(judges_holder[0])2191 judge1_fn = firstname(judges_holder[0])2192 judge1_mn = middlename(judges_holder[0])2193 judge1_suf = namesuffix(judges_holder[0])2194 judge1_full = judge1_ln + ", " + judge1_fn + " " + judge1_mn + " " + judge1_suf2195 judge1_full = re.sub("[\s]+", " ", judge1_full)2196 judge1_full = re.sub(", $", "", judge1_full)2197 if len(judge1_ln) < 2:2198 judge1_ln = ""2199 judge1_vote = ""2200 #print judges_holder[0]2201 judge2_ln = lastname(judges_holder[1])2202 #print judge2_ln2203 judge2_fn = firstname(judges_holder[1])2204 judge2_mn = middlename(judges_holder[1])2205 judge2_suf = namesuffix(judges_holder[1])2206 judge2_full = judge2_ln + ", " + judge2_fn + " " + judge2_mn + " " + judge2_suf2207 judge2_full = re.sub("[\s]+", " ", judge2_full)2208 judge2_full = re.sub(", $", "", judge2_full)2209 if len(judge2_ln) < 2:2210 judge2_ln = ""2211 judge2_vote = ""2212 if (len(judges_holder) > 2):2213 judge3_ln = lastname(judges_holder[2])2214 judge3_fn = firstname(judges_holder[2])2215 judge3_mn = middlename(judges_holder[2])2216 judge3_suf = namesuffix(judges_holder[2])2217 judge3_full = judge3_ln + ", " + judge3_fn + " " + judge3_mn + " " + judge3_suf2218 judge3_full = re.sub("[\s]+", " ", judge3_full)2219 judge3_full = re.sub(", $", "", judge3_full)2220 if len(judge3_ln) < 2:2221 judge3_ln = ""2222 judge3_vote = ""2223 if (len(judges_holder) > 3):2224 judge4_ln = lastname(judges_holder[3])2225 judge4_fn = firstname(judges_holder[3])2226 judge4_mn = middlename(judges_holder[3])2227 judge4_suf = namesuffix(judges_holder[3])2228 judge4_full = judge4_ln + ", " + judge4_fn + " " + judge4_mn + " " + judge4_suf2229 judge4_full = re.sub("[\s]+", " ", judge4_full)2230 judge4_full = re.sub(", $", "", judge4_full)2231 if len(judge4_ln) < 2:2232 judge4_ln = ""2233 judge4_vote = ""2234 if (len(judges_holder) > 4):2235 judge5_ln = lastname(judges_holder[4])2236 judge5_fn = firstname(judges_holder[4])2237 judge5_mn = middlename(judges_holder[4])2238 judge5_suf = namesuffix(judges_holder[4])2239 judge5_full = judge5_ln + ", " + judge5_fn + " " + judge5_mn + " " + judge5_suf2240 judge5_full = re.sub("[\s]+", " ", judge5_full)2241 judge5_full = re.sub(", $", "", judge5_full)2242 if len(judge5_ln) < 2:2243 judge5_ln = ""2244 judge5_vote = ""2245 if (len(judges_holder) > 5):2246 judge6_ln = lastname(judges_holder[5])2247 judge6_fn = firstname(judges_holder[5])2248 judge6_mn = middlename(judges_holder[5])2249 judge6_suf = namesuffix(judges_holder[5])2250 judge6_full = judge6_ln + ", " + judge6_fn + " " + judge6_mn + " " + judge6_suf2251 judge6_full = re.sub("[\s]+", " ", judge6_full)2252 judge6_full = re.sub(", $", "", judge6_full)2253 if len(judge6_ln) < 2:2254 judge6_ln = ""2255 judge6_vote = ""2256 if (len(judges_holder) > 6):2257 judge7_ln = lastname(judges_holder[6])2258 judge7_fn = firstname(judges_holder[6])2259 judge7_mn = middlename(judges_holder[6])2260 judge7_suf = namesuffix(judges_holder[6])2261 judge7_full = judge7_ln + ", " + judge7_fn + " " + judge7_mn + " " + judge7_suf2262 judge7_full = re.sub("[\s]+", " ", judge7_full)2263 judge7_full = re.sub(", $", "", judge7_full)2264 if len(judge7_ln) < 2:2265 judge7_ln = ""2266 judge7_vote = ""2267 if (len(judges_holder) > 7):2268 judge8_ln = lastname(judges_holder[7])2269 judge8_fn = firstname(judges_holder[7])2270 judge8_mn = middlename(judges_holder[7])2271 judge8_suf = namesuffix(judges_holder[7])2272 judge8_full = judge8_ln + ", " + judge8_fn + " " + judge8_mn + " " + judge8_suf2273 judge8_full = re.sub("[\s]+", " ", judge8_full)2274 judge8_full = re.sub(", $", "", judge8_full)2275 if len(judge8_ln) < 2:2276 judge8_ln = ""2277 judge8_vote = ""2278 if (len(judges_holder) > 8):2279 judge9_ln = lastname(judges_holder[8])2280 judge9_fn = firstname(judges_holder[8])2281 judge9_mn = middlename(judges_holder[8])2282 judge9_suf = namesuffix(judges_holder[8])2283 judge9_full = judge9_ln + ", " + judge9_fn + " " + judge9_mn + " " + judge9_suf2284 judge9_full = re.sub("[\s]+", " ", judge9_full)2285 judge9_full = re.sub(", $", "", judge9_full)2286 if len(judge9_ln) < 2:2287 judge9_ln = ""2288 judge9_vote = ""2289 if (len(judges_holder) > 9):2290 judge10_ln = lastname(judges_holder[9])2291 judge10_fn = firstname(judges_holder[9])2292 judge10_mn = middlename(judges_holder[9])2293 judge10_suf = namesuffix(judges_holder[9])2294 judge10_full = judge10_ln + ", " + judge10_fn + " " + judge10_mn + " " + judge10_suf2295 judge10_full = re.sub("[\s]+", " ", judge10_full)2296 judge10_full = re.sub(", $", "", judge10_full)2297 if len(judge10_ln) < 2:2298 judge10_ln = ""2299 judge10_vote = ""2300 if (len(judges_holder) > 10):2301 judge11_ln = lastname(judges_holder[10])2302 judge11_fn = firstname(judges_holder[10])2303 judge11_mn = middlename(judges_holder[10])2304 judge11_suf = namesuffix(judges_holder[10])2305 judge11_full = judge11_ln + ", " + judge11_fn + " " + judge11_mn + " " + judge11_suf2306 judge11_full = re.sub("[\s]+", " ", judge11_full)2307 judge11_full = re.sub(", $", "", judge11_full)2308 if len(judge11_ln) < 2:2309 judge11_ln = ""2310 judge11_vote = ""2311 if (len(judges_holder) > 11):2312 check_case = 12313 if len(judge_np_list) == 0:2314 judge_np1 = ""2315 elif len(judge_np_list) == 1:2316 judge_np1 = judge_np_list[0].strip()2317 judge_np1 = re.sub(",", "", judge_np1)2318 judge_np1 = re.sub("\\xc2\\xa0", "", judge_np1)2319 if len(judge_np1) > 10:2320 judge_np1 = judge_np1.split(' ', 1)[0]2321 elif len(judge_np_list) == 2:2322 judge_np1 = judge_np_list[0].strip()2323 judge_np1 = re.sub(",", "", judge_np1)2324 judge_np2 = judge_np_list[1].strip()2325 judge_np2 = re.sub(",", "", judge_np2)2326 elif len(judge_np_list) > 2:2327 judge_np1 = judge_np_list[0].strip()2328 judge_np1 = re.sub(",", "", judge_np1)2329 judge_np2 = judge_np_list[1].strip()2330 judge_np2 = re.sub(",", "", judge_np2)2331 judge_np3 = judge_np_list[2].strip()2332 judge_np3 = re.sub(",", "", judge_np3)2333 judge_np1 = re.sub("\.", "", judge_np1)2334 judge_np2 = re.sub("\.", "", judge_np2)2335 judge_np3 = re.sub("\.", "", judge_np3)2336 judge_np1 = re.sub("\\\\n", "", judge_np1)2337 judge_np2 = re.sub("\\\\n", "", judge_np2)2338 judge_np3 = re.sub("\\\\n", "", judge_np3)2339 judge_np1 = re.sub("\n", "", judge_np1)2340 judge_np2 = re.sub("\n", "", judge_np2)2341 judge_np3 = re.sub("\n", "", judge_np3)2342 judge_np1 = re.sub(", Chief", "", judge_np1)2343 judge_np2 = re.sub(", Chief", "", judge_np2)2344 judge_np3 = re.sub(", Chief", "", judge_np3)2345 judge_np1 = re.sub("Judges:", "", judge_np1)2346 judge_np2 = re.sub("Judges:", "", judge_np2)2347 judge_np3= re.sub("Judges:", "", judge_np3)2348 judge_np1 = re.sub("All the concur, except", "", judge_np1)2349 judge_np2 = re.sub("All the concur, except", "", judge_np2)2350 judge_np3 = re.sub("All the concur, except", "", judge_np3)2351 judge_np1 = re.sub("\xc2\xa0:", "", judge_np1)2352 judge_np2 = re.sub("\xc2\xa0:", "", judge_np2)2353 judge_np3 = re.sub("\xc2\xa0:", "", judge_np3)2354 judge_np1 = re.sub(", ", "", judge_np1)2355 judge_np2 = re.sub(", ", "", judge_np2)2356 judge_np3 = re.sub(", ", "", judge_np3)2357 judge_np1 = judge_np1.strip()2358 judge_np2 = judge_np2.strip()2359 judge_np3 = judge_np3.strip()2360 judge_np1 = Capitalize(judge_np1)2361 judge_np2 = Capitalize(judge_np2)2362 judge_np3 = Capitalize(judge_np3)2363 judge1_ln = lastname(judge1_ln)2364 judge2_ln = lastname(judge2_ln)2365 judge3_ln = lastname(judge3_ln)2366 judge4_ln = lastname(judge4_ln)2367 judge5_ln = lastname(judge5_ln)2368 judge6_ln = lastname(judge6_ln)2369 judge7_ln = lastname(judge7_ln)2370 judge8_ln = lastname(judge8_ln)2371 judge9_ln = lastname(judge9_ln)2372 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln, judge8_ln, judge9_ln2373 # Remove justices that did not participate based on previously stored list of non-participating judges; remove votes from these justices as well2374 if (judge1_ln == judge_np1 or judge1_ln == judge_np2 or judge1_ln == judge_np3 or judge1_ln == judge_np4):2375 judge1_ln = ""2376 judge1_vote = ""2377 if (judge2_ln == judge_np1 or judge2_ln == judge_np2 or judge2_ln == judge_np3 or judge2_ln == judge_np4):2378 judge2_ln = ""2379 judge2_vote = ""2380 if (judge3_ln == judge_np1 or judge3_ln == judge_np2 or judge3_ln == judge_np3 or judge3_ln == judge_np4):2381 judge3_ln = ""2382 judge3_vote = ""2383 if (judge4_ln == judge_np1 or judge4_ln == judge_np2 or judge4_ln == judge_np3 or judge4_ln == judge_np4):2384 judge4_ln = ""2385 judge4_vote = ""2386 if (judge5_ln == judge_np1 or judge5_ln == judge_np2 or judge5_ln == judge_np3 or judge5_ln == judge_np4):2387 judge5_ln = ""2388 judge5_vote = ""2389 if (judge6_ln == judge_np1 or judge6_ln == judge_np2 or judge6_ln == judge_np3 or judge6_ln == judge_np4):2390 judge6_ln = ""2391 judge6_vote = ""2392 if (judge7_ln == judge_np1 or judge7_ln == judge_np2 or judge7_ln == judge_np3 or judge7_ln == judge_np4):2393 judge7_ln = ""2394 judge7_vote = ""2395 if (judge8_ln == judge_np1 or judge8_ln == judge_np2 or judge8_ln == judge_np3 or judge8_ln == judge_np4):2396 judge8_ln = ""2397 judge8_vote = ""2398 if (judge9_ln == judge_np1 or judge9_ln == judge_np2 or judge9_ln == judge_np3 or judge9_ln == judge_np4):2399 judge9_ln = ""2400 judge9_vote = ""2401 if (judge10_ln == judge_np1 or judge10_ln == judge_np2 or judge10_ln == judge_np3 or judge10_ln == judge_np4):2402 judge10_ln = ""2403 judge10_vote = ""2404 if (judge11_ln == judge_np1 or judge11_ln == judge_np2 or judge11_ln == judge_np3 or judge11_ln == judge_np4 ):2405 judge11_ln = ""2406 judge11_vote = ""2407 # Determine if a dissenting opinion is present2408 if (re.search("dissent|DISSENT|dissents|Dissents|dissenting|Dissenting|DISSENTING", judges_string)):2409 jud_dissent = 12410 # Determine if a decision was unanimous2411 if (re.search("(U|u)nanimous|UNANIMOUS", judges_string)):2412 unanimous = 12413 if(unanimous == 1 and re.search("concurred\.", txtline)): ###build out to parse judge list into single judges2414 new_judges = txtline2415 new_judges = re.sub("C\.\sJ\.,", "", new_judges)2416 new_judges = re.sub("J\.,", "", new_judges)2417 new_judges = re.sub(" and", "", new_judges)2418 new_judges = re.sub("concurred\.", "", new_judges)2419 new_judges = re.sub("\[\*+[0-9]+\]", "", new_judges)2420 new_judges = re.sub("\s", "", new_judges)2421 new_judges = new_judges.split(",")2422 judges_holder = [judges_holder.pop(0)] + new_judges2423 if (len(judges_holder) > 1):2424 judge1_ln = lastname(judges_holder[0])2425 judge2_ln = lastname(judges_holder[1])2426 if (len(judges_holder) > 2):2427 judge3_ln = lastname(judges_holder[2])2428 if (len(judges_holder) > 3):2429 judge4_ln = lastname(judges_holder[3])2430 if (len(judges_holder) > 4):2431 judge5_ln = lastname(judges_holder[4])2432 if (len(judges_holder) > 5):2433 judge6_ln = lastname(judges_holder[5])2434 if (len(judges_holder) > 6):2435 judge7_ln = lastname(judges_holder[6])2436 if (len(judges_holder) > 7):2437 judge8_ln = lastname(judges_holder[7])2438 if (len(judges_holder) > 8):2439 judge9_ln = lastname(judges_holder[8])2440 # Store name of justice writing the majority opinion and format name2441 if (re.match("^Opinion by:", txtline) and not trunc_text):2442 opin_by_line = True2443 if (opin_by_line and re.search("[\w]+", txtline)):2444 opin_by_string = opin_by_string + txtline2445 if (opin_by_line and re.match("^[\s]+$", txtline)):2446 # blank line after opinion by line2447 opin_by_string = re.sub("Opinion by:", "", opin_by_string)2448 opin_by_string = re.sub("FOR THE COURT;", "", opin_by_string)2449 opin_by_string = re.sub("\[\*+\d+\]", "", opin_by_string)2450 opin_by_string = re.sub("\*[\d]*", "", opin_by_string)2451 opin_by_string = re.sub(", Circuit Judge", "", opin_by_string)2452 opin_by_string = re.sub("Chief Justice:", "", opin_by_string)2453 opin_by_string = re.sub("\xc2", "", opin_by_string)2454 opin_by_string = re.sub("'", "", opin_by_string)2455 opin_by_string = re.sub("Sr\.|SR\.|Jr\.|JR\.", "", opin_by_string)2456 opin_by_string = re.sub("\xa0", "", opin_by_string)2457 opin_by_string = re.sub("C\.\sJ\.|C\.J\.|J\.J\.|J\.\sJ\.|J\.", "", opin_by_string)2458 opin_by_string = re.sub("T\.Y\.|T\. Y\.", "", opin_by_string)2459 opin_by_string = re.sub(" C\.", "", opin_by_string)2460 opin_by_string = re.sub("\xc3\x81", "a", opin_by_string)2461 opin_by_string = re.sub("III", "", opin_by_string)2462 opin_by_string = re.sub("\xc3\x81", "a", opin_by_string)2463 opin_by_string = re.sub(" ILL| ill", "ONEILL", opin_by_string)2464 opin_by_string = re.sub("Justice|JUSTICE", "", opin_by_string)2465 opin_by_string = re.sub('DENVIR STITH|DENVIRSTITH', 'Stith', opin_by_string)2466 opin_by_string = re.sub("Judge|judge", "", opin_by_string)2467 opin_by_string = string.strip(opin_by_string)2468 opin_by_line = False2469 author_ln = lastname(opin_by_string)2470 author_fn = firstname(opin_by_string)2471 author_mn = middlename(opin_by_string)2472 author_suf = namesuffix(opin_by_string)2473 author_full = author_ln + ", " + author_fn + " " + author_mn + " " + author_suf2474 author_full = re.sub("[\s]+", " ", author_full)2475 author_full = re.sub(", $", "", author_full)2476 if(Capitalize(judge1_ln) != Capitalize(author_ln)):2477 judge11_ln = judge10_ln2478 judge10_ln = judge9_ln2479 judge9_ln = judge8_ln2480 judge8_ln = judge7_ln2481 judge7_ln = judge6_ln2482 judge6_ln = judge5_ln2483 judge5_ln = judge4_ln2484 judge4_ln = judge3_ln2485 judge3_ln = judge2_ln2486 judge2_ln = judge1_ln2487 judge1_ln = author_ln2488 judge11_vote = judge10_vote2489 judge10_vote = judge9_vote2490 judge9_vote = judge8_vote2491 judge8_vote = judge7_vote2492 judge7_vote = judge6_vote2493 judge6_vote = judge5_vote2494 judge5_vote = judge4_vote2495 judge4_vote = judge3_vote2496 judge3_vote = judge2_vote2497 judge2_vote = judge1_vote2498 judge1_vote = 12499 if (re.match("^Opinion", txtline) and not trunc_text and not blank_after_firstcite and not re.search("^Opinion No.",txtline)):2500 opinion_line = True2501 opinion_start = True2502 if (re.match(re.escape("********** Print Completed **********"), txtline) or re.match("APPENDIX", txtline) or re.match("^CONCUR BY:", txtline) or re.match("^DISSENT BY:", txtline)):2503 opinion_line = False2504 if opinion_line:2505 op_string = txtline2506 op_holder = re.sub("^Opinion", " ", op_string)2507 op_holder = re.sub("\xa0", " ", op_holder)2508 op_holder = re.sub("\n|\r", " ", op_holder)2509 op_holder = re.sub("\[\*+[0-9]+\]", " ", op_holder)2510 op_holder = string.strip(op_holder)2511 op_holder = re.split("\s+", op_holder)2512 op_holder = [word for word in op_holder if word != ""]2513 opinion_word_count += len(op_holder)2514 judge1_vote = 12515 if (re.search("AMICUS|amicus|Amicus", op_string)):2516 amicus = 12517 if (re.search("^Dissent", txtline)):2518 dissent_line = True2519 # If Lexis lists a line beginning with "Dissent:", store the justices listed after2520 if (re.match("^Dissent by:|^DISSENT BY:", txtline) and not trunc_text):2521 dissent_by_line = True2522 dissent = 12523 if (dissent_by_line and re.search("[\w]+", txtline)):2524 dissent_by_string = dissent_by_string + txtline2525 # Format dissenting justice names2526 if (dissent_by_line and re.match("^[\s]+$", txtline)):2527 silent_dissent = True2528 dissent_by_string = string.strip(dissent_by_string)2529 dissent_by_string = re.sub("\n", "", dissent_by_string)2530 dissent_by_string = re.sub("Dissent by:|DISSENT BY:", "", dissent_by_string)2531 dissent_by_string = re.sub("\[.+\]", "", dissent_by_string)2532 dissent_by_string = re.sub("[\s]*\(In[\s]*(P|p)art\)", "", dissent_by_string)2533 dissent_by_string = re.sub("\*\d+", "", dissent_by_string)2534 dissent_by_string = re.sub("dissenting:|dissenting", "", dissent_by_string)2535 dissent_by_string = re.sub("Justice|JUSTICE", "", dissent_by_string)2536 dissent_by_string = re.sub("\d+", "", dissent_by_string)2537 dissent_by_string = re.sub("\xc2", "", dissent_by_string)2538 dissent_by_string = re.sub("\xa0", "", dissent_by_string)2539 dissent_by_string = re.sub("J;", "", dissent_by_string)2540 dissent_by_string = re.sub("C\.J\.|C\. J\.|J\.J\.|JJ\.|J\. J\.|J\.", "", dissent_by_string)2541 dissent_by_string = re.sub("[\(\[].*?[\)\]]", "", dissent_by_string)2542 dissent_by_string = re.sub("'", "", dissent_by_string)2543 dissent_by_string = re.sub("affirmed", "", dissent_by_string)2544 dissent_by_string = re.sub("filed an opinion concurring in part and in part", "", dissent_by_string)2545 dissent_by_string = re.sub("concurring in part", "", dissent_by_string)2546 dissent_by_string = re.sub("in which", "", dissent_by_string)2547 dissent_by_string = re.sub("of which", "", dissent_by_string)2548 dissent_by_string = re.sub("joined", "", dissent_by_string)2549 dissent_by_string = re.sub("Part I", "", dissent_by_string)2550 dissent_by_string = re.sub("Part", "", dissent_by_string)2551 dissent_by_string = re.sub("in part", "", dissent_by_string)2552 dissent_by_string = re.sub("and in", "", dissent_by_string)2553 dissent_by_string = re.sub(" by", "", dissent_by_string)2554 dissent_by_string = re.sub(" and", "", dissent_by_string)2555 dissent_by_string = re.sub("as to", "", dissent_by_string)2556 dissent_by_string = re.sub("filed a", "", dissent_by_string)2557 dissent_by_string = re.sub("\.", ",", dissent_by_string)2558 dissent_by_string = re.sub("[\s]*;", ";", dissent_by_string)2559 dissent_holder = re.split(";|,", dissent_by_string)2560 dissent_holder = filter(None, dissent_holder)2561 dissent_holder = [name for name in dissent_holder if name.strip()]2562 num_dissent = len(dissent_holder)2563 dissent_by_line = False2564 try:2565 dissent1_ln = lastname(dissent_holder[0]).strip()2566 except:2567 pass2568 dissent1_ln = dissent1_ln.strip()2569 dissent1_ln = re.sub("\xa0", "", dissent1_ln)2570 dissent1_ln = Capitalize(dissent1_ln)2571 try:2572 dissent1_fn = firstname(dissent_holder[0])2573 dissent1_mn = middlename(dissent_holder[0])2574 dissent1_suf = namesuffix(dissent_holder[0])2575 except:2576 pass2577 if (len(dissent_holder) > 1):2578 dissent2_ln = lastname(dissent_holder[1]).strip()2579 dissent2_fn = firstname(dissent_holder[1])2580 dissent2_mn = middlename(dissent_holder[1])2581 dissent2_suf = namesuffix(dissent_holder[1])2582 if (len(dissent_holder) > 2):2583 dissent3_ln = lastname(dissent_holder[2]).strip()2584 dissent3_fn = firstname(dissent_holder[2])2585 dissent3_mn = middlename(dissent_holder[2])2586 dissent3_suf = namesuffix(dissent_holder[2])2587 if (len(dissent_holder) > 3):2588 dissent4_ln = lastname(dissent_holder[3]).strip()2589 dissent4_fn = firstname(dissent_holder[3])2590 dissent4_mn = middlename(dissent_holder[3])2591 dissent4_suf = namesuffix(dissent_holder[3])2592 if (len(dissent_holder) > 4):2593 dissent5_ln = lastname(dissent_holder[4]).strip()2594 dissent5_fn = firstname(dissent_holder[4])2595 dissent5_mn = middlename(dissent_holder[4])2596 dissent5_suf = namesuffix(dissent_holder[4])2597 dissent1_full = dissent1_ln + ", " + dissent1_fn + " " + dissent1_mn + " " + dissent1_suf2598 dissent1_full = re.sub("[\s]+", " ", dissent1_full)2599 dissent1_full = re.sub(", $", "", dissent1_full)2600 dissent2_full = dissent2_ln + ", " + dissent2_fn + " " + dissent2_mn + " " + dissent2_suf2601 dissent2_full = re.sub("[\s]+", " ", dissent2_full)2602 dissent2_full = re.sub(", $", "", dissent2_full)2603 dissent3_full = dissent3_ln + ", " + dissent3_fn + " " + dissent3_mn + " " + dissent3_suf2604 dissent3_full = re.sub("[\s]+", " ", dissent3_full)2605 dissent3_full = re.sub(", $", "", dissent3_full)2606 dissent4_full = dissent4_ln + ", " + dissent4_fn + " " + dissent4_mn + " " + dissent4_suf2607 dissent4_full = re.sub("[\s]+", " ", dissent4_full)2608 dissent4_full = re.sub(", $", "", dissent4_full)2609 dissent5_full = dissent4_ln + ", " + dissent5_fn + " " + dissent5_mn + " " + dissent5_suf2610 dissent5_full = re.sub("[\s]+", " ", dissent5_full)2611 dissent5_full = re.sub(", $", "", dissent5_full)2612 # Store justices that concurred in dissenting opinions, format names, and store in a list2613 if (silent_dissent == True and re.search("concurs\.$|concur\.$|concurred\.$", txtline)):2614 other_dissent_string = txtline2615 other_dissent_string = re.sub("\xa0", "", other_dissent_string)2616 other_dissent_string = re.sub(" C\.J\.,| C\. J\.|JJ\.| J\.|C\.J\.", "", other_dissent_string)2617 other_dissent_string = re.sub(" and", ",", other_dissent_string)2618 other_dissent_string = re.sub("'", "", other_dissent_string)2619 other_dissent_string = re.sub(" concurred\.", "", other_dissent_string)2620 other_dissent_string = re.sub(" concur\.\n| concurs\.\n", "", other_dissent_string)2621 other_dissent_string = re.sub("affirmed", "", other_dissent_string)2622 other_dissent_string = re.sub("whom", "", other_dissent_string)2623 other_dissent_string = other_dissent_string.strip()2624 other_dissent_judges = other_dissent_string.split(",")2625 other_dissent_judges[:] = [item for item in other_dissent_judges if item != '']2626 if len(other_dissent_judges) > 0:2627 silent_judge1 = other_dissent_judges[0].strip()2628 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge1))2629 dissent_holder = dissent_holder + [silent_judge1]2630 num_dissent += 12631 if len(other_dissent_judges) > 1:2632 silent_judge2 = other_dissent_judges[1].strip()2633 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge2))2634 num_dissent += 12635 dissent_holder = dissent_holder + [silent_judge2]2636 if len(other_dissent_judges) > 2:2637 silent_judge3 = other_dissent_judges[2].strip()2638 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge3))2639 num_dissent += 12640 dissent_holder = dissent_holder + [silent_judge3]2641 if len(other_dissent_judges) > 3:2642 silent_judge4 = other_dissent_judges[3].strip()2643 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge4))2644 num_dissent += 12645 dissent_holder = dissent_holder + [silent_judge4]2646 if silent_judge4 == silent_judge1 or silent_judge4 == silent_judge2 or silent_judge4 == silent_judge3:2647 silent_judge4 = ""2648 if silent_judge3 == silent_judge1 or silent_judge3 == silent_judge2:2649 silent_judge3 = ""2650 if silent_judge2 == silent_judge1:2651 silent_judge2 = ""2652 silent_dissent = False2653 # Search for concurring judge2654 if (re.search("Concur", txtline)):2655 concur_line = True2656 # Store number of concurring justice and parse/format names of concurring justices (stored in string)2657 if (re.match("^Concur by:", txtline) and not trunc_text):2658 concur_by_line = True2659 concur = concur + 12660 if (concur_by_line and re.search("[\w]+", txtline)):2661 concur_by_string = concur_by_string + txtline2662 if (concur_by_line and re.match("^[\s]+$", txtline)):2663 concur_by_string = string.strip(concur_by_string)2664 concur_by_string = re.sub("\n", " ", concur_by_string)2665 concur_by_string = re.sub("Concur by: ", "", concur_by_string)2666 concur_by_string = re.sub("\[.+\]", "", concur_by_string)2667 concur_by_string = re.sub("\xc2", "", concur_by_string)2668 concur_by_string = re.sub("[\s]*\(In[\s]*(P|p)art\)", "", concur_by_string)2669 concur_by_string = re.sub("\*\d+", "", concur_by_string)2670 concur_by_string = re.sub("\d+", "", concur_by_string)2671 concur_by_string = re.sub("[\s]*;", ";", concur_by_string)2672 concur_holder = re.split("; ", concur_by_string)2673 num_concur = len(concur_holder)2674 concur_by_line = False2675 concur1_ln = lastname(concur_holder[0])2676 concur1_fn = firstname(concur_holder[0])2677 concur1_mn = middlename(concur_holder[0])2678 concur1_suf = namesuffix(concur_holder[0])2679 if (len(concur_holder) > 1):2680 concur2_ln = lastname(concur_holder[1])2681 concur2_fn = firstname(concur_holder[1])2682 concur2_mn = middlename(concur_holder[1])2683 concur2_suf = namesuffix(concur_holder[1])2684 if (len(concur_holder) > 2):2685 concur3_ln = lastname(concur_holder[2])2686 concur3_fn = firstname(concur_holder[2])2687 concur3_mn = middlename(concur_holder[2])2688 concur3_suf = namesuffix(concur_holder[2])2689 if (len(concur_holder) > 3):2690 concur4_ln = lastname(concur_holder[3])2691 concur4_fn = firstname(concur_holder[3])2692 concur4_mn = middlename(concur_holder[3])2693 concur4_suf = namesuffix(concur_holder[3])2694 if (len(concur_holder) > 4):2695 concur5_ln = lastname(concur_holder[4])2696 concur5_fn = firstname(concur_holder[4])2697 concur5_mn = middlename(concur_holder[4])2698 concur5_suf = namesuffix(concur_holder[4])2699 if (len(concur_holder) > 5):2700 concur6_ln = lastname(concur_holder[5])2701 concur6_fn = firstname(concur_holder[5])2702 concur6_mn = middlename(concur_holder[5])2703 concur6_suf = namesuffix(concur_holder[5])2704 if (len(concur_holder) > 6):2705 concur7_ln = lastname(concur_holder[6])2706 concur7_fn = firstname(concur_holder[6])2707 concur7_mn = middlename(concur_holder[6])2708 concur7_suf = namesuffix(concur_holder[6])2709 concur1_full = concur1_ln + ", " + concur1_fn + " " + concur1_mn + " " + concur1_suf2710 concur1_full = re.sub("[\s]+", " ", concur1_full)2711 concur1_full = re.sub(", $", "", concur1_full)2712 concur2_full = concur2_ln + ", " + concur2_fn + " " + concur2_mn + " " + concur2_suf2713 concur2_full = re.sub("[\s]+", " ", concur2_full)2714 concur2_full = re.sub(", $", "", concur2_full)2715 concur3_full = concur3_ln + ", " + concur3_fn + " " + concur3_mn + " " + concur3_suf2716 concur3_full = re.sub("[\s]+", " ", concur3_full)2717 concur3_full = re.sub(", $", "", concur3_full)2718 concur4_full = concur4_ln + ", " + concur4_fn + " " + concur4_mn + " " + concur4_suf2719 concur4_full = re.sub("[\s]+", " ", concur4_full)2720 concur4_full = re.sub(", $", "", concur4_full)2721 concur5_full = concur5_ln + ", " + concur5_fn + " " + concur5_mn + " " + concur5_suf2722 concur5_full = re.sub("[\s]+", " ", concur5_full)2723 concur5_full = re.sub(", $", "", concur5_full)2724 concur6_full = concur6_ln + ", " + concur6_fn + " " + concur6_mn + " " + concur6_suf2725 concur6_full = re.sub("[\s]+", " ", concur6_full)2726 concur6_full = re.sub(", $", "", concur6_full)2727 concur7_full = concur7_ln + ", " + concur7_fn + " " + concur7_mn + " " + concur7_suf2728 concur7_full = re.sub("[\s]+", " ", concur7_full)2729 concur7_full = re.sub(", $", "", concur7_full)2730 # Format all justices listed as dissenting (both those that wrote an opinion and those that signed on)2731 dissent_holder = [word for word in dissent_holder if word != ""]2732 dissent_holder = dissent_holder + other_dissent_holder2733 dissent_holder = [word.upper().strip() for word in dissent_holder]2734 dissent_holder = list(set(dissent_holder))2735 if len(dissent_holder)==0:2736 dissent_author_1 = ""2737 dissent_author_2 = ""2738 dissent_author_3 = ""2739 dissent_author_4 = ""2740 if len(dissent_holder)==1:2741 dissent_author_1 = dissent_holder[0].strip()2742 dissent_author_1 = re.sub("\xa0*", "", dissent_author_1)2743 dissent_author_1 = re.sub("\(In\s*part\)", "", dissent_author_1)2744 dissent_author_1 = lastname(dissent_author_1)2745 dissent_author_1 = Capitalize(dissent_author_1)2746 dissent_author_2 = ""2747 dissent_author_3 = ""2748 dissent_author_4 = ""2749 if len(dissent_holder)==2:2750 dissent_author_1 = dissent_holder[0].strip()2751 dissent_author_1 = dissent_author_1.strip()2752 dissent_author_1 = re.sub("\xa0", "", dissent_author_1)2753 dissent_author_1 = re.sub("\(In", "", dissent_author_1)2754 dissent_author_1 = re.sub("J\.", "", dissent_author_1)2755 dissent_author_1 = re.sub("J;", "", dissent_author_1)2756 dissent_author_1 = Capitalize(lastname(dissent_author_1))2757 dissent_author_2 = dissent_holder[1].strip()2758 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2759 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2760 dissent_author_2 = Capitalize(lastname(dissent_author_2))2761 dissent_author_3 = ""2762 dissent_author_4 = ""2763 if len(dissent_holder)==3:2764 dissent_author_1 = dissent_holder[0].strip()2765 dissent_author_1 = dissent_author_1.strip()2766 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2767 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2768 dissent_author_1 = Capitalize(lastname(dissent_author_1))2769 dissent_author_2 = dissent_holder[1].strip()2770 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2771 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2772 dissent_author_2 = Capitalize(lastname(dissent_author_2))2773 dissent_author_3 = dissent_holder[2].strip()2774 dissent_author_3 = dissent_author_3.strip()2775 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2776 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2777 dissent_author_3 = Capitalize(lastname(dissent_author_3))2778 dissent_author_4 = ""2779 if len(dissent_holder)==4:2780 dissent_author_1 = dissent_holder[0].strip()2781 dissent_author_1 = dissent_author_1.strip()2782 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2783 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2784 dissent_author_1 = Capitalize(lastname(dissent_author_1))2785 dissent_author_2 = dissent_holder[1].strip()2786 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2787 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2788 dissent_author_2 = Capitalize(lastname(dissent_author_2))2789 dissent_author_3 = dissent_holder[2].strip()2790 dissent_author_3 = dissent_author_3.strip()2791 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2792 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2793 dissent_author_3 = Capitalize(lastname(dissent_author_3))2794 dissent_author_4 = dissent_holder[3].strip()2795 dissent_author_4 = dissent_author_4.strip()2796 dissent_author_4 = re.sub("[\xa0]*", "", dissent_author_4)2797 dissent_author_4 = re.sub("\In\spart\)", "", dissent_author_4)2798 dissent_author_4 = Capitalize(lastname(dissent_author_4))2799 dissent_author_5 = ""2800 if len(dissent_holder)==5:2801 dissent_author_1 = dissent_holder[0].strip()2802 dissent_author_1 = dissent_author_1.strip()2803 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2804 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2805 dissent_author_1 = Capitalize(lastname(dissent_author_1))2806 dissent_author_2 = dissent_holder[1].strip()2807 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2808 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2809 dissent_author_2 = Capitalize(lastname(dissent_author_2))2810 dissent_author_3 = dissent_holder[2].strip()2811 dissent_author_3 = dissent_author_3.strip()2812 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2813 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2814 dissent_author_3 = Capitalize(lastname(dissent_author_3))2815 dissent_author_4 = dissent_holder[3].strip()2816 dissent_author_4 = dissent_author_4.strip()2817 dissent_author_4 = re.sub("[\xa0]*", "", dissent_author_4)2818 dissent_author_4 = re.sub("\In\spart\)", "", dissent_author_4)2819 dissent_author_4 = Capitalize(lastname(dissent_author_4))2820 dissent_author_5 = dissent_holder[4].strip()2821 dissent_author_5 = dissent_author_5.strip()2822 dissent_author_5 = re.sub("[\xa0]*", "", dissent_author_5)2823 dissent_author_5 = re.sub("\In\s*part\)", "", dissent_author_5)2824 dissent_author_5 = Capitalize(lastname(dissent_author_5))2825 if len(dissent_author_1) < 2:2826 dissent_author_1 = ""2827 if len(dissent_author_2) < 2:2828 dissent_author_2 = ""2829 if len(dissent_author_3) < 2:2830 dissent_author_3 = ""2831 if len(dissent_author_4) < 2:2832 dissent_author_4 = ""2833 if len(dissent_author_5) < 2:2834 dissent_author_5 = ""2835 if dissent_line and dissent==0:2836 dissent=12837 num_dissent=12838 if concur_line and concur==0:2839 concur=12840 num_concur=12841 #Assign vote values for each justice based on dissenting judges values2842 if dissent_author_1 == judge2_ln or dissent_author_2 == judge2_ln or dissent_author_3 == judge2_ln or dissent_author_4 == judge2_ln or dissent_author_5 == judge2_ln and len(judge2_ln) > 0:2843 judge2_vote = 0 #dissent_author_12844 elif dissent_author_1 != judge2_ln and dissent_author_2 != judge2_ln and dissent_author_3 != judge2_ln and dissent_author_4 != judge2_ln and dissent_author_5 != judge2_ln and len(judge2_ln) > 0:2845 judge2_vote = 12846 else:2847 judge2_vote = ""2848 if dissent_author_1 == judge3_ln or dissent_author_2 == judge3_ln or dissent_author_3 == judge3_ln or dissent_author_4 == judge3_ln or dissent_author_5 == judge3_ln and len(judge3_ln) > 0:2849 judge3_vote = 0 #dissent_author_12850 elif dissent_author_1 != judge3_ln and dissent_author_2 != judge3_ln and dissent_author_3 != judge3_ln and dissent_author_4 != judge3_ln and dissent_author_5 != judge3_ln and len(judge3_ln) > 0:2851 judge3_vote = 12852 else:2853 judge3_vote = ""2854 if dissent_author_1 == judge4_ln or dissent_author_2 == judge4_ln or dissent_author_3 == judge4_ln or dissent_author_4 == judge4_ln or dissent_author_5 == judge4_ln and len(judge4_ln) > 0:2855 judge4_vote = 0 #dissent_author_12856 elif dissent_author_1 != judge4_ln and dissent_author_2 != judge4_ln and dissent_author_3 != judge4_ln and dissent_author_4 != judge4_ln and dissent_author_5 != judge4_ln and len(judge4_ln) > 0:2857 judge4_vote = 12858 else:2859 judge4_vote = ""2860 if dissent_author_1 == judge5_ln or dissent_author_2 == judge5_ln or dissent_author_3 == judge5_ln or dissent_author_4 == judge5_ln or dissent_author_5 == judge5_ln and len(judge5_ln) > 0:2861 judge5_vote = 0 #dissent_author_12862 elif dissent_author_1 != judge5_ln and dissent_author_2 != judge5_ln and dissent_author_3 != judge5_ln and dissent_author_4 != judge5_ln and dissent_author_5 != judge5_ln and len(judge5_ln) > 0:2863 judge5_vote = 12864 else:2865 judge5_vote = ""2866 if dissent_author_1 == judge6_ln or dissent_author_2 == judge6_ln or dissent_author_3 == judge6_ln or dissent_author_4 == judge6_ln or dissent_author_5 == judge6_ln and len(judge6_ln) > 0:2867 judge6_vote = 0 #dissent_author_12868 elif dissent_author_1 != judge6_ln and dissent_author_2 != judge6_ln and dissent_author_3 != judge6_ln and dissent_author_4 != judge6_ln and dissent_author_5 != judge6_ln and len(judge6_ln) > 0:2869 judge6_vote = 12870 else:2871 judge6_vote = ""2872 if dissent_author_1 == judge7_ln or dissent_author_2 == judge7_ln or dissent_author_3 == judge7_ln or dissent_author_4 == judge7_ln or dissent_author_5 == judge7_ln and len(judge7_ln) > 0:2873 judge7_vote = 0 #dissent_author_12874 elif dissent_author_1 != judge7_ln and dissent_author_2 != judge7_ln and dissent_author_3 != judge7_ln and dissent_author_4 != judge7_ln and dissent_author_5 != judge7_ln and len(judge7_ln) > 0:2875 judge7_vote = 12876 else:2877 judge7_vote = ""2878 if dissent_author_1 == judge8_ln or dissent_author_2 == judge8_ln or dissent_author_3 == judge8_ln or dissent_author_4 == judge8_ln or dissent_author_5 == judge8_ln and len(judge8_ln) > 0:2879 judge8_vote = 0 #dissent_author_12880 elif dissent_author_1 != judge8_ln and dissent_author_2 != judge8_ln and dissent_author_3 != judge8_ln and dissent_author_4 != judge8_ln and dissent_author_5 != judge8_ln and len(judge8_ln) > 0:2881 judge8_vote = 12882 else:2883 judge8_vote = ""2884 if dissent_author_1 == judge9_ln or dissent_author_2 == judge9_ln or dissent_author_3 == judge9_ln or dissent_author_4 == judge9_ln or dissent_author_5 == judge9_ln and len(judge9_ln) > 0:2885 judge9_vote = 0 #dissent_author_12886 elif dissent_author_1 != judge9_ln and dissent_author_2 != judge9_ln and dissent_author_3 != judge9_ln and dissent_author_4 != judge9_ln and dissent_author_5 != judge9_ln and len(judge9_ln) > 0:2887 judge9_vote = 12888 else:2889 judge9_vote = ""2890 if dissent_author_1 == judge10_ln or dissent_author_2 == judge10_ln or dissent_author_3 == judge10_ln or dissent_author_4 == judge10_ln or dissent_author_5 == judge10_ln and len(judge10_ln) > 0:2891 judge10_vote = 0 #dissent_author_12892 elif dissent_author_1 != judge10_ln and dissent_author_2 != judge10_ln and dissent_author_3 != judge10_ln and dissent_author_4 != judge10_ln and dissent_author_5 != judge10_ln and len(judge10_ln) > 0:2893 judge10_vote = 12894 else:2895 judge10_vote = ""2896 if dissent_author_1 == judge11_ln or dissent_author_2 == judge11_ln or dissent_author_3 == judge11_ln or dissent_author_4 == judge11_ln or dissent_author_5 == judge11_ln and len(judge11_ln) > 0:2897 judge11_vote = 0 #dissent_author_12898 elif dissent_author_1 != judge11_ln and dissent_author_2 != judge11_ln and dissent_author_3 != judge11_ln and dissent_author_4 != judge11_ln and dissent_author_5 != judge11_ln and len(judge11_ln) > 0:2899 judge11_vote = 12900 else:2901 judge11_vote = ""2902 #Remove vote values from columns without judges2903 if judge1_ln == "":2904 judge1_vote = ""2905 if judge2_ln == "":2906 judge2_vote = ""2907 if judge3_ln == "":2908 judge3_vote = ""2909 if judge4_ln == "":2910 judge4_vote = ""2911 if judge5_ln == "":2912 judge5_vote = ""2913 if judge6_ln == "":2914 judge6_vote = ""2915 if judge7_ln == "":2916 judge7_vote = ""2917 if judge8_ln == "":2918 judge8_vote = ""2919 if judge9_ln == "":2920 judge9_vote = ""2921 if judge10_ln == "":2922 judge10_vote = ""2923 if judge11_ln == "":2924 judge11_vote = ""2925 #Remove non-ASCII characters from Lexis citation values2926 Lexis_cite = re.sub("\xa0", "", Lexis_cite)2927 Lexis_cite = re.sub("\xc2", "", Lexis_cite)2928 #Remove duplicate judges from judge last name columns2929 if(judge9_ln == judge2_ln or judge9_ln == judge3_ln or judge9_ln == judge4_ln or judge9_ln == judge5_ln or judge9_ln == judge6_ln or judge9_ln == judge7_ln or judge9_ln == judge8_ln or judge9_ln == judge1_ln):2930 judge9_ln = ""2931 judge9_vote = ""2932 if(judge8_ln == judge2_ln or judge8_ln == judge3_ln or judge8_ln == judge4_ln or judge8_ln == judge5_ln or judge8_ln == judge6_ln or judge8_ln == judge7_ln or judge8_ln == judge9_ln or judge8_ln == judge1_ln):2933 judge8_ln = ""2934 judge8_vote = ""2935 if(judge7_ln == judge2_ln or judge7_ln == judge3_ln or judge7_ln == judge4_ln or judge7_ln == judge5_ln or judge7_ln == judge6_ln or judge7_ln == judge8_ln or judge7_ln == judge9_ln or judge7_ln == judge1_ln):2936 judge7_ln = ""2937 judge7_vote = ""2938 if(judge6_ln == judge2_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln or judge6_ln == judge7_ln or judge6_ln == judge8_ln or judge6_ln == judge9_ln or judge6_ln == judge1_ln):2939 judge6_ln = ""2940 judge6_vote = ""2941 if(judge5_ln == judge2_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln or judge5_ln == judge7_ln or judge5_ln == judge6_ln or judge5_ln == judge8_ln or judge5_ln == judge9_ln or judge5_ln == judge1_ln):2942 judge5_ln = ""2943 judge5_vote = ""2944 if(judge4_ln == judge2_ln or judge4_ln == judge3_ln or judge4_ln == judge7_ln or judge4_ln == judge5_ln or judge4_ln == judge6_ln or judge4_ln == judge8_ln or judge4_ln == judge9_ln or judge4_ln == judge1_ln):2945 judge4_ln = ""2946 judge4_vote = ""2947 if(judge3_ln == judge2_ln or judge3_ln == judge4_ln or judge3_ln == judge7_ln or judge3_ln == judge5_ln or judge3_ln == judge6_ln or judge3_ln == judge8_ln or judge3_ln == judge9_ln or judge3_ln == judge1_ln):2948 judge3_ln = ""2949 judge3_vote = ""2950 if(judge2_ln == judge3_ln or judge2_ln == judge4_ln or judge2_ln == judge7_ln or judge2_ln == judge5_ln or judge2_ln == judge6_ln or judge2_ln == judge8_ln or judge2_ln == judge9_ln or judge2_ln == judge1_ln):2951 judge2_ln = ""2952 judge2_vote = ""2953 if(judge10_ln == judge1_ln or judge10_ln == judge2_ln or judge10_ln == judge3_ln or judge10_ln == judge4_ln or judge10_ln == judge5_ln or judge10_ln == judge6_ln or judge10_ln == judge7_ln or judge10_ln == judge8_ln or judge10_ln == judge9_ln or judge10_ln == judge11_ln):2954 judge10_ln = ""2955 judge10_vote = ""2956 if(judge11_ln == judge1_ln or judge11_ln == judge2_ln or judge11_ln == judge3_ln or judge11_ln == judge4_ln or judge11_ln == judge5_ln or judge11_ln == judge6_ln or judge11_ln == judge7_ln or judge11_ln == judge8_ln or judge11_ln == judge9_ln or judge11_ln == judge10_ln):2957 judge11_ln = ""2958 judge11_vote = ""2959 #Fix vote values for cases where Lexis only reports judges that author a dissenting opinion in the dissent line2960 if(silent_judge1 == judge1_ln and len(silent_judge1) > 0):2961 judge1_vote = 02962 if(silent_judge1 == judge2_ln and len(silent_judge1) > 0):2963 judge2_vote = 02964 if(silent_judge1 == judge3_ln and len(silent_judge1) > 0):2965 judge3_vote = 02966 if(silent_judge1 == judge4_ln and len(silent_judge1) > 0):2967 judge4_vote = 02968 if(silent_judge1 == judge5_ln and len(silent_judge1) > 0):2969 judge5_vote = 02970 if(silent_judge1 == judge6_ln and len(silent_judge1) > 0):2971 judge6_vote = 02972 if(silent_judge1 == judge7_ln and len(silent_judge1) > 0):2973 judge7_vote = 02974 if(silent_judge1 == judge8_ln and len(silent_judge1) > 0):2975 judge8_vote = 02976 if(silent_judge1 == judge9_ln and len(silent_judge1) > 0):2977 judge9_vote = 02978 if(silent_judge2 == judge1_ln and len(silent_judge2) > 0):2979 judge1_vote = 02980 if(silent_judge2 == judge2_ln and len(silent_judge2) > 0):2981 judge2_vote = 02982 if(silent_judge2 == judge3_ln and len(silent_judge2) > 0):2983 judge3_vote = 02984 if(silent_judge2 == judge4_ln and len(silent_judge2) > 0):2985 judge4_vote = 02986 if(silent_judge2 == judge5_ln and len(silent_judge2) > 0):2987 judge5_vote = 02988 if(silent_judge2 == judge6_ln and len(silent_judge2) > 0):2989 judge6_vote = 02990 if(silent_judge2 == judge7_ln and len(silent_judge2) > 0):2991 judge7_vote = 02992 if(silent_judge2 == judge8_ln and len(silent_judge2) > 0):2993 judge8_vote = 02994 if(silent_judge2 == judge9_ln and len(silent_judge2) > 0):2995 judge9_vote = 02996 if(silent_judge3 == judge1_ln and len(silent_judge3) > 0):2997 judge1_vote = 02998 if(silent_judge3 == judge2_ln and len(silent_judge3) > 0):2999 judge2_vote = 03000 if(silent_judge3 == judge3_ln and len(silent_judge3) > 0):3001 judge3_vote = 03002 if(silent_judge3 == judge4_ln and len(silent_judge3) > 0):3003 judge4_vote = 03004 if(silent_judge3 == judge5_ln and len(silent_judge3) > 0):3005 judge5_vote = 03006 if(silent_judge3 == judge6_ln and len(silent_judge3) > 0):3007 judge6_vote = 03008 if(silent_judge3 == judge7_ln and len(silent_judge3) > 0):3009 judge7_vote = 03010 if(silent_judge3 == judge8_ln and len(silent_judge3) > 0):3011 judge8_vote = 03012 if(silent_judge3 == judge9_ln and len(silent_judge3) > 0):3013 judge9_vote = 03014 if(silent_judge4 == judge1_ln and len(silent_judge4) > 0):3015 judge1_vote = 03016 if(silent_judge4 == judge2_ln and len(silent_judge4) > 0):3017 judge2_vote = 03018 if(silent_judge4 == judge3_ln and len(silent_judge4) > 0):3019 judge3_vote = 03020 if(silent_judge4 == judge4_ln and len(silent_judge4) > 0):3021 judge4_vote = 03022 if(silent_judge4 == judge5_ln and len(silent_judge4) > 0):3023 judge5_vote = 03024 if(silent_judge4 == judge6_ln and len(silent_judge4) > 0):3025 judge6_vote = 03026 if(silent_judge4 == judge7_ln and len(silent_judge4) > 0):3027 judge7_vote = 03028 if(silent_judge4 == judge8_ln and len(silent_judge4) > 0):3029 judge8_vote = 03030 if(silent_judge4 == judge9_ln and len(silent_judge4) > 0):3031 judge9_vote = 03032 if(silent_judge5 == judge1_ln and len(silent_judge5) > 0):3033 judge1_vote = 03034 if(silent_judge5 == judge2_ln and len(silent_judge5) > 0):3035 judge2_vote = 03036 if(silent_judge5 == judge3_ln and len(silent_judge5) > 0):3037 judge3_vote = 03038 if(silent_judge5 == judge4_ln and len(silent_judge5) > 0):3039 judge4_vote = 03040 if(silent_judge5 == judge5_ln and len(silent_judge5) > 0):3041 judge5_vote = 03042 if(silent_judge5 == judge6_ln and len(silent_judge5) > 0):3043 judge6_vote = 03044 if(silent_judge5 == judge7_ln and len(silent_judge5) > 0):3045 judge7_vote = 03046 if(silent_judge5 == judge8_ln and len(silent_judge5) > 0):3047 judge8_vote = 03048 if(silent_judge5 == judge9_ln and len(silent_judge5) > 0):3049 judge9_vote = 03050 #Remove duplicate dissenting judge values from dissent columns3051 if dissent_author_5 == dissent_author_1 or dissent_author_5 == dissent_author_2 or dissent_author_5 == dissent_author_3 or dissent_author_5 == dissent_author_4:3052 dissent_author_5 = ""3053 if dissent_author_4 == dissent_author_1 or dissent_author_4 == dissent_author_2 or dissent_author_4 == dissent_author_3:3054 dissent_author_4 = ""3055 if dissent_author_3 == dissent_author_1 or dissent_author_3 == dissent_author_2:3056 dissent_author_3 = ""3057 if dissent_author_2 == dissent_author_1:3058 dissent_author_2 = ""3059 # Remove instances of "Jr" and "Sr" so that the masterfile will match correctly3060 if judge1_ln == "Jr|Sr":3061 judge1_ln = ""3062 if judge2_ln == "Jr|Sr":3063 judge2_ln = ""3064 if judge3_ln == "Jr|Sr":3065 judge3_ln = ""3066 if judge4_ln == "Jr|Sr":3067 judge4_ln = ""3068 if judge5_ln == "Jr|Sr":3069 judge5_ln = ""3070 if judge6_ln == "Jr|Sr":3071 judge6_ln = ""3072 if judge7_ln == "Jr|Sr":3073 judge7_ln = ""3074 if judge8_ln == "Jr|Sr":3075 judge8_ln = ""3076 if judge9_ln == "Jr|Sr":3077 judge9_ln = ""3078 if judge10_ln == "Jr|Sr":3079 judge10_ln = ""3080 if judge11_ln == "Jr|Sr":3081 judge11_ln = ""3082 #Move judges and votes to the left to fix blank cells3083 if judge1_ln == "" or len(judge1_ln) < 2:3084 judge1_ln = judge2_ln3085 judge1_vote = judge2_vote3086 judge2_ln = judge3_ln3087 judge2_vote = judge3_vote3088 judge3_ln = judge4_ln3089 judge3_vote = judge4_vote3090 judge4_ln = judge5_ln3091 judge4_vote = judge5_vote3092 judge5_ln = judge6_ln3093 judge5_vote = judge6_vote3094 judge6_ln = judge7_ln3095 judge6_vote = judge7_vote3096 judge7_ln = judge8_ln3097 judge7_vote = judge8_vote3098 judge8_ln = judge9_ln3099 judge8_vote = judge9_vote3100 judge9_ln = judge10_ln3101 judge9_vote = judge10_vote3102 judge10_ln = judge11_ln3103 judge10_vote = judge11_vote3104 if judge1_ln == "" or len(judge1_ln) < 2:3105 judge1_ln = judge2_ln3106 judge1_vote = judge2_vote3107 judge2_ln = judge3_ln3108 judge2_vote = judge3_vote3109 judge3_ln = judge4_ln3110 judge3_vote = judge4_vote3111 judge4_ln = judge5_ln3112 judge4_vote = judge5_vote3113 judge5_ln = judge6_ln3114 judge5_vote = judge6_vote3115 judge6_ln = judge7_ln3116 judge6_vote = judge7_vote3117 judge7_ln = judge8_ln3118 judge7_vote = judge8_vote3119 judge8_ln = judge9_ln3120 judge8_vote = judge9_vote3121 judge9_ln = judge10_ln3122 judge9_vote = judge10_vote3123 judge10_ln = judge11_ln3124 judge10_vote = judge11_vote3125 if judge1_ln == "" or len(judge1_ln) < 2:3126 judge1_ln = judge2_ln3127 judge1_vote = judge2_vote3128 judge2_ln = judge3_ln3129 judge2_vote = judge3_vote3130 judge3_ln = judge4_ln3131 judge3_vote = judge4_vote3132 judge4_ln = judge5_ln3133 judge4_vote = judge5_vote3134 judge5_ln = judge6_ln3135 judge5_vote = judge6_vote3136 judge6_ln = judge7_ln3137 judge6_vote = judge7_vote3138 judge7_ln = judge8_ln3139 judge7_vote = judge8_vote3140 judge8_ln = judge9_ln3141 judge8_vote = judge9_vote3142 judge9_ln = judge10_ln3143 judge9_vote = judge10_vote3144 judge10_ln = judge11_ln3145 judge10_vote = judge11_vote3146 if judge2_ln == "" or len(judge2_ln) < 2:3147 judge2_ln = judge3_ln3148 judge2_vote = judge3_vote3149 judge3_ln = judge4_ln3150 judge3_vote = judge4_vote3151 judge4_ln = judge5_ln3152 judge4_vote = judge5_vote3153 judge5_ln = judge6_ln3154 judge5_vote = judge6_vote3155 judge6_ln = judge7_ln3156 judge6_vote = judge7_vote3157 judge7_ln = judge8_ln3158 judge7_vote = judge8_vote3159 judge8_ln = judge9_ln3160 judge8_vote = judge9_vote3161 judge9_ln = judge10_ln3162 judge9_vote = judge10_vote3163 judge10_ln = judge11_ln3164 judge10_vote = judge11_vote3165 if judge2_ln == "" or len(judge2_ln) < 2:3166 judge2_ln = judge3_ln3167 judge2_vote = judge3_vote3168 judge3_ln = judge4_ln3169 judge3_vote = judge4_vote3170 judge4_ln = judge5_ln3171 judge4_vote = judge5_vote3172 judge5_ln = judge6_ln3173 judge5_vote = judge6_vote3174 judge6_ln = judge7_ln3175 judge6_vote = judge7_vote3176 judge7_ln = judge8_ln3177 judge7_vote = judge8_vote3178 judge8_ln = judge9_ln3179 judge8_vote = judge9_vote3180 judge9_ln = judge10_ln3181 judge9_vote = judge10_vote3182 judge10_ln = judge11_ln3183 judge10_vote = judge11_vote3184 if judge2_ln == "" or len(judge2_ln) < 2:3185 judge2_ln = judge3_ln3186 judge2_vote = judge3_vote3187 judge3_ln = judge4_ln3188 judge3_vote = judge4_vote3189 judge4_ln = judge5_ln3190 judge4_vote = judge5_vote3191 judge5_ln = judge6_ln3192 judge5_vote = judge6_vote3193 judge6_ln = judge7_ln3194 judge6_vote = judge7_vote3195 judge7_ln = judge8_ln3196 judge7_vote = judge8_vote3197 judge8_ln = judge9_ln3198 judge8_vote = judge9_vote3199 judge9_ln = judge10_ln3200 judge9_vote = judge10_vote3201 judge10_ln = judge11_ln3202 judge10_vote = judge11_vote3203 if judge3_ln == "" or len(judge3_ln) < 2:3204 judge3_ln = judge4_ln3205 judge3_vote = judge4_vote3206 judge4_ln = judge5_ln3207 judge4_vote = judge5_vote3208 judge5_ln = judge6_ln3209 judge5_vote = judge6_vote3210 judge6_ln = judge7_ln3211 judge6_vote = judge7_vote3212 judge7_ln = judge8_ln3213 judge7_vote = judge8_vote3214 judge8_ln = judge9_ln3215 judge8_vote = judge9_vote3216 judge9_ln = judge10_ln3217 judge9_vote = judge10_vote3218 judge10_ln = judge11_ln3219 judge10_vote = judge11_vote3220 if judge3_ln == "" or len(judge3_ln) < 2:3221 judge3_ln = judge4_ln3222 judge3_vote = judge4_vote3223 judge4_ln = judge5_ln3224 judge4_vote = judge5_vote3225 judge5_ln = judge6_ln3226 judge5_vote = judge6_vote3227 judge6_ln = judge7_ln3228 judge6_vote = judge7_vote3229 judge7_ln = judge8_ln3230 judge7_vote = judge8_vote3231 judge8_ln = judge9_ln3232 judge8_vote = judge9_vote3233 judge9_ln = judge10_ln3234 judge9_vote = judge10_vote3235 judge10_ln = judge11_ln3236 judge10_vote = judge11_vote3237 if judge3_ln == "" or len(judge3_ln) < 2:3238 judge3_ln = judge4_ln3239 judge3_vote = judge4_vote3240 judge4_ln = judge5_ln3241 judge4_vote = judge5_vote3242 judge5_ln = judge6_ln3243 judge5_vote = judge6_vote3244 judge6_ln = judge7_ln3245 judge6_vote = judge7_vote3246 judge7_ln = judge8_ln3247 judge7_vote = judge8_vote3248 judge8_ln = judge9_ln3249 judge8_vote = judge9_vote3250 judge9_ln = judge10_ln3251 judge9_vote = judge10_vote3252 judge10_ln = judge11_ln3253 judge10_vote = judge11_vote3254 if judge4_ln == "" or len(judge4_ln) < 2:3255 judge4_ln = judge5_ln3256 judge4_vote = judge5_vote3257 judge5_ln = judge6_ln3258 judge5_vote = judge6_vote3259 judge6_ln = judge7_ln3260 judge6_vote = judge7_vote3261 judge7_ln = judge8_ln3262 judge7_vote = judge8_vote3263 judge8_ln = judge9_ln3264 judge8_vote = judge9_vote3265 judge9_ln = judge10_ln3266 judge9_vote = judge10_vote3267 judge10_ln = judge11_ln3268 judge10_vote = judge11_vote3269 if judge4_ln == "" or len(judge4_ln) < 2:3270 judge4_ln = judge5_ln3271 judge4_vote = judge5_vote3272 judge5_ln = judge6_ln3273 judge5_vote = judge6_vote3274 judge6_ln = judge7_ln3275 judge6_vote = judge7_vote3276 judge7_ln = judge8_ln3277 judge7_vote = judge8_vote3278 judge8_ln = judge9_ln3279 judge8_vote = judge9_vote3280 judge9_ln = judge10_ln3281 judge9_vote = judge10_vote3282 judge10_ln = judge11_ln3283 judge10_vote = judge11_vote3284 if judge4_ln == "" or len(judge4_ln) < 2:3285 judge4_ln = judge5_ln3286 judge4_vote = judge5_vote3287 judge5_ln = judge6_ln3288 judge5_vote = judge6_vote3289 judge6_ln = judge7_ln3290 judge6_vote = judge7_vote3291 judge7_ln = judge8_ln3292 judge7_vote = judge8_vote3293 judge8_ln = judge9_ln3294 judge8_vote = judge9_vote3295 judge9_ln = judge10_ln3296 judge9_vote = judge10_vote3297 judge10_ln = judge11_ln3298 judge10_vote = judge11_vote3299 if judge5_ln == "" or len(judge5_ln) < 2:3300 judge5_ln = judge6_ln3301 judge5_vote = judge6_vote3302 judge6_ln = judge7_ln3303 judge6_vote = judge7_vote3304 judge7_ln = judge8_ln3305 judge7_vote = judge8_vote3306 judge8_ln = judge9_ln3307 judge8_vote = judge9_vote3308 judge9_ln = judge10_ln3309 judge9_vote = judge10_vote3310 judge10_ln = judge11_ln3311 judge10_vote = judge11_vote3312 if judge5_ln == "" or len(judge5_ln) < 2:3313 judge5_ln = judge6_ln3314 judge5_vote = judge6_vote3315 judge6_ln = judge7_ln3316 judge6_vote = judge7_vote3317 judge7_ln = judge8_ln3318 judge7_vote = judge8_vote3319 judge8_ln = judge9_ln3320 judge8_vote = judge9_vote3321 judge9_ln = judge10_ln3322 judge9_vote = judge10_vote3323 judge10_ln = judge11_ln3324 judge10_vote = judge11_vote3325 if judge5_ln == "" or len(judge5_ln) < 2:3326 judge5_ln = judge6_ln3327 judge5_vote = judge6_vote3328 judge6_ln = judge7_ln3329 judge6_vote = judge7_vote3330 judge7_ln = judge8_ln3331 judge7_vote = judge8_vote3332 judge8_ln = judge9_ln3333 judge8_vote = judge9_vote3334 judge9_ln = judge10_ln3335 judge9_vote = judge10_vote3336 judge10_ln = judge11_ln3337 judge10_vote = judge11_vote3338 if judge6_ln == "" or len(judge6_ln) < 2:3339 judge6_ln = judge7_ln3340 judge6_vote = judge7_vote3341 judge7_ln = judge8_ln3342 judge7_vote = judge8_vote3343 judge8_ln = judge9_ln3344 judge8_vote = judge9_vote3345 judge9_ln = judge10_ln3346 judge9_vote = judge10_vote3347 judge10_ln = judge11_ln3348 judge10_vote = judge11_vote3349 if judge6_ln == "" or len(judge6_ln) < 2:3350 judge6_ln = judge7_ln3351 judge6_vote = judge7_vote3352 judge7_ln = judge8_ln3353 judge7_vote = judge8_vote3354 judge8_ln = judge9_ln3355 judge8_vote = judge9_vote3356 judge9_ln = judge10_ln3357 judge9_vote = judge10_vote3358 judge10_ln = judge11_ln3359 judge10_vote = judge11_vote3360 if judge6_ln == "" or len(judge6_ln) < 2:3361 judge6_ln = judge7_ln3362 judge6_vote = judge7_vote3363 judge7_ln = judge8_ln3364 judge7_vote = judge8_vote3365 judge8_ln = judge9_ln3366 judge8_vote = judge9_vote3367 judge9_ln = judge10_ln3368 judge9_vote = judge10_vote3369 judge10_ln = judge11_ln3370 judge10_vote = judge11_vote3371 if judge7_ln == "" or len(judge7_ln) < 2:3372 judge7_ln = judge8_ln3373 judge7_vote = judge8_vote3374 judge8_ln = judge9_ln3375 judge8_vote = judge9_vote3376 judge9_ln = judge10_ln3377 judge9_vote = judge10_vote3378 judge10_ln = judge11_ln3379 judge10_vote = judge11_vote3380 if judge7_ln == "" or len(judge7_ln) < 2:3381 judge7_ln = judge8_ln3382 judge7_vote = judge8_vote3383 judge8_ln = judge9_ln3384 judge8_vote = judge9_vote3385 judge9_ln = judge10_ln3386 judge9_vote = judge10_vote3387 judge10_ln = judge11_ln3388 judge10_vote = judge11_vote3389 if judge7_ln == "" or len(judge7_ln) < 2:3390 judge7_ln = judge8_ln3391 judge7_vote = judge8_vote3392 judge8_ln = judge9_ln3393 judge8_vote = judge9_vote3394 judge9_ln = judge10_ln3395 judge9_vote = judge10_vote3396 judge10_ln = judge11_ln3397 judge10_vote = judge11_vote3398 if judge8_ln == "" or len(judge8_ln) < 2:3399 judge8_ln = judge9_ln3400 judge8_vote = judge9_vote3401 judge9_ln = judge10_ln3402 judge9_vote = judge10_vote3403 judge10_ln = judge11_ln3404 judge10_vote = judge11_vote3405 if judge8_ln == "" or len(judge8_ln) < 2:3406 judge8_ln = judge9_ln3407 judge8_vote = judge9_vote3408 judge9_ln = judge10_ln3409 judge9_vote = judge10_vote3410 judge10_ln = judge11_ln3411 judge10_vote = judge11_vote3412 if judge8_ln == "" or len(judge8_ln) < 2:3413 judge8_ln = judge9_ln3414 judge8_vote = judge9_vote3415 judge9_ln = judge10_ln3416 judge9_vote = judge10_vote3417 judge10_ln = judge11_ln3418 judge10_vote = judge11_vote3419 if judge9_ln == "" or len(judge9_ln) < 2:3420 judge9_ln = judge10_ln3421 judge9_vote = judge10_vote3422 judge10_ln = judge11_ln3423 judge10_vote = judge11_vote3424 if judge9_ln == "" or len(judge9_ln) < 2:3425 judge9_ln = judge10_ln3426 judge9_vote = judge10_vote3427 judge10_ln = judge11_ln3428 judge10_vote = judge11_vote3429 if judge9_ln == "" or len(judge9_ln) < 2:3430 judge9_ln = judge10_ln3431 judge9_vote = judge10_vote3432 judge10_ln = judge11_ln3433 judge10_vote = judge11_vote3434 if judge10_ln == "" or len(judge10_ln) < 2:3435 judge10_ln = judge11_ln3436 judge10_vote = judge11_vote3437 if judge10_ln == "" or len(judge10_ln) < 2:3438 judge10_ln = judge11_ln3439 judge10_vote = judge11_vote3440 if judge10_ln == "" or len(judge10_ln) < 2:3441 judge10_ln = judge11_ln3442 judge10_vote = judge11_vote3443 #Remove duplicate judges from last judge name columns3444 if(judge9_ln == judge2_ln or judge9_ln == judge3_ln or judge9_ln == judge4_ln or judge9_ln == judge5_ln or judge9_ln == judge6_ln or judge9_ln == judge7_ln or judge9_ln == judge8_ln or judge9_ln == judge1_ln):3445 judge9_ln = ""3446 judge9_vote = ""3447 if(judge8_ln == judge2_ln or judge8_ln == judge3_ln or judge8_ln == judge4_ln or judge8_ln == judge5_ln or judge8_ln == judge6_ln or judge8_ln == judge7_ln or judge8_ln == judge9_ln or judge8_ln == judge1_ln):3448 judge8_ln = ""3449 judge8_vote = ""3450 if(judge7_ln == judge2_ln or judge7_ln == judge3_ln or judge7_ln == judge4_ln or judge7_ln == judge5_ln or judge7_ln == judge6_ln or judge7_ln == judge8_ln or judge7_ln == judge9_ln or judge7_ln == judge1_ln):3451 judge7_ln = ""3452 judge7_vote = ""3453 if(judge6_ln == judge2_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln or judge6_ln == judge7_ln or judge6_ln == judge8_ln or judge6_ln == judge9_ln or judge6_ln == judge1_ln):3454 judge6_ln = ""3455 judge6_vote = ""3456 if(judge5_ln == judge2_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln or judge5_ln == judge7_ln or judge5_ln == judge6_ln or judge5_ln == judge8_ln or judge5_ln == judge9_ln or judge5_ln == judge1_ln):3457 judge5_ln = ""3458 judge5_vote = ""3459 if(judge4_ln == judge2_ln or judge4_ln == judge3_ln or judge4_ln == judge7_ln or judge4_ln == judge5_ln or judge4_ln == judge6_ln or judge4_ln == judge8_ln or judge4_ln == judge9_ln or judge4_ln == judge1_ln):3460 judge4_ln = ""3461 judge4_vote = ""3462 if(judge3_ln == judge2_ln or judge3_ln == judge4_ln or judge3_ln == judge7_ln or judge3_ln == judge5_ln or judge3_ln == judge6_ln or judge3_ln == judge8_ln or judge3_ln == judge9_ln or judge3_ln == judge1_ln):3463 judge3_ln = ""3464 judge3_vote = ""3465 if(judge2_ln == judge3_ln or judge2_ln == judge4_ln or judge2_ln == judge7_ln or judge2_ln == judge5_ln or judge2_ln == judge6_ln or judge2_ln == judge8_ln or judge2_ln == judge9_ln or judge2_ln == judge1_ln):3466 judge2_ln = ""3467 judge2_vote = ""3468 if(judge10_ln == judge1_ln or judge10_ln == judge2_ln or judge10_ln == judge3_ln or judge10_ln == judge4_ln or judge10_ln == judge5_ln or judge10_ln == judge6_ln or judge10_ln == judge7_ln or judge10_ln == judge8_ln or judge10_ln == judge9_ln or judge10_ln == judge11_ln):3469 judge10_ln = ""3470 judge10_vote = ""3471 if(judge11_ln == judge1_ln or judge11_ln == judge2_ln or judge11_ln == judge3_ln or judge11_ln == judge4_ln or judge11_ln == judge5_ln or judge11_ln == judge6_ln or judge11_ln == judge7_ln or judge11_ln == judge8_ln or judge11_ln == judge9_ln or judge11_ln == judge10_ln):3472 judge11_ln = ""3473 judge11_vote = ""3474 if (((state_abbr == "AL" or state_abbr == "FL" or panel == 0 or state_abbr == "NH") and state_abbr != "ME" and state_abbr != "MA" and (len(judge6_ln) > 2) or len(judge2_ln) < 2 or len(judge3_ln) < 2 or (len(judge5_ln) < 2 and panel == 0) and len(judge9_ln) < 2) or len(judge1_ln) < 2 and len(judge2_ln) < 2) or state_abbr != "AL" and len(judge7_ln) < 2:3475 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:3476 reader = csv.reader(f)3477 next(f)3478 for row in reader:3479 state = row[0]3480 name = row[3]3481 3482 #start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3483 #end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date() + datetime.timedelta(30)3484 3485 if len(row[4]) == 4 and row[0] != "MC":3486 row[4] = "1/1/" + row[4]3487 if len(row[5]) == 4 and row[0] != "MC":3488 row[5] = "1/1/" + row[5]3489 #print(len(row[4]), row[4])3490 #if len(row[4]) == 8:3491 # start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3492 # end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date() + datetime.timedelta(30)3493 if len(row[4]) != 4 and row[0] != "MC" and state_abbr != "AK" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and (len(judge6_ln) > 2) and len(judge9_ln) < 2 or len(judge3_ln) < 3) or len(judge5_ln) < 2) and state_abbr:3494 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3495 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date() + datetime.timedelta(30)3496 if ((panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and state_abbr != "AK" and ((len(judge6_ln) > 2) or len(judge2_ln) < 2 or len(judge3_ln) < 3 or len(judge5_ln) < 2) and len(judge9_ln) < 2)) and start <= date_format <= end):3497 between = True3498 if ((state == state_abbr) and between and row[2] == "0" and state_abbr != "AK" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and (len(judge6_ln) > 2 or len(judge2_ln) < 2 or len(judge3_ln) < 3 or len(judge5_ln) < 2) and len(judge9_ln) < 2))):3499 if non_panel_judge_string == "":3500 non_panel_judge_string = non_panel_judge_string + Capitalize(lastname(row[3]))3501 else:3502 non_panel_judge_string = non_panel_judge_string + "," + Capitalize(lastname(row[3]))3503 if state == state_abbr and row[2] == "0" and len(judge1_ln) < 2 and len(judge2_ln) < 2 and start <= date_format <= end:3504 #print row[3]3505 if non_panel_judge_string == "":3506 non_panel_judge_string = non_panel_judge_string + Capitalize(lastname(row[3]))3507 else:3508 non_panel_judge_string = non_panel_judge_string + "," + Capitalize(lastname(row[3]))3509 #print non_panel_judge_string3510 if row[3] == judge1_ln:3511 judge1_code = row[1]3512 #print judge1_code3513 between = False3514 non_panel_list = non_panel_judge_string.split(",")3515 master.close()3516 judges_AL = non_panel_list3517 if "Jr" in judges_AL:3518 judges_AL.remove('Jr')3519 #judges_AL = list(set(judges_AL))3520 judges_AL.sort()3521 #print judges_AL3522 if judge1_ln in judges_AL:3523 judges_AL.remove(judge1_ln)3524 if judge2_ln in judges_AL:3525 judges_AL.remove(judge2_ln)3526 if judge3_ln in judges_AL:3527 judges_AL.remove(judge3_ln)3528 if judge4_ln in judges_AL:3529 judges_AL.remove(judge4_ln)3530 if judge5_ln in judges_AL:3531 judges_AL.remove(judge5_ln)3532 if judge6_ln in judges_AL:3533 judges_AL.remove(judge6_ln)3534 if judge7_ln in judges_AL:3535 judges_AL.remove(judge7_ln)3536 if judge8_ln in judges_AL:3537 judges_AL.remove(judge8_ln)3538 if judge_np1 in judges_AL:3539 judges_AL.remove(judge_np1)3540 if judge_np2 in judges_AL:3541 judges_AL.remove(judge_np2)3542 if judge_np3 in judges_AL:3543 judges_AL.remove(judge_np3)3544 if judge_np4 in judges_AL:3545 judges_AL.remove(judge_np4)3546 judges_AL = list(set(judges_AL))3547 if len(judge1_ln) < 2 and len(judge2_ln) < 2 and len(judges_AL) > 0:3548 judge1_ln = judges_AL[0]3549 judge2_ln = judges_AL[1]3550 judge1_vote = 13551 judge2_vote = 13552 if len(judge3_ln) < 2 and len(judges_AL) > 2:3553 judge3_ln = judges_AL[2]3554 judge3_vote = 13555 if len(judge4_ln) < 2 and len(judges_AL) > 3:3556 judge4_ln = judges_AL[3]3557 judge4_vote = 13558 if len(judge5_ln) < 2 and len(judges_AL) > 4:3559 judge5_ln = judges_AL[4]3560 judge5_vote = 13561 if len(judge6_ln) < 2 and len(judges_AL) > 5:3562 judge6_ln = judges_AL[5]3563 judge6_vote = 13564 if len(judge7_ln) < 2 and len(judges_AL) > 6:3565 judge7_ln = judges_AL[6]3566 judge7_vote = 13567 #print judge7_ln3568 if len(judge8_ln) < 2 and len(judges_AL) > 7:3569 judge8_ln = judges_AL[7]3570 judge8_vote = 13571 if len(judge9_ln) < 2 and len(judges_AL) > 8:3572 judge9_ln = judges_AL[8]3573 judge9_vote = 13574 if len(judge2_ln) < 2 and len(judges_AL) > 0:3575 judge2_ln = judges_AL[0]3576 judge2_vote = 13577 if len(judge3_ln) < 2 and len(judges_AL) > 1:3578 judge3_ln = judges_AL[1]3579 judge3_vote = 13580 if len(judge4_ln) < 2 and len(judges_AL) > 2:3581 judge4_ln = judges_AL[2]3582 judge4_vote = 13583 if len(judge5_ln) < 2 and len(judges_AL) > 3:3584 judge5_ln = judges_AL[3]3585 judge5_vote = 13586 if len(judge6_ln) < 2 and len(judges_AL) > 4:3587 judge6_ln = judges_AL[4]3588 judge6_vote = 13589 if len(judge7_ln) < 2 and len(judges_AL) > 5:3590 judge7_ln = judges_AL[5]3591 judge7_vote = 13592 if len(judge8_ln) < 2 and len(judges_AL) > 6:3593 judge8_ln = judges_AL[6]3594 judge8_vote = 13595 if len(judge9_ln) < 2 and len(judges_AL) > 7:3596 judge9_ln = judges_AL[7]3597 judge9_vote = 13598 if len(judge3_ln) < 2 and len(judges_AL) > 0:3599 judge3_ln = judges_AL[0]3600 judge3_vote = 13601 if len(judge4_ln) < 2 and panel == 0 and len(judges_AL) > 1:3602 judge4_ln = judges_AL[1]3603 judge4_vote = 13604 if len(judge5_ln) < 2 and panel == 0 and len(judges_AL) > 2:3605 judge5_ln = judges_AL[2]3606 judge5_vote = 13607 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 3:3608 judge6_ln = judges_AL[3]3609 judge6_vote = 13610 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 4:3611 judge7_ln = judges_AL[4]3612 judge7_vote = 13613 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 5:3614 judge8_ln = judges_AL[5]3615 judge8_vote = 13616 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 6:3617 judge9_ln = judges_AL[6]3618 judge9_vote = 13619 if len(judge4_ln) < 2 and len(judges_AL) > 0 and panel == 0:3620 judge4_ln = judges_AL[0]3621 judge4_vote = 13622 if len(judge5_ln) < 2 and panel == 0 and len(judges_AL) > 1:3623 judge5_ln = judges_AL[1]3624 judge5_vote = 13625 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 2:3626 judge6_ln = judges_AL[2]3627 judge6_vote = 13628 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 3:3629 judge7_ln = judges_AL[3]3630 judge7_vote = 13631 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 4:3632 judge8_ln = judges_AL[4]3633 judge8_vote = 13634 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 5:3635 judge9_ln = judges_AL[5]3636 judge9_vote = 13637 if len(judge5_ln) < 2 and len(judges_AL) > 0 and panel == 0:3638 judge5_ln = judges_AL[0]3639 judge5_vote = 13640 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 1:3641 judge6_ln = judges_AL[1]3642 judge6_vote = 13643 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 2:3644 judge7_ln = judges_AL[2]3645 judge7_vote = 13646 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 3:3647 judge8_ln = judges_AL[3]3648 judge8_vote = 13649 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 4:3650 judge9_ln = judges_AL[4]3651 judge9_vote = 13652 if len(judge6_ln) < 2 and len(judges_AL) > 0 and panel == 0:3653 judge6_ln = judges_AL[0]3654 judge6_vote = 13655 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 1:3656 judge7_ln = judges_AL[1]3657 judge7_vote = 13658 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 2:3659 judge8_ln = judges_AL[2]3660 judge8_vote = 13661 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 3:3662 judge9_ln = judges_AL[3]3663 judge9_vote = 13664 if len(judge7_ln) < 2 and len(judges_AL) > 0 and panel == 0:3665 judge7_ln = judges_AL[0]3666 judge7_vote = 13667 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 1:3668 judge8_ln = judges_AL[1]3669 judge8_vote = 13670 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 2:3671 judge9_ln = judges_AL[2]3672 judge9_vote = 13673 if len(judge8_ln) < 2 and len(judges_AL) > 0 and panel == 0:3674 judge8_ln = judges_AL[0]3675 judge8_vote = 13676 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 1:3677 judge9_ln = judges_AL[1]3678 judge9_vote = 13679 if len(judge9_ln) < 2 and len(judges_AL) > 0 and panel == 0:3680 judge9_ln = judges_AL[0]3681 judge9_vote = 13682 if len(judge2_ln) < 2 and len(judge1_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "NC" and state_abbr != "PA" and state_abbr != "RI" and state_abbr != "WV" and state_abbr != "WI" and state_abbr != "WY" and state_abbr != "AR" and state_abbr != "CO" and state_abbr != "GA" and state_abbr != "HI" and state_abbr != "MS" and state_abbr != "MO" and state_abbr != "MN":3683 judge2_ln = judges_AL[0]3684 judge3_ln = judges_AL[1]3685 judge4_ln = judges_AL[2]3686 judge5_ln = judges_AL[3]3687 judge6_ln = judges_AL[4]3688 judge7_ln = judges_AL[5]3689 judge2_vote = 13690 judge3_vote = 13691 judge4_vote = 13692 judge5_vote = 13693 judge6_vote = 13694 judge7_vote = 13695 if len(judge2_ln) < 2 and len(judge1_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "WV":3696 judge2_ln = judges_AL[0]3697 judge3_ln = judges_AL[1]3698 judge4_ln = judges_AL[2]3699 judge5_ln = judges_AL[3]3700 judge2_vote = 13701 judge3_vote = 13702 judge4_vote = 13703 judge5_vote = 13704 if len(judge3_ln) < 2 and len(judge1_ln) > 2 and len(judge2_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "NJ" and state_abbr != "NY" and state_abbr != "WV" and state_abbr != "AR" and state_abbr != "CO" and state_abbr != "GA" and state_abbr != "HI" and state_abbr != "MS" and state_abbr != "MO":3705 judge3_ln = judges_AL[1]3706 judge4_ln = judges_AL[2]3707 judge5_ln = judges_AL[3]3708 judge6_ln = judges_AL[4]3709 judge3_vote = 13710 judge4_vote = 13711 judge5_vote = 13712 judge6_vote = 13713 else:3714 if len(judges_AL) >= 1 and len(judge6_ln) < 2 and state_abbr != "NH":3715 judge6_ln = judges_AL[0]3716 judge6_vote = 13717 del judges_AL[0]3718 if len(judges_AL) >= 1 and len(judge7_ln) < 2 and len(judge6_ln) > 2 and state_abbr != "NH":3719 judge7_ln = judges_AL[0]3720 judge7_vote = 13721 del judges_AL[0]3722 if len(judges_AL) >= 1 and len(judge8_ln) < 2 and len(judge7_ln) > 2 and state_abbr != "NH":3723 judge8_ln = judges_AL[0]3724 judge8_vote = 13725 del judges_AL[0]3726 if len(judges_AL) >= 1 and len(judge9_ln) < 2 and len(judge8_ln) > 2 and state_abbr != "NH":3727 judge9_ln = judges_AL[0]3728 judge9_vote = 13729 del judges_AL[0]3730 if len(judges_AL) >= 1 and len(judge6_ln) < 2 and state_abbr != "NH":3731 judge6_ln = judges_AL[0]3732 judge6_vote = 13733 del judges_AL[0]3734 if len(judges_AL) >= 1 and len(judge7_ln) < 2 and len(judge6_ln) > 2 and state_abbr != "NH":3735 judge7_ln = judges_AL[0]3736 judge7_vote = 13737 del judges_AL[0]3738 if len(judges_AL) >= 1 and len(judge8_ln) < 2 and len(judge7_ln) > 2 and state_abbr != "NH":3739 judge8_ln = judges_AL[0]3740 judge8_vote = 13741 del judges_AL[0]3742 if len(judges_AL) >= 1 and len(judge9_ln) < 2 and len(judge8_ln) > 2 and state_abbr != "NH":3743 judge9_ln = judges_AL[0]3744 judge9_vote = 13745 del judges_AL[0]3746 #Move over dissenting judges to remove blank cells3747 if(dissent_author_1 == ""):3748 dissent_author_1 = dissent_author_23749 dissent_author_2 = dissent_author_33750 dissent_author_3 = dissent_author_43751 dissent_author_4 = dissent_author_53752 if(dissent_author_2 == ""):3753 dissent_author_2 = dissent_author_33754 dissent_author_3 = dissent_author_43755 dissent_author_4 = dissent_author_53756 if(dissent_author_3 == ""):3757 dissent_author_3 = dissent_author_43758 dissent_author_4 = dissent_author_53759 if(dissent_author_4 == ""):3760 dissent_author_4 = dissent_author_53761 #Remove remaining duplicate dissenting authors3762 if dissent_author_5 == dissent_author_1 or dissent_author_5 == dissent_author_2 or dissent_author_5 == dissent_author_3 or dissent_author_5 == dissent_author_4:3763 dissent_author_5 = ""3764 if dissent_author_4 == dissent_author_1 or dissent_author_4 == dissent_author_2 or dissent_author_4 == dissent_author_3:3765 dissent_author_4 = ""3766 if dissent_author_3 == dissent_author_1 or dissent_author_3 == dissent_author_2:3767 dissent_author_3 = ""3768 if dissent_author_2 == dissent_author_1:3769 dissent_author_2 = ""3770 #Correct dissent_no3771 if dissent_author_1 != "":3772 num_dissent = 13773 if dissent_author_2 != "":3774 num_dissent = 23775 if dissent_author_3 != "":3776 num_dissent = 33777 if dissent_author_4 != "":3778 num_dissent = 43779 if dissent_author_5 != "":3780 num_dissent = 53781 if len(dissent_author_1) < 2:3782 num_dissent = 03783 # Pull in judge codes from state master file by matching state abbrevation, justice name, and time in office3784 if judge1_code == "":3785 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:3786 reader = csv.reader(f)3787 next(f)3788 for row in reader:3789 state = row[0]3790 name = row[3]3791 if len(row[4]) == 4 and row[0] != "MC":3792 row[4] = "1/1/" + row[4]3793 if len(row[5]) == 4 and row[0] != "MC":3794 row[5] = "1/1/" + row[5]3795 if len(row[4]) != 4 and row[0] != "MC":3796 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3797 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date()3798 #Format justice last names from each file to ensure accurate matching3799 if (Capitalize(lastname(row[7])) == Capitalize(judge1_ln) or Capitalize(lastname(row[3])) == Capitalize(judge1_ln)) and judge1_code == "" and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge1_ln) > 1 and start <= date_format <= (end + one_month):3800 judge1_code = row[1]3801 if (Capitalize(lastname(row[7])) == Capitalize(judge2_ln) or Capitalize(lastname(row[3])) == Capitalize(judge2_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge2_ln) > 1 and start <= date_format <= (end + one_month):3802 judge2_code = row[1]3803 if (Capitalize(lastname(row[7])) == Capitalize(judge3_ln) or Capitalize(lastname(row[3])) == Capitalize(judge3_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge3_ln) > 1 and start <= date_format <= (end + one_month):3804 judge3_code = row[1]3805 if (Capitalize(lastname(row[7])) == Capitalize(judge4_ln) or Capitalize(lastname(row[3])) == Capitalize(judge4_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge4_ln) > 1 and start <= date_format <= (end + one_month):3806 judge4_code = row[1]3807 if (Capitalize(lastname(row[7])) == Capitalize(judge5_ln) or Capitalize(lastname(row[3])) == Capitalize(judge5_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge5_ln) > 1 and start <= date_format <= (end + one_month):3808 judge5_code = row[1]3809 if (Capitalize(lastname(row[7])) == Capitalize(judge6_ln) or Capitalize(lastname(row[3])) == Capitalize(judge6_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge6_ln) > 1 and start <= date_format <= (end + one_month):3810 judge6_code = row[1]3811 if (Capitalize(lastname(row[7])) == Capitalize(judge7_ln) or Capitalize(lastname(row[3])) == Capitalize(judge7_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge7_ln) > 1 and start <= date_format <= (end + one_month):3812 judge7_code = row[1]3813 if (Capitalize(lastname(row[7])) == Capitalize(judge8_ln) or Capitalize(lastname(row[3])) == Capitalize(judge8_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge8_ln) > 1 and start <= date_format <= (end + one_month):3814 judge8_code = row[1]3815 if (Capitalize(lastname(row[7])) == Capitalize(judge9_ln) or Capitalize(lastname(row[3])) == Capitalize(judge9_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge9_ln) > 1 and start <= date_format <= (end + one_month):3816 judge9_code = row[1]3817 if (Capitalize(lastname(row[7])) == Capitalize(judge10_ln) or Capitalize(lastname(row[3])) == Capitalize(judge10_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge10_ln) > 1 and start <= date_format <= (end + one_month):3818 judge10_code = row[1]3819 if (Capitalize(lastname(row[7])) == Capitalize(judge11_ln) or Capitalize(lastname(row[3])) == Capitalize(judge11_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge11_ln) > 1 and start <= date_format <= (end + one_month):3820 judge11_code = row[1]3821 # Store "Did not match" if a justice did not match to a justice code3822 if judge1_code == "" and len(judge1_ln) > 2:3823 judge1_code = "Did not match"3824 if judge2_code == "" and len(judge2_ln) > 2:3825 judge2_code = "Did not match"3826 if judge3_code == "" and len(judge3_ln) > 2:3827 judge3_code = "Did not match"3828 if judge4_code == "" and len(judge4_ln) > 2:3829 judge4_code = "Did not match"3830 if judge5_code == "" and len(judge5_ln) > 2:3831 judge5_code = "Did not match"3832 if judge6_code == "" and len(judge6_ln) > 2:3833 judge6_code = "Did not match"3834 if judge7_code == "" and len(judge7_ln) > 2:3835 judge7_code = "Did not match"3836 if judge8_code == "" and len(judge8_ln) > 2:3837 judge8_code = "Did not match"3838 if judge9_code == "" and len(judge9_ln) > 2:3839 judge9_code = "Did not match"3840 if judge10_code == "" and len(judge10_ln) > 2:3841 judge10_code = "Did not match"3842 if judge11_code == "" and len(judge11_ln) > 2:3843 judge11_code = "Did not match"3844 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln3845 if (judge1_ln == judge_np1 or judge1_ln == judge_np2 or judge1_ln == judge_np3 or judge1_ln == judge_np4):3846 judge1_ln = ""3847 judge1_vote = ""3848 judge1_code = ""3849 if (judge2_ln == judge_np1 or judge2_ln == judge_np2 or judge2_ln == judge_np3 or judge2_ln == judge_np4):3850 judge2_ln = ""3851 judge2_vote = ""3852 judge2_code = ""3853 if (judge3_ln == judge_np1 or judge3_ln == judge_np2 or judge3_ln == judge_np3 or judge3_ln == judge_np4):3854 judge3_ln = ""3855 judge3_vote = ""3856 judge3_code = ""3857 if (judge4_ln == judge_np1 or judge4_ln == judge_np2 or judge4_ln == judge_np3 or judge4_ln == judge_np4):3858 judge4_ln = ""3859 judge4_vote = ""3860 judge4_code = ""3861 if (judge5_ln == judge_np1 or judge5_ln == judge_np2 or judge5_ln == judge_np3 or judge5_ln == judge_np4):3862 judge5_ln = ""3863 judge5_vote = ""3864 judge5_code = ""3865 if (judge6_ln == judge_np1 or judge6_ln == judge_np2 or judge6_ln == judge_np3 or judge6_ln == judge_np4):3866 judge6_ln = ""3867 judge6_vote = ""3868 judge6_code = ""3869 if (judge7_ln == judge_np1 or judge7_ln == judge_np2 or judge7_ln == judge_np3 or judge7_ln == judge_np4):3870 judge7_ln = ""3871 judge7_vote = ""3872 judge7_code = ""3873 if (judge8_ln == judge_np1 or judge8_ln == judge_np2 or judge8_ln == judge_np3 or judge8_ln == judge_np4):3874 judge8_ln = ""3875 judge8_vote = ""3876 judge8_code = ""3877 if (judge9_ln == judge_np1 or judge9_ln == judge_np2 or judge9_ln == judge_np3 or judge9_ln == judge_np4):3878 judge9_ln = ""3879 judge9_vote = ""3880 judge9_code = ""3881 if (judge10_ln == judge_np1 or judge10_ln == judge_np2 or judge10_ln == judge_np3 or judge10_ln == judge_np4):3882 judge10_ln = ""3883 judge10_vote = ""3884 judge10_code = ""3885 if (judge11_ln == judge_np1 or judge11_ln == judge_np2 or judge11_ln == judge_np3 or judge11_ln == judge_np4 ):3886 judge11_ln = ""3887 judge11_vote = ""3888 judge11_code = ""3889 if judge5_ln == judge2_ln or judge5_ln == judge1_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln:3890 judge5_ln = ""3891 judge5_vote = ""3892 judge5_code = ""3893 if judge6_ln == judge2_ln or judge6_ln == judge1_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln:3894 judge6_ln = ""3895 judge6_vote = ""3896 judge6_code = ""3897 if len(judge10_ln) < 2:3898 judge10_ln = judge11_ln3899 judge10_vote = judge11_vote3900 judge10_code = judge11_code3901 judge11_ln = ""3902 judge11_vote = ""3903 judge11_code = ""3904 if len(judge7_ln) < 2:3905 judge7_ln = judge8_ln3906 judge7_vote = judge8_vote3907 judge7_code = judge8_code3908 judge8_ln = judge9_ln3909 judge8_vote = judge9_vote3910 judge8_code = judge9_code3911 judge9_ln = judge10_ln3912 judge9_vote = judge10_vote3913 judge9_code = judge10_code3914 judge10_ln = judge11_ln3915 judge10_vote = judge11_vote3916 judge10_code = judge11_code3917 #Correct participating judges string3918 part_judges = judge1_ln + ", " + judge2_ln + ", " + judge3_ln + ", " + judge4_ln + ", " + judge5_ln + ", " + judge6_ln + ", " + judge7_ln + ", " + judge8_ln + ", " + judge9_ln + ", " + judge10_ln + ", " + judge11_ln3919 part_judges = re.sub(' ,', '', part_judges)3920 part_judges = part_judges.rstrip(', ').upper()3921 #print(part_judges)3922 judge1_ln = judge1_ln.upper()3923 judge2_ln = judge2_ln.upper()3924 judge3_ln = judge3_ln.upper()3925 judge4_ln = judge4_ln.upper()3926 judge5_ln = judge5_ln.upper()3927 judge6_ln = judge6_ln.upper()3928 judge7_ln = judge7_ln.upper()3929 judge8_ln = judge8_ln.upper()3930 judge9_ln = judge9_ln.upper()3931 judge10_ln = judge10_ln.upper()3932 judge11_ln = judge11_ln.upper()3933 if judge5_ln == judge2_ln or judge5_ln == judge1_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln:3934 judge5_ln = ""3935 judge5_vote = ""3936 judge5_code = ""3937 if judge6_ln == judge2_ln or judge6_ln == judge1_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln:3938 judge6_ln = ""3939 judge6_vote = ""3940 judge6_code = ""3941 if judge2_ln == judge6_ln:3942 judge6_ln = ""3943 judge6_vote = ""3944 judge6_code = ""3945 if len(judge4_ln) < 2:3946 judge4_ln = judge5_ln3947 judge5_ln = judge6_ln3948 judge6_ln = judge7_ln3949 judge7_ln = judge8_ln3950 judge8_ln = judge9_ln3951 judge9_ln = judge10_ln3952 judge4_vote = judge5_vote3953 judge5_vote = judge6_vote3954 judge6_vote = judge7_vote3955 judge7_vote = judge8_vote3956 judge8_vote = judge9_vote3957 judge9_vote = judge10_vote3958 judge4_code = judge5_code3959 judge5_code = judge6_code3960 judge6_code = judge7_code3961 judge7_code = judge8_code3962 judge8_code = judge9_code3963 judge9_code = judge10_code3964 if len(judge4_ln) < 2:3965 judge4_ln = judge5_ln3966 judge5_ln = judge6_ln3967 judge6_ln = judge7_ln3968 judge7_ln = judge8_ln3969 judge8_ln = judge9_ln3970 judge9_ln = judge10_ln3971 judge4_vote = judge5_vote3972 judge5_vote = judge6_vote3973 judge6_vote = judge7_vote3974 judge7_vote = judge8_vote3975 judge8_vote = judge9_vote3976 judge9_vote = judge10_vote3977 judge4_code = judge5_code3978 judge5_code = judge6_code3979 judge6_code = judge7_code3980 judge7_code = judge8_code3981 judge8_code = judge9_code3982 judge9_code = judge10_code3983 if len(judge5_ln) < 2:3984 judge5_ln = judge6_ln3985 judge6_ln = judge7_ln3986 judge7_ln = judge8_ln3987 judge8_ln = judge9_ln3988 judge9_ln = judge10_ln3989 judge5_vote = judge6_vote3990 judge6_vote = judge7_vote3991 judge7_vote = judge8_vote3992 judge8_vote = judge9_vote3993 judge9_vote = judge10_vote3994 judge5_code = judge6_code3995 judge6_code = judge7_code3996 judge7_code = judge8_code3997 judge8_code = judge9_code3998 judge9_code = judge10_code3999 if len(judge1_ln) < 2:4000 judge1_ln = judge2_ln4001 judge2_ln = judge3_ln4002 judge3_ln = judge4_ln4003 judge4_ln = judge5_ln4004 judge5_ln = judge6_ln4005 judge6_ln = judge7_ln4006 judge7_ln = judge8_ln4007 judge8_ln = judge9_ln4008 judge9_ln = judge10_ln4009 judge1_vote = judge2_vote4010 judge2_vote = judge3_vote4011 judge3_vote = judge4_vote4012 judge4_vote = judge5_vote4013 judge5_vote = judge6_vote4014 judge6_vote = judge7_vote4015 judge7_vote = judge8_vote4016 judge8_vote = judge9_vote4017 judge9_vote = judge10_vote4018 judge1_code = judge2_code4019 judge2_code = judge3_code4020 judge3_code = judge4_code4021 judge4_code = judge5_code4022 judge5_code = judge6_code4023 judge6_code = judge7_code4024 judge7_code = judge8_code4025 judge8_code = judge9_code4026 judge9_code = judge10_code4027 if len(judge3_ln) < 2:4028 judge3_ln = judge4_ln4029 judge4_ln = judge5_ln4030 judge5_ln = judge6_ln4031 judge6_ln = judge7_ln4032 judge7_ln = judge8_ln4033 judge8_ln = judge9_ln4034 judge9_ln = judge10_ln4035 judge3_vote = judge4_vote4036 judge4_vote = judge5_vote4037 judge5_vote = judge6_vote4038 judge6_vote = judge7_vote4039 judge7_vote = judge8_vote4040 judge8_vote = judge9_vote4041 judge9_vote = judge10_vote4042 judge3_code = judge4_code4043 judge4_code = judge5_code4044 judge5_code = judge6_code4045 judge6_code = judge7_code4046 judge7_code = judge8_code4047 judge8_code = judge9_code4048 judge9_code = judge10_code4049 if len(judge5_ln) < 2:4050 judge5_ln = judge6_ln4051 judge6_ln = judge7_ln4052 judge7_ln = judge8_ln4053 judge8_ln = judge9_ln4054 judge9_ln = judge10_ln4055 judge5_vote = judge6_vote4056 judge6_vote = judge7_vote4057 judge7_vote = judge8_vote4058 judge8_vote = judge9_vote4059 judge9_vote = judge10_vote4060 judge5_code = judge6_code4061 judge6_code = judge7_code4062 judge7_code = judge8_code4063 judge8_code = judge9_code4064 judge9_code = judge10_code4065 if judge9_ln == judge8_ln or judge9_ln == judge7_ln or judge9_ln == judge6_ln or judge9_ln == judge5_ln or judge9_ln == judge4_ln or judge9_ln == judge3_ln or judge9_ln == judge2_ln or judge9_ln == judge1_ln:4066 judge9_ln = ""4067 judge9_vote = ""4068 judge9_code = ""4069 if judge8_ln == judge7_ln or judge8_ln == judge6_ln or judge8_ln == judge5_ln or judge8_ln == judge4_ln or judge8_ln == judge3_ln or judge8_ln == judge2_ln or judge8_ln == judge1_ln:4070 judge8_ln = ""4071 judge8_vote = ""4072 judge8_code = ""4073 if judge7_ln == judge6_ln or judge7_ln == judge5_ln or judge7_ln == judge4_ln or judge7_ln == judge3_ln or judge7_ln == judge2_ln or judge7_ln == judge1_ln:4074 judge7_ln = ""4075 judge7_vote = ""4076 judge7_code = ""4077 if judge6_ln == judge2_ln:4078 judge6_ln = ""4079 judge6_vote = ""4080 judge6_code = ""4081 if judge5_ln == judge4_ln:4082 judge5_ln = ""4083 judge5_vote = ""4084 judge5_code = ""4085 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln4086 if len(judge5_ln) < 2:4087 judge5_ln = judge6_ln4088 judge6_ln = judge7_ln4089 judge7_ln = judge8_ln4090 judge8_ln = judge9_ln4091 judge9_ln = judge10_ln4092 judge5_vote = judge6_vote4093 judge6_vote = judge7_vote4094 judge7_vote = judge8_vote4095 judge8_vote = judge9_vote4096 judge9_vote = judge10_vote4097 judge5_code = judge6_code4098 judge6_code = judge7_code4099 judge7_code = judge8_code4100 judge8_code = judge9_code4101 judge9_code = judge10_code4102 if len(judge6_ln) < 2:4103 judge6_ln = judge7_ln4104 judge7_ln = judge8_ln4105 judge8_ln = judge9_ln4106 judge9_ln = judge10_ln4107 judge6_vote = judge7_vote4108 judge7_vote = judge8_vote4109 judge8_vote = judge9_vote4110 judge9_vote = judge10_vote4111 judge6_code = judge7_code4112 judge7_code = judge8_code4113 judge8_code = judge9_code4114 judge9_code = judge10_code4115 if len(judge2_ln) < 2:4116 judge2_ln = judge3_ln4117 judge3_ln = judge4_ln4118 judge4_ln = judge5_ln4119 judge5_ln = judge6_ln4120 judge6_ln = judge7_ln4121 judge7_ln = judge8_ln4122 judge8_ln = judge9_ln4123 judge9_ln = judge10_ln4124 judge2_vote = judge3_vote4125 judge3_vote = judge4_vote4126 judge4_vote = judge5_vote4127 judge5_vote = judge6_vote4128 judge6_vote = judge7_vote4129 judge7_vote = judge8_vote4130 judge8_vote = judge9_vote4131 judge9_vote = judge10_vote4132 judge2_code = judge3_code4133 judge3_code = judge4_code4134 judge4_code = judge5_code4135 judge5_code = judge6_code4136 judge6_code = judge7_code4137 judge7_code = judge8_code4138 judge8_code = judge9_code4139 judge9_code = judge10_code4140 if len(judge1_ln) < 2:4141 judge1_ln = judge2_ln4142 judge2_ln = judge3_ln4143 judge3_ln = judge4_ln4144 judge4_ln = judge5_ln4145 judge5_ln = judge6_ln4146 judge6_ln = judge7_ln4147 judge7_ln = judge8_ln4148 judge8_ln = judge9_ln4149 judge9_ln = judge10_ln4150 judge1_vote = judge2_vote4151 judge2_vote = judge3_vote4152 judge3_vote = judge4_vote4153 judge4_vote = judge5_vote4154 judge5_vote = judge6_vote4155 judge6_vote = judge7_vote4156 judge7_vote = judge8_vote4157 judge8_vote = judge9_vote4158 judge9_vote = judge10_vote4159 judge1_code = judge2_code4160 judge2_code = judge3_code4161 judge3_code = judge4_code4162 judge4_code = judge5_code4163 judge5_code = judge6_code4164 judge6_code = judge7_code4165 judge7_code = judge8_code4166 judge8_code = judge9_code4167 judge9_code = judge10_code4168 if len(judge8_ln) < 2:4169 judge8_ln = judge9_ln4170 judge9_ln = judge10_ln4171 judge10_ln = judge11_ln4172 judge8_vote = judge9_vote4173 judge9_vote = judge10_vote4174 judge10_vote = judge11_vote4175 judge8_code = judge9_code4176 judge9_code = judge10_code4177 judge10_code = judge11_code4178 if len(judge7_ln) < 2:4179 judge7_ln = judge8_ln4180 judge8_ln = judge9_ln4181 judge9_ln = judge10_ln4182 judge10_ln = judge11_ln4183 judge7_vote = judge8_vote4184 judge8_vote = judge9_vote4185 judge9_vote = judge10_vote4186 judge10_vote = judge11_vote4187 judge7_code = judge8_code4188 judge8_code = judge9_code4189 judge9_code = judge10_code4190 judge10_code = judge11_code4191 if judge6_ln == "":4192 judge6_ln = judge7_ln4193 judge7_ln = judge8_ln4194 judge8_ln = judge9_ln4195 judge9_ln = judge10_ln4196 judge6_vote = judge7_vote4197 judge7_vote = judge8_vote4198 judge8_vote = judge9_vote4199 judge9_vote = judge10_vote4200 judge6_code = judge7_code4201 judge7_code = judge8_code4202 judge8_code = judge9_code4203 judge9_code = judge10_code4204 if judge4_ln == "":4205 judge4_ln = judge5_ln4206 judge5_ln = judge6_ln4207 judge6_ln = judge7_ln4208 judge7_ln = judge8_ln4209 judge8_ln = judge9_ln4210 judge9_ln = judge10_ln4211 judge4_vote = judge5_vote4212 judge5_vote = judge6_vote4213 judge6_vote = judge7_vote4214 judge7_vote = judge8_vote4215 judge8_vote = judge9_vote4216 judge9_vote = judge10_vote4217 judge4_code = judge5_code4218 judge5_code = judge6_code4219 judge6_code = judge7_code4220 judge7_code = judge8_code4221 judge8_code = judge9_code4222 judge9_code = judge10_code4223 if judge5_ln == judge4_ln:4224 judge5_ln = judge6_ln4225 judge5_vote = judge6_vote4226 judge5_code = judge6_code4227 judge6_ln = judge7_ln4228 judge6_vote = judge7_vote4229 judge6_code = judge7_code4230 judge7_ln = judge8_ln4231 judge7_vote = judge8_vote4232 judge7_code = judge8_code4233 judge8_ln = judge9_ln4234 judge8_vote = judge9_vote4235 judge8_code = judge9_code4236 judge9_ln = judge10_ln4237 judge9_vote = judge10_vote4238 judge9_code = judge10_code4239 if state_abbr == "CA" or state_abbr == "IL" or state_abbr == "PA" or state_abbr == "FL" or state_abbr == "KY" or state_abbr == "LA" or state_abbr == "ME" or state_abbr == "OH" or state_abbr == "CT" or state_abbr == "MD" or state_abbr == "MI" or state_abbr == "CO" or state_abbr == "GA" or state_abbr == "IA" or state_abbr == "MO" or state_abbr == "NE" or state_abbr == "NJ" or state_abbr == "NY" or state_abbr == "NC" or state_abbr == "OH" or state_abbr == "WI" or state_abbr == "AZ" or state_abbr == "AR" or state_abbr == "MT":4240 judge8_ln = ""4241 judge8_code = ""4242 judge8_vote = ""4243 judge9_ln = ""4244 judge9_code = ""4245 judge9_vote = ""4246 if state_abbr == "ND" or state_abbr == "RI" or state_abbr == "VT" or state_abbr == "SC" or state_abbr == "UT" or state_abbr == "WY" or state_abbr == "HI":4247 judge6_ln = ""4248 judge6_vote = ""4249 judge6_code = ""4250 judge7_ln = ""4251 judge7_vote = ""4252 judge7_code = ""4253 judge8_ln = ""4254 judge8_vote = ""4255 judge8_code = ""4256 if state_abbr == "MS" or state_abbr == "OK-SC" or state_abbr == "WA":4257 judge10_ln = ""4258 judge10_vote = ""4259 judge10_code = ""4260 judge11_ln = ""4261 judge11_vote = ""4262 judge11_code = ""4263 if len(dissent_by_string) > 2:4264 dissent_by_string = dissent_by_string + " " + str(other_dissent_holder)4265 if len(dissent_by_string) < 2:4266 dissent_by_string = dissent_by_string + str(other_dissent_holder)4267 dissent_by_string = re.sub("\[", "", dissent_by_string)4268 dissent_by_string = re.sub("\]", "", dissent_by_string)4269 dissent_by_string = re.sub("'", "", dissent_by_string)4270 if state_abbr == "ID":4271 panel = 04272 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln, judge8_ln, judge9_ln4273 # For each case, write a row to the .csv file which contains the desired variables.4274 localrow = []4275 localrow.append("mjn15@psu.edu")4276 localrow.append(Lexis_cite)4277 localrow.append(entry)4278 localrow.append(court_string)4279 localrow.append(new_date)4280 localrow.append(state_abbr)4281 localrow.append(panel)4282 localrow.append(parties_string)4283 localrow.append(docketnum)4284 localrow.append(cite_string.strip())4285 localrow.append(Lexis_cite.strip())4286 localrow.append(West_cite.strip())4287 localrow.append(attorney_string)4288 localrow.append(part_judges)4289 localrow.append(judges_np)4290 localrow.append(judge1_ln.upper())4291 localrow.append(judge1_vote)4292 localrow.append(judge1_code)4293 localrow.append(judge2_ln.upper())4294 localrow.append(judge2_vote)4295 localrow.append(judge2_code)4296 localrow.append(judge3_ln.upper())4297 localrow.append(judge3_vote)4298 localrow.append(judge3_code)4299 localrow.append(judge4_ln.upper())4300 localrow.append(judge4_vote)4301 localrow.append(judge4_code)4302 localrow.append(judge5_ln.upper())4303 localrow.append(judge5_vote)4304 localrow.append(judge5_code)4305 localrow.append(judge6_ln.upper())4306 localrow.append(judge6_vote)4307 localrow.append(judge6_code)4308 localrow.append(judge7_ln.upper())4309 localrow.append(judge7_vote)4310 localrow.append(judge7_code)4311 localrow.append(judge8_ln.upper())4312 localrow.append(judge8_vote)4313 localrow.append(judge8_code)4314 localrow.append(judge9_ln.upper())4315 localrow.append(judge9_vote)4316 localrow.append(judge9_code)4317 localrow.append(judge10_ln.upper())4318 localrow.append(judge10_vote)4319 localrow.append(judge10_code)4320 localrow.append(judge11_ln.upper())4321 localrow.append(judge11_vote)4322 localrow.append(judge11_code)4323 localrow.append(dissent)4324 localrow.append(num_dissent)4325 localrow.append(dissent_by_string.upper())4326 localrow.append(dissent_author_1.upper())4327 localrow.append(dissent_author_2.upper())4328 localrow.append(dissent_author_3.upper())4329 localrow.append(dissent_author_4.upper())4330 localrow.append(dissent_author_5.upper())4331 localrow.append(concur)4332 localrow.append(num_concur)4333 localrow.append(concur_by_string.upper())4334 localrow.append(check_recuse_case)4335 if check_recuse == False:4336 outfilehandle.writerow(localrow)4337 if check_recuse == True:4338 recuse_handle.writerow(localrow)4339 check_recuse = False4340# Finish writing to the .csv file and close it so the process is complete4341infilehandle.close()4342check.close()4343fout.close()...

Full Screen

Full Screen

state_court_scraper_final_election.py

Source:state_court_scraper_final_election.py Github

copy

Full Screen

1## reads and extracts info from txt files of published opinions from USCOA2## downloaded from LexisNexis3## written for python 2.6.*4##5## modified version of LexisOpinionParse.py by6## Kevin Quinn7## UC Berkeley8## 5/13/20109##10## modifications by11## Rachael Hinkle12## 9/19/201113##14## modified for state courts by15## Michael Nelson16## Summer, 201717import os18import re19import csv20import string21import operator22import datetime23#mydir = "C:/Users/Steve/Dropbox/PSU2018-2019/RA/Scraper/"24mydir = "C:/Users/sum410/Dropbox/PSU2018-2019/RA/Scraper/"25def expandmonth(mstring2):26 mstring2 = re.sub("Jan\.", "January", mstring2)27 mstring2 = re.sub("Feb\.", "February", mstring2)28 mstring2 = re.sub("Mar\.", "March", mstring2)29 mstring2 = re.sub("Apr\.", "April", mstring2)30 mstring2 = re.sub("Aug\.", "August", mstring2)31 mstring2 = re.sub("Sept\.", "September", mstring2)32 mstring2 = re.sub("Oct\.", "October", mstring2)33 mstring2 = re.sub("Nov\.", "November", mstring2)34 mstring2 = re.sub("Dec\.", "December", mstring2)35 return mstring236def month2number(mstring):37 mnumber = -99938 if (mstring == "January"):39 mnumber = "01"40 if (mstring == "February"):41 mnumber = "02"42 if (mstring == "March"):43 mnumber = "03"44 if (mstring == "April"):45 mnumber = "04"46 if (mstring == "May"):47 mnumber = "05"48 if (mstring == "June"):49 mnumber = "06"50 if (mstring == "July"):51 mnumber = "07"52 if (mstring == "August"):53 mnumber = "08"54 if (mstring == "September"):55 mnumber = "09"56 if (mstring == "October"):57 mnumber = "10"58 if (mstring == "November"):59 mnumber = "11"60 if (mstring == "December"):61 mnumber = "12"62 return mnumber63def Capitalize(nstring):64 if(len(nstring) > 1 and not re.match("MC|Mc|Mac|MAC", nstring)): #O'|Van|VAN65 nstring = string.upper(nstring[0]) + string.lower(nstring[1:])66 if(re.match("MC|Mc|mc", nstring)):67 nstring = string.upper(nstring[0]) + string.lower(nstring[1]) + string.upper(nstring[2]) + string.lower(nstring[3:])68 if(re.match("MAC|Mac", nstring)):69 nstring = string.upper(nstring[0]) + string.lower(nstring[1:3]) + string.upper(nstring[3]) + string.lower(nstring[4:])70 if(re.match("MACY|Macy|MacY", nstring)):71 nstring = string.upper(nstring[0]) + string.lower(nstring[1]) + string.upper(nstring[2]) + string.lower(nstring[3:])72 if(re.match("Van\s|VAN\s", nstring)):73 nstring = string.upper(nstring[0]) + string.lower(nstring[1:4]) + string.upper(nstring[4]) + string.lower(nstring[5:])74 if(len(nstring) == 1):75 nstring = string.upper(nstring)76 return nstring77def lastname(nstring):78 last_name = ""79 nstring = re.sub(",", "", nstring)80 nstring = string.strip(nstring)81 nstring = re.sub("BY THE COURT", "", nstring)82 nstring = re.sub("PER CURIAM[;]*", "", nstring)83 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)84 names_holder = re.split("\s", nstring)85 if(len(names_holder) == 1):86 last_name = names_holder[0]87 if(len(names_holder) == 2): #and not re.search(",", nstring)):88 last_name = names_holder[1]89 if(len(names_holder) == 3 and not re.search(",", nstring)):90 last_name = names_holder[2]91 if(len(names_holder) == 3 and re.search(",", nstring)):92 last_name = names_holder[2]93 if(len(names_holder) == 4): #and not re.search(",", nstring)):94 last_name = names_holder[2] + " " + names_holder[3]95 if(len(names_holder) == 4 and re.search(",", nstring)):96 last_name = names_holder[0] + " " + names_holder[1]97 last_name = re.sub(",", "", last_name)98 last_name = re.sub("\.", "", last_name)99 last_name = Capitalize(last_name)100 return last_name101def firstname(nstring):102 first_name = ""103 nstring = nstring.strip()104 nstring = re.sub("BY THE COURT", "", nstring)105 nstring = re.sub("PER CURIAM[;]*", "", nstring)106 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)107 names_holder = re.split("\s", nstring)108 if(len(names_holder) == 2 and not re.search(",", nstring)):109 first_name = names_holder[0]110 if(len(names_holder) == 2 and re.search(",", nstring)):111 first_name = names_holder[1]112 if(len(names_holder) == 3 and not re.search(",", nstring)):113 first_name = names_holder[0]114 if(len(names_holder) == 3 and re.search(",", nstring)):115 first_name = names_holder[1]116 if(len(names_holder) == 4 and not re.search(",", nstring)):117 first_name = names_holder[0]118 if(len(names_holder) == 4 and re.search(",", nstring)):119 first_name = names_holder[2]120 first_name = re.sub(",", "", first_name)121 first_name = Capitalize(first_name)122 return first_name123def middlename(nstring):124 middle_name = ""125 nstring = string.strip(nstring)126 nstring = re.sub("BY THE COURT", "", nstring)127 nstring = re.sub("PER CURIAM[;]*", "", nstring)128 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)129 names_holder = re.split("\s", nstring)130 if(len(names_holder) == 3 and not re.search(",", nstring)):131 middle_name = names_holder[1]132 if(len(names_holder) == 3 and re.search(",", nstring)):133 middle_name = names_holder[2]134 if(len(names_holder) == 4 and not re.search(",", nstring)):135 middle_name = names_holder[1]136 if(len(names_holder) == 4 and re.search(",", nstring)):137 middle_name = names_holder[3]138 middle_name = re.sub(",", "", middle_name)139 middle_name = Capitalize(middle_name)140 return middle_name141def namesuffix(nstring):142 suffix = ""143 nstring = string.strip(nstring)144 nstring = re.sub("BY THE COURT", "", nstring)145 nstring = re.sub("PER CURIAM[;]*", "", nstring)146 if(re.search("Jr\.|JR\.", nstring)):147 suffix = "Jr."148 if(re.search("III", nstring)):149 suffix = "III"150 if(re.search("II", nstring)):151 suffix = "II"152 if(re.search("Sr\.|SR\.", nstring)):153 suffix = "Sr."154 return suffix155def first_sentence(value):156 """ Take just the first sentence of the HTML passed in.157 """158 words = value.split()159 # Collect words until the result is a sentence.160 sentence = ""161 while words:162 if sentence:163 sentence += " "164 sentence += words.pop(0)165 if not re.search(r'[.?!][)"]*$', sentence):166 # End of sentence doesn't end with punctuation.167 continue168 #if words and not re.search(r'^[("]*[A-Z0-9]', words[0]):169 # Next sentence has to start with upper case.170 continue171 if re.search(r'(Mr\.|Mrs\.|Ms\.|Dr\.| [A-Z]\.)$', sentence):172 # If the "sentence" ends with a title or initial, then it probably173 # isn't the end of the sentence.174 continue175 if sentence.count('(') != sentence.count(')'):176 # A sentence has to have balanced parens.177 continue178 if sentence.count('"') % 2:179 # A sentence has to have an even number of quotes.180 continue181 break182 return sentence183def state_ab(value):184 if(re.search("Alabama", value)):185 state_abbr = "AL"186 return state_abbr187 elif (re.search("Alaska", value)):188 state_abbr = "AK"189 return state_abbr190 elif (re.search("Arkansas", value)):191 state_abbr = "AR"192 return state_abbr193 elif (re.search("Arizona", value)):194 state_abbr = "AZ"195 return state_abbr196 elif (re.search("California", value)):197 state_abbr = "CA"198 return state_abbr199 elif (re.search("Colorado", value)):200 state_abbr = "CO"201 return state_abbr202 elif (re.search("Connecticut", value)):203 state_abbr = "CT"204 return state_abbr205 elif (re.search("Delaware", value)):206 state_abbr = "DE"207 return state_abbr208 elif (re.search("Florida", value)):209 state_abbr = "FL"210 return state_abbr211 elif (re.search("Georgia", value)):212 state_abbr = "GA"213 return state_abbr214 elif (re.search("Hawaii", value)):215 state_abbr = "HI"216 return state_abbr217 elif (re.search("Hawai'i", value)):218 state_abbr = "HI"219 return state_abbr220 elif (re.search("Idaho", value)):221 state_abbr = "ID"222 return state_abbr223 elif (re.search("Illinois", value)):224 state_abbr = "IL"225 return state_abbr226 elif (re.search("Indiana", value)):227 state_abbr = "IN"228 return state_abbr229 elif (re.search("Iowa", value)):230 state_abbr = "IA"231 return state_abbr232 elif (re.search("Kansas", value)):233 state_abbr = "KS"234 return state_abbr235 elif (re.search("Kentucky", value)):236 state_abbr = "KY"237 return state_abbr238 elif (re.search("Louisiana", value)):239 state_abbr = "LA"240 return state_abbr241 elif (re.search("Maine", value)):242 state_abbr = "ME"243 return state_abbr244 elif (re.search("Maryland", value)):245 state_abbr = "MD"246 return state_abbr247 elif (re.search("Massachusetts", value)):248 state_abbr = "MA"249 return state_abbr250 elif (re.search("Michigan", value)):251 state_abbr = "MI"252 return state_abbr253 elif (re.search("Minnesota", value)):254 state_abbr = "MN"255 return state_abbr256 elif (re.search("Mississippi", value)):257 state_abbr = "MS"258 return state_abbr259 elif (re.search("Missouri", value)):260 state_abbr = "MO"261 return state_abbr262 elif (re.search("Montana", value)):263 state_abbr = "MT"264 return state_abbr265 elif (re.search("Nebraska", value)):266 state_abbr = "NE"267 return state_abbr268 elif (re.search("Nevada", value)):269 state_abbr = "NV"270 return state_abbr271 elif (re.search("New Hampshire", value)):272 state_abbr = "NH"273 return state_abbr274 elif (re.search("New Jersey", value)):275 state_abbr = "NJ"276 return state_abbr277 elif (re.search("New Mexico", value)):278 state_abbr = "NM"279 return state_abbr280 elif (re.search("New York", value)):281 state_abbr = "NY"282 return state_abbr283 elif (re.search("North Carolina", value)):284 state_abbr = "NC"285 return state_abbr286 elif (re.search("North Dakota", value)):287 state_abbr = "ND"288 return state_abbr289 elif (re.search("Ohio", value)):290 state_abbr = "OH"291 return state_abbr292 elif (re.search("Supreme Court of Oklahoma", value)):293 state_abbr = "OK-SC"294 return state_abbr295 elif (re.search("Oregon", value)):296 state_abbr = "OR"297 return state_abbr298 elif (re.search("Pennsylvania", value)):299 state_abbr = "PA"300 return state_abbr301 elif (re.search("Rhode Island", value)):302 state_abbr = "RI"303 return state_abbr304 elif (re.search("South Carolina", value)):305 state_abbr = "SC"306 return state_abbr307 elif (re.search("Tennessee", value)):308 state_abbr = "TN"309 return state_abbr310 elif (re.search("Texas", value)):311 state_abbr = "TX-SC"312 return state_abbr313 elif (re.search("Utah", value)):314 state_abbr = "UT"315 return state_abbr316 elif (re.search("Vermont", value)):317 state_abbr = "VT"318 return state_abbr319 elif (re.search("Washington", value)):320 state_abbr = "WA"321 return state_abbr322 elif (re.search("West Virginia", value)):323 state_abbr = "WV"324 return state_abbr325 elif (re.search("Wisconsin", value)):326 state_abbr = "WI"327 return state_abbr328 elif (re.search("Wyoming", value)):329 state_abbr = "WY"330 return state_abbr331# .csv file where extracted metadata will be stored332fout = open(mydir + "election.csv", "wb")333outfilehandle = csv.writer(fout,334 delimiter=",",335 quotechar='"',336 quoting=csv.QUOTE_NONNUMERIC)337check = open(mydir + "check_recusals_election.csv", "wb")338recuse_handle = csv.writer(check,339 delimiter=",",340 quotechar='"',341 quoting=csv.QUOTE_NONNUMERIC)342master = open(mydir + "States_MasterFile_Import.csv", "rb")343# Create your own label for each column of the metadata .csv file344localrow = []345localrow.append("Email")346localrow.append("FirstName")347localrow.append("LastName")348localrow.append("court")349localrow.append("date")350localrow.append("state")351localrow.append("panel_state")352localrow.append("parties")353localrow.append("docket")354localrow.append("citestring")355localrow.append("LexisCite")356localrow.append("WestLaw")357localrow.append("attorneys")358localrow.append("judges")359localrow.append("judgeNP")360localrow.append("Judge1_Last_Name")361localrow.append("Judge1_Vote")362localrow.append("Judge1_code")363localrow.append("Judge2_Last_Name")364localrow.append("Judge2_Vote")365localrow.append("Judge2_code")366localrow.append("Judge3_Last_Name")367localrow.append("Judge3_Vote")368localrow.append("Judge3_code")369localrow.append("Judge4_Last_Name")370localrow.append("Judge4_Vote")371localrow.append("Judge4_code")372localrow.append("Judge5_Last_Name")373localrow.append("Judge5_Vote")374localrow.append("Judge5_code")375localrow.append("Judge6_Last_Name")376localrow.append("Judge6_Vote")377localrow.append("Judge6_code")378localrow.append("Judge7_Last_Name")379localrow.append("Judge7_Vote")380localrow.append("Judge7_code")381localrow.append("Judge8_Last_Name")382localrow.append("Judge8_Vote")383localrow.append("Judge8_code")384localrow.append("Judge9_Last_Name")385localrow.append("Judge9_Vote")386localrow.append("Judge9_code")387localrow.append("Judge10_Last_Name")388localrow.append("Judge10_Vote")389localrow.append("Judge10_code")390localrow.append("Judge11_Last_Name")391localrow.append("Judge11_Vote")392localrow.append("Judge11_code")393localrow.append("dissent")394localrow.append("dissent_no")395localrow.append("dissent_name")396localrow.append("dissent_1")397localrow.append("dissent_2")398localrow.append("dissent_3")399localrow.append("dissent_4")400localrow.append("dissent_5")401localrow.append("concurrence")402localrow.append("concur_no")403localrow.append("concur_name")404localrow.append("check")405outfilehandle.writerow(localrow)406recuse_handle.writerow(localrow)407# Name of folder where all cases are located (and nothing else)408dirname = mydir + "election_law/"409dirlist = os.listdir(dirname)410cleandirlist = []411for entry in dirlist:412 matchresult = re.match('.+\\.txt$', entry)413 if matchresult != None:414 cleandirlist.append(matchresult.group())415#dirlist = [file for file in dirlist if len(file) > 20]416# Use (uncomment) following line to test code on a small handful of cases417#cleandirlist = cleandirlist[838:872]418for entry in cleandirlist: ## each entry is a txt file with an opinion 0:1025419 # initialize all variables to be used420 infilepath = dirname + entry421 infilehandle = open(infilepath)422 txtlines = infilehandle.readlines()423 action_number = 0424 case_with_preamble = False425 searchterms_line = False426 blank_after_searchterms = False427 parties_line = False428 blank_after_parties = False429 docket_line = False430 blank_after_docket = False431 court_line = False432 blank_after_court = False433 fn_line = False434 cite_line = False435 blank_after_cite = False436 action_line = False437 disposition_line = False438 prior_history_line = False439 headnotes_line = False440 trunc_text = False441 judges_line = False442 opin_by_line = False443 opinion_line = False444 dissent_by_line = False445 concur_by_line = False446 blank_after_appellant_attorney = False447 jud_dissent = 0448 opinion_word_count = 0449 amicus = 0450 localrow = []451 action_number = 0452 judges_part_string = ""453 searchterms_string = ""454 shep_treat = ""455 parties_string = ""456 docketnum = ""457 court_string = ""458 cite_string = ""459 Fed_cite = ""460 Lexis_cite = ""461 West_cite = ""462 action_string = ""463 per_curiam = 0464 unanimous = 0465 action1 = ""466 date = ""467 action1_month = ""468 action1_day = ""469 action1_year = ""470 action1_date = ""471 action1_action = ""472 action2 = ""473 action2_month = ""474 action2_day = ""475 action2_year = ""476 action2_date = ""477 action2_action = ""478 prior_history_string = ""479 sub_history_string = ""480 disposition_string = ""481 pubdef = 0482 prose = 0483 attorney_string = ""484 pc_holder = ""485 judges_string = ""486 judge1_ln = ""487 judge1_fn = ""488 judge1_mn = ""489 judge1_suf = ""490 judge1_full = ""491 judge2_ln = ""492 judge2_fn = ""493 judge2_mn = ""494 judge2_suf = ""495 judge2_full = ""496 judge3_ln = ""497 judge3_fn = ""498 judge3_mn = ""499 judge3_suf = ""500 judge3_full = ""501 judge4_ln = ""502 judge4_fn = ""503 judge4_mn = ""504 judge4_suf = ""505 judge4_full = ""506 judge5_ln = ""507 judge5_fn = ""508 judge5_mn = ""509 judge5_suf = ""510 judge5_full = ""511 judge6_ln = ""512 judge6_fn = ""513 judge6_mn = ""514 judge6_suf = ""515 judge6_full = ""516 judge7_ln = ""517 judge7_fn = ""518 judge7_mn = ""519 judge7_suf = ""520 judge7_full = ""521 judge8_ln = ""522 judge8_fn = ""523 judge8_mn = ""524 judge8_suf = ""525 judge8_full = ""526 judge9_ln = ""527 judge9_fn = ""528 judge9_mn = ""529 judge9_suf = ""530 judge9_full = ""531 judge10_ln = ""532 judge10_fn = ""533 judge10_mn = ""534 judge10_suf = ""535 judge10_full = ""536 judge11_ln = ""537 judge11_fn = ""538 judge11_mn = ""539 judge11_suf = ""540 judge11_full = ""541 opin_by_string = ""542 author_ln = ""543 author_fn = ""544 author_mn = ""545 author_suf = ""546 author_full = ""547 dissent1_ln = ""548 dissent1_fn = ""549 dissent1_mn = ""550 dissent1_suf = ""551 dissent1_full = ""552 dissent2_ln = ""553 dissent2_fn = ""554 dissent2_mn = ""555 dissent2_suf = ""556 dissent2_full = ""557 dissent3_ln = ""558 dissent3_fn = ""559 dissent3_mn = ""560 dissent3_suf = ""561 dissent3_full = ""562 dissent4_ln = ""563 dissent4_fn = ""564 dissent4_mn = ""565 dissent4_suf = ""566 dissent4_full = ""567 dissent5_ln = ""568 dissent5_fn = ""569 dissent5_mn = ""570 dissent5_suf = ""571 dissent5_full = ""572 concur1_ln = ""573 concur1_fn = ""574 concur1_mn = ""575 concur1_suf = ""576 concur1_full = ""577 concur2_ln = ""578 concur2_fn = ""579 concur2_mn = ""580 concur2_suf = ""581 concur2_full = ""582 concur3_ln = ""583 concur3_fn = ""584 concur3_mn = ""585 concur3_suf = ""586 concur3_full = ""587 concur4_ln = ""588 concur4_fn = ""589 concur4_mn = ""590 concur4_suf = ""591 concur4_full = ""592 concur5_ln = ""593 concur5_fn = ""594 concur5_mn = ""595 concur5_suf = ""596 concur5_full = ""597 concur6_ln = ""598 concur6_fn = ""599 concur6_mn = ""600 concur6_suf = ""601 concur6_full = ""602 concur7_ln = ""603 concur7_fn = ""604 concur7_mn = ""605 concur7_suf = ""606 concur7_full = ""607 concur_by_string = ""608 dissent_by_string = ""609 no_part_list = [] ####610 no_part_string = "" ####611 full_judges_holder = []612 judges_holder = []613 dissent_holder = []614 concur_holder = []615 no_part = False616 no_part_dich = 0617 shep_line = False618 blank_after_shep = False619 court_line = False620 blank_after_court = False621 cite_line = False622 blank_after_cite = False623 action_line = False624 disposition_line = False625 prior_history_line = False626 headnotes_line = False627 sub_history_line = False628 judges_line = False629 attorney_line = False630 #appellee_attorney_line = False631 opin_by_line = False632 opinion_line = False633 dissent_by_line = False634 concur_by_line = False635 dissent_author_1 = ""636 dissent_author_2 = ""637 dissent_author_3 = ""638 dissent_author_4 = ""639 dissent_author_5 = ""640 opinion_word_count = 0641 circuit = 0642 en_banc = ""643 dissent = 0644 concur = 0645 rehearing = ""646 check_case = 0647 op_string = ""648 unpublished = 0649 num_dissent = 0650 num_concur = 0651 unwritten_dissent = 0652 firstcite_line = False653 firstcite_string = ""654 blank_after_firstcite = False655 caseid = str(re.split("\.", entry)[0])656 print "\n" + entry657 pet_str = ""658 res_str = ""659 opinion_start = False660 dissent_line = False661 concur_line = False662 blank_after_action = False663 line_before_first = False664 judge1_vote = ""665 judge2_vote = ""666 judge3_vote = ""667 judge4_vote = ""668 judge5_vote = ""669 judge6_vote = ""670 judge7_vote = ""671 judge8_vote = ""672 judge9_vote = ""673 judge10_vote = ""674 judge11_vote = ""675 panel = 0676 judges_np = ""677 state_abbr = ""678 judge_np_list = []679 judge_np1 = ""680 judge_np2 = ""681 judge_np3 = ""682 judge_np4 = ""683 other_dissent_string = ""684 other_dissent_judges = []685 silent_dissent = False686 silent_judge1 = ""687 silent_judge2 = ""688 silent_judge3 = ""689 silent_judge4 = ""690 silent_judge5 = ""691 first_dissent = False692 other_dissent = ""693 new_date = ""694 date_bool = False695 between = False696 non_panel_judge_string = ""697 other_dissent_holder = []698 part_judges = ""699 judge1_code = ""700 judge2_code = ""701 judge3_code = ""702 judge4_code = ""703 judge5_code = ""704 judge6_code = ""705 judge7_code = ""706 judge8_code = ""707 judge9_code = ""708 judge10_code = ""709 judge11_code = ""710 one_month = datetime.timedelta(365*3) #/12711 judges_AL = []712 MD_date = False713 dock = False714 docket = False715 check_recuse = False716 check_recuse_case = 0717 # each txtline is one "line" in the text file: the end of a line is determined by \n718 for txtline in txtlines:719 # proceeding logic of script based on boolean operators causes all text prior to the line beginning with "Copy Citation" to be ignored720 if (re.search("^Copy Citation",txtline)):721 line_before_first = True722 if (line_before_first and re.search("(COURT|Court)", txtline) and not re.search("^1 ", txtline)):723 ## the court in which the case was heard724 line_before_first = False725 court_line = True726 court_string = court_string + txtline727 court_string = court_string.strip()728 print court_string729 state_abbr = state_ab(court_string) ###function to return state abbreviations730 if (re.search("Alabama|Arizona|Connecticut|Delaware|Florida|Idaho|Massachusetts|Mississippi|Montana|Nevada|New Hampshire|Virginia", court_string)):731 # all cases in states that hear cases in panels are given a value of 1732 panel = 1733 if re.search("West Virginia", court_string):734 # the prior if statement matches "Virginia" in "West Virginia"; this corrects the incorrect panel assignment value735 panel = 0736 if(court_line and re.search("Jan|Feb|Mar|Apr|May|June|July|Aug|Sep|Oct|Nov|Dec|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC", txtline)) and state_abbr != "MD" and not re.search("Argued$", txtline): #re.match("^[\s]+$", txtline)):737 ## this is the blank line after court738 # stores date and action of court (i.e. Decided, Released, Filed)739 blank_after_firstcite = False740 court_line = False741 blank_after_court = True742 #print txtline743 action_line = True744 if (len(action_string) < 1):745 action_string = action_string + txtline746 dock = True747 if len(action_string) < 2:748 MD_date = True749 if state_abbr == "MD" and re.match("Jan|Feb|Mar|Apr|May|June|July|Aug|Sep|Oct|Nov|Dec", txtline) and MD_date == True:750 action_string = txtline751 MD_date = False752 blank_after_firstcite = False753 court_line = False754 blank_after_court = True755 #print txtline756 action_line = True757 if(action_line): #and re.match("^[\s]+$", txtline)):758 # parse out unnecessary text from action string (Date and Procedural Documentation of Publication) for only the date to remain759 blank_after_court = False760 blank_after_action = True761 action_line = False762 if re.search("Argued; ;", action_string):763 action_string = action_string.split("Argued; ;", 1)[1]764 if re.search("Argued ;", action_string):765 action_string = action_string.split("Argued ;", 1)[1]766 if re.search("Argued;", action_string):767 action_string = action_string.split("Argued;", 1)[1]768 if re.search("Argued and submitted ;", action_string):769 action_string = action_string.split("Argued and submitted ;", 1)[1]770 if re.search("Argued and submitted;", action_string):771 action_string = action_string.split("Argued and submitted;", 1)[1]772 if re.search("Submitted ;", action_string):773 action_string = action_string.split("Submitted ;", 1)[1]774 if re.search("Submitted;", action_string):775 action_string = action_string.split("Submitted;", 1)[1]776 if re.search("Submitted on Briefs ;", action_string):777 action_string = action_string.split("Submitted on Briefs ;", 1)[1]778 if re.search("Submitted on Briefs;", action_string):779 action_string = action_string.split("Submitted on Briefs;", 1)[1]780 if re.search("Heard in the Supreme Court ;", action_string):781 action_string = action_string.split("Heard in the Supreme Court ;", 1)[1]782 if re.search("Heard in the Supreme Court;", action_string):783 action_string = action_string.split("Heard in the Supreme Court;", 1)[1]784 if re.search("Heard ;", action_string):785 action_string = action_string.split("Heard ;", 1)[1]786 if re.search("Heard;", action_string):787 action_string = action_string.split("Heard;", 1)[1]788 if re.search("Session;", action_string):789 action_string = action_string.split("Session;", 1)[1]790 if re.search("Session ;", action_string):791 action_string = action_string.split("Session ;", 1)[1]792 if re.search("Argument ;", action_string):793 action_string = action_string.split("Argument ;", 1)[1]794 if re.search("Argument;", action_string):795 action_string = action_string.split("Argument;", 1)[1]796 print action_string797 action_string = expandmonth(action_string)798 action_string = re.sub(":", ",", action_string)799 action_string = re.sub(";", ",", action_string)800 action_string = re.sub("\*", "", action_string)801 action_string = re.sub("Argued and Submitted ", "Argued and Submitted, ", action_string)802 action_string = re.sub("Argued ", "Argued, ", action_string)803 action_string = re.sub(", Decided ", "", action_string)804 action_string = re.sub("Supplemental Briefing Submitted ", "Supplemental Briefing Submitted, ", action_string)805 action_string = re.sub(", Released", "", action_string)806 action_string = re.sub(", RELEASED", "", action_string)807 action_string = re.sub(", Filed", "", action_string)808 action_string = re.sub("Submitted Under Third Circuit Rule 12\(6\) ", "Submitted Under Third Circuit Rule 12(6), ", action_string)809 action_string = re.sub("Cause argued ", "Cause argued, ", action_string)810 split_action = re.split("\n", action_string)811 action1 = string.strip(split_action[0])812 action2 = string.strip(split_action[1])813 action2 = re.split(", ", action2)814 action1 = re.split(", ", action1)815 if(len(split_action) < 2):816 action1[1] = re.sub("\.", "", action1[1])817 action1[1] = re.sub(",", "", action1[1])818 action1[0] = re.sub("Argued ", "", action1[0])819 action1[0] = re.sub("Submitted ", "", action1[0])820 date = date + action1[0] + ", " + action1[1]821 if(len(action1) > 2 and len(date) == 0 and re.search("Decided|DECIDED", action1[2])):822 date = date + action1[0] + ", " + action1[1]823 if(len(action1) > 2 and len(date) == 0 and re.search("Filed|FILED", action1[2])):824 date = date + action1[0] + ", " + action1[1]825 if(len(action2) > 2 and len(date) == 0 and re.search("Decided|DECIDED", action2[2])):826 date = date + action2[0] + ", " + action2[1]827 if(len(action2) > 2 and len(date) == 0 and re.search("Filed|FILED", action2[2])):828 date = date + action2[0] + ", " + action2[1]829 if(len(action2) > 1 and len(date)==0):830 date = date + action2[0] + ", " + action2[1]831 date = re.sub(",$", "", date)832 date = re.sub("\*", "", date)833 date = re.sub("\.", "", date)834 if(len(action2) > 1 and len(date)==0):835 date = date + action2[0] + ", " + action2[1]836 date = re.sub(",$", "", date)837 date = re.sub("\.", "", date)838 action_string = string.strip(action_string)839 action_string = re.sub("[\s]+", " ", action_string)840 action_string = re.sub("Decided|decided|DECIDED", " ", action_string)841 action_string = re.sub("Filed|filed|FILED", " ", action_string)842 # one case has incorrect formatting of the date and it causes the program to break when calling teh strptime function843 if action_string == "December 22 1995":844 action_string = "December 22, 1995"845 # Dates from Maryland cases do not parse correctly846 if action_string != "Court of Appeals of Maryland":847 x = re.search("\d{4}", action_string)848 # store in x the position of the last digit of the year849 x = x.end()850 if new_date == "":851 date_bool = True852 if(x != -1 and date_bool):853 new_date = action_string[:x]854 date_bool = False855 if(x == -1):856 new_date = action_string857 if state_abbr != "MC":858 # format dates so they match the format from the state judge master file859 new_date = re.sub("April,", "April", new_date)860 new_date = re.sub("On ", "", new_date)861 date_format = datetime.datetime.strptime(new_date, '%B %d, %Y').date()862 elif state_abbr == "MC":863 date_format = datetime.datetime.strptime('1/1/1800', '%m/%d/%Y').date()864 # match state abbrevation and date decided from case and state master file to produce a list of judges who were on the bench at time of decision for cases heard in non-panel state865 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:866 reader = csv.reader(f)867 next(f)868 for row in reader:869 state = row[0]870 name = row[3]871 if len(row[4]) == 4 and row[0] != "MC":872 row[4] = "1/1/" + row[4]873 if len(row[5]) == 4 and row[0] != "MC": #and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL"))) and len(judge6_ln) > 2 and len(judge9_ln) < 2:874 row[5] = "1/1/" + row[5]875 #print state_abbr876 if len(row[4]) != 4 and row[0] != "MC" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH"))) and ((len(judge6_ln) > 2 or len(judge3_ln) < 2) and len(judge9_ln) < 2) and state_abbr:877 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()878 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date()879 if ((panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and state_abbr != "AK" and (len(judge6_ln) > 2) and len(judge9_ln) < 2)) and start <= date_format <= end):880 between = True881 #print state_abbr882 if ((state == state_abbr) and between and row[0] != "MC" and row[2] == 0 and state_abbr != "AK" and (panel == 0 or (state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH")) and (len(judge6_ln) > 2 or len(judge3_ln) < 2) and len(judge9_ln) < 2):883 if non_panel_judge_string == "":884 non_panel_judge_string = non_panel_judge_string + row[3]885 else:886 non_panel_judge_string = non_panel_judge_string + ", " + row[3]887 if row[3] == judge1_ln:888 judge1_code = row[1]889 between = False890 #judges_string = judges_string + ", " + non_panel_judge_string891 non_panel_list = non_panel_judge_string.split(",")892 non_panel_list.sort()893 master.close()894 if (docketnum == "") or not re.search("[0-9]", docketnum):895 if(not re.search("LEXIS", txtline) and re.search("^([\d]+$|Docket|Misc|No\.|Nos\.|SC |File Nos. |File No. |Arizona Supreme Court No. |L. A. Nos. |SCWC-|Cause No. |Supreme Court Cause Number |S[\d][\d]|A[\d][\d]|S. Ct. NO. |[\d] Div. |CASE NO.:|L.A. No. |\[NO NUMBER|\[No number in original|[\w]-|Supreme Court Case |Supreme Court No. |Supreme Court No. |Supreme Court Case No. |Law Docket No. |SUPREME COURT DOCKET NO. |Record No. |SUPREME COURT DOCKET NO. |Sac. No. |\([\d]+\)|\(SC |NO|C\.A\.|\# [\d]|[\d][\d][\d][\d]-|SJC-|Decision No. |DA |CA |[\d][\d]-|91-|Opinion No\.|DOCKET|Case No|[\d][\d][\d][\d][\d][\d][\d], [\d][\d][\d][\d][\d][\d][\d]|S[\d][\d][\d][\d][\d][\d]|Yor-[\d][\d]|Cum-[\d][\d]|C[\d]-[\d]|Case Number:|S.C. No. |NO.|Appeal No. |Supreme Court Nos. |S.F. No. |SCCQ-[\d]|[\d][\d][\d][\d][\d]-|Indiana Supreme Court Cause No. |[\d]|[\d][\d][\d][\d][\d][\d][\d])", txtline) and not re.search("Supreme Court of Pennsylvania",txtline) and not re.search("Supreme Court of Delaware",txtline) and not re.search("Court of Appeals of New York",txtline) and not re.search("^1. ",txtline) and not re.search("^2. ",txtline) and not re.search("^3. ",txtline) and not re.search("^4. ",txtline) and not re.search("^5. ",txtline)):896 ## the docket number897 docket_line = True898 action_line = False899 blank_after_action = True900 docketnum = docketnum + txtline901 ##OLDER PA (and some DE) CASES DON'T HAVE DOCKETS. THIS FIXES THE ISSUE902 elif(blank_after_action and not re.search("^([\d]+$|Docket|Misc|No\.|Nos\.|SC |File Nos. |File No. |Arizona Supreme Court No. |L. A. Nos. |SCWC-|Cause No. |Supreme Court Cause Number |S[\d][\d]|A[\d][\d]|S. Ct. NO. |[\d] Div. |CASE NO.:|L.A. No. |\[NO NUMBER|\[No number in original|[\w]-|Supreme Court Case |Supreme Court No. |Supreme Court No. |Supreme Court Case No. |Law Docket No. |SUPREME COURT DOCKET NO. |Record No. |SUPREME COURT DOCKET NO. |Sac. No. |\([\d]+\)|\(SC |NO|C\.A\.|\# [\d]|[\d][\d][\d][\d]-|SJC-|Decision No. |DA |CA |[\d][\d]-|91-|Opinion No\.|DOCKET|Case No|[\d][\d][\d][\d][\d][\d][\d], [\d][\d][\d][\d][\d][\d][\d]|S[\d][\d][\d][\d][\d][\d]|Yor-[\d][\d]|Cum-[\d][\d]|C[\d]-[\d]|Case Number:|S.C. No. |NO.|Appeal No. |Supreme Court Nos. |S.F. No. |SCCQ-[\d]|[\d][\d][\d][\d][\d]-|Indiana Supreme Court Cause No. |[\d]|[\d][\d][\d][\d][\d][\d].)", txtline) and re.search("Supreme Court of Pennsylvania",txtline) or re.search("Supreme Court of Delaware",txtline) or re.search("Court of Appeals of New York",txtline)):903 ## the docket number904 docketnum = docketnum + txtline905 docket_line = True906 action_line = False907 blank_after_docket = True908 if(re.match("^Reporter", txtline) and not opinion_start):909 ## this is the "Reporter" line after docket number910 blank_after_action = False911 docket_line = False912 blank_after_docket = True913 if(re.search(" > ", docketnum)):914 docketnum = ""915 # Store all citations listed by Lexis916 if((blank_after_docket) and re.search("LEXIS", txtline) and re.search("[\w]+", txtline) and not opinion_start):917 ## the citation block918 cite_line = True919 cite_string = cite_string + txtline920 cite_string = re.sub("[\s]+", " ", cite_string)921 cite_string = re.sub("[\*]+", "", cite_string)922 cite_string = re.sub("\xc2", "", cite_string)923 cite_string = re.sub("\xa0", "", cite_string)924 West_cite = cite_string.split("|")[0]925 #print West_cite926 if(cite_line and re.match("^[\s]+$", txtline)):927 ## done with citation block928 blank_after_docket = False929 cite_line = False930 blank_after_cite = True931 all_cites = re.split(" [\|] ", cite_string)932 ####print all_cites933 ##Fed_cite = [cite for cite in all_cites if re.search("[\s]F\.(2|3)d", cite)]934 Lexis_cite = [cite for cite in all_cites if re.search("LEXIS", cite)]935 try:936 ## Fed_cite = string.strip(Fed_cite[0])937 Lexis_cite = string.strip(Lexis_cite[0])938 except:939 print "Problem with citation"940 if(blank_after_cite and re.match("[\w]+", txtline)):941 ## the parties942 parties_line = True943 parties_string = parties_string + txtline944 #print txtline.replace("\n", "")945 # Store names of parties to the case946 if (parties_line and re.match("^[\s]+$", txtline)):947 ## done with parties block948 blank_after_cite = False949 parties_line = False950 blank_after_parties = True951 parties_string = re.sub("[\s]+", " ", parties_string)952 # Store text in Prior and Subsequent History lines953 if(re.match("^Subsequent History:", txtline)):954 sub_history_line = True955 parties_line = False956 if(sub_history_line and re.search("[\w]+", txtline)):957 sub_history_string = sub_history_string + txtline958 if (prior_history_line and re.match("^[\s]+$", txtline)):959 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)960 prior_history_string = re.sub("Prior History:", "", prior_history_string)961 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)962 prior_history_string = re.sub("\xa0", " ", prior_history_string)963 prior_history_string = re.sub("\n|\r", " ", prior_history_string)964 prior_history_string = string.strip(prior_history_string)965 sub_history_line = False966 if(re.match("^Prior History:", txtline)):967 prior_history_line = True968 parties_line = False969 if(prior_history_line and re.search("[\w]+", txtline)):970 prior_history_string = prior_history_string + txtline971 if (prior_history_line and re.match("^[\s]+$", txtline)):972 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)973 prior_history_string = re.sub("Prior History:", "", prior_history_string)974 prior_history_string = re.sub("Procedural Posture:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)975 prior_history_string = re.sub("Procedural Posture:", "", prior_history_string)976 prior_history_string = re.sub("\xa0", " ", prior_history_string)977 prior_history_string = re.sub("\n|\r", " ", prior_history_string)978 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)979 prior_history_string = string.strip(prior_history_string)980 prior_history_line = False981 if(re.match("^Procedural Posture:", txtline) and prior_history_string == ""):982 prior_history_line = True983 parties_line = False984 if(prior_history_line and re.search("[\w]+", txtline)):985 prior_history_string = prior_history_string + txtline986 if (prior_history_line and re.match("^[\s]+$", txtline)):987 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)988 prior_history_string = re.sub("Prior History:", "", prior_history_string)989 prior_history_string = re.sub("Procedural Posture:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)990 prior_history_string = re.sub("Procedural Posture:", "", prior_history_string)991 prior_history_string = re.sub("\xa0", " ", prior_history_string)992 prior_history_string = re.sub("\n|\r", " ", prior_history_string)993 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)994 prior_history_string = string.strip(prior_history_string)995 prior_history_line = False996 ###RKH USES OUTCOME instead of DISPOSITION because not every case has a DISPOSITION997 if (re.match("^Disposition:", txtline) and disposition_string == ""):998 ## disposition of case999 disposition_line = True1000 #print disposition_string1001 if (disposition_line and re.search("[\w]+", txtline)):1002 ## disposition lines with text1003 disposition_string = disposition_string + txtline1004 #print disposition_string1005 if (disposition_line and re.match("^[\s]+$", txtline)):1006 ## blank line after disposition line1007 disposition_string = re.sub("Disposition:", "", disposition_string)1008 disposition_string = re.sub("Outcome:", "", disposition_string)1009 disposition_string = re.sub("\xa0", " ", disposition_string)1010 disposition_string = re.sub("\n|\r", " ", disposition_string)1011 disposition_string = re.sub("\[.+\]", "", disposition_string)1012 disposition_string = string.strip(disposition_string)1013 #print disposition_string1014 disposition_line = False1015 # Store outcome of case1016 if (re.match("^Outcome:", txtline)):1017 ## disposition of case1018 disposition_line = True1019 #print disposition_string1020 if (disposition_line and re.search("[\w]+", txtline)):1021 ## disposition lines with text1022 disposition_string = disposition_string + txtline1023 #print disposition_string1024 if (disposition_line and re.match("^[\s]+$", txtline)):1025 ## blank line after disposition line1026 disposition_string = re.sub("Outcome:", "", disposition_string)1027 disposition_string = re.sub("Disposition:", "", disposition_string)1028 disposition_string = re.sub("\xa0", " ", disposition_string)1029 disposition_string = re.sub("\n|\r", " ", disposition_string)1030 disposition_string = re.sub("\[.+\]", "", disposition_string)1031 disposition_string = re.sub("\[\**\d*\]", "", disposition_string)1032 disposition_string = string.strip(disposition_string)1033 #print disposition_string1034 disposition_line = False1035 # Search for presence of Per Curiam opinion1036 if re.search("^Opinion", txtline):1037 first_dissent = True1038 if (re.search("Opinion By: (PER CURIAM)|(Per Curiam)", txtline)):1039 #pc_holder = pc_holder + "Per Curiam. "1040 per_curiam = 11041 if (re.search("PER CURIAM", txtline)):1042 #pc_holder = pc_holder + "Per Curiam. "1043 per_curiam = per_curiam + 11044 if (re.search("^[\s]*Per Curiam[\.:\s]*$", txtline)):1045 per_curiam = 11046 #print pc_holder + "\n"1047 # Search for judges that join in dissenting opinions but are not listed as such in the judge line1048 if((first_dissent == True and re.search("dissents\.$|dissent\.$|dissenting\.$", txtline) and len(txtline) < 100 and not re.search("I respectfully dissent\.|I dissent\.|I therefore respectfully dissent\.", txtline)) or (re.search("joined\.$", txtline) and re.search("dissent", txtline))):1049 #print repr(txtline)1050 first_dissent = False1051 other_dissent = re.sub(" and", ",", txtline)1052 other_dissent = re.sub("filed a dissenting opinion", "", other_dissent)1053 other_dissent = re.sub("delivered the Opinion of the Court", "", other_dissent)1054 other_dissent = re.sub("All the Justices concur", "", other_dissent)1055 other_dissent = re.sub("\[\**\d\]", "", other_dissent)1056 other_dissent = re.sub("C\.J\.", "", other_dissent)1057 other_dissent = re.sub(" C\.", "", other_dissent)1058 other_dissent = re.sub("\[\*\*[0-9]+\]", "", other_dissent)1059 other_dissent = re.sub("For those reasons", "", other_dissent)1060 other_dissent = re.sub("dissenting", "", other_dissent)1061 other_dissent = re.sub("dissents\.|dissent\.|dissents|dissent", "", other_dissent)1062 other_dissent = re.sub("J\.;", "", other_dissent)1063 other_dissent = re.sub("C\.J\.|JJ\.|J\.J\.|J\.|C\. J\.", "", other_dissent)1064 #print other_dissent1065 if re.search("deliver", other_dissent):1066 other_dissent = other_dissent.split(".", 1)[1]1067 if re.search("filed a concurring opinion", other_dissent):1068 other_dissent = other_dissent.split(".", 1)[1]1069 #print other_dissent1070 other_dissent = re.sub("joined\.|joined|joins|join|JOINS|JOIN", "", other_dissent)1071 other_dissent = re.sub("in the|IN THE", "", other_dissent)1072 other_dissent = re.sub("in this", "", other_dissent)1073 other_dissent = re.sub("in which", "", other_dissent)1074 other_dissent = re.sub("Special Justice", "", other_dissent)1075 other_dissent = re.sub("JUSTICES|Justices|justices|JUSTICE|Justice|justice", "", other_dissent)1076 other_dissent = re.sub("\xc2", "", other_dissent)1077 other_dissent = re.sub("CHIEF|Chief|chief", "", other_dissent)1078 other_dissent = re.sub("Order affirmed, with costs", "", other_dissent)1079 other_dissent = re.sub("Opinion by|opinion by|OPINION BY", "", other_dissent)1080 other_dissent = re.sub("Judges|judges|JUDGES|judge|Judge|JUDGE", "", other_dissent)1081 other_dissent = re.sub("concurs|CONCURS|concur|CONCUR", "", other_dissent)1082 other_dissent = re.sub("\xa0", "", other_dissent)1083 other_dissent = re.sub("In Part", "", other_dissent)1084 other_dissent = re.sub("in part\.", "", other_dissent)1085 other_dissent = re.sub("in part", "", other_dissent)1086 other_dissent = re.sub("\[\*\*\*[\w]+\]", "", other_dissent)1087 other_dissent = re.sub("I respectfully", "", other_dissent)1088 other_dissent = re.sub("respectfully|RESPECTFULLY|Respectfully", "", other_dissent)1089 #other_dissent = re.sub("")1090# other_dissent = re.sub("\s", "", other_dissent)1091 other_dissent = re.sub("this", "", other_dissent)1092 other_dissent = re.sub("with whom", "", other_dissent)1093 other_dissent = re.sub("except", "", other_dissent)1094 other_dissent = re.sub(" who", "", other_dissent)1095 other_dissent = re.sub("reversed|REVERSED|reverse|REVERSE", "", other_dissent)1096 other_dissent = re.sub("authorizes me to state", "", other_dissent)1097 other_dissent = re.sub("that she", "", other_dissent)1098 other_dissent = re.sub("the views expressed", "", other_dissent)1099 other_dissent = re.sub("foregoing", "", other_dissent)1100 other_dissent = re.sub(" JR\.| JR", "", other_dissent)1101 other_dissent = re.sub(" SR\.| SR", "", other_dissent)1102 other_dissent = re.sub("specially|Specially|SPECIALLY", "", other_dissent)1103 other_dissent = re.sub("Order affirmed, with costs", "", other_dissent)1104 other_dissent = re.sub("affirmed|AFFIRMED", "", other_dissent)1105 other_dissent = re.sub("reason|reasons", "", other_dissent)1106 other_dissent = re.sub("'", "", other_dissent)1107 other_dissent = re.sub("Justice", "", other_dissent)1108 other_dissent = re.sub("filed an opinion", "", other_dissent)1109 other_dissent = re.sub("concurring in part", "", other_dissent)1110 other_dissent = re.sub("Part I", "", other_dissent)1111 other_dissent = re.sub("in part", "", other_dissent)1112 other_dissent = re.sub("Part|part", "", other_dissent)1113 dissent = 11114 other_dissent_holder = other_dissent.split(",")1115 other_dissent_holder = filter(None, other_dissent_holder)1116 if (re.search("^<truncate>", txtline)):1117 trunc_text = True1118 if (re.search("^</truncate>", txtline)):1119 trunc_text = False1120 if (re.match("^Counsel:", txtline) and not opinion_line):1121 attorney_line = True1122 # Store attorneys for appellee and appellant1123 if (attorney_line and re.search("^Judges|^Opinion", txtline) and not opinion_start and not re.search("^Opinion No.",txtline)):1124 attorney_line = False1125 attorney_string = re.sub("Counsel:\[\**\d*\]", "", attorney_string)1126 attorney_string = re.sub("Counsel:", "", attorney_string)1127 attorney_string = re.sub("\[\**\d*\]", "", attorney_string)1128 attorney_string = re.sub("\xa0", " ", attorney_string)1129 attorney_string = re.sub("\xc2", " ", attorney_string)1130 attorney_string = re.sub("\n|\r", " ", attorney_string)1131 attorney_string = string.strip(attorney_string)1132 attorney_line = False1133 if(attorney_line):1134 attorney_string = attorney_string + txtline1135 attorney_string = re.sub("Counsel:\[\**\d*\]", "", attorney_string)1136 attorney_string = re.sub("Counsel:", "", attorney_string)1137 attorney_string = re.sub("\[\**\d*\]", "", attorney_string)1138 attorney_string = re.sub("\xa0", " ", attorney_string)1139 attorney_string = re.sub("\xc2", " ", attorney_string)1140 attorney_string = re.sub("\n|\r", " ", attorney_string)1141 attorney_string = string.strip(attorney_string)1142 attorney_line = False1143 if (re.search("Public|public|PUBLIC|defender|DEFENDER|Defender", attorney_string)):1144 pubdef = 11145 if (re.search("(pro se)|(Pro se)|(Pro Se)|(pro Se)", attorney_string)):1146 prose = 11147 if (re.match("^Judges:", txtline) and not trunc_text):1148 ## judges hearing case1149 judges_line = True1150 if (judges_line and re.search("[\w]+", txtline)):1151 ## judges lines with text1152 judges_string = judges_string + txtline #+ ", " + non_panel_judge_string1153 if (judges_line and re.match("^[\s]+$", txtline)):1154 # new line or some whitespace after judges line1155 # Store and parse text of judges that recused themselves from the case1156 if (re.search("((N|n)ot (P|p)articipat(e|ing)|(R|r)ecus(e|es|ed)|RECUSED|(T|t)ak(e|es) no part| sitting for| disqualified|took no part|NOT PARTICIPATING|sitting in lieu of|sitting for)", judges_string)):1157 no_part = True1158 no_part_dich = 11159 if len(re.findall('not participating|recusal|recused|disqualif|sitting for', judges_string)) > 1 or (re.search('not participating|recusal|recused|disqualif|sitting for', judges_string) and len(judges_string) > 300):1160 check_recuse = True1161 check_recuse_case = 11162 full_judges_holder = re.sub(", (J|JJ)\.", " ", judges_string)1163 full_judges_holder = re.sub(" O\.", "", full_judges_holder)1164 full_judges_holder = re.sub(" C\.", "", full_judges_holder)1165 full_judges_holder = re.sub(" W\.", "", full_judges_holder)1166 full_judges_holder = re.split("\. ", full_judges_holder)1167 no_part_string = [sentence for sentence in full_judges_holder if re.search("((N|n)ot (P|p)articipat(e|ing)|(R|r)ecus(e|es|ed)|RECUSED| sitting for| disqualified|took no part|(T|t)ak(e|es) no part)|NOT PARTICIPATING|sitting in lieu of", sentence)]1168 no_part_string = str(no_part_string)1169 no_part_string = re.sub("(N|n)ot (P|p)articipat(e|ing).*", "", no_part_string)1170 no_part_string = re.sub("NOT PARTICIPATING", "", no_part_string)1171 no_part_string = re.sub("Recus(es|ed|e)", "", no_part_string)1172 no_part_string = re.sub("took no part in the consideration or decision of this case", "", no_part_string)1173 no_part_string = re.sub("took no part in the decison", "", no_part_string)1174 if re.search("except", no_part_string):1175 no_part_string = no_part_string.split("except", 1)[1]1176 if re.search("in place of", no_part_string):1177 no_part_string = no_part_string.split("in place of", 1)[1]1178 if re.search("IN PLACE OF", no_part_string):1179 no_part_string = no_part_string.split("IN PLACE OF", 1)[1]1180 if re.search("sitting for", no_part_string):1181 no_part_string = no_part_string.split("sitting for", 1)[1]1182 if re.search("sitting in lieu of", no_part_string):1183 no_part_string = no_part_string.split("sitting in lieu of", 1)[1]1184 if re.search("Concurring", no_part_string):1185 no_part_string = no_part_string.split("Concurring", 1)[1]1186 no_part_string = re.sub("who is disqualified", "", no_part_string)1187 no_part_string = re.sub(", sitting for Justice", "", no_part_string)1188 no_part_string = re.sub("recus(es|ed|e)|RECUSED\n|RECUSED", "", no_part_string)1189 no_part_string = re.sub("^[\s]+", "", no_part_string)1190 no_part_string = re.sub("[\s]*\*[\s]*", "", no_part_string)1191 no_part_string = re.sub("'", "", no_part_string)1192 no_part_string = re.sub("\[", "", no_part_string)1193 no_part_string = re.sub("Spaulding", "", no_part_string)1194 no_part_string = re.sub("District Court Judge", "", no_part_string)1195 no_part_string = re.sub("John McKeon|JOHN McKEON", "", no_part_string)1196 no_part_string = re.sub("\]", "", no_part_string)1197 no_part_string = re.sub("(Him|him|Her|her|Them|them)sel(f|ves)", "", no_part_string)1198 no_part_string = re.sub("All the Justices concur, except", "", no_part_string)1199 no_part_string = re.sub("(J|j)ustices,*", "", no_part_string)1200 no_part_string = re.sub("(J|j)ustice,*", "", no_part_string)1201 no_part_string = re.sub("JUSTIC(E|ES),*", "", no_part_string)1202 no_part_string = re.sub("Former Chief", "", no_part_string)1203 no_part_string = re.sub("Former", "", no_part_string)1204 no_part_string = re.sub("[\s]*(did|does)[\s]*", "", no_part_string)1205 no_part_string = re.sub("CJ\.", "", no_part_string)1206 no_part_string = re.sub(", (J|JJ|C\.J)\.,*", "", no_part_string)1207 no_part_string = re.sub("[\s] s[\s]*", "", no_part_string)1208 no_part_string = re.sub("J\.", " ", no_part_string)1209 no_part_string = re.sub("[\s]$", "", no_part_string)1210 no_part_string = re.sub(",[\s]+(,|\.)$", "", no_part_string)1211 no_part_string = re.sub("\.[\s]*$", "", no_part_string)1212 no_part_string = re.sub(",[\s]*$", "", no_part_string)1213 no_part_string = re.sub("\\xc2\\xa0", "", no_part_string)1214 no_part_string = re.sub(" s ", "", no_part_string)1215 no_part_string = re.sub("\xc2|\\xc2", "", no_part_string)1216 no_part_string = re.sub("\xa0|\\xa0", "", no_part_string)1217 no_part_string = re.sub("\xc2\xa0GLAZE", "", no_part_string)1218 no_part_string = re.sub("Judges:", "", no_part_string)1219 no_part_string = re.sub("AND", "and", no_part_string)1220 no_part_string = re.sub("Boucier", "Bourcier", no_part_string)1221 no_part_string = re.sub(", ,", ",", no_part_string)1222 no_part_string = re.sub(",", "", no_part_string)1223 no_part_string = re.sub("\.", "", no_part_string)1224 no_part_string = re.sub("Chief|CHIEF", "", no_part_string)1225 no_part_string = re.sub("\n|\\n", "", no_part_string)1226 no_part_string = re.sub("who take no part", "", no_part_string)1227 no_part_string = no_part_string.rstrip('\\n')1228 no_part_string = re.sub(' and', ',', no_part_string)1229 no_part_string = re.sub('deeming', '', no_part_string)1230 no_part_string = re.sub('disqualified', '', no_part_string)1231 no_part_string = re.sub('retired', '', no_part_string)1232 no_part_string = no_part_string.strip()1233 no_part_string = no_part_string.upper()1234 judges_np = no_part_string1235 judges_np = re.sub("\\xc2", "", judges_np)1236 judges_np = re.sub("\xc2\xa0", "", judges_np)1237 judges_np = re.sub(" and", "", judges_np )1238 judge_np_list = judges_np.split(" ")1239 judge_np_list = filter(None, judge_np_list)1240 if len(judge_np_list) > 4:1241 judge_np_list = judge_np_list[2]1242 judges_np = judge_np_list1243 judge_np1 = ""1244 judge_np2 = ""1245 judge_np3 = ""1246 judge_np4 = ""1247 # Parse judges text and store list of judges that decided case1248 judges_string = re.sub("Judges:|Judges|JUDGES", "", judges_string)1249 judges_string = re.sub("judge|Judge|JUDGE", "", judges_string)1250 judges_string = re.sub(" delivered the Opinion of the Court\.| DELIVERED THE OPINION OF THE COURT\.|Delivered the Opinion of the Court\.", ",", judges_string)1251 judges_string = re.sub("BEFORE THE ENTIRE", "", judges_string)1252 judges_string = re.sub("Court", "", judges_string)1253 judges_string = re.sub("court", "", judges_string)1254 judges_string = re.sub("\xc3\x8d", "i", judges_string)1255 judges_string = re.sub(" Sr\.| SR\.", "", judges_string)1256 judges_string = re.sub(" Jr\.| JR\.", "", judges_string)1257 judges_string = re.sub(" Mr\.| MR\.", "", judges_string)1258 judges_string = re.sub(" Sr| SR", "", judges_string)1259 judges_string = re.sub(" Jr| JR", "", judges_string)1260 judges_string = re.sub(" at the", "", judges_string)1261 judges_string = re.sub(" Mr| MR", "", judges_string)1262 judges_string = re.sub("F\.X\. HENNESSEY", "HENNESSY", judges_string)1263 judges_string = re.sub("and in the judgment", "", judges_string)1264 judges_string = re.sub("was an appointed", "", judges_string)1265 judges_string = re.sub("S93A0786", "", judges_string)1266 judges_string = re.sub("S93X0787", "", judges_string)1267 judges_string = re.sub("III-A", "", judges_string)1268 judges_string = re.sub("I-V", "", judges_string)1269 judges_string = re.sub(" VII", "", judges_string)1270 judges_string = re.sub("Parts V\(C\), VI, VII and VIII", "", judges_string)1271 judges_string = re.sub("Parts V\(C\), VI, VII, and VIII", "", judges_string)1272 judges_string = re.sub("Parts I, II, IV and V\(A\)", "", judges_string)1273 judges_string = re.sub("Part III and V\(B\)", "", judges_string)1274 judges_string = re.sub("Parts V\(C\), VI, VII and VIII", "", judges_string)1275 judges_string = re.sub("Messrs\.", "", judges_string)1276 judges_string = re.sub("stead", "", judges_string)1277 judges_string = re.sub("MOTION FOR EXPEDITED APPEAL IS GRANTED", "", judges_string)1278 judges_string = re.sub("REQUEST FOR ORAL ARGUMENT IS DENIED", "", judges_string)1279 judges_string = re.sub("Section IV\(D\)", "", judges_string)1280 judges_string = re.sub("parts I, II, and III", "", judges_string)1281 judges_string = re.sub("respect|RESPECT|Respect", "", judges_string)1282 judges_string = re.sub("action was submitted", "", judges_string)1283 judges_string = re.sub("Subscribing to the Opinion and Assigning Additional Reasons", "", judges_string)1284 judges_string = re.sub("Pursuant to Ariz\. Const\. art\. VI|pursuant to Ariz\. Const\. art\. VI|Pursuant to Ariz\. Const\. art\. 6|pursuant to Ariz\. Const\. art\. 6", "", judges_string)1285 judges_string = re.sub("Arizona Constitution", "", judges_string)1286 judges_string = re.sub("Pursuant to art\. VI\.|Pursuant to article VI", "", judges_string)1287 judges_string = re.sub("pursuant|Pursuant", "", judges_string)1288 judges_string = re.sub(" and Justices", ",", judges_string)1289 judges_string = re.sub("None", "", judges_string)1290 judges_string = re.sub("\xe2\x80\x94", "", judges_string)1291 judges_string = re.sub("PANEL: ", "", judges_string)1292 judges_string = re.sub("\$110W\.", "", judges_string)1293 judges_string = re.sub(" but, on administrative leave,", "", judges_string)1294 judges_string = re.sub("Ex parte Reneau L\. Gates \(re\: v\. Palm Harbor Homes\, Inc\.\, et al\.\)", "", judges_string)1295 judges_string = re.sub("We Concur|WE CONCUR|We concur", ", ", judges_string)1296 judges_string = re.sub("All the|all the|ALL THE", "", judges_string)1297 judges_string = re.sub("Circuit|circuit|CIRCUIT", "", judges_string)1298 judges_string = re.sub("except", "", judges_string)1299 judges_string = re.sub("Special Justices", "", judges_string)1300 judges_string = re.sub("Terminix International v\. Jackson", "", judges_string)1301 judges_string = re.sub("Special Justice", "", judges_string)1302 judges_string = re.sub("Associate Justice", "", judges_string)1303 judges_string = re.sub("Point II", "", judges_string)1304 judges_string = re.sub("Special Chief Justice", "", judges_string)1305 judges_string = re.sub("Chief Justice", "", judges_string)1306 judges_string = re.sub("Justice\.", "", judges_string)1307 judges_string = re.sub("affirmance|Affirmance|AFFIRMANCE", "", judges_string)1308 judges_string = re.sub("'s|'S", "", judges_string)1309 judges_string = re.sub("\(No\.\s\d*\)", "", judges_string)1310 judges_string = re.sub("AFFIRMED|Affirmed|affirmed", "", judges_string)1311 judges_string = re.sub("AFFIRM|Affirm|affirm", "", judges_string)1312 judges_string = re.sub("grant the petition", "", judges_string)1313 judges_string = re.sub("petition|Petition|PETITION", "", judges_string)1314 judges_string = re.sub("Granted|granted|GRANTED", "", judges_string)1315 judges_string = re.sub("abstaining|Abstaining|ABSTAINING", "", judges_string)1316 judges_string = re.sub("No\.\s\d*", "", judges_string)1317 judges_string = re.sub("Senior", "", judges_string)1318 judges_string = re.sub("Supr\.|Supr", "", judges_string)1319 judges_string = re.sub("\xe2\x80\x94", "", judges_string)1320 judges_string = re.sub("Chief Justice", ",", judges_string)1321 judges_string = re.sub("Chief Judge", "", judges_string)1322 judges_string = re.sub("--", ",", judges_string)1323 judges_string = re.sub(" but ", "", judges_string)1324 judges_string = re.sub("Justices|JUSTICES|justices", "", judges_string)1325 judges_string = re.sub("JUSTICE\.", "", judges_string)1326 judges_string = re.sub("JUSTICE|Justice|justice", "", judges_string)1327 judges_string = re.sub("announced|Announced|ANNOUNCED", "", judges_string)1328 judges_string = re.sub("\*Link to the text of the note", "", judges_string)1329 judges_string = re.sub("Ariz\.Const\.", "", judges_string)1330 judges_string = re.sub("art\. VI", "", judges_string)1331 judges_string = re.sub(" art\.", "", judges_string)1332 judges_string = re.sub("Link to the text of the note", "", judges_string)1333 judges_string = re.sub("to the", "", judges_string)1334 judges_string = re.sub("prior", "", judges_string)1335 judges_string = re.sub("oral argument|argument", "", judges_string)1336 judges_string = re.sub("resigned", "", judges_string)1337 judges_string = re.sub("chief|Chief|CHIEF", "", judges_string)1338 judges_string = re.sub("AUTHOR", "", judges_string)1339 judges_string = re.sub("nonrecusal|NONRECUSAL|Nonrecusal", "", judges_string)1340 judges_string = re.sub("deeming", "", judges_string)1341 judges_string = re.sub("temporary", "", judges_string)1342 judges_string = re.sub("filed:", "", judges_string)1343 judges_string = re.sub("filed a|file a", "", judges_string)1344 judges_string = re.sub("President", "", judges_string)1345 judges_string = re.sub("Intermediate|intermediate|INTERMEDIATE", "", judges_string)1346 judges_string = re.sub("Associate|ASSOCIATE|associate", "", judges_string)1347 judges_string = re.sub("reasons|REASONS|Reasons|reason|REASON|Reason", "", judges_string)1348 judges_string = re.sub("Superior", "", judges_string)1349 judges_string = re.sub("constituting the", "", judges_string)1350 judges_string = re.sub("En Banc|en Banc", "", judges_string)1351 judges_string = re.sub("In Banc", "", judges_string)1352 judges_string = re.sub("cases|Cases|CASES", "", judges_string)1353 judges_string = re.sub("agreement|Agreement|AGREEMENT", "", judges_string)1354 judges_string = re.sub('"', "", judges_string)1355 judges_string = re.sub(" all | All | ALL ", "", judges_string)1356 judges_string = re.sub("Present|PRESENT|present", "", judges_string)1357 judges_string = re.sub("APPEALS", "", judges_string)1358 judges_string = re.sub(" THE", "", judges_string)1359 judges_string = re.sub("\xc3\x81", "a", judges_string)1360 judges_string = re.sub("WITHOUT", "", judges_string)1361 judges_string = re.sub("WITH", "", judges_string)1362 judges_string = re.sub("ASSIGNED BY REASON OF VACANCY|VACANCY|Vacancy", "", judges_string)1363 judges_string = re.sub("THIS", "", judges_string)1364 judges_string = re.sub("PELICONES|Pelicones", "", judges_string)1365 judges_string = re.sub("member|Member|MEMBER", "", judges_string)1366 judges_string = re.sub("disposition|Disposition|DISPOSITION", "", judges_string)1367 judges_string = re.sub(" right| Right| RIGHT", "", judges_string)1368 judges_string = re.sub("DISSENTS", "", judges_string)1369 judges_string = re.sub("WRITTEN|written|Written", "", judges_string)1370 judges_string = re.sub("WITHOUT|without", "", judges_string)1371 judges_string = re.sub("\xc3\xa9", "e", judges_string)1372 judges_string = re.sub(" took| TOOK| Took", "", judges_string)1373 judges_string = re.sub("Rule IV", "", judges_string)1374 judges_string = re.sub(" IV", "", judges_string)1375 judges_string = re.sub("C\. J\.,", "", judges_string)1376 judges_string = re.sub(" J\.,", "", judges_string)1377 judges_string = re.sub("assigned|Assigned|ASSIGNED|ASSIGNS|Assigns|assigns", "", judges_string)1378 judges_string = re.sub(" as ", "", judges_string)1379 judges_string = re.sub('"Agreement to Arbitrate"', "", judges_string)1380 judges_string = re.sub("Arbitrate\"", "", judges_string)1381 judges_string = re.sub("files a", "", judges_string)1382 judges_string = re.sub("former|Former|FORMER", "", judges_string)1383 judges_string = re.sub("C\.J\.,|Sp\.JJ|Sp\.J\.|Sp\. J\.|C\.J,|J\.P\.T\.|CJ,||A\.J\.V\.C\.J\.,|JJ\.,|Sp\.J\.|Js,|JS,|JJ\.,|JJ,|D\.J\.,|P\.J\.,|P\.\sJ\.,|C\.J\.,|J\.,|J\.| J,|C\. J\.,", "", judges_string)1384 judges_string = re.sub("C\.J\.|C\.J|CJ|JJ\.|Js|JS|JJ\.|JJ|D\.J\.|P\.J\.|P\.\sJ\.|C\.J\.|J\.|J\.|C\. J\.", "", judges_string)1385 judges_string = re.sub("C\.J\.|C\.J|CJ|JJ\.|Js|JS|JJ\.|JJ|D\.J\.|P\.J\.|P\.\sJ\.|C\.J\.|J\.|J\.|C\. J\.", "", judges_string)1386 judges_string = re.sub("Sp\.J\.", "", judges_string)1387 judges_string = re.sub("Part II\.A", "", judges_string)1388 judges_string = re.sub("Part II\.B", "", judges_string)1389 judges_string = re.sub("Parts II", "", judges_string)1390 judges_string = re.sub("Parts I", "", judges_string)1391 judges_string = re.sub("Part II", "", judges_string)1392 judges_string = re.sub("Part I", "", judges_string)1393 judges_string = re.sub("WoWe", "", judges_string)1394 judges_string = re.sub("foregoing|Foregoing|FOREGOING", "", judges_string)1395 judges_string = re.sub(" for| For| FOR", "", judges_string)1396 judges_string = re.sub("", "", judges_string)1397 judges_string = re.sub("[\(\[].*?[\)\]]", "", judges_string)1398 judges_string = re.sub("III", "", judges_string)1399 judges_string = re.sub("II\(\w\)", "", judges_string)1400 judges_string = re.sub("III\(\w\)", "", judges_string)1401 judges_string = re.sub(" II", "", judges_string)1402 judges_string = re.sub("III", "", judges_string)1403 judges_string = re.sub("Associate", "", judges_string)1404 judges_string = re.sub("Vice", "", judges_string)1405 judges_string = re.sub("\[\**\d*\]", "", judges_string)1406 judges_string = re.sub("Arbitrate|arbitrate|ARBITRATE", "", judges_string)1407 judges_string = re.sub("\xc2", "", judges_string)1408 judges_string = re.sub("BENCH|Bench|bench", "", judges_string)1409 judges_string = re.sub("(Before: |BEFORE: )", "", judges_string)1410 judges_string = re.sub("\xa0", " ", judges_string)1411 judges_string = re.sub("\/", "", judges_string)1412 judges_string = re.sub("\n|\r", " ", judges_string)1413 judges_string = re.sub("\(see p", " ", judges_string)1414 judges_string = re.sub("\(\d\)", "", judges_string)1415 judges_string = re.sub("\d", "", judges_string)1416 judges_string = re.sub("\(", "", judges_string)1417 judges_string = re.sub("\)", "", judges_string)1418 judges_string = re.sub("\sI,", "", judges_string)1419 judges_string = re.sub(" or ", "", judges_string)1420 judges_string = re.sub("Saylor|SAYLOR", "Saylor, ", judges_string)1421 judges_string = re.sub(" BY", "", judges_string)1422 judges_string = re.sub(" FOR", "", judges_string)1423 judges_string = re.sub("I;", "", judges_string)1424 judges_string = re.sub("Voting|VOTING|voting", "", judges_string)1425 judges_string = re.sub("Surrogate", "", judges_string)1426 judges_string = re.sub("\'", "", judges_string) #makes matching of judge names possible: O'Connor -> OConnor1427 judges_string = re.sub("judgment", "", judges_string)1428 judges_string = re.sub("SeeStuart|seestuart", "See, Stuart", judges_string)1429 if(re.search("unanimous view of the court|unanimous", judges_string)):1430 unanimous = 11431 judges_string = re.sub("unanimous view of the court", "", judges_string)1432 judges_string = re.sub("unanimous", "", judges_string)1433 judges_string = re.sub("Took no|Took No|took no|TOOK NO", "", judges_string)1434 judges_string = re.sub(" No,", "", judges_string)1435 judges_string = re.sub("separately|Separately|SEPARATELY", "", judges_string)1436 judges_string = re.sub("separate|Separate|SEPARATE", "", judges_string)1437 judges_string = re.sub("in place of", "", judges_string)1438 judges_string = re.sub("sections,", "", judges_string)1439 judges_string = re.sub("Sections,", "", judges_string)1440 judges_string = re.sub("sections", "", judges_string)1441 judges_string = re.sub("section,", "", judges_string)1442 judges_string = re.sub("Section,", "", judges_string)1443 judges_string = re.sub("section", "", judges_string)1444 judges_string = re.sub("constituting,", "", judges_string)1445 judges_string = re.sub("en banc,|en banc|En banc|En Banc|EN BANC", "", judges_string)1446 judges_string = re.sub("\[", "", judges_string)1447 judges_string = re.sub("\]", ",", judges_string)1448 judges_string = re.sub("concur in part and dissent in part|CONCUR IN PART AND DISSENT IN PART", " ", judges_string)1449 judges_string = re.sub("concurs in part and dissents in part|CONCURS IN PART AND DISSENTS IN PART", " ", judges_string)1450 judges_string = re.sub("concurs in the result, without opinion\.", "", judges_string)1451 judges_string = re.sub("all concurring", "", judges_string)1452 judges_string = re.sub("See separate opinion", "", judges_string)1453 judges_string = re.sub("concurring|Concurring|CONCURRING", "", judges_string)1454 judges_string = re.sub("concurrence|Concurrence|CONCURRENCE|Concurrence:", "", judges_string)1455 judges_string = re.sub("concurs", ",", judges_string)1456 judges_string = re.sub("concurred", ",", judges_string)1457 judges_string = re.sub("concur in", "", judges_string)1458 judges_string = re.sub("Concurs:|CONCURs:", "", judges_string)1459 judges_string = re.sub("concurs|Concurs|CONCURS", "", judges_string)1460 judges_string = re.sub("concur\.", ",", judges_string)1461 judges_string = re.sub("concur|Concur", "", judges_string)1462 judges_string = re.sub("CONCUR", ",", judges_string)1463 judges_string = re.sub("does", "", judges_string)1464 judges_string = re.sub("consideration", "", judges_string)1465 judges_string = re.sub("Md\.", "", judges_string)1466 judges_string = re.sub("Temporarily", "", judges_string)1467 judges_string = re.sub("Link to, text thee", "", judges_string)1468 judges_string = re.sub("assigns reasons", "", judges_string)1469 judges_string = re.sub("Appeals", "", judges_string)1470 judges_string = re.sub("retired|RETIRED|Retired|Ret|ret\.", "", judges_string)1471 judges_string = re.sub("assigned|Assigned|ASSIGNED|assignment|Assignment|ASSIGNNMENT", "", judges_string)1472 judges_string = re.sub("The ", "", judges_string)1473 judges_string = re.sub(" sat", "", judges_string)1474 judges_string = re.sub("delivered|delivers|Delivers|Delivered", "", judges_string)1475 judges_string = re.sub("PARTICIPATING", "", judges_string)1476 judges_string = re.sub("participating", "", judges_string)1477 judges_string = re.sub("PARTICIPATING", "", judges_string)1478 judges_string = re.sub("participating", "", judges_string)1479 judges_string = re.sub("Participating", "", judges_string)1480 judges_string = re.sub("did not participate", "", judges_string)1481 judges_string = re.sub("did not sit", "", judges_string)1482 judges_string = re.sub("did not", "", judges_string)1483 judges_string = re.sub("Maricopa County", "", judges_string)1484 judges_string = re.sub("County", "", judges_string)1485 judges_string = re.sub("WRITTEN BY:|Written by:", "", judges_string)1486 judges_string = re.sub("herein", "", judges_string)1487 judges_string = re.sub("not participate", "", judges_string)1488 judges_string = re.sub("participate", "", judges_string)1489 judges_string = re.sub("Presiding|PRESIDING", "", judges_string)1490 judges_string = re.sub("specially|Specially|SPECIALLY", "", judges_string)1491 judges_string = re.sub("special|Special|SPECIAL", "", judges_string)1492 judges_string = re.sub("pro-tem|Pro-Tem|PRO-TEM", "", judges_string)1493 judges_string = re.sub("concurring", "", judges_string)1494 judges_string = re.sub("Concurring", "", judges_string)1495 judges_string = re.sub("concurs in the result, without opinion\.", "", judges_string)1496 judges_string = re.sub("no opinion", "", judges_string)1497 judges_string = re.sub("opinion\.", ",", judges_string)1498 judges_string = re.sub("OPINIONS|OPINIONs|opinions|Opinions", "", judges_string)1499 judges_string = re.sub("opinion", "", judges_string)1500 judges_string = re.sub("Opinion", "", judges_string)1501 judges_string = re.sub(" full ", "", judges_string)1502 judges_string = re.sub("statement", "", judges_string)1503 judges_string = re.sub("files|file|FILES|FILE", "", judges_string)1504 judges_string = re.sub("Judicial Circuit", "", judges_string)1505 judges_string = re.sub("Part III", "", judges_string)1506 judges_string = re.sub("no part|NO PART|No Part", "", judges_string)1507 judges_string = re.sub("part", "", judges_string)1508 judges_string = re.sub("Part", "", judges_string)1509 judges_string = re.sub("PART", "", judges_string)1510 judges_string = re.sub("which|Which|WHICH", "", judges_string)1511 judges_string = re.sub("DENIED|denied", "", judges_string)1512 judges_string = re.sub("Majority|majority|MAJORITY", "", judges_string)1513 judges_string = re.sub("Heard|heard|HEARD", "", judges_string)1514 judges_string = re.sub("joining|JOINING|Joining", "", judges_string)1515 judges_string = re.sub("joined|JOINED|Joined", "", judges_string)1516 judges_string = re.sub("joins|JOINS|Joins", "", judges_string)1517 judges_string = re.sub("join|JOIN|Join", "", judges_string)1518 judges_string = re.sub("takes|taking|Taking|TAKING", "", judges_string)1519 judges_string = re.sub(" that", "", judges_string)1520 judges_string = re.sub("as to the rationale", "", judges_string)1521 judges_string = re.sub("the judgment", "", judges_string)1522 judges_string = re.sub("rationale", "", judges_string)1523 judges_string = re.sub("T\.Y\.|T\. Y\.", "", judges_string)1524 judges_string = re.sub("A\.M\.", "", judges_string)1525 judges_string = re.sub("F\.E\.", "", judges_string)1526 judges_string = re.sub("N\.C\.", "", judges_string)1527 judges_string = re.sub("Paul H\.", "", judges_string)1528 judges_string = re.sub("Russell A\.", "", judges_string)1529 judges_string = re.sub("G\. Barry", "", judges_string)1530 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1531 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1532 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1533 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1534 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1535 judges_string = re.sub("\.", ",", judges_string)1536 judges_string = re.sub("BEFORE", "", judges_string)1537 judges_string = re.sub("would", "", judges_string)1538 judges_string = re.sub("this", "", judges_string)1539 judges_string = re.sub("only", "", judges_string)1540 judges_string = re.sub("without", "", judges_string)1541 judges_string = re.sub("with", "", judges_string)1542 judges_string = re.sub(" out", "", judges_string)1543 judges_string = re.sub("also", "", judges_string)1544 judges_string = re.sub(" of", "", judges_string)1545 judges_string = re.sub(" view", "", judges_string)1546 judges_string = re.sub(" Not", "", judges_string)1547 judges_string = re.sub(" not", "", judges_string)1548 judges_string = re.sub(" NOT", "", judges_string)1549 judges_string = re.sub(" whom", "", judges_string)1550 judges_string = re.sub(" who", "", judges_string)1551 judges_string = re.sub("filed", "", judges_string)1552 judges_string = re.sub("expressing", "", judges_string)1553 judges_string = re.sub("but dissents", "", judges_string)1554 judges_string = re.sub("but dissent", "", judges_string)1555 judges_string = re.sub("but not the dissent", "", judges_string)1556 judges_string = re.sub("dissented", "", judges_string)1557 judges_string = re.sub("issued", ",", judges_string)1558 judges_string = re.sub("foregoing", "", judges_string)1559 judges_string = re.sub("agree", "", judges_string)1560 judges_string = re.sub("Opposed|opposed|OPPOSED", "", judges_string)1561 judges_string = re.sub("dissents", "", judges_string)1562 judges_string = re.sub("dissenting", "", judges_string)1563 judges_string = re.sub("DISSENTING", "", judges_string)1564 judges_string = re.sub("ENTIRE COURT", "", judges_string)1565 judges_string = re.sub(" as", "", judges_string)1566 judges_string = re.sub("reversal", "", judges_string)1567 judges_string = re.sub("none", "", judges_string)1568 judges_string = re.sub("Twelfth|Eleventh|Fifth|Tenth|Ninth|Eigth|Seventh|Sixth", "", judges_string)1569 judges_string = re.sub("Mr", "", judges_string)1570 judges_string = re.sub("remand", "", judges_string)1571 judges_string = re.sub("overruling", "", judges_string)1572 judges_string = re.sub("rehearing", "", judges_string)1573 judges_string = re.sub("OPINION", "", judges_string)1574 judges_string = re.sub("COURT", "", judges_string)1575 judges_string = re.sub("ONLY", "", judges_string)1576 judges_string = re.sub("IN RESULT", "", judges_string)1577 judges_string = re.sub(" IN ", "", judges_string)1578 judges_string = re.sub("Dissenting", "", judges_string)1579 judges_string = re.sub("Dissents", "", judges_string)1580 judges_string = re.sub("dissent\.", ",", judges_string)1581 judges_string = re.sub("dissent", "", judges_string)1582 judges_string = re.sub("Dissent", "", judges_string)1583 judges_string = re.sub("recuses|RECUSES|Recuses", "", judges_string)1584 judges_string = re.sub("recused|RECUSED|Recused", "", judges_string)1585 judges_string = re.sub("recuse|RECUSE|Recuse", "", judges_string)1586 judges_string = re.sub("SEPARATELY", "", judges_string)1587 judges_string = re.sub("PRO-TEM", "", judges_string)1588 judges_string = re.sub("reserves", "", judges_string)1589 judges_string = re.sub("is disqualified|disqualified|disqualification", "", judges_string)1590 judges_string = re.sub("recused themselves", "", judges_string)1591 judges_string = re.sub("recused", "", judges_string)1592 judges_string = re.sub("Recused", "", judges_string)1593 judges_string = re.sub("deceased", "", judges_string)1594 judges_string = re.sub("in the result", "", judges_string)1595 judges_string = re.sub("the result", "", judges_string)1596 judges_string = re.sub("result|Result|RESULT", "", judges_string)1597 judges_string = re.sub(" acting ", "", judges_string)1598 judges_string = re.sub(" and ", ",", judges_string)1599 judges_string = re.sub(" AND ", ",", judges_string)1600 judges_string = re.sub(" an", ",", judges_string)1601 judges_string = re.sub("application|Application|APPLICATION", ", ", judges_string)1602 judges_string = re.sub("dismissed|Dismissed|DISMISSED", ", ", judges_string)1603 judges_string = re.sub("entitled|Entitled|ENTITLED", ", ", judges_string)1604 judges_string = re.sub("appeal|Appeal|APPEAL", ", ", judges_string)1605 judges_string = re.sub(" the ", ", ", judges_string)1606 judges_string = re.sub(" as to", ", ", judges_string)1607 judges_string = re.sub("decision", ", ", judges_string)1608 judges_string = re.sub("final", ", ", judges_string)1609 judges_string = re.sub(" in a", "", judges_string)1610 judges_string = re.sub("in the", "", judges_string)1611 judges_string = re.sub(" In | in ", "", judges_string)1612 judges_string = re.sub(" in,", "", judges_string)1613 judges_string = re.sub(" of", "", judges_string)1614 judges_string = re.sub(" OF", "", judges_string)1615 judges_string = re.sub(" from", "", judges_string)1616 judges_string = re.sub("herself", "", judges_string)1617 judges_string = re.sub("himself", "", judges_string)1618 judges_string = re.sub("themselves", "", judges_string)1619 judges_string = re.sub("expresses", "", judges_string)1620 judges_string = re.sub("ii", "", judges_string)1621 judges_string = re.sub(" cases| Cases", "", judges_string)1622 judges_string = re.sub("case", "", judges_string)1623 judges_string = re.sub("Case", "", judges_string)1624 judges_string = re.sub(" by", "", judges_string)1625 judges_string = re.sub("heard", "", judges_string)1626 judges_string = re.sub("DENVIRSTITH", "STITH", judges_string)1627 judges_string = re.sub("considered", "", judges_string)1628 judges_string = re.sub("decided", "", judges_string)1629 judges_string = re.sub("time", "", judges_string)1630 judges_string = re.sub("submission", "", judges_string)1631 judges_string = re.sub("\&", "", judges_string)1632 judges_string = re.sub("were designated", "", judges_string)1633 judges_string = re.sub("is designated|designated|designation", "", judges_string)1634 judges_string = re.sub(" All |ALL ", "", judges_string)1635 judges_string = re.sub("is sitting", "", judges_string)1636 judges_string = re.sub("sitting|SITTING|Sitting", "", judges_string)1637 judges_string = re.sub(" sit", "", judges_string)1638 judges_string = re.sub(" superior", "", judges_string)1639 judges_string = re.sub(" under", "", judges_string)1640 judges_string = re.sub("Cavanaugh|CAVANAUGH", "Cavanagh", judges_string)1641 judges_string = re.sub("WHOLE|Whole|whole", "", judges_string)1642 judges_string = re.sub("deny", "", judges_string)1643 judges_string = re.sub("Matter|MATTER|matter", "", judges_string)1644 judges_string = re.sub(" otherwise|Otherwise|OTHERWISE", "", judges_string)1645 judges_string = re.sub(" leave", "", judges_string)1646 judges_string = re.sub(" others| other| Other| OTHER", "", judges_string)1647 judges_string = re.sub(" vote|votes to", "", judges_string)1648 judges_string = re.sub("RSA", "", judges_string)1649 judges_string = re.sub("memorandum", "", judges_string)1650 judges_string = re.sub("took no", "", judges_string)1651 judges_string = re.sub("syllabus", "", judges_string)1652 judges_string = re.sub("Appellate District", "", judges_string)1653 judges_string = re.sub("District|district", "", judges_string)1654 judges_string = re.sub("Administrative", "", judges_string)1655 judges_string = re.sub("i-v", "", judges_string)1656 judges_string = re.sub("follows", "", judges_string)1657 judges_string = re.sub("Judicial", "", judges_string)1658 judges_string = re.sub("By:", "", judges_string)1659 judges_string = re.sub("Panel:", "", judges_string)1660 judges_string = re.sub(":\s", "", judges_string)1661 judges_string = re.sub(":", "", judges_string)1662 judges_string = re.sub("authored|Authored|AUTHORED", "", judges_string)1663 judges_string = re.sub(" to ", "", judges_string)1664 judges_string = re.sub("DISSENT", "", judges_string)1665 judges_string = re.sub(" each", "", judges_string)1666 judges_string = re.sub("Jr|jr|JR", "", judges_string)1667 judges_string = re.sub("denial", "", judges_string)1668 judges_string = re.sub("Sr|sr|SR", "", judges_string)1669 judges_string = re.sub("Deceased|deceased|DECEASED", "", judges_string)1670 judges_string = re.sub("lead|LEAD|Lead", "", judges_string)1671 judges_string = re.sub(" was | WAS | Was", "", judges_string)1672 judges_string = re.sub(" other", "", judges_string)1673 judges_string = re.sub("writing", "", judges_string)1674 judges_string = re.sub("Writ|writ|WRIT", "", judges_string)1675 judges_string = re.sub("take|TAKE|Take", "", judges_string)1676 judges_string = re.sub("Issued|issued|ISSUED", "", judges_string)1677 judges_string = re.sub("Madame|MADAME|madame", "", judges_string)1678 judges_string = re.sub("Visiting|VISITING|visiting", "", judges_string)1679 judges_string = re.sub("acting|ACTING|Acting", "", judges_string)1680 judges_string = re.sub("having|Having|HAVING", "", judges_string)1681 judges_string = re.sub("reverse", "", judges_string)1682 judges_string = re.sub("O'NEILL to|O'NEILLto", "O'NEILL", judges_string)1683 judges_string = re.sub(" is ", "", judges_string)1684 judges_string = re.sub("Third", "", judges_string)1685 judges_string = re.sub(" John ", "", judges_string)1686 judges_string = re.sub("Boucier", "Bourcier", judges_string)1687 judges_string = re.sub(" to ", "", judges_string)1688 judges_string = re.sub(",to ", "", judges_string)1689 judges_string = re.sub("Ralmon", "Almon", judges_string)1690 judges_string = re.sub("Fabec", "Fabe", judges_string)1691 judges_string = re.sub(" ir ", "", judges_string)1692 judges_string = re.sub("Estaugh", "Eastaugh", judges_string)1693 judges_string = re.sub("Modification", "", judges_string)1694 judges_string = re.sub("Vacation", "", judges_string)1695 judges_string = re.sub(",d,", "", judges_string)1696 judges_string = re.sub("Division Two|Two", "", judges_string)1697 judges_string = re.sub("dS", "", judges_string)1698 judges_string = re.sub("NOTE", "", judges_string)1699 judges_string = re.sub("dI", "", judges_string)1700 judges_string = re.sub("dX", "", judges_string)1701 judges_string = re.sub("were", "", judges_string)1702 judges_string = re.sub("pursuant", "", judges_string)1703 judges_string = re.sub("determination ", "", judges_string)1704 judges_string = re.sub("Division One", "", judges_string)1705 judges_string = re.sub("article IV", "", judges_string)1706 judges_string = re.sub("Article|ARTICLE|article", "", judges_string)1707 judges_string = re.sub("Arizona", "", judges_string)1708 judges_string = re.sub("Second", "", judges_string)1709 judges_string = re.sub("Council", "", judges_string)1710 judges_string = re.sub("Chairperson", "", judges_string)1711 judges_string = re.sub("not on panel|on panel|panel", "", judges_string)1712 judges_string = re.sub("Division Four", "", judges_string)1713 judges_string = re.sub("to conviction|conviction", "", judges_string)1714 judges_string = re.sub("to sentence|sentence", "", judges_string)1715 judges_string = re.sub("additional", "", judges_string)1716 judges_string = re.sub("following", "", judges_string)1717 judges_string = re.sub("subscribes|subscribe", "", judges_string)1718 judges_string = re.sub("ORAL ARGUMENT", "", judges_string)1719 judges_string = re.sub("DENIAL", "", judges_string)1720 judges_string = re.sub(" ONE ", "", judges_string)1721 judges_string = re.sub("TWO", "", judges_string)1722 judges_string = re.sub("THREE", "", judges_string)1723 judges_string = re.sub(" have", "", judges_string)1724 judges_string = re.sub("unconstitutional", "", judges_string)1725 judges_string = re.sub("follow", "", judges_string)1726 judges_string = re.sub("chapter", "", judges_string)1727 judges_string = re.sub("Lesson", "Leeson", judges_string)1728 judges_string = re.sub("Before", "", judges_string)1729 judges_string = re.sub("Per Curiam|Curiam", "", judges_string)1730 judges_string = re.sub("causesubmitted", "", judges_string)1731 judges_string = re.sub("on briefs|briefs|brief", "", judges_string)1732 judges_string = re.sub("Division", "", judges_string)1733 judges_string = re.sub("absent", "", judges_string)1734 judges_string = re.sub(" IV,", "", judges_string)1735 judges_string = re.sub(" when", "", judges_string)1736 judges_string = re.sub(" inof", "", judges_string)1737 judges_string = re.sub("Order", "", judges_string)1738 judges_string = re.sub("absent", "", judges_string)1739 judges_string = re.sub(" to ", "", judges_string)1740 judges_string = re.sub("tohis ", "", judges_string)1741 judges_string = re.sub("toother|TOOTHER|to other", "", judges_string)1742 judges_string = string.strip(judges_string)1743 judges_string = re.sub(", ,", ",", judges_string)1744 judges_string = re.sub("s V", "", judges_string)1745 judges_string = re.sub(" VI,", "", judges_string)1746 judges_string = re.sub('DENVIR STITH', 'Stith', judges_string)1747 judges_string = re.sub('remainder|Remainder|REMAINDER', '', judges_string)1748 judges_string = re.sub(' Wo,', '', judges_string)1749 judges_string = re.sub(' Eighth', '', judges_string)1750 judges_string = re.sub('its entirety', '', judges_string)1751 judges_string = re.sub('entirety', '', judges_string)1752 #print judges_string1753 judges_line = False1754 judges_part_string = first_sentence(judges_string)1755 judges_holder = re.sub("\*|\d", "", judges_part_string)1756 judges_holder = re.sub("Before:* ", "", judges_holder)1757 judges_holder = re.sub(", (Circuit|Circuit) (J|j)udge[s]?\.?", "", judges_holder)1758 judges_holder = re.sub(", (District|DISTRICT) (J|j)udge[s]?\.?", "", judges_holder)1759 judges_holder = re.sub("Chief Judge", "", judges_holder)1760 judges_holder = re.sub("Senior Judge", "", judges_holder)1761 judges_holder = re.sub("Justice[s]", "", judges_holder)1762 judges_holder = re.sub("Chief District Judge", "", judges_holder)1763 judges_holder = re.sub("Associate Justice", "", judges_holder)1764 judges_holder = re.sub("Administrative Justice", "", judges_holder)1765 judges_holder = re.sub("Administrative Judge", "", judges_holder)1766 judges_holder = re.sub("(P|p)ro (T|t)em", "", judges_holder)1767 judges_holder = re.sub(", (Jr\.|JR\.|Jr|jr)", "", judges_holder)1768 judges_holder = re.sub(", (Sr\.|SR\.)", "Sr.", judges_holder)1769 judges_holder = re.sub(", III", "III", judges_holder)1770 judges_holder = re.sub(", II", "II", judges_holder)1771 judges_holder = re.sub(";", ",", judges_holder)1772 judges_holder = re.sub(",[\s]*,", ",", judges_holder)1773 judges_holder = re.sub(" and ", ", ", judges_holder)1774 judges_holder = re.sub(" \. ", " ", judges_holder)1775 judges_holder = re.sub("[\s]+", " ", judges_holder)1776 judges_holder = re.sub("C\.J\.,|Supr\. J\.|J\.P\.T\.|Sp\.J\.|S\.J\.|P\.JJ\.|JJ\.,|JJ\.|D\.J\.,|P\.J\.,|C\.J\.|J\.,|J\.|C\. J\.", ",", judges_holder)1777 judges_holder = re.sub("\xc3\xa1", "a", judges_holder)1778 judges_holder = re.split(",", judges_holder)1779 judges_holder = judges_holder + non_panel_list1780 judges_holder = [word for word in judges_holder if word != ""]1781 judges_holder = [word.strip() for word in judges_holder if word != ""]1782 judges_holder = [word.upper() for word in judges_holder if word != ""]1783 judges_holder = list(set(judges_holder))1784 # Apply functions to judge names to format the names of each justice uniformly1785 if (len(judges_holder) == 1):1786 judge1_ln = lastname(judges_holder[0])1787 judge1_fn = firstname(judges_holder[0])1788 judge1_mn = middlename(judges_holder[0])1789 judge1_suf = namesuffix(judges_holder[0])1790 judge1_full = judge1_ln + ", " + judge1_fn + " " + judge1_mn + " " + judge1_suf1791 judge1_full = re.sub("[\s]+", " ", judge1_full)1792 judge1_full = re.sub(", $", "", judge1_full)1793 if len(judge1_ln) < 2:1794 judge1_ln = ""1795 judge1_vote = ""1796 if (len(judges_holder) > 1):1797 judge1_ln = lastname(judges_holder[0])1798 judge1_fn = firstname(judges_holder[0])1799 judge1_mn = middlename(judges_holder[0])1800 judge1_suf = namesuffix(judges_holder[0])1801 judge1_full = judge1_ln + ", " + judge1_fn + " " + judge1_mn + " " + judge1_suf1802 judge1_full = re.sub("[\s]+", " ", judge1_full)1803 judge1_full = re.sub(", $", "", judge1_full)1804 if len(judge1_ln) < 2:1805 judge1_ln = ""1806 judge1_vote = ""1807 #print judges_holder[0]1808 judge2_ln = lastname(judges_holder[1])1809 #print judge2_ln1810 judge2_fn = firstname(judges_holder[1])1811 judge2_mn = middlename(judges_holder[1])1812 judge2_suf = namesuffix(judges_holder[1])1813 judge2_full = judge2_ln + ", " + judge2_fn + " " + judge2_mn + " " + judge2_suf1814 judge2_full = re.sub("[\s]+", " ", judge2_full)1815 judge2_full = re.sub(", $", "", judge2_full)1816 if len(judge2_ln) < 2:1817 judge2_ln = ""1818 judge2_vote = ""1819 if (len(judges_holder) > 2):1820 judge3_ln = lastname(judges_holder[2])1821 judge3_fn = firstname(judges_holder[2])1822 judge3_mn = middlename(judges_holder[2])1823 judge3_suf = namesuffix(judges_holder[2])1824 judge3_full = judge3_ln + ", " + judge3_fn + " " + judge3_mn + " " + judge3_suf1825 judge3_full = re.sub("[\s]+", " ", judge3_full)1826 judge3_full = re.sub(", $", "", judge3_full)1827 if len(judge3_ln) < 2:1828 judge3_ln = ""1829 judge3_vote = ""1830 if (len(judges_holder) > 3):1831 judge4_ln = lastname(judges_holder[3])1832 judge4_fn = firstname(judges_holder[3])1833 judge4_mn = middlename(judges_holder[3])1834 judge4_suf = namesuffix(judges_holder[3])1835 judge4_full = judge4_ln + ", " + judge4_fn + " " + judge4_mn + " " + judge4_suf1836 judge4_full = re.sub("[\s]+", " ", judge4_full)1837 judge4_full = re.sub(", $", "", judge4_full)1838 if len(judge4_ln) < 2:1839 judge4_ln = ""1840 judge4_vote = ""1841 if (len(judges_holder) > 4):1842 judge5_ln = lastname(judges_holder[4])1843 judge5_fn = firstname(judges_holder[4])1844 judge5_mn = middlename(judges_holder[4])1845 judge5_suf = namesuffix(judges_holder[4])1846 judge5_full = judge5_ln + ", " + judge5_fn + " " + judge5_mn + " " + judge5_suf1847 judge5_full = re.sub("[\s]+", " ", judge5_full)1848 judge5_full = re.sub(", $", "", judge5_full)1849 if len(judge5_ln) < 2:1850 judge5_ln = ""1851 judge5_vote = ""1852 if (len(judges_holder) > 5):1853 judge6_ln = lastname(judges_holder[5])1854 judge6_fn = firstname(judges_holder[5])1855 judge6_mn = middlename(judges_holder[5])1856 judge6_suf = namesuffix(judges_holder[5])1857 judge6_full = judge6_ln + ", " + judge6_fn + " " + judge6_mn + " " + judge6_suf1858 judge6_full = re.sub("[\s]+", " ", judge6_full)1859 judge6_full = re.sub(", $", "", judge6_full)1860 if len(judge6_ln) < 2:1861 judge6_ln = ""1862 judge6_vote = ""1863 if (len(judges_holder) > 6):1864 judge7_ln = lastname(judges_holder[6])1865 judge7_fn = firstname(judges_holder[6])1866 judge7_mn = middlename(judges_holder[6])1867 judge7_suf = namesuffix(judges_holder[6])1868 judge7_full = judge7_ln + ", " + judge7_fn + " " + judge7_mn + " " + judge7_suf1869 judge7_full = re.sub("[\s]+", " ", judge7_full)1870 judge7_full = re.sub(", $", "", judge7_full)1871 if len(judge7_ln) < 2:1872 judge7_ln = ""1873 judge7_vote = ""1874 if (len(judges_holder) > 7):1875 judge8_ln = lastname(judges_holder[7])1876 judge8_fn = firstname(judges_holder[7])1877 judge8_mn = middlename(judges_holder[7])1878 judge8_suf = namesuffix(judges_holder[7])1879 judge8_full = judge8_ln + ", " + judge8_fn + " " + judge8_mn + " " + judge8_suf1880 judge8_full = re.sub("[\s]+", " ", judge8_full)1881 judge8_full = re.sub(", $", "", judge8_full)1882 if len(judge8_ln) < 2:1883 judge8_ln = ""1884 judge8_vote = ""1885 if (len(judges_holder) > 8):1886 judge9_ln = lastname(judges_holder[8])1887 judge9_fn = firstname(judges_holder[8])1888 judge9_mn = middlename(judges_holder[8])1889 judge9_suf = namesuffix(judges_holder[8])1890 judge9_full = judge9_ln + ", " + judge9_fn + " " + judge9_mn + " " + judge9_suf1891 judge9_full = re.sub("[\s]+", " ", judge9_full)1892 judge9_full = re.sub(", $", "", judge9_full)1893 if len(judge9_ln) < 2:1894 judge9_ln = ""1895 judge9_vote = ""1896 if (len(judges_holder) > 9):1897 judge10_ln = lastname(judges_holder[9])1898 judge10_fn = firstname(judges_holder[9])1899 judge10_mn = middlename(judges_holder[9])1900 judge10_suf = namesuffix(judges_holder[9])1901 judge10_full = judge10_ln + ", " + judge10_fn + " " + judge10_mn + " " + judge10_suf1902 judge10_full = re.sub("[\s]+", " ", judge10_full)1903 judge10_full = re.sub(", $", "", judge10_full)1904 if len(judge10_ln) < 2:1905 judge10_ln = ""1906 judge10_vote = ""1907 if (len(judges_holder) > 10):1908 judge11_ln = lastname(judges_holder[10])1909 judge11_fn = firstname(judges_holder[10])1910 judge11_mn = middlename(judges_holder[10])1911 judge11_suf = namesuffix(judges_holder[10])1912 judge11_full = judge11_ln + ", " + judge11_fn + " " + judge11_mn + " " + judge11_suf1913 judge11_full = re.sub("[\s]+", " ", judge11_full)1914 judge11_full = re.sub(", $", "", judge11_full)1915 if len(judge11_ln) < 2:1916 judge11_ln = ""1917 judge11_vote = ""1918 if (len(judges_holder) > 11):1919 check_case = 11920 if len(judge_np_list) == 0:1921 judge_np1 = ""1922 elif len(judge_np_list) == 1:1923 judge_np1 = judge_np_list[0].strip()1924 judge_np1 = re.sub(",", "", judge_np1)1925 judge_np1 = re.sub("\\xc2\\xa0", "", judge_np1)1926 if len(judge_np1) > 10:1927 judge_np1 = judge_np1.split(' ', 1)[0]1928 elif len(judge_np_list) == 2:1929 judge_np1 = judge_np_list[0].strip()1930 judge_np1 = re.sub(",", "", judge_np1)1931 judge_np2 = judge_np_list[1].strip()1932 judge_np2 = re.sub(",", "", judge_np2)1933 elif len(judge_np_list) > 2:1934 judge_np1 = judge_np_list[0].strip()1935 judge_np1 = re.sub(",", "", judge_np1)1936 judge_np2 = judge_np_list[1].strip()1937 judge_np2 = re.sub(",", "", judge_np2)1938 judge_np3 = judge_np_list[2].strip()1939 judge_np3 = re.sub(",", "", judge_np3)1940 judge_np1 = re.sub("\.", "", judge_np1)1941 judge_np2 = re.sub("\.", "", judge_np2)1942 judge_np3 = re.sub("\.", "", judge_np3)1943 judge_np1 = re.sub("\\\\n", "", judge_np1)1944 judge_np2 = re.sub("\\\\n", "", judge_np2)1945 judge_np3 = re.sub("\\\\n", "", judge_np3)1946 judge_np1 = re.sub("\n", "", judge_np1)1947 judge_np2 = re.sub("\n", "", judge_np2)1948 judge_np3 = re.sub("\n", "", judge_np3)1949 judge_np1 = re.sub(", Chief", "", judge_np1)1950 judge_np2 = re.sub(", Chief", "", judge_np2)1951 judge_np3 = re.sub(", Chief", "", judge_np3)1952 judge_np1 = re.sub("Judges:", "", judge_np1)1953 judge_np2 = re.sub("Judges:", "", judge_np2)1954 judge_np3= re.sub("Judges:", "", judge_np3)1955 judge_np1 = re.sub("All the concur, except", "", judge_np1)1956 judge_np2 = re.sub("All the concur, except", "", judge_np2)1957 judge_np3 = re.sub("All the concur, except", "", judge_np3)1958 judge_np1 = re.sub("\xc2\xa0:", "", judge_np1)1959 judge_np2 = re.sub("\xc2\xa0:", "", judge_np2)1960 judge_np3 = re.sub("\xc2\xa0:", "", judge_np3)1961 judge_np1 = re.sub(", ", "", judge_np1)1962 judge_np2 = re.sub(", ", "", judge_np2)1963 judge_np3 = re.sub(", ", "", judge_np3)1964 judge_np1 = judge_np1.strip()1965 judge_np2 = judge_np2.strip()1966 judge_np3 = judge_np3.strip()1967 judge_np1 = Capitalize(judge_np1)1968 judge_np2 = Capitalize(judge_np2)1969 judge_np3 = Capitalize(judge_np3)1970 judge1_ln = lastname(judge1_ln)1971 judge2_ln = lastname(judge2_ln)1972 judge3_ln = lastname(judge3_ln)1973 judge4_ln = lastname(judge4_ln)1974 judge5_ln = lastname(judge5_ln)1975 judge6_ln = lastname(judge6_ln)1976 judge7_ln = lastname(judge7_ln)1977 judge8_ln = lastname(judge8_ln)1978 judge9_ln = lastname(judge9_ln)1979 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln, judge8_ln, judge9_ln1980 # Remove justices that did not participate based on previously stored list of non-participating judges; remove votes from these justices as well1981 if (judge1_ln == judge_np1 or judge1_ln == judge_np2 or judge1_ln == judge_np3 or judge1_ln == judge_np4):1982 judge1_ln = ""1983 judge1_vote = ""1984 if (judge2_ln == judge_np1 or judge2_ln == judge_np2 or judge2_ln == judge_np3 or judge2_ln == judge_np4):1985 judge2_ln = ""1986 judge2_vote = ""1987 if (judge3_ln == judge_np1 or judge3_ln == judge_np2 or judge3_ln == judge_np3 or judge3_ln == judge_np4):1988 judge3_ln = ""1989 judge3_vote = ""1990 if (judge4_ln == judge_np1 or judge4_ln == judge_np2 or judge4_ln == judge_np3 or judge4_ln == judge_np4):1991 judge4_ln = ""1992 judge4_vote = ""1993 if (judge5_ln == judge_np1 or judge5_ln == judge_np2 or judge5_ln == judge_np3 or judge5_ln == judge_np4):1994 judge5_ln = ""1995 judge5_vote = ""1996 if (judge6_ln == judge_np1 or judge6_ln == judge_np2 or judge6_ln == judge_np3 or judge6_ln == judge_np4):1997 judge6_ln = ""1998 judge6_vote = ""1999 if (judge7_ln == judge_np1 or judge7_ln == judge_np2 or judge7_ln == judge_np3 or judge7_ln == judge_np4):2000 judge7_ln = ""2001 judge7_vote = ""2002 if (judge8_ln == judge_np1 or judge8_ln == judge_np2 or judge8_ln == judge_np3 or judge8_ln == judge_np4):2003 judge8_ln = ""2004 judge8_vote = ""2005 if (judge9_ln == judge_np1 or judge9_ln == judge_np2 or judge9_ln == judge_np3 or judge9_ln == judge_np4):2006 judge9_ln = ""2007 judge9_vote = ""2008 if (judge10_ln == judge_np1 or judge10_ln == judge_np2 or judge10_ln == judge_np3 or judge10_ln == judge_np4):2009 judge10_ln = ""2010 judge10_vote = ""2011 if (judge11_ln == judge_np1 or judge11_ln == judge_np2 or judge11_ln == judge_np3 or judge11_ln == judge_np4 ):2012 judge11_ln = ""2013 judge11_vote = ""2014 # Determine if a dissenting opinion is present2015 if (re.search("dissent|DISSENT|dissents|Dissents|dissenting|Dissenting|DISSENTING", judges_string)):2016 jud_dissent = 12017 # Determine if a decision was unanimous2018 if (re.search("(U|u)nanimous|UNANIMOUS", judges_string)):2019 unanimous = 12020 if(unanimous == 1 and re.search("concurred\.", txtline)): ###build out to parse judge list into single judges2021 new_judges = txtline2022 new_judges = re.sub("C\.\sJ\.,", "", new_judges)2023 new_judges = re.sub("J\.,", "", new_judges)2024 new_judges = re.sub(" and", "", new_judges)2025 new_judges = re.sub("concurred\.", "", new_judges)2026 new_judges = re.sub("\[\*+[0-9]+\]", "", new_judges)2027 new_judges = re.sub("\s", "", new_judges)2028 new_judges = new_judges.split(",")2029 judges_holder = [judges_holder.pop(0)] + new_judges2030 if (len(judges_holder) > 1):2031 judge1_ln = lastname(judges_holder[0])2032 judge2_ln = lastname(judges_holder[1])2033 if (len(judges_holder) > 2):2034 judge3_ln = lastname(judges_holder[2])2035 if (len(judges_holder) > 3):2036 judge4_ln = lastname(judges_holder[3])2037 if (len(judges_holder) > 4):2038 judge5_ln = lastname(judges_holder[4])2039 if (len(judges_holder) > 5):2040 judge6_ln = lastname(judges_holder[5])2041 if (len(judges_holder) > 6):2042 judge7_ln = lastname(judges_holder[6])2043 if (len(judges_holder) > 7):2044 judge8_ln = lastname(judges_holder[7])2045 if (len(judges_holder) > 8):2046 judge9_ln = lastname(judges_holder[8])2047 # Store name of justice writing the majority opinion and format name2048 if (re.match("^Opinion by:", txtline) and not trunc_text):2049 opin_by_line = True2050 if (opin_by_line and re.search("[\w]+", txtline)):2051 opin_by_string = opin_by_string + txtline2052 if (opin_by_line and re.match("^[\s]+$", txtline)):2053 # blank line after opinion by line2054 opin_by_string = re.sub("Opinion by:", "", opin_by_string)2055 opin_by_string = re.sub("FOR THE COURT;", "", opin_by_string)2056 opin_by_string = re.sub("\[\*+\d+\]", "", opin_by_string)2057 opin_by_string = re.sub("\*[\d]*", "", opin_by_string)2058 opin_by_string = re.sub(", Circuit Judge", "", opin_by_string)2059 opin_by_string = re.sub("Chief Justice:", "", opin_by_string)2060 opin_by_string = re.sub("\xc2", "", opin_by_string)2061 opin_by_string = re.sub("'", "", opin_by_string)2062 opin_by_string = re.sub("Sr\.|SR\.|Jr\.|JR\.", "", opin_by_string)2063 opin_by_string = re.sub("\xa0", "", opin_by_string)2064 opin_by_string = re.sub("C\.\sJ\.|C\.J\.|J\.J\.|J\.\sJ\.|J\.", "", opin_by_string)2065 opin_by_string = re.sub("T\.Y\.|T\. Y\.", "", opin_by_string)2066 opin_by_string = re.sub(" C\.", "", opin_by_string)2067 opin_by_string = re.sub("\xc3\x81", "a", opin_by_string)2068 opin_by_string = re.sub("III", "", opin_by_string)2069 opin_by_string = re.sub("\xc3\x81", "a", opin_by_string)2070 opin_by_string = re.sub(" ILL| ill", "ONEILL", opin_by_string)2071 opin_by_string = re.sub("Justice|JUSTICE", "", opin_by_string)2072 opin_by_string = re.sub('DENVIR STITH|DENVIRSTITH', 'Stith', opin_by_string)2073 opin_by_string = string.strip(opin_by_string)2074 opin_by_line = False2075 author_ln = lastname(opin_by_string)2076 author_fn = firstname(opin_by_string)2077 author_mn = middlename(opin_by_string)2078 author_suf = namesuffix(opin_by_string)2079 author_full = author_ln + ", " + author_fn + " " + author_mn + " " + author_suf2080 author_full = re.sub("[\s]+", " ", author_full)2081 author_full = re.sub(", $", "", author_full)2082 if(Capitalize(judge1_ln) != Capitalize(author_ln)):2083 judge11_ln = judge10_ln2084 judge10_ln = judge9_ln2085 judge9_ln = judge8_ln2086 judge8_ln = judge7_ln2087 judge7_ln = judge6_ln2088 judge6_ln = judge5_ln2089 judge5_ln = judge4_ln2090 judge4_ln = judge3_ln2091 judge3_ln = judge2_ln2092 judge2_ln = judge1_ln2093 judge1_ln = author_ln2094 judge11_vote = judge10_vote2095 judge10_vote = judge9_vote2096 judge9_vote = judge8_vote2097 judge8_vote = judge7_vote2098 judge7_vote = judge6_vote2099 judge6_vote = judge5_vote2100 judge5_vote = judge4_vote2101 judge4_vote = judge3_vote2102 judge3_vote = judge2_vote2103 judge2_vote = judge1_vote2104 judge1_vote = 12105 if (re.match("^Opinion", txtline) and not trunc_text and not blank_after_firstcite and not re.search("^Opinion No.",txtline)):2106 opinion_line = True2107 opinion_start = True2108 if (re.match(re.escape("********** Print Completed **********"), txtline) or re.match("APPENDIX", txtline) or re.match("^CONCUR BY:", txtline) or re.match("^DISSENT BY:", txtline)):2109 opinion_line = False2110 if opinion_line:2111 op_string = txtline2112 op_holder = re.sub("^Opinion", " ", op_string)2113 op_holder = re.sub("\xa0", " ", op_holder)2114 op_holder = re.sub("\n|\r", " ", op_holder)2115 op_holder = re.sub("\[\*+[0-9]+\]", " ", op_holder)2116 op_holder = string.strip(op_holder)2117 op_holder = re.split("\s+", op_holder)2118 op_holder = [word for word in op_holder if word != ""]2119 opinion_word_count += len(op_holder)2120 judge1_vote = 12121 if (re.search("AMICUS|amicus|Amicus", op_string)):2122 amicus = 12123 if (re.search("^Dissent", txtline)):2124 dissent_line = True2125 # If Lexis lists a line beginning with "Dissent:", store the justices listed after2126 if (re.match("^Dissent by:|^DISSENT BY:", txtline) and not trunc_text):2127 dissent_by_line = True2128 dissent = 12129 if (dissent_by_line and re.search("[\w]+", txtline)):2130 dissent_by_string = dissent_by_string + txtline2131 # Format dissenting justice names2132 if (dissent_by_line and re.match("^[\s]+$", txtline)):2133 silent_dissent = True2134 dissent_by_string = string.strip(dissent_by_string)2135 dissent_by_string = re.sub("\n", "", dissent_by_string)2136 dissent_by_string = re.sub("Dissent by:|DISSENT BY:", "", dissent_by_string)2137 dissent_by_string = re.sub("\[.+\]", "", dissent_by_string)2138 dissent_by_string = re.sub("[\s]*\(In[\s]*(P|p)art\)", "", dissent_by_string)2139 dissent_by_string = re.sub("\*\d+", "", dissent_by_string)2140 dissent_by_string = re.sub("dissenting:|dissenting", "", dissent_by_string)2141 dissent_by_string = re.sub("Justice|JUSTICE", "", dissent_by_string)2142 dissent_by_string = re.sub("\d+", "", dissent_by_string)2143 dissent_by_string = re.sub("\xc2", "", dissent_by_string)2144 dissent_by_string = re.sub("\xa0", "", dissent_by_string)2145 dissent_by_string = re.sub("J;", "", dissent_by_string)2146 dissent_by_string = re.sub("C\.J\.|C\. J\.|J\.J\.|JJ\.|J\. J\.|J\.", "", dissent_by_string)2147 dissent_by_string = re.sub("[\(\[].*?[\)\]]", "", dissent_by_string)2148 dissent_by_string = re.sub("'", "", dissent_by_string)2149 dissent_by_string = re.sub("affirmed", "", dissent_by_string)2150 dissent_by_string = re.sub("filed an opinion concurring in part and in part", "", dissent_by_string)2151 dissent_by_string = re.sub("concurring in part", "", dissent_by_string)2152 dissent_by_string = re.sub("in which", "", dissent_by_string)2153 dissent_by_string = re.sub("of which", "", dissent_by_string)2154 dissent_by_string = re.sub("joined", "", dissent_by_string)2155 dissent_by_string = re.sub("Part I", "", dissent_by_string)2156 dissent_by_string = re.sub("Part", "", dissent_by_string)2157 dissent_by_string = re.sub("in part", "", dissent_by_string)2158 dissent_by_string = re.sub("and in", "", dissent_by_string)2159 dissent_by_string = re.sub(" by", "", dissent_by_string)2160 dissent_by_string = re.sub(" and", "", dissent_by_string)2161 dissent_by_string = re.sub("as to", "", dissent_by_string)2162 dissent_by_string = re.sub("filed a", "", dissent_by_string)2163 dissent_by_string = re.sub("\.", ",", dissent_by_string)2164 dissent_by_string = re.sub("[\s]*;", ";", dissent_by_string)2165 dissent_holder = re.split(";|,", dissent_by_string)2166 dissent_holder = filter(None, dissent_holder)2167 dissent_holder = [name for name in dissent_holder if name.strip()]2168 num_dissent = len(dissent_holder)2169 dissent_by_line = False2170 dissent1_ln = lastname(dissent_holder[0]).strip()2171 dissent1_ln = dissent1_ln.strip()2172 dissent1_ln = re.sub("\xa0", "", dissent1_ln)2173 dissent1_ln = Capitalize(dissent1_ln)2174 dissent1_fn = firstname(dissent_holder[0])2175 dissent1_mn = middlename(dissent_holder[0])2176 dissent1_suf = namesuffix(dissent_holder[0])2177 if (len(dissent_holder) > 1):2178 dissent2_ln = lastname(dissent_holder[1]).strip()2179 dissent2_fn = firstname(dissent_holder[1])2180 dissent2_mn = middlename(dissent_holder[1])2181 dissent2_suf = namesuffix(dissent_holder[1])2182 if (len(dissent_holder) > 2):2183 dissent3_ln = lastname(dissent_holder[2]).strip()2184 dissent3_fn = firstname(dissent_holder[2])2185 dissent3_mn = middlename(dissent_holder[2])2186 dissent3_suf = namesuffix(dissent_holder[2])2187 if (len(dissent_holder) > 3):2188 dissent4_ln = lastname(dissent_holder[3]).strip()2189 dissent4_fn = firstname(dissent_holder[3])2190 dissent4_mn = middlename(dissent_holder[3])2191 dissent4_suf = namesuffix(dissent_holder[3])2192 if (len(dissent_holder) > 4):2193 dissent5_ln = lastname(dissent_holder[4]).strip()2194 dissent5_fn = firstname(dissent_holder[4])2195 dissent5_mn = middlename(dissent_holder[4])2196 dissent5_suf = namesuffix(dissent_holder[4])2197 dissent1_full = dissent1_ln + ", " + dissent1_fn + " " + dissent1_mn + " " + dissent1_suf2198 dissent1_full = re.sub("[\s]+", " ", dissent1_full)2199 dissent1_full = re.sub(", $", "", dissent1_full)2200 dissent2_full = dissent2_ln + ", " + dissent2_fn + " " + dissent2_mn + " " + dissent2_suf2201 dissent2_full = re.sub("[\s]+", " ", dissent2_full)2202 dissent2_full = re.sub(", $", "", dissent2_full)2203 dissent3_full = dissent3_ln + ", " + dissent3_fn + " " + dissent3_mn + " " + dissent3_suf2204 dissent3_full = re.sub("[\s]+", " ", dissent3_full)2205 dissent3_full = re.sub(", $", "", dissent3_full)2206 dissent4_full = dissent4_ln + ", " + dissent4_fn + " " + dissent4_mn + " " + dissent4_suf2207 dissent4_full = re.sub("[\s]+", " ", dissent4_full)2208 dissent4_full = re.sub(", $", "", dissent4_full)2209 dissent5_full = dissent4_ln + ", " + dissent5_fn + " " + dissent5_mn + " " + dissent5_suf2210 dissent5_full = re.sub("[\s]+", " ", dissent5_full)2211 dissent5_full = re.sub(", $", "", dissent5_full)2212 # Store justices that concurred in dissenting opinions, format names, and store in a list2213 if (silent_dissent == True and re.search("concurs\.$|concur\.$|concurred\.$", txtline)):2214 other_dissent_string = txtline2215 other_dissent_string = re.sub("\xa0", "", other_dissent_string)2216 other_dissent_string = re.sub(" C\.J\.,| C\. J\.|JJ\.| J\.|C\.J\.", "", other_dissent_string)2217 other_dissent_string = re.sub(" and", ",", other_dissent_string)2218 other_dissent_string = re.sub("'", "", other_dissent_string)2219 other_dissent_string = re.sub(" concurred\.", "", other_dissent_string)2220 other_dissent_string = re.sub(" concur\.\n| concurs\.\n", "", other_dissent_string)2221 other_dissent_string = re.sub("affirmed", "", other_dissent_string)2222 other_dissent_string = re.sub("whom", "", other_dissent_string)2223 other_dissent_string = other_dissent_string.strip()2224 other_dissent_judges = other_dissent_string.split(",")2225 other_dissent_judges[:] = [item for item in other_dissent_judges if item != '']2226 if len(other_dissent_judges) > 0:2227 silent_judge1 = other_dissent_judges[0].strip()2228 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge1))2229 dissent_holder = dissent_holder + [silent_judge1]2230 num_dissent += 12231 if len(other_dissent_judges) > 1:2232 silent_judge2 = other_dissent_judges[1].strip()2233 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge2))2234 num_dissent += 12235 dissent_holder = dissent_holder + [silent_judge2]2236 if len(other_dissent_judges) > 2:2237 silent_judge3 = other_dissent_judges[2].strip()2238 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge3))2239 num_dissent += 12240 dissent_holder = dissent_holder + [silent_judge3]2241 if len(other_dissent_judges) > 3:2242 silent_judge4 = other_dissent_judges[3].strip()2243 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge4))2244 num_dissent += 12245 dissent_holder = dissent_holder + [silent_judge4]2246 if silent_judge4 == silent_judge1 or silent_judge4 == silent_judge2 or silent_judge4 == silent_judge3:2247 silent_judge4 = ""2248 if silent_judge3 == silent_judge1 or silent_judge3 == silent_judge2:2249 silent_judge3 = ""2250 if silent_judge2 == silent_judge1:2251 silent_judge2 = ""2252 silent_dissent = False2253 # Search for concurring judge2254 if (re.search("Concur", txtline)):2255 concur_line = True2256 # Store number of concurring justice and parse/format names of concurring justices (stored in string)2257 if (re.match("^Concur by:", txtline) and not trunc_text):2258 concur_by_line = True2259 concur = concur + 12260 if (concur_by_line and re.search("[\w]+", txtline)):2261 concur_by_string = concur_by_string + txtline2262 if (concur_by_line and re.match("^[\s]+$", txtline)):2263 concur_by_string = string.strip(concur_by_string)2264 concur_by_string = re.sub("\n", " ", concur_by_string)2265 concur_by_string = re.sub("Concur by: ", "", concur_by_string)2266 concur_by_string = re.sub("\[.+\]", "", concur_by_string)2267 concur_by_string = re.sub("\xc2", "", concur_by_string)2268 concur_by_string = re.sub("[\s]*\(In[\s]*(P|p)art\)", "", concur_by_string)2269 concur_by_string = re.sub("\*\d+", "", concur_by_string)2270 concur_by_string = re.sub("\d+", "", concur_by_string)2271 concur_by_string = re.sub("[\s]*;", ";", concur_by_string)2272 concur_holder = re.split("; ", concur_by_string)2273 num_concur = len(concur_holder)2274 concur_by_line = False2275 concur1_ln = lastname(concur_holder[0])2276 concur1_fn = firstname(concur_holder[0])2277 concur1_mn = middlename(concur_holder[0])2278 concur1_suf = namesuffix(concur_holder[0])2279 if (len(concur_holder) > 1):2280 concur2_ln = lastname(concur_holder[1])2281 concur2_fn = firstname(concur_holder[1])2282 concur2_mn = middlename(concur_holder[1])2283 concur2_suf = namesuffix(concur_holder[1])2284 if (len(concur_holder) > 2):2285 concur3_ln = lastname(concur_holder[2])2286 concur3_fn = firstname(concur_holder[2])2287 concur3_mn = middlename(concur_holder[2])2288 concur3_suf = namesuffix(concur_holder[2])2289 if (len(concur_holder) > 3):2290 concur4_ln = lastname(concur_holder[3])2291 concur4_fn = firstname(concur_holder[3])2292 concur4_mn = middlename(concur_holder[3])2293 concur4_suf = namesuffix(concur_holder[3])2294 if (len(concur_holder) > 4):2295 concur5_ln = lastname(concur_holder[4])2296 concur5_fn = firstname(concur_holder[4])2297 concur5_mn = middlename(concur_holder[4])2298 concur5_suf = namesuffix(concur_holder[4])2299 if (len(concur_holder) > 5):2300 concur6_ln = lastname(concur_holder[5])2301 concur6_fn = firstname(concur_holder[5])2302 concur6_mn = middlename(concur_holder[5])2303 concur6_suf = namesuffix(concur_holder[5])2304 if (len(concur_holder) > 6):2305 concur7_ln = lastname(concur_holder[6])2306 concur7_fn = firstname(concur_holder[6])2307 concur7_mn = middlename(concur_holder[6])2308 concur7_suf = namesuffix(concur_holder[6])2309 concur1_full = concur1_ln + ", " + concur1_fn + " " + concur1_mn + " " + concur1_suf2310 concur1_full = re.sub("[\s]+", " ", concur1_full)2311 concur1_full = re.sub(", $", "", concur1_full)2312 concur2_full = concur2_ln + ", " + concur2_fn + " " + concur2_mn + " " + concur2_suf2313 concur2_full = re.sub("[\s]+", " ", concur2_full)2314 concur2_full = re.sub(", $", "", concur2_full)2315 concur3_full = concur3_ln + ", " + concur3_fn + " " + concur3_mn + " " + concur3_suf2316 concur3_full = re.sub("[\s]+", " ", concur3_full)2317 concur3_full = re.sub(", $", "", concur3_full)2318 concur4_full = concur4_ln + ", " + concur4_fn + " " + concur4_mn + " " + concur4_suf2319 concur4_full = re.sub("[\s]+", " ", concur4_full)2320 concur4_full = re.sub(", $", "", concur4_full)2321 concur5_full = concur5_ln + ", " + concur5_fn + " " + concur5_mn + " " + concur5_suf2322 concur5_full = re.sub("[\s]+", " ", concur5_full)2323 concur5_full = re.sub(", $", "", concur5_full)2324 concur6_full = concur6_ln + ", " + concur6_fn + " " + concur6_mn + " " + concur6_suf2325 concur6_full = re.sub("[\s]+", " ", concur6_full)2326 concur6_full = re.sub(", $", "", concur6_full)2327 concur7_full = concur7_ln + ", " + concur7_fn + " " + concur7_mn + " " + concur7_suf2328 concur7_full = re.sub("[\s]+", " ", concur7_full)2329 concur7_full = re.sub(", $", "", concur7_full)2330 # Format all justices listed as dissenting (both those that wrote an opinion and those that signed on)2331 dissent_holder = [word for word in dissent_holder if word != ""]2332 dissent_holder = dissent_holder + other_dissent_holder2333 dissent_holder = [word.upper().strip() for word in dissent_holder]2334 dissent_holder = list(set(dissent_holder))2335 if len(dissent_holder)==0:2336 dissent_author_1 = ""2337 dissent_author_2 = ""2338 dissent_author_3 = ""2339 dissent_author_4 = ""2340 if len(dissent_holder)==1:2341 dissent_author_1 = dissent_holder[0].strip()2342 dissent_author_1 = re.sub("\xa0*", "", dissent_author_1)2343 dissent_author_1 = re.sub("\(In\s*part\)", "", dissent_author_1)2344 dissent_author_1 = lastname(dissent_author_1)2345 dissent_author_1 = Capitalize(dissent_author_1)2346 dissent_author_2 = ""2347 dissent_author_3 = ""2348 dissent_author_4 = ""2349 if len(dissent_holder)==2:2350 dissent_author_1 = dissent_holder[0].strip()2351 dissent_author_1 = dissent_author_1.strip()2352 dissent_author_1 = re.sub("\xa0", "", dissent_author_1)2353 dissent_author_1 = re.sub("\(In", "", dissent_author_1)2354 dissent_author_1 = re.sub("J\.", "", dissent_author_1)2355 dissent_author_1 = re.sub("J;", "", dissent_author_1)2356 dissent_author_1 = Capitalize(lastname(dissent_author_1))2357 dissent_author_2 = dissent_holder[1].strip()2358 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2359 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2360 dissent_author_2 = Capitalize(lastname(dissent_author_2))2361 dissent_author_3 = ""2362 dissent_author_4 = ""2363 if len(dissent_holder)==3:2364 dissent_author_1 = dissent_holder[0].strip()2365 dissent_author_1 = dissent_author_1.strip()2366 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2367 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2368 dissent_author_1 = Capitalize(lastname(dissent_author_1))2369 dissent_author_2 = dissent_holder[1].strip()2370 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2371 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2372 dissent_author_2 = Capitalize(lastname(dissent_author_2))2373 dissent_author_3 = dissent_holder[2].strip()2374 dissent_author_3 = dissent_author_3.strip()2375 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2376 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2377 dissent_author_3 = Capitalize(lastname(dissent_author_3))2378 dissent_author_4 = ""2379 if len(dissent_holder)==4:2380 dissent_author_1 = dissent_holder[0].strip()2381 dissent_author_1 = dissent_author_1.strip()2382 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2383 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2384 dissent_author_1 = Capitalize(lastname(dissent_author_1))2385 dissent_author_2 = dissent_holder[1].strip()2386 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2387 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2388 dissent_author_2 = Capitalize(lastname(dissent_author_2))2389 dissent_author_3 = dissent_holder[2].strip()2390 dissent_author_3 = dissent_author_3.strip()2391 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2392 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2393 dissent_author_3 = Capitalize(lastname(dissent_author_3))2394 dissent_author_4 = dissent_holder[3].strip()2395 dissent_author_4 = dissent_author_4.strip()2396 dissent_author_4 = re.sub("[\xa0]*", "", dissent_author_4)2397 dissent_author_4 = re.sub("\In\spart\)", "", dissent_author_4)2398 dissent_author_4 = Capitalize(lastname(dissent_author_4))2399 dissent_author_5 = ""2400 if len(dissent_holder)==5:2401 dissent_author_1 = dissent_holder[0].strip()2402 dissent_author_1 = dissent_author_1.strip()2403 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2404 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2405 dissent_author_1 = Capitalize(lastname(dissent_author_1))2406 dissent_author_2 = dissent_holder[1].strip()2407 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2408 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2409 dissent_author_2 = Capitalize(lastname(dissent_author_2))2410 dissent_author_3 = dissent_holder[2].strip()2411 dissent_author_3 = dissent_author_3.strip()2412 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2413 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2414 dissent_author_3 = Capitalize(lastname(dissent_author_3))2415 dissent_author_4 = dissent_holder[3].strip()2416 dissent_author_4 = dissent_author_4.strip()2417 dissent_author_4 = re.sub("[\xa0]*", "", dissent_author_4)2418 dissent_author_4 = re.sub("\In\spart\)", "", dissent_author_4)2419 dissent_author_4 = Capitalize(lastname(dissent_author_4))2420 dissent_author_5 = dissent_holder[4].strip()2421 dissent_author_5 = dissent_author_5.strip()2422 dissent_author_5 = re.sub("[\xa0]*", "", dissent_author_5)2423 dissent_author_5 = re.sub("\In\s*part\)", "", dissent_author_5)2424 dissent_author_5 = Capitalize(lastname(dissent_author_5))2425 if len(dissent_author_1) < 2:2426 dissent_author_1 = ""2427 if len(dissent_author_2) < 2:2428 dissent_author_2 = ""2429 if len(dissent_author_3) < 2:2430 dissent_author_3 = ""2431 if len(dissent_author_4) < 2:2432 dissent_author_4 = ""2433 if len(dissent_author_5) < 2:2434 dissent_author_5 = ""2435 if dissent_line and dissent==0:2436 dissent=12437 num_dissent=12438 if concur_line and concur==0:2439 concur=12440 num_concur=12441 #Assign vote values for each justice based on dissenting judges values2442 if dissent_author_1 == judge2_ln or dissent_author_2 == judge2_ln or dissent_author_3 == judge2_ln or dissent_author_4 == judge2_ln or dissent_author_5 == judge2_ln and len(judge2_ln) > 0:2443 judge2_vote = 0 #dissent_author_12444 elif dissent_author_1 != judge2_ln and dissent_author_2 != judge2_ln and dissent_author_3 != judge2_ln and dissent_author_4 != judge2_ln and dissent_author_5 != judge2_ln and len(judge2_ln) > 0:2445 judge2_vote = 12446 else:2447 judge2_vote = ""2448 if dissent_author_1 == judge3_ln or dissent_author_2 == judge3_ln or dissent_author_3 == judge3_ln or dissent_author_4 == judge3_ln or dissent_author_5 == judge3_ln and len(judge3_ln) > 0:2449 judge3_vote = 0 #dissent_author_12450 elif dissent_author_1 != judge3_ln and dissent_author_2 != judge3_ln and dissent_author_3 != judge3_ln and dissent_author_4 != judge3_ln and dissent_author_5 != judge3_ln and len(judge3_ln) > 0:2451 judge3_vote = 12452 else:2453 judge3_vote = ""2454 if dissent_author_1 == judge4_ln or dissent_author_2 == judge4_ln or dissent_author_3 == judge4_ln or dissent_author_4 == judge4_ln or dissent_author_5 == judge4_ln and len(judge4_ln) > 0:2455 judge4_vote = 0 #dissent_author_12456 elif dissent_author_1 != judge4_ln and dissent_author_2 != judge4_ln and dissent_author_3 != judge4_ln and dissent_author_4 != judge4_ln and dissent_author_5 != judge4_ln and len(judge4_ln) > 0:2457 judge4_vote = 12458 else:2459 judge4_vote = ""2460 if dissent_author_1 == judge5_ln or dissent_author_2 == judge5_ln or dissent_author_3 == judge5_ln or dissent_author_4 == judge5_ln or dissent_author_5 == judge5_ln and len(judge5_ln) > 0:2461 judge5_vote = 0 #dissent_author_12462 elif dissent_author_1 != judge5_ln and dissent_author_2 != judge5_ln and dissent_author_3 != judge5_ln and dissent_author_4 != judge5_ln and dissent_author_5 != judge5_ln and len(judge5_ln) > 0:2463 judge5_vote = 12464 else:2465 judge5_vote = ""2466 if dissent_author_1 == judge6_ln or dissent_author_2 == judge6_ln or dissent_author_3 == judge6_ln or dissent_author_4 == judge6_ln or dissent_author_5 == judge6_ln and len(judge6_ln) > 0:2467 judge6_vote = 0 #dissent_author_12468 elif dissent_author_1 != judge6_ln and dissent_author_2 != judge6_ln and dissent_author_3 != judge6_ln and dissent_author_4 != judge6_ln and dissent_author_5 != judge6_ln and len(judge6_ln) > 0:2469 judge6_vote = 12470 else:2471 judge6_vote = ""2472 if dissent_author_1 == judge7_ln or dissent_author_2 == judge7_ln or dissent_author_3 == judge7_ln or dissent_author_4 == judge7_ln or dissent_author_5 == judge7_ln and len(judge7_ln) > 0:2473 judge7_vote = 0 #dissent_author_12474 elif dissent_author_1 != judge7_ln and dissent_author_2 != judge7_ln and dissent_author_3 != judge7_ln and dissent_author_4 != judge7_ln and dissent_author_5 != judge7_ln and len(judge7_ln) > 0:2475 judge7_vote = 12476 else:2477 judge7_vote = ""2478 if dissent_author_1 == judge8_ln or dissent_author_2 == judge8_ln or dissent_author_3 == judge8_ln or dissent_author_4 == judge8_ln or dissent_author_5 == judge8_ln and len(judge8_ln) > 0:2479 judge8_vote = 0 #dissent_author_12480 elif dissent_author_1 != judge8_ln and dissent_author_2 != judge8_ln and dissent_author_3 != judge8_ln and dissent_author_4 != judge8_ln and dissent_author_5 != judge8_ln and len(judge8_ln) > 0:2481 judge8_vote = 12482 else:2483 judge8_vote = ""2484 if dissent_author_1 == judge9_ln or dissent_author_2 == judge9_ln or dissent_author_3 == judge9_ln or dissent_author_4 == judge9_ln or dissent_author_5 == judge9_ln and len(judge9_ln) > 0:2485 judge9_vote = 0 #dissent_author_12486 elif dissent_author_1 != judge9_ln and dissent_author_2 != judge9_ln and dissent_author_3 != judge9_ln and dissent_author_4 != judge9_ln and dissent_author_5 != judge9_ln and len(judge9_ln) > 0:2487 judge9_vote = 12488 else:2489 judge9_vote = ""2490 if dissent_author_1 == judge10_ln or dissent_author_2 == judge10_ln or dissent_author_3 == judge10_ln or dissent_author_4 == judge10_ln or dissent_author_5 == judge10_ln and len(judge10_ln) > 0:2491 judge10_vote = 0 #dissent_author_12492 elif dissent_author_1 != judge10_ln and dissent_author_2 != judge10_ln and dissent_author_3 != judge10_ln and dissent_author_4 != judge10_ln and dissent_author_5 != judge10_ln and len(judge10_ln) > 0:2493 judge10_vote = 12494 else:2495 judge10_vote = ""2496 if dissent_author_1 == judge11_ln or dissent_author_2 == judge11_ln or dissent_author_3 == judge11_ln or dissent_author_4 == judge11_ln or dissent_author_5 == judge11_ln and len(judge11_ln) > 0:2497 judge11_vote = 0 #dissent_author_12498 elif dissent_author_1 != judge11_ln and dissent_author_2 != judge11_ln and dissent_author_3 != judge11_ln and dissent_author_4 != judge11_ln and dissent_author_5 != judge11_ln and len(judge11_ln) > 0:2499 judge11_vote = 12500 else:2501 judge11_vote = ""2502 #Remove vote values from columns without judges2503 if judge1_ln == "":2504 judge1_vote = ""2505 if judge2_ln == "":2506 judge2_vote = ""2507 if judge3_ln == "":2508 judge3_vote = ""2509 if judge4_ln == "":2510 judge4_vote = ""2511 if judge5_ln == "":2512 judge5_vote = ""2513 if judge6_ln == "":2514 judge6_vote = ""2515 if judge7_ln == "":2516 judge7_vote = ""2517 if judge8_ln == "":2518 judge8_vote = ""2519 if judge9_ln == "":2520 judge9_vote = ""2521 if judge10_ln == "":2522 judge10_vote = ""2523 if judge11_ln == "":2524 judge11_vote = ""2525 #Remove non-ASCII characters from Lexis citation values2526 Lexis_cite = re.sub("\xa0", "", Lexis_cite)2527 Lexis_cite = re.sub("\xc2", "", Lexis_cite)2528 #Remove duplicate judges from judge last name columns2529 if(judge9_ln == judge2_ln or judge9_ln == judge3_ln or judge9_ln == judge4_ln or judge9_ln == judge5_ln or judge9_ln == judge6_ln or judge9_ln == judge7_ln or judge9_ln == judge8_ln or judge9_ln == judge1_ln):2530 judge9_ln = ""2531 judge9_vote = ""2532 if(judge8_ln == judge2_ln or judge8_ln == judge3_ln or judge8_ln == judge4_ln or judge8_ln == judge5_ln or judge8_ln == judge6_ln or judge8_ln == judge7_ln or judge8_ln == judge9_ln or judge8_ln == judge1_ln):2533 judge8_ln = ""2534 judge8_vote = ""2535 if(judge7_ln == judge2_ln or judge7_ln == judge3_ln or judge7_ln == judge4_ln or judge7_ln == judge5_ln or judge7_ln == judge6_ln or judge7_ln == judge8_ln or judge7_ln == judge9_ln or judge7_ln == judge1_ln):2536 judge7_ln = ""2537 judge7_vote = ""2538 if(judge6_ln == judge2_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln or judge6_ln == judge7_ln or judge6_ln == judge8_ln or judge6_ln == judge9_ln or judge6_ln == judge1_ln):2539 judge6_ln = ""2540 judge6_vote = ""2541 if(judge5_ln == judge2_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln or judge5_ln == judge7_ln or judge5_ln == judge6_ln or judge5_ln == judge8_ln or judge5_ln == judge9_ln or judge5_ln == judge1_ln):2542 judge5_ln = ""2543 judge5_vote = ""2544 if(judge4_ln == judge2_ln or judge4_ln == judge3_ln or judge4_ln == judge7_ln or judge4_ln == judge5_ln or judge4_ln == judge6_ln or judge4_ln == judge8_ln or judge4_ln == judge9_ln or judge4_ln == judge1_ln):2545 judge4_ln = ""2546 judge4_vote = ""2547 if(judge3_ln == judge2_ln or judge3_ln == judge4_ln or judge3_ln == judge7_ln or judge3_ln == judge5_ln or judge3_ln == judge6_ln or judge3_ln == judge8_ln or judge3_ln == judge9_ln or judge3_ln == judge1_ln):2548 judge3_ln = ""2549 judge3_vote = ""2550 if(judge2_ln == judge3_ln or judge2_ln == judge4_ln or judge2_ln == judge7_ln or judge2_ln == judge5_ln or judge2_ln == judge6_ln or judge2_ln == judge8_ln or judge2_ln == judge9_ln or judge2_ln == judge1_ln):2551 judge2_ln = ""2552 judge2_vote = ""2553 if(judge10_ln == judge1_ln or judge10_ln == judge2_ln or judge10_ln == judge3_ln or judge10_ln == judge4_ln or judge10_ln == judge5_ln or judge10_ln == judge6_ln or judge10_ln == judge7_ln or judge10_ln == judge8_ln or judge10_ln == judge9_ln or judge10_ln == judge11_ln):2554 judge10_ln = ""2555 judge10_vote = ""2556 if(judge11_ln == judge1_ln or judge11_ln == judge2_ln or judge11_ln == judge3_ln or judge11_ln == judge4_ln or judge11_ln == judge5_ln or judge11_ln == judge6_ln or judge11_ln == judge7_ln or judge11_ln == judge8_ln or judge11_ln == judge9_ln or judge11_ln == judge10_ln):2557 judge11_ln = ""2558 judge11_vote = ""2559 #Fix vote values for cases where Lexis only reports judges that author a dissenting opinion in the dissent line2560 if(silent_judge1 == judge1_ln and len(silent_judge1) > 0):2561 judge1_vote = 02562 if(silent_judge1 == judge2_ln and len(silent_judge1) > 0):2563 judge2_vote = 02564 if(silent_judge1 == judge3_ln and len(silent_judge1) > 0):2565 judge3_vote = 02566 if(silent_judge1 == judge4_ln and len(silent_judge1) > 0):2567 judge4_vote = 02568 if(silent_judge1 == judge5_ln and len(silent_judge1) > 0):2569 judge5_vote = 02570 if(silent_judge1 == judge6_ln and len(silent_judge1) > 0):2571 judge6_vote = 02572 if(silent_judge1 == judge7_ln and len(silent_judge1) > 0):2573 judge7_vote = 02574 if(silent_judge1 == judge8_ln and len(silent_judge1) > 0):2575 judge8_vote = 02576 if(silent_judge1 == judge9_ln and len(silent_judge1) > 0):2577 judge9_vote = 02578 if(silent_judge2 == judge1_ln and len(silent_judge2) > 0):2579 judge1_vote = 02580 if(silent_judge2 == judge2_ln and len(silent_judge2) > 0):2581 judge2_vote = 02582 if(silent_judge2 == judge3_ln and len(silent_judge2) > 0):2583 judge3_vote = 02584 if(silent_judge2 == judge4_ln and len(silent_judge2) > 0):2585 judge4_vote = 02586 if(silent_judge2 == judge5_ln and len(silent_judge2) > 0):2587 judge5_vote = 02588 if(silent_judge2 == judge6_ln and len(silent_judge2) > 0):2589 judge6_vote = 02590 if(silent_judge2 == judge7_ln and len(silent_judge2) > 0):2591 judge7_vote = 02592 if(silent_judge2 == judge8_ln and len(silent_judge2) > 0):2593 judge8_vote = 02594 if(silent_judge2 == judge9_ln and len(silent_judge2) > 0):2595 judge9_vote = 02596 if(silent_judge3 == judge1_ln and len(silent_judge3) > 0):2597 judge1_vote = 02598 if(silent_judge3 == judge2_ln and len(silent_judge3) > 0):2599 judge2_vote = 02600 if(silent_judge3 == judge3_ln and len(silent_judge3) > 0):2601 judge3_vote = 02602 if(silent_judge3 == judge4_ln and len(silent_judge3) > 0):2603 judge4_vote = 02604 if(silent_judge3 == judge5_ln and len(silent_judge3) > 0):2605 judge5_vote = 02606 if(silent_judge3 == judge6_ln and len(silent_judge3) > 0):2607 judge6_vote = 02608 if(silent_judge3 == judge7_ln and len(silent_judge3) > 0):2609 judge7_vote = 02610 if(silent_judge3 == judge8_ln and len(silent_judge3) > 0):2611 judge8_vote = 02612 if(silent_judge3 == judge9_ln and len(silent_judge3) > 0):2613 judge9_vote = 02614 if(silent_judge4 == judge1_ln and len(silent_judge4) > 0):2615 judge1_vote = 02616 if(silent_judge4 == judge2_ln and len(silent_judge4) > 0):2617 judge2_vote = 02618 if(silent_judge4 == judge3_ln and len(silent_judge4) > 0):2619 judge3_vote = 02620 if(silent_judge4 == judge4_ln and len(silent_judge4) > 0):2621 judge4_vote = 02622 if(silent_judge4 == judge5_ln and len(silent_judge4) > 0):2623 judge5_vote = 02624 if(silent_judge4 == judge6_ln and len(silent_judge4) > 0):2625 judge6_vote = 02626 if(silent_judge4 == judge7_ln and len(silent_judge4) > 0):2627 judge7_vote = 02628 if(silent_judge4 == judge8_ln and len(silent_judge4) > 0):2629 judge8_vote = 02630 if(silent_judge4 == judge9_ln and len(silent_judge4) > 0):2631 judge9_vote = 02632 if(silent_judge5 == judge1_ln and len(silent_judge5) > 0):2633 judge1_vote = 02634 if(silent_judge5 == judge2_ln and len(silent_judge5) > 0):2635 judge2_vote = 02636 if(silent_judge5 == judge3_ln and len(silent_judge5) > 0):2637 judge3_vote = 02638 if(silent_judge5 == judge4_ln and len(silent_judge5) > 0):2639 judge4_vote = 02640 if(silent_judge5 == judge5_ln and len(silent_judge5) > 0):2641 judge5_vote = 02642 if(silent_judge5 == judge6_ln and len(silent_judge5) > 0):2643 judge6_vote = 02644 if(silent_judge5 == judge7_ln and len(silent_judge5) > 0):2645 judge7_vote = 02646 if(silent_judge5 == judge8_ln and len(silent_judge5) > 0):2647 judge8_vote = 02648 if(silent_judge5 == judge9_ln and len(silent_judge5) > 0):2649 judge9_vote = 02650 #Remove duplicate dissenting judge values from dissent columns2651 if dissent_author_5 == dissent_author_1 or dissent_author_5 == dissent_author_2 or dissent_author_5 == dissent_author_3 or dissent_author_5 == dissent_author_4:2652 dissent_author_5 = ""2653 if dissent_author_4 == dissent_author_1 or dissent_author_4 == dissent_author_2 or dissent_author_4 == dissent_author_3:2654 dissent_author_4 = ""2655 if dissent_author_3 == dissent_author_1 or dissent_author_3 == dissent_author_2:2656 dissent_author_3 = ""2657 if dissent_author_2 == dissent_author_1:2658 dissent_author_2 = ""2659 # Remove instances of "Jr" and "Sr" so that the masterfile will match correctly2660 if judge1_ln == "Jr|Sr":2661 judge1_ln = ""2662 if judge2_ln == "Jr|Sr":2663 judge2_ln = ""2664 if judge3_ln == "Jr|Sr":2665 judge3_ln = ""2666 if judge4_ln == "Jr|Sr":2667 judge4_ln = ""2668 if judge5_ln == "Jr|Sr":2669 judge5_ln = ""2670 if judge6_ln == "Jr|Sr":2671 judge6_ln = ""2672 if judge7_ln == "Jr|Sr":2673 judge7_ln = ""2674 if judge8_ln == "Jr|Sr":2675 judge8_ln = ""2676 if judge9_ln == "Jr|Sr":2677 judge9_ln = ""2678 if judge10_ln == "Jr|Sr":2679 judge10_ln = ""2680 if judge11_ln == "Jr|Sr":2681 judge11_ln = ""2682 #Move judges and votes to the left to fix blank cells2683 if judge1_ln == "" or len(judge1_ln) < 2:2684 judge1_ln = judge2_ln2685 judge1_vote = judge2_vote2686 judge2_ln = judge3_ln2687 judge2_vote = judge3_vote2688 judge3_ln = judge4_ln2689 judge3_vote = judge4_vote2690 judge4_ln = judge5_ln2691 judge4_vote = judge5_vote2692 judge5_ln = judge6_ln2693 judge5_vote = judge6_vote2694 judge6_ln = judge7_ln2695 judge6_vote = judge7_vote2696 judge7_ln = judge8_ln2697 judge7_vote = judge8_vote2698 judge8_ln = judge9_ln2699 judge8_vote = judge9_vote2700 judge9_ln = judge10_ln2701 judge9_vote = judge10_vote2702 judge10_ln = judge11_ln2703 judge10_vote = judge11_vote2704 if judge1_ln == "" or len(judge1_ln) < 2:2705 judge1_ln = judge2_ln2706 judge1_vote = judge2_vote2707 judge2_ln = judge3_ln2708 judge2_vote = judge3_vote2709 judge3_ln = judge4_ln2710 judge3_vote = judge4_vote2711 judge4_ln = judge5_ln2712 judge4_vote = judge5_vote2713 judge5_ln = judge6_ln2714 judge5_vote = judge6_vote2715 judge6_ln = judge7_ln2716 judge6_vote = judge7_vote2717 judge7_ln = judge8_ln2718 judge7_vote = judge8_vote2719 judge8_ln = judge9_ln2720 judge8_vote = judge9_vote2721 judge9_ln = judge10_ln2722 judge9_vote = judge10_vote2723 judge10_ln = judge11_ln2724 judge10_vote = judge11_vote2725 if judge1_ln == "" or len(judge1_ln) < 2:2726 judge1_ln = judge2_ln2727 judge1_vote = judge2_vote2728 judge2_ln = judge3_ln2729 judge2_vote = judge3_vote2730 judge3_ln = judge4_ln2731 judge3_vote = judge4_vote2732 judge4_ln = judge5_ln2733 judge4_vote = judge5_vote2734 judge5_ln = judge6_ln2735 judge5_vote = judge6_vote2736 judge6_ln = judge7_ln2737 judge6_vote = judge7_vote2738 judge7_ln = judge8_ln2739 judge7_vote = judge8_vote2740 judge8_ln = judge9_ln2741 judge8_vote = judge9_vote2742 judge9_ln = judge10_ln2743 judge9_vote = judge10_vote2744 judge10_ln = judge11_ln2745 judge10_vote = judge11_vote2746 if judge2_ln == "" or len(judge2_ln) < 2:2747 judge2_ln = judge3_ln2748 judge2_vote = judge3_vote2749 judge3_ln = judge4_ln2750 judge3_vote = judge4_vote2751 judge4_ln = judge5_ln2752 judge4_vote = judge5_vote2753 judge5_ln = judge6_ln2754 judge5_vote = judge6_vote2755 judge6_ln = judge7_ln2756 judge6_vote = judge7_vote2757 judge7_ln = judge8_ln2758 judge7_vote = judge8_vote2759 judge8_ln = judge9_ln2760 judge8_vote = judge9_vote2761 judge9_ln = judge10_ln2762 judge9_vote = judge10_vote2763 judge10_ln = judge11_ln2764 judge10_vote = judge11_vote2765 if judge2_ln == "" or len(judge2_ln) < 2:2766 judge2_ln = judge3_ln2767 judge2_vote = judge3_vote2768 judge3_ln = judge4_ln2769 judge3_vote = judge4_vote2770 judge4_ln = judge5_ln2771 judge4_vote = judge5_vote2772 judge5_ln = judge6_ln2773 judge5_vote = judge6_vote2774 judge6_ln = judge7_ln2775 judge6_vote = judge7_vote2776 judge7_ln = judge8_ln2777 judge7_vote = judge8_vote2778 judge8_ln = judge9_ln2779 judge8_vote = judge9_vote2780 judge9_ln = judge10_ln2781 judge9_vote = judge10_vote2782 judge10_ln = judge11_ln2783 judge10_vote = judge11_vote2784 if judge2_ln == "" or len(judge2_ln) < 2:2785 judge2_ln = judge3_ln2786 judge2_vote = judge3_vote2787 judge3_ln = judge4_ln2788 judge3_vote = judge4_vote2789 judge4_ln = judge5_ln2790 judge4_vote = judge5_vote2791 judge5_ln = judge6_ln2792 judge5_vote = judge6_vote2793 judge6_ln = judge7_ln2794 judge6_vote = judge7_vote2795 judge7_ln = judge8_ln2796 judge7_vote = judge8_vote2797 judge8_ln = judge9_ln2798 judge8_vote = judge9_vote2799 judge9_ln = judge10_ln2800 judge9_vote = judge10_vote2801 judge10_ln = judge11_ln2802 judge10_vote = judge11_vote2803 if judge3_ln == "" or len(judge3_ln) < 2:2804 judge3_ln = judge4_ln2805 judge3_vote = judge4_vote2806 judge4_ln = judge5_ln2807 judge4_vote = judge5_vote2808 judge5_ln = judge6_ln2809 judge5_vote = judge6_vote2810 judge6_ln = judge7_ln2811 judge6_vote = judge7_vote2812 judge7_ln = judge8_ln2813 judge7_vote = judge8_vote2814 judge8_ln = judge9_ln2815 judge8_vote = judge9_vote2816 judge9_ln = judge10_ln2817 judge9_vote = judge10_vote2818 judge10_ln = judge11_ln2819 judge10_vote = judge11_vote2820 if judge3_ln == "" or len(judge3_ln) < 2:2821 judge3_ln = judge4_ln2822 judge3_vote = judge4_vote2823 judge4_ln = judge5_ln2824 judge4_vote = judge5_vote2825 judge5_ln = judge6_ln2826 judge5_vote = judge6_vote2827 judge6_ln = judge7_ln2828 judge6_vote = judge7_vote2829 judge7_ln = judge8_ln2830 judge7_vote = judge8_vote2831 judge8_ln = judge9_ln2832 judge8_vote = judge9_vote2833 judge9_ln = judge10_ln2834 judge9_vote = judge10_vote2835 judge10_ln = judge11_ln2836 judge10_vote = judge11_vote2837 if judge3_ln == "" or len(judge3_ln) < 2:2838 judge3_ln = judge4_ln2839 judge3_vote = judge4_vote2840 judge4_ln = judge5_ln2841 judge4_vote = judge5_vote2842 judge5_ln = judge6_ln2843 judge5_vote = judge6_vote2844 judge6_ln = judge7_ln2845 judge6_vote = judge7_vote2846 judge7_ln = judge8_ln2847 judge7_vote = judge8_vote2848 judge8_ln = judge9_ln2849 judge8_vote = judge9_vote2850 judge9_ln = judge10_ln2851 judge9_vote = judge10_vote2852 judge10_ln = judge11_ln2853 judge10_vote = judge11_vote2854 if judge4_ln == "" or len(judge4_ln) < 2:2855 judge4_ln = judge5_ln2856 judge4_vote = judge5_vote2857 judge5_ln = judge6_ln2858 judge5_vote = judge6_vote2859 judge6_ln = judge7_ln2860 judge6_vote = judge7_vote2861 judge7_ln = judge8_ln2862 judge7_vote = judge8_vote2863 judge8_ln = judge9_ln2864 judge8_vote = judge9_vote2865 judge9_ln = judge10_ln2866 judge9_vote = judge10_vote2867 judge10_ln = judge11_ln2868 judge10_vote = judge11_vote2869 if judge4_ln == "" or len(judge4_ln) < 2:2870 judge4_ln = judge5_ln2871 judge4_vote = judge5_vote2872 judge5_ln = judge6_ln2873 judge5_vote = judge6_vote2874 judge6_ln = judge7_ln2875 judge6_vote = judge7_vote2876 judge7_ln = judge8_ln2877 judge7_vote = judge8_vote2878 judge8_ln = judge9_ln2879 judge8_vote = judge9_vote2880 judge9_ln = judge10_ln2881 judge9_vote = judge10_vote2882 judge10_ln = judge11_ln2883 judge10_vote = judge11_vote2884 if judge4_ln == "" or len(judge4_ln) < 2:2885 judge4_ln = judge5_ln2886 judge4_vote = judge5_vote2887 judge5_ln = judge6_ln2888 judge5_vote = judge6_vote2889 judge6_ln = judge7_ln2890 judge6_vote = judge7_vote2891 judge7_ln = judge8_ln2892 judge7_vote = judge8_vote2893 judge8_ln = judge9_ln2894 judge8_vote = judge9_vote2895 judge9_ln = judge10_ln2896 judge9_vote = judge10_vote2897 judge10_ln = judge11_ln2898 judge10_vote = judge11_vote2899 if judge5_ln == "" or len(judge5_ln) < 2:2900 judge5_ln = judge6_ln2901 judge5_vote = judge6_vote2902 judge6_ln = judge7_ln2903 judge6_vote = judge7_vote2904 judge7_ln = judge8_ln2905 judge7_vote = judge8_vote2906 judge8_ln = judge9_ln2907 judge8_vote = judge9_vote2908 judge9_ln = judge10_ln2909 judge9_vote = judge10_vote2910 judge10_ln = judge11_ln2911 judge10_vote = judge11_vote2912 if judge5_ln == "" or len(judge5_ln) < 2:2913 judge5_ln = judge6_ln2914 judge5_vote = judge6_vote2915 judge6_ln = judge7_ln2916 judge6_vote = judge7_vote2917 judge7_ln = judge8_ln2918 judge7_vote = judge8_vote2919 judge8_ln = judge9_ln2920 judge8_vote = judge9_vote2921 judge9_ln = judge10_ln2922 judge9_vote = judge10_vote2923 judge10_ln = judge11_ln2924 judge10_vote = judge11_vote2925 if judge5_ln == "" or len(judge5_ln) < 2:2926 judge5_ln = judge6_ln2927 judge5_vote = judge6_vote2928 judge6_ln = judge7_ln2929 judge6_vote = judge7_vote2930 judge7_ln = judge8_ln2931 judge7_vote = judge8_vote2932 judge8_ln = judge9_ln2933 judge8_vote = judge9_vote2934 judge9_ln = judge10_ln2935 judge9_vote = judge10_vote2936 judge10_ln = judge11_ln2937 judge10_vote = judge11_vote2938 if judge6_ln == "" or len(judge6_ln) < 2:2939 judge6_ln = judge7_ln2940 judge6_vote = judge7_vote2941 judge7_ln = judge8_ln2942 judge7_vote = judge8_vote2943 judge8_ln = judge9_ln2944 judge8_vote = judge9_vote2945 judge9_ln = judge10_ln2946 judge9_vote = judge10_vote2947 judge10_ln = judge11_ln2948 judge10_vote = judge11_vote2949 if judge6_ln == "" or len(judge6_ln) < 2:2950 judge6_ln = judge7_ln2951 judge6_vote = judge7_vote2952 judge7_ln = judge8_ln2953 judge7_vote = judge8_vote2954 judge8_ln = judge9_ln2955 judge8_vote = judge9_vote2956 judge9_ln = judge10_ln2957 judge9_vote = judge10_vote2958 judge10_ln = judge11_ln2959 judge10_vote = judge11_vote2960 if judge6_ln == "" or len(judge6_ln) < 2:2961 judge6_ln = judge7_ln2962 judge6_vote = judge7_vote2963 judge7_ln = judge8_ln2964 judge7_vote = judge8_vote2965 judge8_ln = judge9_ln2966 judge8_vote = judge9_vote2967 judge9_ln = judge10_ln2968 judge9_vote = judge10_vote2969 judge10_ln = judge11_ln2970 judge10_vote = judge11_vote2971 if judge7_ln == "" or len(judge7_ln) < 2:2972 judge7_ln = judge8_ln2973 judge7_vote = judge8_vote2974 judge8_ln = judge9_ln2975 judge8_vote = judge9_vote2976 judge9_ln = judge10_ln2977 judge9_vote = judge10_vote2978 judge10_ln = judge11_ln2979 judge10_vote = judge11_vote2980 if judge7_ln == "" or len(judge7_ln) < 2:2981 judge7_ln = judge8_ln2982 judge7_vote = judge8_vote2983 judge8_ln = judge9_ln2984 judge8_vote = judge9_vote2985 judge9_ln = judge10_ln2986 judge9_vote = judge10_vote2987 judge10_ln = judge11_ln2988 judge10_vote = judge11_vote2989 if judge7_ln == "" or len(judge7_ln) < 2:2990 judge7_ln = judge8_ln2991 judge7_vote = judge8_vote2992 judge8_ln = judge9_ln2993 judge8_vote = judge9_vote2994 judge9_ln = judge10_ln2995 judge9_vote = judge10_vote2996 judge10_ln = judge11_ln2997 judge10_vote = judge11_vote2998 if judge8_ln == "" or len(judge8_ln) < 2:2999 judge8_ln = judge9_ln3000 judge8_vote = judge9_vote3001 judge9_ln = judge10_ln3002 judge9_vote = judge10_vote3003 judge10_ln = judge11_ln3004 judge10_vote = judge11_vote3005 if judge8_ln == "" or len(judge8_ln) < 2:3006 judge8_ln = judge9_ln3007 judge8_vote = judge9_vote3008 judge9_ln = judge10_ln3009 judge9_vote = judge10_vote3010 judge10_ln = judge11_ln3011 judge10_vote = judge11_vote3012 if judge8_ln == "" or len(judge8_ln) < 2:3013 judge8_ln = judge9_ln3014 judge8_vote = judge9_vote3015 judge9_ln = judge10_ln3016 judge9_vote = judge10_vote3017 judge10_ln = judge11_ln3018 judge10_vote = judge11_vote3019 if judge9_ln == "" or len(judge9_ln) < 2:3020 judge9_ln = judge10_ln3021 judge9_vote = judge10_vote3022 judge10_ln = judge11_ln3023 judge10_vote = judge11_vote3024 if judge9_ln == "" or len(judge9_ln) < 2:3025 judge9_ln = judge10_ln3026 judge9_vote = judge10_vote3027 judge10_ln = judge11_ln3028 judge10_vote = judge11_vote3029 if judge9_ln == "" or len(judge9_ln) < 2:3030 judge9_ln = judge10_ln3031 judge9_vote = judge10_vote3032 judge10_ln = judge11_ln3033 judge10_vote = judge11_vote3034 if judge10_ln == "" or len(judge10_ln) < 2:3035 judge10_ln = judge11_ln3036 judge10_vote = judge11_vote3037 if judge10_ln == "" or len(judge10_ln) < 2:3038 judge10_ln = judge11_ln3039 judge10_vote = judge11_vote3040 if judge10_ln == "" or len(judge10_ln) < 2:3041 judge10_ln = judge11_ln3042 judge10_vote = judge11_vote3043 #Remove duplicate judges from last judge name columns3044 if(judge9_ln == judge2_ln or judge9_ln == judge3_ln or judge9_ln == judge4_ln or judge9_ln == judge5_ln or judge9_ln == judge6_ln or judge9_ln == judge7_ln or judge9_ln == judge8_ln or judge9_ln == judge1_ln):3045 judge9_ln = ""3046 judge9_vote = ""3047 if(judge8_ln == judge2_ln or judge8_ln == judge3_ln or judge8_ln == judge4_ln or judge8_ln == judge5_ln or judge8_ln == judge6_ln or judge8_ln == judge7_ln or judge8_ln == judge9_ln or judge8_ln == judge1_ln):3048 judge8_ln = ""3049 judge8_vote = ""3050 if(judge7_ln == judge2_ln or judge7_ln == judge3_ln or judge7_ln == judge4_ln or judge7_ln == judge5_ln or judge7_ln == judge6_ln or judge7_ln == judge8_ln or judge7_ln == judge9_ln or judge7_ln == judge1_ln):3051 judge7_ln = ""3052 judge7_vote = ""3053 if(judge6_ln == judge2_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln or judge6_ln == judge7_ln or judge6_ln == judge8_ln or judge6_ln == judge9_ln or judge6_ln == judge1_ln):3054 judge6_ln = ""3055 judge6_vote = ""3056 if(judge5_ln == judge2_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln or judge5_ln == judge7_ln or judge5_ln == judge6_ln or judge5_ln == judge8_ln or judge5_ln == judge9_ln or judge5_ln == judge1_ln):3057 judge5_ln = ""3058 judge5_vote = ""3059 if(judge4_ln == judge2_ln or judge4_ln == judge3_ln or judge4_ln == judge7_ln or judge4_ln == judge5_ln or judge4_ln == judge6_ln or judge4_ln == judge8_ln or judge4_ln == judge9_ln or judge4_ln == judge1_ln):3060 judge4_ln = ""3061 judge4_vote = ""3062 if(judge3_ln == judge2_ln or judge3_ln == judge4_ln or judge3_ln == judge7_ln or judge3_ln == judge5_ln or judge3_ln == judge6_ln or judge3_ln == judge8_ln or judge3_ln == judge9_ln or judge3_ln == judge1_ln):3063 judge3_ln = ""3064 judge3_vote = ""3065 if(judge2_ln == judge3_ln or judge2_ln == judge4_ln or judge2_ln == judge7_ln or judge2_ln == judge5_ln or judge2_ln == judge6_ln or judge2_ln == judge8_ln or judge2_ln == judge9_ln or judge2_ln == judge1_ln):3066 judge2_ln = ""3067 judge2_vote = ""3068 if(judge10_ln == judge1_ln or judge10_ln == judge2_ln or judge10_ln == judge3_ln or judge10_ln == judge4_ln or judge10_ln == judge5_ln or judge10_ln == judge6_ln or judge10_ln == judge7_ln or judge10_ln == judge8_ln or judge10_ln == judge9_ln or judge10_ln == judge11_ln):3069 judge10_ln = ""3070 judge10_vote = ""3071 if(judge11_ln == judge1_ln or judge11_ln == judge2_ln or judge11_ln == judge3_ln or judge11_ln == judge4_ln or judge11_ln == judge5_ln or judge11_ln == judge6_ln or judge11_ln == judge7_ln or judge11_ln == judge8_ln or judge11_ln == judge9_ln or judge11_ln == judge10_ln):3072 judge11_ln = ""3073 judge11_vote = ""3074 if (((state_abbr == "AL" or state_abbr == "FL" or panel == 0 or state_abbr == "NH") and state_abbr != "ME" and state_abbr != "MA" and (len(judge6_ln) > 2) or len(judge2_ln) < 2 or len(judge3_ln) < 2 or (len(judge5_ln) < 2 and panel == 0) and len(judge9_ln) < 2) or len(judge1_ln) < 2 and len(judge2_ln) < 2) or state_abbr != "AL" and len(judge7_ln) < 2:3075 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:3076 reader = csv.reader(f)3077 next(f)3078 for row in reader:3079 state = row[0]3080 name = row[3]3081 if len(row[4]) == 4 and row[0] != "MC":3082 row[4] = "1/1/" + row[4]3083 if len(row[5]) == 4 and row[0] != "MC":3084 row[5] = "1/1/" + row[5]3085 if len(row[4]) != 4 and row[0] != "MC" and state_abbr != "AK" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and (len(judge6_ln) > 2) and len(judge9_ln) < 2 or len(judge3_ln) < 3) or len(judge5_ln) < 2) and state_abbr:3086 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3087 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date() + datetime.timedelta(30)3088 if ((panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and state_abbr != "AK" and ((len(judge6_ln) > 2) or len(judge2_ln) < 2 or len(judge3_ln) < 3 or len(judge5_ln) < 2) and len(judge9_ln) < 2)) and start <= date_format <= end):3089 between = True3090 if ((state == state_abbr) and between and row[2] == "0" and state_abbr != "AK" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and (len(judge6_ln) > 2 or len(judge2_ln) < 2 or len(judge3_ln) < 3 or len(judge5_ln) < 2) and len(judge9_ln) < 2))):3091 if non_panel_judge_string == "":3092 non_panel_judge_string = non_panel_judge_string + Capitalize(lastname(row[3]))3093 else:3094 non_panel_judge_string = non_panel_judge_string + "," + Capitalize(lastname(row[3]))3095 if state == state_abbr and row[2] == "0" and len(judge1_ln) < 2 and len(judge2_ln) < 2 and start <= date_format <= end:3096 #print row[3]3097 if non_panel_judge_string == "":3098 non_panel_judge_string = non_panel_judge_string + Capitalize(lastname(row[3]))3099 else:3100 non_panel_judge_string = non_panel_judge_string + "," + Capitalize(lastname(row[3]))3101 #print non_panel_judge_string3102 if row[3] == judge1_ln:3103 judge1_code = row[1]3104 #print judge1_code3105 between = False3106 non_panel_list = non_panel_judge_string.split(",")3107 master.close()3108 judges_AL = non_panel_list3109 if "Jr" in judges_AL:3110 judges_AL.remove('Jr')3111 #judges_AL = list(set(judges_AL))3112 judges_AL.sort()3113 #print judges_AL3114 if judge1_ln in judges_AL:3115 judges_AL.remove(judge1_ln)3116 if judge2_ln in judges_AL:3117 judges_AL.remove(judge2_ln)3118 if judge3_ln in judges_AL:3119 judges_AL.remove(judge3_ln)3120 if judge4_ln in judges_AL:3121 judges_AL.remove(judge4_ln)3122 if judge5_ln in judges_AL:3123 judges_AL.remove(judge5_ln)3124 if judge6_ln in judges_AL:3125 judges_AL.remove(judge6_ln)3126 if judge7_ln in judges_AL:3127 judges_AL.remove(judge7_ln)3128 if judge8_ln in judges_AL:3129 judges_AL.remove(judge8_ln)3130 if judge_np1 in judges_AL:3131 judges_AL.remove(judge_np1)3132 if judge_np2 in judges_AL:3133 judges_AL.remove(judge_np2)3134 if judge_np3 in judges_AL:3135 judges_AL.remove(judge_np3)3136 if judge_np4 in judges_AL:3137 judges_AL.remove(judge_np4)3138 judges_AL = list(set(judges_AL))3139 if len(judge1_ln) < 2 and len(judge2_ln) < 2 and len(judges_AL) > 0:3140 judge1_ln = judges_AL[0]3141 judge2_ln = judges_AL[1]3142 judge1_vote = 13143 judge2_vote = 13144 if len(judge3_ln) < 2 and len(judges_AL) > 2:3145 judge3_ln = judges_AL[2]3146 judge3_vote = 13147 if len(judge4_ln) < 2 and len(judges_AL) > 3:3148 judge4_ln = judges_AL[3]3149 judge4_vote = 13150 if len(judge5_ln) < 2 and len(judges_AL) > 4:3151 judge5_ln = judges_AL[4]3152 judge5_vote = 13153 if len(judge6_ln) < 2 and len(judges_AL) > 5:3154 judge6_ln = judges_AL[5]3155 judge6_vote = 13156 if len(judge7_ln) < 2 and len(judges_AL) > 6:3157 judge7_ln = judges_AL[6]3158 judge7_vote = 13159 #print judge7_ln3160 if len(judge8_ln) < 2 and len(judges_AL) > 7:3161 judge8_ln = judges_AL[7]3162 judge8_vote = 13163 if len(judge9_ln) < 2 and len(judges_AL) > 8:3164 judge9_ln = judges_AL[8]3165 judge9_vote = 13166 if len(judge2_ln) < 2 and len(judges_AL) > 0:3167 judge2_ln = judges_AL[0]3168 judge2_vote = 13169 if len(judge3_ln) < 2 and len(judges_AL) > 1:3170 judge3_ln = judges_AL[1]3171 judge3_vote = 13172 if len(judge4_ln) < 2 and len(judges_AL) > 2:3173 judge4_ln = judges_AL[2]3174 judge4_vote = 13175 if len(judge5_ln) < 2 and len(judges_AL) > 3:3176 judge5_ln = judges_AL[3]3177 judge5_vote = 13178 if len(judge6_ln) < 2 and len(judges_AL) > 4:3179 judge6_ln = judges_AL[4]3180 judge6_vote = 13181 if len(judge7_ln) < 2 and len(judges_AL) > 5:3182 judge7_ln = judges_AL[5]3183 judge7_vote = 13184 if len(judge8_ln) < 2 and len(judges_AL) > 6:3185 judge8_ln = judges_AL[6]3186 judge8_vote = 13187 if len(judge9_ln) < 2 and len(judges_AL) > 7:3188 judge9_ln = judges_AL[7]3189 judge9_vote = 13190 if len(judge3_ln) < 2 and len(judges_AL) > 0:3191 judge3_ln = judges_AL[0]3192 judge3_vote = 13193 if len(judge4_ln) < 2 and panel == 0 and len(judges_AL) > 1:3194 judge4_ln = judges_AL[1]3195 judge4_vote = 13196 if len(judge5_ln) < 2 and panel == 0 and len(judges_AL) > 2:3197 judge5_ln = judges_AL[2]3198 judge5_vote = 13199 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 3:3200 judge6_ln = judges_AL[3]3201 judge6_vote = 13202 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 4:3203 judge7_ln = judges_AL[4]3204 judge7_vote = 13205 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 5:3206 judge8_ln = judges_AL[5]3207 judge8_vote = 13208 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 6:3209 judge9_ln = judges_AL[6]3210 judge9_vote = 13211 if len(judge4_ln) < 2 and len(judges_AL) > 0 and panel == 0:3212 judge4_ln = judges_AL[0]3213 judge4_vote = 13214 if len(judge5_ln) < 2 and panel == 0 and len(judges_AL) > 1:3215 judge5_ln = judges_AL[1]3216 judge5_vote = 13217 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 2:3218 judge6_ln = judges_AL[2]3219 judge6_vote = 13220 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 3:3221 judge7_ln = judges_AL[3]3222 judge7_vote = 13223 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 4:3224 judge8_ln = judges_AL[4]3225 judge8_vote = 13226 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 5:3227 judge9_ln = judges_AL[5]3228 judge9_vote = 13229 if len(judge5_ln) < 2 and len(judges_AL) > 0 and panel == 0:3230 judge5_ln = judges_AL[0]3231 judge5_vote = 13232 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 1:3233 judge6_ln = judges_AL[1]3234 judge6_vote = 13235 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 2:3236 judge7_ln = judges_AL[2]3237 judge7_vote = 13238 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 3:3239 judge8_ln = judges_AL[3]3240 judge8_vote = 13241 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 4:3242 judge9_ln = judges_AL[4]3243 judge9_vote = 13244 if len(judge6_ln) < 2 and len(judges_AL) > 0 and panel == 0:3245 judge6_ln = judges_AL[0]3246 judge6_vote = 13247 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 1:3248 judge7_ln = judges_AL[1]3249 judge7_vote = 13250 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 2:3251 judge8_ln = judges_AL[2]3252 judge8_vote = 13253 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 3:3254 judge9_ln = judges_AL[3]3255 judge9_vote = 13256 if len(judge7_ln) < 2 and len(judges_AL) > 0 and panel == 0:3257 judge7_ln = judges_AL[0]3258 judge7_vote = 13259 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 1:3260 judge8_ln = judges_AL[1]3261 judge8_vote = 13262 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 2:3263 judge9_ln = judges_AL[2]3264 judge9_vote = 13265 if len(judge8_ln) < 2 and len(judges_AL) > 0 and panel == 0:3266 judge8_ln = judges_AL[0]3267 judge8_vote = 13268 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 1:3269 judge9_ln = judges_AL[1]3270 judge9_vote = 13271 if len(judge9_ln) < 2 and len(judges_AL) > 0 and panel == 0:3272 judge9_ln = judges_AL[0]3273 judge9_vote = 13274 if len(judge2_ln) < 2 and len(judge1_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "NC" and state_abbr != "PA" and state_abbr != "RI" and state_abbr != "WV" and state_abbr != "WI" and state_abbr != "WY" and state_abbr != "AR" and state_abbr != "CO" and state_abbr != "GA" and state_abbr != "HI" and state_abbr != "MS" and state_abbr != "MO" and state_abbr != "MN":3275 judge2_ln = judges_AL[0]3276 judge3_ln = judges_AL[1]3277 judge4_ln = judges_AL[2]3278 judge5_ln = judges_AL[3]3279 judge6_ln = judges_AL[4]3280 judge7_ln = judges_AL[5]3281 judge2_vote = 13282 judge3_vote = 13283 judge4_vote = 13284 judge5_vote = 13285 judge6_vote = 13286 judge7_vote = 13287 if len(judge2_ln) < 2 and len(judge1_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "WV":3288 judge2_ln = judges_AL[0]3289 judge3_ln = judges_AL[1]3290 judge4_ln = judges_AL[2]3291 judge5_ln = judges_AL[3]3292 judge2_vote = 13293 judge3_vote = 13294 judge4_vote = 13295 judge5_vote = 13296 if len(judge3_ln) < 2 and len(judge1_ln) > 2 and len(judge2_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "NJ" and state_abbr != "NY" and state_abbr != "WV" and state_abbr != "AR" and state_abbr != "CO" and state_abbr != "GA" and state_abbr != "HI" and state_abbr != "MS" and state_abbr != "MO":3297 judge3_ln = judges_AL[1]3298 judge4_ln = judges_AL[2]3299 judge5_ln = judges_AL[3]3300 judge6_ln = judges_AL[4]3301 judge3_vote = 13302 judge4_vote = 13303 judge5_vote = 13304 judge6_vote = 13305 else:3306 if len(judges_AL) >= 1 and len(judge6_ln) < 2 and state_abbr != "NH":3307 judge6_ln = judges_AL[0]3308 judge6_vote = 13309 del judges_AL[0]3310 if len(judges_AL) >= 1 and len(judge7_ln) < 2 and len(judge6_ln) > 2 and state_abbr != "NH":3311 judge7_ln = judges_AL[0]3312 judge7_vote = 13313 del judges_AL[0]3314 if len(judges_AL) >= 1 and len(judge8_ln) < 2 and len(judge7_ln) > 2 and state_abbr != "NH":3315 judge8_ln = judges_AL[0]3316 judge8_vote = 13317 del judges_AL[0]3318 if len(judges_AL) >= 1 and len(judge9_ln) < 2 and len(judge8_ln) > 2 and state_abbr != "NH":3319 judge9_ln = judges_AL[0]3320 judge9_vote = 13321 del judges_AL[0]3322 if len(judges_AL) >= 1 and len(judge6_ln) < 2 and state_abbr != "NH":3323 judge6_ln = judges_AL[0]3324 judge6_vote = 13325 del judges_AL[0]3326 if len(judges_AL) >= 1 and len(judge7_ln) < 2 and len(judge6_ln) > 2 and state_abbr != "NH":3327 judge7_ln = judges_AL[0]3328 judge7_vote = 13329 del judges_AL[0]3330 if len(judges_AL) >= 1 and len(judge8_ln) < 2 and len(judge7_ln) > 2 and state_abbr != "NH":3331 judge8_ln = judges_AL[0]3332 judge8_vote = 13333 del judges_AL[0]3334 if len(judges_AL) >= 1 and len(judge9_ln) < 2 and len(judge8_ln) > 2 and state_abbr != "NH":3335 judge9_ln = judges_AL[0]3336 judge9_vote = 13337 del judges_AL[0]3338 #Move over dissenting judges to remove blank cells3339 if(dissent_author_1 == ""):3340 dissent_author_1 = dissent_author_23341 dissent_author_2 = dissent_author_33342 dissent_author_3 = dissent_author_43343 dissent_author_4 = dissent_author_53344 if(dissent_author_2 == ""):3345 dissent_author_2 = dissent_author_33346 dissent_author_3 = dissent_author_43347 dissent_author_4 = dissent_author_53348 if(dissent_author_3 == ""):3349 dissent_author_3 = dissent_author_43350 dissent_author_4 = dissent_author_53351 if(dissent_author_4 == ""):3352 dissent_author_4 = dissent_author_53353 #Remove remaining duplicate dissenting authors3354 if dissent_author_5 == dissent_author_1 or dissent_author_5 == dissent_author_2 or dissent_author_5 == dissent_author_3 or dissent_author_5 == dissent_author_4:3355 dissent_author_5 = ""3356 if dissent_author_4 == dissent_author_1 or dissent_author_4 == dissent_author_2 or dissent_author_4 == dissent_author_3:3357 dissent_author_4 = ""3358 if dissent_author_3 == dissent_author_1 or dissent_author_3 == dissent_author_2:3359 dissent_author_3 = ""3360 if dissent_author_2 == dissent_author_1:3361 dissent_author_2 = ""3362 #Correct dissent_no3363 if dissent_author_1 != "":3364 num_dissent = 13365 if dissent_author_2 != "":3366 num_dissent = 23367 if dissent_author_3 != "":3368 num_dissent = 33369 if dissent_author_4 != "":3370 num_dissent = 43371 if dissent_author_5 != "":3372 num_dissent = 53373 if len(dissent_author_1) < 2:3374 num_dissent = 03375 # Pull in judge codes from state master file by matching state abbrevation, justice name, and time in office3376 if judge1_code == "":3377 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:3378 reader = csv.reader(f)3379 next(f)3380 for row in reader:3381 state = row[0]3382 name = row[3]3383 if len(row[4]) == 4 and row[0] != "MC":3384 row[4] = "1/1/" + row[4]3385 if len(row[5]) == 4 and row[0] != "MC":3386 row[5] = "1/1/" + row[5]3387 if len(row[4]) != 4 and row[0] != "MC":3388 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3389 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date()3390 #Format justice last names from each file to ensure accurate matching3391 if (Capitalize(lastname(row[7])) == Capitalize(judge1_ln) or Capitalize(lastname(row[3])) == Capitalize(judge1_ln)) and judge1_code == "" and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge1_ln) > 1 and start <= date_format <= (end + one_month):3392 judge1_code = row[1]3393 if (Capitalize(lastname(row[7])) == Capitalize(judge2_ln) or Capitalize(lastname(row[3])) == Capitalize(judge2_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge2_ln) > 1 and start <= date_format <= (end + one_month):3394 judge2_code = row[1]3395 if (Capitalize(lastname(row[7])) == Capitalize(judge3_ln) or Capitalize(lastname(row[3])) == Capitalize(judge3_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge3_ln) > 1 and start <= date_format <= (end + one_month):3396 judge3_code = row[1]3397 if (Capitalize(lastname(row[7])) == Capitalize(judge4_ln) or Capitalize(lastname(row[3])) == Capitalize(judge4_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge4_ln) > 1 and start <= date_format <= (end + one_month):3398 judge4_code = row[1]3399 if (Capitalize(lastname(row[7])) == Capitalize(judge5_ln) or Capitalize(lastname(row[3])) == Capitalize(judge5_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge5_ln) > 1 and start <= date_format <= (end + one_month):3400 judge5_code = row[1]3401 if (Capitalize(lastname(row[7])) == Capitalize(judge6_ln) or Capitalize(lastname(row[3])) == Capitalize(judge6_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge6_ln) > 1 and start <= date_format <= (end + one_month):3402 judge6_code = row[1]3403 if (Capitalize(lastname(row[7])) == Capitalize(judge7_ln) or Capitalize(lastname(row[3])) == Capitalize(judge7_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge7_ln) > 1 and start <= date_format <= (end + one_month):3404 judge7_code = row[1]3405 if (Capitalize(lastname(row[7])) == Capitalize(judge8_ln) or Capitalize(lastname(row[3])) == Capitalize(judge8_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge8_ln) > 1 and start <= date_format <= (end + one_month):3406 judge8_code = row[1]3407 if (Capitalize(lastname(row[7])) == Capitalize(judge9_ln) or Capitalize(lastname(row[3])) == Capitalize(judge9_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge9_ln) > 1 and start <= date_format <= (end + one_month):3408 judge9_code = row[1]3409 if (Capitalize(lastname(row[7])) == Capitalize(judge10_ln) or Capitalize(lastname(row[3])) == Capitalize(judge10_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge10_ln) > 1 and start <= date_format <= (end + one_month):3410 judge10_code = row[1]3411 if (Capitalize(lastname(row[7])) == Capitalize(judge11_ln) or Capitalize(lastname(row[3])) == Capitalize(judge11_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge11_ln) > 1 and start <= date_format <= (end + one_month):3412 judge11_code = row[1]3413 # Store "Did not match" if a justice did not match to a justice code3414 if judge1_code == "" and len(judge1_ln) > 2:3415 judge1_code = "Did not match"3416 if judge2_code == "" and len(judge2_ln) > 2:3417 judge2_code = "Did not match"3418 if judge3_code == "" and len(judge3_ln) > 2:3419 judge3_code = "Did not match"3420 if judge4_code == "" and len(judge4_ln) > 2:3421 judge4_code = "Did not match"3422 if judge5_code == "" and len(judge5_ln) > 2:3423 judge5_code = "Did not match"3424 if judge6_code == "" and len(judge6_ln) > 2:3425 judge6_code = "Did not match"3426 if judge7_code == "" and len(judge7_ln) > 2:3427 judge7_code = "Did not match"3428 if judge8_code == "" and len(judge8_ln) > 2:3429 judge8_code = "Did not match"3430 if judge9_code == "" and len(judge9_ln) > 2:3431 judge9_code = "Did not match"3432 if judge10_code == "" and len(judge10_ln) > 2:3433 judge10_code = "Did not match"3434 if judge11_code == "" and len(judge11_ln) > 2:3435 judge11_code = "Did not match"3436 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln3437 if (judge1_ln == judge_np1 or judge1_ln == judge_np2 or judge1_ln == judge_np3 or judge1_ln == judge_np4):3438 judge1_ln = ""3439 judge1_vote = ""3440 judge1_code = ""3441 if (judge2_ln == judge_np1 or judge2_ln == judge_np2 or judge2_ln == judge_np3 or judge2_ln == judge_np4):3442 judge2_ln = ""3443 judge2_vote = ""3444 judge2_code = ""3445 if (judge3_ln == judge_np1 or judge3_ln == judge_np2 or judge3_ln == judge_np3 or judge3_ln == judge_np4):3446 judge3_ln = ""3447 judge3_vote = ""3448 judge3_code = ""3449 if (judge4_ln == judge_np1 or judge4_ln == judge_np2 or judge4_ln == judge_np3 or judge4_ln == judge_np4):3450 judge4_ln = ""3451 judge4_vote = ""3452 judge4_code = ""3453 if (judge5_ln == judge_np1 or judge5_ln == judge_np2 or judge5_ln == judge_np3 or judge5_ln == judge_np4):3454 judge5_ln = ""3455 judge5_vote = ""3456 judge5_code = ""3457 if (judge6_ln == judge_np1 or judge6_ln == judge_np2 or judge6_ln == judge_np3 or judge6_ln == judge_np4):3458 judge6_ln = ""3459 judge6_vote = ""3460 judge6_code = ""3461 if (judge7_ln == judge_np1 or judge7_ln == judge_np2 or judge7_ln == judge_np3 or judge7_ln == judge_np4):3462 judge7_ln = ""3463 judge7_vote = ""3464 judge7_code = ""3465 if (judge8_ln == judge_np1 or judge8_ln == judge_np2 or judge8_ln == judge_np3 or judge8_ln == judge_np4):3466 judge8_ln = ""3467 judge8_vote = ""3468 judge8_code = ""3469 if (judge9_ln == judge_np1 or judge9_ln == judge_np2 or judge9_ln == judge_np3 or judge9_ln == judge_np4):3470 judge9_ln = ""3471 judge9_vote = ""3472 judge9_code = ""3473 if (judge10_ln == judge_np1 or judge10_ln == judge_np2 or judge10_ln == judge_np3 or judge10_ln == judge_np4):3474 judge10_ln = ""3475 judge10_vote = ""3476 judge10_code = ""3477 if (judge11_ln == judge_np1 or judge11_ln == judge_np2 or judge11_ln == judge_np3 or judge11_ln == judge_np4 ):3478 judge11_ln = ""3479 judge11_vote = ""3480 judge11_code = ""3481 if judge5_ln == judge2_ln or judge5_ln == judge1_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln:3482 judge5_ln = ""3483 judge5_vote = ""3484 judge5_code = ""3485 if judge6_ln == judge2_ln or judge6_ln == judge1_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln:3486 judge6_ln = ""3487 judge6_vote = ""3488 judge6_code = ""3489 if len(judge10_ln) < 2:3490 judge10_ln = judge11_ln3491 judge10_vote = judge11_vote3492 judge10_code = judge11_code3493 judge11_ln = ""3494 judge11_vote = ""3495 judge11_code = ""3496 if len(judge7_ln) < 2:3497 judge7_ln = judge8_ln3498 judge7_vote = judge8_vote3499 judge7_code = judge8_code3500 judge8_ln = judge9_ln3501 judge8_vote = judge9_vote3502 judge8_code = judge9_code3503 judge9_ln = judge10_ln3504 judge9_vote = judge10_vote3505 judge9_code = judge10_code3506 judge10_ln = judge11_ln3507 judge10_vote = judge11_vote3508 judge10_code = judge11_code3509 #Correct participating judges string3510 part_judges = judge1_ln + ", " + judge2_ln + ", " + judge3_ln + ", " + judge4_ln + ", " + judge5_ln + ", " + judge6_ln + ", " + judge7_ln + ", " + judge8_ln + ", " + judge9_ln + ", " + judge10_ln + ", " + judge11_ln3511 part_judges = re.sub(' ,', '', part_judges)3512 part_judges = part_judges.rstrip(', ').upper()3513 #print(part_judges)3514 judge1_ln = judge1_ln.upper()3515 judge2_ln = judge2_ln.upper()3516 judge3_ln = judge3_ln.upper()3517 judge4_ln = judge4_ln.upper()3518 judge5_ln = judge5_ln.upper()3519 judge6_ln = judge6_ln.upper()3520 judge7_ln = judge7_ln.upper()3521 judge8_ln = judge8_ln.upper()3522 judge9_ln = judge9_ln.upper()3523 judge10_ln = judge10_ln.upper()3524 judge11_ln = judge11_ln.upper()3525 if judge5_ln == judge2_ln or judge5_ln == judge1_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln:3526 judge5_ln = ""3527 judge5_vote = ""3528 judge5_code = ""3529 if judge6_ln == judge2_ln or judge6_ln == judge1_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln:3530 judge6_ln = ""3531 judge6_vote = ""3532 judge6_code = ""3533 if judge2_ln == judge6_ln:3534 judge6_ln = ""3535 judge6_vote = ""3536 judge6_code = ""3537 if len(judge4_ln) < 2:3538 judge4_ln = judge5_ln3539 judge5_ln = judge6_ln3540 judge6_ln = judge7_ln3541 judge7_ln = judge8_ln3542 judge8_ln = judge9_ln3543 judge9_ln = judge10_ln3544 judge4_vote = judge5_vote3545 judge5_vote = judge6_vote3546 judge6_vote = judge7_vote3547 judge7_vote = judge8_vote3548 judge8_vote = judge9_vote3549 judge9_vote = judge10_vote3550 judge4_code = judge5_code3551 judge5_code = judge6_code3552 judge6_code = judge7_code3553 judge7_code = judge8_code3554 judge8_code = judge9_code3555 judge9_code = judge10_code3556 if len(judge4_ln) < 2:3557 judge4_ln = judge5_ln3558 judge5_ln = judge6_ln3559 judge6_ln = judge7_ln3560 judge7_ln = judge8_ln3561 judge8_ln = judge9_ln3562 judge9_ln = judge10_ln3563 judge4_vote = judge5_vote3564 judge5_vote = judge6_vote3565 judge6_vote = judge7_vote3566 judge7_vote = judge8_vote3567 judge8_vote = judge9_vote3568 judge9_vote = judge10_vote3569 judge4_code = judge5_code3570 judge5_code = judge6_code3571 judge6_code = judge7_code3572 judge7_code = judge8_code3573 judge8_code = judge9_code3574 judge9_code = judge10_code3575 if len(judge5_ln) < 2:3576 judge5_ln = judge6_ln3577 judge6_ln = judge7_ln3578 judge7_ln = judge8_ln3579 judge8_ln = judge9_ln3580 judge9_ln = judge10_ln3581 judge5_vote = judge6_vote3582 judge6_vote = judge7_vote3583 judge7_vote = judge8_vote3584 judge8_vote = judge9_vote3585 judge9_vote = judge10_vote3586 judge5_code = judge6_code3587 judge6_code = judge7_code3588 judge7_code = judge8_code3589 judge8_code = judge9_code3590 judge9_code = judge10_code3591 if len(judge1_ln) < 2:3592 judge1_ln = judge2_ln3593 judge2_ln = judge3_ln3594 judge3_ln = judge4_ln3595 judge4_ln = judge5_ln3596 judge5_ln = judge6_ln3597 judge6_ln = judge7_ln3598 judge7_ln = judge8_ln3599 judge8_ln = judge9_ln3600 judge9_ln = judge10_ln3601 judge1_vote = judge2_vote3602 judge2_vote = judge3_vote3603 judge3_vote = judge4_vote3604 judge4_vote = judge5_vote3605 judge5_vote = judge6_vote3606 judge6_vote = judge7_vote3607 judge7_vote = judge8_vote3608 judge8_vote = judge9_vote3609 judge9_vote = judge10_vote3610 judge1_code = judge2_code3611 judge2_code = judge3_code3612 judge3_code = judge4_code3613 judge4_code = judge5_code3614 judge5_code = judge6_code3615 judge6_code = judge7_code3616 judge7_code = judge8_code3617 judge8_code = judge9_code3618 judge9_code = judge10_code3619 if len(judge3_ln) < 2:3620 judge3_ln = judge4_ln3621 judge4_ln = judge5_ln3622 judge5_ln = judge6_ln3623 judge6_ln = judge7_ln3624 judge7_ln = judge8_ln3625 judge8_ln = judge9_ln3626 judge9_ln = judge10_ln3627 judge3_vote = judge4_vote3628 judge4_vote = judge5_vote3629 judge5_vote = judge6_vote3630 judge6_vote = judge7_vote3631 judge7_vote = judge8_vote3632 judge8_vote = judge9_vote3633 judge9_vote = judge10_vote3634 judge3_code = judge4_code3635 judge4_code = judge5_code3636 judge5_code = judge6_code3637 judge6_code = judge7_code3638 judge7_code = judge8_code3639 judge8_code = judge9_code3640 judge9_code = judge10_code3641 if len(judge5_ln) < 2:3642 judge5_ln = judge6_ln3643 judge6_ln = judge7_ln3644 judge7_ln = judge8_ln3645 judge8_ln = judge9_ln3646 judge9_ln = judge10_ln3647 judge5_vote = judge6_vote3648 judge6_vote = judge7_vote3649 judge7_vote = judge8_vote3650 judge8_vote = judge9_vote3651 judge9_vote = judge10_vote3652 judge5_code = judge6_code3653 judge6_code = judge7_code3654 judge7_code = judge8_code3655 judge8_code = judge9_code3656 judge9_code = judge10_code3657 if judge9_ln == judge8_ln or judge9_ln == judge7_ln or judge9_ln == judge6_ln or judge9_ln == judge5_ln or judge9_ln == judge4_ln or judge9_ln == judge3_ln or judge9_ln == judge2_ln or judge9_ln == judge1_ln:3658 judge9_ln = ""3659 judge9_vote = ""3660 judge9_code = ""3661 if judge8_ln == judge7_ln or judge8_ln == judge6_ln or judge8_ln == judge5_ln or judge8_ln == judge4_ln or judge8_ln == judge3_ln or judge8_ln == judge2_ln or judge8_ln == judge1_ln:3662 judge8_ln = ""3663 judge8_vote = ""3664 judge8_code = ""3665 if judge7_ln == judge6_ln or judge7_ln == judge5_ln or judge7_ln == judge4_ln or judge7_ln == judge3_ln or judge7_ln == judge2_ln or judge7_ln == judge1_ln:3666 judge7_ln = ""3667 judge7_vote = ""3668 judge7_code = ""3669 if judge6_ln == judge2_ln:3670 judge6_ln = ""3671 judge6_vote = ""3672 judge6_code = ""3673 if judge5_ln == judge4_ln:3674 judge5_ln = ""3675 judge5_vote = ""3676 judge5_code = ""3677 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln3678 if len(judge5_ln) < 2:3679 judge5_ln = judge6_ln3680 judge6_ln = judge7_ln3681 judge7_ln = judge8_ln3682 judge8_ln = judge9_ln3683 judge9_ln = judge10_ln3684 judge5_vote = judge6_vote3685 judge6_vote = judge7_vote3686 judge7_vote = judge8_vote3687 judge8_vote = judge9_vote3688 judge9_vote = judge10_vote3689 judge5_code = judge6_code3690 judge6_code = judge7_code3691 judge7_code = judge8_code3692 judge8_code = judge9_code3693 judge9_code = judge10_code3694 if len(judge6_ln) < 2:3695 judge6_ln = judge7_ln3696 judge7_ln = judge8_ln3697 judge8_ln = judge9_ln3698 judge9_ln = judge10_ln3699 judge6_vote = judge7_vote3700 judge7_vote = judge8_vote3701 judge8_vote = judge9_vote3702 judge9_vote = judge10_vote3703 judge6_code = judge7_code3704 judge7_code = judge8_code3705 judge8_code = judge9_code3706 judge9_code = judge10_code3707 if len(judge2_ln) < 2:3708 judge2_ln = judge3_ln3709 judge3_ln = judge4_ln3710 judge4_ln = judge5_ln3711 judge5_ln = judge6_ln3712 judge6_ln = judge7_ln3713 judge7_ln = judge8_ln3714 judge8_ln = judge9_ln3715 judge9_ln = judge10_ln3716 judge2_vote = judge3_vote3717 judge3_vote = judge4_vote3718 judge4_vote = judge5_vote3719 judge5_vote = judge6_vote3720 judge6_vote = judge7_vote3721 judge7_vote = judge8_vote3722 judge8_vote = judge9_vote3723 judge9_vote = judge10_vote3724 judge2_code = judge3_code3725 judge3_code = judge4_code3726 judge4_code = judge5_code3727 judge5_code = judge6_code3728 judge6_code = judge7_code3729 judge7_code = judge8_code3730 judge8_code = judge9_code3731 judge9_code = judge10_code3732 if len(judge1_ln) < 2:3733 judge1_ln = judge2_ln3734 judge2_ln = judge3_ln3735 judge3_ln = judge4_ln3736 judge4_ln = judge5_ln3737 judge5_ln = judge6_ln3738 judge6_ln = judge7_ln3739 judge7_ln = judge8_ln3740 judge8_ln = judge9_ln3741 judge9_ln = judge10_ln3742 judge1_vote = judge2_vote3743 judge2_vote = judge3_vote3744 judge3_vote = judge4_vote3745 judge4_vote = judge5_vote3746 judge5_vote = judge6_vote3747 judge6_vote = judge7_vote3748 judge7_vote = judge8_vote3749 judge8_vote = judge9_vote3750 judge9_vote = judge10_vote3751 judge1_code = judge2_code3752 judge2_code = judge3_code3753 judge3_code = judge4_code3754 judge4_code = judge5_code3755 judge5_code = judge6_code3756 judge6_code = judge7_code3757 judge7_code = judge8_code3758 judge8_code = judge9_code3759 judge9_code = judge10_code3760 if len(judge8_ln) < 2:3761 judge8_ln = judge9_ln3762 judge9_ln = judge10_ln3763 judge10_ln = judge11_ln3764 judge8_vote = judge9_vote3765 judge9_vote = judge10_vote3766 judge10_vote = judge11_vote3767 judge8_code = judge9_code3768 judge9_code = judge10_code3769 judge10_code = judge11_code3770 if len(judge7_ln) < 2:3771 judge7_ln = judge8_ln3772 judge8_ln = judge9_ln3773 judge9_ln = judge10_ln3774 judge10_ln = judge11_ln3775 judge7_vote = judge8_vote3776 judge8_vote = judge9_vote3777 judge9_vote = judge10_vote3778 judge10_vote = judge11_vote3779 judge7_code = judge8_code3780 judge8_code = judge9_code3781 judge9_code = judge10_code3782 judge10_code = judge11_code3783 if judge6_ln == "":3784 judge6_ln = judge7_ln3785 judge7_ln = judge8_ln3786 judge8_ln = judge9_ln3787 judge9_ln = judge10_ln3788 judge6_vote = judge7_vote3789 judge7_vote = judge8_vote3790 judge8_vote = judge9_vote3791 judge9_vote = judge10_vote3792 judge6_code = judge7_code3793 judge7_code = judge8_code3794 judge8_code = judge9_code3795 judge9_code = judge10_code3796 if judge4_ln == "":3797 judge4_ln = judge5_ln3798 judge5_ln = judge6_ln3799 judge6_ln = judge7_ln3800 judge7_ln = judge8_ln3801 judge8_ln = judge9_ln3802 judge9_ln = judge10_ln3803 judge4_vote = judge5_vote3804 judge5_vote = judge6_vote3805 judge6_vote = judge7_vote3806 judge7_vote = judge8_vote3807 judge8_vote = judge9_vote3808 judge9_vote = judge10_vote3809 judge4_code = judge5_code3810 judge5_code = judge6_code3811 judge6_code = judge7_code3812 judge7_code = judge8_code3813 judge8_code = judge9_code3814 judge9_code = judge10_code3815 if judge5_ln == judge4_ln:3816 judge5_ln = judge6_ln3817 judge5_vote = judge6_vote3818 judge5_code = judge6_code3819 judge6_ln = judge7_ln3820 judge6_vote = judge7_vote3821 judge6_code = judge7_code3822 judge7_ln = judge8_ln3823 judge7_vote = judge8_vote3824 judge7_code = judge8_code3825 judge8_ln = judge9_ln3826 judge8_vote = judge9_vote3827 judge8_code = judge9_code3828 judge9_ln = judge10_ln3829 judge9_vote = judge10_vote3830 judge9_code = judge10_code3831 if state_abbr == "CA" or state_abbr == "IL" or state_abbr == "PA" or state_abbr == "FL" or state_abbr == "KY" or state_abbr == "LA" or state_abbr == "ME" or state_abbr == "OH" or state_abbr == "CT" or state_abbr == "MD" or state_abbr == "MI" or state_abbr == "CO" or state_abbr == "GA" or state_abbr == "IA" or state_abbr == "MO" or state_abbr == "NE" or state_abbr == "NJ" or state_abbr == "NY" or state_abbr == "NC" or state_abbr == "OH" or state_abbr == "WI" or state_abbr == "AZ" or state_abbr == "AR" or state_abbr == "MT":3832 judge8_ln = ""3833 judge8_code = ""3834 judge8_vote = ""3835 judge9_ln = ""3836 judge9_code = ""3837 judge9_vote = ""3838 if state_abbr == "ND" or state_abbr == "RI" or state_abbr == "VT" or state_abbr == "SC" or state_abbr == "UT" or state_abbr == "WY" or state_abbr == "HI":3839 judge6_ln = ""3840 judge6_vote = ""3841 judge6_code = ""3842 judge7_ln = ""3843 judge7_vote = ""3844 judge7_code = ""3845 judge8_ln = ""3846 judge8_vote = ""3847 judge8_code = ""3848 if state_abbr == "MS" or state_abbr == "OK-SC" or state_abbr == "WA":3849 judge10_ln = ""3850 judge10_vote = ""3851 judge10_code = ""3852 judge11_ln = ""3853 judge11_vote = ""3854 judge11_code = ""3855 if len(dissent_by_string) > 2:3856 dissent_by_string = dissent_by_string + " " + str(other_dissent_holder)3857 if len(dissent_by_string) < 2:3858 dissent_by_string = dissent_by_string + str(other_dissent_holder)3859 dissent_by_string = re.sub("\[", "", dissent_by_string)3860 dissent_by_string = re.sub("\]", "", dissent_by_string)3861 dissent_by_string = re.sub("'", "", dissent_by_string)3862 if state_abbr == "ID":3863 panel = 03864 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln, judge8_ln, judge9_ln3865 # For each case, write a row to the .csv file which contains the desired variables.3866 localrow = []3867 localrow.append("mjn15@psu.edu")3868 localrow.append(Lexis_cite)3869 localrow.append(entry)3870 localrow.append(court_string)3871 localrow.append(new_date)3872 localrow.append(state_abbr)3873 localrow.append(panel)3874 localrow.append(parties_string)3875 localrow.append(docketnum)3876 localrow.append(cite_string)3877 localrow.append(Lexis_cite)3878 localrow.append(West_cite)3879 localrow.append(attorney_string)3880 localrow.append(part_judges)3881 localrow.append(judges_np)3882 localrow.append(judge1_ln)3883 localrow.append(judge1_vote)3884 localrow.append(judge1_code)3885 localrow.append(judge2_ln)3886 localrow.append(judge2_vote)3887 localrow.append(judge2_code)3888 localrow.append(judge3_ln)3889 localrow.append(judge3_vote)3890 localrow.append(judge3_code)3891 localrow.append(judge4_ln)3892 localrow.append(judge4_vote)3893 localrow.append(judge4_code)3894 localrow.append(judge5_ln)3895 localrow.append(judge5_vote)3896 localrow.append(judge5_code)3897 localrow.append(judge6_ln)3898 localrow.append(judge6_vote)3899 localrow.append(judge6_code)3900 localrow.append(judge7_ln)3901 localrow.append(judge7_vote)3902 localrow.append(judge7_code)3903 localrow.append(judge8_ln)3904 localrow.append(judge8_vote)3905 localrow.append(judge8_code)3906 localrow.append(judge9_ln)3907 localrow.append(judge9_vote)3908 localrow.append(judge9_code)3909 localrow.append(judge10_ln)3910 localrow.append(judge10_vote)3911 localrow.append(judge10_code)3912 localrow.append(judge11_ln)3913 localrow.append(judge11_vote)3914 localrow.append(judge11_code)3915 localrow.append(dissent)3916 localrow.append(num_dissent)3917 localrow.append(dissent_by_string.upper())3918 localrow.append(dissent_author_1.upper())3919 localrow.append(dissent_author_2.upper())3920 localrow.append(dissent_author_3.upper())3921 localrow.append(dissent_author_4.upper())3922 localrow.append(dissent_author_5.upper())3923 localrow.append(concur)3924 localrow.append(num_concur)3925 localrow.append(concur_by_string.upper())3926 localrow.append(check_recuse_case)3927 if check_recuse == False:3928 outfilehandle.writerow(localrow)3929 if check_recuse == True:3930 recuse_handle.writerow(localrow)3931 check_recuse = False3932# Finish writing to the .csv file and close it so the process is complete3933infilehandle.close()3934check.close()3935fout.close()...

Full Screen

Full Screen

state_court_scraper_nonpickle.py

Source:state_court_scraper_nonpickle.py Github

copy

Full Screen

1## reads and extracts info from txt files of published opinions from USCOA2## downloaded from LexisNexis3## written for python 2.6.*4##5## modified version of LexisOpinionParse.py by6## Kevin Quinn7## UC Berkeley8## 5/13/20109##10## modifications by11## Rachael Hinkle12## 9/19/201113##14## modified for state courts by15## Michael Nelson16## Summer, 201717import os18import re19import csv20import string21import operator22import datetime23#mydir = "C:/Users/Steve/Desktop/Summer_Work/"24mydir = "C:/Users/sum410/Dropbox/PSU2018-2019/RA/Scraper/"25def expandmonth(mstring2):26 mstring2 = re.sub("Jan\.", "January", mstring2)27 mstring2 = re.sub("Feb\.", "February", mstring2)28 mstring2 = re.sub("Mar\.", "March", mstring2)29 mstring2 = re.sub("Apr\.", "April", mstring2)30 mstring2 = re.sub("Aug\.", "August", mstring2)31 mstring2 = re.sub("Sept\.", "September", mstring2)32 mstring2 = re.sub("Oct\.", "October", mstring2)33 mstring2 = re.sub("Nov\.", "November", mstring2)34 mstring2 = re.sub("Dec\.", "December", mstring2)35 return mstring236def month2number(mstring):37 mnumber = -99938 if (mstring == "January"):39 mnumber = "01"40 if (mstring == "February"):41 mnumber = "02"42 if (mstring == "March"):43 mnumber = "03"44 if (mstring == "April"):45 mnumber = "04"46 if (mstring == "May"):47 mnumber = "05"48 if (mstring == "June"):49 mnumber = "06"50 if (mstring == "July"):51 mnumber = "07"52 if (mstring == "August"):53 mnumber = "08"54 if (mstring == "September"):55 mnumber = "09"56 if (mstring == "October"):57 mnumber = "10"58 if (mstring == "November"):59 mnumber = "11"60 if (mstring == "December"):61 mnumber = "12"62 return mnumber63def Capitalize(nstring):64 if(len(nstring) > 1 and not re.match("MC|Mc|Mac|MAC", nstring)): #O'|Van|VAN65 nstring = string.upper(nstring[0]) + string.lower(nstring[1:])66 if(re.match("MC|Mc|mc", nstring)):67 nstring = string.upper(nstring[0]) + string.lower(nstring[1]) + string.upper(nstring[2]) + string.lower(nstring[3:])68 if(re.match("MAC|Mac", nstring)):69 nstring = string.upper(nstring[0]) + string.lower(nstring[1:3]) + string.upper(nstring[3]) + string.lower(nstring[4:])70 if(re.match("MACY|Macy|MacY", nstring)):71 nstring = string.upper(nstring[0]) + string.lower(nstring[1]) + string.upper(nstring[2]) + string.lower(nstring[3:])72 # if(re.match("O\'", nstring)):73 # nstring = string.upper(nstring[0]) + nstring[1] + string.upper(nstring[2]) + string.lower(nstring[3:])74 if(re.match("Van\s|VAN\s", nstring)):75 nstring = string.upper(nstring[0]) + string.lower(nstring[1:4]) + string.upper(nstring[4]) + string.lower(nstring[5:])76 if(len(nstring) == 1):77 nstring = string.upper(nstring)78 return nstring79def lastname(nstring):80 last_name = ""81 nstring = re.sub(",", "", nstring)82 nstring = string.strip(nstring)83 nstring = re.sub("BY THE COURT", "", nstring)84 nstring = re.sub("PER CURIAM[;]*", "", nstring)85 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)86 #nstring = re.sub("\(In Part\)", "", nstring)87 #nstring = re.sub("[\s]+", " ", nstring)88 names_holder = re.split("\s", nstring)89 if(len(names_holder) == 1):90 last_name = names_holder[0]91 if(len(names_holder) == 2): #and not re.search(",", nstring)):92 last_name = names_holder[1]93 #if(len(names_holder) == 2): #and re.search(",", nstring)):94 #last_name = names_holder[1]95 if(len(names_holder) == 3 and not re.search(",", nstring)):96 last_name = names_holder[2]97 if(len(names_holder) == 3 and re.search(",", nstring)):98 last_name = names_holder[2]99 if(len(names_holder) == 4): #and not re.search(",", nstring)):100 last_name = names_holder[2] + " " + names_holder[3]101 if(len(names_holder) == 4 and re.search(",", nstring)):102 last_name = names_holder[0] + " " + names_holder[1]103 last_name = re.sub(",", "", last_name)104 last_name = re.sub("\.", "", last_name)105 last_name = Capitalize(last_name)106 return last_name107def firstname(nstring):108 first_name = ""109 nstring = nstring.strip() # previously was string.strip(nstring) but I believe that is incorrect110 nstring = re.sub("BY THE COURT", "", nstring)111 nstring = re.sub("PER CURIAM[;]*", "", nstring)112 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)113 #nstring = re.sub("\(In Part\)", "", nstring)114 #nstring = re.sub("[\s]+", " ", nstring)115 names_holder = re.split("\s", nstring)116 if(len(names_holder) == 2 and not re.search(",", nstring)):117 first_name = names_holder[0]118 if(len(names_holder) == 2 and re.search(",", nstring)):119 first_name = names_holder[1]120 if(len(names_holder) == 3 and not re.search(",", nstring)):121 first_name = names_holder[0]122 if(len(names_holder) == 3 and re.search(",", nstring)):123 first_name = names_holder[1]124 if(len(names_holder) == 4 and not re.search(",", nstring)):125 first_name = names_holder[0]126 if(len(names_holder) == 4 and re.search(",", nstring)):127 first_name = names_holder[2]128 first_name = re.sub(",", "", first_name)129 first_name = Capitalize(first_name)130 return first_name131def middlename(nstring):132 middle_name = ""133 nstring = string.strip(nstring)134 nstring = re.sub("BY THE COURT", "", nstring)135 nstring = re.sub("PER CURIAM[;]*", "", nstring)136 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)137 #nstring = re.sub("\(In Part\)", "", nstring)138 #nstring = re.sub("[\s]+", " ", nstring)139 names_holder = re.split("\s", nstring)140 if(len(names_holder) == 3 and not re.search(",", nstring)):141 middle_name = names_holder[1]142 if(len(names_holder) == 3 and re.search(",", nstring)):143 middle_name = names_holder[2]144 if(len(names_holder) == 4 and not re.search(",", nstring)):145 middle_name = names_holder[1]146 if(len(names_holder) == 4 and re.search(",", nstring)):147 middle_name = names_holder[3]148 middle_name = re.sub(",", "", middle_name)149 middle_name = Capitalize(middle_name)150 return middle_name151def namesuffix(nstring):152 suffix = ""153 nstring = string.strip(nstring)154 nstring = re.sub("BY THE COURT", "", nstring)155 nstring = re.sub("PER CURIAM[;]*", "", nstring)156 #nstring = re.sub("\(In Part\)", "", nstring)157 #nstring = re.sub("[\s]+", " ", nstring)158 if(re.search("Jr\.|JR\.", nstring)):159 suffix = "Jr."160 if(re.search("III", nstring)):161 suffix = "III"162 if(re.search("II", nstring)):163 suffix = "II"164 if(re.search("Sr\.|SR\.", nstring)):165 suffix = "Sr."166 return suffix167def first_sentence(value):168 """ Take just the first sentence of the HTML passed in.169 """170 words = value.split()171 # Collect words until the result is a sentence.172 sentence = ""173 while words:174 if sentence:175 sentence += " "176 sentence += words.pop(0)177 if not re.search(r'[.?!][)"]*$', sentence):178 # End of sentence doesn't end with punctuation.179 continue180 #if words and not re.search(r'^[("]*[A-Z0-9]', words[0]):181 # Next sentence has to start with upper case.182 continue183 if re.search(r'(Mr\.|Mrs\.|Ms\.|Dr\.| [A-Z]\.)$', sentence):184 # If the "sentence" ends with a title or initial, then it probably185 # isn't the end of the sentence.186 continue187 if sentence.count('(') != sentence.count(')'):188 # A sentence has to have balanced parens.189 continue190 if sentence.count('"') % 2:191 # A sentence has to have an even number of quotes.192 continue193 break194 return sentence195def state_ab(value):196 # state_abbr = ""197 if(re.search("Alabama", value)):198 state_abbr = "AL"199 return state_abbr200 elif (re.search("Alaska", value)):201 state_abbr = "AK"202 return state_abbr203 elif (re.search("Arkansas", value)):204 state_abbr = "AR"205 return state_abbr206 elif (re.search("Arizona", value)):207 state_abbr = "AZ"208 return state_abbr209 elif (re.search("California", value)):210 state_abbr = "CA"211 return state_abbr212 elif (re.search("Colorado", value)):213 state_abbr = "CO"214 return state_abbr215 elif (re.search("Connecticut", value)):216 state_abbr = "CT"217 return state_abbr218 elif (re.search("Delaware", value)):219 state_abbr = "DE"220 return state_abbr221 elif (re.search("Florida", value)):222 state_abbr = "FL"223 return state_abbr224 elif (re.search("Georgia", value)):225 state_abbr = "GA"226 return state_abbr227 elif (re.search("Hawaii", value)):228 state_abbr = "HI"229 return state_abbr230 elif (re.search("Hawai'i", value)):231 state_abbr = "HI"232 return state_abbr233 elif (re.search("Idaho", value)):234 state_abbr = "ID"235 return state_abbr236 elif (re.search("Illinois", value)):237 state_abbr = "IL"238 return state_abbr239 elif (re.search("Indiana", value)):240 state_abbr = "IN"241 return state_abbr242 elif (re.search("Iowa", value)):243 state_abbr = "IA"244 return state_abbr245 elif (re.search("Kansas", value)):246 state_abbr = "KS"247 return state_abbr248 elif (re.search("Kentucky", value)):249 state_abbr = "KY"250 return state_abbr251 elif (re.search("Louisiana", value)):252 state_abbr = "LA"253 return state_abbr254 elif (re.search("Maine", value)):255 state_abbr = "ME"256 return state_abbr257 elif (re.search("Maryland", value)):258 state_abbr = "MD"259 return state_abbr260 elif (re.search("Massachusetts", value)):261 state_abbr = "MA"262 return state_abbr263 elif (re.search("Michigan", value)):264 state_abbr = "MI"265 return state_abbr266 elif (re.search("Minnesota", value)):267 state_abbr = "MN"268 return state_abbr269 elif (re.search("Mississippi", value)):270 state_abbr = "MS"271 return state_abbr272 elif (re.search("Missouri", value)):273 state_abbr = "MO"274 return state_abbr275 elif (re.search("Montana", value)):276 state_abbr = "MT"277 return state_abbr278 elif (re.search("Nebraska", value)):279 state_abbr = "NE"280 return state_abbr281 elif (re.search("Nevada", value)):282 state_abbr = "NV"283 return state_abbr284 elif (re.search("New Hampshire", value)):285 state_abbr = "NH"286 return state_abbr287 elif (re.search("New Jersey", value)):288 state_abbr = "NJ"289 return state_abbr290 elif (re.search("New Mexico", value)):291 state_abbr = "NM"292 return state_abbr293 elif (re.search("New York", value)):294 state_abbr = "NY"295 return state_abbr296 elif (re.search("North Carolina", value)):297 state_abbr = "NC"298 return state_abbr299 elif (re.search("North Dakota", value)):300 state_abbr = "ND"301 return state_abbr302 elif (re.search("Ohio", value)):303 state_abbr = "OH"304 return state_abbr305 elif (re.search("Supreme Court of Oklahoma", value)):306 state_abbr = "OK-SC"307 return state_abbr308 elif (re.search("Oregon", value)):309 state_abbr = "OR"310 return state_abbr311 elif (re.search("Pennsylvania", value)):312 state_abbr = "PA"313 return state_abbr314 elif (re.search("Rhode Island", value)):315 state_abbr = "RI"316 return state_abbr317 elif (re.search("South Carolina", value)):318 state_abbr = "SC"319 return state_abbr320 elif (re.search("Tennessee", value)):321 state_abbr = "TN"322 return state_abbr323 elif (re.search("Texas", value)):324 state_abbr = "TX-SC"325 return state_abbr326 elif (re.search("Utah", value)):327 state_abbr = "UT"328 return state_abbr329 elif (re.search("Vermont", value)):330 state_abbr = "VT"331 return state_abbr332 elif (re.search("Washington", value)):333 state_abbr = "WA"334 return state_abbr335 elif (re.search("West Virginia", value)):336 state_abbr = "WV"337 return state_abbr338 elif (re.search("Wisconsin", value)):339 state_abbr = "WI"340 return state_abbr341 elif (re.search("Wyoming", value)):342 state_abbr = "WY"343 return state_abbr344# .csv file where extracted metadata will be stored345fout = open(mydir + "mand_arb.csv", "wb")346outfilehandle = csv.writer(fout,347 delimiter=",",348 quotechar='"',349 quoting=csv.QUOTE_NONNUMERIC)350check = open(mydir + "check_recusals.csv", "wb")351recuse_handle = csv.writer(check,352 delimiter=",",353 quotechar='"',354 quoting=csv.QUOTE_NONNUMERIC)355master = open(mydir + "States_MasterFile_Import.csv", "rb")356# Create your own label for each column of the metadata .csv file357localrow = []358localrow.append("Email")359localrow.append("FirstName")360localrow.append("LastName")361localrow.append("court")362localrow.append("date")363localrow.append("state")364localrow.append("panel_state")365localrow.append("parties")366localrow.append("docket")367localrow.append("citestring")368localrow.append("LexisCite")369localrow.append("WestLaw")370localrow.append("attorneys")371localrow.append("judges")372localrow.append("judgeNP")373localrow.append("Judge1_Last_Name")374localrow.append("Judge1_Vote")375localrow.append("Judge1_code")376localrow.append("Judge2_Last_Name")377localrow.append("Judge2_Vote")378localrow.append("Judge2_code")379localrow.append("Judge3_Last_Name")380localrow.append("Judge3_Vote")381localrow.append("Judge3_code")382localrow.append("Judge4_Last_Name")383localrow.append("Judge4_Vote")384localrow.append("Judge4_code")385localrow.append("Judge5_Last_Name")386localrow.append("Judge5_Vote")387localrow.append("Judge5_code")388localrow.append("Judge6_Last_Name")389localrow.append("Judge6_Vote")390localrow.append("Judge6_code")391localrow.append("Judge7_Last_Name")392localrow.append("Judge7_Vote")393localrow.append("Judge7_code")394localrow.append("Judge8_Last_Name")395localrow.append("Judge8_Vote")396localrow.append("Judge8_code")397localrow.append("Judge9_Last_Name")398localrow.append("Judge9_Vote")399localrow.append("Judge9_code")400localrow.append("Judge10_Last_Name")401localrow.append("Judge10_Vote")402localrow.append("Judge10_code")403localrow.append("Judge11_Last_Name")404localrow.append("Judge11_Vote")405localrow.append("Judge11_code")406localrow.append("dissent")407localrow.append("dissent_no")408localrow.append("dissent_name")409localrow.append("dissent_1")410localrow.append("dissent_2")411localrow.append("dissent_3")412localrow.append("dissent_4")413localrow.append("dissent_5")414localrow.append("concurrence")415localrow.append("concur_no")416localrow.append("concur_name")417localrow.append("check")418outfilehandle.writerow(localrow)419recuse_handle.writerow(localrow)420# Name of folder where all cases are located (and nothing else)421dirname = mydir + "mandArb/"422dirlist = os.listdir(dirname)423cleandirlist = []424for entry in dirlist:425 matchresult = re.match('.+\\.txt$', entry)426 if matchresult != None:427 cleandirlist.append(matchresult.group())428#dirlist = [file for file in dirlist if len(file) > 20]429# Use (uncomment) following line to test code on a small handful of cases430#cleandirlist = cleandirlist[838:872]431for entry in cleandirlist: ## each entry is a txt file with an opinion 0:1025432 # initialize all variables to be used433 infilepath = dirname + entry434 infilehandle = open(infilepath)435 txtlines = infilehandle.readlines()436 action_number = 0437 case_with_preamble = False438 searchterms_line = False439 blank_after_searchterms = False440 parties_line = False441 blank_after_parties = False442 docket_line = False443 blank_after_docket = False444 court_line = False445 blank_after_court = False446 fn_line = False447 cite_line = False448 blank_after_cite = False449 action_line = False450 disposition_line = False451 prior_history_line = False452 headnotes_line = False453 trunc_text = False454 judges_line = False455 opin_by_line = False456 opinion_line = False457 dissent_by_line = False458 concur_by_line = False459 blank_after_appellant_attorney = False460 jud_dissent = 0461 opinion_word_count = 0462 amicus = 0463 localrow = []464 action_number = 0465 judges_part_string = ""466 searchterms_string = ""467 shep_treat = ""468 parties_string = ""469 docketnum = ""470 court_string = ""471 cite_string = ""472 Fed_cite = ""473 Lexis_cite = ""474 West_cite = ""475 action_string = ""476 per_curiam = 0477 unanimous = 0478 action1 = ""479 date = ""480 action1_month = ""481 action1_day = ""482 action1_year = ""483 action1_date = ""484 action1_action = ""485 action2 = ""486 action2_month = ""487 action2_day = ""488 action2_year = ""489 action2_date = ""490 action2_action = ""491 prior_history_string = ""492 sub_history_string = ""493 disposition_string = ""494 pubdef = 0495 prose = 0496 attorney_string = ""497 pc_holder = ""498 judges_string = ""499 judge1_ln = ""500 judge1_fn = ""501 judge1_mn = ""502 judge1_suf = ""503 judge1_full = ""504 judge2_ln = ""505 judge2_fn = ""506 judge2_mn = ""507 judge2_suf = ""508 judge2_full = ""509 judge3_ln = ""510 judge3_fn = ""511 judge3_mn = ""512 judge3_suf = ""513 judge3_full = ""514 judge4_ln = ""515 judge4_fn = ""516 judge4_mn = ""517 judge4_suf = ""518 judge4_full = ""519 judge5_ln = ""520 judge5_fn = ""521 judge5_mn = ""522 judge5_suf = ""523 judge5_full = ""524 judge6_ln = ""525 judge6_fn = ""526 judge6_mn = ""527 judge6_suf = ""528 judge6_full = ""529 judge7_ln = ""530 judge7_fn = ""531 judge7_mn = ""532 judge7_suf = ""533 judge7_full = ""534 judge8_ln = ""535 judge8_fn = ""536 judge8_mn = ""537 judge8_suf = ""538 judge8_full = ""539 judge9_ln = ""540 judge9_fn = ""541 judge9_mn = ""542 judge9_suf = ""543 judge9_full = ""544 judge10_ln = ""545 judge10_fn = ""546 judge10_mn = ""547 judge10_suf = ""548 judge10_full = ""549 judge11_ln = ""550 judge11_fn = ""551 judge11_mn = ""552 judge11_suf = ""553 judge11_full = ""554 opin_by_string = ""555 author_ln = ""556 author_fn = ""557 author_mn = ""558 author_suf = ""559 author_full = ""560 dissent1_ln = ""561 dissent1_fn = ""562 dissent1_mn = ""563 dissent1_suf = ""564 dissent1_full = ""565 dissent2_ln = ""566 dissent2_fn = ""567 dissent2_mn = ""568 dissent2_suf = ""569 dissent2_full = ""570 dissent3_ln = ""571 dissent3_fn = ""572 dissent3_mn = ""573 dissent3_suf = ""574 dissent3_full = ""575 dissent4_ln = ""576 dissent4_fn = ""577 dissent4_mn = ""578 dissent4_suf = ""579 dissent4_full = ""580 dissent5_ln = ""581 dissent5_fn = ""582 dissent5_mn = ""583 dissent5_suf = ""584 dissent5_full = ""585 concur1_ln = ""586 concur1_fn = ""587 concur1_mn = ""588 concur1_suf = ""589 concur1_full = ""590 concur2_ln = ""591 concur2_fn = ""592 concur2_mn = ""593 concur2_suf = ""594 concur2_full = ""595 concur3_ln = ""596 concur3_fn = ""597 concur3_mn = ""598 concur3_suf = ""599 concur3_full = ""600 concur4_ln = ""601 concur4_fn = ""602 concur4_mn = ""603 concur4_suf = ""604 concur4_full = ""605 concur5_ln = ""606 concur5_fn = ""607 concur5_mn = ""608 concur5_suf = ""609 concur5_full = ""610 concur6_ln = ""611 concur6_fn = ""612 concur6_mn = ""613 concur6_suf = ""614 concur6_full = ""615 concur7_ln = ""616 concur7_fn = ""617 concur7_mn = ""618 concur7_suf = ""619 concur7_full = ""620 concur_by_string = ""621 dissent_by_string = ""622 no_part_list = [] ####623 no_part_string = "" ####624 full_judges_holder = []625 judges_holder = []626 dissent_holder = []627 concur_holder = []628 no_part = False629 no_part_dich = 0630 shep_line = False631 blank_after_shep = False632 court_line = False633 blank_after_court = False634 cite_line = False635 blank_after_cite = False636 action_line = False637 disposition_line = False638 prior_history_line = False639 headnotes_line = False640 sub_history_line = False641 judges_line = False642 attorney_line = False643 #appellee_attorney_line = False644 opin_by_line = False645 opinion_line = False646 dissent_by_line = False647 concur_by_line = False648 dissent_author_1 = ""649 dissent_author_2 = ""650 dissent_author_3 = ""651 dissent_author_4 = ""652 dissent_author_5 = ""653 opinion_word_count = 0654 circuit = 0655 en_banc = ""656 dissent = 0657 concur = 0658 rehearing = ""659 check_case = 0660 op_string = ""661 unpublished = 0662 num_dissent = 0663 num_concur = 0664 unwritten_dissent = 0665 firstcite_line = False666 firstcite_string = ""667 blank_after_firstcite = False668 caseid = str(re.split("\.", entry)[0])669 print "\n" + entry670 pet_str = ""671 res_str = ""672 opinion_start = False673 dissent_line = False674 concur_line = False675 blank_after_action = False676 line_before_first = False677 judge1_vote = ""678 judge2_vote = ""679 judge3_vote = ""680 judge4_vote = ""681 judge5_vote = ""682 judge6_vote = ""683 judge7_vote = ""684 judge8_vote = ""685 judge9_vote = ""686 judge10_vote = ""687 judge11_vote = ""688 panel = 0689 judges_np = ""690 state_abbr = ""691 judge_np_list = []692 judge_np1 = ""693 judge_np2 = ""694 judge_np3 = ""695 judge_np4 = ""696 other_dissent_string = ""697 other_dissent_judges = []698 silent_dissent = False699 silent_judge1 = ""700 silent_judge2 = ""701 silent_judge3 = ""702 silent_judge4 = ""703 silent_judge5 = ""704 first_dissent = False705 other_dissent = ""706 new_date = ""707 date_bool = False708 between = False709 non_panel_judge_string = ""710 other_dissent_holder = []711 part_judges = ""712 judge1_code = ""713 judge2_code = ""714 judge3_code = ""715 judge4_code = ""716 judge5_code = ""717 judge6_code = ""718 judge7_code = ""719 judge8_code = ""720 judge9_code = ""721 judge10_code = ""722 judge11_code = ""723 one_month = datetime.timedelta(365*3) #/12724 judges_AL = []725 MD_date = False726 dock = False727 docket = False728 check_recuse = False729 check_recuse_case = 0730 # each txtline is one "line" in the text file: the end of a line is determined by \n731 for txtline in txtlines:732 # proceeding logic of script based on boolean operators causes all text prior to the line beginning with "Copy Citation" to be ignored733 if (re.search("^Copy Citation",txtline)):734 line_before_first = True735 if (line_before_first and re.search("(COURT|Court)", txtline) and not re.search("^1 ", txtline)):736 ## the court in which the case was heard737 line_before_first = False738 court_line = True739 court_string = court_string + txtline740 court_string = court_string.strip()741 print court_string742 state_abbr = state_ab(court_string) ###function to return state abbreviations743 if (re.search("Alabama|Arizona|Connecticut|Delaware|Florida|Idaho|Massachusetts|Mississippi|Montana|Nevada|New Hampshire|Virginia", court_string)):744 # all cases in states that hear cases in panels are given a value of 1745 panel = 1746 if re.search("West Virginia", court_string):747 # the prior if statement matches "Virginia" in "West Virginia"; this corrects the incorrect panel assignment value748 panel = 0749 if(court_line and re.search("Jan|Feb|Mar|Apr|May|June|July|Aug|Sep|Oct|Nov|Dec|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC", txtline)) and state_abbr != "MD" and not re.search("Argued$", txtline): #re.match("^[\s]+$", txtline)):750 ## this is the blank line after court751 # stores date and action of court (i.e. Decided, Released, Filed)752 blank_after_firstcite = False753 court_line = False754 blank_after_court = True755 #print txtline756 action_line = True757 if (len(action_string) < 1):758 action_string = action_string + txtline759 dock = True760 if len(action_string) < 2:761 MD_date = True762 if state_abbr == "MD" and re.match("Jan|Feb|Mar|Apr|May|June|July|Aug|Sep|Oct|Nov|Dec", txtline) and MD_date == True:763 action_string = txtline764 MD_date = False765 blank_after_firstcite = False766 court_line = False767 blank_after_court = True768 #print txtline769 action_line = True770 if(action_line): #and re.match("^[\s]+$", txtline)):771 # parse out unnecessary text from action string (Date and Procedural Documentation of Publication) for only the date to remain772 blank_after_court = False773 blank_after_action = True774 action_line = False775 if re.search("Argued; ;", action_string):776 action_string = action_string.split("Argued; ;", 1)[1]777 if re.search("Argued ;", action_string):778 action_string = action_string.split("Argued ;", 1)[1]779 if re.search("Argued;", action_string):780 action_string = action_string.split("Argued;", 1)[1]781 if re.search("Argued and submitted ;", action_string):782 action_string = action_string.split("Argued and submitted ;", 1)[1]783 if re.search("Argued and submitted;", action_string):784 action_string = action_string.split("Argued and submitted;", 1)[1]785 if re.search("Submitted ;", action_string):786 action_string = action_string.split("Submitted ;", 1)[1]787 if re.search("Submitted;", action_string):788 action_string = action_string.split("Submitted;", 1)[1]789 if re.search("Submitted on Briefs ;", action_string):790 action_string = action_string.split("Submitted on Briefs ;", 1)[1]791 if re.search("Submitted on Briefs;", action_string):792 action_string = action_string.split("Submitted on Briefs;", 1)[1]793 if re.search("Heard in the Supreme Court ;", action_string):794 action_string = action_string.split("Heard in the Supreme Court ;", 1)[1]795 if re.search("Heard in the Supreme Court;", action_string):796 action_string = action_string.split("Heard in the Supreme Court;", 1)[1]797 if re.search("Heard ;", action_string):798 action_string = action_string.split("Heard ;", 1)[1]799 if re.search("Heard;", action_string):800 action_string = action_string.split("Heard;", 1)[1]801 if re.search("Session;", action_string):802 action_string = action_string.split("Session;", 1)[1]803 if re.search("Session ;", action_string):804 action_string = action_string.split("Session ;", 1)[1]805 if re.search("Argument ;", action_string):806 action_string = action_string.split("Argument ;", 1)[1]807 if re.search("Argument;", action_string):808 action_string = action_string.split("Argument;", 1)[1]809 print action_string810 action_string = expandmonth(action_string)811 action_string = re.sub(":", ",", action_string)812 action_string = re.sub(";", ",", action_string)813 action_string = re.sub("\*", "", action_string)814 action_string = re.sub("Argued and Submitted ", "Argued and Submitted, ", action_string)815 action_string = re.sub("Argued ", "Argued, ", action_string)816 action_string = re.sub(", Decided ", "", action_string)817 action_string = re.sub("Supplemental Briefing Submitted ", "Supplemental Briefing Submitted, ", action_string)818 action_string = re.sub(", Released", "", action_string)819 action_string = re.sub(", RELEASED", "", action_string)820 action_string = re.sub(", Filed", "", action_string)821 action_string = re.sub("Submitted Under Third Circuit Rule 12\(6\) ", "Submitted Under Third Circuit Rule 12(6), ", action_string)822 action_string = re.sub("Cause argued ", "Cause argued, ", action_string)823 split_action = re.split("\n", action_string)824 action1 = string.strip(split_action[0])825 action2 = string.strip(split_action[1])826 action2 = re.split(", ", action2)827 action1 = re.split(", ", action1)828 if(len(split_action) < 2):829 action1[1] = re.sub("\.", "", action1[1])830 action1[1] = re.sub(",", "", action1[1])831 action1[0] = re.sub("Argued ", "", action1[0])832 action1[0] = re.sub("Submitted ", "", action1[0])833 date = date + action1[0] + ", " + action1[1]834 if(len(action1) > 2 and len(date) == 0 and re.search("Decided|DECIDED", action1[2])):835 date = date + action1[0] + ", " + action1[1]836 if(len(action1) > 2 and len(date) == 0 and re.search("Filed|FILED", action1[2])):837 date = date + action1[0] + ", " + action1[1]838 if(len(action2) > 2 and len(date) == 0 and re.search("Decided|DECIDED", action2[2])):839 date = date + action2[0] + ", " + action2[1]840 if(len(action2) > 2 and len(date) == 0 and re.search("Filed|FILED", action2[2])):841 date = date + action2[0] + ", " + action2[1]842 if(len(action2) > 1 and len(date)==0):843 date = date + action2[0] + ", " + action2[1]844 date = re.sub(",$", "", date)845 date = re.sub("\*", "", date)846 date = re.sub("\.", "", date)847 if(len(action2) > 1 and len(date)==0):848 date = date + action2[0] + ", " + action2[1]849 date = re.sub(",$", "", date)850 date = re.sub("\.", "", date)851 action_string = string.strip(action_string)852 action_string = re.sub("[\s]+", " ", action_string)853 action_string = re.sub("Decided|decided|DECIDED", " ", action_string)854 action_string = re.sub("Filed|filed|FILED", " ", action_string)855 # one case has incorrect formatting of the date and it causes the program to break when calling teh strptime function856 if action_string == "December 22 1995":857 action_string = "December 22, 1995"858 # Dates from Maryland cases do not parse correctly859 if action_string != "Court of Appeals of Maryland":860 x = re.search("\d{4}", action_string)861 # store in x the position of the last digit of the year862 x = x.end()863 if new_date == "":864 date_bool = True865 if(x != -1 and date_bool):866 new_date = action_string[:x]867 date_bool = False868 if(x == -1):869 new_date = action_string870 if state_abbr != "MC":871 # format dates so they match the format from the state judge master file872 new_date = re.sub("April,", "April", new_date)873 new_date = re.sub("On ", "", new_date)874 date_format = datetime.datetime.strptime(new_date, '%B %d, %Y').date()875 elif state_abbr == "MC":876 date_format = datetime.datetime.strptime('1/1/1800', '%m/%d/%Y').date()877 # match state abbrevation and date decided from case and state master file to produce a list of judges who were on the bench at time of decision for cases heard in non-panel state878 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:879 reader = csv.reader(f)880 next(f)881 for row in reader:882 state = row[0]883 name = row[3]884 if len(row[4]) == 4 and row[0] != "MC":885 row[4] = "1/1/" + row[4]886 if len(row[5]) == 4 and row[0] != "MC": #and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL"))) and len(judge6_ln) > 2 and len(judge9_ln) < 2:887 row[5] = "1/1/" + row[5]888 #print state_abbr889 if len(row[4]) != 4 and row[0] != "MC" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH"))) and ((len(judge6_ln) > 2 or len(judge3_ln) < 2) and len(judge9_ln) < 2) and state_abbr:890 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()891 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date()892 if ((panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and state_abbr != "AK" and (len(judge6_ln) > 2) and len(judge9_ln) < 2)) and start <= date_format <= end):893 between = True894 #print state_abbr895 if ((state == state_abbr) and between and row[0] != "MC" and row[2] == 0 and state_abbr != "AK" and (panel == 0 or (state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH")) and (len(judge6_ln) > 2 or len(judge3_ln) < 2) and len(judge9_ln) < 2):896 if non_panel_judge_string == "":897 non_panel_judge_string = non_panel_judge_string + row[3]898 else:899 non_panel_judge_string = non_panel_judge_string + ", " + row[3]900 if row[3] == judge1_ln:901 judge1_code = row[1]902 between = False903 #judges_string = judges_string + ", " + non_panel_judge_string904 non_panel_list = non_panel_judge_string.split(",")905 non_panel_list.sort()906 master.close()907 if (docketnum == "") or not re.search("[0-9]", docketnum):908 if(not re.search("LEXIS", txtline) and re.search("^([\d]+$|Docket|Misc|No\.|Nos\.|SC |File Nos. |File No. |Arizona Supreme Court No. |L. A. Nos. |SCWC-|Cause No. |Supreme Court Cause Number |S[\d][\d]|A[\d][\d]|S. Ct. NO. |[\d] Div. |CASE NO.:|L.A. No. |\[NO NUMBER|\[No number in original|[\w]-|Supreme Court Case |Supreme Court No. |Supreme Court No. |Supreme Court Case No. |Law Docket No. |SUPREME COURT DOCKET NO. |Record No. |SUPREME COURT DOCKET NO. |Sac. No. |\([\d]+\)|\(SC |NO|C\.A\.|\# [\d]|[\d][\d][\d][\d]-|SJC-|Decision No. |DA |CA |[\d][\d]-|91-|Opinion No\.|DOCKET|Case No|[\d][\d][\d][\d][\d][\d][\d], [\d][\d][\d][\d][\d][\d][\d]|S[\d][\d][\d][\d][\d][\d]|Yor-[\d][\d]|Cum-[\d][\d]|C[\d]-[\d]|Case Number:|S.C. No. |NO.|Appeal No. |Supreme Court Nos. |S.F. No. |SCCQ-[\d]|[\d][\d][\d][\d][\d]-|Indiana Supreme Court Cause No. |[\d]|[\d][\d][\d][\d][\d][\d][\d])", txtline) and not re.search("Supreme Court of Pennsylvania",txtline) and not re.search("Supreme Court of Delaware",txtline) and not re.search("Court of Appeals of New York",txtline) and not re.search("^1. ",txtline) and not re.search("^2. ",txtline) and not re.search("^3. ",txtline) and not re.search("^4. ",txtline) and not re.search("^5. ",txtline)):909 ## the docket number910 docket_line = True911 action_line = False912 blank_after_action = True913 docketnum = docketnum + txtline914 ##OLDER PA (and some DE) CASES DON'T HAVE DOCKETS. THIS FIXES THE ISSUE915 elif(blank_after_action and not re.search("^([\d]+$|Docket|Misc|No\.|Nos\.|SC |File Nos. |File No. |Arizona Supreme Court No. |L. A. Nos. |SCWC-|Cause No. |Supreme Court Cause Number |S[\d][\d]|A[\d][\d]|S. Ct. NO. |[\d] Div. |CASE NO.:|L.A. No. |\[NO NUMBER|\[No number in original|[\w]-|Supreme Court Case |Supreme Court No. |Supreme Court No. |Supreme Court Case No. |Law Docket No. |SUPREME COURT DOCKET NO. |Record No. |SUPREME COURT DOCKET NO. |Sac. No. |\([\d]+\)|\(SC |NO|C\.A\.|\# [\d]|[\d][\d][\d][\d]-|SJC-|Decision No. |DA |CA |[\d][\d]-|91-|Opinion No\.|DOCKET|Case No|[\d][\d][\d][\d][\d][\d][\d], [\d][\d][\d][\d][\d][\d][\d]|S[\d][\d][\d][\d][\d][\d]|Yor-[\d][\d]|Cum-[\d][\d]|C[\d]-[\d]|Case Number:|S.C. No. |NO.|Appeal No. |Supreme Court Nos. |S.F. No. |SCCQ-[\d]|[\d][\d][\d][\d][\d]-|Indiana Supreme Court Cause No. |[\d]|[\d][\d][\d][\d][\d][\d].)", txtline) and re.search("Supreme Court of Pennsylvania",txtline) or re.search("Supreme Court of Delaware",txtline) or re.search("Court of Appeals of New York",txtline)):916 ## the docket number917 docketnum = docketnum + txtline918 docket_line = True919 action_line = False920 blank_after_docket = True921 if(re.match("^Reporter", txtline) and not opinion_start):922 ## this is the "Reporter" line after docket number923 blank_after_action = False924 docket_line = False925 blank_after_docket = True926 if(re.search(" > ", docketnum)):927 docketnum = ""928 # Store all citations listed by Lexis929 if((blank_after_docket) and re.search("LEXIS", txtline) and re.search("[\w]+", txtline) and not opinion_start):930 ## the citation block931 cite_line = True932 cite_string = cite_string + txtline933 cite_string = re.sub("[\s]+", " ", cite_string)934 cite_string = re.sub("[\*]+", "", cite_string)935 cite_string = re.sub("\xc2", "", cite_string)936 cite_string = re.sub("\xa0", "", cite_string)937 West_cite = cite_string.split("|")[0]938 #print West_cite939 if(cite_line and re.match("^[\s]+$", txtline)):940 ## done with citation block941 blank_after_docket = False942 cite_line = False943 blank_after_cite = True944 all_cites = re.split(" [\|] ", cite_string)945 ####print all_cites946 ##Fed_cite = [cite for cite in all_cites if re.search("[\s]F\.(2|3)d", cite)]947 Lexis_cite = [cite for cite in all_cites if re.search("LEXIS", cite)]948 try:949 ## Fed_cite = string.strip(Fed_cite[0])950 Lexis_cite = string.strip(Lexis_cite[0])951 except:952 print "Problem with citation"953 if(blank_after_cite and re.match("[\w]+", txtline)):954 ## the parties955 parties_line = True956 parties_string = parties_string + txtline957 #print txtline.replace("\n", "")958 # Store names of parties to the case959 if (parties_line and re.match("^[\s]+$", txtline)):960 ## done with parties block961 blank_after_cite = False962 parties_line = False963 blank_after_parties = True964 parties_string = re.sub("[\s]+", " ", parties_string)965 # Store text in Prior and Subsequent History lines966 if(re.match("^Subsequent History:", txtline)):967 sub_history_line = True968 parties_line = False969 if(sub_history_line and re.search("[\w]+", txtline)):970 sub_history_string = sub_history_string + txtline971 if (prior_history_line and re.match("^[\s]+$", txtline)):972 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)973 prior_history_string = re.sub("Prior History:", "", prior_history_string)974 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)975 prior_history_string = re.sub("\xa0", " ", prior_history_string)976 prior_history_string = re.sub("\n|\r", " ", prior_history_string)977 prior_history_string = string.strip(prior_history_string)978 sub_history_line = False979 if(re.match("^Prior History:", txtline)):980 prior_history_line = True981 parties_line = False982 if(prior_history_line and re.search("[\w]+", txtline)):983 prior_history_string = prior_history_string + txtline984 if (prior_history_line and re.match("^[\s]+$", txtline)):985 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)986 prior_history_string = re.sub("Prior History:", "", prior_history_string)987 prior_history_string = re.sub("Procedural Posture:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)988 prior_history_string = re.sub("Procedural Posture:", "", prior_history_string)989 prior_history_string = re.sub("\xa0", " ", prior_history_string)990 prior_history_string = re.sub("\n|\r", " ", prior_history_string)991 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)992 prior_history_string = string.strip(prior_history_string)993 prior_history_line = False994 if(re.match("^Procedural Posture:", txtline) and prior_history_string == ""):995 prior_history_line = True996 parties_line = False997 if(prior_history_line and re.search("[\w]+", txtline)):998 prior_history_string = prior_history_string + txtline999 if (prior_history_line and re.match("^[\s]+$", txtline)):1000 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)1001 prior_history_string = re.sub("Prior History:", "", prior_history_string)1002 prior_history_string = re.sub("Procedural Posture:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)1003 prior_history_string = re.sub("Procedural Posture:", "", prior_history_string)1004 prior_history_string = re.sub("\xa0", " ", prior_history_string)1005 prior_history_string = re.sub("\n|\r", " ", prior_history_string)1006 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)1007 prior_history_string = string.strip(prior_history_string)1008 prior_history_line = False1009 ###RKH USES OUTCOME instead of DISPOSITION because not every case has a DISPOSITION1010 if (re.match("^Disposition:", txtline) and disposition_string == ""):1011 ## disposition of case1012 disposition_line = True1013 #print disposition_string1014 if (disposition_line and re.search("[\w]+", txtline)):1015 ## disposition lines with text1016 disposition_string = disposition_string + txtline1017 #print disposition_string1018 if (disposition_line and re.match("^[\s]+$", txtline)):1019 ## blank line after disposition line1020 disposition_string = re.sub("Disposition:", "", disposition_string)1021 disposition_string = re.sub("Outcome:", "", disposition_string)1022 disposition_string = re.sub("\xa0", " ", disposition_string)1023 disposition_string = re.sub("\n|\r", " ", disposition_string)1024 disposition_string = re.sub("\[.+\]", "", disposition_string)1025 disposition_string = string.strip(disposition_string)1026 #print disposition_string1027 disposition_line = False1028 # Store outcome of case1029 if (re.match("^Outcome:", txtline)):1030 ## disposition of case1031 disposition_line = True1032 #print disposition_string1033 if (disposition_line and re.search("[\w]+", txtline)):1034 ## disposition lines with text1035 disposition_string = disposition_string + txtline1036 #print disposition_string1037 if (disposition_line and re.match("^[\s]+$", txtline)):1038 ## blank line after disposition line1039 disposition_string = re.sub("Outcome:", "", disposition_string)1040 disposition_string = re.sub("Disposition:", "", disposition_string)1041 disposition_string = re.sub("\xa0", " ", disposition_string)1042 disposition_string = re.sub("\n|\r", " ", disposition_string)1043 disposition_string = re.sub("\[.+\]", "", disposition_string)1044 disposition_string = re.sub("\[\**\d*\]", "", disposition_string)1045 disposition_string = string.strip(disposition_string)1046 #print disposition_string1047 disposition_line = False1048 # Search for presence of Per Curiam opinion1049 if re.search("^Opinion", txtline):1050 first_dissent = True1051 if (re.search("Opinion By: (PER CURIAM)|(Per Curiam)", txtline)):1052 #pc_holder = pc_holder + "Per Curiam. "1053 per_curiam = 11054 if (re.search("PER CURIAM", txtline)):1055 #pc_holder = pc_holder + "Per Curiam. "1056 per_curiam = per_curiam + 11057 if (re.search("^[\s]*Per Curiam[\.:\s]*$", txtline)):1058 per_curiam = 11059 #print pc_holder + "\n"1060 # Search for judges that join in dissenting opinions but are not listed as such in the judge line1061 if((first_dissent == True and re.search("dissents\.$|dissent\.$|dissenting\.$", txtline) and len(txtline) < 100 and not re.search("I respectfully dissent\.|I dissent\.|I therefore respectfully dissent\.", txtline)) or (re.search("joined\.$", txtline) and re.search("dissent", txtline))):1062 #print repr(txtline)1063 first_dissent = False1064 other_dissent = re.sub(" and", ",", txtline)1065 other_dissent = re.sub("filed a dissenting opinion", "", other_dissent)1066 other_dissent = re.sub("delivered the Opinion of the Court", "", other_dissent)1067 other_dissent = re.sub("All the Justices concur", "", other_dissent)1068 other_dissent = re.sub("\[\**\d\]", "", other_dissent)1069 other_dissent = re.sub("C\.J\.", "", other_dissent)1070 other_dissent = re.sub(" C\.", "", other_dissent)1071 other_dissent = re.sub("\[\*\*[0-9]+\]", "", other_dissent)1072 other_dissent = re.sub("For those reasons", "", other_dissent)1073 other_dissent = re.sub("dissenting", "", other_dissent)1074 other_dissent = re.sub("dissents\.|dissent\.|dissents|dissent", "", other_dissent)1075 other_dissent = re.sub("J\.;", "", other_dissent)1076 other_dissent = re.sub("C\.J\.|JJ\.|J\.J\.|J\.|C\. J\.", "", other_dissent)1077 #print other_dissent1078 if re.search("deliver", other_dissent):1079 other_dissent = other_dissent.split(".", 1)[1]1080 if re.search("filed a concurring opinion", other_dissent):1081 other_dissent = other_dissent.split(".", 1)[1]1082 #print other_dissent1083 other_dissent = re.sub("joined\.|joined|joins|join|JOINS|JOIN", "", other_dissent)1084 other_dissent = re.sub("in the|IN THE", "", other_dissent)1085 other_dissent = re.sub("in this", "", other_dissent)1086 other_dissent = re.sub("in which", "", other_dissent)1087 other_dissent = re.sub("Special Justice", "", other_dissent)1088 other_dissent = re.sub("JUSTICES|Justices|justices|JUSTICE|Justice|justice", "", other_dissent)1089 other_dissent = re.sub("\xc2", "", other_dissent)1090 other_dissent = re.sub("CHIEF|Chief|chief", "", other_dissent)1091 other_dissent = re.sub("Order affirmed, with costs", "", other_dissent)1092 other_dissent = re.sub("Opinion by|opinion by|OPINION BY", "", other_dissent)1093 other_dissent = re.sub("Judges|judges|JUDGES|judge|Judge|JUDGE", "", other_dissent)1094 other_dissent = re.sub("concurs|CONCURS|concur|CONCUR", "", other_dissent)1095 other_dissent = re.sub("\xa0", "", other_dissent)1096 other_dissent = re.sub("In Part", "", other_dissent)1097 other_dissent = re.sub("in part\.", "", other_dissent)1098 other_dissent = re.sub("in part", "", other_dissent)1099 other_dissent = re.sub("\[\*\*\*[\w]+\]", "", other_dissent)1100 other_dissent = re.sub("I respectfully", "", other_dissent)1101 other_dissent = re.sub("respectfully|RESPECTFULLY|Respectfully", "", other_dissent)1102 #other_dissent = re.sub("")1103# other_dissent = re.sub("\s", "", other_dissent)1104 other_dissent = re.sub("this", "", other_dissent)1105 other_dissent = re.sub("with whom", "", other_dissent)1106 other_dissent = re.sub("except", "", other_dissent)1107 other_dissent = re.sub(" who", "", other_dissent)1108 other_dissent = re.sub("reversed|REVERSED|reverse|REVERSE", "", other_dissent)1109 other_dissent = re.sub("authorizes me to state", "", other_dissent)1110 other_dissent = re.sub("that she", "", other_dissent)1111 other_dissent = re.sub("the views expressed", "", other_dissent)1112 other_dissent = re.sub("foregoing", "", other_dissent)1113 other_dissent = re.sub(" JR\.| JR", "", other_dissent)1114 other_dissent = re.sub(" SR\.| SR", "", other_dissent)1115 other_dissent = re.sub("specially|Specially|SPECIALLY", "", other_dissent)1116 other_dissent = re.sub("Order affirmed, with costs", "", other_dissent)1117 other_dissent = re.sub("affirmed|AFFIRMED", "", other_dissent)1118 other_dissent = re.sub("reason|reasons", "", other_dissent)1119 other_dissent = re.sub("'", "", other_dissent)1120 other_dissent = re.sub("Justice", "", other_dissent)1121 other_dissent = re.sub("filed an opinion", "", other_dissent)1122 other_dissent = re.sub("concurring in part", "", other_dissent)1123 other_dissent = re.sub("Part I", "", other_dissent)1124 other_dissent = re.sub("in part", "", other_dissent)1125 other_dissent = re.sub("Part|part", "", other_dissent)1126 dissent = 11127 other_dissent_holder = other_dissent.split(",")1128 other_dissent_holder = filter(None, other_dissent_holder)1129 if (re.search("^<truncate>", txtline)):1130 trunc_text = True1131 if (re.search("^</truncate>", txtline)):1132 trunc_text = False1133 if (re.match("^Counsel:", txtline) and not opinion_line):1134 attorney_line = True1135 # Store attorneys for appellee and appellant1136 if (attorney_line and re.search("^Judges|^Opinion", txtline) and not opinion_start and not re.search("^Opinion No.",txtline)):1137 attorney_line = False1138 attorney_string = re.sub("Counsel:\[\**\d*\]", "", attorney_string)1139 attorney_string = re.sub("Counsel:", "", attorney_string)1140 attorney_string = re.sub("\[\**\d*\]", "", attorney_string)1141 attorney_string = re.sub("\xa0", " ", attorney_string)1142 attorney_string = re.sub("\xc2", " ", attorney_string)1143 attorney_string = re.sub("\n|\r", " ", attorney_string)1144 attorney_string = string.strip(attorney_string)1145 attorney_line = False1146 if(attorney_line):1147 attorney_string = attorney_string + txtline1148 attorney_string = re.sub("Counsel:\[\**\d*\]", "", attorney_string)1149 attorney_string = re.sub("Counsel:", "", attorney_string)1150 attorney_string = re.sub("\[\**\d*\]", "", attorney_string)1151 attorney_string = re.sub("\xa0", " ", attorney_string)1152 attorney_string = re.sub("\xc2", " ", attorney_string)1153 attorney_string = re.sub("\n|\r", " ", attorney_string)1154 attorney_string = string.strip(attorney_string)1155 attorney_line = False1156 if (re.search("Public|public|PUBLIC|defender|DEFENDER|Defender", attorney_string)):1157 pubdef = 11158 if (re.search("(pro se)|(Pro se)|(Pro Se)|(pro Se)", attorney_string)):1159 prose = 11160 if (re.match("^Judges:", txtline) and not trunc_text):1161 ## judges hearing case1162 judges_line = True1163 if (judges_line and re.search("[\w]+", txtline)):1164 ## judges lines with text1165 judges_string = judges_string + txtline #+ ", " + non_panel_judge_string1166 if (judges_line and re.match("^[\s]+$", txtline)):1167 # new line or some whitespace after judges line1168 # Store and parse text of judges that recused themselves from the case1169 if (re.search("((N|n)ot (P|p)articipat(e|ing)|(R|r)ecus(e|es|ed)|RECUSED|(T|t)ak(e|es) no part| sitting for| disqualified|took no part|NOT PARTICIPATING|sitting in lieu of)", judges_string)):1170 no_part = True1171 no_part_dich = 11172 if len(re.findall('not participating|recusal|recused|disqualif', judges_string)) > 1:1173 check_recuse = True1174 check_recuse_case = 11175 full_judges_holder = re.sub(", (J|JJ)\.", " ", judges_string)1176 full_judges_holder = re.sub(" O\.", "", full_judges_holder)1177 full_judges_holder = re.sub(" C\.", "", full_judges_holder)1178 full_judges_holder = re.sub(" W\.", "", full_judges_holder)1179 full_judges_holder = re.split("\. ", full_judges_holder)1180 no_part_string = [sentence for sentence in full_judges_holder if re.search("((N|n)ot (P|p)articipat(e|ing)|(R|r)ecus(e|es|ed)|RECUSED| sitting for| disqualified|took no part|(T|t)ak(e|es) no part)|NOT PARTICIPATING|sitting in lieu of", sentence)]1181 no_part_string = str(no_part_string)1182 no_part_string = re.sub("(N|n)ot (P|p)articipat(e|ing).*", "", no_part_string)1183 no_part_string = re.sub("NOT PARTICIPATING", "", no_part_string)1184 no_part_string = re.sub("Recus(es|ed|e)", "", no_part_string)1185 no_part_string = re.sub("took no part in the consideration or decision of this case", "", no_part_string)1186 if re.search("except", no_part_string):1187 no_part_string = no_part_string.split("except", 1)[1]1188 if re.search("in place of", no_part_string):1189 no_part_string = no_part_string.split("in place of", 1)[1]1190 if re.search("IN PLACE OF", no_part_string):1191 no_part_string = no_part_string.split("IN PLACE OF", 1)[1]1192 if re.search("sitting for", no_part_string):1193 no_part_string = no_part_string.split("sitting for", 1)[1]1194 if re.search("sitting in lieu of", no_part_string):1195 no_part_string = no_part_string.split("sitting in lieu of", 1)[1]1196 if re.search("Concurring", no_part_string):1197 no_part_string = no_part_string.split("Concurring", 1)[1]1198 no_part_string = re.sub("who is disqualified", "", no_part_string)1199 no_part_string = re.sub(", sitting for Justice", "", no_part_string)1200 no_part_string = re.sub("recus(es|ed|e)|RECUSED\n|RECUSED", "", no_part_string)1201 no_part_string = re.sub("^[\s]+", "", no_part_string)1202 no_part_string = re.sub("[\s]*\*[\s]*", "", no_part_string)1203 no_part_string = re.sub("'", "", no_part_string)1204 no_part_string = re.sub("\[", "", no_part_string)1205 no_part_string = re.sub("Spaulding", "", no_part_string)1206 no_part_string = re.sub("District Court Judge", "", no_part_string)1207 no_part_string = re.sub("John McKeon|JOHN McKEON", "", no_part_string)1208 no_part_string = re.sub("\]", "", no_part_string)1209 no_part_string = re.sub("(Him|him|Her|her|Them|them)sel(f|ves)", "", no_part_string)1210 no_part_string = re.sub("All the Justices concur, except", "", no_part_string)1211 no_part_string = re.sub("(J|j)ustices,*", "", no_part_string)1212 no_part_string = re.sub("(J|j)ustice,*", "", no_part_string)1213 no_part_string = re.sub("JUSTIC(E|ES),*", "", no_part_string)1214 no_part_string = re.sub("Former Chief", "", no_part_string)1215 no_part_string = re.sub("Former", "", no_part_string)1216 no_part_string = re.sub("[\s]*(did|does)[\s]*", "", no_part_string)1217 no_part_string = re.sub("CJ\.", "", no_part_string)1218 no_part_string = re.sub(", (J|JJ|C\.J)\.,*", "", no_part_string)1219 no_part_string = re.sub("[\s] s[\s]*", "", no_part_string)1220 no_part_string = re.sub("J\.", " ", no_part_string)1221 no_part_string = re.sub("[\s]$", "", no_part_string)1222 no_part_string = re.sub(",[\s]+(,|\.)$", "", no_part_string)1223 no_part_string = re.sub("\.[\s]*$", "", no_part_string)1224 no_part_string = re.sub(",[\s]*$", "", no_part_string)1225 no_part_string = re.sub("\\xc2\\xa0", "", no_part_string)1226 no_part_string = re.sub(" s ", "", no_part_string)1227 no_part_string = re.sub("\xc2|\\xc2", "", no_part_string)1228 no_part_string = re.sub("\xa0|\\xa0", "", no_part_string)1229 no_part_string = re.sub("\xc2\xa0GLAZE", "", no_part_string)1230 no_part_string = re.sub("Judges:", "", no_part_string)1231 no_part_string = re.sub("AND", "and", no_part_string)1232 no_part_string = re.sub("Boucier", "Bourcier", no_part_string)1233 no_part_string = re.sub(", ,", ",", no_part_string)1234 no_part_string = re.sub(",", "", no_part_string)1235 no_part_string = re.sub("\.", "", no_part_string)1236 no_part_string = re.sub("Chief|CHIEF", "", no_part_string)1237 no_part_string = re.sub("\n|\\n", "", no_part_string)1238 no_part_string = re.sub("who take no part", "", no_part_string)1239 no_part_string = no_part_string.rstrip('\\n')1240 no_part_string = re.sub(' and', ',', no_part_string)1241 no_part_string = re.sub('deeming', '', no_part_string)1242 no_part_string = re.sub('disqualified', '', no_part_string)1243 no_part_string = no_part_string.strip()1244 no_part_string = no_part_string.upper()1245 judges_np = no_part_string1246 judges_np = re.sub("\\xc2", "", judges_np)1247 judges_np = re.sub("\xc2\xa0", "", judges_np)1248 judges_np = re.sub(" and", "", judges_np )1249 judge_np_list = judges_np.split(" ")1250 judge_np_list = filter(None, judge_np_list)1251 if len(judge_np_list) > 4:1252 judge_np_list = judge_np_list[2]1253 judges_np = judge_np_list1254 judge_np1 = ""1255 judge_np2 = ""1256 judge_np3 = ""1257 judge_np4 = ""1258 # Parse judges text and store list of judges that decided case1259 judges_string = re.sub("Judges:|Judges|JUDGES", "", judges_string)1260 judges_string = re.sub("judge|Judge|JUDGE", "", judges_string)1261 judges_string = re.sub(" delivered the Opinion of the Court\.| DELIVERED THE OPINION OF THE COURT\.|Delivered the Opinion of the Court\.", ",", judges_string)1262 judges_string = re.sub("BEFORE THE ENTIRE", "", judges_string)1263 judges_string = re.sub("Court", "", judges_string)1264 judges_string = re.sub("court", "", judges_string)1265 judges_string = re.sub("\xc3\x8d", "i", judges_string)1266 judges_string = re.sub(" Sr\.| SR\.", "", judges_string)1267 judges_string = re.sub(" Jr\.| JR\.", "", judges_string)1268 judges_string = re.sub(" Mr\.| MR\.", "", judges_string)1269 judges_string = re.sub(" Sr| SR", "", judges_string)1270 judges_string = re.sub(" Jr| JR", "", judges_string)1271 judges_string = re.sub(" at the", "", judges_string)1272 judges_string = re.sub(" Mr| MR", "", judges_string)1273 judges_string = re.sub("F\.X\. HENNESSEY", "HENNESSY", judges_string)1274 judges_string = re.sub("and in the judgment", "", judges_string)1275 judges_string = re.sub("was an appointed", "", judges_string)1276 judges_string = re.sub("S93A0786", "", judges_string)1277 judges_string = re.sub("S93X0787", "", judges_string)1278 judges_string = re.sub("III-A", "", judges_string)1279 judges_string = re.sub("I-V", "", judges_string)1280 judges_string = re.sub(" VII", "", judges_string)1281 judges_string = re.sub("Parts V\(C\), VI, VII and VIII", "", judges_string)1282 judges_string = re.sub("Parts V\(C\), VI, VII, and VIII", "", judges_string)1283 judges_string = re.sub("Parts I, II, IV and V\(A\)", "", judges_string)1284 judges_string = re.sub("Part III and V\(B\)", "", judges_string)1285 judges_string = re.sub("Parts V\(C\), VI, VII and VIII", "", judges_string)1286 judges_string = re.sub("Messrs\.", "", judges_string)1287 judges_string = re.sub("stead", "", judges_string)1288 judges_string = re.sub("MOTION FOR EXPEDITED APPEAL IS GRANTED", "", judges_string)1289 judges_string = re.sub("REQUEST FOR ORAL ARGUMENT IS DENIED", "", judges_string)1290 judges_string = re.sub("Section IV\(D\)", "", judges_string)1291 judges_string = re.sub("parts I, II, and III", "", judges_string)1292 judges_string = re.sub("respect|RESPECT|Respect", "", judges_string)1293 judges_string = re.sub("action was submitted", "", judges_string)1294 judges_string = re.sub("Subscribing to the Opinion and Assigning Additional Reasons", "", judges_string)1295 judges_string = re.sub("Pursuant to Ariz\. Const\. art\. VI|pursuant to Ariz\. Const\. art\. VI|Pursuant to Ariz\. Const\. art\. 6|pursuant to Ariz\. Const\. art\. 6", "", judges_string)1296 judges_string = re.sub("Arizona Constitution", "", judges_string)1297 judges_string = re.sub("Pursuant to art\. VI\.|Pursuant to article VI", "", judges_string)1298 judges_string = re.sub("pursuant|Pursuant", "", judges_string)1299 judges_string = re.sub(" and Justices", ",", judges_string)1300 judges_string = re.sub("None", "", judges_string)1301 judges_string = re.sub("\xe2\x80\x94", "", judges_string)1302 judges_string = re.sub("PANEL: ", "", judges_string)1303 judges_string = re.sub("\$110W\.", "", judges_string)1304 judges_string = re.sub(" but, on administrative leave,", "", judges_string)1305 judges_string = re.sub("Ex parte Reneau L\. Gates \(re\: v\. Palm Harbor Homes\, Inc\.\, et al\.\)", "", judges_string)1306 judges_string = re.sub("We Concur|WE CONCUR|We concur", ", ", judges_string)1307 judges_string = re.sub("All the|all the|ALL THE", "", judges_string)1308 judges_string = re.sub("Circuit|circuit|CIRCUIT", "", judges_string)1309 judges_string = re.sub("except", "", judges_string)1310 judges_string = re.sub("Special Justices", "", judges_string)1311 judges_string = re.sub("Terminix International v\. Jackson", "", judges_string)1312 judges_string = re.sub("Special Justice", "", judges_string)1313 judges_string = re.sub("Associate Justice", "", judges_string)1314 judges_string = re.sub("Point II", "", judges_string)1315 judges_string = re.sub("Special Chief Justice", "", judges_string)1316 judges_string = re.sub("Chief Justice", "", judges_string)1317 judges_string = re.sub("Justice\.", "", judges_string)1318 judges_string = re.sub("affirmance|Affirmance|AFFIRMANCE", "", judges_string)1319 judges_string = re.sub("'s|'S", "", judges_string)1320 judges_string = re.sub("\(No\.\s\d*\)", "", judges_string)1321 judges_string = re.sub("AFFIRMED|Affirmed|affirmed", "", judges_string)1322 judges_string = re.sub("AFFIRM|Affirm|affirm", "", judges_string)1323 judges_string = re.sub("grant the petition", "", judges_string)1324 judges_string = re.sub("petition|Petition|PETITION", "", judges_string)1325 judges_string = re.sub("Granted|granted|GRANTED", "", judges_string)1326 judges_string = re.sub("abstaining|Abstaining|ABSTAINING", "", judges_string)1327 judges_string = re.sub("No\.\s\d*", "", judges_string)1328 judges_string = re.sub("Senior", "", judges_string)1329 judges_string = re.sub("Supr\.|Supr", "", judges_string)1330 judges_string = re.sub("\xe2\x80\x94", "", judges_string)1331 judges_string = re.sub("Chief Justice", ",", judges_string)1332 judges_string = re.sub("Chief Judge", "", judges_string)1333 judges_string = re.sub("--", ",", judges_string)1334 judges_string = re.sub(" but ", "", judges_string)1335 judges_string = re.sub("Justices|JUSTICES|justices", "", judges_string)1336 judges_string = re.sub("JUSTICE\.", "", judges_string)1337 judges_string = re.sub("JUSTICE|Justice|justice", "", judges_string)1338 judges_string = re.sub("announced|Announced|ANNOUNCED", "", judges_string)1339 judges_string = re.sub("\*Link to the text of the note", "", judges_string)1340 judges_string = re.sub("Ariz\.Const\.", "", judges_string)1341 judges_string = re.sub("art\. VI", "", judges_string)1342 judges_string = re.sub(" art\.", "", judges_string)1343 judges_string = re.sub("Link to the text of the note", "", judges_string)1344 judges_string = re.sub("to the", "", judges_string)1345 judges_string = re.sub("prior", "", judges_string)1346 judges_string = re.sub("oral argument|argument", "", judges_string)1347 judges_string = re.sub("resigned", "", judges_string)1348 judges_string = re.sub("chief|Chief|CHIEF", "", judges_string)1349 judges_string = re.sub("AUTHOR", "", judges_string)1350 judges_string = re.sub("nonrecusal|NONRECUSAL|Nonrecusal", "", judges_string)1351 judges_string = re.sub("deeming", "", judges_string)1352 judges_string = re.sub("temporary", "", judges_string)1353 judges_string = re.sub("filed:", "", judges_string)1354 judges_string = re.sub("filed a|file a", "", judges_string)1355 judges_string = re.sub("President", "", judges_string)1356 judges_string = re.sub("Intermediate|intermediate|INTERMEDIATE", "", judges_string)1357 judges_string = re.sub("Associate|ASSOCIATE|associate", "", judges_string)1358 judges_string = re.sub("reasons|REASONS|Reasons|reason|REASON|Reason", "", judges_string)1359 judges_string = re.sub("Superior", "", judges_string)1360 judges_string = re.sub("constituting the", "", judges_string)1361 judges_string = re.sub("En Banc|en Banc", "", judges_string)1362 judges_string = re.sub("In Banc", "", judges_string)1363 judges_string = re.sub("cases|Cases|CASES", "", judges_string)1364 judges_string = re.sub("agreement|Agreement|AGREEMENT", "", judges_string)1365 judges_string = re.sub('"', "", judges_string)1366 judges_string = re.sub(" all | All | ALL ", "", judges_string)1367 judges_string = re.sub("Present|PRESENT|present", "", judges_string)1368 judges_string = re.sub("APPEALS", "", judges_string)1369 judges_string = re.sub(" THE", "", judges_string)1370 judges_string = re.sub("\xc3\x81", "a", judges_string)1371 judges_string = re.sub("WITHOUT", "", judges_string)1372 judges_string = re.sub("WITH", "", judges_string)1373 judges_string = re.sub("ASSIGNED BY REASON OF VACANCY|VACANCY|Vacancy", "", judges_string)1374 judges_string = re.sub("THIS", "", judges_string)1375 judges_string = re.sub("PELICONES|Pelicones", "", judges_string)1376 judges_string = re.sub("member|Member|MEMBER", "", judges_string)1377 judges_string = re.sub("disposition|Disposition|DISPOSITION", "", judges_string)1378 judges_string = re.sub(" right| Right| RIGHT", "", judges_string)1379 judges_string = re.sub("DISSENTS", "", judges_string)1380 judges_string = re.sub("WRITTEN|written|Written", "", judges_string)1381 judges_string = re.sub("WITHOUT|without", "", judges_string)1382 judges_string = re.sub("\xc3\xa9", "e", judges_string)1383 judges_string = re.sub(" took| TOOK| Took", "", judges_string)1384 judges_string = re.sub("Rule IV", "", judges_string)1385 judges_string = re.sub(" IV", "", judges_string)1386 judges_string = re.sub("C\. J\.,", "", judges_string)1387 judges_string = re.sub(" J\.,", "", judges_string)1388 judges_string = re.sub("assigned|Assigned|ASSIGNED|ASSIGNS|Assigns|assigns", "", judges_string)1389 judges_string = re.sub(" as ", "", judges_string)1390 judges_string = re.sub('"Agreement to Arbitrate"', "", judges_string)1391 judges_string = re.sub("Arbitrate\"", "", judges_string)1392 judges_string = re.sub("files a", "", judges_string)1393 judges_string = re.sub("former|Former|FORMER", "", judges_string)1394 judges_string = re.sub("C\.J\.,|Sp\.JJ|Sp\.J\.|Sp\. J\.|C\.J,|J\.P\.T\.|CJ,||A\.J\.V\.C\.J\.,|JJ\.,|Sp\.J\.|Js,|JS,|JJ\.,|JJ,|D\.J\.,|P\.J\.,|P\.\sJ\.,|C\.J\.,|J\.,|J\.| J,|C\. J\.,", "", judges_string)1395 judges_string = re.sub("C\.J\.|C\.J|CJ|JJ\.|Js|JS|JJ\.|JJ|D\.J\.|P\.J\.|P\.\sJ\.|C\.J\.|J\.|J\.|C\. J\.", "", judges_string)1396 judges_string = re.sub("C\.J\.|C\.J|CJ|JJ\.|Js|JS|JJ\.|JJ|D\.J\.|P\.J\.|P\.\sJ\.|C\.J\.|J\.|J\.|C\. J\.", "", judges_string)1397 judges_string = re.sub("Sp\.J\.", "", judges_string)1398 judges_string = re.sub("Part II\.A", "", judges_string)1399 judges_string = re.sub("Part II\.B", "", judges_string)1400 judges_string = re.sub("Parts II", "", judges_string)1401 judges_string = re.sub("Parts I", "", judges_string)1402 judges_string = re.sub("Part II", "", judges_string)1403 judges_string = re.sub("Part I", "", judges_string)1404 judges_string = re.sub("WoWe", "", judges_string)1405 judges_string = re.sub("foregoing|Foregoing|FOREGOING", "", judges_string)1406 judges_string = re.sub(" for| For| FOR", "", judges_string)1407 judges_string = re.sub("", "", judges_string)1408 judges_string = re.sub("[\(\[].*?[\)\]]", "", judges_string)1409 judges_string = re.sub("III", "", judges_string)1410 judges_string = re.sub("II\(\w\)", "", judges_string)1411 judges_string = re.sub("III\(\w\)", "", judges_string)1412 judges_string = re.sub(" II", "", judges_string)1413 judges_string = re.sub("III", "", judges_string)1414 judges_string = re.sub("Associate", "", judges_string)1415 judges_string = re.sub("Vice", "", judges_string)1416 judges_string = re.sub("\[\**\d*\]", "", judges_string)1417 judges_string = re.sub("Arbitrate|arbitrate|ARBITRATE", "", judges_string)1418 judges_string = re.sub("\xc2", "", judges_string)1419 judges_string = re.sub("BENCH|Bench|bench", "", judges_string)1420 judges_string = re.sub("(Before: |BEFORE: )", "", judges_string)1421 judges_string = re.sub("\xa0", " ", judges_string)1422 judges_string = re.sub("\/", "", judges_string)1423 judges_string = re.sub("\n|\r", " ", judges_string)1424 judges_string = re.sub("\(see p", " ", judges_string)1425 judges_string = re.sub("\(\d\)", "", judges_string)1426 judges_string = re.sub("\d", "", judges_string)1427 judges_string = re.sub("\(", "", judges_string)1428 judges_string = re.sub("\)", "", judges_string)1429 judges_string = re.sub("\sI,", "", judges_string)1430 judges_string = re.sub(" or ", "", judges_string)1431 judges_string = re.sub("Saylor|SAYLOR", "Saylor, ", judges_string)1432 judges_string = re.sub(" BY", "", judges_string)1433 judges_string = re.sub(" FOR", "", judges_string)1434 judges_string = re.sub("I;", "", judges_string)1435 judges_string = re.sub("Voting|VOTING|voting", "", judges_string)1436 judges_string = re.sub("Surrogate", "", judges_string)1437 judges_string = re.sub("\'", "", judges_string) #makes matching of judge names possible: O'Connor -> OConnor1438 judges_string = re.sub("judgment", "", judges_string)1439 judges_string = re.sub("SeeStuart|seestuart", "See, Stuart", judges_string)1440 if(re.search("unanimous view of the court|unanimous", judges_string)):1441 unanimous = 11442 judges_string = re.sub("unanimous view of the court", "", judges_string)1443 judges_string = re.sub("unanimous", "", judges_string)1444 judges_string = re.sub("Took no|Took No|took no|TOOK NO", "", judges_string)1445 judges_string = re.sub(" No,", "", judges_string)1446 judges_string = re.sub("separately|Separately|SEPARATELY", "", judges_string)1447 judges_string = re.sub("separate|Separate|SEPARATE", "", judges_string)1448 judges_string = re.sub("in place of", "", judges_string)1449 judges_string = re.sub("sections,", "", judges_string)1450 judges_string = re.sub("Sections,", "", judges_string)1451 judges_string = re.sub("sections", "", judges_string)1452 judges_string = re.sub("section,", "", judges_string)1453 judges_string = re.sub("Section,", "", judges_string)1454 judges_string = re.sub("section", "", judges_string)1455 judges_string = re.sub("constituting,", "", judges_string)1456 judges_string = re.sub("en banc,|en banc|En banc|En Banc|EN BANC", "", judges_string)1457 judges_string = re.sub("\[", "", judges_string)1458 judges_string = re.sub("\]", ",", judges_string)1459 judges_string = re.sub("concur in part and dissent in part|CONCUR IN PART AND DISSENT IN PART", " ", judges_string)1460 judges_string = re.sub("concurs in part and dissents in part|CONCURS IN PART AND DISSENTS IN PART", " ", judges_string)1461 judges_string = re.sub("concurs in the result, without opinion\.", "", judges_string)1462 judges_string = re.sub("all concurring", "", judges_string)1463 judges_string = re.sub("See separate opinion", "", judges_string)1464 judges_string = re.sub("concurring|Concurring|CONCURRING", "", judges_string)1465 judges_string = re.sub("concurrence|Concurrence|CONCURRENCE|Concurrence:", "", judges_string)1466 judges_string = re.sub("concurs", ",", judges_string)1467 judges_string = re.sub("concurred", ",", judges_string)1468 judges_string = re.sub("concur in", "", judges_string)1469 judges_string = re.sub("Concurs:|CONCURs:", "", judges_string)1470 judges_string = re.sub("concurs|Concurs|CONCURS", "", judges_string)1471 judges_string = re.sub("concur\.", ",", judges_string)1472 judges_string = re.sub("concur|Concur", "", judges_string)1473 judges_string = re.sub("CONCUR", ",", judges_string)1474 judges_string = re.sub("does", "", judges_string)1475 judges_string = re.sub("consideration", "", judges_string)1476 judges_string = re.sub("Md\.", "", judges_string)1477 judges_string = re.sub("Temporarily", "", judges_string)1478 judges_string = re.sub("Link to, text thee", "", judges_string)1479 judges_string = re.sub("assigns reasons", "", judges_string)1480 judges_string = re.sub("Appeals", "", judges_string)1481 judges_string = re.sub("retired|RETIRED|Retired|Ret|ret\.", "", judges_string)1482 judges_string = re.sub("assigned|Assigned|ASSIGNED|assignment|Assignment|ASSIGNNMENT", "", judges_string)1483 judges_string = re.sub("The ", "", judges_string)1484 judges_string = re.sub(" sat", "", judges_string)1485 judges_string = re.sub("delivered", "", judges_string)1486 judges_string = re.sub("PARTICIPATING", "", judges_string)1487 judges_string = re.sub("participating", "", judges_string)1488 judges_string = re.sub("PARTICIPATING", "", judges_string)1489 judges_string = re.sub("participating", "", judges_string)1490 judges_string = re.sub("Participating", "", judges_string)1491 judges_string = re.sub("did not participate", "", judges_string)1492 judges_string = re.sub("did not sit", "", judges_string)1493 judges_string = re.sub("did not", "", judges_string)1494 judges_string = re.sub("Maricopa County", "", judges_string)1495 judges_string = re.sub("County", "", judges_string)1496 judges_string = re.sub("WRITTEN BY:|Written by:", "", judges_string)1497 judges_string = re.sub("herein", "", judges_string)1498 judges_string = re.sub("not participate", "", judges_string)1499 judges_string = re.sub("participate", "", judges_string)1500 judges_string = re.sub("Presiding|PRESIDING", "", judges_string)1501 judges_string = re.sub("specially|Specially|SPECIALLY", "", judges_string)1502 judges_string = re.sub("special|Special|SPECIAL", "", judges_string)1503 judges_string = re.sub("pro-tem|Pro-Tem|PRO-TEM", "", judges_string)1504 judges_string = re.sub("concurring", "", judges_string)1505 judges_string = re.sub("Concurring", "", judges_string)1506 judges_string = re.sub("concurs in the result, without opinion\.", "", judges_string)1507 judges_string = re.sub("no opinion", "", judges_string)1508 judges_string = re.sub("opinion\.", ",", judges_string)1509 judges_string = re.sub("OPINIONS|OPINIONs|opinions|Opinions", "", judges_string)1510 judges_string = re.sub("opinion", "", judges_string)1511 judges_string = re.sub("Opinion", "", judges_string)1512 judges_string = re.sub(" full ", "", judges_string)1513 judges_string = re.sub("statement", "", judges_string)1514 judges_string = re.sub("files|file|FILES|FILE", "", judges_string)1515 judges_string = re.sub("Judicial Circuit", "", judges_string)1516 judges_string = re.sub("Part III", "", judges_string)1517 judges_string = re.sub("no part|NO PART|No Part", "", judges_string)1518 judges_string = re.sub("part", "", judges_string)1519 judges_string = re.sub("Part", "", judges_string)1520 judges_string = re.sub("PART", "", judges_string)1521 judges_string = re.sub("which|Which|WHICH", "", judges_string)1522 judges_string = re.sub("DENIED|denied", "", judges_string)1523 judges_string = re.sub("Majority|majority|MAJORITY", "", judges_string)1524 judges_string = re.sub("Heard|heard|HEARD", "", judges_string)1525 judges_string = re.sub("joining|JOINING|Joining", "", judges_string)1526 judges_string = re.sub("joined|JOINED|Joined", "", judges_string)1527 judges_string = re.sub("joins|JOINS|Joins", "", judges_string)1528 judges_string = re.sub("join|JOIN|Join", "", judges_string)1529 judges_string = re.sub("takes|taking|Taking|TAKING", "", judges_string)1530 judges_string = re.sub(" that", "", judges_string)1531 judges_string = re.sub("as to the rationale", "", judges_string)1532 judges_string = re.sub("the judgment", "", judges_string)1533 judges_string = re.sub("rationale", "", judges_string)1534 judges_string = re.sub("T\.Y\.|T\. Y\.", "", judges_string)1535 judges_string = re.sub("A\.M\.", "", judges_string)1536 judges_string = re.sub("F\.E\.", "", judges_string)1537 judges_string = re.sub("N\.C\.", "", judges_string)1538 judges_string = re.sub("Paul H\.", "", judges_string)1539 judges_string = re.sub("Russell A\.", "", judges_string)1540 judges_string = re.sub("G\. Barry", "", judges_string)1541 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1542 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1543 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1544 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1545 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1546 judges_string = re.sub("\.", ",", judges_string)1547 judges_string = re.sub("BEFORE", "", judges_string)1548 judges_string = re.sub("would", "", judges_string)1549 judges_string = re.sub("this", "", judges_string)1550 judges_string = re.sub("only", "", judges_string)1551 judges_string = re.sub("without", "", judges_string)1552 judges_string = re.sub("with", "", judges_string)1553 judges_string = re.sub(" out", "", judges_string)1554 judges_string = re.sub("also", "", judges_string)1555 judges_string = re.sub(" of", "", judges_string)1556 judges_string = re.sub(" view", "", judges_string)1557 judges_string = re.sub(" Not", "", judges_string)1558 judges_string = re.sub(" not", "", judges_string)1559 judges_string = re.sub(" NOT", "", judges_string)1560 judges_string = re.sub(" whom", "", judges_string)1561 judges_string = re.sub(" who", "", judges_string)1562 judges_string = re.sub("filed", "", judges_string)1563 judges_string = re.sub("expressing", "", judges_string)1564 judges_string = re.sub("but dissents", "", judges_string)1565 judges_string = re.sub("but dissent", "", judges_string)1566 judges_string = re.sub("but not the dissent", "", judges_string)1567 judges_string = re.sub("dissented", "", judges_string)1568 judges_string = re.sub("issued", ",", judges_string)1569 judges_string = re.sub("foregoing", "", judges_string)1570 judges_string = re.sub("agree", "", judges_string)1571 judges_string = re.sub("Opposed|opposed|OPPOSED", "", judges_string)1572 judges_string = re.sub("dissents", "", judges_string)1573 judges_string = re.sub("dissenting", "", judges_string)1574 judges_string = re.sub("DISSENTING", "", judges_string)1575 judges_string = re.sub("ENTIRE COURT", "", judges_string)1576 judges_string = re.sub(" as", "", judges_string)1577 judges_string = re.sub("reversal", "", judges_string)1578 judges_string = re.sub("none", "", judges_string)1579 judges_string = re.sub("Twelfth|Eleventh|Fifth|Tenth|Ninth|Eigth|Seventh|Sixth", "", judges_string)1580 judges_string = re.sub("Mr", "", judges_string)1581 judges_string = re.sub("remand", "", judges_string)1582 judges_string = re.sub("overruling", "", judges_string)1583 judges_string = re.sub("rehearing", "", judges_string)1584 judges_string = re.sub("OPINION", "", judges_string)1585 judges_string = re.sub("COURT", "", judges_string)1586 judges_string = re.sub("ONLY", "", judges_string)1587 judges_string = re.sub("IN RESULT", "", judges_string)1588 judges_string = re.sub(" IN ", "", judges_string)1589 judges_string = re.sub("Dissenting", "", judges_string)1590 judges_string = re.sub("Dissents", "", judges_string)1591 judges_string = re.sub("dissent\.", ",", judges_string)1592 judges_string = re.sub("dissent", "", judges_string)1593 judges_string = re.sub("Dissent", "", judges_string)1594 judges_string = re.sub("recuses|RECUSES|Recuses", "", judges_string)1595 judges_string = re.sub("recused|RECUSED|Recused", "", judges_string)1596 judges_string = re.sub("recuse|RECUSE|Recuse", "", judges_string)1597 judges_string = re.sub("SEPARATELY", "", judges_string)1598 judges_string = re.sub("PRO-TEM", "", judges_string)1599 judges_string = re.sub("reserves", "", judges_string)1600 judges_string = re.sub("is disqualified|disqualified|disqualification", "", judges_string)1601 judges_string = re.sub("recused themselves", "", judges_string)1602 judges_string = re.sub("recused", "", judges_string)1603 judges_string = re.sub("Recused", "", judges_string)1604 judges_string = re.sub("deceased", "", judges_string)1605 judges_string = re.sub("in the result", "", judges_string)1606 judges_string = re.sub("the result", "", judges_string)1607 judges_string = re.sub("result|Result|RESULT", "", judges_string)1608 judges_string = re.sub(" acting ", "", judges_string)1609 judges_string = re.sub(" and ", ",", judges_string)1610 judges_string = re.sub(" AND ", ",", judges_string)1611 judges_string = re.sub(" an", ",", judges_string)1612 judges_string = re.sub("application|Application|APPLICATION", ", ", judges_string)1613 judges_string = re.sub("dismissed|Dismissed|DISMISSED", ", ", judges_string)1614 judges_string = re.sub("entitled|Entitled|ENTITLED", ", ", judges_string)1615 judges_string = re.sub("appeal|Appeal|APPEAL", ", ", judges_string)1616 judges_string = re.sub(" the ", ", ", judges_string)1617 judges_string = re.sub(" as to", ", ", judges_string)1618 judges_string = re.sub("decision", ", ", judges_string)1619 judges_string = re.sub("final", ", ", judges_string)1620 judges_string = re.sub(" in a", "", judges_string)1621 judges_string = re.sub("in the", "", judges_string)1622 judges_string = re.sub(" In | in ", "", judges_string)1623 judges_string = re.sub(" in,", "", judges_string)1624 judges_string = re.sub(" of", "", judges_string)1625 judges_string = re.sub(" OF", "", judges_string)1626 judges_string = re.sub(" from", "", judges_string)1627 judges_string = re.sub("herself", "", judges_string)1628 judges_string = re.sub("himself", "", judges_string)1629 judges_string = re.sub("themselves", "", judges_string)1630 judges_string = re.sub("expresses", "", judges_string)1631 judges_string = re.sub("ii", "", judges_string)1632 judges_string = re.sub(" cases| Cases", "", judges_string)1633 judges_string = re.sub("case", "", judges_string)1634 judges_string = re.sub("Case", "", judges_string)1635 judges_string = re.sub(" by", "", judges_string)1636 judges_string = re.sub("heard", "", judges_string)1637 judges_string = re.sub("DENVIRSTITH", "STITH", judges_string)1638 judges_string = re.sub("considered", "", judges_string)1639 judges_string = re.sub("decided", "", judges_string)1640 judges_string = re.sub("time", "", judges_string)1641 judges_string = re.sub("submission", "", judges_string)1642 judges_string = re.sub("\&", "", judges_string)1643 judges_string = re.sub("were designated", "", judges_string)1644 judges_string = re.sub("is designated|designated|designation", "", judges_string)1645 judges_string = re.sub(" All |ALL ", "", judges_string)1646 judges_string = re.sub("is sitting", "", judges_string)1647 judges_string = re.sub("sitting|SITTING|Sitting", "", judges_string)1648 judges_string = re.sub(" sit", "", judges_string)1649 judges_string = re.sub(" superior", "", judges_string)1650 judges_string = re.sub(" under", "", judges_string)1651 judges_string = re.sub("Cavanaugh|CAVANAUGH", "Cavanagh", judges_string)1652 judges_string = re.sub("WHOLE|Whole|whole", "", judges_string)1653 judges_string = re.sub("deny", "", judges_string)1654 judges_string = re.sub("Matter|MATTER|matter", "", judges_string)1655 judges_string = re.sub(" otherwise|Otherwise|OTHERWISE", "", judges_string)1656 judges_string = re.sub(" leave", "", judges_string)1657 judges_string = re.sub(" others| other| Other| OTHER", "", judges_string)1658 judges_string = re.sub(" vote|votes to", "", judges_string)1659 judges_string = re.sub("RSA", "", judges_string)1660 judges_string = re.sub("memorandum", "", judges_string)1661 judges_string = re.sub("took no", "", judges_string)1662 judges_string = re.sub("syllabus", "", judges_string)1663 judges_string = re.sub("Appellate District", "", judges_string)1664 judges_string = re.sub("District|district", "", judges_string)1665 judges_string = re.sub("Administrative", "", judges_string)1666 judges_string = re.sub("i-v", "", judges_string)1667 judges_string = re.sub("follows", "", judges_string)1668 judges_string = re.sub("Judicial", "", judges_string)1669 judges_string = re.sub("By:", "", judges_string)1670 judges_string = re.sub("Panel:", "", judges_string)1671 judges_string = re.sub(":\s", "", judges_string)1672 judges_string = re.sub(":", "", judges_string)1673 judges_string = re.sub("authored|Authored|AUTHORED", "", judges_string)1674 judges_string = re.sub(" to ", "", judges_string)1675 judges_string = re.sub("DISSENT", "", judges_string)1676 judges_string = re.sub(" each", "", judges_string)1677 judges_string = re.sub("Jr|jr|JR", "", judges_string)1678 judges_string = re.sub("denial", "", judges_string)1679 judges_string = re.sub("Sr|sr|SR", "", judges_string)1680 judges_string = re.sub("Deceased|deceased|DECEASED", "", judges_string)1681 judges_string = re.sub("lead|LEAD|Lead", "", judges_string)1682 judges_string = re.sub(" was | WAS | Was", "", judges_string)1683 judges_string = re.sub(" other", "", judges_string)1684 judges_string = re.sub("writing", "", judges_string)1685 judges_string = re.sub("Writ|writ|WRIT", "", judges_string)1686 judges_string = re.sub("take|TAKE|Take", "", judges_string)1687 judges_string = re.sub("Issued|issued|ISSUED", "", judges_string)1688 judges_string = re.sub("Madame|MADAME|madame", "", judges_string)1689 judges_string = re.sub("Visiting|VISITING|visiting", "", judges_string)1690 judges_string = re.sub("acting|ACTING|Acting", "", judges_string)1691 judges_string = re.sub("having|Having|HAVING", "", judges_string)1692 judges_string = re.sub("reverse", "", judges_string)1693 judges_string = re.sub("O'NEILL to|O'NEILLto", "O'NEILL", judges_string)1694 judges_string = re.sub(" is ", "", judges_string)1695 judges_string = re.sub("Third", "", judges_string)1696 judges_string = re.sub(" John ", "", judges_string)1697 judges_string = re.sub("Boucier", "Bourcier", judges_string)1698 judges_string = re.sub(" to ", "", judges_string)1699 judges_string = re.sub(",to ", "", judges_string)1700 judges_string = re.sub("Ralmon", "Almon", judges_string)1701 judges_string = re.sub("Fabec", "Fabe", judges_string)1702 judges_string = re.sub(" ir ", "", judges_string)1703 judges_string = re.sub("Estaugh", "Eastaugh", judges_string)1704 judges_string = re.sub("Modification", "", judges_string)1705 judges_string = re.sub("Vacation", "", judges_string)1706 judges_string = re.sub(",d,", "", judges_string)1707 judges_string = re.sub("Division Two|Two", "", judges_string)1708 judges_string = re.sub("dS", "", judges_string)1709 judges_string = re.sub("NOTE", "", judges_string)1710 judges_string = re.sub("dI", "", judges_string)1711 judges_string = re.sub("dX", "", judges_string)1712 judges_string = re.sub("were", "", judges_string)1713 judges_string = re.sub("pursuant", "", judges_string)1714 judges_string = re.sub("determination ", "", judges_string)1715 judges_string = re.sub("Division One", "", judges_string)1716 judges_string = re.sub("article IV", "", judges_string)1717 judges_string = re.sub("Article|ARTICLE|article", "", judges_string)1718 judges_string = re.sub("Arizona", "", judges_string)1719 judges_string = re.sub("Second", "", judges_string)1720 judges_string = re.sub("Council", "", judges_string)1721 judges_string = re.sub("Chairperson", "", judges_string)1722 judges_string = re.sub("not on panel|on panel|panel", "", judges_string)1723 judges_string = re.sub("Division Four", "", judges_string)1724 judges_string = re.sub("to conviction|conviction", "", judges_string)1725 judges_string = re.sub("to sentence|sentence", "", judges_string)1726 judges_string = re.sub("additional", "", judges_string)1727 judges_string = re.sub("following", "", judges_string)1728 judges_string = re.sub("subscribes|subscribe", "", judges_string)1729 judges_string = re.sub("ORAL ARGUMENT", "", judges_string)1730 judges_string = re.sub("DENIAL", "", judges_string)1731 judges_string = re.sub(" ONE ", "", judges_string)1732 judges_string = re.sub("TWO", "", judges_string)1733 judges_string = re.sub("THREE", "", judges_string)1734 judges_string = re.sub(" have", "", judges_string)1735 judges_string = re.sub("unconstitutional", "", judges_string)1736 judges_string = re.sub("follow", "", judges_string)1737 judges_string = re.sub("chapter", "", judges_string)1738 judges_string = re.sub("Lesson", "Leeson", judges_string)1739 judges_string = re.sub("Before", "", judges_string)1740 judges_string = re.sub("Per Curiam|Curiam", "", judges_string)1741 judges_string = re.sub("causesubmitted", "", judges_string)1742 judges_string = re.sub("on briefs|briefs|brief", "", judges_string)1743 judges_string = re.sub("Division", "", judges_string)1744 judges_string = re.sub("absent", "", judges_string)1745 judges_string = re.sub(" IV,", "", judges_string)1746 judges_string = re.sub(" when", "", judges_string)1747 judges_string = re.sub(" inof", "", judges_string)1748 judges_string = re.sub("Order", "", judges_string)1749 judges_string = re.sub("absent", "", judges_string)1750 judges_string = re.sub(" to ", "", judges_string)1751 judges_string = re.sub("tohis ", "", judges_string)1752 judges_string = re.sub("toother|TOOTHER|to other", "", judges_string)1753 judges_string = string.strip(judges_string)1754 judges_string = re.sub(", ,", ",", judges_string)1755 judges_string = re.sub("s V", "", judges_string)1756 judges_string = re.sub(" VI,", "", judges_string)1757 judges_string = re.sub('DENVIR STITH', 'Stith', judges_string)1758 judges_string = re.sub(' Wo,', '', judges_string)1759 judges_line = False1760 judges_part_string = first_sentence(judges_string)1761 judges_holder = re.sub("\*|\d", "", judges_part_string)1762 judges_holder = re.sub("Before:* ", "", judges_holder)1763 judges_holder = re.sub(", (Circuit|Circuit) (J|j)udge[s]?\.?", "", judges_holder)1764 judges_holder = re.sub(", (District|DISTRICT) (J|j)udge[s]?\.?", "", judges_holder)1765 judges_holder = re.sub("Chief Judge", "", judges_holder)1766 judges_holder = re.sub("Senior Judge", "", judges_holder)1767 judges_holder = re.sub("Justice[s]", "", judges_holder)1768 judges_holder = re.sub("Chief District Judge", "", judges_holder)1769 judges_holder = re.sub("Associate Justice", "", judges_holder)1770 judges_holder = re.sub("Administrative Justice", "", judges_holder)1771 judges_holder = re.sub("Administrative Judge", "", judges_holder)1772 judges_holder = re.sub("(P|p)ro (T|t)em", "", judges_holder)1773 judges_holder = re.sub(", (Jr\.|JR\.|Jr|jr)", "", judges_holder)1774 judges_holder = re.sub(", (Sr\.|SR\.)", "Sr.", judges_holder)1775 judges_holder = re.sub(", III", "III", judges_holder)1776 judges_holder = re.sub(", II", "II", judges_holder)1777 judges_holder = re.sub(";", ",", judges_holder)1778 judges_holder = re.sub(",[\s]*,", ",", judges_holder)1779 judges_holder = re.sub(" and ", ", ", judges_holder)1780 judges_holder = re.sub(" \. ", " ", judges_holder)1781 judges_holder = re.sub("[\s]+", " ", judges_holder)1782 judges_holder = re.sub("C\.J\.,|Supr\. J\.|J\.P\.T\.|Sp\.J\.|S\.J\.|P\.JJ\.|JJ\.,|JJ\.|D\.J\.,|P\.J\.,|C\.J\.|J\.,|J\.|C\. J\.", ",", judges_holder)1783 judges_holder = re.sub("\xc3\xa1", "a", judges_holder)1784 judges_holder = re.split(",", judges_holder)1785 judges_holder = judges_holder + non_panel_list1786 judges_holder = [word for word in judges_holder if word != ""]1787 judges_holder = list(set(judges_holder))1788 # Apply functions to judge names to format the names of each justice uniformly1789 if (len(judges_holder) == 1):1790 judge1_ln = lastname(judges_holder[0])1791 judge1_fn = firstname(judges_holder[0])1792 judge1_mn = middlename(judges_holder[0])1793 judge1_suf = namesuffix(judges_holder[0])1794 judge1_full = judge1_ln + ", " + judge1_fn + " " + judge1_mn + " " + judge1_suf1795 judge1_full = re.sub("[\s]+", " ", judge1_full)1796 judge1_full = re.sub(", $", "", judge1_full)1797 if len(judge1_ln) < 2:1798 judge1_ln = ""1799 judge1_vote = ""1800 if (len(judges_holder) > 1):1801 judge1_ln = lastname(judges_holder[0])1802 judge1_fn = firstname(judges_holder[0])1803 judge1_mn = middlename(judges_holder[0])1804 judge1_suf = namesuffix(judges_holder[0])1805 judge1_full = judge1_ln + ", " + judge1_fn + " " + judge1_mn + " " + judge1_suf1806 judge1_full = re.sub("[\s]+", " ", judge1_full)1807 judge1_full = re.sub(", $", "", judge1_full)1808 if len(judge1_ln) < 2:1809 judge1_ln = ""1810 judge1_vote = ""1811 #print judges_holder[0]1812 judge2_ln = lastname(judges_holder[1])1813 #print judge2_ln1814 judge2_fn = firstname(judges_holder[1])1815 judge2_mn = middlename(judges_holder[1])1816 judge2_suf = namesuffix(judges_holder[1])1817 judge2_full = judge2_ln + ", " + judge2_fn + " " + judge2_mn + " " + judge2_suf1818 judge2_full = re.sub("[\s]+", " ", judge2_full)1819 judge2_full = re.sub(", $", "", judge2_full)1820 if len(judge2_ln) < 2:1821 judge2_ln = ""1822 judge2_vote = ""1823 if (len(judges_holder) > 2):1824 judge3_ln = lastname(judges_holder[2])1825 judge3_fn = firstname(judges_holder[2])1826 judge3_mn = middlename(judges_holder[2])1827 judge3_suf = namesuffix(judges_holder[2])1828 judge3_full = judge3_ln + ", " + judge3_fn + " " + judge3_mn + " " + judge3_suf1829 judge3_full = re.sub("[\s]+", " ", judge3_full)1830 judge3_full = re.sub(", $", "", judge3_full)1831 if len(judge3_ln) < 2:1832 judge3_ln = ""1833 judge3_vote = ""1834 if (len(judges_holder) > 3):1835 judge4_ln = lastname(judges_holder[3])1836 judge4_fn = firstname(judges_holder[3])1837 judge4_mn = middlename(judges_holder[3])1838 judge4_suf = namesuffix(judges_holder[3])1839 judge4_full = judge4_ln + ", " + judge4_fn + " " + judge4_mn + " " + judge4_suf1840 judge4_full = re.sub("[\s]+", " ", judge4_full)1841 judge4_full = re.sub(", $", "", judge4_full)1842 if len(judge4_ln) < 2:1843 judge4_ln = ""1844 judge4_vote = ""1845 if (len(judges_holder) > 4):1846 judge5_ln = lastname(judges_holder[4])1847 judge5_fn = firstname(judges_holder[4])1848 judge5_mn = middlename(judges_holder[4])1849 judge5_suf = namesuffix(judges_holder[4])1850 judge5_full = judge5_ln + ", " + judge5_fn + " " + judge5_mn + " " + judge5_suf1851 judge5_full = re.sub("[\s]+", " ", judge5_full)1852 judge5_full = re.sub(", $", "", judge5_full)1853 if len(judge5_ln) < 2:1854 judge5_ln = ""1855 judge5_vote = ""1856 if (len(judges_holder) > 5):1857 judge6_ln = lastname(judges_holder[5])1858 judge6_fn = firstname(judges_holder[5])1859 judge6_mn = middlename(judges_holder[5])1860 judge6_suf = namesuffix(judges_holder[5])1861 judge6_full = judge6_ln + ", " + judge6_fn + " " + judge6_mn + " " + judge6_suf1862 judge6_full = re.sub("[\s]+", " ", judge6_full)1863 judge6_full = re.sub(", $", "", judge6_full)1864 if len(judge6_ln) < 2:1865 judge6_ln = ""1866 judge6_vote = ""1867 if (len(judges_holder) > 6):1868 judge7_ln = lastname(judges_holder[6])1869 judge7_fn = firstname(judges_holder[6])1870 judge7_mn = middlename(judges_holder[6])1871 judge7_suf = namesuffix(judges_holder[6])1872 judge7_full = judge7_ln + ", " + judge7_fn + " " + judge7_mn + " " + judge7_suf1873 judge7_full = re.sub("[\s]+", " ", judge7_full)1874 judge7_full = re.sub(", $", "", judge7_full)1875 if len(judge7_ln) < 2:1876 judge7_ln = ""1877 judge7_vote = ""1878 if (len(judges_holder) > 7):1879 judge8_ln = lastname(judges_holder[7])1880 judge8_fn = firstname(judges_holder[7])1881 judge8_mn = middlename(judges_holder[7])1882 judge8_suf = namesuffix(judges_holder[7])1883 judge8_full = judge8_ln + ", " + judge8_fn + " " + judge8_mn + " " + judge8_suf1884 judge8_full = re.sub("[\s]+", " ", judge8_full)1885 judge8_full = re.sub(", $", "", judge8_full)1886 if len(judge8_ln) < 2:1887 judge8_ln = ""1888 judge8_vote = ""1889 if (len(judges_holder) > 8):1890 judge9_ln = lastname(judges_holder[8])1891 judge9_fn = firstname(judges_holder[8])1892 judge9_mn = middlename(judges_holder[8])1893 judge9_suf = namesuffix(judges_holder[8])1894 judge9_full = judge9_ln + ", " + judge9_fn + " " + judge9_mn + " " + judge9_suf1895 judge9_full = re.sub("[\s]+", " ", judge9_full)1896 judge9_full = re.sub(", $", "", judge9_full)1897 if len(judge9_ln) < 2:1898 judge9_ln = ""1899 judge9_vote = ""1900 if (len(judges_holder) > 9):1901 judge10_ln = lastname(judges_holder[9])1902 judge10_fn = firstname(judges_holder[9])1903 judge10_mn = middlename(judges_holder[9])1904 judge10_suf = namesuffix(judges_holder[9])1905 judge10_full = judge10_ln + ", " + judge10_fn + " " + judge10_mn + " " + judge10_suf1906 judge10_full = re.sub("[\s]+", " ", judge10_full)1907 judge10_full = re.sub(", $", "", judge10_full)1908 if len(judge10_ln) < 2:1909 judge10_ln = ""1910 judge10_vote = ""1911 if (len(judges_holder) > 10):1912 judge11_ln = lastname(judges_holder[10])1913 judge11_fn = firstname(judges_holder[10])1914 judge11_mn = middlename(judges_holder[10])1915 judge11_suf = namesuffix(judges_holder[10])1916 judge11_full = judge11_ln + ", " + judge11_fn + " " + judge11_mn + " " + judge11_suf1917 judge11_full = re.sub("[\s]+", " ", judge11_full)1918 judge11_full = re.sub(", $", "", judge11_full)1919 if len(judge11_ln) < 2:1920 judge11_ln = ""1921 judge11_vote = ""1922 if (len(judges_holder) > 11):1923 check_case = 11924 if len(judge_np_list) == 0:1925 judge_np1 = ""1926 elif len(judge_np_list) == 1:1927 judge_np1 = judge_np_list[0].strip()1928 judge_np1 = re.sub(",", "", judge_np1)1929 judge_np1 = re.sub("\\xc2\\xa0", "", judge_np1)1930 if len(judge_np1) > 10:1931 judge_np1 = judge_np1.split(' ', 1)[0]1932 elif len(judge_np_list) == 2:1933 judge_np1 = judge_np_list[0].strip()1934 judge_np1 = re.sub(",", "", judge_np1)1935 judge_np2 = judge_np_list[1].strip()1936 judge_np2 = re.sub(",", "", judge_np2)1937 elif len(judge_np_list) > 2:1938 judge_np1 = judge_np_list[0].strip()1939 judge_np1 = re.sub(",", "", judge_np1)1940 judge_np2 = judge_np_list[1].strip()1941 judge_np2 = re.sub(",", "", judge_np2)1942 judge_np3 = judge_np_list[2].strip()1943 judge_np3 = re.sub(",", "", judge_np3)1944 judge_np1 = re.sub("\.", "", judge_np1)1945 judge_np2 = re.sub("\.", "", judge_np2)1946 judge_np3 = re.sub("\.", "", judge_np3)1947 judge_np1 = re.sub("\\\\n", "", judge_np1)1948 judge_np2 = re.sub("\\\\n", "", judge_np2)1949 judge_np3 = re.sub("\\\\n", "", judge_np3)1950 judge_np1 = re.sub("\n", "", judge_np1)1951 judge_np2 = re.sub("\n", "", judge_np2)1952 judge_np3 = re.sub("\n", "", judge_np3)1953 judge_np1 = re.sub(", Chief", "", judge_np1)1954 judge_np2 = re.sub(", Chief", "", judge_np2)1955 judge_np3 = re.sub(", Chief", "", judge_np3)1956 judge_np1 = re.sub("Judges:", "", judge_np1)1957 judge_np2 = re.sub("Judges:", "", judge_np2)1958 judge_np3= re.sub("Judges:", "", judge_np3)1959 judge_np1 = re.sub("All the concur, except", "", judge_np1)1960 judge_np2 = re.sub("All the concur, except", "", judge_np2)1961 judge_np3 = re.sub("All the concur, except", "", judge_np3)1962 judge_np1 = re.sub("\xc2\xa0:", "", judge_np1)1963 judge_np2 = re.sub("\xc2\xa0:", "", judge_np2)1964 judge_np3 = re.sub("\xc2\xa0:", "", judge_np3)1965 judge_np1 = re.sub(", ", "", judge_np1)1966 judge_np2 = re.sub(", ", "", judge_np2)1967 judge_np3 = re.sub(", ", "", judge_np3)1968 judge_np1 = judge_np1.strip()1969 judge_np2 = judge_np2.strip()1970 judge_np3 = judge_np3.strip()1971 judge_np1 = Capitalize(judge_np1)1972 judge_np2 = Capitalize(judge_np2)1973 judge_np3 = Capitalize(judge_np3)1974 judge1_ln = lastname(judge1_ln)1975 judge2_ln = lastname(judge2_ln)1976 judge3_ln = lastname(judge3_ln)1977 judge4_ln = lastname(judge4_ln)1978 judge5_ln = lastname(judge5_ln)1979 judge6_ln = lastname(judge6_ln)1980 judge7_ln = lastname(judge7_ln)1981 judge8_ln = lastname(judge8_ln)1982 judge9_ln = lastname(judge9_ln)1983 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln1984 # Remove justices that did not participate based on previously stored list of non-participating judges; remove votes from these justices as well1985 if (judge1_ln == judge_np1 or judge1_ln == judge_np2 or judge1_ln == judge_np3 or judge1_ln == judge_np4):1986 judge1_ln = ""1987 judge1_vote = ""1988 if (judge2_ln == judge_np1 or judge2_ln == judge_np2 or judge2_ln == judge_np3 or judge2_ln == judge_np4):1989 judge2_ln = ""1990 judge2_vote = ""1991 if (judge3_ln == judge_np1 or judge3_ln == judge_np2 or judge3_ln == judge_np3 or judge3_ln == judge_np4):1992 judge3_ln = ""1993 judge3_vote = ""1994 if (judge4_ln == judge_np1 or judge4_ln == judge_np2 or judge4_ln == judge_np3 or judge4_ln == judge_np4):1995 judge4_ln = ""1996 judge4_vote = ""1997 if (judge5_ln == judge_np1 or judge5_ln == judge_np2 or judge5_ln == judge_np3 or judge5_ln == judge_np4):1998 judge5_ln = ""1999 judge5_vote = ""2000 if (judge6_ln == judge_np1 or judge6_ln == judge_np2 or judge6_ln == judge_np3 or judge6_ln == judge_np4):2001 judge6_ln = ""2002 judge6_vote = ""2003 if (judge7_ln == judge_np1 or judge7_ln == judge_np2 or judge7_ln == judge_np3 or judge7_ln == judge_np4):2004 judge7_ln = ""2005 judge7_vote = ""2006 if (judge8_ln == judge_np1 or judge8_ln == judge_np2 or judge8_ln == judge_np3 or judge8_ln == judge_np4):2007 judge8_ln = ""2008 judge8_vote = ""2009 if (judge9_ln == judge_np1 or judge9_ln == judge_np2 or judge9_ln == judge_np3 or judge9_ln == judge_np4):2010 judge9_ln = ""2011 judge9_vote = ""2012 if (judge10_ln == judge_np1 or judge10_ln == judge_np2 or judge10_ln == judge_np3 or judge10_ln == judge_np4):2013 judge10_ln = ""2014 judge10_vote = ""2015 if (judge11_ln == judge_np1 or judge11_ln == judge_np2 or judge11_ln == judge_np3 or judge11_ln == judge_np4 ):2016 judge11_ln = ""2017 judge11_vote = ""2018 # Determine if a dissenting opinion is present2019 if (re.search("dissent|DISSENT|dissents|Dissents|dissenting|Dissenting|DISSENTING", judges_string)):2020 jud_dissent = 12021 # Determine if a decision was unanimous2022 if (re.search("(U|u)nanimous|UNANIMOUS", judges_string)):2023 unanimous = 12024 if(unanimous == 1 and re.search("concurred\.", txtline)): ###build out to parse judge list into single judges2025 new_judges = txtline2026 new_judges = re.sub("C\.\sJ\.,", "", new_judges)2027 new_judges = re.sub("J\.,", "", new_judges)2028 new_judges = re.sub(" and", "", new_judges)2029 new_judges = re.sub("concurred\.", "", new_judges)2030 new_judges = re.sub("\[\*+[0-9]+\]", "", new_judges)2031 new_judges = re.sub("\s", "", new_judges)2032 new_judges = new_judges.split(",")2033 judges_holder = [judges_holder.pop(0)] + new_judges2034 if (len(judges_holder) > 1):2035 judge1_ln = lastname(judges_holder[0])2036 judge2_ln = lastname(judges_holder[1])2037 if (len(judges_holder) > 2):2038 judge3_ln = lastname(judges_holder[2])2039 if (len(judges_holder) > 3):2040 judge4_ln = lastname(judges_holder[3])2041 if (len(judges_holder) > 4):2042 judge5_ln = lastname(judges_holder[4])2043 if (len(judges_holder) > 5):2044 judge6_ln = lastname(judges_holder[5])2045 if (len(judges_holder) > 6):2046 judge7_ln = lastname(judges_holder[6])2047 if (len(judges_holder) > 7):2048 judge8_ln = lastname(judges_holder[7])2049 if (len(judges_holder) > 8):2050 judge9_ln = lastname(judges_holder[8])2051 # Store name of justice writing the majority opinion and format name2052 if (re.match("^Opinion by:", txtline) and not trunc_text):2053 opin_by_line = True2054 if (opin_by_line and re.search("[\w]+", txtline)):2055 opin_by_string = opin_by_string + txtline2056 if (opin_by_line and re.match("^[\s]+$", txtline)):2057 # blank line after opinion by line2058 opin_by_string = re.sub("Opinion by:", "", opin_by_string)2059 opin_by_string = re.sub("FOR THE COURT;", "", opin_by_string)2060 opin_by_string = re.sub("\[\*+\d+\]", "", opin_by_string)2061 opin_by_string = re.sub("\*[\d]*", "", opin_by_string)2062 opin_by_string = re.sub(", Circuit Judge", "", opin_by_string)2063 opin_by_string = re.sub("Chief Justice:", "", opin_by_string)2064 opin_by_string = re.sub("\xc2", "", opin_by_string)2065 opin_by_string = re.sub("'", "", opin_by_string)2066 opin_by_string = re.sub("Sr\.|SR\.|Jr\.|JR\.", "", opin_by_string)2067 opin_by_string = re.sub("\xa0", "", opin_by_string)2068 opin_by_string = re.sub("C\.\sJ\.|C\.J\.|J\.J\.|J\.\sJ\.|J\.", "", opin_by_string)2069 opin_by_string = re.sub("T\.Y\.|T\. Y\.", "", opin_by_string)2070 opin_by_string = re.sub(" C\.", "", opin_by_string)2071 opin_by_string = re.sub("\xc3\x81", "a", opin_by_string)2072 opin_by_string = re.sub("III", "", opin_by_string)2073 opin_by_string = re.sub("\xc3\x81", "a", opin_by_string)2074 opin_by_string = re.sub(" ILL| ill", "ONEILL", opin_by_string)2075 opin_by_string = re.sub('DENVIR STITH|DENVIRSTITH', 'Stith', opin_by_string)2076 opin_by_string = string.strip(opin_by_string)2077 opin_by_line = False2078 author_ln = lastname(opin_by_string)2079 author_fn = firstname(opin_by_string)2080 author_mn = middlename(opin_by_string)2081 author_suf = namesuffix(opin_by_string)2082 author_full = author_ln + ", " + author_fn + " " + author_mn + " " + author_suf2083 author_full = re.sub("[\s]+", " ", author_full)2084 author_full = re.sub(", $", "", author_full)2085 if(Capitalize(judge1_ln) != Capitalize(author_ln)):2086 judge11_ln = judge10_ln2087 judge10_ln = judge9_ln2088 judge9_ln = judge8_ln2089 judge8_ln = judge7_ln2090 judge7_ln = judge6_ln2091 judge6_ln = judge5_ln2092 judge5_ln = judge4_ln2093 judge4_ln = judge3_ln2094 judge3_ln = judge2_ln2095 judge2_ln = judge1_ln2096 judge1_ln = author_ln2097 judge11_vote = judge10_vote2098 judge10_vote = judge9_vote2099 judge9_vote = judge8_vote2100 judge8_vote = judge7_vote2101 judge7_vote = judge6_vote2102 judge6_vote = judge5_vote2103 judge5_vote = judge4_vote2104 judge4_vote = judge3_vote2105 judge3_vote = judge2_vote2106 judge2_vote = judge1_vote2107 judge1_vote = 12108 if (re.match("^Opinion", txtline) and not trunc_text and not blank_after_firstcite and not re.search("^Opinion No.",txtline)):2109 opinion_line = True2110 opinion_start = True2111 if (re.match(re.escape("********** Print Completed **********"), txtline) or re.match("APPENDIX", txtline) or re.match("^CONCUR BY:", txtline) or re.match("^DISSENT BY:", txtline)):2112 opinion_line = False2113 if opinion_line:2114 op_string = txtline2115 op_holder = re.sub("^Opinion", " ", op_string)2116 op_holder = re.sub("\xa0", " ", op_holder)2117 op_holder = re.sub("\n|\r", " ", op_holder)2118 op_holder = re.sub("\[\*+[0-9]+\]", " ", op_holder)2119 op_holder = string.strip(op_holder)2120 op_holder = re.split("\s+", op_holder)2121 op_holder = [word for word in op_holder if word != ""]2122 opinion_word_count += len(op_holder)2123 judge1_vote = 12124 if (re.search("AMICUS|amicus|Amicus", op_string)):2125 amicus = 12126 if (re.search("^Dissent", txtline)):2127 dissent_line = True2128 # If Lexis lists a line beginning with "Dissent:", store the justices listed after2129 if (re.match("^Dissent by:|^DISSENT BY:", txtline) and not trunc_text):2130 dissent_by_line = True2131 dissent = 12132 if (dissent_by_line and re.search("[\w]+", txtline)):2133 dissent_by_string = dissent_by_string + txtline2134 # Format dissenting justice names2135 if (dissent_by_line and re.match("^[\s]+$", txtline)):2136 silent_dissent = True2137 dissent_by_string = string.strip(dissent_by_string)2138 dissent_by_string = re.sub("\n", "", dissent_by_string)2139 dissent_by_string = re.sub("Dissent by:|DISSENT BY:", "", dissent_by_string)2140 dissent_by_string = re.sub("\[.+\]", "", dissent_by_string)2141 dissent_by_string = re.sub("[\s]*\(In[\s]*(P|p)art\)", "", dissent_by_string)2142 dissent_by_string = re.sub("\*\d+", "", dissent_by_string)2143 dissent_by_string = re.sub("dissenting:|dissenting", "", dissent_by_string)2144 dissent_by_string = re.sub("Justice|JUSTICE", "", dissent_by_string)2145 dissent_by_string = re.sub("\d+", "", dissent_by_string)2146 dissent_by_string = re.sub("\xc2", "", dissent_by_string)2147 dissent_by_string = re.sub("\xa0", "", dissent_by_string)2148 dissent_by_string = re.sub("J;", "", dissent_by_string)2149 dissent_by_string = re.sub("C\.J\.|C\. J\.|J\.J\.|JJ\.|J\. J\.|J\.", "", dissent_by_string)2150 dissent_by_string = re.sub("[\(\[].*?[\)\]]", "", dissent_by_string)2151 dissent_by_string = re.sub("'", "", dissent_by_string)2152 dissent_by_string = re.sub("affirmed", "", dissent_by_string)2153 dissent_by_string = re.sub("filed an opinion concurring in part and in part", "", dissent_by_string)2154 dissent_by_string = re.sub("concurring in part", "", dissent_by_string)2155 dissent_by_string = re.sub("in which", "", dissent_by_string)2156 dissent_by_string = re.sub("of which", "", dissent_by_string)2157 dissent_by_string = re.sub("joined", "", dissent_by_string)2158 dissent_by_string = re.sub("Part I", "", dissent_by_string)2159 dissent_by_string = re.sub("Part", "", dissent_by_string)2160 dissent_by_string = re.sub("in part", "", dissent_by_string)2161 dissent_by_string = re.sub("and in", "", dissent_by_string)2162 dissent_by_string = re.sub(" by", "", dissent_by_string)2163 dissent_by_string = re.sub(" and", "", dissent_by_string)2164 dissent_by_string = re.sub("as to", "", dissent_by_string)2165 dissent_by_string = re.sub("filed a", "", dissent_by_string)2166 dissent_by_string = re.sub("\.", ",", dissent_by_string)2167 dissent_by_string = re.sub("[\s]*;", ";", dissent_by_string)2168 dissent_holder = re.split(";|,", dissent_by_string)2169 dissent_holder = filter(None, dissent_holder)2170 dissent_holder = [name for name in dissent_holder if name.strip()]2171 num_dissent = len(dissent_holder)2172 dissent_by_line = False2173 dissent1_ln = lastname(dissent_holder[0]).strip()2174 dissent1_ln = dissent1_ln.strip()2175 dissent1_ln = re.sub("\xa0", "", dissent1_ln)2176 dissent1_ln = Capitalize(dissent1_ln)2177 dissent1_fn = firstname(dissent_holder[0])2178 dissent1_mn = middlename(dissent_holder[0])2179 dissent1_suf = namesuffix(dissent_holder[0])2180 if (len(dissent_holder) > 1):2181 dissent2_ln = lastname(dissent_holder[1]).strip()2182 dissent2_fn = firstname(dissent_holder[1])2183 dissent2_mn = middlename(dissent_holder[1])2184 dissent2_suf = namesuffix(dissent_holder[1])2185 if (len(dissent_holder) > 2):2186 dissent3_ln = lastname(dissent_holder[2]).strip()2187 dissent3_fn = firstname(dissent_holder[2])2188 dissent3_mn = middlename(dissent_holder[2])2189 dissent3_suf = namesuffix(dissent_holder[2])2190 if (len(dissent_holder) > 3):2191 dissent4_ln = lastname(dissent_holder[3]).strip()2192 dissent4_fn = firstname(dissent_holder[3])2193 dissent4_mn = middlename(dissent_holder[3])2194 dissent4_suf = namesuffix(dissent_holder[3])2195 if (len(dissent_holder) > 4):2196 dissent5_ln = lastname(dissent_holder[4]).strip()2197 dissent5_fn = firstname(dissent_holder[4])2198 dissent5_mn = middlename(dissent_holder[4])2199 dissent5_suf = namesuffix(dissent_holder[4])2200 dissent1_full = dissent1_ln + ", " + dissent1_fn + " " + dissent1_mn + " " + dissent1_suf2201 dissent1_full = re.sub("[\s]+", " ", dissent1_full)2202 dissent1_full = re.sub(", $", "", dissent1_full)2203 dissent2_full = dissent2_ln + ", " + dissent2_fn + " " + dissent2_mn + " " + dissent2_suf2204 dissent2_full = re.sub("[\s]+", " ", dissent2_full)2205 dissent2_full = re.sub(", $", "", dissent2_full)2206 dissent3_full = dissent3_ln + ", " + dissent3_fn + " " + dissent3_mn + " " + dissent3_suf2207 dissent3_full = re.sub("[\s]+", " ", dissent3_full)2208 dissent3_full = re.sub(", $", "", dissent3_full)2209 dissent4_full = dissent4_ln + ", " + dissent4_fn + " " + dissent4_mn + " " + dissent4_suf2210 dissent4_full = re.sub("[\s]+", " ", dissent4_full)2211 dissent4_full = re.sub(", $", "", dissent4_full)2212 dissent5_full = dissent4_ln + ", " + dissent5_fn + " " + dissent5_mn + " " + dissent5_suf2213 dissent5_full = re.sub("[\s]+", " ", dissent5_full)2214 dissent5_full = re.sub(", $", "", dissent5_full)2215 # Store justices that concurred in dissenting opinions, format names, and store in a list2216 if (silent_dissent == True and re.search("concurs\.$|concur\.$|concurred\.$", txtline)):2217 other_dissent_string = txtline2218 other_dissent_string = re.sub("\xa0", "", other_dissent_string)2219 other_dissent_string = re.sub(" C\.J\.,| C\. J\.|JJ\.| J\.|C\.J\.", "", other_dissent_string)2220 other_dissent_string = re.sub(" and", ",", other_dissent_string)2221 other_dissent_string = re.sub("'", "", other_dissent_string)2222 other_dissent_string = re.sub(" concurred\.", "", other_dissent_string)2223 other_dissent_string = re.sub(" concur\.\n| concurs\.\n", "", other_dissent_string)2224 other_dissent_string = re.sub("affirmed", "", other_dissent_string)2225 other_dissent_string = re.sub("whom", "", other_dissent_string)2226 other_dissent_string = other_dissent_string.strip()2227 other_dissent_judges = other_dissent_string.split(",")2228 other_dissent_judges[:] = [item for item in other_dissent_judges if item != '']2229 if len(other_dissent_judges) > 0:2230 silent_judge1 = other_dissent_judges[0].strip()2231 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge1))2232 dissent_holder = dissent_holder + [silent_judge1]2233 num_dissent += 12234 if len(other_dissent_judges) > 1:2235 silent_judge2 = other_dissent_judges[1].strip()2236 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge2))2237 num_dissent += 12238 dissent_holder = dissent_holder + [silent_judge2]2239 if len(other_dissent_judges) > 2:2240 silent_judge3 = other_dissent_judges[2].strip()2241 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge3))2242 num_dissent += 12243 dissent_holder = dissent_holder + [silent_judge3]2244 if len(other_dissent_judges) > 3:2245 silent_judge4 = other_dissent_judges[3].strip()2246 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge4))2247 num_dissent += 12248 dissent_holder = dissent_holder + [silent_judge4]2249 if silent_judge4 == silent_judge1 or silent_judge4 == silent_judge2 or silent_judge4 == silent_judge3:2250 silent_judge4 = ""2251 if silent_judge3 == silent_judge1 or silent_judge3 == silent_judge2:2252 silent_judge3 = ""2253 if silent_judge2 == silent_judge1:2254 silent_judge2 = ""2255 silent_dissent = False2256 # Search for concurring judge2257 if (re.search("Concur", txtline)):2258 concur_line = True2259 # Store number of concurring justice and parse/format names of concurring justices (stored in string)2260 if (re.match("^Concur by:", txtline) and not trunc_text):2261 concur_by_line = True2262 concur = concur + 12263 if (concur_by_line and re.search("[\w]+", txtline)):2264 concur_by_string = concur_by_string + txtline2265 if (concur_by_line and re.match("^[\s]+$", txtline)):2266 concur_by_string = string.strip(concur_by_string)2267 concur_by_string = re.sub("\n", " ", concur_by_string)2268 concur_by_string = re.sub("Concur by: ", "", concur_by_string)2269 concur_by_string = re.sub("\[.+\]", "", concur_by_string)2270 concur_by_string = re.sub("\xc2", "", concur_by_string)2271 concur_by_string = re.sub("[\s]*\(In[\s]*(P|p)art\)", "", concur_by_string)2272 concur_by_string = re.sub("\*\d+", "", concur_by_string)2273 concur_by_string = re.sub("\d+", "", concur_by_string)2274 concur_by_string = re.sub("[\s]*;", ";", concur_by_string)2275 concur_holder = re.split("; ", concur_by_string)2276 num_concur = len(concur_holder)2277 concur_by_line = False2278 concur1_ln = lastname(concur_holder[0])2279 concur1_fn = firstname(concur_holder[0])2280 concur1_mn = middlename(concur_holder[0])2281 concur1_suf = namesuffix(concur_holder[0])2282 if (len(concur_holder) > 1):2283 concur2_ln = lastname(concur_holder[1])2284 concur2_fn = firstname(concur_holder[1])2285 concur2_mn = middlename(concur_holder[1])2286 concur2_suf = namesuffix(concur_holder[1])2287 if (len(concur_holder) > 2):2288 concur3_ln = lastname(concur_holder[2])2289 concur3_fn = firstname(concur_holder[2])2290 concur3_mn = middlename(concur_holder[2])2291 concur3_suf = namesuffix(concur_holder[2])2292 if (len(concur_holder) > 3):2293 concur4_ln = lastname(concur_holder[3])2294 concur4_fn = firstname(concur_holder[3])2295 concur4_mn = middlename(concur_holder[3])2296 concur4_suf = namesuffix(concur_holder[3])2297 if (len(concur_holder) > 4):2298 concur5_ln = lastname(concur_holder[4])2299 concur5_fn = firstname(concur_holder[4])2300 concur5_mn = middlename(concur_holder[4])2301 concur5_suf = namesuffix(concur_holder[4])2302 if (len(concur_holder) > 5):2303 concur6_ln = lastname(concur_holder[5])2304 concur6_fn = firstname(concur_holder[5])2305 concur6_mn = middlename(concur_holder[5])2306 concur6_suf = namesuffix(concur_holder[5])2307 if (len(concur_holder) > 6):2308 concur7_ln = lastname(concur_holder[6])2309 concur7_fn = firstname(concur_holder[6])2310 concur7_mn = middlename(concur_holder[6])2311 concur7_suf = namesuffix(concur_holder[6])2312 concur1_full = concur1_ln + ", " + concur1_fn + " " + concur1_mn + " " + concur1_suf2313 concur1_full = re.sub("[\s]+", " ", concur1_full)2314 concur1_full = re.sub(", $", "", concur1_full)2315 concur2_full = concur2_ln + ", " + concur2_fn + " " + concur2_mn + " " + concur2_suf2316 concur2_full = re.sub("[\s]+", " ", concur2_full)2317 concur2_full = re.sub(", $", "", concur2_full)2318 concur3_full = concur3_ln + ", " + concur3_fn + " " + concur3_mn + " " + concur3_suf2319 concur3_full = re.sub("[\s]+", " ", concur3_full)2320 concur3_full = re.sub(", $", "", concur3_full)2321 concur4_full = concur4_ln + ", " + concur4_fn + " " + concur4_mn + " " + concur4_suf2322 concur4_full = re.sub("[\s]+", " ", concur4_full)2323 concur4_full = re.sub(", $", "", concur4_full)2324 concur5_full = concur5_ln + ", " + concur5_fn + " " + concur5_mn + " " + concur5_suf2325 concur5_full = re.sub("[\s]+", " ", concur5_full)2326 concur5_full = re.sub(", $", "", concur5_full)2327 concur6_full = concur6_ln + ", " + concur6_fn + " " + concur6_mn + " " + concur6_suf2328 concur6_full = re.sub("[\s]+", " ", concur6_full)2329 concur6_full = re.sub(", $", "", concur6_full)2330 concur7_full = concur7_ln + ", " + concur7_fn + " " + concur7_mn + " " + concur7_suf2331 concur7_full = re.sub("[\s]+", " ", concur7_full)2332 concur7_full = re.sub(", $", "", concur7_full)2333 # Format all justices listed as dissenting (both those that wrote an opinion and those that signed on)2334 dissent_holder = [word for word in dissent_holder if word != ""]2335 dissent_holder = dissent_holder + other_dissent_holder2336 dissent_holder = [word.upper().strip() for word in dissent_holder]2337 dissent_holder = list(set(dissent_holder))2338 if len(dissent_holder)==0:2339 dissent_author_1 = ""2340 dissent_author_2 = ""2341 dissent_author_3 = ""2342 dissent_author_4 = ""2343 if len(dissent_holder)==1:2344 dissent_author_1 = dissent_holder[0].strip()2345 dissent_author_1 = re.sub("\xa0*", "", dissent_author_1)2346 dissent_author_1 = re.sub("\(In\s*part\)", "", dissent_author_1)2347 dissent_author_1 = lastname(dissent_author_1)2348 dissent_author_1 = Capitalize(dissent_author_1)2349 dissent_author_2 = ""2350 dissent_author_3 = ""2351 dissent_author_4 = ""2352 if len(dissent_holder)==2:2353 dissent_author_1 = dissent_holder[0].strip()2354 dissent_author_1 = dissent_author_1.strip()2355 dissent_author_1 = re.sub("\xa0", "", dissent_author_1)2356 dissent_author_1 = re.sub("\(In", "", dissent_author_1)2357 dissent_author_1 = re.sub("J\.", "", dissent_author_1)2358 dissent_author_1 = re.sub("J;", "", dissent_author_1)2359 dissent_author_1 = Capitalize(lastname(dissent_author_1))2360 dissent_author_2 = dissent_holder[1].strip()2361 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2362 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2363 dissent_author_2 = Capitalize(lastname(dissent_author_2))2364 dissent_author_3 = ""2365 dissent_author_4 = ""2366 if len(dissent_holder)==3:2367 dissent_author_1 = dissent_holder[0].strip()2368 dissent_author_1 = dissent_author_1.strip()2369 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2370 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2371 dissent_author_1 = Capitalize(lastname(dissent_author_1))2372 dissent_author_2 = dissent_holder[1].strip()2373 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2374 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2375 dissent_author_2 = Capitalize(lastname(dissent_author_2))2376 dissent_author_3 = dissent_holder[2].strip()2377 dissent_author_3 = dissent_author_3.strip()2378 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2379 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2380 dissent_author_3 = Capitalize(lastname(dissent_author_3))2381 dissent_author_4 = ""2382 if len(dissent_holder)==4:2383 dissent_author_1 = dissent_holder[0].strip()2384 dissent_author_1 = dissent_author_1.strip()2385 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2386 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2387 dissent_author_1 = Capitalize(lastname(dissent_author_1))2388 dissent_author_2 = dissent_holder[1].strip()2389 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2390 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2391 dissent_author_2 = Capitalize(lastname(dissent_author_2))2392 dissent_author_3 = dissent_holder[2].strip()2393 dissent_author_3 = dissent_author_3.strip()2394 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2395 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2396 dissent_author_3 = Capitalize(lastname(dissent_author_3))2397 dissent_author_4 = dissent_holder[3].strip()2398 dissent_author_4 = dissent_author_4.strip()2399 dissent_author_4 = re.sub("[\xa0]*", "", dissent_author_4)2400 dissent_author_4 = re.sub("\In\spart\)", "", dissent_author_4)2401 dissent_author_4 = Capitalize(lastname(dissent_author_4))2402 dissent_author_5 = ""2403 if len(dissent_holder)==5:2404 dissent_author_1 = dissent_holder[0].strip()2405 dissent_author_1 = dissent_author_1.strip()2406 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2407 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2408 dissent_author_1 = Capitalize(lastname(dissent_author_1))2409 dissent_author_2 = dissent_holder[1].strip()2410 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2411 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2412 dissent_author_2 = Capitalize(lastname(dissent_author_2))2413 dissent_author_3 = dissent_holder[2].strip()2414 dissent_author_3 = dissent_author_3.strip()2415 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2416 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2417 dissent_author_3 = Capitalize(lastname(dissent_author_3))2418 dissent_author_4 = dissent_holder[3].strip()2419 dissent_author_4 = dissent_author_4.strip()2420 dissent_author_4 = re.sub("[\xa0]*", "", dissent_author_4)2421 dissent_author_4 = re.sub("\In\spart\)", "", dissent_author_4)2422 dissent_author_4 = Capitalize(lastname(dissent_author_4))2423 dissent_author_5 = dissent_holder[4].strip()2424 dissent_author_5 = dissent_author_5.strip()2425 dissent_author_5 = re.sub("[\xa0]*", "", dissent_author_5)2426 dissent_author_5 = re.sub("\In\s*part\)", "", dissent_author_5)2427 dissent_author_5 = Capitalize(lastname(dissent_author_5))2428 if len(dissent_author_1) < 2:2429 dissent_author_1 = ""2430 if len(dissent_author_2) < 2:2431 dissent_author_2 = ""2432 if len(dissent_author_3) < 2:2433 dissent_author_3 = ""2434 if len(dissent_author_4) < 2:2435 dissent_author_4 = ""2436 if len(dissent_author_5) < 2:2437 dissent_author_5 = ""2438 if dissent_line and dissent==0:2439 dissent=12440 num_dissent=12441 if concur_line and concur==0:2442 concur=12443 num_concur=12444 #Assign vote values for each justice based on dissenting judges values2445 if dissent_author_1 == judge2_ln or dissent_author_2 == judge2_ln or dissent_author_3 == judge2_ln or dissent_author_4 == judge2_ln or dissent_author_5 == judge2_ln and len(judge2_ln) > 0:2446 judge2_vote = 0 #dissent_author_12447 elif dissent_author_1 != judge2_ln and dissent_author_2 != judge2_ln and dissent_author_3 != judge2_ln and dissent_author_4 != judge2_ln and dissent_author_5 != judge2_ln and len(judge2_ln) > 0:2448 judge2_vote = 12449 else:2450 judge2_vote = ""2451 if dissent_author_1 == judge3_ln or dissent_author_2 == judge3_ln or dissent_author_3 == judge3_ln or dissent_author_4 == judge3_ln or dissent_author_5 == judge3_ln and len(judge3_ln) > 0:2452 judge3_vote = 0 #dissent_author_12453 elif dissent_author_1 != judge3_ln and dissent_author_2 != judge3_ln and dissent_author_3 != judge3_ln and dissent_author_4 != judge3_ln and dissent_author_5 != judge3_ln and len(judge3_ln) > 0:2454 judge3_vote = 12455 else:2456 judge3_vote = ""2457 if dissent_author_1 == judge4_ln or dissent_author_2 == judge4_ln or dissent_author_3 == judge4_ln or dissent_author_4 == judge4_ln or dissent_author_5 == judge4_ln and len(judge4_ln) > 0:2458 judge4_vote = 0 #dissent_author_12459 elif dissent_author_1 != judge4_ln and dissent_author_2 != judge4_ln and dissent_author_3 != judge4_ln and dissent_author_4 != judge4_ln and dissent_author_5 != judge4_ln and len(judge4_ln) > 0:2460 judge4_vote = 12461 else:2462 judge4_vote = ""2463 if dissent_author_1 == judge5_ln or dissent_author_2 == judge5_ln or dissent_author_3 == judge5_ln or dissent_author_4 == judge5_ln or dissent_author_5 == judge5_ln and len(judge5_ln) > 0:2464 judge5_vote = 0 #dissent_author_12465 elif dissent_author_1 != judge5_ln and dissent_author_2 != judge5_ln and dissent_author_3 != judge5_ln and dissent_author_4 != judge5_ln and dissent_author_5 != judge5_ln and len(judge5_ln) > 0:2466 judge5_vote = 12467 else:2468 judge5_vote = ""2469 if dissent_author_1 == judge6_ln or dissent_author_2 == judge6_ln or dissent_author_3 == judge6_ln or dissent_author_4 == judge6_ln or dissent_author_5 == judge6_ln and len(judge6_ln) > 0:2470 judge6_vote = 0 #dissent_author_12471 elif dissent_author_1 != judge6_ln and dissent_author_2 != judge6_ln and dissent_author_3 != judge6_ln and dissent_author_4 != judge6_ln and dissent_author_5 != judge6_ln and len(judge6_ln) > 0:2472 judge6_vote = 12473 else:2474 judge6_vote = ""2475 if dissent_author_1 == judge7_ln or dissent_author_2 == judge7_ln or dissent_author_3 == judge7_ln or dissent_author_4 == judge7_ln or dissent_author_5 == judge7_ln and len(judge7_ln) > 0:2476 judge7_vote = 0 #dissent_author_12477 elif dissent_author_1 != judge7_ln and dissent_author_2 != judge7_ln and dissent_author_3 != judge7_ln and dissent_author_4 != judge7_ln and dissent_author_5 != judge7_ln and len(judge7_ln) > 0:2478 judge7_vote = 12479 else:2480 judge7_vote = ""2481 if dissent_author_1 == judge8_ln or dissent_author_2 == judge8_ln or dissent_author_3 == judge8_ln or dissent_author_4 == judge8_ln or dissent_author_5 == judge8_ln and len(judge8_ln) > 0:2482 judge8_vote = 0 #dissent_author_12483 elif dissent_author_1 != judge8_ln and dissent_author_2 != judge8_ln and dissent_author_3 != judge8_ln and dissent_author_4 != judge8_ln and dissent_author_5 != judge8_ln and len(judge8_ln) > 0:2484 judge8_vote = 12485 else:2486 judge8_vote = ""2487 if dissent_author_1 == judge9_ln or dissent_author_2 == judge9_ln or dissent_author_3 == judge9_ln or dissent_author_4 == judge9_ln or dissent_author_5 == judge9_ln and len(judge9_ln) > 0:2488 judge9_vote = 0 #dissent_author_12489 elif dissent_author_1 != judge9_ln and dissent_author_2 != judge9_ln and dissent_author_3 != judge9_ln and dissent_author_4 != judge9_ln and dissent_author_5 != judge9_ln and len(judge9_ln) > 0:2490 judge9_vote = 12491 else:2492 judge9_vote = ""2493 if dissent_author_1 == judge10_ln or dissent_author_2 == judge10_ln or dissent_author_3 == judge10_ln or dissent_author_4 == judge10_ln or dissent_author_5 == judge10_ln and len(judge10_ln) > 0:2494 judge10_vote = 0 #dissent_author_12495 elif dissent_author_1 != judge10_ln and dissent_author_2 != judge10_ln and dissent_author_3 != judge10_ln and dissent_author_4 != judge10_ln and dissent_author_5 != judge10_ln and len(judge10_ln) > 0:2496 judge10_vote = 12497 else:2498 judge10_vote = ""2499 if dissent_author_1 == judge11_ln or dissent_author_2 == judge11_ln or dissent_author_3 == judge11_ln or dissent_author_4 == judge11_ln or dissent_author_5 == judge11_ln and len(judge11_ln) > 0:2500 judge11_vote = 0 #dissent_author_12501 elif dissent_author_1 != judge11_ln and dissent_author_2 != judge11_ln and dissent_author_3 != judge11_ln and dissent_author_4 != judge11_ln and dissent_author_5 != judge11_ln and len(judge11_ln) > 0:2502 judge11_vote = 12503 else:2504 judge11_vote = ""2505 #Remove vote values from columns without judges2506 if judge1_ln == "":2507 judge1_vote = ""2508 if judge2_ln == "":2509 judge2_vote = ""2510 if judge3_ln == "":2511 judge3_vote = ""2512 if judge4_ln == "":2513 judge4_vote = ""2514 if judge5_ln == "":2515 judge5_vote = ""2516 if judge6_ln == "":2517 judge6_vote = ""2518 if judge7_ln == "":2519 judge7_vote = ""2520 if judge8_ln == "":2521 judge8_vote = ""2522 if judge9_ln == "":2523 judge9_vote = ""2524 if judge10_ln == "":2525 judge10_vote = ""2526 if judge11_ln == "":2527 judge11_vote = ""2528 #Remove non-ASCII characters from Lexis citation values2529 Lexis_cite = re.sub("\xa0", "", Lexis_cite)2530 Lexis_cite = re.sub("\xc2", "", Lexis_cite)2531 #Remove duplicate judges from judge last name columns2532 if(judge9_ln == judge2_ln or judge9_ln == judge3_ln or judge9_ln == judge4_ln or judge9_ln == judge5_ln or judge9_ln == judge6_ln or judge9_ln == judge7_ln or judge9_ln == judge8_ln or judge9_ln == judge1_ln):2533 judge9_ln = ""2534 judge9_vote = ""2535 if(judge8_ln == judge2_ln or judge8_ln == judge3_ln or judge8_ln == judge4_ln or judge8_ln == judge5_ln or judge8_ln == judge6_ln or judge8_ln == judge7_ln or judge8_ln == judge9_ln or judge8_ln == judge1_ln):2536 judge8_ln = ""2537 judge8_vote = ""2538 if(judge7_ln == judge2_ln or judge7_ln == judge3_ln or judge7_ln == judge4_ln or judge7_ln == judge5_ln or judge7_ln == judge6_ln or judge7_ln == judge8_ln or judge7_ln == judge9_ln or judge7_ln == judge1_ln):2539 judge7_ln = ""2540 judge7_vote = ""2541 if(judge6_ln == judge2_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln or judge6_ln == judge7_ln or judge6_ln == judge8_ln or judge6_ln == judge9_ln or judge6_ln == judge1_ln):2542 judge6_ln = ""2543 judge6_vote = ""2544 if(judge5_ln == judge2_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln or judge5_ln == judge7_ln or judge5_ln == judge6_ln or judge5_ln == judge8_ln or judge5_ln == judge9_ln or judge5_ln == judge1_ln):2545 judge5_ln = ""2546 judge5_vote = ""2547 if(judge4_ln == judge2_ln or judge4_ln == judge3_ln or judge4_ln == judge7_ln or judge4_ln == judge5_ln or judge4_ln == judge6_ln or judge4_ln == judge8_ln or judge4_ln == judge9_ln or judge4_ln == judge1_ln):2548 judge4_ln = ""2549 judge4_vote = ""2550 if(judge3_ln == judge2_ln or judge3_ln == judge4_ln or judge3_ln == judge7_ln or judge3_ln == judge5_ln or judge3_ln == judge6_ln or judge3_ln == judge8_ln or judge3_ln == judge9_ln or judge3_ln == judge1_ln):2551 judge3_ln = ""2552 judge3_vote = ""2553 if(judge2_ln == judge3_ln or judge2_ln == judge4_ln or judge2_ln == judge7_ln or judge2_ln == judge5_ln or judge2_ln == judge6_ln or judge2_ln == judge8_ln or judge2_ln == judge9_ln or judge2_ln == judge1_ln):2554 judge2_ln = ""2555 judge2_vote = ""2556 if(judge10_ln == judge1_ln or judge10_ln == judge2_ln or judge10_ln == judge3_ln or judge10_ln == judge4_ln or judge10_ln == judge5_ln or judge10_ln == judge6_ln or judge10_ln == judge7_ln or judge10_ln == judge8_ln or judge10_ln == judge9_ln or judge10_ln == judge11_ln):2557 judge10_ln = ""2558 judge10_vote = ""2559 if(judge11_ln == judge1_ln or judge11_ln == judge2_ln or judge11_ln == judge3_ln or judge11_ln == judge4_ln or judge11_ln == judge5_ln or judge11_ln == judge6_ln or judge11_ln == judge7_ln or judge11_ln == judge8_ln or judge11_ln == judge9_ln or judge11_ln == judge10_ln):2560 judge11_ln = ""2561 judge11_vote = ""2562 #Fix vote values for cases where Lexis only reports judges that author a dissenting opinion in the dissent line2563 if(silent_judge1 == judge1_ln and len(silent_judge1) > 0):2564 judge1_vote = 02565 if(silent_judge1 == judge2_ln and len(silent_judge1) > 0):2566 judge2_vote = 02567 if(silent_judge1 == judge3_ln and len(silent_judge1) > 0):2568 judge3_vote = 02569 if(silent_judge1 == judge4_ln and len(silent_judge1) > 0):2570 judge4_vote = 02571 if(silent_judge1 == judge5_ln and len(silent_judge1) > 0):2572 judge5_vote = 02573 if(silent_judge1 == judge6_ln and len(silent_judge1) > 0):2574 judge6_vote = 02575 if(silent_judge1 == judge7_ln and len(silent_judge1) > 0):2576 judge7_vote = 02577 if(silent_judge1 == judge8_ln and len(silent_judge1) > 0):2578 judge8_vote = 02579 if(silent_judge1 == judge9_ln and len(silent_judge1) > 0):2580 judge9_vote = 02581 if(silent_judge2 == judge1_ln and len(silent_judge2) > 0):2582 judge1_vote = 02583 if(silent_judge2 == judge2_ln and len(silent_judge2) > 0):2584 judge2_vote = 02585 if(silent_judge2 == judge3_ln and len(silent_judge2) > 0):2586 judge3_vote = 02587 if(silent_judge2 == judge4_ln and len(silent_judge2) > 0):2588 judge4_vote = 02589 if(silent_judge2 == judge5_ln and len(silent_judge2) > 0):2590 judge5_vote = 02591 if(silent_judge2 == judge6_ln and len(silent_judge2) > 0):2592 judge6_vote = 02593 if(silent_judge2 == judge7_ln and len(silent_judge2) > 0):2594 judge7_vote = 02595 if(silent_judge2 == judge8_ln and len(silent_judge2) > 0):2596 judge8_vote = 02597 if(silent_judge2 == judge9_ln and len(silent_judge2) > 0):2598 judge9_vote = 02599 if(silent_judge3 == judge1_ln and len(silent_judge3) > 0):2600 judge1_vote = 02601 if(silent_judge3 == judge2_ln and len(silent_judge3) > 0):2602 judge2_vote = 02603 if(silent_judge3 == judge3_ln and len(silent_judge3) > 0):2604 judge3_vote = 02605 if(silent_judge3 == judge4_ln and len(silent_judge3) > 0):2606 judge4_vote = 02607 if(silent_judge3 == judge5_ln and len(silent_judge3) > 0):2608 judge5_vote = 02609 if(silent_judge3 == judge6_ln and len(silent_judge3) > 0):2610 judge6_vote = 02611 if(silent_judge3 == judge7_ln and len(silent_judge3) > 0):2612 judge7_vote = 02613 if(silent_judge3 == judge8_ln and len(silent_judge3) > 0):2614 judge8_vote = 02615 if(silent_judge3 == judge9_ln and len(silent_judge3) > 0):2616 judge9_vote = 02617 if(silent_judge4 == judge1_ln and len(silent_judge4) > 0):2618 judge1_vote = 02619 if(silent_judge4 == judge2_ln and len(silent_judge4) > 0):2620 judge2_vote = 02621 if(silent_judge4 == judge3_ln and len(silent_judge4) > 0):2622 judge3_vote = 02623 if(silent_judge4 == judge4_ln and len(silent_judge4) > 0):2624 judge4_vote = 02625 if(silent_judge4 == judge5_ln and len(silent_judge4) > 0):2626 judge5_vote = 02627 if(silent_judge4 == judge6_ln and len(silent_judge4) > 0):2628 judge6_vote = 02629 if(silent_judge4 == judge7_ln and len(silent_judge4) > 0):2630 judge7_vote = 02631 if(silent_judge4 == judge8_ln and len(silent_judge4) > 0):2632 judge8_vote = 02633 if(silent_judge4 == judge9_ln and len(silent_judge4) > 0):2634 judge9_vote = 02635 if(silent_judge5 == judge1_ln and len(silent_judge5) > 0):2636 judge1_vote = 02637 if(silent_judge5 == judge2_ln and len(silent_judge5) > 0):2638 judge2_vote = 02639 if(silent_judge5 == judge3_ln and len(silent_judge5) > 0):2640 judge3_vote = 02641 if(silent_judge5 == judge4_ln and len(silent_judge5) > 0):2642 judge4_vote = 02643 if(silent_judge5 == judge5_ln and len(silent_judge5) > 0):2644 judge5_vote = 02645 if(silent_judge5 == judge6_ln and len(silent_judge5) > 0):2646 judge6_vote = 02647 if(silent_judge5 == judge7_ln and len(silent_judge5) > 0):2648 judge7_vote = 02649 if(silent_judge5 == judge8_ln and len(silent_judge5) > 0):2650 judge8_vote = 02651 if(silent_judge5 == judge9_ln and len(silent_judge5) > 0):2652 judge9_vote = 02653 #Remove duplicate dissenting judge values from dissent columns2654 if dissent_author_5 == dissent_author_1 or dissent_author_5 == dissent_author_2 or dissent_author_5 == dissent_author_3 or dissent_author_5 == dissent_author_4:2655 dissent_author_5 = ""2656 if dissent_author_4 == dissent_author_1 or dissent_author_4 == dissent_author_2 or dissent_author_4 == dissent_author_3:2657 dissent_author_4 = ""2658 if dissent_author_3 == dissent_author_1 or dissent_author_3 == dissent_author_2:2659 dissent_author_3 = ""2660 if dissent_author_2 == dissent_author_1:2661 dissent_author_2 = ""2662 # Remove instances of "Jr" and "Sr" so that the masterfile will match correctly2663 if judge1_ln == "Jr|Sr":2664 judge1_ln = ""2665 if judge2_ln == "Jr|Sr":2666 judge2_ln = ""2667 if judge3_ln == "Jr|Sr":2668 judge3_ln = ""2669 if judge4_ln == "Jr|Sr":2670 judge4_ln = ""2671 if judge5_ln == "Jr|Sr":2672 judge5_ln = ""2673 if judge6_ln == "Jr|Sr":2674 judge6_ln = ""2675 if judge7_ln == "Jr|Sr":2676 judge7_ln = ""2677 if judge8_ln == "Jr|Sr":2678 judge8_ln = ""2679 if judge9_ln == "Jr|Sr":2680 judge9_ln = ""2681 if judge10_ln == "Jr|Sr":2682 judge10_ln = ""2683 if judge11_ln == "Jr|Sr":2684 judge11_ln = ""2685 #Move judges and votes to the left to fix blank cells2686 if judge1_ln == "" or len(judge1_ln) < 2:2687 judge1_ln = judge2_ln2688 judge1_vote = judge2_vote2689 judge2_ln = judge3_ln2690 judge2_vote = judge3_vote2691 judge3_ln = judge4_ln2692 judge3_vote = judge4_vote2693 judge4_ln = judge5_ln2694 judge4_vote = judge5_vote2695 judge5_ln = judge6_ln2696 judge5_vote = judge6_vote2697 judge6_ln = judge7_ln2698 judge6_vote = judge7_vote2699 judge7_ln = judge8_ln2700 judge7_vote = judge8_vote2701 judge8_ln = judge9_ln2702 judge8_vote = judge9_vote2703 judge9_ln = judge10_ln2704 judge9_vote = judge10_vote2705 judge10_ln = judge11_ln2706 judge10_vote = judge11_vote2707 if judge1_ln == "" or len(judge1_ln) < 2:2708 judge1_ln = judge2_ln2709 judge1_vote = judge2_vote2710 judge2_ln = judge3_ln2711 judge2_vote = judge3_vote2712 judge3_ln = judge4_ln2713 judge3_vote = judge4_vote2714 judge4_ln = judge5_ln2715 judge4_vote = judge5_vote2716 judge5_ln = judge6_ln2717 judge5_vote = judge6_vote2718 judge6_ln = judge7_ln2719 judge6_vote = judge7_vote2720 judge7_ln = judge8_ln2721 judge7_vote = judge8_vote2722 judge8_ln = judge9_ln2723 judge8_vote = judge9_vote2724 judge9_ln = judge10_ln2725 judge9_vote = judge10_vote2726 judge10_ln = judge11_ln2727 judge10_vote = judge11_vote2728 if judge1_ln == "" or len(judge1_ln) < 2:2729 judge1_ln = judge2_ln2730 judge1_vote = judge2_vote2731 judge2_ln = judge3_ln2732 judge2_vote = judge3_vote2733 judge3_ln = judge4_ln2734 judge3_vote = judge4_vote2735 judge4_ln = judge5_ln2736 judge4_vote = judge5_vote2737 judge5_ln = judge6_ln2738 judge5_vote = judge6_vote2739 judge6_ln = judge7_ln2740 judge6_vote = judge7_vote2741 judge7_ln = judge8_ln2742 judge7_vote = judge8_vote2743 judge8_ln = judge9_ln2744 judge8_vote = judge9_vote2745 judge9_ln = judge10_ln2746 judge9_vote = judge10_vote2747 judge10_ln = judge11_ln2748 judge10_vote = judge11_vote2749 if judge2_ln == "" or len(judge2_ln) < 2:2750 judge2_ln = judge3_ln2751 judge2_vote = judge3_vote2752 judge3_ln = judge4_ln2753 judge3_vote = judge4_vote2754 judge4_ln = judge5_ln2755 judge4_vote = judge5_vote2756 judge5_ln = judge6_ln2757 judge5_vote = judge6_vote2758 judge6_ln = judge7_ln2759 judge6_vote = judge7_vote2760 judge7_ln = judge8_ln2761 judge7_vote = judge8_vote2762 judge8_ln = judge9_ln2763 judge8_vote = judge9_vote2764 judge9_ln = judge10_ln2765 judge9_vote = judge10_vote2766 judge10_ln = judge11_ln2767 judge10_vote = judge11_vote2768 if judge2_ln == "" or len(judge2_ln) < 2:2769 judge2_ln = judge3_ln2770 judge2_vote = judge3_vote2771 judge3_ln = judge4_ln2772 judge3_vote = judge4_vote2773 judge4_ln = judge5_ln2774 judge4_vote = judge5_vote2775 judge5_ln = judge6_ln2776 judge5_vote = judge6_vote2777 judge6_ln = judge7_ln2778 judge6_vote = judge7_vote2779 judge7_ln = judge8_ln2780 judge7_vote = judge8_vote2781 judge8_ln = judge9_ln2782 judge8_vote = judge9_vote2783 judge9_ln = judge10_ln2784 judge9_vote = judge10_vote2785 judge10_ln = judge11_ln2786 judge10_vote = judge11_vote2787 if judge2_ln == "" or len(judge2_ln) < 2:2788 judge2_ln = judge3_ln2789 judge2_vote = judge3_vote2790 judge3_ln = judge4_ln2791 judge3_vote = judge4_vote2792 judge4_ln = judge5_ln2793 judge4_vote = judge5_vote2794 judge5_ln = judge6_ln2795 judge5_vote = judge6_vote2796 judge6_ln = judge7_ln2797 judge6_vote = judge7_vote2798 judge7_ln = judge8_ln2799 judge7_vote = judge8_vote2800 judge8_ln = judge9_ln2801 judge8_vote = judge9_vote2802 judge9_ln = judge10_ln2803 judge9_vote = judge10_vote2804 judge10_ln = judge11_ln2805 judge10_vote = judge11_vote2806 if judge3_ln == "" or len(judge3_ln) < 2:2807 judge3_ln = judge4_ln2808 judge3_vote = judge4_vote2809 judge4_ln = judge5_ln2810 judge4_vote = judge5_vote2811 judge5_ln = judge6_ln2812 judge5_vote = judge6_vote2813 judge6_ln = judge7_ln2814 judge6_vote = judge7_vote2815 judge7_ln = judge8_ln2816 judge7_vote = judge8_vote2817 judge8_ln = judge9_ln2818 judge8_vote = judge9_vote2819 judge9_ln = judge10_ln2820 judge9_vote = judge10_vote2821 judge10_ln = judge11_ln2822 judge10_vote = judge11_vote2823 if judge3_ln == "" or len(judge3_ln) < 2:2824 judge3_ln = judge4_ln2825 judge3_vote = judge4_vote2826 judge4_ln = judge5_ln2827 judge4_vote = judge5_vote2828 judge5_ln = judge6_ln2829 judge5_vote = judge6_vote2830 judge6_ln = judge7_ln2831 judge6_vote = judge7_vote2832 judge7_ln = judge8_ln2833 judge7_vote = judge8_vote2834 judge8_ln = judge9_ln2835 judge8_vote = judge9_vote2836 judge9_ln = judge10_ln2837 judge9_vote = judge10_vote2838 judge10_ln = judge11_ln2839 judge10_vote = judge11_vote2840 if judge3_ln == "" or len(judge3_ln) < 2:2841 judge3_ln = judge4_ln2842 judge3_vote = judge4_vote2843 judge4_ln = judge5_ln2844 judge4_vote = judge5_vote2845 judge5_ln = judge6_ln2846 judge5_vote = judge6_vote2847 judge6_ln = judge7_ln2848 judge6_vote = judge7_vote2849 judge7_ln = judge8_ln2850 judge7_vote = judge8_vote2851 judge8_ln = judge9_ln2852 judge8_vote = judge9_vote2853 judge9_ln = judge10_ln2854 judge9_vote = judge10_vote2855 judge10_ln = judge11_ln2856 judge10_vote = judge11_vote2857 if judge4_ln == "" or len(judge4_ln) < 2:2858 judge4_ln = judge5_ln2859 judge4_vote = judge5_vote2860 judge5_ln = judge6_ln2861 judge5_vote = judge6_vote2862 judge6_ln = judge7_ln2863 judge6_vote = judge7_vote2864 judge7_ln = judge8_ln2865 judge7_vote = judge8_vote2866 judge8_ln = judge9_ln2867 judge8_vote = judge9_vote2868 judge9_ln = judge10_ln2869 judge9_vote = judge10_vote2870 judge10_ln = judge11_ln2871 judge10_vote = judge11_vote2872 if judge4_ln == "" or len(judge4_ln) < 2:2873 judge4_ln = judge5_ln2874 judge4_vote = judge5_vote2875 judge5_ln = judge6_ln2876 judge5_vote = judge6_vote2877 judge6_ln = judge7_ln2878 judge6_vote = judge7_vote2879 judge7_ln = judge8_ln2880 judge7_vote = judge8_vote2881 judge8_ln = judge9_ln2882 judge8_vote = judge9_vote2883 judge9_ln = judge10_ln2884 judge9_vote = judge10_vote2885 judge10_ln = judge11_ln2886 judge10_vote = judge11_vote2887 if judge4_ln == "" or len(judge4_ln) < 2:2888 judge4_ln = judge5_ln2889 judge4_vote = judge5_vote2890 judge5_ln = judge6_ln2891 judge5_vote = judge6_vote2892 judge6_ln = judge7_ln2893 judge6_vote = judge7_vote2894 judge7_ln = judge8_ln2895 judge7_vote = judge8_vote2896 judge8_ln = judge9_ln2897 judge8_vote = judge9_vote2898 judge9_ln = judge10_ln2899 judge9_vote = judge10_vote2900 judge10_ln = judge11_ln2901 judge10_vote = judge11_vote2902 if judge5_ln == "" or len(judge5_ln) < 2:2903 judge5_ln = judge6_ln2904 judge5_vote = judge6_vote2905 judge6_ln = judge7_ln2906 judge6_vote = judge7_vote2907 judge7_ln = judge8_ln2908 judge7_vote = judge8_vote2909 judge8_ln = judge9_ln2910 judge8_vote = judge9_vote2911 judge9_ln = judge10_ln2912 judge9_vote = judge10_vote2913 judge10_ln = judge11_ln2914 judge10_vote = judge11_vote2915 if judge5_ln == "" or len(judge5_ln) < 2:2916 judge5_ln = judge6_ln2917 judge5_vote = judge6_vote2918 judge6_ln = judge7_ln2919 judge6_vote = judge7_vote2920 judge7_ln = judge8_ln2921 judge7_vote = judge8_vote2922 judge8_ln = judge9_ln2923 judge8_vote = judge9_vote2924 judge9_ln = judge10_ln2925 judge9_vote = judge10_vote2926 judge10_ln = judge11_ln2927 judge10_vote = judge11_vote2928 if judge5_ln == "" or len(judge5_ln) < 2:2929 judge5_ln = judge6_ln2930 judge5_vote = judge6_vote2931 judge6_ln = judge7_ln2932 judge6_vote = judge7_vote2933 judge7_ln = judge8_ln2934 judge7_vote = judge8_vote2935 judge8_ln = judge9_ln2936 judge8_vote = judge9_vote2937 judge9_ln = judge10_ln2938 judge9_vote = judge10_vote2939 judge10_ln = judge11_ln2940 judge10_vote = judge11_vote2941 if judge6_ln == "" or len(judge6_ln) < 2:2942 judge6_ln = judge7_ln2943 judge6_vote = judge7_vote2944 judge7_ln = judge8_ln2945 judge7_vote = judge8_vote2946 judge8_ln = judge9_ln2947 judge8_vote = judge9_vote2948 judge9_ln = judge10_ln2949 judge9_vote = judge10_vote2950 judge10_ln = judge11_ln2951 judge10_vote = judge11_vote2952 if judge6_ln == "" or len(judge6_ln) < 2:2953 judge6_ln = judge7_ln2954 judge6_vote = judge7_vote2955 judge7_ln = judge8_ln2956 judge7_vote = judge8_vote2957 judge8_ln = judge9_ln2958 judge8_vote = judge9_vote2959 judge9_ln = judge10_ln2960 judge9_vote = judge10_vote2961 judge10_ln = judge11_ln2962 judge10_vote = judge11_vote2963 if judge6_ln == "" or len(judge6_ln) < 2:2964 judge6_ln = judge7_ln2965 judge6_vote = judge7_vote2966 judge7_ln = judge8_ln2967 judge7_vote = judge8_vote2968 judge8_ln = judge9_ln2969 judge8_vote = judge9_vote2970 judge9_ln = judge10_ln2971 judge9_vote = judge10_vote2972 judge10_ln = judge11_ln2973 judge10_vote = judge11_vote2974 if judge7_ln == "" or len(judge7_ln) < 2:2975 judge7_ln = judge8_ln2976 judge7_vote = judge8_vote2977 judge8_ln = judge9_ln2978 judge8_vote = judge9_vote2979 judge9_ln = judge10_ln2980 judge9_vote = judge10_vote2981 judge10_ln = judge11_ln2982 judge10_vote = judge11_vote2983 if judge7_ln == "" or len(judge7_ln) < 2:2984 judge7_ln = judge8_ln2985 judge7_vote = judge8_vote2986 judge8_ln = judge9_ln2987 judge8_vote = judge9_vote2988 judge9_ln = judge10_ln2989 judge9_vote = judge10_vote2990 judge10_ln = judge11_ln2991 judge10_vote = judge11_vote2992 if judge7_ln == "" or len(judge7_ln) < 2:2993 judge7_ln = judge8_ln2994 judge7_vote = judge8_vote2995 judge8_ln = judge9_ln2996 judge8_vote = judge9_vote2997 judge9_ln = judge10_ln2998 judge9_vote = judge10_vote2999 judge10_ln = judge11_ln3000 judge10_vote = judge11_vote3001 if judge8_ln == "" or len(judge8_ln) < 2:3002 judge8_ln = judge9_ln3003 judge8_vote = judge9_vote3004 judge9_ln = judge10_ln3005 judge9_vote = judge10_vote3006 judge10_ln = judge11_ln3007 judge10_vote = judge11_vote3008 if judge8_ln == "" or len(judge8_ln) < 2:3009 judge8_ln = judge9_ln3010 judge8_vote = judge9_vote3011 judge9_ln = judge10_ln3012 judge9_vote = judge10_vote3013 judge10_ln = judge11_ln3014 judge10_vote = judge11_vote3015 if judge8_ln == "" or len(judge8_ln) < 2:3016 judge8_ln = judge9_ln3017 judge8_vote = judge9_vote3018 judge9_ln = judge10_ln3019 judge9_vote = judge10_vote3020 judge10_ln = judge11_ln3021 judge10_vote = judge11_vote3022 if judge9_ln == "" or len(judge9_ln) < 2:3023 judge9_ln = judge10_ln3024 judge9_vote = judge10_vote3025 judge10_ln = judge11_ln3026 judge10_vote = judge11_vote3027 if judge9_ln == "" or len(judge9_ln) < 2:3028 judge9_ln = judge10_ln3029 judge9_vote = judge10_vote3030 judge10_ln = judge11_ln3031 judge10_vote = judge11_vote3032 if judge9_ln == "" or len(judge9_ln) < 2:3033 judge9_ln = judge10_ln3034 judge9_vote = judge10_vote3035 judge10_ln = judge11_ln3036 judge10_vote = judge11_vote3037 if judge10_ln == "" or len(judge10_ln) < 2:3038 judge10_ln = judge11_ln3039 judge10_vote = judge11_vote3040 if judge10_ln == "" or len(judge10_ln) < 2:3041 judge10_ln = judge11_ln3042 judge10_vote = judge11_vote3043 if judge10_ln == "" or len(judge10_ln) < 2:3044 judge10_ln = judge11_ln3045 judge10_vote = judge11_vote3046 #Remove duplicate judges from last judge name columns3047 if(judge9_ln == judge2_ln or judge9_ln == judge3_ln or judge9_ln == judge4_ln or judge9_ln == judge5_ln or judge9_ln == judge6_ln or judge9_ln == judge7_ln or judge9_ln == judge8_ln or judge9_ln == judge1_ln):3048 judge9_ln = ""3049 judge9_vote = ""3050 if(judge8_ln == judge2_ln or judge8_ln == judge3_ln or judge8_ln == judge4_ln or judge8_ln == judge5_ln or judge8_ln == judge6_ln or judge8_ln == judge7_ln or judge8_ln == judge9_ln or judge8_ln == judge1_ln):3051 judge8_ln = ""3052 judge8_vote = ""3053 if(judge7_ln == judge2_ln or judge7_ln == judge3_ln or judge7_ln == judge4_ln or judge7_ln == judge5_ln or judge7_ln == judge6_ln or judge7_ln == judge8_ln or judge7_ln == judge9_ln or judge7_ln == judge1_ln):3054 judge7_ln = ""3055 judge7_vote = ""3056 if(judge6_ln == judge2_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln or judge6_ln == judge7_ln or judge6_ln == judge8_ln or judge6_ln == judge9_ln or judge6_ln == judge1_ln):3057 judge6_ln = ""3058 judge6_vote = ""3059 if(judge5_ln == judge2_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln or judge5_ln == judge7_ln or judge5_ln == judge6_ln or judge5_ln == judge8_ln or judge5_ln == judge9_ln or judge5_ln == judge1_ln):3060 judge5_ln = ""3061 judge5_vote = ""3062 if(judge4_ln == judge2_ln or judge4_ln == judge3_ln or judge4_ln == judge7_ln or judge4_ln == judge5_ln or judge4_ln == judge6_ln or judge4_ln == judge8_ln or judge4_ln == judge9_ln or judge4_ln == judge1_ln):3063 judge4_ln = ""3064 judge4_vote = ""3065 if(judge3_ln == judge2_ln or judge3_ln == judge4_ln or judge3_ln == judge7_ln or judge3_ln == judge5_ln or judge3_ln == judge6_ln or judge3_ln == judge8_ln or judge3_ln == judge9_ln or judge3_ln == judge1_ln):3066 judge3_ln = ""3067 judge3_vote = ""3068 if(judge2_ln == judge3_ln or judge2_ln == judge4_ln or judge2_ln == judge7_ln or judge2_ln == judge5_ln or judge2_ln == judge6_ln or judge2_ln == judge8_ln or judge2_ln == judge9_ln or judge2_ln == judge1_ln):3069 judge2_ln = ""3070 judge2_vote = ""3071 if(judge10_ln == judge1_ln or judge10_ln == judge2_ln or judge10_ln == judge3_ln or judge10_ln == judge4_ln or judge10_ln == judge5_ln or judge10_ln == judge6_ln or judge10_ln == judge7_ln or judge10_ln == judge8_ln or judge10_ln == judge9_ln or judge10_ln == judge11_ln):3072 judge10_ln = ""3073 judge10_vote = ""3074 if(judge11_ln == judge1_ln or judge11_ln == judge2_ln or judge11_ln == judge3_ln or judge11_ln == judge4_ln or judge11_ln == judge5_ln or judge11_ln == judge6_ln or judge11_ln == judge7_ln or judge11_ln == judge8_ln or judge11_ln == judge9_ln or judge11_ln == judge10_ln):3075 judge11_ln = ""3076 judge11_vote = ""3077 if (((state_abbr == "AL" or state_abbr == "FL" or panel == 0 or state_abbr == "NH") and state_abbr != "ME" and state_abbr != "MA" and (len(judge6_ln) > 2) or len(judge2_ln) < 2 or len(judge3_ln) < 2 or (len(judge5_ln) < 2 and panel == 0) and len(judge9_ln) < 2) or len(judge1_ln) < 2 and len(judge2_ln) < 2) or state_abbr != "AL" and len(judge7_ln) < 2:3078 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:3079 reader = csv.reader(f)3080 next(f)3081 for row in reader:3082 state = row[0]3083 name = row[3]3084 if len(row[4]) == 4 and row[0] != "MC":3085 row[4] = "1/1/" + row[4]3086 if len(row[5]) == 4 and row[0] != "MC":3087 row[5] = "1/1/" + row[5]3088 if len(row[4]) != 4 and row[0] != "MC" and state_abbr != "AK" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and (len(judge6_ln) > 2) and len(judge9_ln) < 2 or len(judge3_ln) < 3) or len(judge5_ln) < 2) and state_abbr:3089 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3090 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date() + datetime.timedelta(30)3091 if ((panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and state_abbr != "AK" and ((len(judge6_ln) > 2) or len(judge2_ln) < 2 or len(judge3_ln) < 3 or len(judge5_ln) < 2) and len(judge9_ln) < 2)) and start <= date_format <= end):3092 between = True3093 if ((state == state_abbr) and between and row[2] == "0" and state_abbr != "AK" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and (len(judge6_ln) > 2 or len(judge2_ln) < 2 or len(judge3_ln) < 3 or len(judge5_ln) < 2) and len(judge9_ln) < 2))):3094 if non_panel_judge_string == "":3095 non_panel_judge_string = non_panel_judge_string + Capitalize(lastname(row[3]))3096 else:3097 non_panel_judge_string = non_panel_judge_string + "," + Capitalize(lastname(row[3]))3098 if state == state_abbr and row[2] == "0" and len(judge1_ln) < 2 and len(judge2_ln) < 2 and start <= date_format <= end:3099 #print row[3]3100 if non_panel_judge_string == "":3101 non_panel_judge_string = non_panel_judge_string + Capitalize(lastname(row[3]))3102 else:3103 non_panel_judge_string = non_panel_judge_string + "," + Capitalize(lastname(row[3]))3104 #print non_panel_judge_string3105 if row[3] == judge1_ln:3106 judge1_code = row[1]3107 #print judge1_code3108 between = False3109 non_panel_list = non_panel_judge_string.split(",")3110 master.close()3111 judges_AL = non_panel_list3112 if "Jr" in judges_AL:3113 judges_AL.remove('Jr')3114 #judges_AL = list(set(judges_AL))3115 judges_AL.sort()3116 #print judges_AL3117 if judge1_ln in judges_AL:3118 judges_AL.remove(judge1_ln)3119 if judge2_ln in judges_AL:3120 judges_AL.remove(judge2_ln)3121 if judge3_ln in judges_AL:3122 judges_AL.remove(judge3_ln)3123 if judge4_ln in judges_AL:3124 judges_AL.remove(judge4_ln)3125 if judge5_ln in judges_AL:3126 judges_AL.remove(judge5_ln)3127 if judge6_ln in judges_AL:3128 judges_AL.remove(judge6_ln)3129 if judge7_ln in judges_AL:3130 judges_AL.remove(judge7_ln)3131 if judge8_ln in judges_AL:3132 judges_AL.remove(judge8_ln)3133 if judge_np1 in judges_AL:3134 judges_AL.remove(judge_np1)3135 if judge_np2 in judges_AL:3136 judges_AL.remove(judge_np2)3137 if judge_np3 in judges_AL:3138 judges_AL.remove(judge_np3)3139 if judge_np4 in judges_AL:3140 judges_AL.remove(judge_np4)3141 judges_AL = list(set(judges_AL))3142 if len(judge1_ln) < 2 and len(judge2_ln) < 2 and len(judges_AL) > 0:3143 judge1_ln = judges_AL[0]3144 judge2_ln = judges_AL[1]3145 judge1_vote = 13146 judge2_vote = 13147 if len(judge3_ln) < 2 and len(judges_AL) > 2:3148 judge3_ln = judges_AL[2]3149 judge3_vote = 13150 if len(judge4_ln) < 2 and len(judges_AL) > 3:3151 judge4_ln = judges_AL[3]3152 judge4_vote = 13153 if len(judge5_ln) < 2 and len(judges_AL) > 4:3154 judge5_ln = judges_AL[4]3155 judge5_vote = 13156 if len(judge6_ln) < 2 and len(judges_AL) > 5:3157 judge6_ln = judges_AL[5]3158 judge6_vote = 13159 if len(judge7_ln) < 2 and len(judges_AL) > 6:3160 judge7_ln = judges_AL[6]3161 judge7_vote = 13162 #print judge7_ln3163 if len(judge8_ln) < 2 and len(judges_AL) > 7:3164 judge8_ln = judges_AL[7]3165 judge8_vote = 13166 if len(judge9_ln) < 2 and len(judges_AL) > 8:3167 judge9_ln = judges_AL[8]3168 judge9_vote = 13169 if len(judge2_ln) < 2 and len(judges_AL) > 0:3170 judge2_ln = judges_AL[0]3171 judge2_vote = 13172 if len(judge3_ln) < 2 and len(judges_AL) > 1:3173 judge3_ln = judges_AL[1]3174 judge3_vote = 13175 if len(judge4_ln) < 2 and len(judges_AL) > 2:3176 judge4_ln = judges_AL[2]3177 judge4_vote = 13178 if len(judge5_ln) < 2 and len(judges_AL) > 3:3179 judge5_ln = judges_AL[3]3180 judge5_vote = 13181 if len(judge6_ln) < 2 and len(judges_AL) > 4:3182 judge6_ln = judges_AL[4]3183 judge6_vote = 13184 if len(judge7_ln) < 2 and len(judges_AL) > 5:3185 judge7_ln = judges_AL[5]3186 judge7_vote = 13187 if len(judge8_ln) < 2 and len(judges_AL) > 6:3188 judge8_ln = judges_AL[6]3189 judge8_vote = 13190 if len(judge9_ln) < 2 and len(judges_AL) > 7:3191 judge9_ln = judges_AL[7]3192 judge9_vote = 13193 if len(judge3_ln) < 2 and len(judges_AL) > 0:3194 judge3_ln = judges_AL[0]3195 judge3_vote = 13196 if len(judge4_ln) < 2 and panel == 0 and len(judges_AL) > 1:3197 judge4_ln = judges_AL[1]3198 judge4_vote = 13199 if len(judge5_ln) < 2 and panel == 0 and len(judges_AL) > 2:3200 judge5_ln = judges_AL[2]3201 judge5_vote = 13202 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 3:3203 judge6_ln = judges_AL[3]3204 judge6_vote = 13205 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 4:3206 judge7_ln = judges_AL[4]3207 judge7_vote = 13208 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 5:3209 judge8_ln = judges_AL[5]3210 judge8_vote = 13211 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 6:3212 judge9_ln = judges_AL[6]3213 judge9_vote = 13214 if len(judge4_ln) < 2 and len(judges_AL) > 0 and panel == 0:3215 judge4_ln = judges_AL[0]3216 judge4_vote = 13217 if len(judge5_ln) < 2 and panel == 0 and len(judges_AL) > 1:3218 judge5_ln = judges_AL[1]3219 judge5_vote = 13220 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 2:3221 judge6_ln = judges_AL[2]3222 judge6_vote = 13223 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 3:3224 judge7_ln = judges_AL[3]3225 judge7_vote = 13226 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 4:3227 judge8_ln = judges_AL[4]3228 judge8_vote = 13229 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 5:3230 judge9_ln = judges_AL[5]3231 judge9_vote = 13232 if len(judge5_ln) < 2 and len(judges_AL) > 0 and panel == 0:3233 judge5_ln = judges_AL[0]3234 judge5_vote = 13235 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 1:3236 judge6_ln = judges_AL[1]3237 judge6_vote = 13238 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 2:3239 judge7_ln = judges_AL[2]3240 judge7_vote = 13241 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 3:3242 judge8_ln = judges_AL[3]3243 judge8_vote = 13244 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 4:3245 judge9_ln = judges_AL[4]3246 judge9_vote = 13247 if len(judge6_ln) < 2 and len(judges_AL) > 0 and panel == 0:3248 judge6_ln = judges_AL[0]3249 judge6_vote = 13250 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 1:3251 judge7_ln = judges_AL[1]3252 judge7_vote = 13253 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 2:3254 judge8_ln = judges_AL[2]3255 judge8_vote = 13256 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 3:3257 judge9_ln = judges_AL[3]3258 judge9_vote = 13259 if len(judge7_ln) < 2 and len(judges_AL) > 0 and panel == 0:3260 judge7_ln = judges_AL[0]3261 judge7_vote = 13262 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 1:3263 judge8_ln = judges_AL[1]3264 judge8_vote = 13265 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 2:3266 judge9_ln = judges_AL[2]3267 judge9_vote = 13268 if len(judge8_ln) < 2 and len(judges_AL) > 0 and panel == 0:3269 judge8_ln = judges_AL[0]3270 judge8_vote = 13271 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 1:3272 judge9_ln = judges_AL[1]3273 judge9_vote = 13274 if len(judge9_ln) < 2 and len(judges_AL) > 0 and panel == 0:3275 judge9_ln = judges_AL[0]3276 judge9_vote = 13277 if len(judge2_ln) < 2 and len(judge1_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "NC" and state_abbr != "PA" and state_abbr != "RI" and state_abbr != "WV" and state_abbr != "WI" and state_abbr != "WY" and state_abbr != "AR" and state_abbr != "CO" and state_abbr != "GA" and state_abbr != "HI" and state_abbr != "MS" and state_abbr != "MO" and state_abbr != "MN":3278 judge2_ln = judges_AL[0]3279 judge3_ln = judges_AL[1]3280 judge4_ln = judges_AL[2]3281 judge5_ln = judges_AL[3]3282 judge6_ln = judges_AL[4]3283 judge7_ln = judges_AL[5]3284 judge2_vote = 13285 judge3_vote = 13286 judge4_vote = 13287 judge5_vote = 13288 judge6_vote = 13289 judge7_vote = 13290 if len(judge2_ln) < 2 and len(judge1_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "WV":3291 judge2_ln = judges_AL[0]3292 judge3_ln = judges_AL[1]3293 judge4_ln = judges_AL[2]3294 judge5_ln = judges_AL[3]3295 judge2_vote = 13296 judge3_vote = 13297 judge4_vote = 13298 judge5_vote = 13299 if len(judge3_ln) < 2 and len(judge1_ln) > 2 and len(judge2_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "NJ" and state_abbr != "NY" and state_abbr != "WV" and state_abbr != "AR" and state_abbr != "CO" and state_abbr != "GA" and state_abbr != "HI" and state_abbr != "MS" and state_abbr != "MO":3300 judge3_ln = judges_AL[1]3301 judge4_ln = judges_AL[2]3302 judge5_ln = judges_AL[3]3303 judge6_ln = judges_AL[4]3304 judge3_vote = 13305 judge4_vote = 13306 judge5_vote = 13307 judge6_vote = 13308 else:3309 if len(judges_AL) >= 1 and len(judge6_ln) < 2 and state_abbr != "NH":3310 judge6_ln = judges_AL[0]3311 judge6_vote = 13312 del judges_AL[0]3313 if len(judges_AL) >= 1 and len(judge7_ln) < 2 and len(judge6_ln) > 2 and state_abbr != "NH":3314 judge7_ln = judges_AL[0]3315 judge7_vote = 13316 del judges_AL[0]3317 if len(judges_AL) >= 1 and len(judge8_ln) < 2 and len(judge7_ln) > 2 and state_abbr != "NH":3318 judge8_ln = judges_AL[0]3319 judge8_vote = 13320 del judges_AL[0]3321 if len(judges_AL) >= 1 and len(judge9_ln) < 2 and len(judge8_ln) > 2 and state_abbr != "NH":3322 judge9_ln = judges_AL[0]3323 judge9_vote = 13324 del judges_AL[0]3325 if len(judges_AL) >= 1 and len(judge6_ln) < 2 and state_abbr != "NH":3326 judge6_ln = judges_AL[0]3327 judge6_vote = 13328 del judges_AL[0]3329 if len(judges_AL) >= 1 and len(judge7_ln) < 2 and len(judge6_ln) > 2 and state_abbr != "NH":3330 judge7_ln = judges_AL[0]3331 judge7_vote = 13332 del judges_AL[0]3333 if len(judges_AL) >= 1 and len(judge8_ln) < 2 and len(judge7_ln) > 2 and state_abbr != "NH":3334 judge8_ln = judges_AL[0]3335 judge8_vote = 13336 del judges_AL[0]3337 if len(judges_AL) >= 1 and len(judge9_ln) < 2 and len(judge8_ln) > 2 and state_abbr != "NH":3338 judge9_ln = judges_AL[0]3339 judge9_vote = 13340 del judges_AL[0]3341 #Move over dissenting judges to remove blank cells3342 if(dissent_author_1 == ""):3343 dissent_author_1 = dissent_author_23344 dissent_author_2 = dissent_author_33345 dissent_author_3 = dissent_author_43346 dissent_author_4 = dissent_author_53347 if(dissent_author_2 == ""):3348 dissent_author_2 = dissent_author_33349 dissent_author_3 = dissent_author_43350 dissent_author_4 = dissent_author_53351 if(dissent_author_3 == ""):3352 dissent_author_3 = dissent_author_43353 dissent_author_4 = dissent_author_53354 if(dissent_author_4 == ""):3355 dissent_author_4 = dissent_author_53356 #Remove remaining duplicate dissenting authors3357 if dissent_author_5 == dissent_author_1 or dissent_author_5 == dissent_author_2 or dissent_author_5 == dissent_author_3 or dissent_author_5 == dissent_author_4:3358 dissent_author_5 = ""3359 if dissent_author_4 == dissent_author_1 or dissent_author_4 == dissent_author_2 or dissent_author_4 == dissent_author_3:3360 dissent_author_4 = ""3361 if dissent_author_3 == dissent_author_1 or dissent_author_3 == dissent_author_2:3362 dissent_author_3 = ""3363 if dissent_author_2 == dissent_author_1:3364 dissent_author_2 = ""3365 #Correct dissent_no3366 if dissent_author_1 != "":3367 num_dissent = 13368 if dissent_author_2 != "":3369 num_dissent = 23370 if dissent_author_3 != "":3371 num_dissent = 33372 if dissent_author_4 != "":3373 num_dissent = 43374 if dissent_author_5 != "":3375 num_dissent = 53376 if len(dissent_author_1) < 2:3377 num_dissent = 03378 # Pull in judge codes from state master file by matching state abbrevation, justice name, and time in office3379 if judge1_code == "":3380 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:3381 reader = csv.reader(f)3382 next(f)3383 for row in reader:3384 state = row[0]3385 name = row[3]3386 if len(row[4]) == 4 and row[0] != "MC":3387 row[4] = "1/1/" + row[4]3388 if len(row[5]) == 4 and row[0] != "MC":3389 row[5] = "1/1/" + row[5]3390 if len(row[4]) != 4 and row[0] != "MC":3391 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3392 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date()3393 #Format justice last names from each file to ensure accurate matching3394 if (Capitalize(lastname(row[7])) == Capitalize(judge1_ln) or Capitalize(lastname(row[3])) == Capitalize(judge1_ln)) and judge1_code == "" and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge1_ln) > 1 and start <= date_format <= (end + one_month):3395 judge1_code = row[1]3396 if (Capitalize(lastname(row[7])) == Capitalize(judge2_ln) or Capitalize(lastname(row[3])) == Capitalize(judge2_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge2_ln) > 1 and start <= date_format <= (end + one_month):3397 judge2_code = row[1]3398 if (Capitalize(lastname(row[7])) == Capitalize(judge3_ln) or Capitalize(lastname(row[3])) == Capitalize(judge3_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge3_ln) > 1 and start <= date_format <= (end + one_month):3399 judge3_code = row[1]3400 if (Capitalize(lastname(row[7])) == Capitalize(judge4_ln) or Capitalize(lastname(row[3])) == Capitalize(judge4_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge4_ln) > 1 and start <= date_format <= (end + one_month):3401 judge4_code = row[1]3402 if (Capitalize(lastname(row[7])) == Capitalize(judge5_ln) or Capitalize(lastname(row[3])) == Capitalize(judge5_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge5_ln) > 1 and start <= date_format <= (end + one_month):3403 judge5_code = row[1]3404 if (Capitalize(lastname(row[7])) == Capitalize(judge6_ln) or Capitalize(lastname(row[3])) == Capitalize(judge6_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge6_ln) > 1 and start <= date_format <= (end + one_month):3405 judge6_code = row[1]3406 if (Capitalize(lastname(row[7])) == Capitalize(judge7_ln) or Capitalize(lastname(row[3])) == Capitalize(judge7_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge7_ln) > 1 and start <= date_format <= (end + one_month):3407 judge7_code = row[1]3408 if (Capitalize(lastname(row[7])) == Capitalize(judge8_ln) or Capitalize(lastname(row[3])) == Capitalize(judge8_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge8_ln) > 1 and start <= date_format <= (end + one_month):3409 judge8_code = row[1]3410 if (Capitalize(lastname(row[7])) == Capitalize(judge9_ln) or Capitalize(lastname(row[3])) == Capitalize(judge9_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge9_ln) > 1 and start <= date_format <= (end + one_month):3411 judge9_code = row[1]3412 if (Capitalize(lastname(row[7])) == Capitalize(judge10_ln) or Capitalize(lastname(row[3])) == Capitalize(judge10_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge10_ln) > 1 and start <= date_format <= (end + one_month):3413 judge10_code = row[1]3414 if (Capitalize(lastname(row[7])) == Capitalize(judge11_ln) or Capitalize(lastname(row[3])) == Capitalize(judge11_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge11_ln) > 1 and start <= date_format <= (end + one_month):3415 judge11_code = row[1]3416 # Store "Did not match" if a justice did not match to a justice code3417 if judge1_code == "" and len(judge1_ln) > 2:3418 judge1_code = "Did not match"3419 if judge2_code == "" and len(judge2_ln) > 2:3420 judge2_code = "Did not match"3421 if judge3_code == "" and len(judge3_ln) > 2:3422 judge3_code = "Did not match"3423 if judge4_code == "" and len(judge4_ln) > 2:3424 judge4_code = "Did not match"3425 if judge5_code == "" and len(judge5_ln) > 2:3426 judge5_code = "Did not match"3427 if judge6_code == "" and len(judge6_ln) > 2:3428 judge6_code = "Did not match"3429 if judge7_code == "" and len(judge7_ln) > 2:3430 judge7_code = "Did not match"3431 if judge8_code == "" and len(judge8_ln) > 2:3432 judge8_code = "Did not match"3433 if judge9_code == "" and len(judge9_ln) > 2:3434 judge9_code = "Did not match"3435 if judge10_code == "" and len(judge10_ln) > 2:3436 judge10_code = "Did not match"3437 if judge11_code == "" and len(judge11_ln) > 2:3438 judge11_code = "Did not match"3439 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln3440 if (judge1_ln == judge_np1 or judge1_ln == judge_np2 or judge1_ln == judge_np3 or judge1_ln == judge_np4):3441 judge1_ln = ""3442 judge1_vote = ""3443 judge1_code = ""3444 if (judge2_ln == judge_np1 or judge2_ln == judge_np2 or judge2_ln == judge_np3 or judge2_ln == judge_np4):3445 judge2_ln = ""3446 judge2_vote = ""3447 judge2_code = ""3448 if (judge3_ln == judge_np1 or judge3_ln == judge_np2 or judge3_ln == judge_np3 or judge3_ln == judge_np4):3449 judge3_ln = ""3450 judge3_vote = ""3451 judge3_code = ""3452 if (judge4_ln == judge_np1 or judge4_ln == judge_np2 or judge4_ln == judge_np3 or judge4_ln == judge_np4):3453 judge4_ln = ""3454 judge4_vote = ""3455 judge4_code = ""3456 if (judge5_ln == judge_np1 or judge5_ln == judge_np2 or judge5_ln == judge_np3 or judge5_ln == judge_np4):3457 judge5_ln = ""3458 judge5_vote = ""3459 judge5_code = ""3460 if (judge6_ln == judge_np1 or judge6_ln == judge_np2 or judge6_ln == judge_np3 or judge6_ln == judge_np4):3461 judge6_ln = ""3462 judge6_vote = ""3463 judge6_code = ""3464 if (judge7_ln == judge_np1 or judge7_ln == judge_np2 or judge7_ln == judge_np3 or judge7_ln == judge_np4):3465 judge7_ln = ""3466 judge7_vote = ""3467 judge7_code = ""3468 if (judge8_ln == judge_np1 or judge8_ln == judge_np2 or judge8_ln == judge_np3 or judge8_ln == judge_np4):3469 judge8_ln = ""3470 judge8_vote = ""3471 judge8_code = ""3472 if (judge9_ln == judge_np1 or judge9_ln == judge_np2 or judge9_ln == judge_np3 or judge9_ln == judge_np4):3473 judge9_ln = ""3474 judge9_vote = ""3475 judge9_code = ""3476 if (judge10_ln == judge_np1 or judge10_ln == judge_np2 or judge10_ln == judge_np3 or judge10_ln == judge_np4):3477 judge10_ln = ""3478 judge10_vote = ""3479 judge10_code = ""3480 if (judge11_ln == judge_np1 or judge11_ln == judge_np2 or judge11_ln == judge_np3 or judge11_ln == judge_np4 ):3481 judge11_ln = ""3482 judge11_vote = ""3483 judge11_code = ""3484 if judge5_ln == judge2_ln or judge5_ln == judge1_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln:3485 judge5_ln = ""3486 judge5_vote = ""3487 judge5_code = ""3488 if judge6_ln == judge2_ln or judge6_ln == judge1_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln:3489 judge6_ln = ""3490 judge6_vote = ""3491 judge6_code = ""3492 if len(judge10_ln) < 2:3493 judge10_ln = judge11_ln3494 judge10_vote = judge11_vote3495 judge10_code = judge11_code3496 judge11_ln = ""3497 judge11_vote = ""3498 judge11_code = ""3499 if len(judge7_ln) < 2:3500 judge7_ln = judge8_ln3501 judge7_vote = judge8_vote3502 judge7_code = judge8_code3503 judge8_ln = judge9_ln3504 judge8_vote = judge9_vote3505 judge8_code = judge9_code3506 judge9_ln = judge10_ln3507 judge9_vote = judge10_vote3508 judge9_code = judge10_code3509 judge10_ln = judge11_ln3510 judge10_vote = judge11_vote3511 judge10_code = judge11_code3512 #Correct participating judges string3513 part_judges = judge1_ln + ", " + judge2_ln + ", " + judge3_ln + ", " + judge4_ln + ", " + judge5_ln + ", " + judge6_ln + ", " + judge7_ln + ", " + judge8_ln + ", " + judge9_ln + ", " + judge10_ln + ", " + judge11_ln3514 part_judges = re.sub(' ,', '', part_judges)3515 part_judges = part_judges.rstrip(', ').upper()3516 #print(part_judges)3517 judge1_ln = judge1_ln.upper()3518 judge2_ln = judge2_ln.upper()3519 judge3_ln = judge3_ln.upper()3520 judge4_ln = judge4_ln.upper()3521 judge5_ln = judge5_ln.upper()3522 judge6_ln = judge6_ln.upper()3523 judge7_ln = judge7_ln.upper()3524 judge8_ln = judge8_ln.upper()3525 judge9_ln = judge9_ln.upper()3526 judge10_ln = judge10_ln.upper()3527 judge11_ln = judge11_ln.upper()3528 if judge5_ln == judge2_ln or judge5_ln == judge1_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln:3529 judge5_ln = ""3530 judge5_vote = ""3531 judge5_code = ""3532 if judge6_ln == judge2_ln or judge6_ln == judge1_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln:3533 judge6_ln = ""3534 judge6_vote = ""3535 judge6_code = ""3536 if judge2_ln == judge6_ln:3537 judge6_ln = ""3538 judge6_vote = ""3539 judge6_code = ""3540 if len(judge4_ln) < 2:3541 judge4_ln = judge5_ln3542 judge5_ln = judge6_ln3543 judge6_ln = judge7_ln3544 judge7_ln = judge8_ln3545 judge8_ln = judge9_ln3546 judge9_ln = judge10_ln3547 judge4_vote = judge5_vote3548 judge5_vote = judge6_vote3549 judge6_vote = judge7_vote3550 judge7_vote = judge8_vote3551 judge8_vote = judge9_vote3552 judge9_vote = judge10_vote3553 judge4_code = judge5_code3554 judge5_code = judge6_code3555 judge6_code = judge7_code3556 judge7_code = judge8_code3557 judge8_code = judge9_code3558 judge9_code = judge10_code3559 if len(judge4_ln) < 2:3560 judge4_ln = judge5_ln3561 judge5_ln = judge6_ln3562 judge6_ln = judge7_ln3563 judge7_ln = judge8_ln3564 judge8_ln = judge9_ln3565 judge9_ln = judge10_ln3566 judge4_vote = judge5_vote3567 judge5_vote = judge6_vote3568 judge6_vote = judge7_vote3569 judge7_vote = judge8_vote3570 judge8_vote = judge9_vote3571 judge9_vote = judge10_vote3572 judge4_code = judge5_code3573 judge5_code = judge6_code3574 judge6_code = judge7_code3575 judge7_code = judge8_code3576 judge8_code = judge9_code3577 judge9_code = judge10_code3578 if len(judge5_ln) < 2:3579 judge5_ln = judge6_ln3580 judge6_ln = judge7_ln3581 judge7_ln = judge8_ln3582 judge8_ln = judge9_ln3583 judge9_ln = judge10_ln3584 judge5_vote = judge6_vote3585 judge6_vote = judge7_vote3586 judge7_vote = judge8_vote3587 judge8_vote = judge9_vote3588 judge9_vote = judge10_vote3589 judge5_code = judge6_code3590 judge6_code = judge7_code3591 judge7_code = judge8_code3592 judge8_code = judge9_code3593 judge9_code = judge10_code3594 if len(judge1_ln) < 2:3595 judge1_ln = judge2_ln3596 judge2_ln = judge3_ln3597 judge3_ln = judge4_ln3598 judge4_ln = judge5_ln3599 judge5_ln = judge6_ln3600 judge6_ln = judge7_ln3601 judge7_ln = judge8_ln3602 judge8_ln = judge9_ln3603 judge9_ln = judge10_ln3604 judge1_vote = judge2_vote3605 judge2_vote = judge3_vote3606 judge3_vote = judge4_vote3607 judge4_vote = judge5_vote3608 judge5_vote = judge6_vote3609 judge6_vote = judge7_vote3610 judge7_vote = judge8_vote3611 judge8_vote = judge9_vote3612 judge9_vote = judge10_vote3613 judge1_code = judge2_code3614 judge2_code = judge3_code3615 judge3_code = judge4_code3616 judge4_code = judge5_code3617 judge5_code = judge6_code3618 judge6_code = judge7_code3619 judge7_code = judge8_code3620 judge8_code = judge9_code3621 judge9_code = judge10_code3622 if len(judge3_ln) < 2:3623 judge3_ln = judge4_ln3624 judge4_ln = judge5_ln3625 judge5_ln = judge6_ln3626 judge6_ln = judge7_ln3627 judge7_ln = judge8_ln3628 judge8_ln = judge9_ln3629 judge9_ln = judge10_ln3630 judge3_vote = judge4_vote3631 judge4_vote = judge5_vote3632 judge5_vote = judge6_vote3633 judge6_vote = judge7_vote3634 judge7_vote = judge8_vote3635 judge8_vote = judge9_vote3636 judge9_vote = judge10_vote3637 judge3_code = judge4_code3638 judge4_code = judge5_code3639 judge5_code = judge6_code3640 judge6_code = judge7_code3641 judge7_code = judge8_code3642 judge8_code = judge9_code3643 judge9_code = judge10_code3644 if len(judge5_ln) < 2:3645 judge5_ln = judge6_ln3646 judge6_ln = judge7_ln3647 judge7_ln = judge8_ln3648 judge8_ln = judge9_ln3649 judge9_ln = judge10_ln3650 judge5_vote = judge6_vote3651 judge6_vote = judge7_vote3652 judge7_vote = judge8_vote3653 judge8_vote = judge9_vote3654 judge9_vote = judge10_vote3655 judge5_code = judge6_code3656 judge6_code = judge7_code3657 judge7_code = judge8_code3658 judge8_code = judge9_code3659 judge9_code = judge10_code3660 if judge9_ln == judge8_ln or judge9_ln == judge7_ln or judge9_ln == judge6_ln or judge9_ln == judge5_ln or judge9_ln == judge4_ln or judge9_ln == judge3_ln or judge9_ln == judge2_ln or judge9_ln == judge1_ln:3661 judge9_ln = ""3662 judge9_vote = ""3663 judge9_code = ""3664 if judge8_ln == judge7_ln or judge8_ln == judge6_ln or judge8_ln == judge5_ln or judge8_ln == judge4_ln or judge8_ln == judge3_ln or judge8_ln == judge2_ln or judge8_ln == judge1_ln:3665 judge8_ln = ""3666 judge8_vote = ""3667 judge8_code = ""3668 if judge7_ln == judge6_ln or judge7_ln == judge5_ln or judge7_ln == judge4_ln or judge7_ln == judge3_ln or judge7_ln == judge2_ln or judge7_ln == judge1_ln:3669 judge7_ln = ""3670 judge7_vote = ""3671 judge7_code = ""3672 if judge6_ln == judge2_ln:3673 judge6_ln = ""3674 judge6_vote = ""3675 judge6_code = ""3676 if judge5_ln == judge4_ln:3677 judge5_ln = ""3678 judge5_vote = ""3679 judge5_code = ""3680 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln3681 if len(judge5_ln) < 2:3682 judge5_ln = judge6_ln3683 judge6_ln = judge7_ln3684 judge7_ln = judge8_ln3685 judge8_ln = judge9_ln3686 judge9_ln = judge10_ln3687 judge5_vote = judge6_vote3688 judge6_vote = judge7_vote3689 judge7_vote = judge8_vote3690 judge8_vote = judge9_vote3691 judge9_vote = judge10_vote3692 judge5_code = judge6_code3693 judge6_code = judge7_code3694 judge7_code = judge8_code3695 judge8_code = judge9_code3696 judge9_code = judge10_code3697 if len(judge6_ln) < 2:3698 judge6_ln = judge7_ln3699 judge7_ln = judge8_ln3700 judge8_ln = judge9_ln3701 judge9_ln = judge10_ln3702 judge6_vote = judge7_vote3703 judge7_vote = judge8_vote3704 judge8_vote = judge9_vote3705 judge9_vote = judge10_vote3706 judge6_code = judge7_code3707 judge7_code = judge8_code3708 judge8_code = judge9_code3709 judge9_code = judge10_code3710 if len(judge2_ln) < 2:3711 judge2_ln = judge3_ln3712 judge3_ln = judge4_ln3713 judge4_ln = judge5_ln3714 judge5_ln = judge6_ln3715 judge6_ln = judge7_ln3716 judge7_ln = judge8_ln3717 judge8_ln = judge9_ln3718 judge9_ln = judge10_ln3719 judge2_vote = judge3_vote3720 judge3_vote = judge4_vote3721 judge4_vote = judge5_vote3722 judge5_vote = judge6_vote3723 judge6_vote = judge7_vote3724 judge7_vote = judge8_vote3725 judge8_vote = judge9_vote3726 judge9_vote = judge10_vote3727 judge2_code = judge3_code3728 judge3_code = judge4_code3729 judge4_code = judge5_code3730 judge5_code = judge6_code3731 judge6_code = judge7_code3732 judge7_code = judge8_code3733 judge8_code = judge9_code3734 judge9_code = judge10_code3735 if len(judge1_ln) < 2:3736 judge1_ln = judge2_ln3737 judge2_ln = judge3_ln3738 judge3_ln = judge4_ln3739 judge4_ln = judge5_ln3740 judge5_ln = judge6_ln3741 judge6_ln = judge7_ln3742 judge7_ln = judge8_ln3743 judge8_ln = judge9_ln3744 judge9_ln = judge10_ln3745 judge1_vote = judge2_vote3746 judge2_vote = judge3_vote3747 judge3_vote = judge4_vote3748 judge4_vote = judge5_vote3749 judge5_vote = judge6_vote3750 judge6_vote = judge7_vote3751 judge7_vote = judge8_vote3752 judge8_vote = judge9_vote3753 judge9_vote = judge10_vote3754 judge1_code = judge2_code3755 judge2_code = judge3_code3756 judge3_code = judge4_code3757 judge4_code = judge5_code3758 judge5_code = judge6_code3759 judge6_code = judge7_code3760 judge7_code = judge8_code3761 judge8_code = judge9_code3762 judge9_code = judge10_code3763 if len(judge8_ln) < 2:3764 judge8_ln = judge9_ln3765 judge9_ln = judge10_ln3766 judge10_ln = judge11_ln3767 judge8_vote = judge9_vote3768 judge9_vote = judge10_vote3769 judge10_vote = judge11_vote3770 judge8_code = judge9_code3771 judge9_code = judge10_code3772 judge10_code = judge11_code3773 if len(judge7_ln) < 2:3774 judge7_ln = judge8_ln3775 judge8_ln = judge9_ln3776 judge9_ln = judge10_ln3777 judge10_ln = judge11_ln3778 judge7_vote = judge8_vote3779 judge8_vote = judge9_vote3780 judge9_vote = judge10_vote3781 judge10_vote = judge11_vote3782 judge7_code = judge8_code3783 judge8_code = judge9_code3784 judge9_code = judge10_code3785 judge10_code = judge11_code3786 if judge6_ln == "":3787 judge6_ln = judge7_ln3788 judge7_ln = judge8_ln3789 judge8_ln = judge9_ln3790 judge9_ln = judge10_ln3791 judge6_vote = judge7_vote3792 judge7_vote = judge8_vote3793 judge8_vote = judge9_vote3794 judge9_vote = judge10_vote3795 judge6_code = judge7_code3796 judge7_code = judge8_code3797 judge8_code = judge9_code3798 judge9_code = judge10_code3799 if judge4_ln == "":3800 judge4_ln = judge5_ln3801 judge5_ln = judge6_ln3802 judge6_ln = judge7_ln3803 judge7_ln = judge8_ln3804 judge8_ln = judge9_ln3805 judge9_ln = judge10_ln3806 judge4_vote = judge5_vote3807 judge5_vote = judge6_vote3808 judge6_vote = judge7_vote3809 judge7_vote = judge8_vote3810 judge8_vote = judge9_vote3811 judge9_vote = judge10_vote3812 judge4_code = judge5_code3813 judge5_code = judge6_code3814 judge6_code = judge7_code3815 judge7_code = judge8_code3816 judge8_code = judge9_code3817 judge9_code = judge10_code3818 if judge5_ln == judge4_ln:3819 judge5_ln = judge6_ln3820 judge5_vote = judge6_vote3821 judge5_code = judge6_code3822 judge6_ln = judge7_ln3823 judge6_vote = judge7_vote3824 judge6_code = judge7_code3825 judge7_ln = judge8_ln3826 judge7_vote = judge8_vote3827 judge7_code = judge8_code3828 judge8_ln = judge9_ln3829 judge8_vote = judge9_vote3830 judge8_code = judge9_code3831 judge9_ln = judge10_ln3832 judge9_vote = judge10_vote3833 judge9_code = judge10_code3834 if state_abbr == "CA" or state_abbr == "IL" or state_abbr == "PA" or state_abbr == "FL" or state_abbr == "KY" or state_abbr == "LA" or state_abbr == "ME" or state_abbr == "OH" or state_abbr == "CT" or state_abbr == "MD" or state_abbr == "MI" or state_abbr == "CO" or state_abbr == "GA" or state_abbr == "IA" or state_abbr == "MO" or state_abbr == "NE" or state_abbr == "NJ" or state_abbr == "NY" or state_abbr == "NC" or state_abbr == "OH" or state_abbr == "WI" or state_abbr == "AZ" or state_abbr == "AR" or state_abbr == "MT":3835 judge8_ln = ""3836 judge8_code = ""3837 judge8_vote = ""3838 judge9_ln = ""3839 judge9_code = ""3840 judge9_vote = ""3841 if state_abbr == "ND" or state_abbr == "RI" or state_abbr == "VT" or state_abbr == "SC" or state_abbr == "UT" or state_abbr == "WY" or state_abbr == "HI":3842 judge6_ln = ""3843 judge6_vote = ""3844 judge6_code = ""3845 judge7_ln = ""3846 judge7_vote = ""3847 judge7_code = ""3848 judge8_ln = ""3849 judge8_vote = ""3850 judge8_code = ""3851 if state_abbr == "MS" or state_abbr == "OK-SC" or state_abbr == "WA":3852 judge10_ln = ""3853 judge10_vote = ""3854 judge10_code = ""3855 judge11_ln = ""3856 judge11_vote = ""3857 judge11_code = ""3858 if len(dissent_by_string) > 2:3859 dissent_by_string = dissent_by_string + " " + str(other_dissent_holder)3860 if len(dissent_by_string) < 2:3861 dissent_by_string = dissent_by_string + str(other_dissent_holder)3862 dissent_by_string = re.sub("\[", "", dissent_by_string)3863 dissent_by_string = re.sub("\]", "", dissent_by_string)3864 dissent_by_string = re.sub("'", "", dissent_by_string)3865 if state_abbr == "ID":3866 panel = 03867 # For each case, write a row to the .csv file which contains the desired variables.3868 localrow = []3869 localrow.append("mjn15@psu.edu")3870 localrow.append(Lexis_cite)3871 localrow.append(entry)3872 localrow.append(court_string)3873 localrow.append(new_date)3874 localrow.append(state_abbr)3875 localrow.append(panel)3876 localrow.append(parties_string)3877 localrow.append(docketnum)3878 localrow.append(cite_string)3879 localrow.append(Lexis_cite)3880 localrow.append(West_cite)3881 localrow.append(attorney_string)3882 localrow.append(part_judges)3883 localrow.append(judges_np)3884 localrow.append(judge1_ln)3885 localrow.append(judge1_vote)3886 localrow.append(judge1_code)3887 localrow.append(judge2_ln)3888 localrow.append(judge2_vote)3889 localrow.append(judge2_code)3890 localrow.append(judge3_ln)3891 localrow.append(judge3_vote)3892 localrow.append(judge3_code)3893 localrow.append(judge4_ln)3894 localrow.append(judge4_vote)3895 localrow.append(judge4_code)3896 localrow.append(judge5_ln)3897 localrow.append(judge5_vote)3898 localrow.append(judge5_code)3899 localrow.append(judge6_ln)3900 localrow.append(judge6_vote)3901 localrow.append(judge6_code)3902 localrow.append(judge7_ln)3903 localrow.append(judge7_vote)3904 localrow.append(judge7_code)3905 localrow.append(judge8_ln)3906 localrow.append(judge8_vote)3907 localrow.append(judge8_code)3908 localrow.append(judge9_ln)3909 localrow.append(judge9_vote)3910 localrow.append(judge9_code)3911 localrow.append(judge10_ln)3912 localrow.append(judge10_vote)3913 localrow.append(judge10_code)3914 localrow.append(judge11_ln)3915 localrow.append(judge11_vote)3916 localrow.append(judge11_code)3917 localrow.append(dissent)3918 localrow.append(num_dissent)3919 localrow.append(dissent_by_string.upper())3920 localrow.append(dissent_author_1.upper())3921 localrow.append(dissent_author_2.upper())3922 localrow.append(dissent_author_3.upper())3923 localrow.append(dissent_author_4.upper())3924 localrow.append(dissent_author_5.upper())3925 localrow.append(concur)3926 localrow.append(num_concur)3927 localrow.append(concur_by_string.upper())3928 localrow.append(check_recuse_case)3929 outfilehandle.writerow(localrow)3930 if check_recuse == True:3931 recuse_handle.writerow(localrow)3932 check_recuse = False3933# Finish writing to the .csv file and close it so the process is complete3934infilehandle.close()3935check.close()3936fout.close()...

Full Screen

Full Screen

state_court_scraper_final.py

Source:state_court_scraper_final.py Github

copy

Full Screen

1## reads and extracts info from txt files of published opinions from USCOA2## downloaded from LexisNexis3## written for python 2.6.*4##5## modified version of LexisOpinionParse.py by6## Kevin Quinn7## UC Berkeley8## 5/13/20109##10## modifications by11## Rachael Hinkle12## 9/19/201113##14## modified for state courts by15## Michael Nelson16## Summer, 201717import os18import re19import csv20import string21import operator22import datetime23#mydir = "C:/Users/Steve/Dropbox/PSU2018-2019/RA/Scraper/"24mydir = "C:/Users/sum410/Dropbox/PSU2018-2019/RA/Scraper/"25def expandmonth(mstring2):26 mstring2 = re.sub("Jan\.", "January", mstring2)27 mstring2 = re.sub("Feb\.", "February", mstring2)28 mstring2 = re.sub("Mar\.", "March", mstring2)29 mstring2 = re.sub("Apr\.", "April", mstring2)30 mstring2 = re.sub("Aug\.", "August", mstring2)31 mstring2 = re.sub("Sept\.", "September", mstring2)32 mstring2 = re.sub("Oct\.", "October", mstring2)33 mstring2 = re.sub("Nov\.", "November", mstring2)34 mstring2 = re.sub("Dec\.", "December", mstring2)35 return mstring236def month2number(mstring):37 mnumber = -99938 if (mstring == "January"):39 mnumber = "01"40 if (mstring == "February"):41 mnumber = "02"42 if (mstring == "March"):43 mnumber = "03"44 if (mstring == "April"):45 mnumber = "04"46 if (mstring == "May"):47 mnumber = "05"48 if (mstring == "June"):49 mnumber = "06"50 if (mstring == "July"):51 mnumber = "07"52 if (mstring == "August"):53 mnumber = "08"54 if (mstring == "September"):55 mnumber = "09"56 if (mstring == "October"):57 mnumber = "10"58 if (mstring == "November"):59 mnumber = "11"60 if (mstring == "December"):61 mnumber = "12"62 return mnumber63def Capitalize(nstring):64 if(len(nstring) > 1 and not re.match("MC|Mc|Mac|MAC", nstring)): #O'|Van|VAN65 nstring = string.upper(nstring[0]) + string.lower(nstring[1:])66 if(re.match("MC|Mc|mc", nstring)):67 nstring = string.upper(nstring[0]) + string.lower(nstring[1]) + string.upper(nstring[2]) + string.lower(nstring[3:])68 if(re.match("MAC|Mac", nstring)):69 nstring = string.upper(nstring[0]) + string.lower(nstring[1:3]) + string.upper(nstring[3]) + string.lower(nstring[4:])70 if(re.match("MACY|Macy|MacY", nstring)):71 nstring = string.upper(nstring[0]) + string.lower(nstring[1]) + string.upper(nstring[2]) + string.lower(nstring[3:])72 if(re.match("Van\s|VAN\s", nstring)):73 nstring = string.upper(nstring[0]) + string.lower(nstring[1:4]) + string.upper(nstring[4]) + string.lower(nstring[5:])74 if(len(nstring) == 1):75 nstring = string.upper(nstring)76 return nstring77def lastname(nstring):78 last_name = ""79 nstring = re.sub(",", "", nstring)80 nstring = string.strip(nstring)81 nstring = re.sub("BY THE COURT", "", nstring)82 nstring = re.sub("PER CURIAM[;]*", "", nstring)83 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)84 names_holder = re.split("\s", nstring)85 if(len(names_holder) == 1):86 last_name = names_holder[0]87 if(len(names_holder) == 2): #and not re.search(",", nstring)):88 last_name = names_holder[1]89 if(len(names_holder) == 3 and not re.search(",", nstring)):90 last_name = names_holder[2]91 if(len(names_holder) == 3 and re.search(",", nstring)):92 last_name = names_holder[2]93 if(len(names_holder) == 4): #and not re.search(",", nstring)):94 last_name = names_holder[2] + " " + names_holder[3]95 if(len(names_holder) == 4 and re.search(",", nstring)):96 last_name = names_holder[0] + " " + names_holder[1]97 last_name = re.sub(",", "", last_name)98 last_name = re.sub("\.", "", last_name)99 last_name = Capitalize(last_name)100 return last_name101def firstname(nstring):102 first_name = ""103 nstring = nstring.strip()104 nstring = re.sub("BY THE COURT", "", nstring)105 nstring = re.sub("PER CURIAM[;]*", "", nstring)106 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)107 names_holder = re.split("\s", nstring)108 if(len(names_holder) == 2 and not re.search(",", nstring)):109 first_name = names_holder[0]110 if(len(names_holder) == 2 and re.search(",", nstring)):111 first_name = names_holder[1]112 if(len(names_holder) == 3 and not re.search(",", nstring)):113 first_name = names_holder[0]114 if(len(names_holder) == 3 and re.search(",", nstring)):115 first_name = names_holder[1]116 if(len(names_holder) == 4 and not re.search(",", nstring)):117 first_name = names_holder[0]118 if(len(names_holder) == 4 and re.search(",", nstring)):119 first_name = names_holder[2]120 first_name = re.sub(",", "", first_name)121 first_name = Capitalize(first_name)122 return first_name123def middlename(nstring):124 middle_name = ""125 nstring = string.strip(nstring)126 nstring = re.sub("BY THE COURT", "", nstring)127 nstring = re.sub("PER CURIAM[;]*", "", nstring)128 nstring = re.sub(", (Jr\.|JR\.|III|Sr\.|SR\.)", "", nstring)129 names_holder = re.split("\s", nstring)130 if(len(names_holder) == 3 and not re.search(",", nstring)):131 middle_name = names_holder[1]132 if(len(names_holder) == 3 and re.search(",", nstring)):133 middle_name = names_holder[2]134 if(len(names_holder) == 4 and not re.search(",", nstring)):135 middle_name = names_holder[1]136 if(len(names_holder) == 4 and re.search(",", nstring)):137 middle_name = names_holder[3]138 middle_name = re.sub(",", "", middle_name)139 middle_name = Capitalize(middle_name)140 return middle_name141def namesuffix(nstring):142 suffix = ""143 nstring = string.strip(nstring)144 nstring = re.sub("BY THE COURT", "", nstring)145 nstring = re.sub("PER CURIAM[;]*", "", nstring)146 if(re.search("Jr\.|JR\.", nstring)):147 suffix = "Jr."148 if(re.search("III", nstring)):149 suffix = "III"150 if(re.search("II", nstring)):151 suffix = "II"152 if(re.search("Sr\.|SR\.", nstring)):153 suffix = "Sr."154 return suffix155def first_sentence(value):156 """ Take just the first sentence of the HTML passed in.157 """158 words = value.split()159 # Collect words until the result is a sentence.160 sentence = ""161 while words:162 if sentence:163 sentence += " "164 sentence += words.pop(0)165 if not re.search(r'[.?!][)"]*$', sentence):166 # End of sentence doesn't end with punctuation.167 continue168 #if words and not re.search(r'^[("]*[A-Z0-9]', words[0]):169 # Next sentence has to start with upper case.170 continue171 if re.search(r'(Mr\.|Mrs\.|Ms\.|Dr\.| [A-Z]\.)$', sentence):172 # If the "sentence" ends with a title or initial, then it probably173 # isn't the end of the sentence.174 continue175 if sentence.count('(') != sentence.count(')'):176 # A sentence has to have balanced parens.177 continue178 if sentence.count('"') % 2:179 # A sentence has to have an even number of quotes.180 continue181 break182 return sentence183def state_ab(value):184 if(re.search("Alabama", value)):185 state_abbr = "AL"186 return state_abbr187 elif (re.search("Alaska", value)):188 state_abbr = "AK"189 return state_abbr190 elif (re.search("Arkansas", value)):191 state_abbr = "AR"192 return state_abbr193 elif (re.search("Arizona", value)):194 state_abbr = "AZ"195 return state_abbr196 elif (re.search("California", value)):197 state_abbr = "CA"198 return state_abbr199 elif (re.search("Colorado", value)):200 state_abbr = "CO"201 return state_abbr202 elif (re.search("Connecticut", value)):203 state_abbr = "CT"204 return state_abbr205 elif (re.search("Delaware", value)):206 state_abbr = "DE"207 return state_abbr208 elif (re.search("Florida", value)):209 state_abbr = "FL"210 return state_abbr211 elif (re.search("Georgia", value)):212 state_abbr = "GA"213 return state_abbr214 elif (re.search("Hawaii", value)):215 state_abbr = "HI"216 return state_abbr217 elif (re.search("Hawai'i", value)):218 state_abbr = "HI"219 return state_abbr220 elif (re.search("Idaho", value)):221 state_abbr = "ID"222 return state_abbr223 elif (re.search("Illinois", value)):224 state_abbr = "IL"225 return state_abbr226 elif (re.search("Indiana", value)):227 state_abbr = "IN"228 return state_abbr229 elif (re.search("Iowa", value)):230 state_abbr = "IA"231 return state_abbr232 elif (re.search("Kansas", value)):233 state_abbr = "KS"234 return state_abbr235 elif (re.search("Kentucky", value)):236 state_abbr = "KY"237 return state_abbr238 elif (re.search("Louisiana", value)):239 state_abbr = "LA"240 return state_abbr241 elif (re.search("Maine", value)):242 state_abbr = "ME"243 return state_abbr244 elif (re.search("Maryland", value)):245 state_abbr = "MD"246 return state_abbr247 elif (re.search("Massachusetts", value)):248 state_abbr = "MA"249 return state_abbr250 elif (re.search("Michigan", value)):251 state_abbr = "MI"252 return state_abbr253 elif (re.search("Minnesota", value)):254 state_abbr = "MN"255 return state_abbr256 elif (re.search("Mississippi", value)):257 state_abbr = "MS"258 return state_abbr259 elif (re.search("Missouri", value)):260 state_abbr = "MO"261 return state_abbr262 elif (re.search("Montana", value)):263 state_abbr = "MT"264 return state_abbr265 elif (re.search("Nebraska", value)):266 state_abbr = "NE"267 return state_abbr268 elif (re.search("Nevada", value)):269 state_abbr = "NV"270 return state_abbr271 elif (re.search("New Hampshire", value)):272 state_abbr = "NH"273 return state_abbr274 elif (re.search("New Jersey", value)):275 state_abbr = "NJ"276 return state_abbr277 elif (re.search("New Mexico", value)):278 state_abbr = "NM"279 return state_abbr280 elif (re.search("New York", value)):281 state_abbr = "NY"282 return state_abbr283 elif (re.search("North Carolina", value)):284 state_abbr = "NC"285 return state_abbr286 elif (re.search("North Dakota", value)):287 state_abbr = "ND"288 return state_abbr289 elif (re.search("Ohio", value)):290 state_abbr = "OH"291 return state_abbr292 elif (re.search("Supreme Court of Oklahoma", value)):293 state_abbr = "OK-SC"294 return state_abbr295 elif (re.search("Oregon", value)):296 state_abbr = "OR"297 return state_abbr298 elif (re.search("Pennsylvania", value)):299 state_abbr = "PA"300 return state_abbr301 elif (re.search("Rhode Island", value)):302 state_abbr = "RI"303 return state_abbr304 elif (re.search("South Carolina", value)):305 state_abbr = "SC"306 return state_abbr307 elif (re.search("Tennessee", value)):308 state_abbr = "TN"309 return state_abbr310 elif (re.search("Texas", value)):311 state_abbr = "TX-SC"312 return state_abbr313 elif (re.search("Utah", value)):314 state_abbr = "UT"315 return state_abbr316 elif (re.search("Vermont", value)):317 state_abbr = "VT"318 return state_abbr319 elif (re.search("Washington", value)):320 state_abbr = "WA"321 return state_abbr322 elif (re.search("West Virginia", value)):323 state_abbr = "WV"324 return state_abbr325 elif (re.search("Wisconsin", value)):326 state_abbr = "WI"327 return state_abbr328 elif (re.search("Wyoming", value)):329 state_abbr = "WY"330 return state_abbr331# .csv file where extracted metadata will be stored332fout = open(mydir + "mand_arb.csv", "wb")333outfilehandle = csv.writer(fout,334 delimiter=",",335 quotechar='"',336 quoting=csv.QUOTE_NONNUMERIC)337check = open(mydir + "check_recusals.csv", "wb")338recuse_handle = csv.writer(check,339 delimiter=",",340 quotechar='"',341 quoting=csv.QUOTE_NONNUMERIC)342master = open(mydir + "States_MasterFile_Import.csv", "rb")343# Create your own label for each column of the metadata .csv file344localrow = []345localrow.append("Email")346localrow.append("FirstName")347localrow.append("LastName")348localrow.append("court")349localrow.append("date")350localrow.append("state")351localrow.append("panel_state")352localrow.append("parties")353localrow.append("docket")354localrow.append("citestring")355localrow.append("LexisCite")356localrow.append("WestLaw")357localrow.append("attorneys")358localrow.append("judges")359localrow.append("judgeNP")360localrow.append("Judge1_Last_Name")361localrow.append("Judge1_Vote")362localrow.append("Judge1_code")363localrow.append("Judge2_Last_Name")364localrow.append("Judge2_Vote")365localrow.append("Judge2_code")366localrow.append("Judge3_Last_Name")367localrow.append("Judge3_Vote")368localrow.append("Judge3_code")369localrow.append("Judge4_Last_Name")370localrow.append("Judge4_Vote")371localrow.append("Judge4_code")372localrow.append("Judge5_Last_Name")373localrow.append("Judge5_Vote")374localrow.append("Judge5_code")375localrow.append("Judge6_Last_Name")376localrow.append("Judge6_Vote")377localrow.append("Judge6_code")378localrow.append("Judge7_Last_Name")379localrow.append("Judge7_Vote")380localrow.append("Judge7_code")381localrow.append("Judge8_Last_Name")382localrow.append("Judge8_Vote")383localrow.append("Judge8_code")384localrow.append("Judge9_Last_Name")385localrow.append("Judge9_Vote")386localrow.append("Judge9_code")387localrow.append("Judge10_Last_Name")388localrow.append("Judge10_Vote")389localrow.append("Judge10_code")390localrow.append("Judge11_Last_Name")391localrow.append("Judge11_Vote")392localrow.append("Judge11_code")393localrow.append("dissent")394localrow.append("dissent_no")395localrow.append("dissent_name")396localrow.append("dissent_1")397localrow.append("dissent_2")398localrow.append("dissent_3")399localrow.append("dissent_4")400localrow.append("dissent_5")401localrow.append("concurrence")402localrow.append("concur_no")403localrow.append("concur_name")404localrow.append("check")405outfilehandle.writerow(localrow)406recuse_handle.writerow(localrow)407# Name of folder where all cases are located (and nothing else)408dirname = mydir + "mandArb/"409dirlist = os.listdir(dirname)410cleandirlist = []411for entry in dirlist:412 matchresult = re.match('.+\\.txt$', entry)413 if matchresult != None:414 cleandirlist.append(matchresult.group())415#dirlist = [file for file in dirlist if len(file) > 20]416# Use (uncomment) following line to test code on a small handful of cases417#cleandirlist = cleandirlist[838:872]418for entry in cleandirlist: ## each entry is a txt file with an opinion 0:1025419 # initialize all variables to be used420 infilepath = dirname + entry421 infilehandle = open(infilepath)422 txtlines = infilehandle.readlines()423 action_number = 0424 case_with_preamble = False425 searchterms_line = False426 blank_after_searchterms = False427 parties_line = False428 blank_after_parties = False429 docket_line = False430 blank_after_docket = False431 court_line = False432 blank_after_court = False433 fn_line = False434 cite_line = False435 blank_after_cite = False436 action_line = False437 disposition_line = False438 prior_history_line = False439 headnotes_line = False440 trunc_text = False441 judges_line = False442 opin_by_line = False443 opinion_line = False444 dissent_by_line = False445 concur_by_line = False446 blank_after_appellant_attorney = False447 jud_dissent = 0448 opinion_word_count = 0449 amicus = 0450 localrow = []451 action_number = 0452 judges_part_string = ""453 searchterms_string = ""454 shep_treat = ""455 parties_string = ""456 docketnum = ""457 court_string = ""458 cite_string = ""459 Fed_cite = ""460 Lexis_cite = ""461 West_cite = ""462 action_string = ""463 per_curiam = 0464 unanimous = 0465 action1 = ""466 date = ""467 action1_month = ""468 action1_day = ""469 action1_year = ""470 action1_date = ""471 action1_action = ""472 action2 = ""473 action2_month = ""474 action2_day = ""475 action2_year = ""476 action2_date = ""477 action2_action = ""478 prior_history_string = ""479 sub_history_string = ""480 disposition_string = ""481 pubdef = 0482 prose = 0483 attorney_string = ""484 pc_holder = ""485 judges_string = ""486 judge1_ln = ""487 judge1_fn = ""488 judge1_mn = ""489 judge1_suf = ""490 judge1_full = ""491 judge2_ln = ""492 judge2_fn = ""493 judge2_mn = ""494 judge2_suf = ""495 judge2_full = ""496 judge3_ln = ""497 judge3_fn = ""498 judge3_mn = ""499 judge3_suf = ""500 judge3_full = ""501 judge4_ln = ""502 judge4_fn = ""503 judge4_mn = ""504 judge4_suf = ""505 judge4_full = ""506 judge5_ln = ""507 judge5_fn = ""508 judge5_mn = ""509 judge5_suf = ""510 judge5_full = ""511 judge6_ln = ""512 judge6_fn = ""513 judge6_mn = ""514 judge6_suf = ""515 judge6_full = ""516 judge7_ln = ""517 judge7_fn = ""518 judge7_mn = ""519 judge7_suf = ""520 judge7_full = ""521 judge8_ln = ""522 judge8_fn = ""523 judge8_mn = ""524 judge8_suf = ""525 judge8_full = ""526 judge9_ln = ""527 judge9_fn = ""528 judge9_mn = ""529 judge9_suf = ""530 judge9_full = ""531 judge10_ln = ""532 judge10_fn = ""533 judge10_mn = ""534 judge10_suf = ""535 judge10_full = ""536 judge11_ln = ""537 judge11_fn = ""538 judge11_mn = ""539 judge11_suf = ""540 judge11_full = ""541 opin_by_string = ""542 author_ln = ""543 author_fn = ""544 author_mn = ""545 author_suf = ""546 author_full = ""547 dissent1_ln = ""548 dissent1_fn = ""549 dissent1_mn = ""550 dissent1_suf = ""551 dissent1_full = ""552 dissent2_ln = ""553 dissent2_fn = ""554 dissent2_mn = ""555 dissent2_suf = ""556 dissent2_full = ""557 dissent3_ln = ""558 dissent3_fn = ""559 dissent3_mn = ""560 dissent3_suf = ""561 dissent3_full = ""562 dissent4_ln = ""563 dissent4_fn = ""564 dissent4_mn = ""565 dissent4_suf = ""566 dissent4_full = ""567 dissent5_ln = ""568 dissent5_fn = ""569 dissent5_mn = ""570 dissent5_suf = ""571 dissent5_full = ""572 concur1_ln = ""573 concur1_fn = ""574 concur1_mn = ""575 concur1_suf = ""576 concur1_full = ""577 concur2_ln = ""578 concur2_fn = ""579 concur2_mn = ""580 concur2_suf = ""581 concur2_full = ""582 concur3_ln = ""583 concur3_fn = ""584 concur3_mn = ""585 concur3_suf = ""586 concur3_full = ""587 concur4_ln = ""588 concur4_fn = ""589 concur4_mn = ""590 concur4_suf = ""591 concur4_full = ""592 concur5_ln = ""593 concur5_fn = ""594 concur5_mn = ""595 concur5_suf = ""596 concur5_full = ""597 concur6_ln = ""598 concur6_fn = ""599 concur6_mn = ""600 concur6_suf = ""601 concur6_full = ""602 concur7_ln = ""603 concur7_fn = ""604 concur7_mn = ""605 concur7_suf = ""606 concur7_full = ""607 concur_by_string = ""608 dissent_by_string = ""609 no_part_list = [] ####610 no_part_string = "" ####611 full_judges_holder = []612 judges_holder = []613 dissent_holder = []614 concur_holder = []615 no_part = False616 no_part_dich = 0617 shep_line = False618 blank_after_shep = False619 court_line = False620 blank_after_court = False621 cite_line = False622 blank_after_cite = False623 action_line = False624 disposition_line = False625 prior_history_line = False626 headnotes_line = False627 sub_history_line = False628 judges_line = False629 attorney_line = False630 #appellee_attorney_line = False631 opin_by_line = False632 opinion_line = False633 dissent_by_line = False634 concur_by_line = False635 dissent_author_1 = ""636 dissent_author_2 = ""637 dissent_author_3 = ""638 dissent_author_4 = ""639 dissent_author_5 = ""640 opinion_word_count = 0641 circuit = 0642 en_banc = ""643 dissent = 0644 concur = 0645 rehearing = ""646 check_case = 0647 op_string = ""648 unpublished = 0649 num_dissent = 0650 num_concur = 0651 unwritten_dissent = 0652 firstcite_line = False653 firstcite_string = ""654 blank_after_firstcite = False655 caseid = str(re.split("\.", entry)[0])656 print "\n" + entry657 pet_str = ""658 res_str = ""659 opinion_start = False660 dissent_line = False661 concur_line = False662 blank_after_action = False663 line_before_first = False664 judge1_vote = ""665 judge2_vote = ""666 judge3_vote = ""667 judge4_vote = ""668 judge5_vote = ""669 judge6_vote = ""670 judge7_vote = ""671 judge8_vote = ""672 judge9_vote = ""673 judge10_vote = ""674 judge11_vote = ""675 panel = 0676 judges_np = ""677 state_abbr = ""678 judge_np_list = []679 judge_np1 = ""680 judge_np2 = ""681 judge_np3 = ""682 judge_np4 = ""683 other_dissent_string = ""684 other_dissent_judges = []685 silent_dissent = False686 silent_judge1 = ""687 silent_judge2 = ""688 silent_judge3 = ""689 silent_judge4 = ""690 silent_judge5 = ""691 first_dissent = False692 other_dissent = ""693 new_date = ""694 date_bool = False695 between = False696 non_panel_judge_string = ""697 other_dissent_holder = []698 part_judges = ""699 judge1_code = ""700 judge2_code = ""701 judge3_code = ""702 judge4_code = ""703 judge5_code = ""704 judge6_code = ""705 judge7_code = ""706 judge8_code = ""707 judge9_code = ""708 judge10_code = ""709 judge11_code = ""710 one_month = datetime.timedelta(365*3) #/12711 judges_AL = []712 MD_date = False713 dock = False714 docket = False715 check_recuse = False716 check_recuse_case = 0717 # each txtline is one "line" in the text file: the end of a line is determined by \n718 for txtline in txtlines:719 # proceeding logic of script based on boolean operators causes all text prior to the line beginning with "Copy Citation" to be ignored720 if (re.search("^Copy Citation",txtline)):721 line_before_first = True722 if (line_before_first and re.search("(COURT|Court)", txtline) and not re.search("^1 ", txtline)):723 ## the court in which the case was heard724 line_before_first = False725 court_line = True726 court_string = court_string + txtline727 court_string = court_string.strip()728 print court_string729 state_abbr = state_ab(court_string) ###function to return state abbreviations730 if (re.search("Alabama|Arizona|Connecticut|Delaware|Florida|Idaho|Massachusetts|Mississippi|Montana|Nevada|New Hampshire|Virginia", court_string)):731 # all cases in states that hear cases in panels are given a value of 1732 panel = 1733 if re.search("West Virginia", court_string):734 # the prior if statement matches "Virginia" in "West Virginia"; this corrects the incorrect panel assignment value735 panel = 0736 if(court_line and re.search("Jan|Feb|Mar|Apr|May|June|July|Aug|Sep|Oct|Nov|Dec|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC", txtline)) and state_abbr != "MD" and not re.search("Argued$", txtline): #re.match("^[\s]+$", txtline)):737 ## this is the blank line after court738 # stores date and action of court (i.e. Decided, Released, Filed)739 blank_after_firstcite = False740 court_line = False741 blank_after_court = True742 #print txtline743 action_line = True744 if (len(action_string) < 1):745 action_string = action_string + txtline746 dock = True747 if len(action_string) < 2:748 MD_date = True749 if state_abbr == "MD" and re.match("Jan|Feb|Mar|Apr|May|June|July|Aug|Sep|Oct|Nov|Dec", txtline) and MD_date == True:750 action_string = txtline751 MD_date = False752 blank_after_firstcite = False753 court_line = False754 blank_after_court = True755 #print txtline756 action_line = True757 if(action_line): #and re.match("^[\s]+$", txtline)):758 # parse out unnecessary text from action string (Date and Procedural Documentation of Publication) for only the date to remain759 blank_after_court = False760 blank_after_action = True761 action_line = False762 if re.search("Argued; ;", action_string):763 action_string = action_string.split("Argued; ;", 1)[1]764 if re.search("Argued ;", action_string):765 action_string = action_string.split("Argued ;", 1)[1]766 if re.search("Argued;", action_string):767 action_string = action_string.split("Argued;", 1)[1]768 if re.search("Argued and submitted ;", action_string):769 action_string = action_string.split("Argued and submitted ;", 1)[1]770 if re.search("Argued and submitted;", action_string):771 action_string = action_string.split("Argued and submitted;", 1)[1]772 if re.search("Submitted ;", action_string):773 action_string = action_string.split("Submitted ;", 1)[1]774 if re.search("Submitted;", action_string):775 action_string = action_string.split("Submitted;", 1)[1]776 if re.search("Submitted on Briefs ;", action_string):777 action_string = action_string.split("Submitted on Briefs ;", 1)[1]778 if re.search("Submitted on Briefs;", action_string):779 action_string = action_string.split("Submitted on Briefs;", 1)[1]780 if re.search("Heard in the Supreme Court ;", action_string):781 action_string = action_string.split("Heard in the Supreme Court ;", 1)[1]782 if re.search("Heard in the Supreme Court;", action_string):783 action_string = action_string.split("Heard in the Supreme Court;", 1)[1]784 if re.search("Heard ;", action_string):785 action_string = action_string.split("Heard ;", 1)[1]786 if re.search("Heard;", action_string):787 action_string = action_string.split("Heard;", 1)[1]788 if re.search("Session;", action_string):789 action_string = action_string.split("Session;", 1)[1]790 if re.search("Session ;", action_string):791 action_string = action_string.split("Session ;", 1)[1]792 if re.search("Argument ;", action_string):793 action_string = action_string.split("Argument ;", 1)[1]794 if re.search("Argument;", action_string):795 action_string = action_string.split("Argument;", 1)[1]796 print action_string797 action_string = expandmonth(action_string)798 action_string = re.sub(":", ",", action_string)799 action_string = re.sub(";", ",", action_string)800 action_string = re.sub("\*", "", action_string)801 action_string = re.sub("Argued and Submitted ", "Argued and Submitted, ", action_string)802 action_string = re.sub("Argued ", "Argued, ", action_string)803 action_string = re.sub(", Decided ", "", action_string)804 action_string = re.sub("Supplemental Briefing Submitted ", "Supplemental Briefing Submitted, ", action_string)805 action_string = re.sub(", Released", "", action_string)806 action_string = re.sub(", RELEASED", "", action_string)807 action_string = re.sub(", Filed", "", action_string)808 action_string = re.sub("Submitted Under Third Circuit Rule 12\(6\) ", "Submitted Under Third Circuit Rule 12(6), ", action_string)809 action_string = re.sub("Cause argued ", "Cause argued, ", action_string)810 split_action = re.split("\n", action_string)811 action1 = string.strip(split_action[0])812 action2 = string.strip(split_action[1])813 action2 = re.split(", ", action2)814 action1 = re.split(", ", action1)815 if(len(split_action) < 2):816 action1[1] = re.sub("\.", "", action1[1])817 action1[1] = re.sub(",", "", action1[1])818 action1[0] = re.sub("Argued ", "", action1[0])819 action1[0] = re.sub("Submitted ", "", action1[0])820 date = date + action1[0] + ", " + action1[1]821 if(len(action1) > 2 and len(date) == 0 and re.search("Decided|DECIDED", action1[2])):822 date = date + action1[0] + ", " + action1[1]823 if(len(action1) > 2 and len(date) == 0 and re.search("Filed|FILED", action1[2])):824 date = date + action1[0] + ", " + action1[1]825 if(len(action2) > 2 and len(date) == 0 and re.search("Decided|DECIDED", action2[2])):826 date = date + action2[0] + ", " + action2[1]827 if(len(action2) > 2 and len(date) == 0 and re.search("Filed|FILED", action2[2])):828 date = date + action2[0] + ", " + action2[1]829 if(len(action2) > 1 and len(date)==0):830 date = date + action2[0] + ", " + action2[1]831 date = re.sub(",$", "", date)832 date = re.sub("\*", "", date)833 date = re.sub("\.", "", date)834 if(len(action2) > 1 and len(date)==0):835 date = date + action2[0] + ", " + action2[1]836 date = re.sub(",$", "", date)837 date = re.sub("\.", "", date)838 action_string = string.strip(action_string)839 action_string = re.sub("[\s]+", " ", action_string)840 action_string = re.sub("Decided|decided|DECIDED", " ", action_string)841 action_string = re.sub("Filed|filed|FILED", " ", action_string)842 # one case has incorrect formatting of the date and it causes the program to break when calling teh strptime function843 if action_string == "December 22 1995":844 action_string = "December 22, 1995"845 # Dates from Maryland cases do not parse correctly846 if action_string != "Court of Appeals of Maryland":847 x = re.search("\d{4}", action_string)848 # store in x the position of the last digit of the year849 x = x.end()850 if new_date == "":851 date_bool = True852 if(x != -1 and date_bool):853 new_date = action_string[:x]854 date_bool = False855 if(x == -1):856 new_date = action_string857 if state_abbr != "MC":858 # format dates so they match the format from the state judge master file859 new_date = re.sub("April,", "April", new_date)860 new_date = re.sub("On ", "", new_date)861 date_format = datetime.datetime.strptime(new_date, '%B %d, %Y').date()862 elif state_abbr == "MC":863 date_format = datetime.datetime.strptime('1/1/1800', '%m/%d/%Y').date()864 # match state abbrevation and date decided from case and state master file to produce a list of judges who were on the bench at time of decision for cases heard in non-panel state865 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:866 reader = csv.reader(f)867 next(f)868 for row in reader:869 state = row[0]870 name = row[3]871 if len(row[4]) == 4 and row[0] != "MC":872 row[4] = "1/1/" + row[4]873 if len(row[5]) == 4 and row[0] != "MC": #and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL"))) and len(judge6_ln) > 2 and len(judge9_ln) < 2:874 row[5] = "1/1/" + row[5]875 #print state_abbr876 if len(row[4]) != 4 and row[0] != "MC" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH"))) and ((len(judge6_ln) > 2 or len(judge3_ln) < 2) and len(judge9_ln) < 2) and state_abbr:877 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()878 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date()879 if ((panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and state_abbr != "AK" and (len(judge6_ln) > 2) and len(judge9_ln) < 2)) and start <= date_format <= end):880 between = True881 #print state_abbr882 if ((state == state_abbr) and between and row[0] != "MC" and row[2] == 0 and state_abbr != "AK" and (panel == 0 or (state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH")) and (len(judge6_ln) > 2 or len(judge3_ln) < 2) and len(judge9_ln) < 2):883 if non_panel_judge_string == "":884 non_panel_judge_string = non_panel_judge_string + row[3]885 else:886 non_panel_judge_string = non_panel_judge_string + ", " + row[3]887 if row[3] == judge1_ln:888 judge1_code = row[1]889 between = False890 #judges_string = judges_string + ", " + non_panel_judge_string891 non_panel_list = non_panel_judge_string.split(",")892 non_panel_list.sort()893 master.close()894 if (docketnum == "") or not re.search("[0-9]", docketnum):895 if(not re.search("LEXIS", txtline) and re.search("^([\d]+$|Docket|Misc|No\.|Nos\.|SC |File Nos. |File No. |Arizona Supreme Court No. |L. A. Nos. |SCWC-|Cause No. |Supreme Court Cause Number |S[\d][\d]|A[\d][\d]|S. Ct. NO. |[\d] Div. |CASE NO.:|L.A. No. |\[NO NUMBER|\[No number in original|[\w]-|Supreme Court Case |Supreme Court No. |Supreme Court No. |Supreme Court Case No. |Law Docket No. |SUPREME COURT DOCKET NO. |Record No. |SUPREME COURT DOCKET NO. |Sac. No. |\([\d]+\)|\(SC |NO|C\.A\.|\# [\d]|[\d][\d][\d][\d]-|SJC-|Decision No. |DA |CA |[\d][\d]-|91-|Opinion No\.|DOCKET|Case No|[\d][\d][\d][\d][\d][\d][\d], [\d][\d][\d][\d][\d][\d][\d]|S[\d][\d][\d][\d][\d][\d]|Yor-[\d][\d]|Cum-[\d][\d]|C[\d]-[\d]|Case Number:|S.C. No. |NO.|Appeal No. |Supreme Court Nos. |S.F. No. |SCCQ-[\d]|[\d][\d][\d][\d][\d]-|Indiana Supreme Court Cause No. |[\d]|[\d][\d][\d][\d][\d][\d][\d])", txtline) and not re.search("Supreme Court of Pennsylvania",txtline) and not re.search("Supreme Court of Delaware",txtline) and not re.search("Court of Appeals of New York",txtline) and not re.search("^1. ",txtline) and not re.search("^2. ",txtline) and not re.search("^3. ",txtline) and not re.search("^4. ",txtline) and not re.search("^5. ",txtline)):896 ## the docket number897 docket_line = True898 action_line = False899 blank_after_action = True900 docketnum = docketnum + txtline901 ##OLDER PA (and some DE) CASES DON'T HAVE DOCKETS. THIS FIXES THE ISSUE902 elif(blank_after_action and not re.search("^([\d]+$|Docket|Misc|No\.|Nos\.|SC |File Nos. |File No. |Arizona Supreme Court No. |L. A. Nos. |SCWC-|Cause No. |Supreme Court Cause Number |S[\d][\d]|A[\d][\d]|S. Ct. NO. |[\d] Div. |CASE NO.:|L.A. No. |\[NO NUMBER|\[No number in original|[\w]-|Supreme Court Case |Supreme Court No. |Supreme Court No. |Supreme Court Case No. |Law Docket No. |SUPREME COURT DOCKET NO. |Record No. |SUPREME COURT DOCKET NO. |Sac. No. |\([\d]+\)|\(SC |NO|C\.A\.|\# [\d]|[\d][\d][\d][\d]-|SJC-|Decision No. |DA |CA |[\d][\d]-|91-|Opinion No\.|DOCKET|Case No|[\d][\d][\d][\d][\d][\d][\d], [\d][\d][\d][\d][\d][\d][\d]|S[\d][\d][\d][\d][\d][\d]|Yor-[\d][\d]|Cum-[\d][\d]|C[\d]-[\d]|Case Number:|S.C. No. |NO.|Appeal No. |Supreme Court Nos. |S.F. No. |SCCQ-[\d]|[\d][\d][\d][\d][\d]-|Indiana Supreme Court Cause No. |[\d]|[\d][\d][\d][\d][\d][\d].)", txtline) and re.search("Supreme Court of Pennsylvania",txtline) or re.search("Supreme Court of Delaware",txtline) or re.search("Court of Appeals of New York",txtline)):903 ## the docket number904 docketnum = docketnum + txtline905 docket_line = True906 action_line = False907 blank_after_docket = True908 if(re.match("^Reporter", txtline) and not opinion_start):909 ## this is the "Reporter" line after docket number910 blank_after_action = False911 docket_line = False912 blank_after_docket = True913 if(re.search(" > ", docketnum)):914 docketnum = ""915 # Store all citations listed by Lexis916 if((blank_after_docket) and re.search("LEXIS", txtline) and re.search("[\w]+", txtline) and not opinion_start):917 ## the citation block918 cite_line = True919 cite_string = cite_string + txtline920 cite_string = re.sub("[\s]+", " ", cite_string)921 cite_string = re.sub("[\*]+", "", cite_string)922 cite_string = re.sub("\xc2", "", cite_string)923 cite_string = re.sub("\xa0", "", cite_string)924 West_cite = cite_string.split("|")[0]925 #print West_cite926 if(cite_line and re.match("^[\s]+$", txtline)):927 ## done with citation block928 blank_after_docket = False929 cite_line = False930 blank_after_cite = True931 all_cites = re.split(" [\|] ", cite_string)932 ####print all_cites933 ##Fed_cite = [cite for cite in all_cites if re.search("[\s]F\.(2|3)d", cite)]934 Lexis_cite = [cite for cite in all_cites if re.search("LEXIS", cite)]935 try:936 ## Fed_cite = string.strip(Fed_cite[0])937 Lexis_cite = string.strip(Lexis_cite[0])938 except:939 print "Problem with citation"940 if(blank_after_cite and re.match("[\w]+", txtline)):941 ## the parties942 parties_line = True943 parties_string = parties_string + txtline944 #print txtline.replace("\n", "")945 # Store names of parties to the case946 if (parties_line and re.match("^[\s]+$", txtline)):947 ## done with parties block948 blank_after_cite = False949 parties_line = False950 blank_after_parties = True951 parties_string = re.sub("[\s]+", " ", parties_string)952 # Store text in Prior and Subsequent History lines953 if(re.match("^Subsequent History:", txtline)):954 sub_history_line = True955 parties_line = False956 if(sub_history_line and re.search("[\w]+", txtline)):957 sub_history_string = sub_history_string + txtline958 if (prior_history_line and re.match("^[\s]+$", txtline)):959 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)960 prior_history_string = re.sub("Prior History:", "", prior_history_string)961 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)962 prior_history_string = re.sub("\xa0", " ", prior_history_string)963 prior_history_string = re.sub("\n|\r", " ", prior_history_string)964 prior_history_string = string.strip(prior_history_string)965 sub_history_line = False966 if(re.match("^Prior History:", txtline)):967 prior_history_line = True968 parties_line = False969 if(prior_history_line and re.search("[\w]+", txtline)):970 prior_history_string = prior_history_string + txtline971 if (prior_history_line and re.match("^[\s]+$", txtline)):972 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)973 prior_history_string = re.sub("Prior History:", "", prior_history_string)974 prior_history_string = re.sub("Procedural Posture:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)975 prior_history_string = re.sub("Procedural Posture:", "", prior_history_string)976 prior_history_string = re.sub("\xa0", " ", prior_history_string)977 prior_history_string = re.sub("\n|\r", " ", prior_history_string)978 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)979 prior_history_string = string.strip(prior_history_string)980 prior_history_line = False981 if(re.match("^Procedural Posture:", txtline) and prior_history_string == ""):982 prior_history_line = True983 parties_line = False984 if(prior_history_line and re.search("[\w]+", txtline)):985 prior_history_string = prior_history_string + txtline986 if (prior_history_line and re.match("^[\s]+$", txtline)):987 prior_history_string = re.sub("Prior History:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)988 prior_history_string = re.sub("Prior History:", "", prior_history_string)989 prior_history_string = re.sub("Procedural Posture:\s+\[\*+[0-9]+\]\s+", "", prior_history_string)990 prior_history_string = re.sub("Procedural Posture:", "", prior_history_string)991 prior_history_string = re.sub("\xa0", " ", prior_history_string)992 prior_history_string = re.sub("\n|\r", " ", prior_history_string)993 prior_history_string = re.sub("\[\**\d*\]", "", prior_history_string)994 prior_history_string = string.strip(prior_history_string)995 prior_history_line = False996 ###RKH USES OUTCOME instead of DISPOSITION because not every case has a DISPOSITION997 if (re.match("^Disposition:", txtline) and disposition_string == ""):998 ## disposition of case999 disposition_line = True1000 #print disposition_string1001 if (disposition_line and re.search("[\w]+", txtline)):1002 ## disposition lines with text1003 disposition_string = disposition_string + txtline1004 #print disposition_string1005 if (disposition_line and re.match("^[\s]+$", txtline)):1006 ## blank line after disposition line1007 disposition_string = re.sub("Disposition:", "", disposition_string)1008 disposition_string = re.sub("Outcome:", "", disposition_string)1009 disposition_string = re.sub("\xa0", " ", disposition_string)1010 disposition_string = re.sub("\n|\r", " ", disposition_string)1011 disposition_string = re.sub("\[.+\]", "", disposition_string)1012 disposition_string = string.strip(disposition_string)1013 #print disposition_string1014 disposition_line = False1015 # Store outcome of case1016 if (re.match("^Outcome:", txtline)):1017 ## disposition of case1018 disposition_line = True1019 #print disposition_string1020 if (disposition_line and re.search("[\w]+", txtline)):1021 ## disposition lines with text1022 disposition_string = disposition_string + txtline1023 #print disposition_string1024 if (disposition_line and re.match("^[\s]+$", txtline)):1025 ## blank line after disposition line1026 disposition_string = re.sub("Outcome:", "", disposition_string)1027 disposition_string = re.sub("Disposition:", "", disposition_string)1028 disposition_string = re.sub("\xa0", " ", disposition_string)1029 disposition_string = re.sub("\n|\r", " ", disposition_string)1030 disposition_string = re.sub("\[.+\]", "", disposition_string)1031 disposition_string = re.sub("\[\**\d*\]", "", disposition_string)1032 disposition_string = string.strip(disposition_string)1033 #print disposition_string1034 disposition_line = False1035 # Search for presence of Per Curiam opinion1036 if re.search("^Opinion", txtline):1037 first_dissent = True1038 if (re.search("Opinion By: (PER CURIAM)|(Per Curiam)", txtline)):1039 #pc_holder = pc_holder + "Per Curiam. "1040 per_curiam = 11041 if (re.search("PER CURIAM", txtline)):1042 #pc_holder = pc_holder + "Per Curiam. "1043 per_curiam = per_curiam + 11044 if (re.search("^[\s]*Per Curiam[\.:\s]*$", txtline)):1045 per_curiam = 11046 #print pc_holder + "\n"1047 # Search for judges that join in dissenting opinions but are not listed as such in the judge line1048 if((first_dissent == True and re.search("dissents\.$|dissent\.$|dissenting\.$", txtline) and len(txtline) < 100 and not re.search("I respectfully dissent\.|I dissent\.|I therefore respectfully dissent\.", txtline)) or (re.search("joined\.$", txtline) and re.search("dissent", txtline))):1049 #print repr(txtline)1050 first_dissent = False1051 other_dissent = re.sub(" and", ",", txtline)1052 other_dissent = re.sub("filed a dissenting opinion", "", other_dissent)1053 other_dissent = re.sub("delivered the Opinion of the Court", "", other_dissent)1054 other_dissent = re.sub("All the Justices concur", "", other_dissent)1055 other_dissent = re.sub("\[\**\d\]", "", other_dissent)1056 other_dissent = re.sub("C\.J\.", "", other_dissent)1057 other_dissent = re.sub(" C\.", "", other_dissent)1058 other_dissent = re.sub("\[\*\*[0-9]+\]", "", other_dissent)1059 other_dissent = re.sub("For those reasons", "", other_dissent)1060 other_dissent = re.sub("dissenting", "", other_dissent)1061 other_dissent = re.sub("dissents\.|dissent\.|dissents|dissent", "", other_dissent)1062 other_dissent = re.sub("J\.;", "", other_dissent)1063 other_dissent = re.sub("C\.J\.|JJ\.|J\.J\.|J\.|C\. J\.", "", other_dissent)1064 #print other_dissent1065 if re.search("deliver", other_dissent):1066 other_dissent = other_dissent.split(".", 1)[1]1067 if re.search("filed a concurring opinion", other_dissent):1068 other_dissent = other_dissent.split(".", 1)[1]1069 #print other_dissent1070 other_dissent = re.sub("joined\.|joined|joins|join|JOINS|JOIN", "", other_dissent)1071 other_dissent = re.sub("in the|IN THE", "", other_dissent)1072 other_dissent = re.sub("in this", "", other_dissent)1073 other_dissent = re.sub("in which", "", other_dissent)1074 other_dissent = re.sub("Special Justice", "", other_dissent)1075 other_dissent = re.sub("JUSTICES|Justices|justices|JUSTICE|Justice|justice", "", other_dissent)1076 other_dissent = re.sub("\xc2", "", other_dissent)1077 other_dissent = re.sub("CHIEF|Chief|chief", "", other_dissent)1078 other_dissent = re.sub("Order affirmed, with costs", "", other_dissent)1079 other_dissent = re.sub("Opinion by|opinion by|OPINION BY", "", other_dissent)1080 other_dissent = re.sub("Judges|judges|JUDGES|judge|Judge|JUDGE", "", other_dissent)1081 other_dissent = re.sub("concurs|CONCURS|concur|CONCUR", "", other_dissent)1082 other_dissent = re.sub("\xa0", "", other_dissent)1083 other_dissent = re.sub("In Part", "", other_dissent)1084 other_dissent = re.sub("in part\.", "", other_dissent)1085 other_dissent = re.sub("in part", "", other_dissent)1086 other_dissent = re.sub("\[\*\*\*[\w]+\]", "", other_dissent)1087 other_dissent = re.sub("I respectfully", "", other_dissent)1088 other_dissent = re.sub("respectfully|RESPECTFULLY|Respectfully", "", other_dissent)1089 #other_dissent = re.sub("")1090# other_dissent = re.sub("\s", "", other_dissent)1091 other_dissent = re.sub("this", "", other_dissent)1092 other_dissent = re.sub("with whom", "", other_dissent)1093 other_dissent = re.sub("except", "", other_dissent)1094 other_dissent = re.sub(" who", "", other_dissent)1095 other_dissent = re.sub("reversed|REVERSED|reverse|REVERSE", "", other_dissent)1096 other_dissent = re.sub("authorizes me to state", "", other_dissent)1097 other_dissent = re.sub("that she", "", other_dissent)1098 other_dissent = re.sub("the views expressed", "", other_dissent)1099 other_dissent = re.sub("foregoing", "", other_dissent)1100 other_dissent = re.sub(" JR\.| JR", "", other_dissent)1101 other_dissent = re.sub(" SR\.| SR", "", other_dissent)1102 other_dissent = re.sub("specially|Specially|SPECIALLY", "", other_dissent)1103 other_dissent = re.sub("Order affirmed, with costs", "", other_dissent)1104 other_dissent = re.sub("affirmed|AFFIRMED", "", other_dissent)1105 other_dissent = re.sub("reason|reasons", "", other_dissent)1106 other_dissent = re.sub("'", "", other_dissent)1107 other_dissent = re.sub("Justice", "", other_dissent)1108 other_dissent = re.sub("filed an opinion", "", other_dissent)1109 other_dissent = re.sub("concurring in part", "", other_dissent)1110 other_dissent = re.sub("Part I", "", other_dissent)1111 other_dissent = re.sub("in part", "", other_dissent)1112 other_dissent = re.sub("Part|part", "", other_dissent)1113 dissent = 11114 other_dissent_holder = other_dissent.split(",")1115 other_dissent_holder = filter(None, other_dissent_holder)1116 if (re.search("^<truncate>", txtline)):1117 trunc_text = True1118 if (re.search("^</truncate>", txtline)):1119 trunc_text = False1120 if (re.match("^Counsel:", txtline) and not opinion_line):1121 attorney_line = True1122 # Store attorneys for appellee and appellant1123 if (attorney_line and re.search("^Judges|^Opinion", txtline) and not opinion_start and not re.search("^Opinion No.",txtline)):1124 attorney_line = False1125 attorney_string = re.sub("Counsel:\[\**\d*\]", "", attorney_string)1126 attorney_string = re.sub("Counsel:", "", attorney_string)1127 attorney_string = re.sub("\[\**\d*\]", "", attorney_string)1128 attorney_string = re.sub("\xa0", " ", attorney_string)1129 attorney_string = re.sub("\xc2", " ", attorney_string)1130 attorney_string = re.sub("\n|\r", " ", attorney_string)1131 attorney_string = string.strip(attorney_string)1132 attorney_line = False1133 if(attorney_line):1134 attorney_string = attorney_string + txtline1135 attorney_string = re.sub("Counsel:\[\**\d*\]", "", attorney_string)1136 attorney_string = re.sub("Counsel:", "", attorney_string)1137 attorney_string = re.sub("\[\**\d*\]", "", attorney_string)1138 attorney_string = re.sub("\xa0", " ", attorney_string)1139 attorney_string = re.sub("\xc2", " ", attorney_string)1140 attorney_string = re.sub("\n|\r", " ", attorney_string)1141 attorney_string = string.strip(attorney_string)1142 attorney_line = False1143 if (re.search("Public|public|PUBLIC|defender|DEFENDER|Defender", attorney_string)):1144 pubdef = 11145 if (re.search("(pro se)|(Pro se)|(Pro Se)|(pro Se)", attorney_string)):1146 prose = 11147 if (re.match("^Judges:", txtline) and not trunc_text):1148 ## judges hearing case1149 judges_line = True1150 if (judges_line and re.search("[\w]+", txtline)):1151 ## judges lines with text1152 judges_string = judges_string + txtline #+ ", " + non_panel_judge_string1153 if (judges_line and re.match("^[\s]+$", txtline)):1154 # new line or some whitespace after judges line1155 # Store and parse text of judges that recused themselves from the case1156 if (re.search("((N|n)ot (P|p)articipat(e|ing)|(R|r)ecus(e|es|ed)|RECUSED|(T|t)ak(e|es) no part| sitting for| disqualified|took no part|NOT PARTICIPATING|sitting in lieu of)", judges_string)):1157 no_part = True1158 no_part_dich = 11159 if len(re.findall('not participating|recusal|recused|disqualif', judges_string)) > 1:1160 check_recuse = True1161 check_recuse_case = 11162 full_judges_holder = re.sub(", (J|JJ)\.", " ", judges_string)1163 full_judges_holder = re.sub(" O\.", "", full_judges_holder)1164 full_judges_holder = re.sub(" C\.", "", full_judges_holder)1165 full_judges_holder = re.sub(" W\.", "", full_judges_holder)1166 full_judges_holder = re.split("\. ", full_judges_holder)1167 no_part_string = [sentence for sentence in full_judges_holder if re.search("((N|n)ot (P|p)articipat(e|ing)|(R|r)ecus(e|es|ed)|RECUSED| sitting for| disqualified|took no part|(T|t)ak(e|es) no part)|NOT PARTICIPATING|sitting in lieu of", sentence)]1168 no_part_string = str(no_part_string)1169 no_part_string = re.sub("(N|n)ot (P|p)articipat(e|ing).*", "", no_part_string)1170 no_part_string = re.sub("NOT PARTICIPATING", "", no_part_string)1171 no_part_string = re.sub("Recus(es|ed|e)", "", no_part_string)1172 no_part_string = re.sub("took no part in the consideration or decision of this case", "", no_part_string)1173 if re.search("except", no_part_string):1174 no_part_string = no_part_string.split("except", 1)[1]1175 if re.search("in place of", no_part_string):1176 no_part_string = no_part_string.split("in place of", 1)[1]1177 if re.search("IN PLACE OF", no_part_string):1178 no_part_string = no_part_string.split("IN PLACE OF", 1)[1]1179 if re.search("sitting for", no_part_string):1180 no_part_string = no_part_string.split("sitting for", 1)[1]1181 if re.search("sitting in lieu of", no_part_string):1182 no_part_string = no_part_string.split("sitting in lieu of", 1)[1]1183 if re.search("Concurring", no_part_string):1184 no_part_string = no_part_string.split("Concurring", 1)[1]1185 no_part_string = re.sub("who is disqualified", "", no_part_string)1186 no_part_string = re.sub(", sitting for Justice", "", no_part_string)1187 no_part_string = re.sub("recus(es|ed|e)|RECUSED\n|RECUSED", "", no_part_string)1188 no_part_string = re.sub("^[\s]+", "", no_part_string)1189 no_part_string = re.sub("[\s]*\*[\s]*", "", no_part_string)1190 no_part_string = re.sub("'", "", no_part_string)1191 no_part_string = re.sub("\[", "", no_part_string)1192 no_part_string = re.sub("Spaulding", "", no_part_string)1193 no_part_string = re.sub("District Court Judge", "", no_part_string)1194 no_part_string = re.sub("John McKeon|JOHN McKEON", "", no_part_string)1195 no_part_string = re.sub("\]", "", no_part_string)1196 no_part_string = re.sub("(Him|him|Her|her|Them|them)sel(f|ves)", "", no_part_string)1197 no_part_string = re.sub("All the Justices concur, except", "", no_part_string)1198 no_part_string = re.sub("(J|j)ustices,*", "", no_part_string)1199 no_part_string = re.sub("(J|j)ustice,*", "", no_part_string)1200 no_part_string = re.sub("JUSTIC(E|ES),*", "", no_part_string)1201 no_part_string = re.sub("Former Chief", "", no_part_string)1202 no_part_string = re.sub("Former", "", no_part_string)1203 no_part_string = re.sub("[\s]*(did|does)[\s]*", "", no_part_string)1204 no_part_string = re.sub("CJ\.", "", no_part_string)1205 no_part_string = re.sub(", (J|JJ|C\.J)\.,*", "", no_part_string)1206 no_part_string = re.sub("[\s] s[\s]*", "", no_part_string)1207 no_part_string = re.sub("J\.", " ", no_part_string)1208 no_part_string = re.sub("[\s]$", "", no_part_string)1209 no_part_string = re.sub(",[\s]+(,|\.)$", "", no_part_string)1210 no_part_string = re.sub("\.[\s]*$", "", no_part_string)1211 no_part_string = re.sub(",[\s]*$", "", no_part_string)1212 no_part_string = re.sub("\\xc2\\xa0", "", no_part_string)1213 no_part_string = re.sub(" s ", "", no_part_string)1214 no_part_string = re.sub("\xc2|\\xc2", "", no_part_string)1215 no_part_string = re.sub("\xa0|\\xa0", "", no_part_string)1216 no_part_string = re.sub("\xc2\xa0GLAZE", "", no_part_string)1217 no_part_string = re.sub("Judges:", "", no_part_string)1218 no_part_string = re.sub("AND", "and", no_part_string)1219 no_part_string = re.sub("Boucier", "Bourcier", no_part_string)1220 no_part_string = re.sub(", ,", ",", no_part_string)1221 no_part_string = re.sub(",", "", no_part_string)1222 no_part_string = re.sub("\.", "", no_part_string)1223 no_part_string = re.sub("Chief|CHIEF", "", no_part_string)1224 no_part_string = re.sub("\n|\\n", "", no_part_string)1225 no_part_string = re.sub("who take no part", "", no_part_string)1226 no_part_string = no_part_string.rstrip('\\n')1227 no_part_string = re.sub(' and', ',', no_part_string)1228 no_part_string = re.sub('deeming', '', no_part_string)1229 no_part_string = re.sub('disqualified', '', no_part_string)1230 no_part_string = no_part_string.strip()1231 no_part_string = no_part_string.upper()1232 judges_np = no_part_string1233 judges_np = re.sub("\\xc2", "", judges_np)1234 judges_np = re.sub("\xc2\xa0", "", judges_np)1235 judges_np = re.sub(" and", "", judges_np )1236 judge_np_list = judges_np.split(" ")1237 judge_np_list = filter(None, judge_np_list)1238 if len(judge_np_list) > 4:1239 judge_np_list = judge_np_list[2]1240 judges_np = judge_np_list1241 judge_np1 = ""1242 judge_np2 = ""1243 judge_np3 = ""1244 judge_np4 = ""1245 # Parse judges text and store list of judges that decided case1246 judges_string = re.sub("Judges:|Judges|JUDGES", "", judges_string)1247 judges_string = re.sub("judge|Judge|JUDGE", "", judges_string)1248 judges_string = re.sub(" delivered the Opinion of the Court\.| DELIVERED THE OPINION OF THE COURT\.|Delivered the Opinion of the Court\.", ",", judges_string)1249 judges_string = re.sub("BEFORE THE ENTIRE", "", judges_string)1250 judges_string = re.sub("Court", "", judges_string)1251 judges_string = re.sub("court", "", judges_string)1252 judges_string = re.sub("\xc3\x8d", "i", judges_string)1253 judges_string = re.sub(" Sr\.| SR\.", "", judges_string)1254 judges_string = re.sub(" Jr\.| JR\.", "", judges_string)1255 judges_string = re.sub(" Mr\.| MR\.", "", judges_string)1256 judges_string = re.sub(" Sr| SR", "", judges_string)1257 judges_string = re.sub(" Jr| JR", "", judges_string)1258 judges_string = re.sub(" at the", "", judges_string)1259 judges_string = re.sub(" Mr| MR", "", judges_string)1260 judges_string = re.sub("F\.X\. HENNESSEY", "HENNESSY", judges_string)1261 judges_string = re.sub("and in the judgment", "", judges_string)1262 judges_string = re.sub("was an appointed", "", judges_string)1263 judges_string = re.sub("S93A0786", "", judges_string)1264 judges_string = re.sub("S93X0787", "", judges_string)1265 judges_string = re.sub("III-A", "", judges_string)1266 judges_string = re.sub("I-V", "", judges_string)1267 judges_string = re.sub(" VII", "", judges_string)1268 judges_string = re.sub("Parts V\(C\), VI, VII and VIII", "", judges_string)1269 judges_string = re.sub("Parts V\(C\), VI, VII, and VIII", "", judges_string)1270 judges_string = re.sub("Parts I, II, IV and V\(A\)", "", judges_string)1271 judges_string = re.sub("Part III and V\(B\)", "", judges_string)1272 judges_string = re.sub("Parts V\(C\), VI, VII and VIII", "", judges_string)1273 judges_string = re.sub("Messrs\.", "", judges_string)1274 judges_string = re.sub("stead", "", judges_string)1275 judges_string = re.sub("MOTION FOR EXPEDITED APPEAL IS GRANTED", "", judges_string)1276 judges_string = re.sub("REQUEST FOR ORAL ARGUMENT IS DENIED", "", judges_string)1277 judges_string = re.sub("Section IV\(D\)", "", judges_string)1278 judges_string = re.sub("parts I, II, and III", "", judges_string)1279 judges_string = re.sub("respect|RESPECT|Respect", "", judges_string)1280 judges_string = re.sub("action was submitted", "", judges_string)1281 judges_string = re.sub("Subscribing to the Opinion and Assigning Additional Reasons", "", judges_string)1282 judges_string = re.sub("Pursuant to Ariz\. Const\. art\. VI|pursuant to Ariz\. Const\. art\. VI|Pursuant to Ariz\. Const\. art\. 6|pursuant to Ariz\. Const\. art\. 6", "", judges_string)1283 judges_string = re.sub("Arizona Constitution", "", judges_string)1284 judges_string = re.sub("Pursuant to art\. VI\.|Pursuant to article VI", "", judges_string)1285 judges_string = re.sub("pursuant|Pursuant", "", judges_string)1286 judges_string = re.sub(" and Justices", ",", judges_string)1287 judges_string = re.sub("None", "", judges_string)1288 judges_string = re.sub("\xe2\x80\x94", "", judges_string)1289 judges_string = re.sub("PANEL: ", "", judges_string)1290 judges_string = re.sub("\$110W\.", "", judges_string)1291 judges_string = re.sub(" but, on administrative leave,", "", judges_string)1292 judges_string = re.sub("Ex parte Reneau L\. Gates \(re\: v\. Palm Harbor Homes\, Inc\.\, et al\.\)", "", judges_string)1293 judges_string = re.sub("We Concur|WE CONCUR|We concur", ", ", judges_string)1294 judges_string = re.sub("All the|all the|ALL THE", "", judges_string)1295 judges_string = re.sub("Circuit|circuit|CIRCUIT", "", judges_string)1296 judges_string = re.sub("except", "", judges_string)1297 judges_string = re.sub("Special Justices", "", judges_string)1298 judges_string = re.sub("Terminix International v\. Jackson", "", judges_string)1299 judges_string = re.sub("Special Justice", "", judges_string)1300 judges_string = re.sub("Associate Justice", "", judges_string)1301 judges_string = re.sub("Point II", "", judges_string)1302 judges_string = re.sub("Special Chief Justice", "", judges_string)1303 judges_string = re.sub("Chief Justice", "", judges_string)1304 judges_string = re.sub("Justice\.", "", judges_string)1305 judges_string = re.sub("affirmance|Affirmance|AFFIRMANCE", "", judges_string)1306 judges_string = re.sub("'s|'S", "", judges_string)1307 judges_string = re.sub("\(No\.\s\d*\)", "", judges_string)1308 judges_string = re.sub("AFFIRMED|Affirmed|affirmed", "", judges_string)1309 judges_string = re.sub("AFFIRM|Affirm|affirm", "", judges_string)1310 judges_string = re.sub("grant the petition", "", judges_string)1311 judges_string = re.sub("petition|Petition|PETITION", "", judges_string)1312 judges_string = re.sub("Granted|granted|GRANTED", "", judges_string)1313 judges_string = re.sub("abstaining|Abstaining|ABSTAINING", "", judges_string)1314 judges_string = re.sub("No\.\s\d*", "", judges_string)1315 judges_string = re.sub("Senior", "", judges_string)1316 judges_string = re.sub("Supr\.|Supr", "", judges_string)1317 judges_string = re.sub("\xe2\x80\x94", "", judges_string)1318 judges_string = re.sub("Chief Justice", ",", judges_string)1319 judges_string = re.sub("Chief Judge", "", judges_string)1320 judges_string = re.sub("--", ",", judges_string)1321 judges_string = re.sub(" but ", "", judges_string)1322 judges_string = re.sub("Justices|JUSTICES|justices", "", judges_string)1323 judges_string = re.sub("JUSTICE\.", "", judges_string)1324 judges_string = re.sub("JUSTICE|Justice|justice", "", judges_string)1325 judges_string = re.sub("announced|Announced|ANNOUNCED", "", judges_string)1326 judges_string = re.sub("\*Link to the text of the note", "", judges_string)1327 judges_string = re.sub("Ariz\.Const\.", "", judges_string)1328 judges_string = re.sub("art\. VI", "", judges_string)1329 judges_string = re.sub(" art\.", "", judges_string)1330 judges_string = re.sub("Link to the text of the note", "", judges_string)1331 judges_string = re.sub("to the", "", judges_string)1332 judges_string = re.sub("prior", "", judges_string)1333 judges_string = re.sub("oral argument|argument", "", judges_string)1334 judges_string = re.sub("resigned", "", judges_string)1335 judges_string = re.sub("chief|Chief|CHIEF", "", judges_string)1336 judges_string = re.sub("AUTHOR", "", judges_string)1337 judges_string = re.sub("nonrecusal|NONRECUSAL|Nonrecusal", "", judges_string)1338 judges_string = re.sub("deeming", "", judges_string)1339 judges_string = re.sub("temporary", "", judges_string)1340 judges_string = re.sub("filed:", "", judges_string)1341 judges_string = re.sub("filed a|file a", "", judges_string)1342 judges_string = re.sub("President", "", judges_string)1343 judges_string = re.sub("Intermediate|intermediate|INTERMEDIATE", "", judges_string)1344 judges_string = re.sub("Associate|ASSOCIATE|associate", "", judges_string)1345 judges_string = re.sub("reasons|REASONS|Reasons|reason|REASON|Reason", "", judges_string)1346 judges_string = re.sub("Superior", "", judges_string)1347 judges_string = re.sub("constituting the", "", judges_string)1348 judges_string = re.sub("En Banc|en Banc", "", judges_string)1349 judges_string = re.sub("In Banc", "", judges_string)1350 judges_string = re.sub("cases|Cases|CASES", "", judges_string)1351 judges_string = re.sub("agreement|Agreement|AGREEMENT", "", judges_string)1352 judges_string = re.sub('"', "", judges_string)1353 judges_string = re.sub(" all | All | ALL ", "", judges_string)1354 judges_string = re.sub("Present|PRESENT|present", "", judges_string)1355 judges_string = re.sub("APPEALS", "", judges_string)1356 judges_string = re.sub(" THE", "", judges_string)1357 judges_string = re.sub("\xc3\x81", "a", judges_string)1358 judges_string = re.sub("WITHOUT", "", judges_string)1359 judges_string = re.sub("WITH", "", judges_string)1360 judges_string = re.sub("ASSIGNED BY REASON OF VACANCY|VACANCY|Vacancy", "", judges_string)1361 judges_string = re.sub("THIS", "", judges_string)1362 judges_string = re.sub("PELICONES|Pelicones", "", judges_string)1363 judges_string = re.sub("member|Member|MEMBER", "", judges_string)1364 judges_string = re.sub("disposition|Disposition|DISPOSITION", "", judges_string)1365 judges_string = re.sub(" right| Right| RIGHT", "", judges_string)1366 judges_string = re.sub("DISSENTS", "", judges_string)1367 judges_string = re.sub("WRITTEN|written|Written", "", judges_string)1368 judges_string = re.sub("WITHOUT|without", "", judges_string)1369 judges_string = re.sub("\xc3\xa9", "e", judges_string)1370 judges_string = re.sub(" took| TOOK| Took", "", judges_string)1371 judges_string = re.sub("Rule IV", "", judges_string)1372 judges_string = re.sub(" IV", "", judges_string)1373 judges_string = re.sub("C\. J\.,", "", judges_string)1374 judges_string = re.sub(" J\.,", "", judges_string)1375 judges_string = re.sub("assigned|Assigned|ASSIGNED|ASSIGNS|Assigns|assigns", "", judges_string)1376 judges_string = re.sub(" as ", "", judges_string)1377 judges_string = re.sub('"Agreement to Arbitrate"', "", judges_string)1378 judges_string = re.sub("Arbitrate\"", "", judges_string)1379 judges_string = re.sub("files a", "", judges_string)1380 judges_string = re.sub("former|Former|FORMER", "", judges_string)1381 judges_string = re.sub("C\.J\.,|Sp\.JJ|Sp\.J\.|Sp\. J\.|C\.J,|J\.P\.T\.|CJ,||A\.J\.V\.C\.J\.,|JJ\.,|Sp\.J\.|Js,|JS,|JJ\.,|JJ,|D\.J\.,|P\.J\.,|P\.\sJ\.,|C\.J\.,|J\.,|J\.| J,|C\. J\.,", "", judges_string)1382 judges_string = re.sub("C\.J\.|C\.J|CJ|JJ\.|Js|JS|JJ\.|JJ|D\.J\.|P\.J\.|P\.\sJ\.|C\.J\.|J\.|J\.|C\. J\.", "", judges_string)1383 judges_string = re.sub("C\.J\.|C\.J|CJ|JJ\.|Js|JS|JJ\.|JJ|D\.J\.|P\.J\.|P\.\sJ\.|C\.J\.|J\.|J\.|C\. J\.", "", judges_string)1384 judges_string = re.sub("Sp\.J\.", "", judges_string)1385 judges_string = re.sub("Part II\.A", "", judges_string)1386 judges_string = re.sub("Part II\.B", "", judges_string)1387 judges_string = re.sub("Parts II", "", judges_string)1388 judges_string = re.sub("Parts I", "", judges_string)1389 judges_string = re.sub("Part II", "", judges_string)1390 judges_string = re.sub("Part I", "", judges_string)1391 judges_string = re.sub("WoWe", "", judges_string)1392 judges_string = re.sub("foregoing|Foregoing|FOREGOING", "", judges_string)1393 judges_string = re.sub(" for| For| FOR", "", judges_string)1394 judges_string = re.sub("", "", judges_string)1395 judges_string = re.sub("[\(\[].*?[\)\]]", "", judges_string)1396 judges_string = re.sub("III", "", judges_string)1397 judges_string = re.sub("II\(\w\)", "", judges_string)1398 judges_string = re.sub("III\(\w\)", "", judges_string)1399 judges_string = re.sub(" II", "", judges_string)1400 judges_string = re.sub("III", "", judges_string)1401 judges_string = re.sub("Associate", "", judges_string)1402 judges_string = re.sub("Vice", "", judges_string)1403 judges_string = re.sub("\[\**\d*\]", "", judges_string)1404 judges_string = re.sub("Arbitrate|arbitrate|ARBITRATE", "", judges_string)1405 judges_string = re.sub("\xc2", "", judges_string)1406 judges_string = re.sub("BENCH|Bench|bench", "", judges_string)1407 judges_string = re.sub("(Before: |BEFORE: )", "", judges_string)1408 judges_string = re.sub("\xa0", " ", judges_string)1409 judges_string = re.sub("\/", "", judges_string)1410 judges_string = re.sub("\n|\r", " ", judges_string)1411 judges_string = re.sub("\(see p", " ", judges_string)1412 judges_string = re.sub("\(\d\)", "", judges_string)1413 judges_string = re.sub("\d", "", judges_string)1414 judges_string = re.sub("\(", "", judges_string)1415 judges_string = re.sub("\)", "", judges_string)1416 judges_string = re.sub("\sI,", "", judges_string)1417 judges_string = re.sub(" or ", "", judges_string)1418 judges_string = re.sub("Saylor|SAYLOR", "Saylor, ", judges_string)1419 judges_string = re.sub(" BY", "", judges_string)1420 judges_string = re.sub(" FOR", "", judges_string)1421 judges_string = re.sub("I;", "", judges_string)1422 judges_string = re.sub("Voting|VOTING|voting", "", judges_string)1423 judges_string = re.sub("Surrogate", "", judges_string)1424 judges_string = re.sub("\'", "", judges_string) #makes matching of judge names possible: O'Connor -> OConnor1425 judges_string = re.sub("judgment", "", judges_string)1426 judges_string = re.sub("SeeStuart|seestuart", "See, Stuart", judges_string)1427 if(re.search("unanimous view of the court|unanimous", judges_string)):1428 unanimous = 11429 judges_string = re.sub("unanimous view of the court", "", judges_string)1430 judges_string = re.sub("unanimous", "", judges_string)1431 judges_string = re.sub("Took no|Took No|took no|TOOK NO", "", judges_string)1432 judges_string = re.sub(" No,", "", judges_string)1433 judges_string = re.sub("separately|Separately|SEPARATELY", "", judges_string)1434 judges_string = re.sub("separate|Separate|SEPARATE", "", judges_string)1435 judges_string = re.sub("in place of", "", judges_string)1436 judges_string = re.sub("sections,", "", judges_string)1437 judges_string = re.sub("Sections,", "", judges_string)1438 judges_string = re.sub("sections", "", judges_string)1439 judges_string = re.sub("section,", "", judges_string)1440 judges_string = re.sub("Section,", "", judges_string)1441 judges_string = re.sub("section", "", judges_string)1442 judges_string = re.sub("constituting,", "", judges_string)1443 judges_string = re.sub("en banc,|en banc|En banc|En Banc|EN BANC", "", judges_string)1444 judges_string = re.sub("\[", "", judges_string)1445 judges_string = re.sub("\]", ",", judges_string)1446 judges_string = re.sub("concur in part and dissent in part|CONCUR IN PART AND DISSENT IN PART", " ", judges_string)1447 judges_string = re.sub("concurs in part and dissents in part|CONCURS IN PART AND DISSENTS IN PART", " ", judges_string)1448 judges_string = re.sub("concurs in the result, without opinion\.", "", judges_string)1449 judges_string = re.sub("all concurring", "", judges_string)1450 judges_string = re.sub("See separate opinion", "", judges_string)1451 judges_string = re.sub("concurring|Concurring|CONCURRING", "", judges_string)1452 judges_string = re.sub("concurrence|Concurrence|CONCURRENCE|Concurrence:", "", judges_string)1453 judges_string = re.sub("concurs", ",", judges_string)1454 judges_string = re.sub("concurred", ",", judges_string)1455 judges_string = re.sub("concur in", "", judges_string)1456 judges_string = re.sub("Concurs:|CONCURs:", "", judges_string)1457 judges_string = re.sub("concurs|Concurs|CONCURS", "", judges_string)1458 judges_string = re.sub("concur\.", ",", judges_string)1459 judges_string = re.sub("concur|Concur", "", judges_string)1460 judges_string = re.sub("CONCUR", ",", judges_string)1461 judges_string = re.sub("does", "", judges_string)1462 judges_string = re.sub("consideration", "", judges_string)1463 judges_string = re.sub("Md\.", "", judges_string)1464 judges_string = re.sub("Temporarily", "", judges_string)1465 judges_string = re.sub("Link to, text thee", "", judges_string)1466 judges_string = re.sub("assigns reasons", "", judges_string)1467 judges_string = re.sub("Appeals", "", judges_string)1468 judges_string = re.sub("retired|RETIRED|Retired|Ret|ret\.", "", judges_string)1469 judges_string = re.sub("assigned|Assigned|ASSIGNED|assignment|Assignment|ASSIGNNMENT", "", judges_string)1470 judges_string = re.sub("The ", "", judges_string)1471 judges_string = re.sub(" sat", "", judges_string)1472 judges_string = re.sub("delivered", "", judges_string)1473 judges_string = re.sub("PARTICIPATING", "", judges_string)1474 judges_string = re.sub("participating", "", judges_string)1475 judges_string = re.sub("PARTICIPATING", "", judges_string)1476 judges_string = re.sub("participating", "", judges_string)1477 judges_string = re.sub("Participating", "", judges_string)1478 judges_string = re.sub("did not participate", "", judges_string)1479 judges_string = re.sub("did not sit", "", judges_string)1480 judges_string = re.sub("did not", "", judges_string)1481 judges_string = re.sub("Maricopa County", "", judges_string)1482 judges_string = re.sub("County", "", judges_string)1483 judges_string = re.sub("WRITTEN BY:|Written by:", "", judges_string)1484 judges_string = re.sub("herein", "", judges_string)1485 judges_string = re.sub("not participate", "", judges_string)1486 judges_string = re.sub("participate", "", judges_string)1487 judges_string = re.sub("Presiding|PRESIDING", "", judges_string)1488 judges_string = re.sub("specially|Specially|SPECIALLY", "", judges_string)1489 judges_string = re.sub("special|Special|SPECIAL", "", judges_string)1490 judges_string = re.sub("pro-tem|Pro-Tem|PRO-TEM", "", judges_string)1491 judges_string = re.sub("concurring", "", judges_string)1492 judges_string = re.sub("Concurring", "", judges_string)1493 judges_string = re.sub("concurs in the result, without opinion\.", "", judges_string)1494 judges_string = re.sub("no opinion", "", judges_string)1495 judges_string = re.sub("opinion\.", ",", judges_string)1496 judges_string = re.sub("OPINIONS|OPINIONs|opinions|Opinions", "", judges_string)1497 judges_string = re.sub("opinion", "", judges_string)1498 judges_string = re.sub("Opinion", "", judges_string)1499 judges_string = re.sub(" full ", "", judges_string)1500 judges_string = re.sub("statement", "", judges_string)1501 judges_string = re.sub("files|file|FILES|FILE", "", judges_string)1502 judges_string = re.sub("Judicial Circuit", "", judges_string)1503 judges_string = re.sub("Part III", "", judges_string)1504 judges_string = re.sub("no part|NO PART|No Part", "", judges_string)1505 judges_string = re.sub("part", "", judges_string)1506 judges_string = re.sub("Part", "", judges_string)1507 judges_string = re.sub("PART", "", judges_string)1508 judges_string = re.sub("which|Which|WHICH", "", judges_string)1509 judges_string = re.sub("DENIED|denied", "", judges_string)1510 judges_string = re.sub("Majority|majority|MAJORITY", "", judges_string)1511 judges_string = re.sub("Heard|heard|HEARD", "", judges_string)1512 judges_string = re.sub("joining|JOINING|Joining", "", judges_string)1513 judges_string = re.sub("joined|JOINED|Joined", "", judges_string)1514 judges_string = re.sub("joins|JOINS|Joins", "", judges_string)1515 judges_string = re.sub("join|JOIN|Join", "", judges_string)1516 judges_string = re.sub("takes|taking|Taking|TAKING", "", judges_string)1517 judges_string = re.sub(" that", "", judges_string)1518 judges_string = re.sub("as to the rationale", "", judges_string)1519 judges_string = re.sub("the judgment", "", judges_string)1520 judges_string = re.sub("rationale", "", judges_string)1521 judges_string = re.sub("T\.Y\.|T\. Y\.", "", judges_string)1522 judges_string = re.sub("A\.M\.", "", judges_string)1523 judges_string = re.sub("F\.E\.", "", judges_string)1524 judges_string = re.sub("N\.C\.", "", judges_string)1525 judges_string = re.sub("Paul H\.", "", judges_string)1526 judges_string = re.sub("Russell A\.", "", judges_string)1527 judges_string = re.sub("G\. Barry", "", judges_string)1528 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1529 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1530 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1531 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1532 judges_string = re.sub(" A\.| B\.| C\.| D\.| E\.| F\.| G\.| H\.| I\.| J\.| K\.| L\.| M\.| N\.| O\.| P\.| Q\.| R\.| S\.| T\.| U\.| V\.| W\.| X\.| Y\.| Z\.|", "", judges_string)1533 judges_string = re.sub("\.", ",", judges_string)1534 judges_string = re.sub("BEFORE", "", judges_string)1535 judges_string = re.sub("would", "", judges_string)1536 judges_string = re.sub("this", "", judges_string)1537 judges_string = re.sub("only", "", judges_string)1538 judges_string = re.sub("without", "", judges_string)1539 judges_string = re.sub("with", "", judges_string)1540 judges_string = re.sub(" out", "", judges_string)1541 judges_string = re.sub("also", "", judges_string)1542 judges_string = re.sub(" of", "", judges_string)1543 judges_string = re.sub(" view", "", judges_string)1544 judges_string = re.sub(" Not", "", judges_string)1545 judges_string = re.sub(" not", "", judges_string)1546 judges_string = re.sub(" NOT", "", judges_string)1547 judges_string = re.sub(" whom", "", judges_string)1548 judges_string = re.sub(" who", "", judges_string)1549 judges_string = re.sub("filed", "", judges_string)1550 judges_string = re.sub("expressing", "", judges_string)1551 judges_string = re.sub("but dissents", "", judges_string)1552 judges_string = re.sub("but dissent", "", judges_string)1553 judges_string = re.sub("but not the dissent", "", judges_string)1554 judges_string = re.sub("dissented", "", judges_string)1555 judges_string = re.sub("issued", ",", judges_string)1556 judges_string = re.sub("foregoing", "", judges_string)1557 judges_string = re.sub("agree", "", judges_string)1558 judges_string = re.sub("Opposed|opposed|OPPOSED", "", judges_string)1559 judges_string = re.sub("dissents", "", judges_string)1560 judges_string = re.sub("dissenting", "", judges_string)1561 judges_string = re.sub("DISSENTING", "", judges_string)1562 judges_string = re.sub("ENTIRE COURT", "", judges_string)1563 judges_string = re.sub(" as", "", judges_string)1564 judges_string = re.sub("reversal", "", judges_string)1565 judges_string = re.sub("none", "", judges_string)1566 judges_string = re.sub("Twelfth|Eleventh|Fifth|Tenth|Ninth|Eigth|Seventh|Sixth", "", judges_string)1567 judges_string = re.sub("Mr", "", judges_string)1568 judges_string = re.sub("remand", "", judges_string)1569 judges_string = re.sub("overruling", "", judges_string)1570 judges_string = re.sub("rehearing", "", judges_string)1571 judges_string = re.sub("OPINION", "", judges_string)1572 judges_string = re.sub("COURT", "", judges_string)1573 judges_string = re.sub("ONLY", "", judges_string)1574 judges_string = re.sub("IN RESULT", "", judges_string)1575 judges_string = re.sub(" IN ", "", judges_string)1576 judges_string = re.sub("Dissenting", "", judges_string)1577 judges_string = re.sub("Dissents", "", judges_string)1578 judges_string = re.sub("dissent\.", ",", judges_string)1579 judges_string = re.sub("dissent", "", judges_string)1580 judges_string = re.sub("Dissent", "", judges_string)1581 judges_string = re.sub("recuses|RECUSES|Recuses", "", judges_string)1582 judges_string = re.sub("recused|RECUSED|Recused", "", judges_string)1583 judges_string = re.sub("recuse|RECUSE|Recuse", "", judges_string)1584 judges_string = re.sub("SEPARATELY", "", judges_string)1585 judges_string = re.sub("PRO-TEM", "", judges_string)1586 judges_string = re.sub("reserves", "", judges_string)1587 judges_string = re.sub("is disqualified|disqualified|disqualification", "", judges_string)1588 judges_string = re.sub("recused themselves", "", judges_string)1589 judges_string = re.sub("recused", "", judges_string)1590 judges_string = re.sub("Recused", "", judges_string)1591 judges_string = re.sub("deceased", "", judges_string)1592 judges_string = re.sub("in the result", "", judges_string)1593 judges_string = re.sub("the result", "", judges_string)1594 judges_string = re.sub("result|Result|RESULT", "", judges_string)1595 judges_string = re.sub(" acting ", "", judges_string)1596 judges_string = re.sub(" and ", ",", judges_string)1597 judges_string = re.sub(" AND ", ",", judges_string)1598 judges_string = re.sub(" an", ",", judges_string)1599 judges_string = re.sub("application|Application|APPLICATION", ", ", judges_string)1600 judges_string = re.sub("dismissed|Dismissed|DISMISSED", ", ", judges_string)1601 judges_string = re.sub("entitled|Entitled|ENTITLED", ", ", judges_string)1602 judges_string = re.sub("appeal|Appeal|APPEAL", ", ", judges_string)1603 judges_string = re.sub(" the ", ", ", judges_string)1604 judges_string = re.sub(" as to", ", ", judges_string)1605 judges_string = re.sub("decision", ", ", judges_string)1606 judges_string = re.sub("final", ", ", judges_string)1607 judges_string = re.sub(" in a", "", judges_string)1608 judges_string = re.sub("in the", "", judges_string)1609 judges_string = re.sub(" In | in ", "", judges_string)1610 judges_string = re.sub(" in,", "", judges_string)1611 judges_string = re.sub(" of", "", judges_string)1612 judges_string = re.sub(" OF", "", judges_string)1613 judges_string = re.sub(" from", "", judges_string)1614 judges_string = re.sub("herself", "", judges_string)1615 judges_string = re.sub("himself", "", judges_string)1616 judges_string = re.sub("themselves", "", judges_string)1617 judges_string = re.sub("expresses", "", judges_string)1618 judges_string = re.sub("ii", "", judges_string)1619 judges_string = re.sub(" cases| Cases", "", judges_string)1620 judges_string = re.sub("case", "", judges_string)1621 judges_string = re.sub("Case", "", judges_string)1622 judges_string = re.sub(" by", "", judges_string)1623 judges_string = re.sub("heard", "", judges_string)1624 judges_string = re.sub("DENVIRSTITH", "STITH", judges_string)1625 judges_string = re.sub("considered", "", judges_string)1626 judges_string = re.sub("decided", "", judges_string)1627 judges_string = re.sub("time", "", judges_string)1628 judges_string = re.sub("submission", "", judges_string)1629 judges_string = re.sub("\&", "", judges_string)1630 judges_string = re.sub("were designated", "", judges_string)1631 judges_string = re.sub("is designated|designated|designation", "", judges_string)1632 judges_string = re.sub(" All |ALL ", "", judges_string)1633 judges_string = re.sub("is sitting", "", judges_string)1634 judges_string = re.sub("sitting|SITTING|Sitting", "", judges_string)1635 judges_string = re.sub(" sit", "", judges_string)1636 judges_string = re.sub(" superior", "", judges_string)1637 judges_string = re.sub(" under", "", judges_string)1638 judges_string = re.sub("Cavanaugh|CAVANAUGH", "Cavanagh", judges_string)1639 judges_string = re.sub("WHOLE|Whole|whole", "", judges_string)1640 judges_string = re.sub("deny", "", judges_string)1641 judges_string = re.sub("Matter|MATTER|matter", "", judges_string)1642 judges_string = re.sub(" otherwise|Otherwise|OTHERWISE", "", judges_string)1643 judges_string = re.sub(" leave", "", judges_string)1644 judges_string = re.sub(" others| other| Other| OTHER", "", judges_string)1645 judges_string = re.sub(" vote|votes to", "", judges_string)1646 judges_string = re.sub("RSA", "", judges_string)1647 judges_string = re.sub("memorandum", "", judges_string)1648 judges_string = re.sub("took no", "", judges_string)1649 judges_string = re.sub("syllabus", "", judges_string)1650 judges_string = re.sub("Appellate District", "", judges_string)1651 judges_string = re.sub("District|district", "", judges_string)1652 judges_string = re.sub("Administrative", "", judges_string)1653 judges_string = re.sub("i-v", "", judges_string)1654 judges_string = re.sub("follows", "", judges_string)1655 judges_string = re.sub("Judicial", "", judges_string)1656 judges_string = re.sub("By:", "", judges_string)1657 judges_string = re.sub("Panel:", "", judges_string)1658 judges_string = re.sub(":\s", "", judges_string)1659 judges_string = re.sub(":", "", judges_string)1660 judges_string = re.sub("authored|Authored|AUTHORED", "", judges_string)1661 judges_string = re.sub(" to ", "", judges_string)1662 judges_string = re.sub("DISSENT", "", judges_string)1663 judges_string = re.sub(" each", "", judges_string)1664 judges_string = re.sub("Jr|jr|JR", "", judges_string)1665 judges_string = re.sub("denial", "", judges_string)1666 judges_string = re.sub("Sr|sr|SR", "", judges_string)1667 judges_string = re.sub("Deceased|deceased|DECEASED", "", judges_string)1668 judges_string = re.sub("lead|LEAD|Lead", "", judges_string)1669 judges_string = re.sub(" was | WAS | Was", "", judges_string)1670 judges_string = re.sub(" other", "", judges_string)1671 judges_string = re.sub("writing", "", judges_string)1672 judges_string = re.sub("Writ|writ|WRIT", "", judges_string)1673 judges_string = re.sub("take|TAKE|Take", "", judges_string)1674 judges_string = re.sub("Issued|issued|ISSUED", "", judges_string)1675 judges_string = re.sub("Madame|MADAME|madame", "", judges_string)1676 judges_string = re.sub("Visiting|VISITING|visiting", "", judges_string)1677 judges_string = re.sub("acting|ACTING|Acting", "", judges_string)1678 judges_string = re.sub("having|Having|HAVING", "", judges_string)1679 judges_string = re.sub("reverse", "", judges_string)1680 judges_string = re.sub("O'NEILL to|O'NEILLto", "O'NEILL", judges_string)1681 judges_string = re.sub(" is ", "", judges_string)1682 judges_string = re.sub("Third", "", judges_string)1683 judges_string = re.sub(" John ", "", judges_string)1684 judges_string = re.sub("Boucier", "Bourcier", judges_string)1685 judges_string = re.sub(" to ", "", judges_string)1686 judges_string = re.sub(",to ", "", judges_string)1687 judges_string = re.sub("Ralmon", "Almon", judges_string)1688 judges_string = re.sub("Fabec", "Fabe", judges_string)1689 judges_string = re.sub(" ir ", "", judges_string)1690 judges_string = re.sub("Estaugh", "Eastaugh", judges_string)1691 judges_string = re.sub("Modification", "", judges_string)1692 judges_string = re.sub("Vacation", "", judges_string)1693 judges_string = re.sub(",d,", "", judges_string)1694 judges_string = re.sub("Division Two|Two", "", judges_string)1695 judges_string = re.sub("dS", "", judges_string)1696 judges_string = re.sub("NOTE", "", judges_string)1697 judges_string = re.sub("dI", "", judges_string)1698 judges_string = re.sub("dX", "", judges_string)1699 judges_string = re.sub("were", "", judges_string)1700 judges_string = re.sub("pursuant", "", judges_string)1701 judges_string = re.sub("determination ", "", judges_string)1702 judges_string = re.sub("Division One", "", judges_string)1703 judges_string = re.sub("article IV", "", judges_string)1704 judges_string = re.sub("Article|ARTICLE|article", "", judges_string)1705 judges_string = re.sub("Arizona", "", judges_string)1706 judges_string = re.sub("Second", "", judges_string)1707 judges_string = re.sub("Council", "", judges_string)1708 judges_string = re.sub("Chairperson", "", judges_string)1709 judges_string = re.sub("not on panel|on panel|panel", "", judges_string)1710 judges_string = re.sub("Division Four", "", judges_string)1711 judges_string = re.sub("to conviction|conviction", "", judges_string)1712 judges_string = re.sub("to sentence|sentence", "", judges_string)1713 judges_string = re.sub("additional", "", judges_string)1714 judges_string = re.sub("following", "", judges_string)1715 judges_string = re.sub("subscribes|subscribe", "", judges_string)1716 judges_string = re.sub("ORAL ARGUMENT", "", judges_string)1717 judges_string = re.sub("DENIAL", "", judges_string)1718 judges_string = re.sub(" ONE ", "", judges_string)1719 judges_string = re.sub("TWO", "", judges_string)1720 judges_string = re.sub("THREE", "", judges_string)1721 judges_string = re.sub(" have", "", judges_string)1722 judges_string = re.sub("unconstitutional", "", judges_string)1723 judges_string = re.sub("follow", "", judges_string)1724 judges_string = re.sub("chapter", "", judges_string)1725 judges_string = re.sub("Lesson", "Leeson", judges_string)1726 judges_string = re.sub("Before", "", judges_string)1727 judges_string = re.sub("Per Curiam|Curiam", "", judges_string)1728 judges_string = re.sub("causesubmitted", "", judges_string)1729 judges_string = re.sub("on briefs|briefs|brief", "", judges_string)1730 judges_string = re.sub("Division", "", judges_string)1731 judges_string = re.sub("absent", "", judges_string)1732 judges_string = re.sub(" IV,", "", judges_string)1733 judges_string = re.sub(" when", "", judges_string)1734 judges_string = re.sub(" inof", "", judges_string)1735 judges_string = re.sub("Order", "", judges_string)1736 judges_string = re.sub("absent", "", judges_string)1737 judges_string = re.sub(" to ", "", judges_string)1738 judges_string = re.sub("tohis ", "", judges_string)1739 judges_string = re.sub("toother|TOOTHER|to other", "", judges_string)1740 judges_string = string.strip(judges_string)1741 judges_string = re.sub(", ,", ",", judges_string)1742 judges_string = re.sub("s V", "", judges_string)1743 judges_string = re.sub(" VI,", "", judges_string)1744 judges_string = re.sub('DENVIR STITH', 'Stith', judges_string)1745 judges_string = re.sub(' Wo,', '', judges_string)1746 judges_line = False1747 judges_part_string = first_sentence(judges_string)1748 judges_holder = re.sub("\*|\d", "", judges_part_string)1749 judges_holder = re.sub("Before:* ", "", judges_holder)1750 judges_holder = re.sub(", (Circuit|Circuit) (J|j)udge[s]?\.?", "", judges_holder)1751 judges_holder = re.sub(", (District|DISTRICT) (J|j)udge[s]?\.?", "", judges_holder)1752 judges_holder = re.sub("Chief Judge", "", judges_holder)1753 judges_holder = re.sub("Senior Judge", "", judges_holder)1754 judges_holder = re.sub("Justice[s]", "", judges_holder)1755 judges_holder = re.sub("Chief District Judge", "", judges_holder)1756 judges_holder = re.sub("Associate Justice", "", judges_holder)1757 judges_holder = re.sub("Administrative Justice", "", judges_holder)1758 judges_holder = re.sub("Administrative Judge", "", judges_holder)1759 judges_holder = re.sub("(P|p)ro (T|t)em", "", judges_holder)1760 judges_holder = re.sub(", (Jr\.|JR\.|Jr|jr)", "", judges_holder)1761 judges_holder = re.sub(", (Sr\.|SR\.)", "Sr.", judges_holder)1762 judges_holder = re.sub(", III", "III", judges_holder)1763 judges_holder = re.sub(", II", "II", judges_holder)1764 judges_holder = re.sub(";", ",", judges_holder)1765 judges_holder = re.sub(",[\s]*,", ",", judges_holder)1766 judges_holder = re.sub(" and ", ", ", judges_holder)1767 judges_holder = re.sub(" \. ", " ", judges_holder)1768 judges_holder = re.sub("[\s]+", " ", judges_holder)1769 judges_holder = re.sub("C\.J\.,|Supr\. J\.|J\.P\.T\.|Sp\.J\.|S\.J\.|P\.JJ\.|JJ\.,|JJ\.|D\.J\.,|P\.J\.,|C\.J\.|J\.,|J\.|C\. J\.", ",", judges_holder)1770 judges_holder = re.sub("\xc3\xa1", "a", judges_holder)1771 judges_holder = re.split(",", judges_holder)1772 judges_holder = judges_holder + non_panel_list1773 judges_holder = [word for word in judges_holder if word != ""]1774 judges_holder = list(set(judges_holder))1775 # Apply functions to judge names to format the names of each justice uniformly1776 if (len(judges_holder) == 1):1777 judge1_ln = lastname(judges_holder[0])1778 judge1_fn = firstname(judges_holder[0])1779 judge1_mn = middlename(judges_holder[0])1780 judge1_suf = namesuffix(judges_holder[0])1781 judge1_full = judge1_ln + ", " + judge1_fn + " " + judge1_mn + " " + judge1_suf1782 judge1_full = re.sub("[\s]+", " ", judge1_full)1783 judge1_full = re.sub(", $", "", judge1_full)1784 if len(judge1_ln) < 2:1785 judge1_ln = ""1786 judge1_vote = ""1787 if (len(judges_holder) > 1):1788 judge1_ln = lastname(judges_holder[0])1789 judge1_fn = firstname(judges_holder[0])1790 judge1_mn = middlename(judges_holder[0])1791 judge1_suf = namesuffix(judges_holder[0])1792 judge1_full = judge1_ln + ", " + judge1_fn + " " + judge1_mn + " " + judge1_suf1793 judge1_full = re.sub("[\s]+", " ", judge1_full)1794 judge1_full = re.sub(", $", "", judge1_full)1795 if len(judge1_ln) < 2:1796 judge1_ln = ""1797 judge1_vote = ""1798 #print judges_holder[0]1799 judge2_ln = lastname(judges_holder[1])1800 #print judge2_ln1801 judge2_fn = firstname(judges_holder[1])1802 judge2_mn = middlename(judges_holder[1])1803 judge2_suf = namesuffix(judges_holder[1])1804 judge2_full = judge2_ln + ", " + judge2_fn + " " + judge2_mn + " " + judge2_suf1805 judge2_full = re.sub("[\s]+", " ", judge2_full)1806 judge2_full = re.sub(", $", "", judge2_full)1807 if len(judge2_ln) < 2:1808 judge2_ln = ""1809 judge2_vote = ""1810 if (len(judges_holder) > 2):1811 judge3_ln = lastname(judges_holder[2])1812 judge3_fn = firstname(judges_holder[2])1813 judge3_mn = middlename(judges_holder[2])1814 judge3_suf = namesuffix(judges_holder[2])1815 judge3_full = judge3_ln + ", " + judge3_fn + " " + judge3_mn + " " + judge3_suf1816 judge3_full = re.sub("[\s]+", " ", judge3_full)1817 judge3_full = re.sub(", $", "", judge3_full)1818 if len(judge3_ln) < 2:1819 judge3_ln = ""1820 judge3_vote = ""1821 if (len(judges_holder) > 3):1822 judge4_ln = lastname(judges_holder[3])1823 judge4_fn = firstname(judges_holder[3])1824 judge4_mn = middlename(judges_holder[3])1825 judge4_suf = namesuffix(judges_holder[3])1826 judge4_full = judge4_ln + ", " + judge4_fn + " " + judge4_mn + " " + judge4_suf1827 judge4_full = re.sub("[\s]+", " ", judge4_full)1828 judge4_full = re.sub(", $", "", judge4_full)1829 if len(judge4_ln) < 2:1830 judge4_ln = ""1831 judge4_vote = ""1832 if (len(judges_holder) > 4):1833 judge5_ln = lastname(judges_holder[4])1834 judge5_fn = firstname(judges_holder[4])1835 judge5_mn = middlename(judges_holder[4])1836 judge5_suf = namesuffix(judges_holder[4])1837 judge5_full = judge5_ln + ", " + judge5_fn + " " + judge5_mn + " " + judge5_suf1838 judge5_full = re.sub("[\s]+", " ", judge5_full)1839 judge5_full = re.sub(", $", "", judge5_full)1840 if len(judge5_ln) < 2:1841 judge5_ln = ""1842 judge5_vote = ""1843 if (len(judges_holder) > 5):1844 judge6_ln = lastname(judges_holder[5])1845 judge6_fn = firstname(judges_holder[5])1846 judge6_mn = middlename(judges_holder[5])1847 judge6_suf = namesuffix(judges_holder[5])1848 judge6_full = judge6_ln + ", " + judge6_fn + " " + judge6_mn + " " + judge6_suf1849 judge6_full = re.sub("[\s]+", " ", judge6_full)1850 judge6_full = re.sub(", $", "", judge6_full)1851 if len(judge6_ln) < 2:1852 judge6_ln = ""1853 judge6_vote = ""1854 if (len(judges_holder) > 6):1855 judge7_ln = lastname(judges_holder[6])1856 judge7_fn = firstname(judges_holder[6])1857 judge7_mn = middlename(judges_holder[6])1858 judge7_suf = namesuffix(judges_holder[6])1859 judge7_full = judge7_ln + ", " + judge7_fn + " " + judge7_mn + " " + judge7_suf1860 judge7_full = re.sub("[\s]+", " ", judge7_full)1861 judge7_full = re.sub(", $", "", judge7_full)1862 if len(judge7_ln) < 2:1863 judge7_ln = ""1864 judge7_vote = ""1865 if (len(judges_holder) > 7):1866 judge8_ln = lastname(judges_holder[7])1867 judge8_fn = firstname(judges_holder[7])1868 judge8_mn = middlename(judges_holder[7])1869 judge8_suf = namesuffix(judges_holder[7])1870 judge8_full = judge8_ln + ", " + judge8_fn + " " + judge8_mn + " " + judge8_suf1871 judge8_full = re.sub("[\s]+", " ", judge8_full)1872 judge8_full = re.sub(", $", "", judge8_full)1873 if len(judge8_ln) < 2:1874 judge8_ln = ""1875 judge8_vote = ""1876 if (len(judges_holder) > 8):1877 judge9_ln = lastname(judges_holder[8])1878 judge9_fn = firstname(judges_holder[8])1879 judge9_mn = middlename(judges_holder[8])1880 judge9_suf = namesuffix(judges_holder[8])1881 judge9_full = judge9_ln + ", " + judge9_fn + " " + judge9_mn + " " + judge9_suf1882 judge9_full = re.sub("[\s]+", " ", judge9_full)1883 judge9_full = re.sub(", $", "", judge9_full)1884 if len(judge9_ln) < 2:1885 judge9_ln = ""1886 judge9_vote = ""1887 if (len(judges_holder) > 9):1888 judge10_ln = lastname(judges_holder[9])1889 judge10_fn = firstname(judges_holder[9])1890 judge10_mn = middlename(judges_holder[9])1891 judge10_suf = namesuffix(judges_holder[9])1892 judge10_full = judge10_ln + ", " + judge10_fn + " " + judge10_mn + " " + judge10_suf1893 judge10_full = re.sub("[\s]+", " ", judge10_full)1894 judge10_full = re.sub(", $", "", judge10_full)1895 if len(judge10_ln) < 2:1896 judge10_ln = ""1897 judge10_vote = ""1898 if (len(judges_holder) > 10):1899 judge11_ln = lastname(judges_holder[10])1900 judge11_fn = firstname(judges_holder[10])1901 judge11_mn = middlename(judges_holder[10])1902 judge11_suf = namesuffix(judges_holder[10])1903 judge11_full = judge11_ln + ", " + judge11_fn + " " + judge11_mn + " " + judge11_suf1904 judge11_full = re.sub("[\s]+", " ", judge11_full)1905 judge11_full = re.sub(", $", "", judge11_full)1906 if len(judge11_ln) < 2:1907 judge11_ln = ""1908 judge11_vote = ""1909 if (len(judges_holder) > 11):1910 check_case = 11911 if len(judge_np_list) == 0:1912 judge_np1 = ""1913 elif len(judge_np_list) == 1:1914 judge_np1 = judge_np_list[0].strip()1915 judge_np1 = re.sub(",", "", judge_np1)1916 judge_np1 = re.sub("\\xc2\\xa0", "", judge_np1)1917 if len(judge_np1) > 10:1918 judge_np1 = judge_np1.split(' ', 1)[0]1919 elif len(judge_np_list) == 2:1920 judge_np1 = judge_np_list[0].strip()1921 judge_np1 = re.sub(",", "", judge_np1)1922 judge_np2 = judge_np_list[1].strip()1923 judge_np2 = re.sub(",", "", judge_np2)1924 elif len(judge_np_list) > 2:1925 judge_np1 = judge_np_list[0].strip()1926 judge_np1 = re.sub(",", "", judge_np1)1927 judge_np2 = judge_np_list[1].strip()1928 judge_np2 = re.sub(",", "", judge_np2)1929 judge_np3 = judge_np_list[2].strip()1930 judge_np3 = re.sub(",", "", judge_np3)1931 judge_np1 = re.sub("\.", "", judge_np1)1932 judge_np2 = re.sub("\.", "", judge_np2)1933 judge_np3 = re.sub("\.", "", judge_np3)1934 judge_np1 = re.sub("\\\\n", "", judge_np1)1935 judge_np2 = re.sub("\\\\n", "", judge_np2)1936 judge_np3 = re.sub("\\\\n", "", judge_np3)1937 judge_np1 = re.sub("\n", "", judge_np1)1938 judge_np2 = re.sub("\n", "", judge_np2)1939 judge_np3 = re.sub("\n", "", judge_np3)1940 judge_np1 = re.sub(", Chief", "", judge_np1)1941 judge_np2 = re.sub(", Chief", "", judge_np2)1942 judge_np3 = re.sub(", Chief", "", judge_np3)1943 judge_np1 = re.sub("Judges:", "", judge_np1)1944 judge_np2 = re.sub("Judges:", "", judge_np2)1945 judge_np3= re.sub("Judges:", "", judge_np3)1946 judge_np1 = re.sub("All the concur, except", "", judge_np1)1947 judge_np2 = re.sub("All the concur, except", "", judge_np2)1948 judge_np3 = re.sub("All the concur, except", "", judge_np3)1949 judge_np1 = re.sub("\xc2\xa0:", "", judge_np1)1950 judge_np2 = re.sub("\xc2\xa0:", "", judge_np2)1951 judge_np3 = re.sub("\xc2\xa0:", "", judge_np3)1952 judge_np1 = re.sub(", ", "", judge_np1)1953 judge_np2 = re.sub(", ", "", judge_np2)1954 judge_np3 = re.sub(", ", "", judge_np3)1955 judge_np1 = judge_np1.strip()1956 judge_np2 = judge_np2.strip()1957 judge_np3 = judge_np3.strip()1958 judge_np1 = Capitalize(judge_np1)1959 judge_np2 = Capitalize(judge_np2)1960 judge_np3 = Capitalize(judge_np3)1961 judge1_ln = lastname(judge1_ln)1962 judge2_ln = lastname(judge2_ln)1963 judge3_ln = lastname(judge3_ln)1964 judge4_ln = lastname(judge4_ln)1965 judge5_ln = lastname(judge5_ln)1966 judge6_ln = lastname(judge6_ln)1967 judge7_ln = lastname(judge7_ln)1968 judge8_ln = lastname(judge8_ln)1969 judge9_ln = lastname(judge9_ln)1970 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln1971 # Remove justices that did not participate based on previously stored list of non-participating judges; remove votes from these justices as well1972 if (judge1_ln == judge_np1 or judge1_ln == judge_np2 or judge1_ln == judge_np3 or judge1_ln == judge_np4):1973 judge1_ln = ""1974 judge1_vote = ""1975 if (judge2_ln == judge_np1 or judge2_ln == judge_np2 or judge2_ln == judge_np3 or judge2_ln == judge_np4):1976 judge2_ln = ""1977 judge2_vote = ""1978 if (judge3_ln == judge_np1 or judge3_ln == judge_np2 or judge3_ln == judge_np3 or judge3_ln == judge_np4):1979 judge3_ln = ""1980 judge3_vote = ""1981 if (judge4_ln == judge_np1 or judge4_ln == judge_np2 or judge4_ln == judge_np3 or judge4_ln == judge_np4):1982 judge4_ln = ""1983 judge4_vote = ""1984 if (judge5_ln == judge_np1 or judge5_ln == judge_np2 or judge5_ln == judge_np3 or judge5_ln == judge_np4):1985 judge5_ln = ""1986 judge5_vote = ""1987 if (judge6_ln == judge_np1 or judge6_ln == judge_np2 or judge6_ln == judge_np3 or judge6_ln == judge_np4):1988 judge6_ln = ""1989 judge6_vote = ""1990 if (judge7_ln == judge_np1 or judge7_ln == judge_np2 or judge7_ln == judge_np3 or judge7_ln == judge_np4):1991 judge7_ln = ""1992 judge7_vote = ""1993 if (judge8_ln == judge_np1 or judge8_ln == judge_np2 or judge8_ln == judge_np3 or judge8_ln == judge_np4):1994 judge8_ln = ""1995 judge8_vote = ""1996 if (judge9_ln == judge_np1 or judge9_ln == judge_np2 or judge9_ln == judge_np3 or judge9_ln == judge_np4):1997 judge9_ln = ""1998 judge9_vote = ""1999 if (judge10_ln == judge_np1 or judge10_ln == judge_np2 or judge10_ln == judge_np3 or judge10_ln == judge_np4):2000 judge10_ln = ""2001 judge10_vote = ""2002 if (judge11_ln == judge_np1 or judge11_ln == judge_np2 or judge11_ln == judge_np3 or judge11_ln == judge_np4 ):2003 judge11_ln = ""2004 judge11_vote = ""2005 # Determine if a dissenting opinion is present2006 if (re.search("dissent|DISSENT|dissents|Dissents|dissenting|Dissenting|DISSENTING", judges_string)):2007 jud_dissent = 12008 # Determine if a decision was unanimous2009 if (re.search("(U|u)nanimous|UNANIMOUS", judges_string)):2010 unanimous = 12011 if(unanimous == 1 and re.search("concurred\.", txtline)): ###build out to parse judge list into single judges2012 new_judges = txtline2013 new_judges = re.sub("C\.\sJ\.,", "", new_judges)2014 new_judges = re.sub("J\.,", "", new_judges)2015 new_judges = re.sub(" and", "", new_judges)2016 new_judges = re.sub("concurred\.", "", new_judges)2017 new_judges = re.sub("\[\*+[0-9]+\]", "", new_judges)2018 new_judges = re.sub("\s", "", new_judges)2019 new_judges = new_judges.split(",")2020 judges_holder = [judges_holder.pop(0)] + new_judges2021 if (len(judges_holder) > 1):2022 judge1_ln = lastname(judges_holder[0])2023 judge2_ln = lastname(judges_holder[1])2024 if (len(judges_holder) > 2):2025 judge3_ln = lastname(judges_holder[2])2026 if (len(judges_holder) > 3):2027 judge4_ln = lastname(judges_holder[3])2028 if (len(judges_holder) > 4):2029 judge5_ln = lastname(judges_holder[4])2030 if (len(judges_holder) > 5):2031 judge6_ln = lastname(judges_holder[5])2032 if (len(judges_holder) > 6):2033 judge7_ln = lastname(judges_holder[6])2034 if (len(judges_holder) > 7):2035 judge8_ln = lastname(judges_holder[7])2036 if (len(judges_holder) > 8):2037 judge9_ln = lastname(judges_holder[8])2038 # Store name of justice writing the majority opinion and format name2039 if (re.match("^Opinion by:", txtline) and not trunc_text):2040 opin_by_line = True2041 if (opin_by_line and re.search("[\w]+", txtline)):2042 opin_by_string = opin_by_string + txtline2043 if (opin_by_line and re.match("^[\s]+$", txtline)):2044 # blank line after opinion by line2045 opin_by_string = re.sub("Opinion by:", "", opin_by_string)2046 opin_by_string = re.sub("FOR THE COURT;", "", opin_by_string)2047 opin_by_string = re.sub("\[\*+\d+\]", "", opin_by_string)2048 opin_by_string = re.sub("\*[\d]*", "", opin_by_string)2049 opin_by_string = re.sub(", Circuit Judge", "", opin_by_string)2050 opin_by_string = re.sub("Chief Justice:", "", opin_by_string)2051 opin_by_string = re.sub("\xc2", "", opin_by_string)2052 opin_by_string = re.sub("'", "", opin_by_string)2053 opin_by_string = re.sub("Sr\.|SR\.|Jr\.|JR\.", "", opin_by_string)2054 opin_by_string = re.sub("\xa0", "", opin_by_string)2055 opin_by_string = re.sub("C\.\sJ\.|C\.J\.|J\.J\.|J\.\sJ\.|J\.", "", opin_by_string)2056 opin_by_string = re.sub("T\.Y\.|T\. Y\.", "", opin_by_string)2057 opin_by_string = re.sub(" C\.", "", opin_by_string)2058 opin_by_string = re.sub("\xc3\x81", "a", opin_by_string)2059 opin_by_string = re.sub("III", "", opin_by_string)2060 opin_by_string = re.sub("\xc3\x81", "a", opin_by_string)2061 opin_by_string = re.sub(" ILL| ill", "ONEILL", opin_by_string)2062 opin_by_string = re.sub('DENVIR STITH|DENVIRSTITH', 'Stith', opin_by_string)2063 opin_by_string = string.strip(opin_by_string)2064 opin_by_line = False2065 author_ln = lastname(opin_by_string)2066 author_fn = firstname(opin_by_string)2067 author_mn = middlename(opin_by_string)2068 author_suf = namesuffix(opin_by_string)2069 author_full = author_ln + ", " + author_fn + " " + author_mn + " " + author_suf2070 author_full = re.sub("[\s]+", " ", author_full)2071 author_full = re.sub(", $", "", author_full)2072 if(Capitalize(judge1_ln) != Capitalize(author_ln)):2073 judge11_ln = judge10_ln2074 judge10_ln = judge9_ln2075 judge9_ln = judge8_ln2076 judge8_ln = judge7_ln2077 judge7_ln = judge6_ln2078 judge6_ln = judge5_ln2079 judge5_ln = judge4_ln2080 judge4_ln = judge3_ln2081 judge3_ln = judge2_ln2082 judge2_ln = judge1_ln2083 judge1_ln = author_ln2084 judge11_vote = judge10_vote2085 judge10_vote = judge9_vote2086 judge9_vote = judge8_vote2087 judge8_vote = judge7_vote2088 judge7_vote = judge6_vote2089 judge6_vote = judge5_vote2090 judge5_vote = judge4_vote2091 judge4_vote = judge3_vote2092 judge3_vote = judge2_vote2093 judge2_vote = judge1_vote2094 judge1_vote = 12095 if (re.match("^Opinion", txtline) and not trunc_text and not blank_after_firstcite and not re.search("^Opinion No.",txtline)):2096 opinion_line = True2097 opinion_start = True2098 if (re.match(re.escape("********** Print Completed **********"), txtline) or re.match("APPENDIX", txtline) or re.match("^CONCUR BY:", txtline) or re.match("^DISSENT BY:", txtline)):2099 opinion_line = False2100 if opinion_line:2101 op_string = txtline2102 op_holder = re.sub("^Opinion", " ", op_string)2103 op_holder = re.sub("\xa0", " ", op_holder)2104 op_holder = re.sub("\n|\r", " ", op_holder)2105 op_holder = re.sub("\[\*+[0-9]+\]", " ", op_holder)2106 op_holder = string.strip(op_holder)2107 op_holder = re.split("\s+", op_holder)2108 op_holder = [word for word in op_holder if word != ""]2109 opinion_word_count += len(op_holder)2110 judge1_vote = 12111 if (re.search("AMICUS|amicus|Amicus", op_string)):2112 amicus = 12113 if (re.search("^Dissent", txtline)):2114 dissent_line = True2115 # If Lexis lists a line beginning with "Dissent:", store the justices listed after2116 if (re.match("^Dissent by:|^DISSENT BY:", txtline) and not trunc_text):2117 dissent_by_line = True2118 dissent = 12119 if (dissent_by_line and re.search("[\w]+", txtline)):2120 dissent_by_string = dissent_by_string + txtline2121 # Format dissenting justice names2122 if (dissent_by_line and re.match("^[\s]+$", txtline)):2123 silent_dissent = True2124 dissent_by_string = string.strip(dissent_by_string)2125 dissent_by_string = re.sub("\n", "", dissent_by_string)2126 dissent_by_string = re.sub("Dissent by:|DISSENT BY:", "", dissent_by_string)2127 dissent_by_string = re.sub("\[.+\]", "", dissent_by_string)2128 dissent_by_string = re.sub("[\s]*\(In[\s]*(P|p)art\)", "", dissent_by_string)2129 dissent_by_string = re.sub("\*\d+", "", dissent_by_string)2130 dissent_by_string = re.sub("dissenting:|dissenting", "", dissent_by_string)2131 dissent_by_string = re.sub("Justice|JUSTICE", "", dissent_by_string)2132 dissent_by_string = re.sub("\d+", "", dissent_by_string)2133 dissent_by_string = re.sub("\xc2", "", dissent_by_string)2134 dissent_by_string = re.sub("\xa0", "", dissent_by_string)2135 dissent_by_string = re.sub("J;", "", dissent_by_string)2136 dissent_by_string = re.sub("C\.J\.|C\. J\.|J\.J\.|JJ\.|J\. J\.|J\.", "", dissent_by_string)2137 dissent_by_string = re.sub("[\(\[].*?[\)\]]", "", dissent_by_string)2138 dissent_by_string = re.sub("'", "", dissent_by_string)2139 dissent_by_string = re.sub("affirmed", "", dissent_by_string)2140 dissent_by_string = re.sub("filed an opinion concurring in part and in part", "", dissent_by_string)2141 dissent_by_string = re.sub("concurring in part", "", dissent_by_string)2142 dissent_by_string = re.sub("in which", "", dissent_by_string)2143 dissent_by_string = re.sub("of which", "", dissent_by_string)2144 dissent_by_string = re.sub("joined", "", dissent_by_string)2145 dissent_by_string = re.sub("Part I", "", dissent_by_string)2146 dissent_by_string = re.sub("Part", "", dissent_by_string)2147 dissent_by_string = re.sub("in part", "", dissent_by_string)2148 dissent_by_string = re.sub("and in", "", dissent_by_string)2149 dissent_by_string = re.sub(" by", "", dissent_by_string)2150 dissent_by_string = re.sub(" and", "", dissent_by_string)2151 dissent_by_string = re.sub("as to", "", dissent_by_string)2152 dissent_by_string = re.sub("filed a", "", dissent_by_string)2153 dissent_by_string = re.sub("\.", ",", dissent_by_string)2154 dissent_by_string = re.sub("[\s]*;", ";", dissent_by_string)2155 dissent_holder = re.split(";|,", dissent_by_string)2156 dissent_holder = filter(None, dissent_holder)2157 dissent_holder = [name for name in dissent_holder if name.strip()]2158 num_dissent = len(dissent_holder)2159 dissent_by_line = False2160 dissent1_ln = lastname(dissent_holder[0]).strip()2161 dissent1_ln = dissent1_ln.strip()2162 dissent1_ln = re.sub("\xa0", "", dissent1_ln)2163 dissent1_ln = Capitalize(dissent1_ln)2164 dissent1_fn = firstname(dissent_holder[0])2165 dissent1_mn = middlename(dissent_holder[0])2166 dissent1_suf = namesuffix(dissent_holder[0])2167 if (len(dissent_holder) > 1):2168 dissent2_ln = lastname(dissent_holder[1]).strip()2169 dissent2_fn = firstname(dissent_holder[1])2170 dissent2_mn = middlename(dissent_holder[1])2171 dissent2_suf = namesuffix(dissent_holder[1])2172 if (len(dissent_holder) > 2):2173 dissent3_ln = lastname(dissent_holder[2]).strip()2174 dissent3_fn = firstname(dissent_holder[2])2175 dissent3_mn = middlename(dissent_holder[2])2176 dissent3_suf = namesuffix(dissent_holder[2])2177 if (len(dissent_holder) > 3):2178 dissent4_ln = lastname(dissent_holder[3]).strip()2179 dissent4_fn = firstname(dissent_holder[3])2180 dissent4_mn = middlename(dissent_holder[3])2181 dissent4_suf = namesuffix(dissent_holder[3])2182 if (len(dissent_holder) > 4):2183 dissent5_ln = lastname(dissent_holder[4]).strip()2184 dissent5_fn = firstname(dissent_holder[4])2185 dissent5_mn = middlename(dissent_holder[4])2186 dissent5_suf = namesuffix(dissent_holder[4])2187 dissent1_full = dissent1_ln + ", " + dissent1_fn + " " + dissent1_mn + " " + dissent1_suf2188 dissent1_full = re.sub("[\s]+", " ", dissent1_full)2189 dissent1_full = re.sub(", $", "", dissent1_full)2190 dissent2_full = dissent2_ln + ", " + dissent2_fn + " " + dissent2_mn + " " + dissent2_suf2191 dissent2_full = re.sub("[\s]+", " ", dissent2_full)2192 dissent2_full = re.sub(", $", "", dissent2_full)2193 dissent3_full = dissent3_ln + ", " + dissent3_fn + " " + dissent3_mn + " " + dissent3_suf2194 dissent3_full = re.sub("[\s]+", " ", dissent3_full)2195 dissent3_full = re.sub(", $", "", dissent3_full)2196 dissent4_full = dissent4_ln + ", " + dissent4_fn + " " + dissent4_mn + " " + dissent4_suf2197 dissent4_full = re.sub("[\s]+", " ", dissent4_full)2198 dissent4_full = re.sub(", $", "", dissent4_full)2199 dissent5_full = dissent4_ln + ", " + dissent5_fn + " " + dissent5_mn + " " + dissent5_suf2200 dissent5_full = re.sub("[\s]+", " ", dissent5_full)2201 dissent5_full = re.sub(", $", "", dissent5_full)2202 # Store justices that concurred in dissenting opinions, format names, and store in a list2203 if (silent_dissent == True and re.search("concurs\.$|concur\.$|concurred\.$", txtline)):2204 other_dissent_string = txtline2205 other_dissent_string = re.sub("\xa0", "", other_dissent_string)2206 other_dissent_string = re.sub(" C\.J\.,| C\. J\.|JJ\.| J\.|C\.J\.", "", other_dissent_string)2207 other_dissent_string = re.sub(" and", ",", other_dissent_string)2208 other_dissent_string = re.sub("'", "", other_dissent_string)2209 other_dissent_string = re.sub(" concurred\.", "", other_dissent_string)2210 other_dissent_string = re.sub(" concur\.\n| concurs\.\n", "", other_dissent_string)2211 other_dissent_string = re.sub("affirmed", "", other_dissent_string)2212 other_dissent_string = re.sub("whom", "", other_dissent_string)2213 other_dissent_string = other_dissent_string.strip()2214 other_dissent_judges = other_dissent_string.split(",")2215 other_dissent_judges[:] = [item for item in other_dissent_judges if item != '']2216 if len(other_dissent_judges) > 0:2217 silent_judge1 = other_dissent_judges[0].strip()2218 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge1))2219 dissent_holder = dissent_holder + [silent_judge1]2220 num_dissent += 12221 if len(other_dissent_judges) > 1:2222 silent_judge2 = other_dissent_judges[1].strip()2223 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge2))2224 num_dissent += 12225 dissent_holder = dissent_holder + [silent_judge2]2226 if len(other_dissent_judges) > 2:2227 silent_judge3 = other_dissent_judges[2].strip()2228 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge3))2229 num_dissent += 12230 dissent_holder = dissent_holder + [silent_judge3]2231 if len(other_dissent_judges) > 3:2232 silent_judge4 = other_dissent_judges[3].strip()2233 dissent_by_string = dissent_by_string + ", " + Capitalize(lastname(silent_judge4))2234 num_dissent += 12235 dissent_holder = dissent_holder + [silent_judge4]2236 if silent_judge4 == silent_judge1 or silent_judge4 == silent_judge2 or silent_judge4 == silent_judge3:2237 silent_judge4 = ""2238 if silent_judge3 == silent_judge1 or silent_judge3 == silent_judge2:2239 silent_judge3 = ""2240 if silent_judge2 == silent_judge1:2241 silent_judge2 = ""2242 silent_dissent = False2243 # Search for concurring judge2244 if (re.search("Concur", txtline)):2245 concur_line = True2246 # Store number of concurring justice and parse/format names of concurring justices (stored in string)2247 if (re.match("^Concur by:", txtline) and not trunc_text):2248 concur_by_line = True2249 concur = concur + 12250 if (concur_by_line and re.search("[\w]+", txtline)):2251 concur_by_string = concur_by_string + txtline2252 if (concur_by_line and re.match("^[\s]+$", txtline)):2253 concur_by_string = string.strip(concur_by_string)2254 concur_by_string = re.sub("\n", " ", concur_by_string)2255 concur_by_string = re.sub("Concur by: ", "", concur_by_string)2256 concur_by_string = re.sub("\[.+\]", "", concur_by_string)2257 concur_by_string = re.sub("\xc2", "", concur_by_string)2258 concur_by_string = re.sub("[\s]*\(In[\s]*(P|p)art\)", "", concur_by_string)2259 concur_by_string = re.sub("\*\d+", "", concur_by_string)2260 concur_by_string = re.sub("\d+", "", concur_by_string)2261 concur_by_string = re.sub("[\s]*;", ";", concur_by_string)2262 concur_holder = re.split("; ", concur_by_string)2263 num_concur = len(concur_holder)2264 concur_by_line = False2265 concur1_ln = lastname(concur_holder[0])2266 concur1_fn = firstname(concur_holder[0])2267 concur1_mn = middlename(concur_holder[0])2268 concur1_suf = namesuffix(concur_holder[0])2269 if (len(concur_holder) > 1):2270 concur2_ln = lastname(concur_holder[1])2271 concur2_fn = firstname(concur_holder[1])2272 concur2_mn = middlename(concur_holder[1])2273 concur2_suf = namesuffix(concur_holder[1])2274 if (len(concur_holder) > 2):2275 concur3_ln = lastname(concur_holder[2])2276 concur3_fn = firstname(concur_holder[2])2277 concur3_mn = middlename(concur_holder[2])2278 concur3_suf = namesuffix(concur_holder[2])2279 if (len(concur_holder) > 3):2280 concur4_ln = lastname(concur_holder[3])2281 concur4_fn = firstname(concur_holder[3])2282 concur4_mn = middlename(concur_holder[3])2283 concur4_suf = namesuffix(concur_holder[3])2284 if (len(concur_holder) > 4):2285 concur5_ln = lastname(concur_holder[4])2286 concur5_fn = firstname(concur_holder[4])2287 concur5_mn = middlename(concur_holder[4])2288 concur5_suf = namesuffix(concur_holder[4])2289 if (len(concur_holder) > 5):2290 concur6_ln = lastname(concur_holder[5])2291 concur6_fn = firstname(concur_holder[5])2292 concur6_mn = middlename(concur_holder[5])2293 concur6_suf = namesuffix(concur_holder[5])2294 if (len(concur_holder) > 6):2295 concur7_ln = lastname(concur_holder[6])2296 concur7_fn = firstname(concur_holder[6])2297 concur7_mn = middlename(concur_holder[6])2298 concur7_suf = namesuffix(concur_holder[6])2299 concur1_full = concur1_ln + ", " + concur1_fn + " " + concur1_mn + " " + concur1_suf2300 concur1_full = re.sub("[\s]+", " ", concur1_full)2301 concur1_full = re.sub(", $", "", concur1_full)2302 concur2_full = concur2_ln + ", " + concur2_fn + " " + concur2_mn + " " + concur2_suf2303 concur2_full = re.sub("[\s]+", " ", concur2_full)2304 concur2_full = re.sub(", $", "", concur2_full)2305 concur3_full = concur3_ln + ", " + concur3_fn + " " + concur3_mn + " " + concur3_suf2306 concur3_full = re.sub("[\s]+", " ", concur3_full)2307 concur3_full = re.sub(", $", "", concur3_full)2308 concur4_full = concur4_ln + ", " + concur4_fn + " " + concur4_mn + " " + concur4_suf2309 concur4_full = re.sub("[\s]+", " ", concur4_full)2310 concur4_full = re.sub(", $", "", concur4_full)2311 concur5_full = concur5_ln + ", " + concur5_fn + " " + concur5_mn + " " + concur5_suf2312 concur5_full = re.sub("[\s]+", " ", concur5_full)2313 concur5_full = re.sub(", $", "", concur5_full)2314 concur6_full = concur6_ln + ", " + concur6_fn + " " + concur6_mn + " " + concur6_suf2315 concur6_full = re.sub("[\s]+", " ", concur6_full)2316 concur6_full = re.sub(", $", "", concur6_full)2317 concur7_full = concur7_ln + ", " + concur7_fn + " " + concur7_mn + " " + concur7_suf2318 concur7_full = re.sub("[\s]+", " ", concur7_full)2319 concur7_full = re.sub(", $", "", concur7_full)2320 # Format all justices listed as dissenting (both those that wrote an opinion and those that signed on)2321 dissent_holder = [word for word in dissent_holder if word != ""]2322 dissent_holder = dissent_holder + other_dissent_holder2323 dissent_holder = [word.upper().strip() for word in dissent_holder]2324 dissent_holder = list(set(dissent_holder))2325 if len(dissent_holder)==0:2326 dissent_author_1 = ""2327 dissent_author_2 = ""2328 dissent_author_3 = ""2329 dissent_author_4 = ""2330 if len(dissent_holder)==1:2331 dissent_author_1 = dissent_holder[0].strip()2332 dissent_author_1 = re.sub("\xa0*", "", dissent_author_1)2333 dissent_author_1 = re.sub("\(In\s*part\)", "", dissent_author_1)2334 dissent_author_1 = lastname(dissent_author_1)2335 dissent_author_1 = Capitalize(dissent_author_1)2336 dissent_author_2 = ""2337 dissent_author_3 = ""2338 dissent_author_4 = ""2339 if len(dissent_holder)==2:2340 dissent_author_1 = dissent_holder[0].strip()2341 dissent_author_1 = dissent_author_1.strip()2342 dissent_author_1 = re.sub("\xa0", "", dissent_author_1)2343 dissent_author_1 = re.sub("\(In", "", dissent_author_1)2344 dissent_author_1 = re.sub("J\.", "", dissent_author_1)2345 dissent_author_1 = re.sub("J;", "", dissent_author_1)2346 dissent_author_1 = Capitalize(lastname(dissent_author_1))2347 dissent_author_2 = dissent_holder[1].strip()2348 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2349 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2350 dissent_author_2 = Capitalize(lastname(dissent_author_2))2351 dissent_author_3 = ""2352 dissent_author_4 = ""2353 if len(dissent_holder)==3:2354 dissent_author_1 = dissent_holder[0].strip()2355 dissent_author_1 = dissent_author_1.strip()2356 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2357 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2358 dissent_author_1 = Capitalize(lastname(dissent_author_1))2359 dissent_author_2 = dissent_holder[1].strip()2360 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2361 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2362 dissent_author_2 = Capitalize(lastname(dissent_author_2))2363 dissent_author_3 = dissent_holder[2].strip()2364 dissent_author_3 = dissent_author_3.strip()2365 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2366 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2367 dissent_author_3 = Capitalize(lastname(dissent_author_3))2368 dissent_author_4 = ""2369 if len(dissent_holder)==4:2370 dissent_author_1 = dissent_holder[0].strip()2371 dissent_author_1 = dissent_author_1.strip()2372 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2373 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2374 dissent_author_1 = Capitalize(lastname(dissent_author_1))2375 dissent_author_2 = dissent_holder[1].strip()2376 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2377 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2378 dissent_author_2 = Capitalize(lastname(dissent_author_2))2379 dissent_author_3 = dissent_holder[2].strip()2380 dissent_author_3 = dissent_author_3.strip()2381 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2382 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2383 dissent_author_3 = Capitalize(lastname(dissent_author_3))2384 dissent_author_4 = dissent_holder[3].strip()2385 dissent_author_4 = dissent_author_4.strip()2386 dissent_author_4 = re.sub("[\xa0]*", "", dissent_author_4)2387 dissent_author_4 = re.sub("\In\spart\)", "", dissent_author_4)2388 dissent_author_4 = Capitalize(lastname(dissent_author_4))2389 dissent_author_5 = ""2390 if len(dissent_holder)==5:2391 dissent_author_1 = dissent_holder[0].strip()2392 dissent_author_1 = dissent_author_1.strip()2393 dissent_author_1 = re.sub("[\xa0]*", "", dissent_author_1)2394 dissent_author_1 = re.sub("\In\spart\)", "", dissent_author_1)2395 dissent_author_1 = Capitalize(lastname(dissent_author_1))2396 dissent_author_2 = dissent_holder[1].strip()2397 dissent_author_2 = re.sub("\xa0", "", dissent_author_2)2398 dissent_author_2 = re.sub("\In\spart\)", "", dissent_author_2)2399 dissent_author_2 = Capitalize(lastname(dissent_author_2))2400 dissent_author_3 = dissent_holder[2].strip()2401 dissent_author_3 = dissent_author_3.strip()2402 dissent_author_3 = re.sub("[\xa0]*", "", dissent_author_3)2403 dissent_author_3 = re.sub("\In\spart\)", "", dissent_author_3)2404 dissent_author_3 = Capitalize(lastname(dissent_author_3))2405 dissent_author_4 = dissent_holder[3].strip()2406 dissent_author_4 = dissent_author_4.strip()2407 dissent_author_4 = re.sub("[\xa0]*", "", dissent_author_4)2408 dissent_author_4 = re.sub("\In\spart\)", "", dissent_author_4)2409 dissent_author_4 = Capitalize(lastname(dissent_author_4))2410 dissent_author_5 = dissent_holder[4].strip()2411 dissent_author_5 = dissent_author_5.strip()2412 dissent_author_5 = re.sub("[\xa0]*", "", dissent_author_5)2413 dissent_author_5 = re.sub("\In\s*part\)", "", dissent_author_5)2414 dissent_author_5 = Capitalize(lastname(dissent_author_5))2415 if len(dissent_author_1) < 2:2416 dissent_author_1 = ""2417 if len(dissent_author_2) < 2:2418 dissent_author_2 = ""2419 if len(dissent_author_3) < 2:2420 dissent_author_3 = ""2421 if len(dissent_author_4) < 2:2422 dissent_author_4 = ""2423 if len(dissent_author_5) < 2:2424 dissent_author_5 = ""2425 if dissent_line and dissent==0:2426 dissent=12427 num_dissent=12428 if concur_line and concur==0:2429 concur=12430 num_concur=12431 #Assign vote values for each justice based on dissenting judges values2432 if dissent_author_1 == judge2_ln or dissent_author_2 == judge2_ln or dissent_author_3 == judge2_ln or dissent_author_4 == judge2_ln or dissent_author_5 == judge2_ln and len(judge2_ln) > 0:2433 judge2_vote = 0 #dissent_author_12434 elif dissent_author_1 != judge2_ln and dissent_author_2 != judge2_ln and dissent_author_3 != judge2_ln and dissent_author_4 != judge2_ln and dissent_author_5 != judge2_ln and len(judge2_ln) > 0:2435 judge2_vote = 12436 else:2437 judge2_vote = ""2438 if dissent_author_1 == judge3_ln or dissent_author_2 == judge3_ln or dissent_author_3 == judge3_ln or dissent_author_4 == judge3_ln or dissent_author_5 == judge3_ln and len(judge3_ln) > 0:2439 judge3_vote = 0 #dissent_author_12440 elif dissent_author_1 != judge3_ln and dissent_author_2 != judge3_ln and dissent_author_3 != judge3_ln and dissent_author_4 != judge3_ln and dissent_author_5 != judge3_ln and len(judge3_ln) > 0:2441 judge3_vote = 12442 else:2443 judge3_vote = ""2444 if dissent_author_1 == judge4_ln or dissent_author_2 == judge4_ln or dissent_author_3 == judge4_ln or dissent_author_4 == judge4_ln or dissent_author_5 == judge4_ln and len(judge4_ln) > 0:2445 judge4_vote = 0 #dissent_author_12446 elif dissent_author_1 != judge4_ln and dissent_author_2 != judge4_ln and dissent_author_3 != judge4_ln and dissent_author_4 != judge4_ln and dissent_author_5 != judge4_ln and len(judge4_ln) > 0:2447 judge4_vote = 12448 else:2449 judge4_vote = ""2450 if dissent_author_1 == judge5_ln or dissent_author_2 == judge5_ln or dissent_author_3 == judge5_ln or dissent_author_4 == judge5_ln or dissent_author_5 == judge5_ln and len(judge5_ln) > 0:2451 judge5_vote = 0 #dissent_author_12452 elif dissent_author_1 != judge5_ln and dissent_author_2 != judge5_ln and dissent_author_3 != judge5_ln and dissent_author_4 != judge5_ln and dissent_author_5 != judge5_ln and len(judge5_ln) > 0:2453 judge5_vote = 12454 else:2455 judge5_vote = ""2456 if dissent_author_1 == judge6_ln or dissent_author_2 == judge6_ln or dissent_author_3 == judge6_ln or dissent_author_4 == judge6_ln or dissent_author_5 == judge6_ln and len(judge6_ln) > 0:2457 judge6_vote = 0 #dissent_author_12458 elif dissent_author_1 != judge6_ln and dissent_author_2 != judge6_ln and dissent_author_3 != judge6_ln and dissent_author_4 != judge6_ln and dissent_author_5 != judge6_ln and len(judge6_ln) > 0:2459 judge6_vote = 12460 else:2461 judge6_vote = ""2462 if dissent_author_1 == judge7_ln or dissent_author_2 == judge7_ln or dissent_author_3 == judge7_ln or dissent_author_4 == judge7_ln or dissent_author_5 == judge7_ln and len(judge7_ln) > 0:2463 judge7_vote = 0 #dissent_author_12464 elif dissent_author_1 != judge7_ln and dissent_author_2 != judge7_ln and dissent_author_3 != judge7_ln and dissent_author_4 != judge7_ln and dissent_author_5 != judge7_ln and len(judge7_ln) > 0:2465 judge7_vote = 12466 else:2467 judge7_vote = ""2468 if dissent_author_1 == judge8_ln or dissent_author_2 == judge8_ln or dissent_author_3 == judge8_ln or dissent_author_4 == judge8_ln or dissent_author_5 == judge8_ln and len(judge8_ln) > 0:2469 judge8_vote = 0 #dissent_author_12470 elif dissent_author_1 != judge8_ln and dissent_author_2 != judge8_ln and dissent_author_3 != judge8_ln and dissent_author_4 != judge8_ln and dissent_author_5 != judge8_ln and len(judge8_ln) > 0:2471 judge8_vote = 12472 else:2473 judge8_vote = ""2474 if dissent_author_1 == judge9_ln or dissent_author_2 == judge9_ln or dissent_author_3 == judge9_ln or dissent_author_4 == judge9_ln or dissent_author_5 == judge9_ln and len(judge9_ln) > 0:2475 judge9_vote = 0 #dissent_author_12476 elif dissent_author_1 != judge9_ln and dissent_author_2 != judge9_ln and dissent_author_3 != judge9_ln and dissent_author_4 != judge9_ln and dissent_author_5 != judge9_ln and len(judge9_ln) > 0:2477 judge9_vote = 12478 else:2479 judge9_vote = ""2480 if dissent_author_1 == judge10_ln or dissent_author_2 == judge10_ln or dissent_author_3 == judge10_ln or dissent_author_4 == judge10_ln or dissent_author_5 == judge10_ln and len(judge10_ln) > 0:2481 judge10_vote = 0 #dissent_author_12482 elif dissent_author_1 != judge10_ln and dissent_author_2 != judge10_ln and dissent_author_3 != judge10_ln and dissent_author_4 != judge10_ln and dissent_author_5 != judge10_ln and len(judge10_ln) > 0:2483 judge10_vote = 12484 else:2485 judge10_vote = ""2486 if dissent_author_1 == judge11_ln or dissent_author_2 == judge11_ln or dissent_author_3 == judge11_ln or dissent_author_4 == judge11_ln or dissent_author_5 == judge11_ln and len(judge11_ln) > 0:2487 judge11_vote = 0 #dissent_author_12488 elif dissent_author_1 != judge11_ln and dissent_author_2 != judge11_ln and dissent_author_3 != judge11_ln and dissent_author_4 != judge11_ln and dissent_author_5 != judge11_ln and len(judge11_ln) > 0:2489 judge11_vote = 12490 else:2491 judge11_vote = ""2492 #Remove vote values from columns without judges2493 if judge1_ln == "":2494 judge1_vote = ""2495 if judge2_ln == "":2496 judge2_vote = ""2497 if judge3_ln == "":2498 judge3_vote = ""2499 if judge4_ln == "":2500 judge4_vote = ""2501 if judge5_ln == "":2502 judge5_vote = ""2503 if judge6_ln == "":2504 judge6_vote = ""2505 if judge7_ln == "":2506 judge7_vote = ""2507 if judge8_ln == "":2508 judge8_vote = ""2509 if judge9_ln == "":2510 judge9_vote = ""2511 if judge10_ln == "":2512 judge10_vote = ""2513 if judge11_ln == "":2514 judge11_vote = ""2515 #Remove non-ASCII characters from Lexis citation values2516 Lexis_cite = re.sub("\xa0", "", Lexis_cite)2517 Lexis_cite = re.sub("\xc2", "", Lexis_cite)2518 #Remove duplicate judges from judge last name columns2519 if(judge9_ln == judge2_ln or judge9_ln == judge3_ln or judge9_ln == judge4_ln or judge9_ln == judge5_ln or judge9_ln == judge6_ln or judge9_ln == judge7_ln or judge9_ln == judge8_ln or judge9_ln == judge1_ln):2520 judge9_ln = ""2521 judge9_vote = ""2522 if(judge8_ln == judge2_ln or judge8_ln == judge3_ln or judge8_ln == judge4_ln or judge8_ln == judge5_ln or judge8_ln == judge6_ln or judge8_ln == judge7_ln or judge8_ln == judge9_ln or judge8_ln == judge1_ln):2523 judge8_ln = ""2524 judge8_vote = ""2525 if(judge7_ln == judge2_ln or judge7_ln == judge3_ln or judge7_ln == judge4_ln or judge7_ln == judge5_ln or judge7_ln == judge6_ln or judge7_ln == judge8_ln or judge7_ln == judge9_ln or judge7_ln == judge1_ln):2526 judge7_ln = ""2527 judge7_vote = ""2528 if(judge6_ln == judge2_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln or judge6_ln == judge7_ln or judge6_ln == judge8_ln or judge6_ln == judge9_ln or judge6_ln == judge1_ln):2529 judge6_ln = ""2530 judge6_vote = ""2531 if(judge5_ln == judge2_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln or judge5_ln == judge7_ln or judge5_ln == judge6_ln or judge5_ln == judge8_ln or judge5_ln == judge9_ln or judge5_ln == judge1_ln):2532 judge5_ln = ""2533 judge5_vote = ""2534 if(judge4_ln == judge2_ln or judge4_ln == judge3_ln or judge4_ln == judge7_ln or judge4_ln == judge5_ln or judge4_ln == judge6_ln or judge4_ln == judge8_ln or judge4_ln == judge9_ln or judge4_ln == judge1_ln):2535 judge4_ln = ""2536 judge4_vote = ""2537 if(judge3_ln == judge2_ln or judge3_ln == judge4_ln or judge3_ln == judge7_ln or judge3_ln == judge5_ln or judge3_ln == judge6_ln or judge3_ln == judge8_ln or judge3_ln == judge9_ln or judge3_ln == judge1_ln):2538 judge3_ln = ""2539 judge3_vote = ""2540 if(judge2_ln == judge3_ln or judge2_ln == judge4_ln or judge2_ln == judge7_ln or judge2_ln == judge5_ln or judge2_ln == judge6_ln or judge2_ln == judge8_ln or judge2_ln == judge9_ln or judge2_ln == judge1_ln):2541 judge2_ln = ""2542 judge2_vote = ""2543 if(judge10_ln == judge1_ln or judge10_ln == judge2_ln or judge10_ln == judge3_ln or judge10_ln == judge4_ln or judge10_ln == judge5_ln or judge10_ln == judge6_ln or judge10_ln == judge7_ln or judge10_ln == judge8_ln or judge10_ln == judge9_ln or judge10_ln == judge11_ln):2544 judge10_ln = ""2545 judge10_vote = ""2546 if(judge11_ln == judge1_ln or judge11_ln == judge2_ln or judge11_ln == judge3_ln or judge11_ln == judge4_ln or judge11_ln == judge5_ln or judge11_ln == judge6_ln or judge11_ln == judge7_ln or judge11_ln == judge8_ln or judge11_ln == judge9_ln or judge11_ln == judge10_ln):2547 judge11_ln = ""2548 judge11_vote = ""2549 #Fix vote values for cases where Lexis only reports judges that author a dissenting opinion in the dissent line2550 if(silent_judge1 == judge1_ln and len(silent_judge1) > 0):2551 judge1_vote = 02552 if(silent_judge1 == judge2_ln and len(silent_judge1) > 0):2553 judge2_vote = 02554 if(silent_judge1 == judge3_ln and len(silent_judge1) > 0):2555 judge3_vote = 02556 if(silent_judge1 == judge4_ln and len(silent_judge1) > 0):2557 judge4_vote = 02558 if(silent_judge1 == judge5_ln and len(silent_judge1) > 0):2559 judge5_vote = 02560 if(silent_judge1 == judge6_ln and len(silent_judge1) > 0):2561 judge6_vote = 02562 if(silent_judge1 == judge7_ln and len(silent_judge1) > 0):2563 judge7_vote = 02564 if(silent_judge1 == judge8_ln and len(silent_judge1) > 0):2565 judge8_vote = 02566 if(silent_judge1 == judge9_ln and len(silent_judge1) > 0):2567 judge9_vote = 02568 if(silent_judge2 == judge1_ln and len(silent_judge2) > 0):2569 judge1_vote = 02570 if(silent_judge2 == judge2_ln and len(silent_judge2) > 0):2571 judge2_vote = 02572 if(silent_judge2 == judge3_ln and len(silent_judge2) > 0):2573 judge3_vote = 02574 if(silent_judge2 == judge4_ln and len(silent_judge2) > 0):2575 judge4_vote = 02576 if(silent_judge2 == judge5_ln and len(silent_judge2) > 0):2577 judge5_vote = 02578 if(silent_judge2 == judge6_ln and len(silent_judge2) > 0):2579 judge6_vote = 02580 if(silent_judge2 == judge7_ln and len(silent_judge2) > 0):2581 judge7_vote = 02582 if(silent_judge2 == judge8_ln and len(silent_judge2) > 0):2583 judge8_vote = 02584 if(silent_judge2 == judge9_ln and len(silent_judge2) > 0):2585 judge9_vote = 02586 if(silent_judge3 == judge1_ln and len(silent_judge3) > 0):2587 judge1_vote = 02588 if(silent_judge3 == judge2_ln and len(silent_judge3) > 0):2589 judge2_vote = 02590 if(silent_judge3 == judge3_ln and len(silent_judge3) > 0):2591 judge3_vote = 02592 if(silent_judge3 == judge4_ln and len(silent_judge3) > 0):2593 judge4_vote = 02594 if(silent_judge3 == judge5_ln and len(silent_judge3) > 0):2595 judge5_vote = 02596 if(silent_judge3 == judge6_ln and len(silent_judge3) > 0):2597 judge6_vote = 02598 if(silent_judge3 == judge7_ln and len(silent_judge3) > 0):2599 judge7_vote = 02600 if(silent_judge3 == judge8_ln and len(silent_judge3) > 0):2601 judge8_vote = 02602 if(silent_judge3 == judge9_ln and len(silent_judge3) > 0):2603 judge9_vote = 02604 if(silent_judge4 == judge1_ln and len(silent_judge4) > 0):2605 judge1_vote = 02606 if(silent_judge4 == judge2_ln and len(silent_judge4) > 0):2607 judge2_vote = 02608 if(silent_judge4 == judge3_ln and len(silent_judge4) > 0):2609 judge3_vote = 02610 if(silent_judge4 == judge4_ln and len(silent_judge4) > 0):2611 judge4_vote = 02612 if(silent_judge4 == judge5_ln and len(silent_judge4) > 0):2613 judge5_vote = 02614 if(silent_judge4 == judge6_ln and len(silent_judge4) > 0):2615 judge6_vote = 02616 if(silent_judge4 == judge7_ln and len(silent_judge4) > 0):2617 judge7_vote = 02618 if(silent_judge4 == judge8_ln and len(silent_judge4) > 0):2619 judge8_vote = 02620 if(silent_judge4 == judge9_ln and len(silent_judge4) > 0):2621 judge9_vote = 02622 if(silent_judge5 == judge1_ln and len(silent_judge5) > 0):2623 judge1_vote = 02624 if(silent_judge5 == judge2_ln and len(silent_judge5) > 0):2625 judge2_vote = 02626 if(silent_judge5 == judge3_ln and len(silent_judge5) > 0):2627 judge3_vote = 02628 if(silent_judge5 == judge4_ln and len(silent_judge5) > 0):2629 judge4_vote = 02630 if(silent_judge5 == judge5_ln and len(silent_judge5) > 0):2631 judge5_vote = 02632 if(silent_judge5 == judge6_ln and len(silent_judge5) > 0):2633 judge6_vote = 02634 if(silent_judge5 == judge7_ln and len(silent_judge5) > 0):2635 judge7_vote = 02636 if(silent_judge5 == judge8_ln and len(silent_judge5) > 0):2637 judge8_vote = 02638 if(silent_judge5 == judge9_ln and len(silent_judge5) > 0):2639 judge9_vote = 02640 #Remove duplicate dissenting judge values from dissent columns2641 if dissent_author_5 == dissent_author_1 or dissent_author_5 == dissent_author_2 or dissent_author_5 == dissent_author_3 or dissent_author_5 == dissent_author_4:2642 dissent_author_5 = ""2643 if dissent_author_4 == dissent_author_1 or dissent_author_4 == dissent_author_2 or dissent_author_4 == dissent_author_3:2644 dissent_author_4 = ""2645 if dissent_author_3 == dissent_author_1 or dissent_author_3 == dissent_author_2:2646 dissent_author_3 = ""2647 if dissent_author_2 == dissent_author_1:2648 dissent_author_2 = ""2649 # Remove instances of "Jr" and "Sr" so that the masterfile will match correctly2650 if judge1_ln == "Jr|Sr":2651 judge1_ln = ""2652 if judge2_ln == "Jr|Sr":2653 judge2_ln = ""2654 if judge3_ln == "Jr|Sr":2655 judge3_ln = ""2656 if judge4_ln == "Jr|Sr":2657 judge4_ln = ""2658 if judge5_ln == "Jr|Sr":2659 judge5_ln = ""2660 if judge6_ln == "Jr|Sr":2661 judge6_ln = ""2662 if judge7_ln == "Jr|Sr":2663 judge7_ln = ""2664 if judge8_ln == "Jr|Sr":2665 judge8_ln = ""2666 if judge9_ln == "Jr|Sr":2667 judge9_ln = ""2668 if judge10_ln == "Jr|Sr":2669 judge10_ln = ""2670 if judge11_ln == "Jr|Sr":2671 judge11_ln = ""2672 #Move judges and votes to the left to fix blank cells2673 if judge1_ln == "" or len(judge1_ln) < 2:2674 judge1_ln = judge2_ln2675 judge1_vote = judge2_vote2676 judge2_ln = judge3_ln2677 judge2_vote = judge3_vote2678 judge3_ln = judge4_ln2679 judge3_vote = judge4_vote2680 judge4_ln = judge5_ln2681 judge4_vote = judge5_vote2682 judge5_ln = judge6_ln2683 judge5_vote = judge6_vote2684 judge6_ln = judge7_ln2685 judge6_vote = judge7_vote2686 judge7_ln = judge8_ln2687 judge7_vote = judge8_vote2688 judge8_ln = judge9_ln2689 judge8_vote = judge9_vote2690 judge9_ln = judge10_ln2691 judge9_vote = judge10_vote2692 judge10_ln = judge11_ln2693 judge10_vote = judge11_vote2694 if judge1_ln == "" or len(judge1_ln) < 2:2695 judge1_ln = judge2_ln2696 judge1_vote = judge2_vote2697 judge2_ln = judge3_ln2698 judge2_vote = judge3_vote2699 judge3_ln = judge4_ln2700 judge3_vote = judge4_vote2701 judge4_ln = judge5_ln2702 judge4_vote = judge5_vote2703 judge5_ln = judge6_ln2704 judge5_vote = judge6_vote2705 judge6_ln = judge7_ln2706 judge6_vote = judge7_vote2707 judge7_ln = judge8_ln2708 judge7_vote = judge8_vote2709 judge8_ln = judge9_ln2710 judge8_vote = judge9_vote2711 judge9_ln = judge10_ln2712 judge9_vote = judge10_vote2713 judge10_ln = judge11_ln2714 judge10_vote = judge11_vote2715 if judge1_ln == "" or len(judge1_ln) < 2:2716 judge1_ln = judge2_ln2717 judge1_vote = judge2_vote2718 judge2_ln = judge3_ln2719 judge2_vote = judge3_vote2720 judge3_ln = judge4_ln2721 judge3_vote = judge4_vote2722 judge4_ln = judge5_ln2723 judge4_vote = judge5_vote2724 judge5_ln = judge6_ln2725 judge5_vote = judge6_vote2726 judge6_ln = judge7_ln2727 judge6_vote = judge7_vote2728 judge7_ln = judge8_ln2729 judge7_vote = judge8_vote2730 judge8_ln = judge9_ln2731 judge8_vote = judge9_vote2732 judge9_ln = judge10_ln2733 judge9_vote = judge10_vote2734 judge10_ln = judge11_ln2735 judge10_vote = judge11_vote2736 if judge2_ln == "" or len(judge2_ln) < 2:2737 judge2_ln = judge3_ln2738 judge2_vote = judge3_vote2739 judge3_ln = judge4_ln2740 judge3_vote = judge4_vote2741 judge4_ln = judge5_ln2742 judge4_vote = judge5_vote2743 judge5_ln = judge6_ln2744 judge5_vote = judge6_vote2745 judge6_ln = judge7_ln2746 judge6_vote = judge7_vote2747 judge7_ln = judge8_ln2748 judge7_vote = judge8_vote2749 judge8_ln = judge9_ln2750 judge8_vote = judge9_vote2751 judge9_ln = judge10_ln2752 judge9_vote = judge10_vote2753 judge10_ln = judge11_ln2754 judge10_vote = judge11_vote2755 if judge2_ln == "" or len(judge2_ln) < 2:2756 judge2_ln = judge3_ln2757 judge2_vote = judge3_vote2758 judge3_ln = judge4_ln2759 judge3_vote = judge4_vote2760 judge4_ln = judge5_ln2761 judge4_vote = judge5_vote2762 judge5_ln = judge6_ln2763 judge5_vote = judge6_vote2764 judge6_ln = judge7_ln2765 judge6_vote = judge7_vote2766 judge7_ln = judge8_ln2767 judge7_vote = judge8_vote2768 judge8_ln = judge9_ln2769 judge8_vote = judge9_vote2770 judge9_ln = judge10_ln2771 judge9_vote = judge10_vote2772 judge10_ln = judge11_ln2773 judge10_vote = judge11_vote2774 if judge2_ln == "" or len(judge2_ln) < 2:2775 judge2_ln = judge3_ln2776 judge2_vote = judge3_vote2777 judge3_ln = judge4_ln2778 judge3_vote = judge4_vote2779 judge4_ln = judge5_ln2780 judge4_vote = judge5_vote2781 judge5_ln = judge6_ln2782 judge5_vote = judge6_vote2783 judge6_ln = judge7_ln2784 judge6_vote = judge7_vote2785 judge7_ln = judge8_ln2786 judge7_vote = judge8_vote2787 judge8_ln = judge9_ln2788 judge8_vote = judge9_vote2789 judge9_ln = judge10_ln2790 judge9_vote = judge10_vote2791 judge10_ln = judge11_ln2792 judge10_vote = judge11_vote2793 if judge3_ln == "" or len(judge3_ln) < 2:2794 judge3_ln = judge4_ln2795 judge3_vote = judge4_vote2796 judge4_ln = judge5_ln2797 judge4_vote = judge5_vote2798 judge5_ln = judge6_ln2799 judge5_vote = judge6_vote2800 judge6_ln = judge7_ln2801 judge6_vote = judge7_vote2802 judge7_ln = judge8_ln2803 judge7_vote = judge8_vote2804 judge8_ln = judge9_ln2805 judge8_vote = judge9_vote2806 judge9_ln = judge10_ln2807 judge9_vote = judge10_vote2808 judge10_ln = judge11_ln2809 judge10_vote = judge11_vote2810 if judge3_ln == "" or len(judge3_ln) < 2:2811 judge3_ln = judge4_ln2812 judge3_vote = judge4_vote2813 judge4_ln = judge5_ln2814 judge4_vote = judge5_vote2815 judge5_ln = judge6_ln2816 judge5_vote = judge6_vote2817 judge6_ln = judge7_ln2818 judge6_vote = judge7_vote2819 judge7_ln = judge8_ln2820 judge7_vote = judge8_vote2821 judge8_ln = judge9_ln2822 judge8_vote = judge9_vote2823 judge9_ln = judge10_ln2824 judge9_vote = judge10_vote2825 judge10_ln = judge11_ln2826 judge10_vote = judge11_vote2827 if judge3_ln == "" or len(judge3_ln) < 2:2828 judge3_ln = judge4_ln2829 judge3_vote = judge4_vote2830 judge4_ln = judge5_ln2831 judge4_vote = judge5_vote2832 judge5_ln = judge6_ln2833 judge5_vote = judge6_vote2834 judge6_ln = judge7_ln2835 judge6_vote = judge7_vote2836 judge7_ln = judge8_ln2837 judge7_vote = judge8_vote2838 judge8_ln = judge9_ln2839 judge8_vote = judge9_vote2840 judge9_ln = judge10_ln2841 judge9_vote = judge10_vote2842 judge10_ln = judge11_ln2843 judge10_vote = judge11_vote2844 if judge4_ln == "" or len(judge4_ln) < 2:2845 judge4_ln = judge5_ln2846 judge4_vote = judge5_vote2847 judge5_ln = judge6_ln2848 judge5_vote = judge6_vote2849 judge6_ln = judge7_ln2850 judge6_vote = judge7_vote2851 judge7_ln = judge8_ln2852 judge7_vote = judge8_vote2853 judge8_ln = judge9_ln2854 judge8_vote = judge9_vote2855 judge9_ln = judge10_ln2856 judge9_vote = judge10_vote2857 judge10_ln = judge11_ln2858 judge10_vote = judge11_vote2859 if judge4_ln == "" or len(judge4_ln) < 2:2860 judge4_ln = judge5_ln2861 judge4_vote = judge5_vote2862 judge5_ln = judge6_ln2863 judge5_vote = judge6_vote2864 judge6_ln = judge7_ln2865 judge6_vote = judge7_vote2866 judge7_ln = judge8_ln2867 judge7_vote = judge8_vote2868 judge8_ln = judge9_ln2869 judge8_vote = judge9_vote2870 judge9_ln = judge10_ln2871 judge9_vote = judge10_vote2872 judge10_ln = judge11_ln2873 judge10_vote = judge11_vote2874 if judge4_ln == "" or len(judge4_ln) < 2:2875 judge4_ln = judge5_ln2876 judge4_vote = judge5_vote2877 judge5_ln = judge6_ln2878 judge5_vote = judge6_vote2879 judge6_ln = judge7_ln2880 judge6_vote = judge7_vote2881 judge7_ln = judge8_ln2882 judge7_vote = judge8_vote2883 judge8_ln = judge9_ln2884 judge8_vote = judge9_vote2885 judge9_ln = judge10_ln2886 judge9_vote = judge10_vote2887 judge10_ln = judge11_ln2888 judge10_vote = judge11_vote2889 if judge5_ln == "" or len(judge5_ln) < 2:2890 judge5_ln = judge6_ln2891 judge5_vote = judge6_vote2892 judge6_ln = judge7_ln2893 judge6_vote = judge7_vote2894 judge7_ln = judge8_ln2895 judge7_vote = judge8_vote2896 judge8_ln = judge9_ln2897 judge8_vote = judge9_vote2898 judge9_ln = judge10_ln2899 judge9_vote = judge10_vote2900 judge10_ln = judge11_ln2901 judge10_vote = judge11_vote2902 if judge5_ln == "" or len(judge5_ln) < 2:2903 judge5_ln = judge6_ln2904 judge5_vote = judge6_vote2905 judge6_ln = judge7_ln2906 judge6_vote = judge7_vote2907 judge7_ln = judge8_ln2908 judge7_vote = judge8_vote2909 judge8_ln = judge9_ln2910 judge8_vote = judge9_vote2911 judge9_ln = judge10_ln2912 judge9_vote = judge10_vote2913 judge10_ln = judge11_ln2914 judge10_vote = judge11_vote2915 if judge5_ln == "" or len(judge5_ln) < 2:2916 judge5_ln = judge6_ln2917 judge5_vote = judge6_vote2918 judge6_ln = judge7_ln2919 judge6_vote = judge7_vote2920 judge7_ln = judge8_ln2921 judge7_vote = judge8_vote2922 judge8_ln = judge9_ln2923 judge8_vote = judge9_vote2924 judge9_ln = judge10_ln2925 judge9_vote = judge10_vote2926 judge10_ln = judge11_ln2927 judge10_vote = judge11_vote2928 if judge6_ln == "" or len(judge6_ln) < 2:2929 judge6_ln = judge7_ln2930 judge6_vote = judge7_vote2931 judge7_ln = judge8_ln2932 judge7_vote = judge8_vote2933 judge8_ln = judge9_ln2934 judge8_vote = judge9_vote2935 judge9_ln = judge10_ln2936 judge9_vote = judge10_vote2937 judge10_ln = judge11_ln2938 judge10_vote = judge11_vote2939 if judge6_ln == "" or len(judge6_ln) < 2:2940 judge6_ln = judge7_ln2941 judge6_vote = judge7_vote2942 judge7_ln = judge8_ln2943 judge7_vote = judge8_vote2944 judge8_ln = judge9_ln2945 judge8_vote = judge9_vote2946 judge9_ln = judge10_ln2947 judge9_vote = judge10_vote2948 judge10_ln = judge11_ln2949 judge10_vote = judge11_vote2950 if judge6_ln == "" or len(judge6_ln) < 2:2951 judge6_ln = judge7_ln2952 judge6_vote = judge7_vote2953 judge7_ln = judge8_ln2954 judge7_vote = judge8_vote2955 judge8_ln = judge9_ln2956 judge8_vote = judge9_vote2957 judge9_ln = judge10_ln2958 judge9_vote = judge10_vote2959 judge10_ln = judge11_ln2960 judge10_vote = judge11_vote2961 if judge7_ln == "" or len(judge7_ln) < 2:2962 judge7_ln = judge8_ln2963 judge7_vote = judge8_vote2964 judge8_ln = judge9_ln2965 judge8_vote = judge9_vote2966 judge9_ln = judge10_ln2967 judge9_vote = judge10_vote2968 judge10_ln = judge11_ln2969 judge10_vote = judge11_vote2970 if judge7_ln == "" or len(judge7_ln) < 2:2971 judge7_ln = judge8_ln2972 judge7_vote = judge8_vote2973 judge8_ln = judge9_ln2974 judge8_vote = judge9_vote2975 judge9_ln = judge10_ln2976 judge9_vote = judge10_vote2977 judge10_ln = judge11_ln2978 judge10_vote = judge11_vote2979 if judge7_ln == "" or len(judge7_ln) < 2:2980 judge7_ln = judge8_ln2981 judge7_vote = judge8_vote2982 judge8_ln = judge9_ln2983 judge8_vote = judge9_vote2984 judge9_ln = judge10_ln2985 judge9_vote = judge10_vote2986 judge10_ln = judge11_ln2987 judge10_vote = judge11_vote2988 if judge8_ln == "" or len(judge8_ln) < 2:2989 judge8_ln = judge9_ln2990 judge8_vote = judge9_vote2991 judge9_ln = judge10_ln2992 judge9_vote = judge10_vote2993 judge10_ln = judge11_ln2994 judge10_vote = judge11_vote2995 if judge8_ln == "" or len(judge8_ln) < 2:2996 judge8_ln = judge9_ln2997 judge8_vote = judge9_vote2998 judge9_ln = judge10_ln2999 judge9_vote = judge10_vote3000 judge10_ln = judge11_ln3001 judge10_vote = judge11_vote3002 if judge8_ln == "" or len(judge8_ln) < 2:3003 judge8_ln = judge9_ln3004 judge8_vote = judge9_vote3005 judge9_ln = judge10_ln3006 judge9_vote = judge10_vote3007 judge10_ln = judge11_ln3008 judge10_vote = judge11_vote3009 if judge9_ln == "" or len(judge9_ln) < 2:3010 judge9_ln = judge10_ln3011 judge9_vote = judge10_vote3012 judge10_ln = judge11_ln3013 judge10_vote = judge11_vote3014 if judge9_ln == "" or len(judge9_ln) < 2:3015 judge9_ln = judge10_ln3016 judge9_vote = judge10_vote3017 judge10_ln = judge11_ln3018 judge10_vote = judge11_vote3019 if judge9_ln == "" or len(judge9_ln) < 2:3020 judge9_ln = judge10_ln3021 judge9_vote = judge10_vote3022 judge10_ln = judge11_ln3023 judge10_vote = judge11_vote3024 if judge10_ln == "" or len(judge10_ln) < 2:3025 judge10_ln = judge11_ln3026 judge10_vote = judge11_vote3027 if judge10_ln == "" or len(judge10_ln) < 2:3028 judge10_ln = judge11_ln3029 judge10_vote = judge11_vote3030 if judge10_ln == "" or len(judge10_ln) < 2:3031 judge10_ln = judge11_ln3032 judge10_vote = judge11_vote3033 #Remove duplicate judges from last judge name columns3034 if(judge9_ln == judge2_ln or judge9_ln == judge3_ln or judge9_ln == judge4_ln or judge9_ln == judge5_ln or judge9_ln == judge6_ln or judge9_ln == judge7_ln or judge9_ln == judge8_ln or judge9_ln == judge1_ln):3035 judge9_ln = ""3036 judge9_vote = ""3037 if(judge8_ln == judge2_ln or judge8_ln == judge3_ln or judge8_ln == judge4_ln or judge8_ln == judge5_ln or judge8_ln == judge6_ln or judge8_ln == judge7_ln or judge8_ln == judge9_ln or judge8_ln == judge1_ln):3038 judge8_ln = ""3039 judge8_vote = ""3040 if(judge7_ln == judge2_ln or judge7_ln == judge3_ln or judge7_ln == judge4_ln or judge7_ln == judge5_ln or judge7_ln == judge6_ln or judge7_ln == judge8_ln or judge7_ln == judge9_ln or judge7_ln == judge1_ln):3041 judge7_ln = ""3042 judge7_vote = ""3043 if(judge6_ln == judge2_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln or judge6_ln == judge7_ln or judge6_ln == judge8_ln or judge6_ln == judge9_ln or judge6_ln == judge1_ln):3044 judge6_ln = ""3045 judge6_vote = ""3046 if(judge5_ln == judge2_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln or judge5_ln == judge7_ln or judge5_ln == judge6_ln or judge5_ln == judge8_ln or judge5_ln == judge9_ln or judge5_ln == judge1_ln):3047 judge5_ln = ""3048 judge5_vote = ""3049 if(judge4_ln == judge2_ln or judge4_ln == judge3_ln or judge4_ln == judge7_ln or judge4_ln == judge5_ln or judge4_ln == judge6_ln or judge4_ln == judge8_ln or judge4_ln == judge9_ln or judge4_ln == judge1_ln):3050 judge4_ln = ""3051 judge4_vote = ""3052 if(judge3_ln == judge2_ln or judge3_ln == judge4_ln or judge3_ln == judge7_ln or judge3_ln == judge5_ln or judge3_ln == judge6_ln or judge3_ln == judge8_ln or judge3_ln == judge9_ln or judge3_ln == judge1_ln):3053 judge3_ln = ""3054 judge3_vote = ""3055 if(judge2_ln == judge3_ln or judge2_ln == judge4_ln or judge2_ln == judge7_ln or judge2_ln == judge5_ln or judge2_ln == judge6_ln or judge2_ln == judge8_ln or judge2_ln == judge9_ln or judge2_ln == judge1_ln):3056 judge2_ln = ""3057 judge2_vote = ""3058 if(judge10_ln == judge1_ln or judge10_ln == judge2_ln or judge10_ln == judge3_ln or judge10_ln == judge4_ln or judge10_ln == judge5_ln or judge10_ln == judge6_ln or judge10_ln == judge7_ln or judge10_ln == judge8_ln or judge10_ln == judge9_ln or judge10_ln == judge11_ln):3059 judge10_ln = ""3060 judge10_vote = ""3061 if(judge11_ln == judge1_ln or judge11_ln == judge2_ln or judge11_ln == judge3_ln or judge11_ln == judge4_ln or judge11_ln == judge5_ln or judge11_ln == judge6_ln or judge11_ln == judge7_ln or judge11_ln == judge8_ln or judge11_ln == judge9_ln or judge11_ln == judge10_ln):3062 judge11_ln = ""3063 judge11_vote = ""3064 if (((state_abbr == "AL" or state_abbr == "FL" or panel == 0 or state_abbr == "NH") and state_abbr != "ME" and state_abbr != "MA" and (len(judge6_ln) > 2) or len(judge2_ln) < 2 or len(judge3_ln) < 2 or (len(judge5_ln) < 2 and panel == 0) and len(judge9_ln) < 2) or len(judge1_ln) < 2 and len(judge2_ln) < 2) or state_abbr != "AL" and len(judge7_ln) < 2:3065 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:3066 reader = csv.reader(f)3067 next(f)3068 for row in reader:3069 state = row[0]3070 name = row[3]3071 if len(row[4]) == 4 and row[0] != "MC":3072 row[4] = "1/1/" + row[4]3073 if len(row[5]) == 4 and row[0] != "MC":3074 row[5] = "1/1/" + row[5]3075 if len(row[4]) != 4 and row[0] != "MC" and state_abbr != "AK" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and (len(judge6_ln) > 2) and len(judge9_ln) < 2 or len(judge3_ln) < 3) or len(judge5_ln) < 2) and state_abbr:3076 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3077 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date() + datetime.timedelta(30)3078 if ((panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and state_abbr != "AK" and ((len(judge6_ln) > 2) or len(judge2_ln) < 2 or len(judge3_ln) < 3 or len(judge5_ln) < 2) and len(judge9_ln) < 2)) and start <= date_format <= end):3079 between = True3080 if ((state == state_abbr) and between and row[2] == "0" and state_abbr != "AK" and (panel == 0 or ((state_abbr == "AL" or state_abbr == "FL" or state_abbr == "NH") and (len(judge6_ln) > 2 or len(judge2_ln) < 2 or len(judge3_ln) < 3 or len(judge5_ln) < 2) and len(judge9_ln) < 2))):3081 if non_panel_judge_string == "":3082 non_panel_judge_string = non_panel_judge_string + Capitalize(lastname(row[3]))3083 else:3084 non_panel_judge_string = non_panel_judge_string + "," + Capitalize(lastname(row[3]))3085 if state == state_abbr and row[2] == "0" and len(judge1_ln) < 2 and len(judge2_ln) < 2 and start <= date_format <= end:3086 #print row[3]3087 if non_panel_judge_string == "":3088 non_panel_judge_string = non_panel_judge_string + Capitalize(lastname(row[3]))3089 else:3090 non_panel_judge_string = non_panel_judge_string + "," + Capitalize(lastname(row[3]))3091 #print non_panel_judge_string3092 if row[3] == judge1_ln:3093 judge1_code = row[1]3094 #print judge1_code3095 between = False3096 non_panel_list = non_panel_judge_string.split(",")3097 master.close()3098 judges_AL = non_panel_list3099 if "Jr" in judges_AL:3100 judges_AL.remove('Jr')3101 #judges_AL = list(set(judges_AL))3102 judges_AL.sort()3103 #print judges_AL3104 if judge1_ln in judges_AL:3105 judges_AL.remove(judge1_ln)3106 if judge2_ln in judges_AL:3107 judges_AL.remove(judge2_ln)3108 if judge3_ln in judges_AL:3109 judges_AL.remove(judge3_ln)3110 if judge4_ln in judges_AL:3111 judges_AL.remove(judge4_ln)3112 if judge5_ln in judges_AL:3113 judges_AL.remove(judge5_ln)3114 if judge6_ln in judges_AL:3115 judges_AL.remove(judge6_ln)3116 if judge7_ln in judges_AL:3117 judges_AL.remove(judge7_ln)3118 if judge8_ln in judges_AL:3119 judges_AL.remove(judge8_ln)3120 if judge_np1 in judges_AL:3121 judges_AL.remove(judge_np1)3122 if judge_np2 in judges_AL:3123 judges_AL.remove(judge_np2)3124 if judge_np3 in judges_AL:3125 judges_AL.remove(judge_np3)3126 if judge_np4 in judges_AL:3127 judges_AL.remove(judge_np4)3128 judges_AL = list(set(judges_AL))3129 if len(judge1_ln) < 2 and len(judge2_ln) < 2 and len(judges_AL) > 0:3130 judge1_ln = judges_AL[0]3131 judge2_ln = judges_AL[1]3132 judge1_vote = 13133 judge2_vote = 13134 if len(judge3_ln) < 2 and len(judges_AL) > 2:3135 judge3_ln = judges_AL[2]3136 judge3_vote = 13137 if len(judge4_ln) < 2 and len(judges_AL) > 3:3138 judge4_ln = judges_AL[3]3139 judge4_vote = 13140 if len(judge5_ln) < 2 and len(judges_AL) > 4:3141 judge5_ln = judges_AL[4]3142 judge5_vote = 13143 if len(judge6_ln) < 2 and len(judges_AL) > 5:3144 judge6_ln = judges_AL[5]3145 judge6_vote = 13146 if len(judge7_ln) < 2 and len(judges_AL) > 6:3147 judge7_ln = judges_AL[6]3148 judge7_vote = 13149 #print judge7_ln3150 if len(judge8_ln) < 2 and len(judges_AL) > 7:3151 judge8_ln = judges_AL[7]3152 judge8_vote = 13153 if len(judge9_ln) < 2 and len(judges_AL) > 8:3154 judge9_ln = judges_AL[8]3155 judge9_vote = 13156 if len(judge2_ln) < 2 and len(judges_AL) > 0:3157 judge2_ln = judges_AL[0]3158 judge2_vote = 13159 if len(judge3_ln) < 2 and len(judges_AL) > 1:3160 judge3_ln = judges_AL[1]3161 judge3_vote = 13162 if len(judge4_ln) < 2 and len(judges_AL) > 2:3163 judge4_ln = judges_AL[2]3164 judge4_vote = 13165 if len(judge5_ln) < 2 and len(judges_AL) > 3:3166 judge5_ln = judges_AL[3]3167 judge5_vote = 13168 if len(judge6_ln) < 2 and len(judges_AL) > 4:3169 judge6_ln = judges_AL[4]3170 judge6_vote = 13171 if len(judge7_ln) < 2 and len(judges_AL) > 5:3172 judge7_ln = judges_AL[5]3173 judge7_vote = 13174 if len(judge8_ln) < 2 and len(judges_AL) > 6:3175 judge8_ln = judges_AL[6]3176 judge8_vote = 13177 if len(judge9_ln) < 2 and len(judges_AL) > 7:3178 judge9_ln = judges_AL[7]3179 judge9_vote = 13180 if len(judge3_ln) < 2 and len(judges_AL) > 0:3181 judge3_ln = judges_AL[0]3182 judge3_vote = 13183 if len(judge4_ln) < 2 and panel == 0 and len(judges_AL) > 1:3184 judge4_ln = judges_AL[1]3185 judge4_vote = 13186 if len(judge5_ln) < 2 and panel == 0 and len(judges_AL) > 2:3187 judge5_ln = judges_AL[2]3188 judge5_vote = 13189 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 3:3190 judge6_ln = judges_AL[3]3191 judge6_vote = 13192 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 4:3193 judge7_ln = judges_AL[4]3194 judge7_vote = 13195 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 5:3196 judge8_ln = judges_AL[5]3197 judge8_vote = 13198 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 6:3199 judge9_ln = judges_AL[6]3200 judge9_vote = 13201 if len(judge4_ln) < 2 and len(judges_AL) > 0 and panel == 0:3202 judge4_ln = judges_AL[0]3203 judge4_vote = 13204 if len(judge5_ln) < 2 and panel == 0 and len(judges_AL) > 1:3205 judge5_ln = judges_AL[1]3206 judge5_vote = 13207 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 2:3208 judge6_ln = judges_AL[2]3209 judge6_vote = 13210 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 3:3211 judge7_ln = judges_AL[3]3212 judge7_vote = 13213 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 4:3214 judge8_ln = judges_AL[4]3215 judge8_vote = 13216 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 5:3217 judge9_ln = judges_AL[5]3218 judge9_vote = 13219 if len(judge5_ln) < 2 and len(judges_AL) > 0 and panel == 0:3220 judge5_ln = judges_AL[0]3221 judge5_vote = 13222 if len(judge6_ln) < 2 and panel == 0 and len(judges_AL) > 1:3223 judge6_ln = judges_AL[1]3224 judge6_vote = 13225 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 2:3226 judge7_ln = judges_AL[2]3227 judge7_vote = 13228 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 3:3229 judge8_ln = judges_AL[3]3230 judge8_vote = 13231 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 4:3232 judge9_ln = judges_AL[4]3233 judge9_vote = 13234 if len(judge6_ln) < 2 and len(judges_AL) > 0 and panel == 0:3235 judge6_ln = judges_AL[0]3236 judge6_vote = 13237 if len(judge7_ln) < 2 and panel == 0 and len(judges_AL) > 1:3238 judge7_ln = judges_AL[1]3239 judge7_vote = 13240 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 2:3241 judge8_ln = judges_AL[2]3242 judge8_vote = 13243 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 3:3244 judge9_ln = judges_AL[3]3245 judge9_vote = 13246 if len(judge7_ln) < 2 and len(judges_AL) > 0 and panel == 0:3247 judge7_ln = judges_AL[0]3248 judge7_vote = 13249 if len(judge8_ln) < 2 and panel == 0 and len(judges_AL) > 1:3250 judge8_ln = judges_AL[1]3251 judge8_vote = 13252 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 2:3253 judge9_ln = judges_AL[2]3254 judge9_vote = 13255 if len(judge8_ln) < 2 and len(judges_AL) > 0 and panel == 0:3256 judge8_ln = judges_AL[0]3257 judge8_vote = 13258 if len(judge9_ln) < 2 and panel == 0 and len(judges_AL) > 1:3259 judge9_ln = judges_AL[1]3260 judge9_vote = 13261 if len(judge9_ln) < 2 and len(judges_AL) > 0 and panel == 0:3262 judge9_ln = judges_AL[0]3263 judge9_vote = 13264 if len(judge2_ln) < 2 and len(judge1_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "NC" and state_abbr != "PA" and state_abbr != "RI" and state_abbr != "WV" and state_abbr != "WI" and state_abbr != "WY" and state_abbr != "AR" and state_abbr != "CO" and state_abbr != "GA" and state_abbr != "HI" and state_abbr != "MS" and state_abbr != "MO" and state_abbr != "MN":3265 judge2_ln = judges_AL[0]3266 judge3_ln = judges_AL[1]3267 judge4_ln = judges_AL[2]3268 judge5_ln = judges_AL[3]3269 judge6_ln = judges_AL[4]3270 judge7_ln = judges_AL[5]3271 judge2_vote = 13272 judge3_vote = 13273 judge4_vote = 13274 judge5_vote = 13275 judge6_vote = 13276 judge7_vote = 13277 if len(judge2_ln) < 2 and len(judge1_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "WV":3278 judge2_ln = judges_AL[0]3279 judge3_ln = judges_AL[1]3280 judge4_ln = judges_AL[2]3281 judge5_ln = judges_AL[3]3282 judge2_vote = 13283 judge3_vote = 13284 judge4_vote = 13285 judge5_vote = 13286 if len(judge3_ln) < 2 and len(judge1_ln) > 2 and len(judge2_ln) > 2 and len(judges_AL) > 0 and state_abbr != "NH" and state_abbr != "NJ" and state_abbr != "NY" and state_abbr != "WV" and state_abbr != "AR" and state_abbr != "CO" and state_abbr != "GA" and state_abbr != "HI" and state_abbr != "MS" and state_abbr != "MO":3287 judge3_ln = judges_AL[1]3288 judge4_ln = judges_AL[2]3289 judge5_ln = judges_AL[3]3290 judge6_ln = judges_AL[4]3291 judge3_vote = 13292 judge4_vote = 13293 judge5_vote = 13294 judge6_vote = 13295 else:3296 if len(judges_AL) >= 1 and len(judge6_ln) < 2 and state_abbr != "NH":3297 judge6_ln = judges_AL[0]3298 judge6_vote = 13299 del judges_AL[0]3300 if len(judges_AL) >= 1 and len(judge7_ln) < 2 and len(judge6_ln) > 2 and state_abbr != "NH":3301 judge7_ln = judges_AL[0]3302 judge7_vote = 13303 del judges_AL[0]3304 if len(judges_AL) >= 1 and len(judge8_ln) < 2 and len(judge7_ln) > 2 and state_abbr != "NH":3305 judge8_ln = judges_AL[0]3306 judge8_vote = 13307 del judges_AL[0]3308 if len(judges_AL) >= 1 and len(judge9_ln) < 2 and len(judge8_ln) > 2 and state_abbr != "NH":3309 judge9_ln = judges_AL[0]3310 judge9_vote = 13311 del judges_AL[0]3312 if len(judges_AL) >= 1 and len(judge6_ln) < 2 and state_abbr != "NH":3313 judge6_ln = judges_AL[0]3314 judge6_vote = 13315 del judges_AL[0]3316 if len(judges_AL) >= 1 and len(judge7_ln) < 2 and len(judge6_ln) > 2 and state_abbr != "NH":3317 judge7_ln = judges_AL[0]3318 judge7_vote = 13319 del judges_AL[0]3320 if len(judges_AL) >= 1 and len(judge8_ln) < 2 and len(judge7_ln) > 2 and state_abbr != "NH":3321 judge8_ln = judges_AL[0]3322 judge8_vote = 13323 del judges_AL[0]3324 if len(judges_AL) >= 1 and len(judge9_ln) < 2 and len(judge8_ln) > 2 and state_abbr != "NH":3325 judge9_ln = judges_AL[0]3326 judge9_vote = 13327 del judges_AL[0]3328 #Move over dissenting judges to remove blank cells3329 if(dissent_author_1 == ""):3330 dissent_author_1 = dissent_author_23331 dissent_author_2 = dissent_author_33332 dissent_author_3 = dissent_author_43333 dissent_author_4 = dissent_author_53334 if(dissent_author_2 == ""):3335 dissent_author_2 = dissent_author_33336 dissent_author_3 = dissent_author_43337 dissent_author_4 = dissent_author_53338 if(dissent_author_3 == ""):3339 dissent_author_3 = dissent_author_43340 dissent_author_4 = dissent_author_53341 if(dissent_author_4 == ""):3342 dissent_author_4 = dissent_author_53343 #Remove remaining duplicate dissenting authors3344 if dissent_author_5 == dissent_author_1 or dissent_author_5 == dissent_author_2 or dissent_author_5 == dissent_author_3 or dissent_author_5 == dissent_author_4:3345 dissent_author_5 = ""3346 if dissent_author_4 == dissent_author_1 or dissent_author_4 == dissent_author_2 or dissent_author_4 == dissent_author_3:3347 dissent_author_4 = ""3348 if dissent_author_3 == dissent_author_1 or dissent_author_3 == dissent_author_2:3349 dissent_author_3 = ""3350 if dissent_author_2 == dissent_author_1:3351 dissent_author_2 = ""3352 #Correct dissent_no3353 if dissent_author_1 != "":3354 num_dissent = 13355 if dissent_author_2 != "":3356 num_dissent = 23357 if dissent_author_3 != "":3358 num_dissent = 33359 if dissent_author_4 != "":3360 num_dissent = 43361 if dissent_author_5 != "":3362 num_dissent = 53363 if len(dissent_author_1) < 2:3364 num_dissent = 03365 # Pull in judge codes from state master file by matching state abbrevation, justice name, and time in office3366 if judge1_code == "":3367 with open(mydir + "States_MasterFile_Import.csv", "rb") as f:3368 reader = csv.reader(f)3369 next(f)3370 for row in reader:3371 state = row[0]3372 name = row[3]3373 if len(row[4]) == 4 and row[0] != "MC":3374 row[4] = "1/1/" + row[4]3375 if len(row[5]) == 4 and row[0] != "MC":3376 row[5] = "1/1/" + row[5]3377 if len(row[4]) != 4 and row[0] != "MC":3378 start = datetime.datetime.strptime(row[4], '%m/%d/%Y').date()3379 end = datetime.datetime.strptime(row[5], '%m/%d/%Y').date()3380 #Format justice last names from each file to ensure accurate matching3381 if (Capitalize(lastname(row[7])) == Capitalize(judge1_ln) or Capitalize(lastname(row[3])) == Capitalize(judge1_ln)) and judge1_code == "" and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge1_ln) > 1 and start <= date_format <= (end + one_month):3382 judge1_code = row[1]3383 if (Capitalize(lastname(row[7])) == Capitalize(judge2_ln) or Capitalize(lastname(row[3])) == Capitalize(judge2_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge2_ln) > 1 and start <= date_format <= (end + one_month):3384 judge2_code = row[1]3385 if (Capitalize(lastname(row[7])) == Capitalize(judge3_ln) or Capitalize(lastname(row[3])) == Capitalize(judge3_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge3_ln) > 1 and start <= date_format <= (end + one_month):3386 judge3_code = row[1]3387 if (Capitalize(lastname(row[7])) == Capitalize(judge4_ln) or Capitalize(lastname(row[3])) == Capitalize(judge4_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge4_ln) > 1 and start <= date_format <= (end + one_month):3388 judge4_code = row[1]3389 if (Capitalize(lastname(row[7])) == Capitalize(judge5_ln) or Capitalize(lastname(row[3])) == Capitalize(judge5_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge5_ln) > 1 and start <= date_format <= (end + one_month):3390 judge5_code = row[1]3391 if (Capitalize(lastname(row[7])) == Capitalize(judge6_ln) or Capitalize(lastname(row[3])) == Capitalize(judge6_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge6_ln) > 1 and start <= date_format <= (end + one_month):3392 judge6_code = row[1]3393 if (Capitalize(lastname(row[7])) == Capitalize(judge7_ln) or Capitalize(lastname(row[3])) == Capitalize(judge7_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge7_ln) > 1 and start <= date_format <= (end + one_month):3394 judge7_code = row[1]3395 if (Capitalize(lastname(row[7])) == Capitalize(judge8_ln) or Capitalize(lastname(row[3])) == Capitalize(judge8_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge8_ln) > 1 and start <= date_format <= (end + one_month):3396 judge8_code = row[1]3397 if (Capitalize(lastname(row[7])) == Capitalize(judge9_ln) or Capitalize(lastname(row[3])) == Capitalize(judge9_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge9_ln) > 1 and start <= date_format <= (end + one_month):3398 judge9_code = row[1]3399 if (Capitalize(lastname(row[7])) == Capitalize(judge10_ln) or Capitalize(lastname(row[3])) == Capitalize(judge10_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge10_ln) > 1 and start <= date_format <= (end + one_month):3400 judge10_code = row[1]3401 if (Capitalize(lastname(row[7])) == Capitalize(judge11_ln) or Capitalize(lastname(row[3])) == Capitalize(judge11_ln)) and (row[0] == state_abbr or state_abbr == "OK" or state_abbr == "TX") and len(judge11_ln) > 1 and start <= date_format <= (end + one_month):3402 judge11_code = row[1]3403 # Store "Did not match" if a justice did not match to a justice code3404 if judge1_code == "" and len(judge1_ln) > 2:3405 judge1_code = "Did not match"3406 if judge2_code == "" and len(judge2_ln) > 2:3407 judge2_code = "Did not match"3408 if judge3_code == "" and len(judge3_ln) > 2:3409 judge3_code = "Did not match"3410 if judge4_code == "" and len(judge4_ln) > 2:3411 judge4_code = "Did not match"3412 if judge5_code == "" and len(judge5_ln) > 2:3413 judge5_code = "Did not match"3414 if judge6_code == "" and len(judge6_ln) > 2:3415 judge6_code = "Did not match"3416 if judge7_code == "" and len(judge7_ln) > 2:3417 judge7_code = "Did not match"3418 if judge8_code == "" and len(judge8_ln) > 2:3419 judge8_code = "Did not match"3420 if judge9_code == "" and len(judge9_ln) > 2:3421 judge9_code = "Did not match"3422 if judge10_code == "" and len(judge10_ln) > 2:3423 judge10_code = "Did not match"3424 if judge11_code == "" and len(judge11_ln) > 2:3425 judge11_code = "Did not match"3426 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln3427 if (judge1_ln == judge_np1 or judge1_ln == judge_np2 or judge1_ln == judge_np3 or judge1_ln == judge_np4):3428 judge1_ln = ""3429 judge1_vote = ""3430 judge1_code = ""3431 if (judge2_ln == judge_np1 or judge2_ln == judge_np2 or judge2_ln == judge_np3 or judge2_ln == judge_np4):3432 judge2_ln = ""3433 judge2_vote = ""3434 judge2_code = ""3435 if (judge3_ln == judge_np1 or judge3_ln == judge_np2 or judge3_ln == judge_np3 or judge3_ln == judge_np4):3436 judge3_ln = ""3437 judge3_vote = ""3438 judge3_code = ""3439 if (judge4_ln == judge_np1 or judge4_ln == judge_np2 or judge4_ln == judge_np3 or judge4_ln == judge_np4):3440 judge4_ln = ""3441 judge4_vote = ""3442 judge4_code = ""3443 if (judge5_ln == judge_np1 or judge5_ln == judge_np2 or judge5_ln == judge_np3 or judge5_ln == judge_np4):3444 judge5_ln = ""3445 judge5_vote = ""3446 judge5_code = ""3447 if (judge6_ln == judge_np1 or judge6_ln == judge_np2 or judge6_ln == judge_np3 or judge6_ln == judge_np4):3448 judge6_ln = ""3449 judge6_vote = ""3450 judge6_code = ""3451 if (judge7_ln == judge_np1 or judge7_ln == judge_np2 or judge7_ln == judge_np3 or judge7_ln == judge_np4):3452 judge7_ln = ""3453 judge7_vote = ""3454 judge7_code = ""3455 if (judge8_ln == judge_np1 or judge8_ln == judge_np2 or judge8_ln == judge_np3 or judge8_ln == judge_np4):3456 judge8_ln = ""3457 judge8_vote = ""3458 judge8_code = ""3459 if (judge9_ln == judge_np1 or judge9_ln == judge_np2 or judge9_ln == judge_np3 or judge9_ln == judge_np4):3460 judge9_ln = ""3461 judge9_vote = ""3462 judge9_code = ""3463 if (judge10_ln == judge_np1 or judge10_ln == judge_np2 or judge10_ln == judge_np3 or judge10_ln == judge_np4):3464 judge10_ln = ""3465 judge10_vote = ""3466 judge10_code = ""3467 if (judge11_ln == judge_np1 or judge11_ln == judge_np2 or judge11_ln == judge_np3 or judge11_ln == judge_np4 ):3468 judge11_ln = ""3469 judge11_vote = ""3470 judge11_code = ""3471 if judge5_ln == judge2_ln or judge5_ln == judge1_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln:3472 judge5_ln = ""3473 judge5_vote = ""3474 judge5_code = ""3475 if judge6_ln == judge2_ln or judge6_ln == judge1_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln:3476 judge6_ln = ""3477 judge6_vote = ""3478 judge6_code = ""3479 if len(judge10_ln) < 2:3480 judge10_ln = judge11_ln3481 judge10_vote = judge11_vote3482 judge10_code = judge11_code3483 judge11_ln = ""3484 judge11_vote = ""3485 judge11_code = ""3486 if len(judge7_ln) < 2:3487 judge7_ln = judge8_ln3488 judge7_vote = judge8_vote3489 judge7_code = judge8_code3490 judge8_ln = judge9_ln3491 judge8_vote = judge9_vote3492 judge8_code = judge9_code3493 judge9_ln = judge10_ln3494 judge9_vote = judge10_vote3495 judge9_code = judge10_code3496 judge10_ln = judge11_ln3497 judge10_vote = judge11_vote3498 judge10_code = judge11_code3499 #Correct participating judges string3500 part_judges = judge1_ln + ", " + judge2_ln + ", " + judge3_ln + ", " + judge4_ln + ", " + judge5_ln + ", " + judge6_ln + ", " + judge7_ln + ", " + judge8_ln + ", " + judge9_ln + ", " + judge10_ln + ", " + judge11_ln3501 part_judges = re.sub(' ,', '', part_judges)3502 part_judges = part_judges.rstrip(', ').upper()3503 #print(part_judges)3504 judge1_ln = judge1_ln.upper()3505 judge2_ln = judge2_ln.upper()3506 judge3_ln = judge3_ln.upper()3507 judge4_ln = judge4_ln.upper()3508 judge5_ln = judge5_ln.upper()3509 judge6_ln = judge6_ln.upper()3510 judge7_ln = judge7_ln.upper()3511 judge8_ln = judge8_ln.upper()3512 judge9_ln = judge9_ln.upper()3513 judge10_ln = judge10_ln.upper()3514 judge11_ln = judge11_ln.upper()3515 if judge5_ln == judge2_ln or judge5_ln == judge1_ln or judge5_ln == judge3_ln or judge5_ln == judge4_ln:3516 judge5_ln = ""3517 judge5_vote = ""3518 judge5_code = ""3519 if judge6_ln == judge2_ln or judge6_ln == judge1_ln or judge6_ln == judge3_ln or judge6_ln == judge4_ln or judge6_ln == judge5_ln:3520 judge6_ln = ""3521 judge6_vote = ""3522 judge6_code = ""3523 if judge2_ln == judge6_ln:3524 judge6_ln = ""3525 judge6_vote = ""3526 judge6_code = ""3527 if len(judge4_ln) < 2:3528 judge4_ln = judge5_ln3529 judge5_ln = judge6_ln3530 judge6_ln = judge7_ln3531 judge7_ln = judge8_ln3532 judge8_ln = judge9_ln3533 judge9_ln = judge10_ln3534 judge4_vote = judge5_vote3535 judge5_vote = judge6_vote3536 judge6_vote = judge7_vote3537 judge7_vote = judge8_vote3538 judge8_vote = judge9_vote3539 judge9_vote = judge10_vote3540 judge4_code = judge5_code3541 judge5_code = judge6_code3542 judge6_code = judge7_code3543 judge7_code = judge8_code3544 judge8_code = judge9_code3545 judge9_code = judge10_code3546 if len(judge4_ln) < 2:3547 judge4_ln = judge5_ln3548 judge5_ln = judge6_ln3549 judge6_ln = judge7_ln3550 judge7_ln = judge8_ln3551 judge8_ln = judge9_ln3552 judge9_ln = judge10_ln3553 judge4_vote = judge5_vote3554 judge5_vote = judge6_vote3555 judge6_vote = judge7_vote3556 judge7_vote = judge8_vote3557 judge8_vote = judge9_vote3558 judge9_vote = judge10_vote3559 judge4_code = judge5_code3560 judge5_code = judge6_code3561 judge6_code = judge7_code3562 judge7_code = judge8_code3563 judge8_code = judge9_code3564 judge9_code = judge10_code3565 if len(judge5_ln) < 2:3566 judge5_ln = judge6_ln3567 judge6_ln = judge7_ln3568 judge7_ln = judge8_ln3569 judge8_ln = judge9_ln3570 judge9_ln = judge10_ln3571 judge5_vote = judge6_vote3572 judge6_vote = judge7_vote3573 judge7_vote = judge8_vote3574 judge8_vote = judge9_vote3575 judge9_vote = judge10_vote3576 judge5_code = judge6_code3577 judge6_code = judge7_code3578 judge7_code = judge8_code3579 judge8_code = judge9_code3580 judge9_code = judge10_code3581 if len(judge1_ln) < 2:3582 judge1_ln = judge2_ln3583 judge2_ln = judge3_ln3584 judge3_ln = judge4_ln3585 judge4_ln = judge5_ln3586 judge5_ln = judge6_ln3587 judge6_ln = judge7_ln3588 judge7_ln = judge8_ln3589 judge8_ln = judge9_ln3590 judge9_ln = judge10_ln3591 judge1_vote = judge2_vote3592 judge2_vote = judge3_vote3593 judge3_vote = judge4_vote3594 judge4_vote = judge5_vote3595 judge5_vote = judge6_vote3596 judge6_vote = judge7_vote3597 judge7_vote = judge8_vote3598 judge8_vote = judge9_vote3599 judge9_vote = judge10_vote3600 judge1_code = judge2_code3601 judge2_code = judge3_code3602 judge3_code = judge4_code3603 judge4_code = judge5_code3604 judge5_code = judge6_code3605 judge6_code = judge7_code3606 judge7_code = judge8_code3607 judge8_code = judge9_code3608 judge9_code = judge10_code3609 if len(judge3_ln) < 2:3610 judge3_ln = judge4_ln3611 judge4_ln = judge5_ln3612 judge5_ln = judge6_ln3613 judge6_ln = judge7_ln3614 judge7_ln = judge8_ln3615 judge8_ln = judge9_ln3616 judge9_ln = judge10_ln3617 judge3_vote = judge4_vote3618 judge4_vote = judge5_vote3619 judge5_vote = judge6_vote3620 judge6_vote = judge7_vote3621 judge7_vote = judge8_vote3622 judge8_vote = judge9_vote3623 judge9_vote = judge10_vote3624 judge3_code = judge4_code3625 judge4_code = judge5_code3626 judge5_code = judge6_code3627 judge6_code = judge7_code3628 judge7_code = judge8_code3629 judge8_code = judge9_code3630 judge9_code = judge10_code3631 if len(judge5_ln) < 2:3632 judge5_ln = judge6_ln3633 judge6_ln = judge7_ln3634 judge7_ln = judge8_ln3635 judge8_ln = judge9_ln3636 judge9_ln = judge10_ln3637 judge5_vote = judge6_vote3638 judge6_vote = judge7_vote3639 judge7_vote = judge8_vote3640 judge8_vote = judge9_vote3641 judge9_vote = judge10_vote3642 judge5_code = judge6_code3643 judge6_code = judge7_code3644 judge7_code = judge8_code3645 judge8_code = judge9_code3646 judge9_code = judge10_code3647 if judge9_ln == judge8_ln or judge9_ln == judge7_ln or judge9_ln == judge6_ln or judge9_ln == judge5_ln or judge9_ln == judge4_ln or judge9_ln == judge3_ln or judge9_ln == judge2_ln or judge9_ln == judge1_ln:3648 judge9_ln = ""3649 judge9_vote = ""3650 judge9_code = ""3651 if judge8_ln == judge7_ln or judge8_ln == judge6_ln or judge8_ln == judge5_ln or judge8_ln == judge4_ln or judge8_ln == judge3_ln or judge8_ln == judge2_ln or judge8_ln == judge1_ln:3652 judge8_ln = ""3653 judge8_vote = ""3654 judge8_code = ""3655 if judge7_ln == judge6_ln or judge7_ln == judge5_ln or judge7_ln == judge4_ln or judge7_ln == judge3_ln or judge7_ln == judge2_ln or judge7_ln == judge1_ln:3656 judge7_ln = ""3657 judge7_vote = ""3658 judge7_code = ""3659 if judge6_ln == judge2_ln:3660 judge6_ln = ""3661 judge6_vote = ""3662 judge6_code = ""3663 if judge5_ln == judge4_ln:3664 judge5_ln = ""3665 judge5_vote = ""3666 judge5_code = ""3667 #print judge1_ln, judge2_ln, judge3_ln, judge4_ln, judge5_ln, judge6_ln, judge7_ln3668 if len(judge5_ln) < 2:3669 judge5_ln = judge6_ln3670 judge6_ln = judge7_ln3671 judge7_ln = judge8_ln3672 judge8_ln = judge9_ln3673 judge9_ln = judge10_ln3674 judge5_vote = judge6_vote3675 judge6_vote = judge7_vote3676 judge7_vote = judge8_vote3677 judge8_vote = judge9_vote3678 judge9_vote = judge10_vote3679 judge5_code = judge6_code3680 judge6_code = judge7_code3681 judge7_code = judge8_code3682 judge8_code = judge9_code3683 judge9_code = judge10_code3684 if len(judge6_ln) < 2:3685 judge6_ln = judge7_ln3686 judge7_ln = judge8_ln3687 judge8_ln = judge9_ln3688 judge9_ln = judge10_ln3689 judge6_vote = judge7_vote3690 judge7_vote = judge8_vote3691 judge8_vote = judge9_vote3692 judge9_vote = judge10_vote3693 judge6_code = judge7_code3694 judge7_code = judge8_code3695 judge8_code = judge9_code3696 judge9_code = judge10_code3697 if len(judge2_ln) < 2:3698 judge2_ln = judge3_ln3699 judge3_ln = judge4_ln3700 judge4_ln = judge5_ln3701 judge5_ln = judge6_ln3702 judge6_ln = judge7_ln3703 judge7_ln = judge8_ln3704 judge8_ln = judge9_ln3705 judge9_ln = judge10_ln3706 judge2_vote = judge3_vote3707 judge3_vote = judge4_vote3708 judge4_vote = judge5_vote3709 judge5_vote = judge6_vote3710 judge6_vote = judge7_vote3711 judge7_vote = judge8_vote3712 judge8_vote = judge9_vote3713 judge9_vote = judge10_vote3714 judge2_code = judge3_code3715 judge3_code = judge4_code3716 judge4_code = judge5_code3717 judge5_code = judge6_code3718 judge6_code = judge7_code3719 judge7_code = judge8_code3720 judge8_code = judge9_code3721 judge9_code = judge10_code3722 if len(judge1_ln) < 2:3723 judge1_ln = judge2_ln3724 judge2_ln = judge3_ln3725 judge3_ln = judge4_ln3726 judge4_ln = judge5_ln3727 judge5_ln = judge6_ln3728 judge6_ln = judge7_ln3729 judge7_ln = judge8_ln3730 judge8_ln = judge9_ln3731 judge9_ln = judge10_ln3732 judge1_vote = judge2_vote3733 judge2_vote = judge3_vote3734 judge3_vote = judge4_vote3735 judge4_vote = judge5_vote3736 judge5_vote = judge6_vote3737 judge6_vote = judge7_vote3738 judge7_vote = judge8_vote3739 judge8_vote = judge9_vote3740 judge9_vote = judge10_vote3741 judge1_code = judge2_code3742 judge2_code = judge3_code3743 judge3_code = judge4_code3744 judge4_code = judge5_code3745 judge5_code = judge6_code3746 judge6_code = judge7_code3747 judge7_code = judge8_code3748 judge8_code = judge9_code3749 judge9_code = judge10_code3750 if len(judge8_ln) < 2:3751 judge8_ln = judge9_ln3752 judge9_ln = judge10_ln3753 judge10_ln = judge11_ln3754 judge8_vote = judge9_vote3755 judge9_vote = judge10_vote3756 judge10_vote = judge11_vote3757 judge8_code = judge9_code3758 judge9_code = judge10_code3759 judge10_code = judge11_code3760 if len(judge7_ln) < 2:3761 judge7_ln = judge8_ln3762 judge8_ln = judge9_ln3763 judge9_ln = judge10_ln3764 judge10_ln = judge11_ln3765 judge7_vote = judge8_vote3766 judge8_vote = judge9_vote3767 judge9_vote = judge10_vote3768 judge10_vote = judge11_vote3769 judge7_code = judge8_code3770 judge8_code = judge9_code3771 judge9_code = judge10_code3772 judge10_code = judge11_code3773 if judge6_ln == "":3774 judge6_ln = judge7_ln3775 judge7_ln = judge8_ln3776 judge8_ln = judge9_ln3777 judge9_ln = judge10_ln3778 judge6_vote = judge7_vote3779 judge7_vote = judge8_vote3780 judge8_vote = judge9_vote3781 judge9_vote = judge10_vote3782 judge6_code = judge7_code3783 judge7_code = judge8_code3784 judge8_code = judge9_code3785 judge9_code = judge10_code3786 if judge4_ln == "":3787 judge4_ln = judge5_ln3788 judge5_ln = judge6_ln3789 judge6_ln = judge7_ln3790 judge7_ln = judge8_ln3791 judge8_ln = judge9_ln3792 judge9_ln = judge10_ln3793 judge4_vote = judge5_vote3794 judge5_vote = judge6_vote3795 judge6_vote = judge7_vote3796 judge7_vote = judge8_vote3797 judge8_vote = judge9_vote3798 judge9_vote = judge10_vote3799 judge4_code = judge5_code3800 judge5_code = judge6_code3801 judge6_code = judge7_code3802 judge7_code = judge8_code3803 judge8_code = judge9_code3804 judge9_code = judge10_code3805 if judge5_ln == judge4_ln:3806 judge5_ln = judge6_ln3807 judge5_vote = judge6_vote3808 judge5_code = judge6_code3809 judge6_ln = judge7_ln3810 judge6_vote = judge7_vote3811 judge6_code = judge7_code3812 judge7_ln = judge8_ln3813 judge7_vote = judge8_vote3814 judge7_code = judge8_code3815 judge8_ln = judge9_ln3816 judge8_vote = judge9_vote3817 judge8_code = judge9_code3818 judge9_ln = judge10_ln3819 judge9_vote = judge10_vote3820 judge9_code = judge10_code3821 if state_abbr == "CA" or state_abbr == "IL" or state_abbr == "PA" or state_abbr == "FL" or state_abbr == "KY" or state_abbr == "LA" or state_abbr == "ME" or state_abbr == "OH" or state_abbr == "CT" or state_abbr == "MD" or state_abbr == "MI" or state_abbr == "CO" or state_abbr == "GA" or state_abbr == "IA" or state_abbr == "MO" or state_abbr == "NE" or state_abbr == "NJ" or state_abbr == "NY" or state_abbr == "NC" or state_abbr == "OH" or state_abbr == "WI" or state_abbr == "AZ" or state_abbr == "AR" or state_abbr == "MT":3822 judge8_ln = ""3823 judge8_code = ""3824 judge8_vote = ""3825 judge9_ln = ""3826 judge9_code = ""3827 judge9_vote = ""3828 if state_abbr == "ND" or state_abbr == "RI" or state_abbr == "VT" or state_abbr == "SC" or state_abbr == "UT" or state_abbr == "WY" or state_abbr == "HI":3829 judge6_ln = ""3830 judge6_vote = ""3831 judge6_code = ""3832 judge7_ln = ""3833 judge7_vote = ""3834 judge7_code = ""3835 judge8_ln = ""3836 judge8_vote = ""3837 judge8_code = ""3838 if state_abbr == "MS" or state_abbr == "OK-SC" or state_abbr == "WA":3839 judge10_ln = ""3840 judge10_vote = ""3841 judge10_code = ""3842 judge11_ln = ""3843 judge11_vote = ""3844 judge11_code = ""3845 if len(dissent_by_string) > 2:3846 dissent_by_string = dissent_by_string + " " + str(other_dissent_holder)3847 if len(dissent_by_string) < 2:3848 dissent_by_string = dissent_by_string + str(other_dissent_holder)3849 dissent_by_string = re.sub("\[", "", dissent_by_string)3850 dissent_by_string = re.sub("\]", "", dissent_by_string)3851 dissent_by_string = re.sub("'", "", dissent_by_string)3852 if state_abbr == "ID":3853 panel = 03854 # For each case, write a row to the .csv file which contains the desired variables.3855 localrow = []3856 localrow.append("mjn15@psu.edu")3857 localrow.append(Lexis_cite)3858 localrow.append(entry)3859 localrow.append(court_string)3860 localrow.append(new_date)3861 localrow.append(state_abbr)3862 localrow.append(panel)3863 localrow.append(parties_string)3864 localrow.append(docketnum)3865 localrow.append(cite_string)3866 localrow.append(Lexis_cite)3867 localrow.append(West_cite)3868 localrow.append(attorney_string)3869 localrow.append(part_judges)3870 localrow.append(judges_np)3871 localrow.append(judge1_ln)3872 localrow.append(judge1_vote)3873 localrow.append(judge1_code)3874 localrow.append(judge2_ln)3875 localrow.append(judge2_vote)3876 localrow.append(judge2_code)3877 localrow.append(judge3_ln)3878 localrow.append(judge3_vote)3879 localrow.append(judge3_code)3880 localrow.append(judge4_ln)3881 localrow.append(judge4_vote)3882 localrow.append(judge4_code)3883 localrow.append(judge5_ln)3884 localrow.append(judge5_vote)3885 localrow.append(judge5_code)3886 localrow.append(judge6_ln)3887 localrow.append(judge6_vote)3888 localrow.append(judge6_code)3889 localrow.append(judge7_ln)3890 localrow.append(judge7_vote)3891 localrow.append(judge7_code)3892 localrow.append(judge8_ln)3893 localrow.append(judge8_vote)3894 localrow.append(judge8_code)3895 localrow.append(judge9_ln)3896 localrow.append(judge9_vote)3897 localrow.append(judge9_code)3898 localrow.append(judge10_ln)3899 localrow.append(judge10_vote)3900 localrow.append(judge10_code)3901 localrow.append(judge11_ln)3902 localrow.append(judge11_vote)3903 localrow.append(judge11_code)3904 localrow.append(dissent)3905 localrow.append(num_dissent)3906 localrow.append(dissent_by_string.upper())3907 localrow.append(dissent_author_1.upper())3908 localrow.append(dissent_author_2.upper())3909 localrow.append(dissent_author_3.upper())3910 localrow.append(dissent_author_4.upper())3911 localrow.append(dissent_author_5.upper())3912 localrow.append(concur)3913 localrow.append(num_concur)3914 localrow.append(concur_by_string.upper())3915 localrow.append(check_recuse_case)3916 if check_recuse == False:3917 outfilehandle.writerow(localrow)3918 if check_recuse == True:3919 recuse_handle.writerow(localrow)3920 check_recuse = False3921# Finish writing to the .csv file and close it so the process is complete3922infilehandle.close()3923check.close()3924fout.close()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Nose2 automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful