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: 574
Committed: Thu Feb 5 02:46:39 2015 UTC (11 years, 1 month ago) by nino.borges
Content type: text/x-python
File size: 18031 byte(s)
Log Message:
Updated to also report the date on the html page.

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