| 1 |
|
| 2 |
"""
|
| 3 |
|
| 4 |
RelativitySearchReport_UI
|
| 5 |
|
| 6 |
Created by:
|
| 7 |
Emanuel Borges
|
| 8 |
05.25.2025
|
| 9 |
|
| 10 |
UI for the program that creates the Relativity Saved Search Report.
|
| 11 |
|
| 12 |
"""
|
| 13 |
|
| 14 |
import wx
|
| 15 |
import os
|
| 16 |
import wx.lib.agw.pybusyinfo as PBI
|
| 17 |
import RelativitySearchReport
|
| 18 |
|
| 19 |
version = '1.0'
|
| 20 |
|
| 21 |
class MyFrame(wx.Frame):
|
| 22 |
def __init__(self, parent, ID, title, pos=wx.DefaultPosition):
|
| 23 |
wx.Frame.__init__(self, parent, ID, title, pos, size=(700, 300))
|
| 24 |
self.panel = wx.Panel(self, -1)
|
| 25 |
|
| 26 |
self.serviceProviders = ["Lighthouse", "Consillio"]
|
| 27 |
self.workspaceOptions = {
|
| 28 |
"Lighthouse": ["AT&T - Project Shiny_Review", "AT&T - Project Vermont_Review"],
|
| 29 |
"Consillio": ["A01056-AI-FTC v Amazon Retail Litigation - Review", "H53611 - Amazon - FTC CID Review","H55278 - Amazon - FTC - CA AG US"]
|
| 30 |
}
|
| 31 |
|
| 32 |
self.serviceProviderSiteLookupMatrix = {"Lighthouse":"https://relativity4.lighthouseglobal.com/Relativity/",
|
| 33 |
"Consillio":"https://relmtp003.consilio.com/Relativity/"}
|
| 34 |
self.artifactIdLookupMatrix = {"AT&T - Project Shiny_Review":"1267840",
|
| 35 |
"AT&T - Project Vermont_Review":"1530226",
|
| 36 |
"A01056-AI-FTC v Amazon Retail Litigation - Review":"146939220",
|
| 37 |
"H53611 - Amazon - FTC CID Review":"3274606",
|
| 38 |
"H55278 - Amazon - FTC - CA AG US":"4424598"}
|
| 39 |
|
| 40 |
self.CreateMenuBar()
|
| 41 |
self.CreateControls()
|
| 42 |
self.CreateButtons()
|
| 43 |
|
| 44 |
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
| 45 |
mainSizer.Add(self.controlsSizer, 0, wx.ALL | wx.CENTER, 30)
|
| 46 |
mainSizer.Add(self.filePicker, 0, wx.ALL | wx.EXPAND, 20)
|
| 47 |
mainSizer.Add(self.buttonSizer, 0, wx.ALL | wx.CENTER, 10)
|
| 48 |
|
| 49 |
self.panel.SetSizer(mainSizer)
|
| 50 |
self.CreateStatusBar()
|
| 51 |
self.SetStatusText("Ready.")
|
| 52 |
|
| 53 |
self.okButton.Disable()
|
| 54 |
|
| 55 |
|
| 56 |
def MenuData(self):
|
| 57 |
return(("&File",),
|
| 58 |
("&Help",
|
| 59 |
("&About","Displays the About window.", self.OnAbout)))
|
| 60 |
|
| 61 |
def NothingYet(self, event):
|
| 62 |
diag = wx.MessageDialog(self, "Nothing here yet!", "Coming Soon ...", wx.OK | wx.ICON_INFORMATION)
|
| 63 |
diag.ShowModal()
|
| 64 |
diag.Destroy()
|
| 65 |
|
| 66 |
def OnAbout(self, event):
|
| 67 |
diag = wx.MessageDialog(self, "This program was written for Redgrave LLP by Emanuel 'Manny' Borges. To report a bug or request a new feature, please email eborges@redgravellp.com", "About Information", wx.OK | wx.ICON_INFORMATION)
|
| 68 |
diag.ShowModal()
|
| 69 |
diag.Destroy()
|
| 70 |
|
| 71 |
|
| 72 |
def CreateMenuBar(self):
|
| 73 |
menuBar = wx.MenuBar()
|
| 74 |
for eachMenuData in self.MenuData():
|
| 75 |
menuLabel = eachMenuData[0]
|
| 76 |
menuItems = eachMenuData[1:]
|
| 77 |
menuBar.Append(self.CreateMenu(menuItems), menuLabel)
|
| 78 |
self.SetMenuBar(menuBar)
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
def CreateMenu(self, menuData):
|
| 83 |
menu = wx.Menu()
|
| 84 |
for eachLabel, eachStatus, eachHandler in menuData:
|
| 85 |
if not eachLabel:
|
| 86 |
menu.AppendSeparator()
|
| 87 |
continue
|
| 88 |
menuItem = menu.Append(-1, eachLabel, eachStatus)
|
| 89 |
self.Bind(wx.EVT_MENU, eachHandler, menuItem)
|
| 90 |
return menu
|
| 91 |
|
| 92 |
def CreateControls(self):
|
| 93 |
self.controlsSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 94 |
|
| 95 |
self.serviceProviderLabel = wx.StaticText(self.panel, label="Service Provider")
|
| 96 |
self.serviceProviderChoice = wx.Choice(self.panel, choices=self.serviceProviders)
|
| 97 |
self.serviceProviderChoice.Bind(wx.EVT_CHOICE, self.OnServiceProviderSelected)
|
| 98 |
|
| 99 |
self.workspaceLabel = wx.StaticText(self.panel, label="Workspace")
|
| 100 |
self.workspaceChoice = wx.Choice(self.panel, choices=[])
|
| 101 |
self.workspaceChoice.Bind(wx.EVT_CHOICE, self.OnAnySelectionChanged)
|
| 102 |
|
| 103 |
self.controlsSizer.Add(self.serviceProviderLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
|
| 104 |
self.controlsSizer.Add(self.serviceProviderChoice, 0, wx.RIGHT, 80)
|
| 105 |
self.controlsSizer.Add(self.workspaceLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)
|
| 106 |
self.controlsSizer.Add(self.workspaceChoice, 0)
|
| 107 |
|
| 108 |
self.filePicker = wx.FilePickerCtrl(self.panel, message="Select a CSV file", wildcard="CSV files (*.csv)|*.csv")
|
| 109 |
self.filePicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnAnySelectionChanged)
|
| 110 |
|
| 111 |
def CreateButtons(self):
|
| 112 |
self.okButton = wx.Button(self.panel, -1, "Ok")
|
| 113 |
self.cancelButton = wx.Button(self.panel, -1, "Cancel")
|
| 114 |
|
| 115 |
self.okButton.Bind(wx.EVT_BUTTON, self.OnProcess)
|
| 116 |
self.cancelButton.Bind(wx.EVT_BUTTON, self.CloseWindow)
|
| 117 |
|
| 118 |
self.buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
|
| 119 |
self.buttonSizer.Add(self.okButton, 0, wx.ALL, 10)
|
| 120 |
self.buttonSizer.Add(self.cancelButton, 0, wx.ALL, 10)
|
| 121 |
|
| 122 |
def OnServiceProviderSelected(self, event):
|
| 123 |
selected_provider = self.serviceProviderChoice.GetStringSelection()
|
| 124 |
self.workspaceChoice.Set(self.workspaceOptions.get(selected_provider, []))
|
| 125 |
self.workspaceChoice.SetSelection(wx.NOT_FOUND)
|
| 126 |
self.OnAnySelectionChanged(None)
|
| 127 |
|
| 128 |
def OnAnySelectionChanged(self, event):
|
| 129 |
service_selected = self.serviceProviderChoice.GetSelection() != wx.NOT_FOUND
|
| 130 |
workspace_selected = self.workspaceChoice.GetSelection() != wx.NOT_FOUND
|
| 131 |
file_selected = bool(self.filePicker.GetPath())
|
| 132 |
if service_selected and workspace_selected and file_selected:
|
| 133 |
self.okButton.Enable()
|
| 134 |
else:
|
| 135 |
self.okButton.Disable()
|
| 136 |
|
| 137 |
def OnProcess(self, event):
|
| 138 |
message = "Writing Excel Report..."
|
| 139 |
busy = PBI.PyBusyInfo(message, parent=None, title="System Busy: Please Wait.")
|
| 140 |
rawReportFile = self.filePicker.GetPath()
|
| 141 |
outputFilename = os.path.splitext(rawReportFile)[0] + "_REPORT.XLSX"
|
| 142 |
relativityInstancePath = self.serviceProviderSiteLookupMatrix[self.serviceProviderChoice.GetStringSelection()]
|
| 143 |
workspaceArtifactID = self.artifactIdLookupMatrix[self.workspaceChoice.GetStringSelection()]
|
| 144 |
RelativitySearchReport.GenerateSearchReport(rawReportFile, outputFilename, relativityInstancePath, workspaceArtifactID)
|
| 145 |
print(f"Service Provider: {self.serviceProviderChoice.GetStringSelection()}")
|
| 146 |
print(f"Workspace: {self.workspaceChoice.GetStringSelection()}")
|
| 147 |
print(f"CSV File: {self.filePicker.GetPath()}")
|
| 148 |
del busy
|
| 149 |
diag = wx.MessageDialog(self, f"The Relativity search report has been created and saved to:\n{outputFilename}", "About Information", wx.OK | wx.ICON_INFORMATION)
|
| 150 |
diag.ShowModal()
|
| 151 |
diag.Destroy()
|
| 152 |
self.Close(True)
|
| 153 |
|
| 154 |
def CloseWindow(self, event):
|
| 155 |
self.Close(True)
|
| 156 |
|
| 157 |
|
| 158 |
class MyApp(wx.App):
|
| 159 |
def OnInit(self):
|
| 160 |
self.frame = MyFrame(None, -1, f"Relativity Search Report Creator v {version}")
|
| 161 |
self.frame.Show(True)
|
| 162 |
self.SetTopWindow(self.frame)
|
| 163 |
return True
|
| 164 |
|
| 165 |
|
| 166 |
if __name__ == '__main__':
|
| 167 |
app = MyApp(0)
|
| 168 |
app.MainLoop()
|
| 169 |
|
| 170 |
|