File size: 16,224 Bytes
2ab2b76 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | """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()
|