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: 572
Committed: Wed Feb 4 20:32:48 2015 UTC (11 years, 1 month ago) by nino.borges
Content type: text/x-python
File size: 17506 byte(s)
Log Message:
Added support for picking the html file.

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