"""Generate the 9 fictional campus bursary notices (8 PDFs + 1 CSV), source_manifest.csv, and passages.jsonl.""" import csv from pathlib import Path from typing import Dict, List import pymupdf from src.config import ( MANIFESTS_DIR, PASSAGES_PATH, RAW_CSV_DIR, RAW_PDF_DIR, ROOT_DIR, SOURCE_MANIFEST_PATH, ) from src.document_processing.chunker import build_passages_from_sources PERMISSION_NOTE = "Authored original synthetic corpus for CampusDesk AI (CC-BY-4.0, safe to share)" PDF_NOTICES: List[Dict] = [ { "document_id": "N01", "title": "2026 Bursary Application Window and Core Required Documents", "date": "2026-06-01", "version": "1.0", "filename": "N01_application_window_and_documents.pdf", "amends_doc_id": "", "amends_scope": "", "sections": [ ( "1", "Application Window and Closing Date: Applications for the Zaria Institute of Technology " "(ZIT) 2026 Undergraduate Support & Hardship Bursary open on 1 June 2026 and close on " "14 June 2026 at 11:59 PM WAT. Late portal submissions after the closing date are not " "accepted under the regular bursary cycle.", ), ( "2", "Mandatory Documents for All Applicants: Every applicant must attach three mandatory " "documents to their application: (1) a valid ZIT Student ID card, (2) the official " "2025/2026 Session Tuition Fee Receipt issued by the Bursary, and (3) a signed Head " "of Department (HOD) Attestation Letter confirming active departmental registration.", ), ], }, { "document_id": "N02", "title": "Dated Amendment to Bursary Application Closing Date (Notice N01)", "date": "2026-06-08", "version": "1.1", "filename": "N02_amendment_closing_date.pdf", "amends_doc_id": "N01", "amends_scope": "Replaces application closing date (14 June 2026 -> 10 June 2026); required documents in N01 stand.", "sections": [ ( "1", "Amendment to Application Closing Date: Due to early Senate audit scheduling, this " "amendment explicitly replaces the closing date in Notice N01 (14 June 2026) with " "10 June 2026 at 11:59 PM WAT. All other requirements in Notice N01 - specifically the " "valid ZIT Student ID card, the 2025/2026 Tuition Fee Receipt, and the signed HOD " "Attestation Letter - stand unchanged.", ), ], }, { "document_id": "N03", "title": "Undergraduate Bursary Eligibility Criteria and Scholarship Cap", "date": "2026-05-20", "version": "1.0", "filename": "N03_eligibility_criteria.pdf", "amends_doc_id": "", "amends_scope": "", "sections": [ ( "1", "Academic Level and Study Mode Eligibility: The 2026 ZIT Bursary is open strictly to " "registered full-time undergraduate students in 200-level through 500-level across " "accredited faculties. First-year 100-level freshers, part-time evening students, and " "postgraduate students are not eligible for this bursary cycle.", ), ( "2", "Minimum CGPA and Concurrent Scholarship Cap: Applicants must maintain a minimum " "Cumulative Grade Point Average (CGPA) of 2.50 on a 5.00 scale based on verified " "first-semester results. In addition, an applicant must not hold any concurrent " "external scholarship or corporate award exceeding NGN 200,000 in the 2025/2026 session.", ), ], }, { "document_id": "N04", "title": "Dated Amendment to Minimum CGPA Threshold for STEM Faculties (Notice N03)", "date": "2026-06-03", "version": "1.1", "filename": "N04_amendment_stem_cgpa.pdf", "amends_doc_id": "N03", "amends_scope": "Replaces minimum CGPA (2.50 -> 2.20) for Engineering, Computing, and Vocational Technology only.", "sections": [ ( "1", "Targeted CGPA Amendment for STEM and Vocational Faculties: This amendment replaces the " "minimum CGPA requirement in Notice N03 (2.50) with 2.20 specifically for full-time " "undergraduate students in the Faculty of Engineering, Faculty of Computing, and " "Vocational Technology programs. Students in all other faculties remain on the 2.50 " "CGPA threshold. All other eligibility rules in Notice N03 (200-level to 500-level, " "full-time status, and the NGN 200,000 external scholarship cap) stand unchanged.", ), ], }, { "document_id": "N05", "title": "Bank Account Verification and Bursary Disbursement Schedule", "date": "2026-05-25", "version": "1.0", "filename": "N05_disbursement_and_banking.pdf", "amends_doc_id": "", "amends_scope": "", "sections": [ ( "1", "Student Bank Account Requirements: Approved bursary funds are disbursed exclusively " "via BVN-linked Nigerian commercial bank accounts registered in the student's own " "legal name on the ZIT Student Portal. Parent, guardian, or third-party bank accounts " "are automatically rejected during verification.", ), ( "2", "Disbursement Timeline and Confirmation Cutoff: Payout batches are processed within " "21 working days after the final shortlist is published. Shortlisted recipients must " "confirm their bank account details on the portal on or before 25 June 2026; unconfirmed " "awards are held until the September supplementary batch.", ), ], }, { "document_id": "N06", "title": "Special Documentation for Indigent and Orphaned Priority Tier", "date": "2026-05-28", "version": "1.0", "filename": "N06_indigent_priority_documents.pdf", "amends_doc_id": "", "amends_scope": "", "sections": [ ( "1", "Priority Tier Supporting Document: Applicants applying under the Indigent or " "Orphaned Student Priority Tier must submit one extra supporting document in addition " "to the three mandatory documents listed in Notice N01: either a High Court Sworn " "Affidavit of Financial Hardship OR a signed Local Government Area (LGA) / Ward Head " "Indigency Letter issued within the last 6 months.", ), ], }, { "document_id": "N07", "title": "Portal Upload Specifications and Physical Desk Verification Hours", "date": "2026-06-02", "version": "1.0", "filename": "N07_portal_upload_and_desk_hours.pdf", "amends_doc_id": "", "amends_scope": "", "sections": [ ( "1", "File Format Limits and Physical Bursary Helpdesk: All supporting documents must be " "uploaded to the ZIT Bursary Portal as readable PDF files not exceeding 5 MB per file. " "Students needing physical verification or document stamp checks can visit Bursary " "Block B, Room 14, open Monday to Friday from 9:00 AM to 3:00 PM (excluding public " "holidays). Physical verification closes on the same date as the portal application " "closing deadline.", ), ], }, { "document_id": "N08", "title": "Clearance Audit Holds and Submission Rejection Rules", "date": "2026-06-05", "version": "1.0", "filename": "N08_audit_holds_and_rejections.pdf", "amends_doc_id": "", "amends_scope": "", "sections": [ ( "1", "Clearance Holds and Incomplete Uploads: Students with unresolved Library overdue " "fines, Laboratory breakage charges, or Hostel damage audit holds cannot receive " "bursary disbursement until the Bursary Clearance Unit marks the hold as cleared. " "Applications containing blurred scans, unsigned HOD attestation letters, or " "expired fee receipts are disqualified during screening.", ), ], }, ] CSV_ROWS: List[Dict[str, str]] = [ { "row_id": "N09-R01", "item_name": "Bursary Application Processing Fee", "category": "Application Fee", "amount_ngn": "NGN 0 (Free)", "applies_to": "All undergraduate applicants", "notes": "Submitting the online bursary form carries zero administrative charge.", "effective_date": "2026-05-20", }, { "row_id": "N09-R02", "item_name": "Express Transcript and CGPA Verification Fee", "category": "Verification Fee", "amount_ngn": "NGN 2,500", "applies_to": "Applicants requesting 48-hour expedited Exams & Records CGPA audit", "notes": "Optional; standard departmental CGPA verification through the HOD is free.", "effective_date": "2026-05-20", }, { "row_id": "N09-R03", "item_name": "Late Student ID Card Re-issuance Fee", "category": "Replacement Fee", "amount_ngn": "NGN 3,000", "applies_to": "Applicants without a valid ZIT Student ID card who need a replacement slip", "notes": "Payable at Bursary Block B before uploading the replacement slip as ID proof.", "effective_date": "2026-05-20", }, { "row_id": "N09-R04", "item_name": "Portal Document Correction and Re-upload Admin Fee", "category": "Correction Fee", "amount_ngn": "NGN 1,500", "applies_to": "Applicants unlocking a submitted application before the closing deadline", "notes": "Unlock requests are permitted only before the official application closing date.", "effective_date": "2026-06-01", }, { "row_id": "N09-R05", "item_name": "Grant Tier A - Tuition Relief Maximum Award", "category": "Grant Award Cap", "amount_ngn": "Up to NGN 150,000 per session", "applies_to": "Approved Tuition Relief recipients (credited directly to fee ledger)", "notes": "Covers verified 2025/2026 tuition balance up to the NGN 150,000 cap.", "effective_date": "2026-05-20", }, { "row_id": "N09-R06", "item_name": "Grant Tier B - Books, Studio and Lab Equipment Stipend", "category": "Grant Award Cap", "amount_ngn": "NGN 45,000 per session", "applies_to": "Approved stipends paid into verified student BVN-linked bank accounts", "notes": "Disbursed directly to the student's verified bank account within the payout batch.", "effective_date": "2026-05-20", }, ] def render_notice_pdf(notice: Dict, out_path: Path) -> None: """Create a cleanly formatted institutional PDF notice using PyMuPDF.""" doc = pymupdf.open() page = doc.new_page(width=595, height=842) page.draw_rect(pymupdf.Rect(40, 36, 555, 108), color=(0.10, 0.30, 0.25), fill=(0.93, 0.96, 0.95)) page.insert_text( (52, 58), "ZARIA INSTITUTE OF TECHNOLOGY (ZIT) - STUDENT BURSARY & WELFARE OFFICE", fontsize=10.5, fontname="helv", color=(0.08, 0.25, 0.20), ) page.insert_text( (52, 78), f"Notice ID: {notice['document_id']} | Issue Date: {notice['date']} | Version: {notice['version']}", fontsize=9.5, fontname="helv", color=(0.20, 0.20, 0.20), ) page.insert_text( (52, 96), f"Permission: {PERMISSION_NOTE}", fontsize=8, fontname="helv", color=(0.35, 0.35, 0.35), ) page.insert_textbox( pymupdf.Rect(40, 124, 555, 175), notice["title"], fontsize=14, fontname="hebo", color=(0.05, 0.15, 0.12), ) y = 182 if notice["amends_doc_id"]: page.draw_rect(pymupdf.Rect(40, y, 555, y + 36), color=(0.75, 0.45, 0.10), fill=(0.99, 0.96, 0.90)) page.insert_textbox( pymupdf.Rect(48, y + 6, 547, y + 32), f"AMENDMENT NOTICE - Modifies {notice['amends_doc_id']}: {notice['amends_scope']}", fontsize=9, fontname="helv", color=(0.55, 0.28, 0.02), ) y += 50 for sec_num, body in notice["sections"]: sec_text = f"[Section {sec_num}]\n{body}" page.insert_textbox( pymupdf.Rect(40, y, 555, y + 180), sec_text, fontsize=10.5, fontname="helv", lineheight=1.4, color=(0.10, 0.10, 0.10), ) y += 145 page.insert_text( (40, y + 20), "Issued by: Office of the Student Bursar, Zaria Institute of Technology (Fictional Capstone Corpus)", fontsize=9, fontname="helv", color=(0.35, 0.35, 0.35), ) out_path.parent.mkdir(parents=True, exist_ok=True) doc.save(out_path) doc.close() def build_all() -> None: RAW_PDF_DIR.mkdir(parents=True, exist_ok=True) RAW_CSV_DIR.mkdir(parents=True, exist_ok=True) MANIFESTS_DIR.mkdir(parents=True, exist_ok=True) manifest_rows: List[Dict[str, str]] = [] for notice in PDF_NOTICES: pdf_rel = Path("data") / "raw" / "pdf" / notice["filename"] render_notice_pdf(notice, ROOT_DIR / pdf_rel) sec_list = ", ".join(f"Section {s[0]}" for s in notice["sections"]) manifest_rows.append( { "document_id": notice["document_id"], "title": notice["title"], "format": "pdf", "file_path": pdf_rel.as_posix(), "date": notice["date"], "version": notice["version"], "section_or_row": sec_list, "amends_doc_id": notice["amends_doc_id"], "amends_scope": notice["amends_scope"], "permission": PERMISSION_NOTE, } ) csv_rel = Path("data") / "raw" / "csv" / "bursary_fees_and_tiers.csv" with (ROOT_DIR / csv_rel).open("w", encoding="utf-8", newline="") as f: writer = csv.DictWriter( f, fieldnames=["row_id", "item_name", "category", "amount_ngn", "applies_to", "notes", "effective_date"], ) writer.writeheader() writer.writerows(CSV_ROWS) manifest_rows.append( { "document_id": "N09", "title": "Schedule of Bursary Fees and Grant Tiers (2026 Session)", "format": "csv", "file_path": csv_rel.as_posix(), "date": "2026-06-01", "version": "1.0", "section_or_row": "Rows 1-6 (N09-R01 to N09-R06)", "amends_doc_id": "", "amends_scope": "", "permission": PERMISSION_NOTE, } ) with SOURCE_MANIFEST_PATH.open("w", encoding="utf-8", newline="") as f: writer = csv.DictWriter( f, fieldnames=[ "document_id", "title", "format", "file_path", "date", "version", "section_or_row", "amends_doc_id", "amends_scope", "permission", ], ) writer.writeheader() writer.writerows(manifest_rows) passages = build_passages_from_sources(SOURCE_MANIFEST_PATH, PASSAGES_PATH) print(f"Generated {len(manifest_rows)} raw notices (8 PDFs + 1 CSV) and {len(passages)} processed passages.") if __name__ == "__main__": build_all()