Tomorrow is my Forensic medicine viva and my professor will ask from Introduction to forensic medicine ( Like defination) and other also form Essentials of Forensic Medicine (KS Narayan Reddy) . Please provide me all the necessary concept in easy language

Reading File
Finding Sources
Searching the Web

KS Narayan Reddy Essentials Forensic Medicine introduction definitions viva questions

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Here is your complete viva prep guide based directly from The Essentials of Forensic Medicine and Toxicology, 36th Edition (KS Narayan Reddy & OP Murty) - the exact book your professor uses.

Forensic Medicine Viva Prep - Introduction


PART 1: KEY DEFINITIONS (Most Asked in Viva)

1. Forensic Medicine (= Legal Medicine)

"Application of medical and paramedical knowledge to aid in the administration of justice."
  • "Forensic" comes from Latin forums = courts of law
  • Used by legal authorities to solve legal problems
  • Covers: injuries, murder, suicide, accidents, sexual offences, poisoning
  • Simple way to remember: Medical knowledge applied to Law

2. Medical Jurisprudence

"Deals with legal responsibilities of the physician - especially those arising from physician-patient relationship."
  • "Juris" = law; "Prudentia" = knowledge
  • Covers: medical negligence, consent, rights and duties of doctors, professional misconduct, medical ethics
  • Simple way to remember: Legal aspects of practising medicine
Viva Trap: Professor may ask the difference between Forensic Medicine and Medical Jurisprudence.
  • Forensic Medicine = medical aspects of LAW (helping courts)
  • Medical Jurisprudence = legal aspects of MEDICINE (doctor's duties)

3. Forensic Pathology

"Study and application of the effects of violence or unnatural disease on the human body; determining the cause and manner of death in cases of violence, suspicious, unexplained, unexpected, sudden and medically unattended deaths."

4. Clinical Forensic Medicine

"Deals with medicolegal aspects of examination of living human beings caused by or associated with all types of violence and other cases where legal problems are involved."
  • e.g., examining a rape victim, assault victim, drunk driver

5. State Medicine

"Deals with legal aspects of practice of medicine, regulating professional activities of medical practitioners, standard and uniformity of medical education, and health requirement of community and environmental health."

6. Medical Ethics

"The moral principles which should guide members of the medical profession in their dealings with each other, their patients and the State."

PART 2: PRINCIPLES OF ETHICS (4 Pillars)

PrincipleMeaningSimple Example
AutonomyPatient's right to make decisions about their own bodyPatient can refuse treatment
BeneficenceDoctor must act in the patient's best interestGive best possible treatment
Non-maleficenceDo no harm"Primum non nocere" - avoid procedures that cause harm
JusticeFair and equal treatment for all patientsTreat rich and poor equally
Key difference - Beneficence vs Non-maleficence:
  • Beneficence = do good actively
  • Non-maleficence = prevent harm (more restrictive)

PART 3: IMPORTANT LEGAL CODES (Updated - New Indian Laws 2023)

The old IPC/CrPC/IEA have been replaced. Know both old and new names:
New Name (2023)Old NameWhat it Covers
BNS - Bharatiya Nyaya Sanhita (Act 45 of 2023)IPC 1860Defines offences and prescribes punishments (substantive criminal law)
BNSS - Bharatiya Nagarika Suraksha Sanhita (Act 46 of 2023)CrPC 1973Criminal procedure - police duties, investigation, court procedures, trials
BSA - Bharatiya Sakshya Adhiniyam (Act 47 of 2023)Indian Evidence Act 1872Law of evidence - applies to ALL judicial proceedings
POCSO = Protection of Children from Sexual Offences Act - protects children from sexual abuse

Types of Law:

  • Criminal Law - offences against public interest (State vs Accused; handled by public prosecutors)
  • Civil Law (Case Law) - disputes between two individuals (Plaintiff vs Defendant)
  • Common Law - made by judges through their decisions in individual cases

PART 4: INQUEST

Definition: An inquest is an inquiry or investigation into the cause of death.
When is inquest held?
  • Suicide, murder
  • Killing by animal or machinery
  • Accidents
  • Deaths due to torture or ill-treatment
  • Occupational diseases
  • Suspected medical negligence
  • Suspicious/unnatural deaths
  • Deaths due to anaesthesia or operation
  • Unidentified or skeletonised bodies

Two Types of Inquest in India:

1. Police Inquest

  • Conducted by officer-in-charge (usually sub-inspector, not below rank of Head Constable)
  • Done under BNSS Section 194 (old CrPC 174)
  • Purpose: Find out whether the death is natural, suicidal, accidental, or homicidal
  • Police can order postmortem if needed
  • Does NOT determine manner of death - just preliminary inquiry

2. Magistrate's Inquest

  • Done under BNSS Section 196 (old CrPC 176)
  • Ordered by District Magistrate or Sub-Divisional Magistrate
  • Mandatory in: deaths in police custody, prison deaths, dowry deaths within 5 years of marriage
  • More formal and detailed than police inquest
  • Magistrate records statements and examines witnesses

PART 5: COGNIZABLE vs NON-COGNIZABLE OFFENCES

TypeDefinitionPolice Action
CognizableSerious offences where police CAN arrest without warrantMurder, rape, robbery, dacoity
Non-cognizableLess serious offences - police CANNOT arrest without warrantAssault, cheating, defamation

PART 6: COURTS OF LAW (Hierarchy)

From lowest to highest:
  1. Judicial Magistrate / Metropolitan Magistrate (trial court)
  2. Sessions Court / Additional Sessions Court
  3. High Court (each state)
  4. Supreme Court (final/highest court of India)

PART 7: HISTORY OF FORENSIC MEDICINE (Key Milestones for Viva)

Time PeriodMilestone
~3000 BCChinese Materia Medica - first mention of poisons
2700 BCImhotep (Egypt) - enacted rules for medical practice
~2200 BCCode of Hammurabi (Babylon) - OLDEST known medicolegal code
7th century BCCharaka Samhita - duties of physicians, description of poisons
4th-3rd century BCArtha Shastra (Kautilya) - penal laws, examination of dead bodies in unnatural deaths
4th century BCManu Smriti - laws on sexual offences, mental incapacity due to intoxication
460-377 BCHippocrates ("Father of Western Medicine") - discussed lethality of wounds, medical ethics
200-300 ADSushruta (Father of Indian Surgery) - Sushruta Samhita - classified wounds/fractures/poisons
1247 ADSung Tz'u (China) - wrote "Hsi Yuan Lu" = First book on forensic medicine
1598Fortunato Fidelis (Italy) - First to practice forensic medicine in modern sense
1621Paolo Zacchia (Italy) - "Father of Forensic Medicine" - wrote "Quaestiones Medico-Legales"
1788Dr. Samuel Farr (England) - first English textbook on medical jurisprudence
Key person to remember: Paolo Zacchia = Father of Forensic Medicine

PART 8: DOCTOR'S DUTIES & PROFESSIONAL CONDUCT

Duties of a Doctor (medicolegal context):

  • Must not refuse to give certificate if the patient is entitled to one
  • Must maintain confidentiality (professional secret)
  • Must give evidence in court when required
  • Must report certain cases to police (medico-legal cases - MLCs)

Which cases are MLCs (Medico-Legal Cases)?

  • Road traffic accidents
  • Injuries due to assault/fight
  • Burns (suspicious)
  • Poisoning cases
  • Sexual offences
  • Industrial accidents
  • Deaths within 24 hours of admission (suspicious)
  • Unconscious patients with unknown cause

Duties of a Doctor as Expert Witness:

  • Give an honest opinion based on facts
  • Avoid bias
  • Should not take sides
  • Explain findings in simple language to the court
  • Cannot refuse to appear in court if summoned

PART 9: MEDICAL NEGLIGENCE (Quick Summary)

Definition: Negligence = Failure to exercise the standard of care that a reasonably competent doctor would have exercised in similar circumstances.

The "4 Ds" of Medical Negligence:

  1. Duty - Doctor had a duty of care towards the patient
  2. Dereliction - Doctor failed (breached) that duty
  3. Direct Cause - The breach directly caused harm
  4. Damage - The patient suffered actual harm/injury

Types:

  • Civil negligence - patient sues for compensation (money)
  • Criminal negligence - so gross/reckless that it warrants punishment (rare)
  • Contributory negligence - patient also contributed to harm (e.g., didn't follow advice)

PART 10: QUICK VIVA Q&A FORMAT

Q: Define Forensic Medicine. A: Application of medical and paramedical knowledge to aid in the administration of justice.
Q: Who is the Father of Forensic Medicine? A: Paolo Zacchia (Italy, 1621)
Q: What is the oldest medicolegal code? A: Code of Hammurabi (~2200 BC, Babylon)
Q: What is the first book on Forensic Medicine? A: "Hsi Yuan Lu" by Sung Tz'u (China, 1247 AD)
Q: Difference between Police and Magistrate's Inquest? A: Police inquest (BNSS 194) is preliminary - finds nature of death. Magistrate's inquest (BNSS 196) is mandatory for custody deaths, prison deaths, dowry deaths - more formal.
Q: What replaced IPC, CrPC, IEA? A: BNS (IPC), BNSS (CrPC), BSA (IEA) - all enacted in 2023.
Q: 4 principles of medical ethics? A: Autonomy, Beneficence, Non-maleficence, Justice.
Q: Define Medical Jurisprudence vs Forensic Medicine? A: Forensic Medicine = medical aspects of law (for courts). Medical Jurisprudence = legal aspects of medicine (for doctors).
Q: What is Clinical Forensic Medicine? A: Medicolegal aspects of examination of living persons caused by or associated with all types of violence.
Q: What is an inquest? A: An inquiry or investigation into the cause of death.

QUICK MEMORY TRICKS

  • BNSS, BNS, BSA = "Big New System Arrives" (remember they all came in 2023)
  • 4 Ethics pillars = "All Big Nice Judges" (Autonomy, Beneficence, Non-maleficence, Justice)
  • Paolo Zacchia = "Father of Forensic" - remember PaZ - "Past Zero (beginning)" of FM
  • Hammurabi = Oldest medicolegal CODE (2200 BC, Babylon)
  • Sung Tz'u = First BOOK on FM (1247 AD, China)

Source: The Essentials of Forensic Medicine and Toxicology, 36th Edition (KS Narayan Reddy & OP Murty), Chapter 1 - Medical Law and Ethics.

Good luck for your viva tomorrow! Focus especially on the definitions (Q1), the difference between forensic medicine and medical jurisprudence, the new law names (BNS/BNSS/BSA), and Paolo Zacchia as father of FM - these are classic viva favourites.

All are good but can you please provide me defination according to KS naryan reddy and provide me Important legal codes of nepal and types of inquest in nepal

Reading File
Searching the Web

Nepal forensic medicine legal codes inquest types Muluki Criminal Code forensic

Finding Sources
Reading Web Page

https://pmc.ncbi.nlm.nih.gov/articles/PMC9419216

Searching the Web

Nepal Muluki Ain Muluki Criminal Code 2017 National Penal Code forensic medicine medicolegal inquest procedure

Searching the Web

Nepal inquest types police inquest district chief officer postmortem forensic medicine viva

Reading Web Page

https://medhacorplaw.com/an-overview-of-national-criminal-co…

I now have all the information needed. Let me compile the complete, viva-ready answer.

Forensic Medicine Viva Prep - Revised & Nepal-Specific


PART 1: EXACT DEFINITIONS AS PER KS NARAYAN REDDY (36th Edition, 2026)

These are the word-for-word definitions from the textbook:

1. Forensic Medicine / Legal Medicine

"Forensic or legal medicine (forensic = forums of or used in courts of law) deals with the application of medical and paramedical knowledge to aid in the administration of justice. It is used by the legal authorities for the solution of legal problems."
  • In short: deals with medical aspects of law

2. Medical Jurisprudence

"Medical jurisprudence (juris = law; Prudentia = knowledge) deals with legal responsibilities of the physician with particular reference to those arising from physician-patient relationship, such as medical negligence cases, consent, rights and duties of doctors, serious professional misconduct, medical ethics, etc."
  • In short: deals with legal aspects of practice of medicine

3. Clinical Forensic Medicine

"Clinical forensic medicine deals with medicolegal aspects of examination of living human beings caused by or associated with all types of violence and other cases where legal problems are involved."

4. Forensic Pathology

"Forensic pathology deals with the study and application of the effects of violence or unnatural disease in its various forms in or on the human body; in determining the cause and manner of death in case of violence, suspicious, unexplained, unexpected, sudden and medically unattended deaths."

5. State Medicine

"State medicine deals with legal aspects of practice of medicine, regulating professional activities of medical practitioners, standard and uniformity of medical education, and health requirement of community and environmental health."

6. Medical Ethics

"Medical ethics deals with the moral principles which should guide members of the medical profession in their dealings with each other, their patients and the State."

Viva Tip: The two most confused definitions are Forensic Medicine vs Medical Jurisprudence. Remember:
  • Forensic Medicine = Doctor helps the Court (medical knowledge → legal problems)
  • Medical Jurisprudence = Law governs the Doctor (legal duties of the physician)

PART 2: IMPORTANT LEGAL CODES OF NEPAL

Nepal replaced its old Muluki Ain (1963) with 3 modern codes in 2017, which came into force on 17 August 2018.
CodeNepali NameWhat it CoversForensic Relevance
National Penal (Criminal) Code, 2074 (2017)Muluki Aparadh SanhitaDefines all criminal offences and punishments. 267 sections, 12 chaptersDefines crimes like murder, rape, grievous hurt, poisoning, medical negligence (Sections 231-233)
National Criminal Procedure (Code) Act, 2074 (2017)Muluki Faujadaree Karyawidhi SanhitaProcedure for criminal investigation, arrest, trial, courtsGoverns how police investigate deaths, inquest procedure, evidence collection
Criminal Offences (Determination and Execution of Sentence) Act, 2074 (2017)Sentencing ActDetermines how punishments are decided and executed-

Other Important Acts in Nepal for Forensic Medicine:

ActRelevance
Constitution of Nepal, 2072 (2015)Fundamental rights - right to life, right against torture, equality before law
Nepal Medical Council Act, 2020 (1964)Regulates medical practice, professional misconduct, licensing
Human Body Organ Transplant (Regulation and Prohibition) Act, 2055 (1998)Organ donation and transplantation laws
Mental Health ActMental capacity, consent in psychiatric patients
Consumer Protection ActMedical negligence complaints
CAAN / Evidence ActAdmissibility of forensic evidence in courts

Key Principles in Nepal's Penal Code (Forensic Context):

  • Presumption of Innocence - accused is innocent until proven guilty
  • Nullum crimen sine lege - no crime without law (no one punished for act not defined as crime)
  • Proportionality - punishment must match the severity of the crime
  • Right to Fair Trial

PART 3: TYPES OF INQUEST IN NEPAL

Definition of Inquest: An official inquiry or investigation into the cause and circumstances of death, especially in unnatural, suspicious, or sudden deaths.
Nepal follows an integrated service model where police lead all death investigations.

Types of Inquest in Nepal:


1. Police Inquest (Most Common)

  • Conducted by: Police (Officer-in-Charge of the police station)
  • When: For ALL unnatural deaths - accidents, suicides, homicides, suspicious deaths
  • What happens:
    • Police visit the scene and examine the body
    • An inquest form is filled out
    • Police assess whether death is criminal or non-criminal
    • Police can order a medico-legal autopsy at the nearest government hospital
    • No consent from family is required for the autopsy
    • A preliminary report is compiled
  • Legal authority: National Criminal Procedure Code, 2074 (Section 194 equivalent)

2. District Chief Officer (CDO) / Administrative Inquest

  • Conducted by: Chief District Officer (CDO) or District Administration
  • When: For custodial deaths (deaths in police custody, prison deaths) and deaths of special public importance
  • Why: To ensure independent investigation when police themselves may be implicated
  • More formal than routine police inquest; witnesses are examined and a detailed report is submitted

Comparison Table: Police Inquest vs CDO Inquest in Nepal

FeaturePolice InquestCDO/Administrative Inquest
AuthorityPolice (Sub-Inspector or above)Chief District Officer
CasesAll unnatural/suspicious deathsCustodial deaths, prison deaths
PurposeDetermine nature of death (criminal/non-criminal)Independent investigation; accountability
AutopsyCan order medico-legal autopsyOrdered as part of investigation
ConsentNot required from familyNot required

When is Medico-Legal Autopsy Done in Nepal?

  • All unnatural deaths reported to police
  • Suspicious deaths
  • Deaths in custody
  • Deaths where cause is unknown
  • Identity establishment required
  • Medicolegal autopsy is performed at government hospitals by government-appointed doctors

Brief History of Forensic Medicine in Nepal:

  • 1854: Earliest written law (Muluki Ain) enacted - based on Hindu principles + British law
  • 1951: Nepal became democratic; medicolegal services systematized by statutes
  • 1960s: Medico-legal autopsies started; jail doctors (police surgeons) appointed at Bir Hospital, Kathmandu
  • 2017: New criminal codes replaced the old Muluki Ain

QUICK VIVA Q&A - Nepal Focus

Q: What are the important legal codes of Nepal relevant to forensic medicine? A: National Penal Code 2074 (2017), National Criminal Procedure Code 2074 (2017), and Sentencing Act 2074 (2017) - all came into force August 17, 2018.
Q: What replaced Muluki Ain in Nepal? A: The three new codes of 2017 (Penal Code, Criminal Procedure Code, Sentencing Act), replacing the Muluki Ain of 1963.
Q: Who conducts inquest in Nepal? A: Police conduct inquest for all unnatural deaths. The Chief District Officer (CDO) conducts inquest for custodial deaths.
Q: How many types of inquest are there in Nepal? A: Two - Police Inquest (for all unnatural deaths) and District Chief Officer/Administrative Inquest (for custodial deaths).
Q: Is consent required for medico-legal autopsy in Nepal? A: No. In Nepal, police are the legal authority for death investigation. No consent from family members is required for medico-legal autopsy.
Q: Where did medico-legal autopsies begin in Nepal? A: Bir Hospital, Kathmandu in the 1960s.

Sources:

Make a quick reference PDF for your viva

Reading File
Running Command

mkdir -p /home/daytona/workspace/forensic-viva && ls /home/daytona/workspace/

Writing File

~/forensic-viva/make_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
                                 TableStyle, HRFlowable, KeepTogether)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import PageBreak

OUTPUT = "/home/daytona/workspace/forensic-viva/Forensic_Medicine_Viva_Quick_Reference.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1a3a5c")
MED_BLUE    = colors.HexColor("#2563a8")
LIGHT_BLUE  = colors.HexColor("#dbeafe")
ORANGE      = colors.HexColor("#d97706")
ORANGE_LITE = colors.HexColor("#fef3c7")
GREEN       = colors.HexColor("#166534")
GREEN_LITE  = colors.HexColor("#dcfce7")
RED         = colors.HexColor("#991b1b")
RED_LITE    = colors.HexColor("#fee2e2")
PURPLE      = colors.HexColor("#5b21b6")
PURPLE_LITE = colors.HexColor("#ede9fe")
GRAY_DARK   = colors.HexColor("#374151")
GRAY_LIGHT  = colors.HexColor("#f3f4f6")
WHITE       = colors.white

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=1.5*cm, leftMargin=1.5*cm,
    topMargin=1.5*cm, bottomMargin=1.5*cm,
    title="Forensic Medicine Viva Quick Reference",
    author="KS Narayan Reddy 36th Ed."
)

