Spaces:
Sleeping
Sleeping
Update pdf_generator.py
Browse files- pdf_generator.py +56 -15
pdf_generator.py
CHANGED
@@ -121,14 +121,22 @@ def process_workload_scope(session_state, styles):
|
|
121 |
story = []
|
122 |
answers = session_state.answers['workload_scope']
|
123 |
|
124 |
-
story.append(Paragraph("
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
story.append(Paragraph("
|
131 |
-
story.append(Paragraph(answers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
return story
|
134 |
|
@@ -136,19 +144,52 @@ def process_useful_assets(session_state, styles):
|
|
136 |
story = []
|
137 |
answers = session_state.answers['useful_assets']
|
138 |
|
139 |
-
story.append(Paragraph("
|
140 |
-
for
|
141 |
-
story.append(Paragraph(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
return story
|
144 |
|
145 |
def process_pilot_evaluation(session_state, styles):
|
146 |
story = []
|
147 |
-
answers = session_state.answers['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
return story
|
154 |
|
|
|
121 |
story = []
|
122 |
answers = session_state.answers['workload_scope']
|
123 |
|
124 |
+
story.append(Paragraph("Feature Prioritization", styles['Heading2']))
|
125 |
+
for i, feature in enumerate(answers['feature_prioritization']):
|
126 |
+
lines = feature.split('\n')
|
127 |
+
for line in lines:
|
128 |
+
story.append(Paragraph(f"<b>Feature {i+1}</b>: {line}", styles['Answer']))
|
129 |
+
|
130 |
+
# story.append(Paragraph("Preferred Start Period", styles['Heading2']))
|
131 |
+
# story.append(Paragraph(str(answers['preferred_start_period']), styles['Answer']))
|
132 |
+
story.append(Paragraph("Preferred Start Period", styles['Heading2']))
|
133 |
+
story.append(Paragraph(f"<b>{answers['preferred_start_period'][0]}</b> - <b>{answers['preferred_start_period'][1]}</b>", styles['Answer']))
|
134 |
+
|
135 |
+
story.append(Paragraph("Team Composition", styles['Heading2']))
|
136 |
+
for team_member in ['partner', 'ibm']:
|
137 |
+
lines = answers['team_composition'][team_member].split('\n')
|
138 |
+
for line in lines:
|
139 |
+
story.append(Paragraph(f"<b>{team_member.capitalize()}</b>: {line}", styles['Answer']))
|
140 |
|
141 |
return story
|
142 |
|
|
|
144 |
story = []
|
145 |
answers = session_state.answers['useful_assets']
|
146 |
|
147 |
+
story.append(Paragraph("Solution Elements", styles['Heading2']))
|
148 |
+
for element in answers['solution_elements']:
|
149 |
+
story.append(Paragraph(element, styles['Answer']))
|
150 |
+
|
151 |
+
story.append(Paragraph("IBM Software", styles['Heading2']))
|
152 |
+
for software in answers['ibm_software']:
|
153 |
+
story.append(Paragraph(software, styles['Answer']))
|
154 |
+
|
155 |
+
story.append(Paragraph("Open Source Supports", styles['Heading2']))
|
156 |
+
for support in answers['open_source_supports']:
|
157 |
+
story.append(Paragraph(support, styles['Answer']))
|
158 |
|
159 |
return story
|
160 |
|
161 |
def process_pilot_evaluation(session_state, styles):
|
162 |
story = []
|
163 |
+
answers = session_state.answers['useful_assets']
|
164 |
+
|
165 |
+
story.extend(process_validation_criteria(answers, styles))
|
166 |
+
|
167 |
+
return story
|
168 |
+
|
169 |
+
def process_validation_criteria(session_state, styles):
|
170 |
+
story = []
|
171 |
|
172 |
+
# Qualitative Criteria
|
173 |
+
story.append(Paragraph("Qualitative Criteria:", styles['Heading2']))
|
174 |
+
for i, criterion in enumerate(session_state.get('qualitative', [])):
|
175 |
+
description = session_state.get(f'qual_desc_{i}', '')
|
176 |
+
story.append(Paragraph(f"<b>{criterion}</b>: <font face='Helvetica' size=11 color='#350863'>{description}</font>", styles['Answer']))
|
177 |
+
|
178 |
+
# Quantitative Criteria
|
179 |
+
story.append(Paragraph("Quantitative Criteria:", styles['Heading2']))
|
180 |
+
for i, criterion in enumerate(session_state.get('quantitative', [])):
|
181 |
+
parsed = parse_quantitative_criteria(criterion)
|
182 |
+
if parsed:
|
183 |
+
name, min_val, max_val, is_percentage, is_integer = parsed
|
184 |
+
value = session_state.get(f'quant_value_{i}', min_val)
|
185 |
+
|
186 |
+
if is_percentage:
|
187 |
+
slider = SliderFlowable(name, value*100, min_val*100, max_val*100, is_percentage=True)
|
188 |
+
else:
|
189 |
+
slider = SliderFlowable(name, value, min_val, max_val, is_percentage=False)
|
190 |
+
|
191 |
+
story.append(slider)
|
192 |
+
story.append(Paragraph(f"<b>{name}</b>: {value:.2f}", styles['Answer']))
|
193 |
|
194 |
return story
|
195 |
|