| 1 |
nino.borges |
624 |
"""
|
| 2 |
|
|
|
| 3 |
|
|
LitTechHelperTools.py
|
| 4 |
|
|
|
| 5 |
|
|
Created by
|
| 6 |
|
|
Emanuel Borges
|
| 7 |
|
|
|
| 8 |
|
|
This is a collection of generic litigation technology tools, like taking
|
| 9 |
|
|
begimage and begattach and making a dict.
|
| 10 |
|
|
|
| 11 |
|
|
"""
|
| 12 |
|
|
|
| 13 |
|
|
import os
|
| 14 |
|
|
|
| 15 |
|
|
def FamilyToDict(dbExport):
|
| 16 |
|
|
"""Takes an export of bates and begattach and makes a dir. should be pipe delimited and no quotes"""
|
| 17 |
|
|
## Returns a dict where the parent is the key and the first value in the list (but only if its in the document)
|
| 18 |
|
|
familyDict = {}
|
| 19 |
|
|
for line in dbExport:
|
| 20 |
|
|
line = line.replace("\n","")
|
| 21 |
|
|
bates,begAttach = line.split("|")
|
| 22 |
|
|
if bates == begAttach:
|
| 23 |
|
|
## Im a parent
|
| 24 |
nino.borges |
744 |
if bates in list(familyDict.keys()):
|
| 25 |
nino.borges |
624 |
pass
|
| 26 |
|
|
else:
|
| 27 |
|
|
familyDict[bates] = [bates,]
|
| 28 |
|
|
else:
|
| 29 |
|
|
## Im a child
|
| 30 |
nino.borges |
744 |
if begAttach in list(familyDict.keys()):
|
| 31 |
nino.borges |
624 |
familyDict[begAttach].append(bates)
|
| 32 |
|
|
else:
|
| 33 |
|
|
## I removed this line vecause there will be times where the parent is missing from the export
|
| 34 |
|
|
#familyDict[begAttach] = [begAttach,bates]
|
| 35 |
|
|
familyDict[begAttach] = [bates,]
|
| 36 |
|
|
return familyDict
|
| 37 |
|
|
|
| 38 |
|
|
|
| 39 |
|
|
|