W, H = A4
CW = W - 3*cm   # content width

# ── Styles ───────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

cover_title = S("CoverTitle",
    fontSize=26, textColor=WHITE, fontName="Helvetica-Bold",
    alignment=TA_CENTER, spaceAfter=6)
cover_sub = S("CoverSub",
    fontSize=13, textColor=colors.HexColor("#bfdbfe"),
    fontName="Helvetica", alignment=TA_CENTER, spaceAfter=4)
cover_tag = S("CoverTag",
    fontSize=10, textColor=colors.HexColor("#fde68a"),
    fontName="Helvetica-Oblique", alignment=TA_CENTER)

sec_hdr = S("SecHdr",
    fontSize=13, textColor=WHITE, fontName="Helvetica-Bold",
    alignment=TA_LEFT, spaceAfter=0, spaceBefore=0,
    leftIndent=6, leading=18)
sub_hdr = S("SubHdr",
    fontSize=11, textColor=DARK_BLUE, fontName="Helvetica-Bold",
    spaceBefore=8, spaceAfter=2)
body = S("Body",
    fontSize=9, textColor=GRAY_DARK, fontName="Helvetica",
    leading=14, spaceAfter=3, alignment=TA_JUSTIFY)
body_sm = S("BodySm",
    fontSize=8.5, textColor=GRAY_DARK, fontName="Helvetica",
    leading=13, spaceAfter=2)
bold_body = S("BoldBody",
    fontSize=9, textColor=DARK_BLUE, fontName="Helvetica-Bold",
    leading=14, spaceAfter=2)
quote = S("Quote",
    fontSize=9, textColor=GREEN, fontName="Helvetica-Oblique",
    leading=14, spaceAfter=4, leftIndent=10,
    borderPad=4, backColor=GREEN_LITE)
tip = S("Tip",
    fontSize=8.5, textColor=RED, fontName="Helvetica-Oblique",
    leading=13, spaceAfter=3, leftIndent=8)
memory = S("Memory",
    fontSize=8.5, textColor=PURPLE, fontName="Helvetica-Bold",
    leading=13, spaceAfter=2)
footer_s = S("Footer",
    fontSize=7.5, textColor=colors.HexColor("#9ca3af"),
    fontName="Helvetica", alignment=TA_CENTER)

# ── Helper builders ──────────────────────────────────────────────────────────

def section_banner(text, color=DARK_BLUE):
    data = [[Paragraph(text, sec_hdr)]]
    t = Table(data, colWidths=[CW])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("ROUNDEDCORNERS", [4]),
    ]))
    return t

def info_box(text, bg=LIGHT_BLUE, tc=DARK_BLUE, border=MED_BLUE):
    st = S("IB", fontSize=9, textColor=tc, fontName="Helvetica",
           leading=13, spaceAfter=0)
    data = [[Paragraph(text, st)]]
    t = Table(data, colWidths=[CW])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), bg),
        ("TOPPADDING",    (0,0), (-1,-1), 7),
        ("BOTTOMPADDING", (0,0), (-1,-1), 7),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("LINEBELOW",     (0,0), (-1,-1), 1.5, border),
    ]))
    return t

