| from fpdf import FPDF |
| import qrcode |
| import os |
| from io import BytesIO |
|
|
| class OMNIPDF_V7(FPDF): |
| def __init__(self): |
| super().__init__() |
| self.font_path = "static/AbyssinicaSIL.ttf" |
| |
| def generate_clinical_report(self, analysis_text, report_id): |
| self.add_page() |
| qr = qrcode.QRCode(box_size=10, border=2) |
| qr.add_data(f"https://verify.abyssinia.ai/v7/{report_id}") |
| qr.make(fit=True) |
| qr_img = qr.make_image(fill_color="black", back_color="white") |
| qr_buffer = BytesIO() |
| qr_img.save(qr_buffer, format="PNG") |
| qr_buffer.seek(0) |
| |
| self.image(qr_buffer, x=175, y=10, w=25) |
| self.set_font("helvetica", "B", 16) |
| self.cell(0, 10, "Abyssinia Intelligence | Version 7", ln=True) |
| self.set_font("helvetica", "", 10) |
| self.cell(0, 5, f"Blockchain-Verified ID: {report_id}", ln=True) |
| self.ln(10) |
| |
| if os.path.exists(self.font_path): |
| self.add_font("Abyssinica", style="", fname=self.font_path) |
| self.set_font("Abyssinica", size=11) |
| |
| self.multi_cell(0, 8, analysis_text) |
| |
| self.set_y(-30) |
| self.set_font("helvetica", "I", 8) |
| self.cell(0, 5, "V7 Agentic Verification: FHIR R4 Compliant", align="C", ln=True) |
| return bytes(self.output(dest='S')) |