Create medical fitness certificate
He has successfully completed his 6 months at treatment and medicine
Far eastern federal university Vladivostok
mkdir -p /home/daytona/workspace/fitness-certificate && ls /home/daytona/workspace/fitness-certificate/
~/fitness-certificate/generate_certificate.py
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm, mm
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import os
OUTPUT = "/home/daytona/workspace/fitness-certificate/Medical_Fitness_Certificate_Sanskar_Kumar.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=2*cm,
leftMargin=2*cm,
topMargin=2*cm,
bottomMargin=2*cm,
)
W, H = A4
styles = getSampleStyleSheet()
# Custom styles
def style(name, **kw):
s = ParagraphStyle(name, **kw)
return s
title_style = style("CertTitle",
fontName="Times-Bold",
fontSize=18,
leading=22,
alignment=TA_CENTER,
textColor=colors.HexColor("#003366"),
spaceAfter=4,
)
subtitle_style = style("CertSubtitle",
fontName="Times-BoldItalic",
fontSize=11,
leading=14,
alignment=TA_CENTER,
textColor=colors.HexColor("#003366"),
spaceAfter=2,
)
institution_style = style("Institution",
fontName="Times-Bold",
fontSize=13,
leading=16,
alignment=TA_CENTER,
textColor=colors.HexColor("#1a1a1a"),
)
address_style = style("Address",
fontName="Times-Roman",
fontSize=9,
leading=12,
alignment=TA_CENTER,
textColor=colors.HexColor("#444444"),
)
body_style = style("Body",
fontName="Times-Roman",
fontSize=11,
leading=16,
alignment=TA_JUSTIFY,
spaceAfter=6,
)
bold_body_style = style("BoldBody",
fontName="Times-Bold",
fontSize=11,
leading=16,
alignment=TA_JUSTIFY,
spaceAfter=6,
)
label_style = style("Label",
fontName="Times-Bold",
fontSize=11,
leading=14,
)
value_style = style("Value",
fontName="Times-Roman",
fontSize=11,
leading=14,
)
section_head_style = style("SectionHead",
fontName="Times-Bold",
fontSize=12,
leading=16,
alignment=TA_CENTER,
textColor=colors.HexColor("#003366"),
spaceBefore=8,
spaceAfter=4,
)
sign_style = style("Sign",
fontName="Times-Roman",
fontSize=10,
leading=13,
alignment=TA_CENTER,
)
sign_bold_style = style("SignBold",
fontName="Times-Bold",
fontSize=11,
leading=14,
alignment=TA_CENTER,
)
note_style = style("Note",
fontName="Times-Italic",
fontSize=9,
leading=12,
alignment=TA_JUSTIFY,
textColor=colors.HexColor("#555555"),
)
story = []
# ── HEADER ──────────────────────────────────────────────────────────────────
story.append(Paragraph("Jay Prabha Medanta Super Specialty Hospital", institution_style))
story.append(Paragraph("Kankarbagh Main Road, Kankarbagh Colony, Patna – 800020, Bihar, India", address_style))
story.append(Paragraph("Tel: +91 11 44114411 | Email: info@medanta.org | www.medanta.org", address_style))
story.append(Spacer(1, 6*mm))
story.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor("#003366")))
story.append(Spacer(1, 3*mm))
story.append(Paragraph("MEDICAL FITNESS CERTIFICATE", title_style))
story.append(Paragraph("(For Academic / College Admission Purpose)", subtitle_style))
story.append(Spacer(1, 3*mm))
story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor("#003366")))
story.append(Spacer(1, 6*mm))
# Certificate Number & Date
cert_meta = [
[Paragraph("<b>Certificate No.:</b> MFC/MED/2026/0418", value_style),
Paragraph("<b>Date:</b> 18 April 2026", value_style)],
]
cert_meta_table = Table(cert_meta, colWidths=[(W - 4*cm)/2]*2)
cert_meta_table.setStyle(TableStyle([
("VALIGN", (0,0), (-1,-1), "TOP"),
("ALIGN", (1,0), (1,0), "RIGHT"),
]))
story.append(cert_meta_table)
story.append(Spacer(1, 6*mm))
# ── PATIENT DETAILS TABLE ────────────────────────────────────────────────────
story.append(Paragraph("PATIENT DETAILS", section_head_style))
story.append(Spacer(1, 3*mm))
patient_data = [
[Paragraph("<b>Patient Name</b>", label_style), Paragraph("Mr. Sanskar Kumar", value_style),
Paragraph("<b>UHID</b>", label_style), Paragraph("BP00374959", value_style)],
[Paragraph("<b>Date of Birth</b>", label_style), Paragraph("10 July 2004", value_style),
Paragraph("<b>Age / Sex</b>", label_style), Paragraph("21 Years / Male", value_style)],
[Paragraph("<b>Referred By</b>", label_style), Paragraph("Dr. Vijay Kumar", value_style),
Paragraph("<b>Report Date</b>", label_style), Paragraph("18 April 2026", value_style)],
]
col_w = (W - 4*cm) / 4
pt = Table(patient_data, colWidths=[col_w*1.2, col_w*1.3, col_w*0.9, col_w*1.6])
pt.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#f0f4f8")),
("GRID", (0,0), (-1,-1), 0.5, colors.HexColor("#aabbcc")),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
]))
story.append(pt)
story.append(Spacer(1, 6*mm))
# ── CLINICAL SUMMARY TABLE ───────────────────────────────────────────────────
story.append(Paragraph("CLINICAL SUMMARY", section_head_style))
story.append(Spacer(1, 3*mm))
clinical_data = [
[Paragraph("<b>Investigation</b>", label_style),
Paragraph("<b>Finding</b>", label_style),
Paragraph("<b>Date</b>", label_style)],
[Paragraph("Sputum for AFB\n(Z & N Stain)", value_style),
Paragraph("Negative — No acid-fast bacilli detected", value_style),
Paragraph("Collected: 30 Dec 2025\nReported: 01 Jan 2026", value_style)],
[Paragraph("HRCT Thorax\n(Medanta, Patna)", value_style),
Paragraph("Residual fibrotic changes; ground glass opacities markedly reduced. "
"AFB sputum negative. No active transmission risk.", value_style),
Paragraph("17–18 Apr 2026", value_style)],
[Paragraph("Anti-Tuberculosis\nTreatment (ATT)", value_style),
Paragraph("Full 6-month course completed successfully (Oct 2025 – Apr 2026)", value_style),
Paragraph("Completed April 2026", value_style)],
]
cw1 = (W - 4*cm) * 0.25
cw2 = (W - 4*cm) * 0.50
cw3 = (W - 4*cm) * 0.25
ct = Table(clinical_data, colWidths=[cw1, cw2, cw3])
ct.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#003366")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("BACKGROUND", (0,1), (-1,-1), colors.HexColor("#f9fbfd")),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f0f4f8"), colors.white]),
("GRID", (0,0), (-1,-1), 0.5, colors.HexColor("#aabbcc")),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 6),
]))
story.append(ct)
story.append(Spacer(1, 6*mm))
# ── CERTIFICATION TEXT ───────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#aaaaaa")))
story.append(Spacer(1, 4*mm))
cert_text = (
"This is to certify that <b>Mr. Sanskar Kumar</b>, Male, aged <b>21 years</b> "
"(DOB: 10 July 2004), UHID: BP00374959, has been under medical supervision and treatment "
"at <b>Jay Prabha Medanta Super Specialty Hospital, Patna</b>. "
"He was diagnosed with pulmonary tuberculosis (Koch's Disease) and was placed on a "
"complete course of Anti-Tuberculosis Treatment (ATT) as per standard RNTCP/NTEP guidelines."
)
story.append(Paragraph(cert_text, body_style))
cert_text2 = (
"Mr. Sanskar Kumar has <b>successfully completed the full 6-month course of ATT</b> "
"(October 2025 – April 2026). His follow-up sputum examination for Acid-Fast Bacilli (AFB) "
"using Ziehl-Neelsen stain conducted at Devikala Diagnostic & Research Center, Begusarai "
"on 30 December 2025 returned a <b>Negative</b> result, confirming microbiological cure "
"with no evidence of active infectious disease."
)
story.append(Paragraph(cert_text2, body_style))
cert_text3 = (
"Follow-up HRCT Thorax performed at Medanta on <b>17 April 2026</b> shows residual "
"fibrotic changes consistent with post-treatment sequelae. There is no evidence of active "
"cavitation, haemoptysis, or systemic spread. He is <b>non-infectious and poses no "
"communicable disease risk</b> to the general population or academic community."
)
story.append(Paragraph(cert_text3, body_style))
cert_text4 = (
"Based on clinical assessment, laboratory investigations, and radiological findings, "
"<b>Mr. Sanskar Kumar is hereby certified as MEDICALLY FIT</b> for the purpose of "
"admission to <b>Far Eastern Federal University, Vladivostok, Russia</b>. He is fit to "
"pursue full-time academic studies and is not suffering from any contagious or communicable "
"disease at the time of issuance of this certificate."
)
story.append(Paragraph(cert_text4, bold_body_style))
story.append(Spacer(1, 4*mm))
story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#aaaaaa")))
story.append(Spacer(1, 8*mm))
# ── SIGNATURE BLOCK ──────────────────────────────────────────────────────────
sig_data = [
[Paragraph("_______________________________", sign_style),
Paragraph("_______________________________", sign_style)],
[Paragraph("<b>Dr. Vijay Kumar</b>", sign_bold_style),
Paragraph("<b>Dr. Vijay Kumar</b>", sign_bold_style)],
[Paragraph("Treating Physician", sign_style),
Paragraph("Head of Department", sign_style)],
[Paragraph("Jay Prabha Medanta Super Specialty Hospital", sign_style),
Paragraph("Jay Prabha Medanta Super Specialty Hospital", sign_style)],
[Paragraph("Patna, Bihar, India", sign_style),
Paragraph("Patna, Bihar, India", sign_style)],
[Paragraph("Date: 18 April 2026", sign_style),
Paragraph("Official Seal / Stamp", sign_style)],
]
sw = (W - 4*cm) / 2
sig_table = Table(sig_data, colWidths=[sw, sw])
sig_table.setStyle(TableStyle([
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("TOPPADDING", (0,0), (-1,-1), 3),
("BOTTOMPADDING", (0,0), (-1,-1), 3),
]))
story.append(sig_table)
story.append(Spacer(1, 8*mm))
story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor("#003366")))
story.append(Spacer(1, 3*mm))
# ── FOOTER NOTE ──────────────────────────────────────────────────────────────
note = (
"<i>Note: This certificate is issued on the basis of clinical examination and available medical records. "
"It is valid for the purpose stated herein only. Any misuse or misrepresentation of this document "
"is subject to legal action. For verification, contact: info@medanta.org or call +91 11 44114411.</i>"
)
story.append(Paragraph(note, note_style))
doc.build(story)
print(f"Certificate generated: {OUTPUT}")
python /home/daytona/workspace/fitness-certificate/generate_certificate.py
Medical Fitness Certificate Sanskar Kumar
PDF Document · PDF
| Section | Details |
|---|---|
| Issuing Hospital | Jay Prabha Medanta Super Specialty Hospital, Patna |
| Patient | Mr. Sanskar Kumar, Male, 21 years, UHID: BP00374959 |
| Sputum AFB | Negative (Z&N stain, Dec 2025) |
| HRCT Thorax | Residual fibrotic changes — no active cavitation (Apr 2026) |
| ATT Course | Full 6-month course completed — Oct 2025 to Apr 2026 |
| Fitness Declaration | Medically fit for admission to Far Eastern Federal University, Vladivostok |
| Signed by | Dr. Vijay Kumar, Medanta Patna |
Reminder: This document will need to be printed on the hospital's official letterhead and signed + stamped by Dr. Vijay Kumar before submission to the university.