def two_col_table(rows, col_ratio=(0.38, 0.62), hdr=None,
                  hdr_bg=DARK_BLUE, alt_bg=GRAY_LIGHT):
    cw = [CW * r for r in col_ratio]
    cell_st = S("TC", fontSize=8.5, textColor=GRAY_DARK,
                fontName="Helvetica", leading=12)
    hdr_st  = S("TH", fontSize=8.5, textColor=WHITE,
                fontName="Helvetica-Bold", leading=12)

    data = []
    if hdr:
        data.append([Paragraph(h, hdr_st) for h in hdr])
    for row in rows:
        data.append([Paragraph(str(c), cell_st) for c in row])

    t = Table(data, colWidths=cw, repeatRows=(1 if hdr else 0))
    style = [
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 7),
        ("RIGHTPADDING",  (0,0), (-1,-1), 7),
        ("GRID",          (0,0), (-1,-1), 0.4, colors.HexColor("#d1d5db")),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ]
    if hdr:
        style += [
            ("BACKGROUND", (0,0), (-1,0), hdr_bg),
            ("FONTNAME",   (0,0), (-1,0), "Helvetica-Bold"),
            ("TEXTCOLOR",  (0,0), (-1,0), WHITE),
        ]
        start = 1
    else:
        start = 0
    for i in range(start, len(data)):
        if (i - start) % 2 == 1:
            style.append(("BACKGROUND", (0,i), (-1,i), alt_bg))
    t.setStyle(TableStyle(style))
    return t

def three_col_table(rows, col_ratio=(0.30, 0.35, 0.35), hdr=None,
                    hdr_bg=DARK_BLUE, alt_bg=GRAY_LIGHT):
    cw = [CW * r for r in col_ratio]
    cell_st = S("TC3", fontSize=8.5, textColor=GRAY_DARK,
                fontName="Helvetica", leading=12)
    hdr_st  = S("TH3", fontSize=8.5, textColor=WHITE,
                fontName="Helvetica-Bold", leading=12)
    data = []
    if hdr:
        data.append([Paragraph(h, hdr_st) for h in hdr])
    for row in rows:
        data.append([Paragraph(str(c), cell_st) for c in row])
    t = Table(data, colWidths=cw, repeatRows=(1 if hdr else 0))
    style = [
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 7),
        ("RIGHTPADDING",  (0,0), (-1,-1), 7),
        ("GRID",          (0,0), (-1,-1), 0.4, colors.HexColor("#d1d5db")),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
    ]
    if hdr:
        style += [
            ("BACKGROUND", (0,0), (-1,0), hdr_bg),
            ("FONTNAME",   (0,0), (-1,0), "Helvetica-Bold"),
            ("TEXTCOLOR",  (0,0), (-1,0), WHITE),
        ]
        start = 1
    else:
        start = 0
    for i in range(start, len(data)):
        if (i - start) % 2 == 1:
            style.append(("BACKGROUND", (0,i), (-1,i), alt_bg))
    t.setStyle(TableStyle(style))
    return t

def qa_box(q, a):
    qs = S("QS", fontSize=9, textColor=ORANGE, fontName="Helvetica-Bold", leading=13)
    as_ = S("AS", fontSize=9, textColor=GRAY_DARK, fontName="Helvetica", leading=13)
    data = [
        [Paragraph(f"Q: {q}", qs)],
        [Paragraph(f"A: {a}", as_)],
    ]
    t = Table(data, colWidths=[CW])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (0,0), ORANGE_LITE),
        ("BACKGROUND",    (0,1), (0,1), WHITE),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("LINEBELOW",     (0,1), (-1,1), 0.5, colors.HexColor("#d1d5db")),
    ]))
    return t

sp = lambda n=4: Spacer(1, n)
hr = lambda: HRFlowable(width="100%", thickness=0.5,
                         color=colors.HexColor("#e5e7eb"), spaceAfter=4)

# ═══════════════════════════════════════════════════════════════════════════
# BUILD STORY
# ═══════════════════════════════════════════════════════════════════════════
story = []

# ── COVER PAGE ──────────────────────────────────────────────────────────────
cover_data = [[
    Paragraph("FORENSIC MEDICINE", cover_title),
    Paragraph("VIVA QUICK REFERENCE", cover_title),
    Spacer(1, 10),
    Paragraph("Based on KS Narayan Reddy & OP Murty", cover_sub),
    Paragraph("The Essentials of Forensic Medicine & Toxicology, 36th Edition (2026)", cover_sub),
    Spacer(1, 6),
    Paragraph("+ Nepal Legal Codes & Inquest Types", cover_tag),
    Spacer(1, 4),
    Paragraph("Viva Date: 8 July 2026", cover_tag),
]]
cover_t = Table(cover_data, colWidths=[CW])
cover_t.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), DARK_BLUE),
    ("TOPPADDING",    (0,0), (-1,-1), 30),
    ("BOTTOMPADDING", (0,0), (-1,-1), 30),
    ("LEFTPADDING",   (0,0), (-1,-1), 20),
    ("RIGHTPADDING",  (0,0), (-1,-1), 20),
    ("ROUNDEDCORNERS", [8]),
]))
story += [cover_t, sp(14)]

# index box
idx_rows = [
    ["1", "Key Definitions (Exact - KS Narayan Reddy)"],
    ["2", "Forensic Medicine vs Medical Jurisprudence"],
    ["3", "4 Principles of Medical Ethics"],
    ["4", "Important Legal Codes of Nepal"],
    ["5", "Types of Inquest in Nepal"],
    ["6", "History Milestones"],
    ["7", "Quick Viva Q&A"],
    ["8", "Memory Tricks"],
]
story.append(section_banner("CONTENTS", MED_BLUE))
story.append(sp(4))
story.append(two_col_table(idx_rows, col_ratio=(0.12, 0.88),
                            hdr=["#", "Topic"], hdr_bg=MED_BLUE))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# PAGE 2: DEFINITIONS
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_banner("1. KEY DEFINITIONS (EXACT — KS NARAYAN REDDY 36th Ed.)", DARK_BLUE))
story.append(sp(6))

defs = [
    ("Forensic Medicine / Legal Medicine",
     '"Forensic or legal medicine (forensic = forums of or used in courts of law) deals with the '
     'application of medical and paramedical knowledge to aid in the administration of justice. '
     'It is used by the legal authorities for the solution of legal problems."',
     "In short: deals with MEDICAL aspects of LAW", GREEN),

    ("Medical Jurisprudence",
     '"Medical jurisprudence (juris = law; Prudentia = knowledge) deals with legal responsibilities '
     'of the physician with particular reference to those arising from physician-patient relationship, '
     'such as medical negligence cases, consent, rights and duties of doctors, serious professional '
     'misconduct, medical ethics, etc."',
     "In short: deals with LEGAL aspects of PRACTICE OF MEDICINE", MED_BLUE),

    ("Clinical Forensic Medicine",
     '"Clinical forensic medicine deals with medicolegal aspects of examination of living human beings '
     'caused by or associated with all types of violence and other cases where legal problems are involved."',
     "Key word: LIVING persons + violence + legal problems", ORANGE),

    ("Forensic Pathology",
     '"Forensic pathology deals with the study and application of the effects of violence or unnatural '
     'disease in its various forms in or on the human body; in determining the cause and manner of death '
     'in case of violence, suspicious, unexplained, unexpected, sudden and medically unattended deaths."',
     "Key word: DEATH investigation — cause and manner", RED),

    ("State Medicine",
     '"State medicine deals with legal aspects of practice of medicine, regulating professional activities '
     'of medical practitioners, standard and uniformity of medical education, and health requirement of '
     'community and environmental health."',
     "Key word: REGULATION of medical profession + community health", PURPLE),

    ("Medical Ethics",
     '"Medical ethics deals with the moral principles which should guide members of the medical profession '
     'in their dealings with each other, their patients and the State."',
     "Key word: MORAL principles guiding doctors", colors.HexColor("#0369a1")),
]

for title, definition, note, color in defs:
    hdr_st = S("DH", fontSize=10, textColor=WHITE, fontName="Helvetica-Bold", leading=14)
    def_st = S("DD", fontSize=9, textColor=colors.HexColor("#1f2937"),
               fontName="Helvetica-Oblique", leading=14)
    note_st = S("DN", fontSize=8.5, textColor=color, fontName="Helvetica-Bold", leading=13)

    inner = [
        [Paragraph(title, hdr_st)],
        [Paragraph(definition, def_st)],
        [Paragraph(f"► {note}", note_st)],
    ]
    t = Table(inner, colWidths=[CW - 20])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), color),
        ("BACKGROUND",    (0,1), (-1,1), colors.HexColor("#f9fafb")),
        ("BACKGROUND",    (0,2), (-1,2), colors.HexColor("#f3f4f6")),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("LINEBEFORE",    (0,0), (-1,-1), 3, color),
        ("LINEBELOW",     (0,2), (-1,2), 0.5, colors.HexColor("#d1d5db")),
    ]))
    outer = Table([[t]], colWidths=[CW])
    outer.setStyle(TableStyle([
        ("LEFTPADDING",   (0,0), (-1,-1), 0),
        ("RIGHTPADDING",  (0,0), (-1,-1), 0),
        ("TOPPADDING",    (0,0), (-1,-1), 0),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ]))
    story.append(KeepTogether([outer, sp(2)]))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# PAGE 3: COMPARISON + ETHICS
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_banner("2. FORENSIC MEDICINE vs MEDICAL JURISPRUDENCE", MED_BLUE))
story.append(sp(6))
story.append(three_col_table(
    [
        ["Full name", "Forensic / Legal Medicine", "Medical Jurisprudence"],
        ["Etymology", "Forensic = courts of law", "Juris = law; Prudentia = knowledge"],
        ["Who benefits", "Courts / Legal authorities", "The Doctor / Medical profession"],
        ["Deals with", "Medical aspects of LAW", "Legal aspects of MEDICINE"],
        ["Examples", "Murder, suicide, poisoning, sexual offences, injuries", "Negligence, consent, misconduct, rights of doctors"],
        ["One-liner", "Doctor helps the Court", "Law governs the Doctor"],
    ],
    col_ratio=(0.25, 0.375, 0.375),
    hdr=["Feature", "Forensic Medicine", "Medical Jurisprudence"],
    hdr_bg=MED_BLUE
))
story.append(sp(10))

story.append(section_banner("3. FOUR PRINCIPLES OF MEDICAL ETHICS (Beauchamp & Childress)", ORANGE))
story.append(sp(6))
ethics = [
    ("Autonomy", "Patient's right to make decisions about their own body and treatment.",
     "Patient CAN refuse treatment even if life-saving. Doctor MUST respect this.", ORANGE),
    ("Beneficence", "Doctor must actively ACT in the best interest of the patient.",
     "Give the best possible treatment. Do something GOOD.", GREEN),
    ("Non-maleficence", '"Primum non nocere" — First, do no harm. Avoid procedures/treatments that cause more harm than benefit.',
     "More RESTRICTIVE than beneficence. Prevents harm.", RED),
    ("Justice", "Fair, equal treatment for ALL patients regardless of status, gender, religion, or finances.",
     "Treat rich and poor equally. Distribute resources fairly.", PURPLE),
]
for principle, meaning, example, color in ethics:
    p_st  = S("EP", fontSize=10, textColor=WHITE, fontName="Helvetica-Bold", leading=14)
    m_st  = S("EM", fontSize=9,  textColor=GRAY_DARK, fontName="Helvetica", leading=13)
    ex_st = S("EX", fontSize=8.5,textColor=color, fontName="Helvetica-Bold", leading=13)
    inner = [
        [Paragraph(principle, p_st)],
        [Paragraph(meaning, m_st)],
        [Paragraph(f"eg. {example}", ex_st)],
    ]
    t = Table(inner, colWidths=[CW - 20])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), color),
        ("BACKGROUND",    (0,1), (-1,1), colors.HexColor("#f9fafb")),
        ("BACKGROUND",    (0,2), (-1,2), colors.HexColor("#f3f4f6")),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
        ("LINEBEFORE",    (0,0), (-1,-1), 3, color),
    ]))
    outer = Table([[t]], colWidths=[CW])
    outer.setStyle(TableStyle([("LEFTPADDING",(0,0),(-1,-1),0),("RIGHTPADDING",(0,0),(-1,-1),0),
                                ("TOPPADDING",(0,0),(-1,-1),0),("BOTTOMPADDING",(0,0),(-1,-1),3)]))
    story.append(KeepTogether([outer, sp(2)]))

