| 1 |
ninoborges |
8 |
"""
|
| 2 |
|
|
|
| 3 |
|
|
ConcordanceHelperTools.py
|
| 4 |
|
|
|
| 5 |
|
|
Created by
|
| 6 |
|
|
Emanuel Borges
|
| 7 |
|
|
|
| 8 |
|
|
This is a collection of Concordance helper tools, things like Enumerate Databases. This is really any
|
| 9 |
|
|
tool that doesnt fully connect to the actual database but instead just does things on the outside. This
|
| 10 |
|
|
will just be called as a library of methods.
|
| 11 |
|
|
|
| 12 |
|
|
"""
|
| 13 |
|
|
|
| 14 |
|
|
import os
|
| 15 |
|
|
|
| 16 |
|
|
def EnumerateConcordanceDatabases(dirName, filesInDir):
|
| 17 |
|
|
databasesList = []
|
| 18 |
|
|
for file in filesInDir:
|
| 19 |
|
|
if os.path.isfile(os.path.join(dirName, file)):
|
| 20 |
|
|
if os.path.splitext(file)[1].upper() == '.DCB':
|
| 21 |
|
|
if os.path.splitext(file)[0][-6:].upper() == '-NOTES':
|
| 22 |
|
|
pass
|
| 23 |
|
|
elif os.path.splitext(file)[0][-9:].upper() == '-REDLINES':
|
| 24 |
|
|
pass
|
| 25 |
|
|
else:
|
| 26 |
|
|
databasesList.append(file)
|
| 27 |
|
|
return databasesList
|
| 28 |
|
|
|
| 29 |
|
|
|
| 30 |
|
|
def ParseClientMatter(clientMatterNumber):
|
| 31 |
|
|
"""This method will parse a client matter number and give you the path on the DIS. xxxxxx-xxxx"""
|
| 32 |
|
|
fullPath = None
|
| 33 |
|
|
if len(clientMatterNumber) == 11:
|
| 34 |
|
|
secondaryServerList = ['07','08','09']
|
| 35 |
|
|
if clientMatterNumber[:2] in secondaryServerList:
|
| 36 |
|
|
serverShare = r"\\lisdisdss01\ConcordanceII"
|
| 37 |
|
|
else:
|
| 38 |
|
|
serverShare = r"\\lisdisdss01\ERCDIS06\E\Data\Concordance"
|
| 39 |
|
|
cliMatPath = os.path.join(clientMatterNumber[:2],clientMatterNumber[:3], clientMatterNumber[1:6]+clientMatterNumber[8:11])
|
| 40 |
|
|
fullPath = os.path.join(serverShare,cliMatPath)
|
| 41 |
|
|
else:
|
| 42 |
nino.borges |
744 |
print("ERROR! Client matter number not valid. Must be a full number.")
|
| 43 |
ninoborges |
8 |
return fullPath
|
| 44 |
|
|
|
| 45 |
|
|
def ParseClientMatterRemote(clientMatterNumber):
|
| 46 |
|
|
"""This method will parse a client matter number and return the relative path for either Concordance
|
| 47 |
|
|
or Relativity on the LN system"""
|
| 48 |
|
|
relativePath = None
|
| 49 |
|
|
if len(clientMatterNumber) == 11:
|
| 50 |
|
|
cliMatPath = os.path.join(clientMatterNumber[:2],clientMatterNumber[:3], clientMatterNumber[:6]+clientMatterNumber[7:11])
|
| 51 |
|
|
#print cliMatPath
|
| 52 |
|
|
relativePath = cliMatPath
|
| 53 |
|
|
else:
|
| 54 |
nino.borges |
744 |
print("ERROR! Client matter number not valid. Must be a full number.")
|
| 55 |
ninoborges |
8 |
return relativePath |