ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Relativity/HoneywellProjectManager/trunk/HoneywellProjectManager.py
Revision: 571
Committed: Wed Feb 4 16:07:42 2015 UTC (11 years, 1 month ago) by nino.borges
Content type: text/x-python
File size: 17126 byte(s)
Log Message:
A program for working with the HPM.

File Contents

# Content
1 """
2 HoneywellProjectManager
3
4 An application that will augment and automate the HPM. This is also to test the RL lib
5
6
7 Created By
8 Emanuel Borges
9 20140717
10
11 """
12 import RelativityLib
13
14
15 class HPM(object):
16 version = "0.01"
17
18 def __init__(self):
19 ## A matrix with name to Artifact ID
20 ## Dev
21 #self.environment = "Manny_Dev_Environment"
22 #self.assignedToMatrix = {'Manny':1078301}
23 #self.requestorMatrix = {'Jadyn':1078265, 'Krista': 1078266}
24 #self.prodCategory = 1078370
25 #self.taskCategory =
26 #self.caseName = 1078365
27
28
29 ## Production
30 self.environment = "037354-0519 Honeywell Project Management Database"
31 self.assignedToMatrix = {'Manny':1145376, 'Jadyn':1145382,'Krista':1145383,'Sakyung':1145384,'Ashley':1145462,'Stacy':1145463,'Seth':1145464}
32 self.requestorMatrix = {'Jadyn':1145330, 'Krista': 1145331,'Seth':1145501,'Stacy':1145707}
33 self.projectCategoryMatrix = {'Production' :1145404,'Manny_Project':1145403,}
34 self.taskCategoryMatrix = {}
35 self.projectCaseMatrix = {'Perligo':1145401}
36 self.taskCaseMatrix = {'Perligo':1145407}
37 ## Admin|Choices and you added the artifactID to the all choices view, to get artifactIDs above.
38 #self.siteOverride = 'http://www.mcdermottdiscovery.com'
39 #self.passwordOveride = QEst3kU2!
40
41 def CreateProductionEntry(self,prodName,assignedTo,requestor, dueDate, pdfRequested = False):
42 '''Creates the production project and it's default tasks. dates in mm/dd/yyyy format.'''
43 ## Make the Project
44 projObj = RelativityLib.CustomObjectTable(self.environment,'Projects')
45 projPayload = {
46 "Name":prodName,"Description":"Create production set from email request.","Due Date":dueDate, "Case":{"Artifact ID":self.projectCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"}, "Category":{"Artifact ID":self.projectCategoryMatrix['Production'], "Artifact Type Name":"Choice"}
47 }
48 print "Creating project..."
49 projID = projObj.CreateNewItem(projPayload)
50 ## Get the Artifact ID of the project that you just created
51 print "Done."
52
53 ## Make the tasks, using the project artifact ID and the one of the person too.
54 taskObj = RelativityLib.CustomObjectTable(self.environment,'Tasks')
55 taskPayload1 = {
56 "Name":"QC and Verify Production",
57 "Description":"Perform QC of produciton checking for document number, priv screen and sensitivity screen.",
58 "Estimated Billing Time":1,
59 "Due Date":dueDate,
60 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
61 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
62 "Project":{"Artifact ID":int(projID)},
63 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
64 }
65 taskPayload2 = {
66 "Name":"Bates Stamping and Exporting",
67 "Description":"Perform production in Relativity by bates stamping and exporting.",
68 "Estimated Billing Time":1,
69 "Due Date":dueDate,
70 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
71 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
72 "Project":{"Artifact ID":int(projID)},
73 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
74 }
75 taskPayload3 = {
76 "Name":"Image QC",
77 "Description":"Verify image count, file name and bates stamp.",
78 "Estimated Billing Time":1,
79 "Due Date":dueDate,
80 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
81 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
82 "Project":{"Artifact ID":int(projID)},
83 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
84 }
85 taskPayload4 = {
86 "Name":"Transfer Production",
87 "Description":"Transfer production to the Honeywell 17th floor production folder for QC.",
88 "Estimated Billing Time":1,
89 "Due Date":dueDate,
90 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
91 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
92 "Project":{"Artifact ID":int(projID)},
93 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
94 }
95 taskPayload5 = {
96 "Name":"Create Searchable PDF Set",
97 "Description":"Merge all multipage tiffs into 1 PDF and then OCR, to make them searchable PDFs.",
98 "Estimated Billing Time":1,
99 "Due Date":dueDate,
100 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
101 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
102 "Project":{"Artifact ID":int(projID)},
103 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
104 }
105 taskPayload6 = {
106 "Name":"Copy prod beg and end values to reverse date field",
107 "Description":"Copy the prod beg and prod end (The specific ones you created for the production) to the prodbeg<reversedate> and prodend<reversedate> fields, updating the field name to the current date.",
108 "Estimated Billing Time":1,
109 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
110 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
111 "Project":{"Artifact ID":int(projID)},
112 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
113 }
114
115 print "Creating first task..."
116 taskID = taskObj.CreateNewItem(taskPayload1)
117 print "Creating second task..."
118 taskID = taskObj.CreateNewItem(taskPayload2)
119 print "Creating third task..."
120 taskID = taskObj.CreateNewItem(taskPayload3)
121 print "Creating fourth task..."
122 taskID = taskObj.CreateNewItem(taskPayload4)
123 if pdfRequested:
124 print "Creating optional task..."
125 taskID = taskObj.CreateNewItem(taskPayload5)
126 print "Creating final task..."
127 taskID = taskObj.CreateNewItem(taskPayload6)
128 print "All tasks created. Production entry done."
129
130 def CreateNewDocumentLoadEntry(self,loadName,assignedTo,requestor, dueDate):
131 '''Creates the New Documents Loaded project and it's default tasks. dates in mm/dd/yyyy format.'''
132 ## Make the Project
133 projObj = RelativityLib.CustomObjectTable(self.environment,'Projects')
134 projPayload = {
135 "Name":"%s: QC Delivery"%loadName,"Description":"Add New document volumes to datbase and QC.","Due Date":dueDate, "Case":{"Artifact ID":self.projectCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"}, "Category":{"Artifact ID":self.projectCategoryMatrix['Manny_Project'], "Artifact Type Name":"Choice"}
136 }
137 print "Creating project..."
138 projID = projObj.CreateNewItem(projPayload)
139 ## Get the Artifact ID of the project that you just created
140 print "Done."
141
142 ## Make the tasks, using the project artifact ID and the one of the person too.
143 taskObj = RelativityLib.CustomObjectTable(self.environment,'Tasks')
144 taskPayload1 = {
145 "Name":"%s: Verify Doc Counts"%loadName,
146 "Description":"Verify that we received the documents that they said we would receive.",
147 "Estimated Billing Time":1,
148 "Due Date":dueDate,
149 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
150 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
151 "Project":{"Artifact ID":int(projID)},
152 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
153 }
154 taskPayload2 = {
155 "Name":"%s: Verify Page Counts"%loadName,
156 "Description":"Verify that we received the pages that they said we would.",
157 "Estimated Billing Time":1,
158 "Due Date":dueDate,
159 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
160 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
161 "Project":{"Artifact ID":int(projID)},
162 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
163 }
164 taskPayload3 = {
165 "Name":"%s: Test For Missing Images"%loadName,
166 "Description":"Test that Relativity reports no missing images.",
167 "Estimated Billing Time":1,
168 "Due Date":dueDate,
169 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
170 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
171 "Project":{"Artifact ID":int(projID)},
172 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
173 }
174 taskPayload4 = {
175 "Name":"%s: Family Documents Test"%loadName,
176 "Description":"Run a test to determine if there are any missing documents in the families that they gave us.",
177 "Estimated Billing Time":2,
178 "Due Date":dueDate,
179 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
180 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
181 "Project":{"Artifact ID":int(projID)},
182 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
183 }
184 taskPayload5 = {
185 "Name":"%s: Enumerate Values"%loadName,
186 "Description":"Enumerate all new documents and put enumeration in the enumerated values field.",
187 "Estimated Billing Time":2,
188 "Due Date":dueDate,
189 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
190 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
191 "Project":{"Artifact ID":int(projID)},
192 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
193 }
194 taskPayload6 = {
195 "Name":"%s: Copy doc date to doc date new field"%loadName,
196 "Description":"Copy the values in the doc date field to the doc date new field, normalizing the values. If the date field is completely empty, leave it empty.",
197 "Estimated Billing Time":2,
198 "Due Date":dueDate,
199 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
200 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
201 "Project":{"Artifact ID":int(projID)},
202 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
203 }
204 taskPayload7 = {
205 "Name":"%s: Does this fix previous family prob documents"%loadName,
206 "Description":"Run a test to see if these new documents fix any of the old family problem documents.",
207 "Estimated Billing Time":2,
208 "Due Date":dueDate,
209 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
210 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
211 "Project":{"Artifact ID":int(projID)},
212 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
213 }
214 taskPayload8 = {
215 "Name":"%s: Verify that every document has at least 1 bib field filled out."%loadName,
216 "Description":"Run a search to determine if all documents have atleast 1 bib coded field filled out.",
217 "Estimated Billing Time":2,
218 "Due Date":dueDate,
219 "Case":{"Artifact ID":self.taskCaseMatrix ['Perligo'], "Artifact Type Name":"Choice"},
220 "Requestor":{"Artifact ID": int(self.requestorMatrix[requestor]), "Artifact Type Name":"Choice"},
221 "Project":{"Artifact ID":int(projID)},
222 "Assigned To":[{"Artifact ID":self.assignedToMatrix['Manny']}]
223 }
224
225 print "Creating first task..."
226 taskID = taskObj.CreateNewItem(taskPayload1)
227 print "Creating second task..."
228 taskID = taskObj.CreateNewItem(taskPayload2)
229 print "Creating third task..."
230 taskID = taskObj.CreateNewItem(taskPayload3)
231 print "Creating fourth task..."
232 taskID = taskObj.CreateNewItem(taskPayload4)
233 print "Creating fifth task..."
234 taskID = taskObj.CreateNewItem(taskPayload5)
235 print "Creating sixth task..."
236 taskID = taskObj.CreateNewItem(taskPayload6)
237 print "Creating seventh task..."
238 taskID = taskObj.CreateNewItem(taskPayload7)
239 print "Creating final task..."
240 taskID = taskObj.CreateNewItem(taskPayload8)
241 print "All tasks created. Production entry done."
242
243 def CalculateBillTimes(self):
244 '''Connects and for every project, will update teh bill time used field, based on the tasks bill time used'''
245 pass
246 def GetProductionReport(self):
247 """Gathers the report of active productions and exports an html page for the HPM. """
248 productionsID =1145404
249 inProgressID =1145326
250 waitingId =1145327
251 completedID = 1145465
252
253 projObj = RelativityLib.CustomObjectTable(self.environment,'Projects')
254
255 activeList = []
256 activeProductions = projObj.QueryForItems("'Category' == CHOICE %s AND 'Status' == CHOICE %s"% (productionsID,inProgressID))
257 for i in activeProductions:
258 activeList.append(i['Name'])
259
260 waitingList = []
261 waitngProductions = projObj.QueryForItems("'Category' == CHOICE %s AND 'Status' == CHOICE %s"% (productionsID,waitingId))
262 for i in waitngProductions:
263 waitingList.append(i['Name'])
264
265 #completedList = []
266 #completedProductions = projObj.QueryForItems("'Category' == CHOICE %s AND 'Status' == CHOICE %s"% (productionsID,completedID))
267 #for i in completedProductions:
268 # completedList.append(i['Name'])
269
270 #everythingButList = []
271 #everythingButCompleted = projObj.QueryForItems("'Category' == CHOICE %s AND NOT 'Status' == CHOICE %s"% (productionsID,completedID))
272 #for i in everythingButCompleted:
273 # everythingButList.append(i['Name'])
274
275 print "Active List:"
276 for i in activeList:
277 print i
278 print""
279
280 print "Waiting List:"
281 for i in waitingList:
282 print i
283 print""
284
285 htmlTop = """<!DOCTYPE html>
286 <html>
287 <head>
288 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
289 <meta name="description" content="Your description goes here" />
290 <meta name="keywords" content="your,keywords,goes,here" />
291 <meta name="author" content="Emanuel Borges"> <link rel="stylesheet" type="text/css" href="sitesheet.css" title="Honeywell Perligo Request System" media="all" />
292 <title>Honeywell Perligo Request System</title>
293 </head>
294
295 <body>
296 <div class="main">
297 <a name="TOP"></a>
298 <h1><a href="index.html">Honeywell Perligo Request System</a></h1>
299 <h2>For Perligo, HOBX and HBPD requests.</h2>
300
301 <br>
302
303 <div class="menu">
304 <a class="mainbutton" href="index.html">MWE Caseteam</a>
305 <a class="mainbutton" href="TPMRequestsPage.html">TPM</a>
306 <a class="mainbutton" id="selectedbutton" href="Productions.html">Active Productions</a>
307 </div>
308
309 <Br><Br>
310 <hr width="40%"><br>
311 <h2>Document Productions</h2>
312 <br>
313 <table>
314 <Caption>Active Productions</Caption>
315 <tr>
316 <th>Production Name</th><th>Due Date</th><th>Status</th>
317 </tr
318 """
319
320
321 htmlMid = """</table>
322 <br><br><br>
323 <table>
324 <Caption>Non-Active Productions</Caption>
325 <tr>
326 <th>Production Name</th><th>Due Date</th><th>Status</th>
327 </tr
328 """
329 htmlBottom = """ </table>
330 </div>
331 <br><br><br>
332 </body>
333 </html>
334 """
335 print "now creating html file..."
336 outputFile = open("/Users/ninoborges/Dropbox/Misc/Productions2.html",'w')
337 outputFile.write(htmlTop)
338 for i in activeList:
339 outputFile.write("<tr>\n<td>%s</td><td>00/00/0000</td><td>In Progress</td>\n</tr>"%i)
340 outputFile.write(htmlMid)
341 for i in waitingList:
342 outputFile.write("<tr>\n<td>%s</td><td>00/00/0000</td><td>In Progress</td>\n</tr>"%i)
343 outputFile.write(htmlBottom)
344 outputFile.close()
345 print "done."