story.append(info_box(
    "VIVA TRAP: Beneficence vs Non-maleficence\n"
    "Beneficence = DO GOOD actively (positive duty)\n"
    "Non-maleficence = DO NOT HARM (more restrictive — negative duty)\n"
    "Both are different! Do not confuse them.",
    bg=ORANGE_LITE, tc=colors.HexColor("#92400e"), border=ORANGE
))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# PAGE 4: NEPAL LEGAL CODES
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_banner("4. IMPORTANT LEGAL CODES OF NEPAL", colors.HexColor("#065f46")))
story.append(sp(6))

story.append(info_box(
    "Nepal replaced the old Muluki Ain (1963) with THREE new codes enacted on 8 August 2017.\n"
    "All came into force on: 17 AUGUST 2018",
    bg=GREEN_LITE, tc=GREEN, border=colors.HexColor("#065f46")
))
story.append(sp(6))

nepal_codes = [
    ["National Penal (Criminal) Code, 2074 (2017)",
     "Muluki Aparadh Sanhita",
     "Replaced IPC-equivalent. Defines ALL criminal offences + punishments. 267 sections, 12 chapters.\nForensic: murder, rape, grievous hurt, poisoning, medical treatment offences (Sec 231-233)"],
    ["National Criminal Procedure (Code) Act, 2074 (2017)",
     "Muluki Faujadaree Karyawidhi Sanhita",
     "Replaced CrPC-equivalent. Criminal investigation, police duties, arrest, inquest, courts, trial procedure.\nForensic: governs inquest, autopsy requests, evidence collection"],
    ["Criminal Offences (Determination & Execution of Sentence) Act, 2074 (2017)",
     "Sentencing Act",
     "Determines how punishments are decided and executed. Replaces scattered sentencing provisions."],
]
story.append(three_col_table(
    nepal_codes,
    col_ratio=(0.30, 0.25, 0.45),
    hdr=["Act Name", "Nepali Name", "What It Covers"],
    hdr_bg=colors.HexColor("#065f46")
))
story.append(sp(8))

story.append(Paragraph("Other Important Nepal Acts (Forensic Context)", sub_hdr))
story.append(sp(4))
other_acts = [
    ["Constitution of Nepal, 2072 (2015)", "Right to life, right against torture, equality before law — foundation of all criminal law"],
    ["Nepal Medical Council Act, 2020 B.S. (1964)", "Regulates medical practice, professional misconduct, licensing of doctors"],
    ["Human Body Organ Transplant Act, 2055 (1998)", "Organ donation and transplantation — legality and conditions"],
    ["Mental Health Act", "Mental capacity, fitness to plead, consent in psychiatric patients"],
    ["Consumer Protection Act", "Patients can file complaints of medical negligence under this act"],
]
story.append(two_col_table(
    other_acts,
    col_ratio=(0.40, 0.60),
    hdr=["Act", "Forensic Relevance"],
    hdr_bg=colors.HexColor("#14532d")
))
story.append(sp(8))

story.append(Paragraph("Key Legal Principles (Nepal Penal Code, 2074)", sub_hdr))
story.append(sp(4))
principles_rows = [
    ["Presumption of Innocence", "Accused is innocent UNTIL proven guilty"],
    ["Nullum crimen sine lege", "No crime without law — nobody punished for act not defined as crime"],
    ["Proportionality", "Punishment must match the severity of the offence"],
    ["Right to Fair Trial", "Every accused has right to fair hearing"],
    ["Equality Before Law", "All persons equal before the law — no discrimination"],
]
story.append(two_col_table(
    principles_rows,
    col_ratio=(0.35, 0.65),
    hdr=["Principle", "Meaning"],
    hdr_bg=colors.HexColor("#065f46")
))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# PAGE 5: INQUEST IN NEPAL
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_banner("5. TYPES OF INQUEST IN NEPAL", RED))
story.append(sp(6))

story.append(info_box(
    "Definition of Inquest: An official inquiry / investigation into the CAUSE and CIRCUMSTANCES of death.\n"
    "Nepal follows an INTEGRATED SERVICE MODEL — POLICE lead ALL death investigations.",
    bg=RED_LITE, tc=RED, border=RED
))
story.append(sp(8))

# Type 1
story.append(Paragraph("TYPE 1: Police Inquest", S("SH1", fontSize=11, textColor=WHITE,
    fontName="Helvetica-Bold", leading=15)))

pi_data = [
    [Paragraph("TYPE 1: POLICE INQUEST", S("PHdr", fontSize=11, textColor=WHITE,
     fontName="Helvetica-Bold", leading=15))],
]
t_pi_hdr = Table(pi_data, colWidths=[CW])
t_pi_hdr.setStyle(TableStyle([
    ("BACKGROUND", (0,0),(-1,-1), MED_BLUE),
    ("TOPPADDING", (0,0),(-1,-1), 7), ("BOTTOMPADDING", (0,0),(-1,-1), 7),
    ("LEFTPADDING",(0,0),(-1,-1), 12), ("RIGHTPADDING", (0,0),(-1,-1), 12),
]))
story.append(t_pi_hdr)

pi_rows = [
    ["Conducted by", "Police Officer-in-Charge (sub-inspector or above)"],
    ["When applicable", "ALL unnatural deaths — accidents, suicides, homicides, suspicious deaths"],
    ["Legal authority", "National Criminal Procedure Code, 2074 (2017)"],
    ["Process", "Police visit scene → examine body → fill inquest form → classify death (criminal/non-criminal) → may order medico-legal autopsy"],
    ["Consent required", "NO — family consent NOT required for medico-legal autopsy"],
    ["Outcome", "Preliminary inquest form compiled; body released for cremation after autopsy (if done)"],
    ["Autopsy location", "Nearest government hospital by government-appointed doctor"],
]
story.append(two_col_table(pi_rows, col_ratio=(0.30, 0.70), hdr_bg=MED_BLUE))
story.append(sp(8))

t_cdo_hdr_data = [[Paragraph("TYPE 2: DISTRICT CHIEF OFFICER (CDO) / ADMINISTRATIVE INQUEST",
    S("CDOHdr", fontSize=11, textColor=WHITE, fontName="Helvetica-Bold", leading=15))]]
t_cdo_hdr = Table(t_cdo_hdr_data, colWidths=[CW])
t_cdo_hdr.setStyle(TableStyle([
    ("BACKGROUND", (0,0),(-1,-1), colors.HexColor("#7c3aed")),
    ("TOPPADDING", (0,0),(-1,-1), 7), ("BOTTOMPADDING", (0,0),(-1,-1), 7),
    ("LEFTPADDING",(0,0),(-1,-1), 12), ("RIGHTPADDING", (0,0),(-1,-1), 12),
]))
story.append(t_cdo_hdr)

cdo_rows = [
    ["Conducted by", "Chief District Officer (CDO) or District Administration Office"],
    ["When applicable", "CUSTODIAL DEATHS (deaths in police custody, prison deaths), deaths of public importance"],
    ["Legal authority", "National Criminal Procedure Code, 2074 (2017)"],
    ["Why separate", "Ensures INDEPENDENT investigation when police themselves may be implicated"],
    ["Process", "More formal — witnesses examined, statements recorded, detailed report submitted to court"],
    ["Consent required", "NO"],
    ["Autopsy", "Ordered as part of independent investigation"],
]
story.append(two_col_table(cdo_rows, col_ratio=(0.30, 0.70),
                            hdr_bg=colors.HexColor("#7c3aed")))
story.append(sp(8))

story.append(section_banner("COMPARISON: Police vs CDO Inquest", GRAY_DARK))
story.append(sp(4))
comp_rows = [
    ["Authority", "Police (Sub-Inspector or above)", "Chief District Officer (CDO)"],
    ["Cases", "ALL unnatural/suspicious deaths", "Custodial deaths, prison deaths"],
    ["Purpose", "Determine nature of death (criminal or not)", "Independent accountability investigation"],
    ["Formality", "Preliminary / routine", "Formal — witnesses + statements recorded"],
    ["Family consent", "Not required", "Not required"],
    ["Autopsy", "Can order medico-legal autopsy", "Ordered as part of investigation"],
]
story.append(three_col_table(
    comp_rows, col_ratio=(0.25, 0.375, 0.375),
    hdr=["Feature", "Police Inquest", "CDO Inquest"],
    hdr_bg=GRAY_DARK
))
story.append(sp(6))
story.append(info_box(
    "HISTORY NOTE: Medicolegal services systematized in Nepal in 1951. "
    "Medico-legal autopsies started in the 1960s at Bir Hospital, Kathmandu by jail doctors (police surgeons).",
    bg=GREEN_LITE, tc=GREEN, border=GREEN
))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# PAGE 6: HISTORY + QUICK QA + MEMORY TRICKS
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_banner("6. HISTORY OF FORENSIC MEDICINE — KEY MILESTONES", ORANGE))
story.append(sp(6))
history_rows = [
    ["~3000 BC", "Chinese Materia Medica — first mention of poisons"],
    ["~2700 BC", "Imhotep (Egypt) — enacted rules for medical practice"],
    ["~2200 BC", "Code of Hammurabi (Babylon) — OLDEST known medicolegal code"],
    ["7th C BC", "Charaka Samhita — duties of physicians + poisons described"],
    ["4th C BC", "Artha Shastra (Kautilya) — penal laws, examination of dead in unnatural deaths"],
    ["4th C BC", "Manu Smriti — laws on sexual offences, mental incapacity from intoxication"],
    ["460-377 BC", "Hippocrates — 'Father of Western Medicine'; lethality of wounds; medical ethics"],
    ["200-300 AD", "Sushruta (Father of Indian Surgery) — classified wounds, fractures, poisons"],
    ["1247 AD", "Sung Tz'u (China) — 'Hsi Yuan Lu' = FIRST book on Forensic Medicine"],
    ["1598 AD", "Fortunato Fidelis (Italy) — first to PRACTICE forensic medicine in modern sense"],
    ["1621 AD", "Paolo Zacchia (Italy) — 'Father of Forensic Medicine' — wrote Quaestiones Medico-Legales"],
    ["1788 AD", "Dr. Samuel Farr (England) — first English textbook on Medical Jurisprudence"],
    ["1951", "Nepal — medicolegal services systematized by statutes"],
    ["1960s", "Nepal — medicolegal autopsies began at Bir Hospital, Kathmandu"],
    ["2018", "Nepal — New codes (BNS equivalents) came into force: 17 August 2018"],
]
story.append(two_col_table(history_rows, col_ratio=(0.22, 0.78),
                            hdr=["Period", "Milestone"], hdr_bg=ORANGE))
