Fix 3 deliverable bugs: PDF env catalogue, business case, drawio diagram

- oci_pdf_gen.py: add_environment_catalogue now auto-detects new schema
  (name/sizing/cost_pct) vs legacy (environment/tier/databases/ocpus),
  same fix as oci_deck_gen.py. Also normalizes cost_notes string to list.
- business-case-spec.yaml: created PharmaCorp spec (was using MELI).
  Fixed schema: risks as {migration_risks, do_nothing_risks}, roadmap
  as {phases, total_duration}, recommendation as {summary, next_steps}.
- diagram-spec.yaml: rewrote to match generator format
  (tenancy.regions[].vcns[].subnets[].services[] with explicit IDs).
  Now generates 231 cells, 11 containers, 15 services, 10 connections.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
root
2026-04-13 00:21:26 -03:00
parent d2b153c5ce
commit b0fcf8d0f3
5 changed files with 190 additions and 21 deletions

View File

@@ -619,20 +619,38 @@ class OCIPDFGenerator:
self._add_bullet_list(items)
def add_environment_catalogue(self, environments: list,
cost_notes: list = None):
cost_notes=None):
"""Environment Catalogue section."""
self._add_section_title("Environment Catalogue")
headers = ["Environment", "Tier", "Databases", "OCPUs", "Isolation"]
rows = [
[e.get("environment", ""), e.get("tier", ""),
e.get("databases", ""), e.get("ocpus", ""),
e.get("isolation", "")]
for e in environments
]
avail = self.PAGE_WIDTH - 2 * self.MARGIN
widths = [avail * 0.16, avail * 0.10, avail * 0.20,
avail * 0.10, avail * 0.44]
# Normalize cost_notes to list
if isinstance(cost_notes, str):
cost_notes = [s.strip() for s in cost_notes.split(".") if s.strip()]
# Detect schema: new (name/sizing/cost_pct) vs legacy (environment/tier/databases/ocpus)
sample = environments[0] if environments else {}
if "sizing" in sample or "cost_pct" in sample:
headers = ["Environment", "Sizing", "Isolation", "Cost %"]
rows = [
[e.get("name", e.get("environment", "")),
e.get("sizing", ""),
e.get("isolation", ""),
f"{e.get('cost_pct', '')}%" if e.get("cost_pct", "") != "" else ""]
for e in environments
]
avail = self.PAGE_WIDTH - 2 * self.MARGIN
widths = [avail * 0.18, avail * 0.40, avail * 0.27, avail * 0.15]
else:
headers = ["Environment", "Tier", "Databases", "OCPUs", "Isolation"]
rows = [
[e.get("environment", ""), e.get("tier", ""),
e.get("databases", ""), e.get("ocpus", ""),
e.get("isolation", "")]
for e in environments
]
avail = self.PAGE_WIDTH - 2 * self.MARGIN
widths = [avail * 0.16, avail * 0.10, avail * 0.20,
avail * 0.10, avail * 0.44]
self.story.append(self._make_table(headers, rows, widths))
if cost_notes: