bluenevus commited on
Commit
78d4d47
·
verified ·
1 Parent(s): 0060666

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -21
app.py CHANGED
@@ -30,13 +30,13 @@ pink_review_document = None
30
  # Document types and their descriptions
31
  document_types = {
32
  "Shred": "Generate a requirements outline of the Project Work Statement (PWS) identified by action words like shall, will, perform etc.",
33
- "Pink": "Create a Pink Team document based on the PWS outline",
34
- "Pink Review": "Evaluate compliance of the Pink Team document",
35
- "Red": "Generate a Red Team document based on the P.Review",
36
- "Red Review": "Evaluate compliance of the Red Team document",
37
- "Gold": "Create a Pink Team document based on the PWS outline",
38
- "Gold Review": "Perform a final compliance review",
39
- "Compliance Check": "Perform a final compliance review",
40
  "LOE": "Generate a Level of Effort (LOE) breakdown as a spreadsheet"
41
  }
42
 
@@ -79,9 +79,8 @@ app.layout = dbc.Container([
79
  dcc.Loading(
80
  id="loading-indicator",
81
  type="dot",
82
- children=[html.Div(id="loading-output")]
83
  ),
84
- html.Div(id='document-preview', className="border p-3 mb-3"),
85
  dbc.Button("Download Document", id="btn-download", color="success", className="mt-3"),
86
  dcc.Download(id="download-document"),
87
  html.Hr(),
@@ -184,6 +183,25 @@ Instructions:
184
  2. Use proper formatting and structure.
185
  3. Include all necessary sections and details.
186
  4. Start the output immediately with the document content.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  Now, generate the {document_type}:
188
  """
189
 
@@ -192,8 +210,7 @@ Now, generate the {document_type}:
192
 
193
  @app.callback(
194
  Output('document-preview', 'children'),
195
- Output('loading-output', 'children'),
196
- Output('status-bar', 'children', allow_duplicate=True),
197
  Output('pink-review-upload', 'style'),
198
  [Input(f'btn-{doc_type.lower().replace("_", "-")}', 'n_clicks') for doc_type in document_types.keys()],
199
  State('pink-review-file-name', 'children'),
@@ -209,27 +226,27 @@ def generate_document_preview(*args):
209
  pink_review_file = args[-1]
210
 
211
  if not uploaded_files and document_type != "Shred":
212
- return html.Div("Please upload and shred a document first."), "", "Please upload and shred a document first.", {'display': 'none'}
213
 
214
  if document_type == "Shred":
215
  if not uploaded_files:
216
- return html.Div("Please upload a document before shredding."), "", "Please upload a document before shredding.", {'display': 'none'}
217
  file_contents = list(uploaded_files.values())
218
  try:
219
  shredded_document = generate_document(document_type, file_contents)
220
- return dcc.Markdown(shredded_document), f"{document_type} generated", "Document shredded. You can now proceed with other operations.", {'display': 'none'}
221
  except Exception as e:
222
  print(f"Error generating document: {str(e)}")
223
- return html.Div(f"Error generating document: {str(e)}"), "Error", "An error occurred while shredding the document.", {'display': 'none'}
224
 
225
  if shredded_document is None:
226
- return html.Div("Please shred a document first."), "", "Please shred a document first.", {'display': 'none'}
227
 
228
  if document_type == "Pink Review":
229
- return html.Div("Please upload a Pink Team document or use the generated one."), "", "Please upload a Pink Team document or use the generated one.", {'display': 'block'}
230
 
231
  if document_type in ["Red", "Red Review"] and pink_review_document is None:
232
- return html.Div("Please complete Pink Review first."), "", "Please complete Pink Review first.", {'display': 'none'}
233
 
234
  try:
235
  if document_type == "Pink Review" and pink_review_file:
@@ -242,11 +259,11 @@ def generate_document_preview(*args):
242
  if document_type == "Pink Review":
243
  pink_review_document = current_document
244
 
245
- return dcc.Markdown(current_document), f"{document_type} generated", f"{document_type} document generated successfully.", {'display': 'none'}
246
  except Exception as e:
247
  print(f"Error generating document: {str(e)}")
248
- return html.Div(f"Error generating document: {str(e)}"), "Error", "An error occurred while generating the document.", {'display': 'none'}
249
-
250
  @app.callback(
251
  Output('pink-review-file-name', 'children'),
252
  Input('upload-pink-review', 'contents'),
 
30
  # Document types and their descriptions
31
  document_types = {
32
  "Shred": "Generate a requirements outline of the Project Work Statement (PWS) identified by action words like shall, will, perform etc.",
33
+ "Pink": "Create a Pink Team document based on the PWS outline. Your goal is to be compliant and compelling.",
34
+ "Pink Review": "Evaluate compliance of the Pink Team document against the requirements and output a spreadsheet of non compliant findings by pws number, the goal of that pws section, what made it non compliant and your recommendations for recovery",
35
+ "Red": "Produce a Red Team document based on the Pink Review by pws sections. Your goal is to be compliant and compelling by recovering all the findings in Pink Review",
36
+ "Red Review": "Evaluate compliance of the Red Team document against the requirements and output a spreadsheet of non compliant findings by pws number, the goal of that pws section, what made it non compliant and your recommendations for recovery",
37
+ "Gold": "Create a Pink Team document based on the PWS response by pws sections. Your goal is to be compliant and compelling by recovering all the findings in Red Review",
38
+ "Gold Review": "Perform a final compliance review against the requirements and output a spreadsheet of non compliant findings by pws number, the goal of that pws section, what made it non compliant and your recommendations for recovery",
39
+ "Virtual Board": "Based on the requirements and in particular the evaulation criteria, you will evaluate the proposal as if you were a contracting office and provide section by section evaluation as unsatisfactory, satisfactory, good, very good, excellent and why in a spreadsheet",
40
  "LOE": "Generate a Level of Effort (LOE) breakdown as a spreadsheet"
41
  }
42
 
 
79
  dcc.Loading(
80
  id="loading-indicator",
81
  type="dot",
82
+ children=[html.Div(id="document-preview", className="border p-3 mb-3")]
83
  ),
 
84
  dbc.Button("Download Document", id="btn-download", color="success", className="mt-3"),
85
  dcc.Download(id="download-document"),
86
  html.Hr(),
 
183
  2. Use proper formatting and structure.
184
  3. Include all necessary sections and details.
185
  4. Start the output immediately with the document content.
186
+ 5. Your goal is to be compliant based on the
187
+ requrements, write in paragraph in active voice as
188
+ MicroHealth, limit bullets, answer the
189
+ requirement with what MicroHealth will do
190
+ to satisfy the requirement, the technical
191
+ approach with innovation for efficiency,
192
+ productivity, quality and measurable
193
+ outcomes, the industry standard that
194
+ methodology is based on if applicable,
195
+ detail the workflow or steps to accomplish
196
+ the requirement with labor categories that
197
+ will do those tasks in that workflow,
198
+ reference reputable research like gartner,
199
+ forrester, IDC, Deloitte, Accenture etc
200
+ with measures of success and substantiation
201
+ of MicroHealth's approach. Never use soft words
202
+ like maybe, could be, should, possible be definitive in your language and confident.
203
+ 6. you must also take into account section L&M of the document which is the evaluation criteria
204
+ to be sure we address them.
205
  Now, generate the {document_type}:
206
  """
207
 
 
210
 
211
  @app.callback(
212
  Output('document-preview', 'children'),
213
+ Output('status-bar', 'children'),
 
214
  Output('pink-review-upload', 'style'),
215
  [Input(f'btn-{doc_type.lower().replace("_", "-")}', 'n_clicks') for doc_type in document_types.keys()],
216
  State('pink-review-file-name', 'children'),
 
226
  pink_review_file = args[-1]
227
 
228
  if not uploaded_files and document_type != "Shred":
229
+ return html.Div("Please upload and shred a document first."), "Please upload and shred a document first.", {'display': 'none'}
230
 
231
  if document_type == "Shred":
232
  if not uploaded_files:
233
+ return html.Div("Please upload a document before shredding."), "Please upload a document before shredding.", {'display': 'none'}
234
  file_contents = list(uploaded_files.values())
235
  try:
236
  shredded_document = generate_document(document_type, file_contents)
237
+ return dcc.Markdown(shredded_document), "Document shredded. You can now proceed with other operations.", {'display': 'none'}
238
  except Exception as e:
239
  print(f"Error generating document: {str(e)}")
240
+ return html.Div(f"Error generating document: {str(e)}"), "An error occurred while shredding the document.", {'display': 'none'}
241
 
242
  if shredded_document is None:
243
+ return html.Div("Please shred a document first."), "Please shred a document first.", {'display': 'none'}
244
 
245
  if document_type == "Pink Review":
246
+ return html.Div("Please upload a Pink Team document or use the generated one."), "Please upload a Pink Team document or use the generated one.", {'display': 'block'}
247
 
248
  if document_type in ["Red", "Red Review"] and pink_review_document is None:
249
+ return html.Div("Please complete Pink Review first."), "Please complete Pink Review first.", {'display': 'none'}
250
 
251
  try:
252
  if document_type == "Pink Review" and pink_review_file:
 
259
  if document_type == "Pink Review":
260
  pink_review_document = current_document
261
 
262
+ return dcc.Markdown(current_document), f"{document_type} document generated successfully.", {'display': 'none'}
263
  except Exception as e:
264
  print(f"Error generating document: {str(e)}")
265
+ return html.Div(f"Error generating document: {str(e)}"), "An error occurred while generating the document.", {'display': 'none'}
266
+
267
  @app.callback(
268
  Output('pink-review-file-name', 'children'),
269
  Input('upload-pink-review', 'contents'),