story.append(sp(8))

story.append(section_banner("7. QUICK VIVA Q&A", RED))
story.append(sp(6))
qas = [
    ("Define Forensic Medicine.",
     "Application of medical and paramedical knowledge to aid in the administration of justice. Deals with medical aspects of law."),
    ("Who is the Father of Forensic Medicine?",
     "Paolo Zacchia (Italy, 1621) — wrote 'Quaestiones Medico-Legales'."),
    ("What is the oldest medicolegal code?",
     "Code of Hammurabi (~2200 BC, Babylon)."),
    ("What is the first book on Forensic Medicine?",
     "'Hsi Yuan Lu' by Sung Tz'u (China, 1247 AD)."),
    ("Difference between Forensic Medicine and Medical Jurisprudence?",
     "FM = medical aspects of LAW (doctor helps court). MJ = legal aspects of MEDICINE (law governs doctor)."),
    ("What are the 4 principles of medical ethics?",
     "Autonomy, Beneficence, Non-maleficence, Justice."),
    ("What are the important legal codes of Nepal?",
     "National Penal Code 2074, National Criminal Procedure Code 2074, Sentencing Act 2074 — all in force from 17 August 2018."),
    ("What replaced the Muluki Ain in Nepal?",
     "The three new codes of 2017: Penal Code, Criminal Procedure Code, Sentencing Act."),
    ("Who conducts inquest in Nepal?",
     "Police for all unnatural deaths. CDO (Chief District Officer) for custodial/prison deaths."),
    ("Is consent required for medico-legal autopsy in Nepal?",
     "NO. Police are the legal authority. Family consent is NOT required."),
    ("Where did medico-legal autopsies begin in Nepal?",
     "Bir Hospital, Kathmandu in the 1960s, performed by jail doctors (police surgeons)."),
    ("What is Clinical Forensic Medicine?",
     "Medicolegal aspects of examination of LIVING persons involved in violence or legal problems."),
]
for q, a in qas:
    story.append(qa_box(q, a))
    story.append(sp(2))

story.append(sp(6))
story.append(section_banner("8. MEMORY TRICKS", PURPLE))
story.append(sp(6))
tricks = [
    ("4 Ethics = A-B-N-J",
     '"All Big Nice Judges" → Autonomy, Beneficence, Non-maleficence, Justice'),
    ("Oldest LEGAL CODE",
     "Hammurabi (2200 BC, Babylon) — oldest medicolegal CODE"),
    ("First BOOK on FM",
     "Sung Tz'u (1247 AD, China) — 'Hsi Yuan Lu'"),
    ("Father of FM",
     "Paolo Zacchia — remember 'PaZ = Past Zero = the Beginning of FM'"),
    ("Nepal's 3 new codes",
     "All 3 enacted 2017, all in force 17 Aug 2018. Penal → Procedure → Sentence"),
    ("Nepal Inquest",
     "Police = ALL unnatural deaths. CDO = CUSTODY deaths. No consent needed for autopsy."),
    ("FM vs MJ",
     "FM: Doctor → helps Court. MJ: Law → governs Doctor."),
]
mem_cell_st = S("MemK", fontSize=9, textColor=PURPLE, fontName="Helvetica-Bold", leading=13)
mem_val_st  = S("MemV", fontSize=9, textColor=GRAY_DARK, fontName="Helvetica", leading=13)
mem_data = []
for k, v in tricks:
    mem_data.append([Paragraph(k, mem_cell_st), Paragraph(v, mem_val_st)])
mt = Table(mem_data, colWidths=[CW*0.30, CW*0.70])
mt.setStyle(TableStyle([
    ("TOPPADDING",    (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
    ("GRID",          (0,0), (-1,-1), 0.4, colors.HexColor("#d1d5db")),
    ("BACKGROUND",    (0,0), (0,-1), PURPLE_LITE),
    ("VALIGN",        (0,0), (-1,-1), "TOP"),
]))
story.append(mt)
story.append(sp(10))
story.append(info_box(
    "Good luck for your viva tomorrow!  "
    "Focus most on: Definitions (exact wording) · FM vs MJ difference · Nepal codes · Paolo Zacchia · Nepal inquest types.",
    bg=GREEN_LITE, tc=GREEN, border=GREEN
))

# ── Build ────────────────────────────────────────────────────────────────────
doc.build(story)
print("PDF created:", OUTPUT)
Running Command

cd /home/daytona/workspace/forensic-viva && python make_pdf.py

Your PDF is ready! Here's your download link:

Forensic Medicine Viva Quick Reference

PDF Document · PDF


Here is what's inside the PDF (6 pages, color-coded):
PageContent
Cover + ContentsTitle page with index
Page 2All 6 exact definitions from KS Narayan Reddy 36th Ed, each with a color-coded header
Page 3FM vs Medical Jurisprudence comparison table + 4 Ethics principles (Autonomy/Beneficence/Non-maleficence/Justice)
Page 4Nepal's 3 main legal codes (2017/2074) + other important acts + key legal principles
Page 5Nepal inquest types - Police Inquest vs CDO Inquest, detailed tables + comparison
Page 6History milestones timeline + Quick Viva Q&A + Memory Tricks
All definitions are word-for-word from KS Narayan Reddy. Good luck tomorrow!

Create a summary PDF/Word document I can print and revise tonight

Reading File
Running Command

ls /home/daytona/workspace/forensic-viva/

Writing File

~/forensic-viva/make_docx.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  Header, Footer, AlignmentType, HeadingLevel, BorderStyle, WidthType,
  ShadingType, VerticalAlign, PageNumber, NumberFormat, TableOfContents,
  LevelFormat, convertInchesToTwip, PageBreak
} = require('docx');
const fs = require('fs');

// ── Colour palette ─────────────────────────────────────────────────────────
const C = {
  darkBlue:   "1A3A5C",
  medBlue:    "2563A8",
  lightBlue:  "DBEAFE",
  orange:     "D97706",
  orangeLite: "FEF3C7",
  green:      "166534",
  greenLite:  "DCFCE7",
  red:        "991B1B",
  redLite:    "FEE2E2",
  purple:     "5B21B6",
  purpleLite: "EDE9FE",
  grayDark:   "374151",
  grayLight:  "F3F4F6",
  white:      "FFFFFF",
  yellow:     "FCD34D",
};

// ── Helpers ────────────────────────────────────────────────────────────────
const sp = (n = 80) => new Paragraph({ spacing: { before: n, after: n } });

function heading1(text, color = C.darkBlue) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, size: 28, color, font: "Calibri" })],
    spacing: { before: 240, after: 80 },
    border: { bottom: { style: BorderStyle.SINGLE, size: 8, color } }
  });
}

function heading2(text, color = C.medBlue) {
  return new Paragraph({
    children: [new TextRun({ text: `▌ ${text}`, bold: true, size: 22, color, font: "Calibri" })],
    spacing: { before: 200, after: 60 }
  });
}

function heading3(text, color = C.grayDark) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, size: 20, color, font: "Calibri" })],
    spacing: { before: 120, after: 40 }
  });
}

function para(text, { bold = false, italic = false, size = 19, color = C.grayDark, indent = 0, before = 40, after = 40 } = {}) {
  return new Paragraph({
    children: [new TextRun({ text, bold, italic, size, color, font: "Calibri" })],
    spacing: { before, after },
    indent: indent ? { left: indent } : undefined
  });
}

function bullet(text, { bold = false, color = C.grayDark, size = 19, level = 0 } = {}) {
  return new Paragraph({
    bullet: { level },
    children: [new TextRun({ text, bold, color, size, font: "Calibri" })],
    spacing: { before: 30, after: 30 },
    indent: { left: convertInchesToTwip(0.25 + level * 0.25), hanging: convertInchesToTwip(0.15) }
  });
}

function definitionBox(term, definition, note, bgColor, termColor) {
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    borders: {
      top:    { style: BorderStyle.SINGLE, size: 4, color: termColor },
      bottom: { style: BorderStyle.SINGLE, size: 4, color: termColor },
      left:   { style: BorderStyle.THICK,  size: 12, color: termColor },
      right:  { style: BorderStyle.SINGLE, size: 4, color: termColor },
    },
    rows: [
      new TableRow({ children: [new TableCell({
        shading: { type: ShadingType.SOLID, fill: termColor, color: termColor },
        margins: { top: 80, bottom: 80, left: 120, right: 120 },
        children: [new Paragraph({ children: [new TextRun({ text: term, bold: true, size: 20, color: C.white, font: "Calibri" })] })]
      })]}),
      new TableRow({ children: [new TableCell({
        shading: { type: ShadingType.SOLID, fill: "F9FAFB", color: "F9FAFB" },
        margins: { top: 80, bottom: 60, left: 140, right: 120 },
        children: [new Paragraph({ children: [new TextRun({ text: `"${definition}"`, italic: true, size: 19, color: "1F2937", font: "Calibri" })] })]
      })]}),
      new TableRow({ children: [new TableCell({
        shading: { type: ShadingType.SOLID, fill: bgColor, color: bgColor },
        margins: { top: 60, bottom: 60, left: 140, right: 120 },
        children: [new Paragraph({ children: [new TextRun({ text: `► ${note}`, bold: true, size: 18, color: termColor, font: "Calibri" })] })]
      })]}),
    ]
  });
}

function colorTable(rows, headers, colWidths, hdrBg = C.darkBlue) {
  const tableRows = [];
  if (headers && headers.length) {
    tableRows.push(new TableRow({
      tableHeader: true,
      children: headers.map((h, i) => new TableCell({
        width: { size: colWidths[i], type: WidthType.PERCENTAGE },
        shading: { type: ShadingType.SOLID, fill: hdrBg, color: hdrBg },
        margins: { top: 80, bottom: 80, left: 100, right: 80 },
        verticalAlign: VerticalAlign.CENTER,
        children: [new Paragraph({ children: [new TextRun({ text: h, bold: true, size: 18, color: C.white, font: "Calibri" })] })]
      }))
    }));
  }
  rows.forEach((row, ri) => {
    const bg = ri % 2 === 0 ? C.white : "F3F4F6";
    tableRows.push(new TableRow({
      children: row.map((cell, ci) => new TableCell({
        width: { size: colWidths[ci], type: WidthType.PERCENTAGE },
        shading: { type: ShadingType.SOLID, fill: bg, color: bg },
        margins: { top: 60, bottom: 60, left: 100, right: 80 },
        verticalAlign: VerticalAlign.TOP,
        children: [new Paragraph({ children: [new TextRun({ text: cell, size: 18, color: C.grayDark, font: "Calibri" })] })]
      }))
    }));
  });
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    borders: {
      top:            { style: BorderStyle.SINGLE, size: 4, color: "D1D5DB" },
      bottom:         { style: BorderStyle.SINGLE, size: 4, color: "D1D5DB" },
      left:           { style: BorderStyle.SINGLE, size: 4, color: "D1D5DB" },
      right:          { style: BorderStyle.SINGLE, size: 4, color: "D1D5DB" },
      insideH:        { style: BorderStyle.SINGLE, size: 4, color: "D1D5DB" },
      insideV:        { style: BorderStyle.SINGLE, size: 4, color: "D1D5DB" },
    },
    rows: tableRows
  });
}

function infoBox(text, bg, borderColor, textColor = "1F2937") {
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    borders: {
      top:    { style: BorderStyle.SINGLE, size: 4, color: borderColor },
      bottom: { style: BorderStyle.SINGLE, size: 4, color: borderColor },
      left:   { style: BorderStyle.THICK,  size: 16, color: borderColor },
      right:  { style: BorderStyle.SINGLE, size: 4, color: borderColor },
    },
    rows: [new TableRow({ children: [new TableCell({
      shading: { type: ShadingType.SOLID, fill: bg, color: bg },
      margins: { top: 80, bottom: 80, left: 140, right: 120 },
      children: text.split('\n').map(line =>
        new Paragraph({ children: [new TextRun({ text: line, size: 18, color: textColor, font: "Calibri", bold: line.startsWith('►') || line.startsWith('NOTE') || line.startsWith('TIP') })] })
      )
    })]})],
  });
}

function pageBreak() {
  return new Paragraph({ children: [new PageBreak()] });
}

function qaRow(q, a) {
  return [
    new Table({
      width: { size: 100, type: WidthType.PERCENTAGE },
      borders: {
        top:    { style: BorderStyle.NONE },
        bottom: { style: BorderStyle.SINGLE, size: 4, color: "E5E7EB" },
        left:   { style: BorderStyle.NONE },
        right:  { style: BorderStyle.NONE },
        insideH:{ style: BorderStyle.NONE },
        insideV:{ style: BorderStyle.NONE },
      },
      rows: [
        new TableRow({ children: [new TableCell({
          shading: { type: ShadingType.SOLID, fill: C.orangeLite, color: C.orangeLite },
          margins: { top: 60, bottom: 60, left: 120, right: 100 },
          children: [new Paragraph({ children: [new TextRun({ text: `Q: ${q}`, bold: true, size: 18, color: C.orange, font: "Calibri" })] })]
        })]}),
        new TableRow({ children: [new TableCell({
          shading: { type: ShadingType.SOLID, fill: C.white, color: C.white },
          margins: { top: 60, bottom: 80, left: 120, right: 100 },
          children: [new Paragraph({ children: [new TextRun({ text: `A: ${a}`, size: 18, color: C.grayDark, font: "Calibri" })] })]
        })]}),
      ]
    }),
    sp(40)
  ];
}

// ═══════════════════════════════════════════════════════════════════════════
// DOCUMENT CONTENT
// ═══════════════════════════════════════════════════════════════════════════

const children = [];

// ── COVER ──────────────────────────────────────────────────────────────────
children.push(sp(200));
children.push(new Paragraph({
  alignment: AlignmentType.CENTER,
  children: [new TextRun({ text: "FORENSIC MEDICINE", bold: true, size: 56, color: C.darkBlue, font: "Calibri" })]
}));
children.push(new Paragraph({
  alignment: AlignmentType.CENTER,
  children: [new TextRun({ text: "VIVA QUICK REFERENCE", bold: true, size: 40, color: C.medBlue, font: "Calibri" })]
}));
children.push(sp(80));
children.push(new Paragraph({
  alignment: AlignmentType.CENTER,
  border: { top: { style: BorderStyle.SINGLE, size: 6, color: C.medBlue }, bottom: { style: BorderStyle.SINGLE, size: 6, color: C.medBlue } },
  spacing: { before: 100, after: 100 },
  children: [new TextRun({ text: "Based on: KS Narayan Reddy & OP Murty", bold: true, size: 22, color: C.grayDark, font: "Calibri" })]
}));
children.push(new Paragraph({
  alignment: AlignmentType.CENTER,
  children: [new TextRun({ text: "The Essentials of Forensic Medicine & Toxicology, 36th Edition (2026)", italic: true, size: 20, color: C.grayDark, font: "Calibri" })]
}));
children.push(sp(40));
children.push(new Paragraph({
  alignment: AlignmentType.CENTER,
  children: [new TextRun({ text: "+ Nepal Legal Codes & Inquest Types", bold: true, size: 22, color: C.orange, font: "Calibri" })]
}));
children.push(sp(40));
children.push(new Paragraph({
  alignment: AlignmentType.CENTER,
  children: [new TextRun({ text: "Viva Date: 8 July 2026", size: 20, color: "6B7280", font: "Calibri", italics: true })]
}));
children.push(sp(200));

// Sections list
const sections = [
  "1.  Key Definitions (Exact Wording — KS Narayan Reddy)",
  "2.  Forensic Medicine vs Medical Jurisprudence",
  "3.  Four Principles of Medical Ethics",
  "4.  Important Legal Codes of Nepal",
  "5.  Types of Inquest in Nepal",
  "6.  History of Forensic Medicine — Key Milestones",
  "7.  Quick Viva Q&A",
  "8.  Memory Tricks",
];
children.push(new Paragraph({
  alignment: AlignmentType.CENTER,
  children: [new TextRun({ text: "CONTENTS", bold: true, size: 24, color: C.darkBlue, font: "Calibri" })]
}));
children.push(sp(40));
sections.forEach(s => children.push(new Paragraph({
  alignment: AlignmentType.CENTER,
  children: [new TextRun({ text: s, size: 20, color: C.grayDark, font: "Calibri" })]
})));

children.push(pageBreak());

// ═══════════════════════════════════════════════════════════════════════════
// SECTION 1: DEFINITIONS
// ═══════════════════════════════════════════════════════════════════════════
children.push(heading1("1. KEY DEFINITIONS (EXACT — KS NARAYAN REDDY 36th Ed.)", C.darkBlue));
children.push(sp(60));
children.push(infoBox(
  "These are word-for-word definitions from the textbook. Learn them exactly as written.\nSource: The Essentials of Forensic Medicine & Toxicology, 36th Edition, KS Narayan Reddy & OP Murty.",
  C.lightBlue, C.medBlue, "1E40AF"
));
children.push(sp(80));

const defs = [
  {
    term: "1. Forensic Medicine / Legal Medicine",
    def: "Forensic or legal medicine (forensic = forums of or used in courts of law) deals with the application of medical and paramedical knowledge to aid in the administration of justice. It is used by the legal authorities for the solution of legal problems.",
    note: "In short: deals with MEDICAL aspects of LAW",
    bg: C.lightBlue, col: C.medBlue
  },
  {
    term: "2. Medical Jurisprudence",
    def: "Medical jurisprudence (juris = law; Prudentia = knowledge) deals with legal responsibilities of the physician with particular reference to those arising from physician-patient relationship, such as medical negligence cases, consent, rights and duties of doctors, serious professional misconduct, medical ethics, etc.",
    note: "In short: deals with LEGAL aspects of PRACTICE OF MEDICINE",
    bg: "E0F2FE", col: "0369A1"
  },
  {
    term: "3. Clinical Forensic Medicine",
    def: "Clinical forensic medicine deals with medicolegal aspects of examination of living human beings caused by or associated with all types of violence and other cases where legal problems are involved.",
    note: "Key: LIVING persons + violence/legal problems",
    bg: C.orangeLite, col: C.orange
  },
  {
    term: "4. Forensic Pathology",
    def: "Forensic pathology deals with the study and application of the effects of violence or unnatural disease in its various forms in or on the human body; in determining the cause and manner of death in case of violence, suspicious, unexplained, unexpected, sudden and medically unattended deaths.",
    note: "Key: DEATH investigation — cause and MANNER of death",
    bg: C.redLite, col: C.red
  },
  {
    term: "5. State Medicine",
    def: "State medicine deals with legal aspects of practice of medicine, regulating professional activities of medical practitioners, standard and uniformity of medical education, and health requirement of community and environmental health.",
    note: "Key: REGULATION of medical profession + community health",
    bg: C.purpleLite, col: C.purple
  },
  {
    term: "6. Medical Ethics",
    def: "Medical ethics deals with the moral principles which should guide members of the medical profession in their dealings with each other, their patients and the State.",
    note: "Key: MORAL principles guiding doctors",
    bg: C.greenLite, col: C.green
  },
];

defs.forEach(d => {
  children.push(definitionBox(d.term, d.def, d.note, d.bg, d.col));
  children.push(sp(60));
});

children.push(sp(60));
children.push(infoBox(
  "VIVA TRAP — Most Asked Difference:\n► Forensic Medicine = Doctor helps the COURT (medical knowledge → legal problems)\n► Medical Jurisprudence = LAW governs the DOCTOR (legal duties of the physician)",
  C.orangeLite, C.orange, "92400E"
));

children.push(pageBreak());

// ═══════════════════════════════════════════════════════════════════════════
// SECTION 2: FM vs MJ
// ═══════════════════════════════════════════════════════════════════════════
children.push(heading1("2. FORENSIC MEDICINE vs MEDICAL JURISPRUDENCE", C.medBlue));
children.push(sp(60));
children.push(colorTable(
  [
    ["Full name",   "Forensic Medicine / Legal Medicine",        "Medical Jurisprudence"],
    ["Etymology",   "Forensic = courts of law",                  "Juris = law; Prudentia = knowledge"],
    ["Who benefits","Courts / Legal authorities",                 "The Doctor / Medical profession"],
    ["Deals with",  "Medical aspects of LAW",                    "Legal aspects of MEDICINE"],
    ["Examples",    "Murder, suicide, poisoning, sexual offences, injuries", "Negligence, consent, misconduct, rights of doctors"],
    ["One-liner",   "Doctor HELPS the Court",                    "Law GOVERNS the Doctor"],
  ],
  ["Feature", "Forensic Medicine", "Medical Jurisprudence"],
  [25, 37, 38], C.medBlue
));

children.push(sp(100));

// ═══════════════════════════════════════════════════════════════════════════
// SECTION 3: ETHICS
// ═══════════════════════════════════════════════════════════════════════════
children.push(heading1("3. FOUR PRINCIPLES OF MEDICAL ETHICS", C.orange));
children.push(sp(40));
children.push(para("(Beauchamp & Childress — Endorsed by KS Narayan Reddy)", { italic: true, size: 18, color: "6B7280" }));
children.push(sp(60));

const ethics = [
  { name: "1. AUTONOMY", def: "Patient's right to make decisions about their own body and treatment — including the right to REFUSE treatment, even if life-saving.", eg: "Patient can refuse surgery. Doctor must respect this.", col: C.orange, bg: C.orangeLite },
  { name: "2. BENEFICENCE", def: "Doctor must actively ACT in the best interest of the patient. Do something GOOD.", eg: "Give the best possible treatment available.", col: C.green, bg: C.greenLite },
  { name: "3. NON-MALEFICENCE", def: '"Primum non nocere" — First, do no harm. Avoid procedures or treatments that cause more harm than benefit. More RESTRICTIVE than beneficence (negative duty).', eg: "Do not perform unnecessary surgery that risks the patient's life.", col: C.red, bg: C.redLite },
  { name: "4. JUSTICE", def: "Fair and equal treatment for ALL patients regardless of status, gender, religion, or financial situation. Distribute healthcare resources fairly.", eg: "Treat rich and poor patients equally.", col: C.purple, bg: C.purpleLite },
];

ethics.forEach(e => {
  children.push(new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    borders: {
      top:    { style: BorderStyle.SINGLE, size: 4, color: e.col },
      bottom: { style: BorderStyle.SINGLE, size: 4, color: e.col },
      left:   { style: BorderStyle.THICK,  size: 14, color: e.col },
      right:  { style: BorderStyle.SINGLE, size: 4, color: e.col },
    },
    rows: [
      new TableRow({ children: [new TableCell({
        shading: { type: ShadingType.SOLID, fill: e.col, color: e.col },
        margins: { top: 70, bottom: 70, left: 120, right: 100 },
        children: [new Paragraph({ children: [new TextRun({ text: e.name, bold: true, size: 20, color: C.white, font: "Calibri" })] })]
      })]}),
      new TableRow({ children: [new TableCell({
        shading: { type: ShadingType.SOLID, fill: "F9FAFB", color: "F9FAFB" },
        margins: { top: 70, bottom: 50, left: 140, right: 120 },
        children: [new Paragraph({ children: [new TextRun({ text: e.def, size: 19, color: "1F2937", font: "Calibri" })] })]
      })]}),
      new TableRow({ children: [new TableCell({
        shading: { type: ShadingType.SOLID, fill: e.bg, color: e.bg },
        margins: { top: 50, bottom: 70, left: 140, right: 120 },
        children: [new Paragraph({ children: [new TextRun({ text: `Example: ${e.eg}`, size: 18, bold: true, color: e.col, font: "Calibri" })] })]
      })]}),
    ]
  }));
  children.push(sp(50));
});

children.push(infoBox(
  "KEY DIFFERENCE — Beneficence vs Non-maleficence:\n► Beneficence = DO GOOD actively (positive duty — you must act)\n► Non-maleficence = DO NOT HARM (negative duty — you must avoid)\nBoth are DIFFERENT — never confuse them in viva!",
  C.orangeLite, C.orange, "92400E"
));

children.push(pageBreak());

// ═══════════════════════════════════════════════════════════════════════════
// SECTION 4: NEPAL LEGAL CODES
// ═══════════════════════════════════════════════════════════════════════════
children.push(heading1("4. IMPORTANT LEGAL CODES OF NEPAL", "065F46"));
children.push(sp(40));
children.push(infoBox(
  "Nepal replaced the old Muluki Ain (1963) with THREE new codes.\nEnacted: 8 August 2017  |  Came into force: 17 AUGUST 2018",
  C.greenLite, C.green, C.green
));
children.push(sp(80));

children.push(heading2("A) The Three Main Codes (2074 BS / 2017 AD)", "065F46"));
children.push(sp(50));
children.push(colorTable(
  [
    [
      "National Penal (Criminal) Code, 2074 (2017)\nMuluki Aparadh Sanhita\n(Act enacted: 8 Aug 2017 | In force: 17 Aug 2018)",
      "Replaces the old IPC equivalent. Defines ALL criminal offences and prescribes punishments.\n267 sections, 12 chapters.\n\nForensic relevance:\n• Defines murder, rape, grievous hurt, kidnapping, poisoning\n• Offences relating to medical treatment: Sections 231, 232, 233\n• Crimes against the person, public safety, State\n\nKey principles: Presumption of innocence, Nullum crimen sine lege, Proportionality, Right to fair trial"
    ],
    [
      "National Criminal Procedure (Code) Act, 2074 (2017)\nMuluki Faujadaree Karyawidhi Sanhita\n(Act enacted: 8 Aug 2017 | In force: 17 Aug 2018)",
      "Replaces the old CrPC equivalent. Governs HOW criminal investigations and trials are conducted.\n\nForensic relevance:\n• Governs police inquest procedures\n• Governs medico-legal autopsy requests\n• Rules for arrest, investigation, evidence collection\n• Defines court hierarchy (District Court → High Court → Supreme Court)\n• Custodial death investigation procedures"
    ],
    [
      "Criminal Offences (Determination & Execution of Sentence) Act, 2074 (2017)\nSentencing Act",
      "Determines how punishments are decided and executed. Replaces scattered sentencing provisions across old laws.\n\nForensic relevance:\n• Proportionality of sentencing\n• Implementation of court decisions"
    ],
  ],
  ["Act Name / Nepali Name", "What It Covers + Forensic Relevance"],
  [38, 62], "065F46"
));

children.push(sp(100));

children.push(heading2("B) Other Important Nepal Acts (Forensic Context)", "065F46"));
children.push(sp(50));
children.push(colorTable(
  [
    ["Constitution of Nepal, 2072 (2015)", "Foundation of all law. Guarantees right to life, right against torture, equality before law, right to fair trial."],
    ["Nepal Medical Council Act, 2020 B.S. (1964)", "Regulates medical practice. Covers professional misconduct, licensing, registration, and disciplinary action against doctors."],
    ["Human Body Organ Transplant (Regulation & Prohibition) Act, 2055 (1998)", "Governs organ donation and transplantation. Defines legal and illegal transplantation."],
    ["Mental Health Act", "Mental capacity, fitness to stand trial, consent in psychiatric patients."],
    ["Consumer Protection Act", "Patients can file complaints against doctors for medical negligence under this Act."],
  ],
  ["Act", "Forensic Relevance"],
  [38, 62], "14532D"
));

children.push(sp(100));

children.push(heading2("C) Key Legal Principles — Nepal Penal Code 2074", "065F46"));
children.push(sp(50));
children.push(colorTable(
  [
    ["Presumption of Innocence", "The accused is INNOCENT until proven guilty by the court."],
    ["Nullum crimen sine lege", "No crime without law — nobody can be punished for an act not defined as a crime."],
    ["Proportionality in Sentencing", "The punishment must match the severity of the offence."],
    ["Right to Fair Trial", "Every accused has the right to a fair hearing and legal representation."],
    ["Equality Before Law", "All persons are equal before the law — no discrimination."],
  ],
  ["Principle", "Meaning"],
  [35, 65], "065F46"
));

children.push(pageBreak());

// ═══════════════════════════════════════════════════════════════════════════
// SECTION 5: INQUEST IN NEPAL
// ═══════════════════════════════════════════════════════════════════════════
children.push(heading1("5. TYPES OF INQUEST IN NEPAL", C.red));
children.push(sp(40));
children.push(infoBox(
  "Definition: An inquest is an official inquiry / investigation into the CAUSE and CIRCUMSTANCES of death.\nNepal follows an INTEGRATED SERVICE MODEL — POLICE lead ALL death investigations.\nLegal authority: National Criminal Procedure Code 2074 (2017)",
  C.redLite, C.red, C.red
));
children.push(sp(80));

// Type 1
children.push(new Table({
  width: { size: 100, type: WidthType.PERCENTAGE },
  borders: { top: { style: BorderStyle.SINGLE, size: 4, color: C.medBlue }, bottom: { style: BorderStyle.SINGLE, size: 4, color: C.medBlue }, left: { style: BorderStyle.THICK, size: 14, color: C.medBlue }, right: { style: BorderStyle.SINGLE, size: 4, color: C.medBlue }, insideH: { style: BorderStyle.NONE }, insideV: { style: BorderStyle.NONE } },
  rows: [
    new TableRow({ children: [new TableCell({
      shading: { type: ShadingType.SOLID, fill: C.medBlue, color: C.medBlue },
      margins: { top: 80, bottom: 80, left: 120, right: 100 },
      children: [new Paragraph({ children: [new TextRun({ text: "TYPE 1: POLICE INQUEST", bold: true, size: 22, color: C.white, font: "Calibri" })] })]
    })]})
  ]
}));
children.push(colorTable(
  [
    ["Conducted by",    "Police Officer-in-Charge (Sub-Inspector or above)"],
    ["When",           "ALL unnatural deaths — accidents, suicides, homicides, suspicious deaths, drowning, burns, etc."],
    ["Legal authority","National Criminal Procedure Code, 2074 (2017)"],
    ["Process",        "1. Police visit scene of death\n2. External examination of body\n3. Fill inquest form\n4. Classify death: criminal vs non-criminal\n5. Order medico-legal autopsy at nearest government hospital if needed"],
    ["Consent",        "NO — family consent is NOT required for medico-legal autopsy"],
    ["Outcome",        "Preliminary inquest form compiled; body released for cremation after autopsy"],
    ["Autopsy done at","Nearest government hospital by government-appointed doctor"],
  ],
  ["Feature", "Details"],
  [25, 75], C.medBlue
));
children.push(sp(80));

// Type 2
children.push(new Table({
  width: { size: 100, type: WidthType.PERCENTAGE },
  borders: { top: { style: BorderStyle.SINGLE, size: 4, color: C.purple }, bottom: { style: BorderStyle.SINGLE, size: 4, color: C.purple }, left: { style: BorderStyle.THICK, size: 14, color: C.purple }, right: { style: BorderStyle.SINGLE, size: 4, color: C.purple }, insideH: { style: BorderStyle.NONE }, insideV: { style: BorderStyle.NONE } },
  rows: [new TableRow({ children: [new TableCell({
    shading: { type: ShadingType.SOLID, fill: C.purple, color: C.purple },
    margins: { top: 80, bottom: 80, left: 120, right: 100 },
    children: [new Paragraph({ children: [new TextRun({ text: "TYPE 2: DISTRICT CHIEF OFFICER (CDO) / ADMINISTRATIVE INQUEST", bold: true, size: 22, color: C.white, font: "Calibri" })] })]
  })]})],
}));
children.push(colorTable(
  [
    ["Conducted by",    "Chief District Officer (CDO) or District Administration Office"],
    ["When",           "CUSTODIAL DEATHS — deaths in police custody, prison deaths, deaths of public importance"],
    ["Legal authority","National Criminal Procedure Code, 2074 (2017)"],
    ["Why separate",   "Ensures INDEPENDENT investigation when police themselves may be implicated (e.g., custody death)"],
    ["Process",        "More formal than police inquest — witnesses examined, statements recorded, detailed report submitted to court"],
    ["Consent",        "NO — not required"],
    ["Autopsy",        "Ordered as part of the independent investigation"],
  ],
  ["Feature", "Details"],
  [25, 75], C.purple
));
children.push(sp(80));

// Comparison
children.push(heading2("Comparison: Police Inquest vs CDO Inquest", C.grayDark));
children.push(sp(40));
children.push(colorTable(
  [
    ["Authority",        "Police (Sub-Inspector or above)",           "Chief District Officer (CDO)"],
    ["Cases",            "ALL unnatural/suspicious deaths",           "Custodial and prison deaths"],
    ["Purpose",          "Determine nature of death (criminal/not)",  "Independent accountability investigation"],
    ["Formality",        "Preliminary / routine",                     "Formal — witnesses and statements recorded"],
    ["Family consent",   "Not required",                              "Not required"],
    ["Autopsy",          "Can order medico-legal autopsy",            "Ordered as part of formal investigation"],
  ],
  ["Feature", "Police Inquest", "CDO Inquest"],
  [25, 37, 38], "374151"
));
children.push(sp(80));

children.push(infoBox(
  "HISTORY OF FORENSIC MEDICINE IN NEPAL:\n• 1854 — Earliest written law (Muluki Ain) enacted, based on Hindu principles + British law\n• 1951 — Nepal became democratic; medicolegal services SYSTEMATIZED by statutes\n• 1960s — Medico-legal autopsies STARTED at Bir Hospital, Kathmandu (by jail doctors / police surgeons)\n• 2017/2018 — New codes replaced Muluki Ain 1963",
  C.greenLite, C.green, C.green
));

children.push(pageBreak());

// ═══════════════════════════════════════════════════════════════════════════
// SECTION 6: HISTORY
// ═══════════════════════════════════════════════════════════════════════════
children.push(heading1("6. HISTORY OF FORENSIC MEDICINE — KEY MILESTONES", C.orange));
children.push(sp(40));
children.push(colorTable(
  [
    ["~3000 BC",   "Chinese Materia Medica",          "First mention of poisons in written record"],
    ["~2700 BC",   "Imhotep (Egypt)",                 "Grand Vizier, chief physician of King Zoser — enacted rules for medical practice"],
    ["~2200 BC",   "Code of Hammurabi (Babylon)",     "OLDEST known medicolegal code in history"],
    ["7th C BC",   "Charaka Samhita (India)",         "Duties of physicians + detailed description of poisons"],
    ["4th C BC",   "Artha Shastra — Kautilya",        "Penal laws, examination of dead bodies in unnatural deaths. Physicians punished for negligence."],
    ["4th C BC",   "Manu Smriti — Manu",              "Laws on sexual offences, mental incapacity from intoxication/illness"],
    ["460–377 BC", "Hippocrates (Greece)",            "Father of Western Medicine. Discussed lethality of wounds. Contributed to medical ethics."],
    ["200–300 AD", "Sushruta (India)",                "Father of Indian Surgery. Sushruta Samhita — classified wounds, fractures, poisons."],
    ["1247 AD",    "Sung Tz'u (China)",               "Wrote 'Hsi Yuan Lu' — FIRST book ever on Forensic Medicine"],
    ["1598 AD",    "Fortunato Fidelis (Italy)",       "First to PRACTICE forensic medicine in the modern sense"],
    ["1621 AD",    "Paolo Zacchia (Italy)",           "FATHER OF FORENSIC MEDICINE — wrote 'Quaestiones Medico-Legales'"],
    ["1788 AD",    "Dr. Samuel Farr (England)",       "First English textbook on Medical Jurisprudence"],
    ["1951",       "Nepal",                           "Medicolegal services systematized by statutes"],
    ["1960s",      "Nepal",                           "Medico-legal autopsies started at Bir Hospital, Kathmandu"],
    ["2018",       "Nepal",                           "New codes (National Penal Code, Criminal Procedure Code) came into force: 17 August 2018"],
  ],
  ["Period", "Person / Event", "Significance"],
  [18, 30, 52], C.orange
));

children.push(pageBreak());

// ═══════════════════════════════════════════════════════════════════════════
// SECTION 7: QUICK QA
// ═══════════════════════════════════════════════════════════════════════════
children.push(heading1("7. QUICK VIVA Q&A", C.red));
children.push(sp(40));

const qas = [
  ["Define Forensic Medicine.", "Application of medical and paramedical knowledge to aid in the administration of justice. It deals with medical aspects of law."],
  ["Who is the Father of Forensic Medicine?", "Paolo Zacchia (Italy, 1621) — wrote 'Quaestiones Medico-Legales'."],
  ["What is the oldest medicolegal code?", "Code of Hammurabi (~2200 BC, Babylon) — oldest known medicolegal code."],
  ["What is the first book on Forensic Medicine?", "'Hsi Yuan Lu' by Sung Tz'u (China, 1247 AD) — first book ever on forensic medicine."],
  ["Difference between FM and Medical Jurisprudence?", "FM = medical aspects of LAW (doctor helps court). MJ = legal aspects of MEDICINE (law governs doctor)."],
  ["What are the 4 principles of medical ethics?", "Autonomy, Beneficence, Non-maleficence, Justice."],
  ["Define Clinical Forensic Medicine.", "Medicolegal aspects of examination of living human beings caused by or associated with violence or other cases involving legal problems."],
  ["What are the important legal codes of Nepal?", "National Penal Code 2074, National Criminal Procedure Code 2074, and Sentencing Act 2074 — all came into force 17 August 2018."],
  ["What replaced the Muluki Ain in Nepal?", "Three new codes enacted in 2017: National Penal Code, National Criminal Procedure Code, and Sentencing Act — in force from 17 August 2018."],
  ["How many types of inquest are there in Nepal?", "Two types: (1) Police Inquest — for all unnatural deaths. (2) CDO / Administrative Inquest — for custodial and prison deaths."],
  ["Who conducts inquest in Nepal?", "Police conduct inquest for all unnatural deaths. Chief District Officer (CDO) conducts inquest for custodial/prison deaths."],
  ["Is family consent required for medico-legal autopsy in Nepal?", "NO. In Nepal, police are the legal death-investigating authority. Family consent is NOT required."],
  ["Where did medico-legal autopsies begin in Nepal?", "Bir Hospital, Kathmandu in the 1960s, performed by jail doctors (police surgeons)."],
  ["Define Medical Jurisprudence.", "Deals with legal responsibilities of the physician — especially those from physician-patient relationship (negligence, consent, rights and duties of doctors)."],
  ["Define Forensic Pathology.", "Study of effects of violence or unnatural disease on the body; determines cause and manner of death in violent, suspicious, sudden, unexplained, and medically unattended deaths."],
];

qas.forEach(([q, a]) => { qaRow(q, a).forEach(e => children.push(e)); });

children.push(pageBreak());

// ═══════════════════════════════════════════════════════════════════════════
// SECTION 8: MEMORY TRICKS
// ═══════════════════════════════════════════════════════════════════════════
children.push(heading1("8. MEMORY TRICKS", C.purple));
children.push(sp(40));

const tricks = [
  ["4 Ethics Pillars", '"All Big Nice Judges" → Autonomy, Beneficence, Non-maleficence, Justice', C.orangeLite, C.orange],
  ["Oldest CODE", "Hammurabi (2200 BC, Babylon) = oldest medicolegal CODE", C.lightBlue, C.medBlue],
  ["First BOOK", "Sung Tz'u (1247 AD, China) = 'Hsi Yuan Lu' = first BOOK on FM", C.greenLite, C.green],
  ["Father of FM", "Paolo Zacchia = 'PaZ = Past Zero = The BEGINNING of FM'", C.purpleLite, C.purple],
  ["Nepal 3 New Codes", "Penal → Procedure → Sentence. All 2017, all in force 17 Aug 2018.", C.redLite, C.red],
  ["Nepal Inquest", "Police = ALL unnatural deaths. CDO = CUSTODY deaths. No consent needed.", C.orangeLite, C.orange],
  ["FM vs MJ", "FM: Doctor → helps Court. MJ: Law → governs Doctor.", C.lightBlue, C.medBlue],
  ["Beneficence vs Non-mal", "Beneficence = DO GOOD (positive duty). Non-maleficence = DO NOT HARM (negative duty).", C.greenLite, C.green],
];

tricks.forEach(([k, v, bg, col]) => {
  children.push(new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    borders: { top: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.SINGLE, size: 4, color: "E5E7EB" }, left: { style: BorderStyle.THICK, size: 12, color: col }, right: { style: BorderStyle.NONE }, insideH: { style: BorderStyle.NONE }, insideV: { style: BorderStyle.NONE } },
    rows: [new TableRow({ children: [
      new TableCell({
        width: { size: 28, type: WidthType.PERCENTAGE },
        shading: { type: ShadingType.SOLID, fill: bg, color: bg },
        margins: { top: 70, bottom: 70, left: 110, right: 80 },
        verticalAlign: VerticalAlign.CENTER,
        children: [new Paragraph({ children: [new TextRun({ text: k, bold: true, size: 18, color: col, font: "Calibri" })] })]
      }),
      new TableCell({
        width: { size: 72, type: WidthType.PERCENTAGE },
        margins: { top: 70, bottom: 70, left: 110, right: 80 },
        verticalAlign: VerticalAlign.CENTER,
        children: [new Paragraph({ children: [new TextRun({ text: v, size: 18, color: "1F2937", font: "Calibri" })] })]
      }),
    ]})]
  }));
  children.push(sp(30));
});

children.push(sp(100));
children.push(infoBox(
  "BEST OF LUCK FOR YOUR VIVA TOMORROW!\nFocus most on: Exact definitions · FM vs MJ difference · Nepal codes · Paolo Zacchia · Nepal inquest types.\nSource: KS Narayan Reddy & OP Murty, Essentials of Forensic Medicine & Toxicology, 36th Ed. (2026)",
  C.greenLite, C.green, C.green
));

// ═══════════════════════════════════════════════════════════════════════════
// BUILD DOCUMENT
// ═══════════════════════════════════════════════════════════════════════════
const doc = new Document({
  creator: "Orris AI",
  title: "Forensic Medicine Viva Quick Reference",
  description: "Based on KS Narayan Reddy 36th Edition + Nepal Legal Codes",
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: 19, color: C.grayDark }
      }
    }
  },
  sections: [{
    properties: {
      page: {
        margin: {
          top:    convertInchesToTwip(1.0),
          bottom: convertInchesToTwip(1.0),
          left:   convertInchesToTwip(1.1),
          right:  convertInchesToTwip(1.1),
        }
      }
    },
    headers: {
      default: new Header({
        children: [new Paragraph({
          alignment: AlignmentType.RIGHT,
          border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: "D1D5DB" } },
          children: [
            new TextRun({ text: "Forensic Medicine Viva Reference  |  KS Narayan Reddy 36th Ed.", size: 16, color: "9CA3AF", font: "Calibri" }),
          ]
        })]
      })
    },
    footers: {
      default: new Footer({
        children: [new Paragraph({
          alignment: AlignmentType.CENTER,
          border: { top: { style: BorderStyle.SINGLE, size: 4, color: "D1D5DB" } },
          children: [
            new TextRun({ text: "Page ", size: 16, color: "9CA3AF", font: "Calibri" }),
            new TextRun({ children: [PageNumber.CURRENT], size: 16, color: "9CA3AF", font: "Calibri" }),
            new TextRun({ text: " of ", size: 16, color: "9CA3AF", font: "Calibri" }),
            new TextRun({ children: [PageNumber.TOTAL_PAGES], size: 16, color: "9CA3AF", font: "Calibri" }),
          ]
        })]
      })
    },
    children
  }]
});

const OUT = "/home/daytona/workspace/forensic-viva/Forensic_Medicine_Viva_Summary.docx";
Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync(OUT, buf);
  console.log("DOCX created:", OUT);
}).catch(err => { console.error(err); process.exit(1); });
Running Command

cd /home/daytona/workspace/forensic-viva && node make_docx.js 2>&1

Running Command

cd /home/daytona/workspace/forensic-viva && python /home/daytona/skills/docx/scr…

Running Command

cd /home/daytona/workspace/forensic-viva && python -c " from zipfile import ZipF…

The file is valid - proper ZIP structure, well-formed XML, all sections present. Your Word document is ready to download and print:

Forensic Medicine Viva Summary

Word Document · DOCX


Here's what's inside the document (print-ready, A4, 1-inch margins):
SectionContent
Cover pageTitle + textbook source + date
Section 1All 6 exact definitions (KS Narayan Reddy, word-for-word), each in a colour-coded box with the exact quote + a "key takeaway" line
Section 2FM vs Medical Jurisprudence - side-by-side comparison table
Section 34 Ethics principles (Autonomy/Beneficence/Non-maleficence/Justice) - each with definition and example, colour-coded
Section 4Nepal's 3 main legal codes (2074/2017) + other acts + key principles table
Section 5Nepal inquest types - Police Inquest + CDO Inquest detailed tables + comparison
Section 6History milestones table (3000 BC to 2018)
Section 715 Quick Viva Q&As in orange question / plain answer format
Section 8Memory tricks table - colour-coded
The document has a running header (book name) and page numbers on every page so it's easy to navigate after printing. Good luck tonight!
This is a shared conversation. Sign in to Orris to start your own chat.