Make a presentation pdf on diagnosis of insanity only from reddy book fmt only
mkdir -p /home/daytona/workspace/insanity-presentation && ls /home/daytona/works…
~/insanity-presentation/create_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, HRFlowable
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import KeepTogether
# ── colour palette ──────────────────────────────────────────────────────────
DARK_BLUE = colors.HexColor("#1a3a5c")
MID_BLUE = colors.HexColor("#2e6da4")
LIGHT_BLUE = colors.HexColor("#d6e4f0")
ACCENT = colors.HexColor("#e74c3c")
GOLD = colors.HexColor("#f39c12")
WHITE = colors.white
DARK_TEXT = colors.HexColor("#1c1c1c")
GREY_BG = colors.HexColor("#f4f6f8")
GREY_LINE = colors.HexColor("#aab4be")
# ── document ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
"/home/daytona/workspace/insanity-presentation/Diagnosis_of_Insanity_Reddy.pdf",
pagesize=A4,
leftMargin=1.8*cm, rightMargin=1.8*cm,
topMargin=1.8*cm, bottomMargin=2*cm,
)
W = A4[0] - 3.6*cm # usable width
styles = getSampleStyleSheet()
# ── custom styles ─────────────────────────────────────────────────────────────
def S(name, **kw):
return ParagraphStyle(name, **kw)
title_style = S("SlideTitle",
fontName="Helvetica-Bold", fontSize=22,
textColor=WHITE, alignment=TA_CENTER,
spaceAfter=4)
subtitle_style = S("SlideSubtitle",
fontName="Helvetica", fontSize=13,
textColor=LIGHT_BLUE, alignment=TA_CENTER,
spaceAfter=2)
source_style = S("Source",
fontName="Helvetica-Oblique", fontSize=9,
textColor=GOLD, alignment=TA_CENTER)
slide_heading = S("SlideHeading",
fontName="Helvetica-Bold", fontSize=15,
textColor=DARK_BLUE, spaceBefore=6, spaceAfter=6,
borderPad=4)
section_heading = S("SectionHeading",
fontName="Helvetica-Bold", fontSize=12,
textColor=MID_BLUE, spaceBefore=8, spaceAfter=3)
body_style = S("Body",
fontName="Helvetica", fontSize=10.5,
textColor=DARK_TEXT, leading=16,
spaceAfter=3, alignment=TA_JUSTIFY)
bullet_style = S("Bullet",
fontName="Helvetica", fontSize=10.5,
textColor=DARK_TEXT, leading=16,
leftIndent=14, firstLineIndent=-14,
spaceBefore=2, spaceAfter=2)
subbullet_style = S("SubBullet",
fontName="Helvetica", fontSize=10,
textColor=colors.HexColor("#444444"), leading=15,
leftIndent=30, firstLineIndent=-14,
spaceBefore=1, spaceAfter=1)
table_header_style = S("ThStyle",
fontName="Helvetica-Bold", fontSize=9.5,
textColor=WHITE, alignment=TA_CENTER)
table_cell_style = S("TdStyle",
fontName="Helvetica", fontSize=9,
textColor=DARK_TEXT, leading=13,
alignment=TA_LEFT)
footnote_style = S("Footnote",
fontName="Helvetica-Oblique", fontSize=8.5,
textColor=colors.HexColor("#555555"),
alignment=TA_CENTER, spaceBefore=4)
# ── helpers ───────────────────────────────────────────────────────────────────
def bullet(text, style=bullet_style):
return Paragraph(f"• {text}", style)
def subbullet(text):
return Paragraph(f"◦ {text}", subbullet_style)
def hline(color=GREY_LINE, thickness=0.5):
return HRFlowable(width="100%", thickness=thickness, color=color, spaceAfter=6, spaceBefore=2)
def slide_title_block(title_text, subtitle_text=None):
"""Draws a full-width coloured header block for each slide."""
inner = [Paragraph(title_text, title_style)]
if subtitle_text:
inner.append(Paragraph(subtitle_text, subtitle_style))
t = Table([[inner]], colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
("TOPPADDING", (0,0), (-1,-1), 10),
("BOTTOMPADDING",(0,0),(-1,-1), 10),
("LEFTPADDING", (0,0), (-1,-1), 12),
("RIGHTPADDING",(0,0), (-1,-1), 12),
("ROUNDEDCORNERS", [6]),
]))
return t
def section_box(text):
p = Paragraph(text, S("sb", fontName="Helvetica-Bold", fontSize=11,
textColor=WHITE, alignment=TA_LEFT))
t = Table([[p]], colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), MID_BLUE),
("TOPPADDING", (0,0),(-1,-1), 6),
("BOTTOMPADDING",(0,0),(-1,-1), 6),
("LEFTPADDING", (0,0),(-1,-1), 10),
("RIGHTPADDING",(0,0),(-1,-1), 10),
]))
return t
def info_box(text, bg=LIGHT_BLUE, tc=DARK_BLUE):
p = Paragraph(text, S("ib", fontName="Helvetica", fontSize=10,
textColor=tc, leading=15, alignment=TA_JUSTIFY))
t = Table([[p]], colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), bg),
("TOPPADDING", (0,0),(-1,-1), 8),
("BOTTOMPADDING",(0,0),(-1,-1), 8),
("LEFTPADDING", (0,0),(-1,-1), 10),
("RIGHTPADDING",(0,0),(-1,-1), 10),
("BOX", (0,0),(-1,-1), 0.5, MID_BLUE),
]))
return t
def spacer(h=0.25):
return Spacer(1, h*cm)
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# BUILD STORY
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
story = []
# ============================================================
# SLIDE 1 – TITLE
# ============================================================
story.append(spacer(4))
cover = Table([[Paragraph("DIAGNOSIS OF INSANITY",
S("ct", fontName="Helvetica-Bold", fontSize=28,
textColor=WHITE, alignment=TA_CENTER))]],
colWidths=[W])
cover.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), DARK_BLUE),
("TOPPADDING", (0,0),(-1,-1), 28),
("BOTTOMPADDING", (0,0),(-1,-1), 28),
("LEFTPADDING", (0,0),(-1,-1), 16),
("RIGHTPADDING", (0,0),(-1,-1), 16),
]))
story.append(cover)
story.append(spacer(0.5))
story.append(Paragraph("Forensic Medicine & Toxicology", subtitle_style))
story.append(spacer(0.3))
story.append(hline(GOLD, thickness=2))
story.append(spacer(0.3))
story.append(Paragraph(
"Source: The Essentials of Forensic Medicine and Toxicology, 36th Edition (2026)<br/>"
"K.S. Narayan Reddy & O.P. Murty",
source_style))
story.append(spacer(0.8))
story.append(Paragraph("Chapter 23 — Medical Jurisprudence", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 2 – OVERVIEW / OUTLINE
# ============================================================
story.append(slide_title_block("OVERVIEW", "Topics Covered in This Presentation"))
story.append(spacer(0.4))
outline_items = [
("1", "Introduction & Definition of Insanity"),
("2", "Preliminary Steps & Documentation"),
("3", "Family History"),
("4", "Personal History"),
("5", "Physical Examination"),
("6", "Mental Status Examination"),
("7", "Other Investigations"),
("8", "Observation Period"),
("9", "Certification"),
("10", "Feigned vs Real Mental Illness"),
("11", "Lucid Interval"),
]
outline_data = [[Paragraph(f"<b>{n}.</b> {t}", S("ol", fontName="Helvetica",
fontSize=10.5, textColor=DARK_TEXT, leading=16))] for n, t in outline_items]
outline_table = Table(outline_data, colWidths=[W])
outline_table.setStyle(TableStyle([
("BACKGROUND", (0, i*2), (-1, i*2), GREY_BG) if i % 2 == 0 else
("BACKGROUND", (0, 0), (0, 0), WHITE)
for i in range(len(outline_items))
] + [
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 10),
("BOX", (0,0), (-1,-1), 0.5, GREY_LINE),
("LINEBELOW", (0,0), (-1,-2), 0.3, GREY_LINE),
]))
# Alternating rows
for i in range(len(outline_items)):
bg = GREY_BG if i % 2 == 0 else WHITE
outline_table.setStyle(TableStyle([("BACKGROUND", (0,i),(-1,i), bg)]))
story.append(outline_table)
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 464–465", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 3 – INTRODUCTION
# ============================================================
story.append(slide_title_block("INTRODUCTION", "What is Insanity? Why Diagnose?"))
story.append(spacer(0.4))
story.append(info_box(
"<b>Insanity</b> is a legal (not medical) term used for persons who are "
"unable to adapt themselves to the ordinary social requirements due to "
"some mental disease or defect. Indian law has not defined insanity. "
"The term covers those whose mental abnormality renders them not fully "
"responsible for their actions."
))
story.append(spacer(0.3))
story.append(section_box("Clinical Importance"))
story.append(spacer(0.15))
story.append(bullet("In a <b>typical case</b>, the diagnosis is easy."))
story.append(bullet("In <b>early stages</b> — especially when no permanent delusions are present — and in <b>borderline cases</b>, the diagnosis becomes difficult."))
story.append(bullet("The object of clinical examination is to form an <b>opinion about the patient's mind</b> and the <b>degree of responsibility</b>."))
story.append(spacer(0.3))
story.append(info_box(
"<b>Medico-legal significance:</b> A person diagnosed as insane at the "
"time of committing an offence may not be held criminally responsible "
"(Sections 84, IPC India).",
bg=colors.HexColor("#fef9e7"), tc=colors.HexColor("#7d6608")))
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 464", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 4 – STEP 1: PRELIMINARIES
# ============================================================
story.append(slide_title_block("STEP 1: PRELIMINARIES", "Documentation Before Examination"))
story.append(spacer(0.4))
story.append(section_box("Mandatory Initial Documentation"))
story.append(spacer(0.15))
items = [
"Note the <b>name, age, sex,</b> and <b>address</b> of the person.",
"Record the <b>time of beginning and end</b> of each examination.",
"Identify the referring authority — court, police, or hospital.",
"Record who is present during the examination.",
]
for item in items:
story.append(bullet(item))
story.append(spacer(0.3))
story.append(info_box(
"These initial details are essential for medico-legal validity. "
"Any certificate issued must be traceable to specific examination sessions.",
bg=LIGHT_BLUE))
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 464", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 5 – STEP 2: FAMILY HISTORY
# ============================================================
story.append(slide_title_block("STEP 2: FAMILY HISTORY", "Hereditary & Background Enquiry"))
story.append(spacer(0.4))
story.append(section_box("Key Areas of Family History"))
story.append(spacer(0.15))
story.append(bullet("Mental condition of the patient's <b>parents and siblings</b>."))
story.append(bullet("Whether any family member suffered from:"))
story.append(subbullet("Chorea"))
story.append(subbullet("Epilepsy"))
story.append(subbullet("Frank mental illness"))
story.append(spacer(0.3))
story.append(info_box(
"<b>Why it matters:</b> Many mental illnesses have a genetic predisposition. "
"A positive family history strengthens the diagnosis and helps rule out feigning.",
bg=LIGHT_BLUE))
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 464", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 6 – STEP 3: PERSONAL HISTORY
# ============================================================
story.append(slide_title_block("STEP 3: PERSONAL HISTORY", "Eight Categories to Explore"))
story.append(spacer(0.3))
ph_data = [
[Paragraph("<b>#</b>", table_header_style),
Paragraph("<b>Category</b>", table_header_style),
Paragraph("<b>Details</b>", table_header_style)],
[Paragraph("1", table_cell_style),
Paragraph("Previous mental disease", table_cell_style),
Paragraph("History of mental illness in parents", table_cell_style)],
[Paragraph("2", table_cell_style),
Paragraph("Environmental factors", table_cell_style),
Paragraph("Parents, home, over-protection, rejection, strictness, inferiority complex, discrimination, emotional maladjustments in childhood/adolescence", table_cell_style)],
[Paragraph("3", table_cell_style),
Paragraph("Psychogenic factors", table_cell_style),
Paragraph("Repression, emotional conflict, anxiety states", table_cell_style)],
[Paragraph("4", table_cell_style),
Paragraph("Organic diseases", table_cell_style),
Paragraph("CVA, head injury, acute fevers, renal/cardiac disease, senile degeneration, toxaemias", table_cell_style)],
[Paragraph("5", table_cell_style),
Paragraph("Drug dependence", table_cell_style),
Paragraph("Opium, pethidine, barbiturates, alcohol, cannabis", table_cell_style)],
[Paragraph("6", table_cell_style),
Paragraph("Domestic difficulties", table_cell_style),
Paragraph("Marital, financial, family conflicts", table_cell_style)],
[Paragraph("7", table_cell_style),
Paragraph("Emotional shock", table_cell_style),
Paragraph("Recent traumatic events", table_cell_style)],
[Paragraph("8", table_cell_style),
Paragraph("Frustrations", table_cell_style),
Paragraph("In life, love, sex, career, etc.", table_cell_style)],
]
col_w = [0.6*cm, 4.5*cm, W - 5.1*cm - 0.6*cm]
ph_table = Table(ph_data, colWidths=col_w, repeatRows=1)
ph_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), DARK_BLUE),
("TEXTCOLOR", (0,0), (-1,0), WHITE),
("GRID", (0,0), (-1,-1), 0.4, GREY_LINE),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
for i in range(1, len(ph_data)):
bg = GREY_BG if i % 2 == 0 else WHITE
ph_table.setStyle(TableStyle([("BACKGROUND", (0,i),(-1,i), bg)]))
story.append(ph_table)
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 464", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 7 – STEP 4: PHYSICAL EXAMINATION
# ============================================================
story.append(slide_title_block("STEP 4: PHYSICAL EXAMINATION", "General & Systemic Assessment"))
story.append(spacer(0.4))
story.append(section_box("Key Points to Examine"))
story.append(spacer(0.15))
phys_items = [
("Observation", "Patient's manner of dressing and walking, bearing and gestures."),
("Morphology", "Deformities and malformations in the head or body."),
("Vitals", "Pulse rate and body temperature — both may be increased."),
("Tongue", "May be furred."),
("Skin & Extremities", "Skin is dry and wrinkled; hands and feet may be moist."),
("Full Examination", "A complete and detailed physical examination should be carried out to exclude any organic disease."),
]
for label, detail in phys_items:
story.append(bullet(f"<b>{label}:</b> {detail}"))
story.append(spacer(0.3))
story.append(info_box(
"Physical signs help differentiate mental illness from organic causes (e.g., metabolic encephalopathy, substance intoxication) that can mimic psychiatric symptoms.",
bg=LIGHT_BLUE))
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 464", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 8 – STEP 5: MENTAL STATUS EXAMINATION (Part 1)
# ============================================================
story.append(slide_title_block("STEP 5: MENTAL STATUS EXAMINATION", "Observations to Record (Part 1 of 2)"))
story.append(spacer(0.3))
mse_data_1 = [
[Paragraph("<b>Domain</b>", table_header_style),
Paragraph("<b>Features to Note</b>", table_header_style)],
[Paragraph("1. General Appearance", table_cell_style),
Paragraph("Naked, dressed properly/improperly, dirty or clean habits, facial expression (vacant, grimacing, mask-like)", table_cell_style)],
[Paragraph("2. Talk", table_cell_style),
Paragraph("Mutism, aphonia, distraction, irrelevant speech, neologism (coining own vocabulary), echolalia (repeating others' words), perseveration (monotonous repetition), wandering speech, talkativeness", table_cell_style)],
[Paragraph("3. Speech", table_cell_style),
Paragraph("Coherent or incoherent, aphasia, lalling, lisping, drawling, slurring, stammering", table_cell_style)],
[Paragraph("4. Writing", table_cell_style),
Paragraph("Agraphia, flight of ideas, obscene or insulting language, unintelligible writing", table_cell_style)],
[Paragraph("5. Behaviour", table_cell_style),
Paragraph("Stereotypy, perseveration, mannerism, impulsiveness, laziness, stupor, automatic obedience, negativism, seclusion, echopraxia (copying others' actions)", table_cell_style)],
[Paragraph("6. Mood", table_cell_style),
Paragraph("Emotion, euphoria, joy, anger, elation, exaltation, apathy, irritability, touchiness", table_cell_style)],
[Paragraph("7. Memory", table_cell_style),
Paragraph("Good/bad, concentration, appreciation, grasp", table_cell_style)],
]
col_w2 = [3.8*cm, W - 3.8*cm]
mse_t1 = Table(mse_data_1, colWidths=col_w2, repeatRows=1)
mse_t1.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), DARK_BLUE),
("TEXTCOLOR", (0,0), (-1,0), WHITE),
("GRID", (0,0), (-1,-1), 0.4, GREY_LINE),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
for i in range(1, len(mse_data_1)):
bg = GREY_BG if i % 2 == 0 else WHITE
mse_t1.setStyle(TableStyle([("BACKGROUND", (0,i),(-1,i), bg)]))
story.append(mse_t1)
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 464–465", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 9 – STEP 5: MENTAL STATUS EXAMINATION (Part 2)
# ============================================================
story.append(slide_title_block("STEP 5: MENTAL STATUS EXAMINATION", "Observations to Record (Part 2 of 2)"))
story.append(spacer(0.3))
mse_data_2 = [
[Paragraph("<b>Domain</b>", table_header_style),
Paragraph("<b>Features to Note</b>", table_header_style)],
[Paragraph("8. Sleep", table_cell_style),
Paragraph("Insomnia, hyposomnia, somnambulism, somnolentia", table_cell_style)],
[Paragraph("9. Walking & Gait", table_cell_style),
Paragraph("Stealthy, hurried, etc.", table_cell_style)],
[Paragraph("10. Attitude & Posture", table_cell_style),
Paragraph("Proud, peculiar, over-erect, aggressive, worried", table_cell_style)],
[Paragraph("11. Sexual Behaviour", table_cell_style),
Paragraph("Behaviour towards same sex and opposite sex", table_cell_style)],
[Paragraph("12. Attention", table_cell_style),
Paragraph("Attentive, inattentive, fluctuating", table_cell_style)],
[Paragraph("13. Thought Process", table_cell_style),
Paragraph("Retardation, preoccupation, ambivalence, double orientation, power of orientation", table_cell_style)],
[Paragraph("14. Thought Content", table_cell_style),
Paragraph("Delusions, hallucinations, illusions, obsessions, self-consciousness", table_cell_style)],
]
mse_t2 = Table(mse_data_2, colWidths=col_w2, repeatRows=1)
mse_t2.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), DARK_BLUE),
("TEXTCOLOR", (0,0), (-1,0), WHITE),
("GRID", (0,0), (-1,-1), 0.4, GREY_LINE),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
for i in range(1, len(mse_data_2)):
bg = GREY_BG if i % 2 == 0 else WHITE
mse_t2.setStyle(TableStyle([("BACKGROUND", (0,i),(-1,i), bg)]))
story.append(mse_t2)
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 465", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 10 – STEP 6: OTHER INVESTIGATIONS
# ============================================================
story.append(slide_title_block("STEP 6: ADDITIONAL INVESTIGATIONS", "Pathological & Imaging Studies"))
story.append(spacer(0.4))
story.append(section_box("Investigations to be Ordered"))
story.append(spacer(0.15))
invest_items = [
("Blood examination", "To detect metabolic causes, infections, toxins, substance use."),
("Urine analysis", "To screen for drug metabolites and metabolic disorders."),
("CSF analysis", "If CNS infection or inflammatory cause is suspected."),
("CT / MRI Brain", "To detect structural lesions — tumours, haemorrhage, atrophy."),
("Electroencephalography (EEG)", "Especially useful in epilepsy-associated psychiatric states."),
]
for label, detail in invest_items:
story.append(bullet(f"<b>{label}:</b> {detail}"))
story.append(spacer(0.3))
story.append(info_box(
"These additional investigations help exclude <b>organic cerebral disease</b> "
"that can mimic primary mental illness. A negative workup supports a functional psychiatric diagnosis.",
bg=LIGHT_BLUE))
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 465", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 11 – OBSERVATION
# ============================================================
story.append(slide_title_block("OBSERVATION PERIOD", "Sustained Behavioural Watch"))
story.append(spacer(0.4))
story.append(section_box("Where to Observe"))
story.append(spacer(0.15))
story.append(bullet("General hospital or general nursing home"))
story.append(bullet("Psychiatric hospital or nursing home"))
story.append(bullet("Any other suitable place"))
story.append(bullet("Violent and criminal persons: kept in <b>prison</b>"))
story.append(spacer(0.3))
story.append(section_box("Duration"))
story.append(spacer(0.15))
story.append(bullet("Should <b>not exceed 10 days</b> ordinarily."))
story.append(bullet("With the permission of the <b>Magistrate</b>, can be extended by further periods of 10 days, up to a <b>maximum of 30 days</b>."))
story.append(spacer(0.3))
story.append(section_box("Timing of Observation"))
story.append(spacer(0.15))
story.append(bullet("Different times of the day"))
story.append(bullet("When alone, in company, and while working"))
story.append(bullet("While eating, reading, or writing"))
story.append(bullet("<b>When he is unaware of being observed</b> — crucial for detecting feigning"))
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 465", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 12 – CERTIFICATION
# ============================================================
story.append(slide_title_block("CERTIFICATION", "Issuing the Medico-Legal Certificate"))
story.append(spacer(0.4))
story.append(section_box("Rules for Certification"))
story.append(spacer(0.15))
story.append(bullet("<b>A certificate should NOT be issued after a single examination.</b>"))
story.append(bullet("<b>Three examinations</b> on different days and different hours are usually recommended."))
story.append(bullet("More examinations may be necessary because a person may behave peculiarly at a single examination — either due to the effect of drugs or due to <b>delirium caused by fever</b>."))
story.append(spacer(0.3))
story.append(section_box("Contents of the Certificate"))
story.append(spacer(0.15))
story.append(bullet("Clinical description of the patient"))
story.append(bullet("Indicate the <b>reasons for the diagnosis</b> of the specified disorder"))
story.append(spacer(0.3))
story.append(info_box(
"<b>Key principle:</b> The certificate must be based on thorough, repeated assessments — "
"not a snapshot of one interaction. This safeguards both the accused and the justice system.",
bg=colors.HexColor("#fef9e7"), tc=colors.HexColor("#7d6608")))
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 465", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 13 – REAL vs FEIGNED (Table 23.3)
# ============================================================
story.append(slide_title_block("FEIGNED vs REAL MENTAL ILLNESS", "Table 23.3 — Reddy, FMT 36th Ed."))
story.append(spacer(0.3))
feign_data = [
[Paragraph("<b>Trait</b>", table_header_style),
Paragraph("<b>Real Mental Illness</b>", table_header_style),
Paragraph("<b>Feigned Mental Illness</b>", table_header_style)],
["Onset", "Gradual", "Sudden"],
["Motive", "Absent (no history of crime)", "Present (e.g., commission of crime)"],
["Predisposing factors", "Usually present (family h/o, monetary loss, grief)", "Absent"],
["Signs & symptoms", "Uniform; present even when unobserved", "Present only when observed; variable, exaggerated, not resembling any disease"],
["Mood", "Excited, depressed or fluctuating", "May overact to show abnormality"],
["Facial expression", "Peculiar — vacant or fixed excitement look", "No peculiarity; frequently changing, exaggerated, voluntary"],
["Insomnia", "Present", "Cannot persist; patient sleeps soundly after a day or two"],
["Exertion", "Can withstand fatigue, hunger and sleeplessness for days", "Breaks down within a few days"],
["Habits", "Dirty and filthy", "Not dirty and filthy"],
["Skin & lips", "Dry, harsh", "Normal"],
["Frequent examination", "Does not mind", "Resents — for fear of detection"],
]
col_w3 = [3.2*cm, (W-3.2*cm)/2, (W-3.2*cm)/2]
f_rows = []
for i, row in enumerate(feign_data):
if i == 0:
f_rows.append(row)
else:
f_rows.append([
Paragraph(str(row[0]), table_cell_style),
Paragraph(str(row[1]), table_cell_style),
Paragraph(str(row[2]), table_cell_style),
])
feign_table = Table(f_rows, colWidths=col_w3, repeatRows=1)
feign_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), DARK_BLUE),
("TEXTCOLOR", (0,0), (-1,0), WHITE),
("GRID", (0,0), (-1,-1), 0.4, GREY_LINE),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
("BACKGROUND", (1,1), (1,-1), colors.HexColor("#eafaf1")),
("BACKGROUND", (2,1), (2,-1), colors.HexColor("#fdf2f8")),
]))
for i in range(1, len(f_rows)):
if i % 2 == 0:
feign_table.setStyle(TableStyle([
("BACKGROUND", (1,i),(1,i), colors.HexColor("#d5f5e3")),
("BACKGROUND", (2,i),(2,i), colors.HexColor("#f9ebea")),
]))
story.append(feign_table)
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 465 (Table 23.3)", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 14 – LUCID INTERVAL
# ============================================================
story.append(slide_title_block("LUCID INTERVAL", "Temporary Clearing of Mental Symptoms"))
story.append(spacer(0.4))
story.append(info_box(
"<b>Definition:</b> A period occurring in insanity during which <b>all the symptoms of insanity disappear completely</b>. "
"The individual is able to judge his acts soundly, and becomes legally liable for his acts."
))
story.append(spacer(0.3))
story.append(section_box("Key Features"))
story.append(spacer(0.15))
story.append(bullet("Duration varies from person to person and from time to time in the same person."))
story.append(bullet("One cannot be certain about when a person passes again into the state of insanity."))
story.append(bullet("If an offence is committed during an apparent lucid interval, the person <b>cannot be completely held responsible</b>, because it is very difficult to determine whether he was suffering from mental abnormality at that precise time."))
story.append(bullet("Lucid intervals are <b>common in mania and melancholia</b>."))
story.append(spacer(0.3))
# Table 23.1 - Lucid interval difference
story.append(section_box("Table 23.1: Lucid Interval — Insanity vs Head Injury"))
story.append(spacer(0.15))
li_data = [
[Paragraph("<b>Trait</b>", table_header_style),
Paragraph("<b>Insanity</b>", table_header_style),
Paragraph("<b>Head Injury</b>", table_header_style)],
["History", "History of insanity present", "History of injury to the head"],
["Consciousness", "Always conscious", "May be unconscious initially"],
["Duration", "Variable, unpredictable", "Usually short and definite"],
["Recurrence", "Recurs unpredictably", "After recovery, usually does not recur"],
]
li_rows = []
for i, row in enumerate(li_data):
if i == 0:
li_rows.append(row)
else:
li_rows.append([
Paragraph(str(row[0]), table_cell_style),
Paragraph(str(row[1]), table_cell_style),
Paragraph(str(row[2]), table_cell_style),
])
li_table = Table(li_rows, colWidths=col_w3, repeatRows=1)
li_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), MID_BLUE),
("TEXTCOLOR", (0,0), (-1,0), WHITE),
("GRID", (0,0), (-1,-1), 0.4, GREY_LINE),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
for i in range(1, len(li_rows)):
bg = GREY_BG if i % 2 == 0 else WHITE
li_table.setStyle(TableStyle([("BACKGROUND", (0,i),(-1,i), bg)]))
story.append(li_table)
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., p. 463 (Table 23.1)", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 15 – SUMMARY / FLOWCHART
# ============================================================
story.append(slide_title_block("SUMMARY", "Step-by-Step Approach to Diagnosis of Insanity"))
story.append(spacer(0.3))
summary_steps = [
("STEP 1", "PRELIMINARIES", "Name, age, sex, address; time of each examination"),
("STEP 2", "FAMILY HISTORY", "Mental illness, chorea, epilepsy in parents/siblings"),
("STEP 3", "PERSONAL HISTORY", "8 categories: previous illness, environment, organic, drugs, domestic, emotional, frustrations"),
("STEP 4", "PHYSICAL EXAMINATION", "Appearance, vitals, tongue, skin; full examination to exclude organic disease"),
("STEP 5", "MENTAL STATUS EXAM", "14 domains: appearance, talk, speech, writing, behaviour, mood, memory, sleep, gait, posture, sex, attention, thought process, thought content"),
("STEP 6", "INVESTIGATIONS", "Blood, urine, CSF; CT/MRI brain; EEG"),
("STEP 7", "OBSERVATION", "Up to 10 days (max 30 with Magistrate permission); various contexts; when unaware of being observed"),
("STEP 8", "CERTIFICATION", "Minimum 3 examinations on different days; clinical description + reasons for diagnosis"),
]
for step, heading, detail in summary_steps:
row_data = [
[Paragraph(f"<b>{step}</b>", S("ss1", fontName="Helvetica-Bold", fontSize=9,
textColor=WHITE, alignment=TA_CENTER)),
Paragraph(f"<b>{heading}</b>", S("ss2", fontName="Helvetica-Bold", fontSize=9.5,
textColor=DARK_BLUE)),
Paragraph(detail, S("ss3", fontName="Helvetica", fontSize=9,
textColor=DARK_TEXT, leading=13))],
]
t = Table(row_data, colWidths=[1.8*cm, 4.5*cm, W-6.3*cm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (0,0), MID_BLUE),
("BACKGROUND", (1,0), (1,0), LIGHT_BLUE),
("BACKGROUND", (2,0), (2,0), WHITE),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("GRID", (0,0), (-1,-1), 0.4, GREY_LINE),
]))
story.append(t)
story.append(spacer(0.3))
story.append(Paragraph("Reference: Reddy & Murty, Essentials of FMT, 36th Ed., Chapter 23", footnote_style))
story.append(PageBreak())
# ============================================================
# SLIDE 16 – THANK YOU / REFERENCE
# ============================================================
story.append(spacer(3.5))
end_table = Table([[Paragraph("THANK YOU",
S("ty", fontName="Helvetica-Bold", fontSize=30,
textColor=WHITE, alignment=TA_CENTER))]],
colWidths=[W])
end_table.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,-1), DARK_BLUE),
("TOPPADDING", (0,0),(-1,-1), 24),
("BOTTOMPADDING", (0,0),(-1,-1), 24),
]))
story.append(end_table)
story.append(spacer(0.6))
story.append(hline(GOLD, thickness=2))
story.append(spacer(0.3))
story.append(Paragraph(
"<b>Reference:</b><br/>"
"K.S. Narayan Reddy & O.P. Murty. "
"<i>The Essentials of Forensic Medicine and Toxicology</i>, 36th Edition (2026). "
"Chapter 23: Medical Jurisprudence — Diagnosis of Insanity, pp. 463–465.",
S("ref", fontName="Helvetica", fontSize=10, textColor=DARK_TEXT,
alignment=TA_CENTER, leading=15)))
# ── build ─────────────────────────────────────────────────────────────────────
doc.build(story)
print("PDF created successfully.")
cd /home/daytona/workspace/insanity-presentation && python create_pdf.py 2>&1
~/insanity-presentation/create_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/insanity-presentation/create_pdf.py'
~/insanity-presentation/create_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/insanity-presentation/create_pdf.py'
cd /home/daytona/workspace/insanity-presentation && python create_pdf.py 2>&1
ls -lh /home/daytona/workspace/insanity-presentation/Diagnosis_of_Insanity_Reddy…
Diagnosis of Insanity Reddy
PDF Document · PDF
| Slide | Content |
|---|---|
| 1 | Title slide |
| 2 | Outline / Overview |
| 3 | Introduction & Definition of Insanity |
| 4 | Step 1 - Preliminaries |
| 5 | Step 2 - Family History |
| 6 | Step 3 - Personal History (8-category table) |
| 7 | Step 4 - Physical Examination |
| 8 | Step 5 - Mental Status Examination (Part 1: domains 1-7) |
| 9 | Step 5 - Mental Status Examination (Part 2: domains 8-14) |
| 10 | Step 6 - Additional Investigations (blood, urine, CSF, CT/MRI, EEG) |
| 11 | Observation Period (duration, setting, timing) |
| 12 | Certification rules |
| 13 | Table 23.3 - Real vs Feigned Mental Illness (full comparison table) |
| 14 | Lucid Interval + Table 23.1 - Insanity vs Head Injury |
| 15 | Summary flowchart (all 8 steps at a glance) |
| 16 | Thank You & Reference |
Not able to download
ls -lh /home/daytona/workspace/insanity-presentation/ && echo "File exists and s…
cp /home/daytona/workspace/insanity-presentation/Diagnosis_of_Insanity_Reddy.pdf…
Diagnosis of Insanity Reddy
PDF Document · PDF
/home/daytona/workspace/insanity-presentation/Diagnosis_of_Insanity_Reddy.pdfGenerate slides as a PowerPoint presentation (.pptx)
~/insanity-presentation/create_pptx.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Diagnosis of Insanity";
pres.author = "Reddy & Murty, FMT 36th Edition";
// ── PALETTE ─────────────────────────────────────────────────────────────────
const C = {
darkBlue: "1A3A5C",
midBlue: "2E6DA4",
lightBlue: "D6E4F0",
accent: "E74C3C",
gold: "F39C12",
white: "FFFFFF",
darkText: "1C1C1C",
greyBg: "F4F6F8",
greyLine: "AAB4BE",
green: "1E8449",
lightGreen:"EAFAF1",
lightRed: "FDEDEC",
};
// ── HELPERS ──────────────────────────────────────────────────────────────────
function addHeader(slide, title, subtitle) {
// Dark blue header bar
slide.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: 10, h: 1.1,
fill: { color: C.darkBlue }, line: { color: C.darkBlue }
});
slide.addText(title, {
x: 0.3, y: 0.05, w: 9.4, h: 0.6,
fontSize: 22, bold: true, color: C.white, valign: "middle",
fontFace: "Calibri"
});
if (subtitle) {
slide.addText(subtitle, {
x: 0.3, y: 0.65, w: 9.4, h: 0.38,
fontSize: 11, color: C.lightBlue, valign: "top",
fontFace: "Calibri", italic: true
});
}
// Gold accent line
slide.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 1.1, w: 10, h: 0.04,
fill: { color: C.gold }, line: { color: C.gold }
});
}
function addSectionBar(slide, text, y) {
slide.addShape(pres.shapes.RECTANGLE, {
x: 0.35, y: y, w: 9.3, h: 0.32,
fill: { color: C.midBlue }, line: { color: C.midBlue }
});
slide.addText(text, {
x: 0.45, y: y, w: 9.1, h: 0.32,
fontSize: 11, bold: true, color: C.white, valign: "middle",
fontFace: "Calibri"
});
}
function addInfoBox(slide, text, x, y, w, h, bg, tc) {
bg = bg || C.lightBlue;
tc = tc || C.darkBlue;
slide.addShape(pres.shapes.RECTANGLE, {
x, y, w, h,
fill: { color: bg },
line: { color: C.midBlue, width: 0.5 }
});
slide.addText(text, {
x: x + 0.1, y: y + 0.05, w: w - 0.2, h: h - 0.1,
fontSize: 10, color: tc, valign: "top",
fontFace: "Calibri", wrap: true
});
}
function addBullets(slide, items, x, y, w, h, fontSize) {
fontSize = fontSize || 11;
const textArr = items.map((item, i) => ({
text: item.text || item,
options: {
bullet: item.indent ? { indent: 30 } : true,
bold: item.bold || false,
breakLine: i < items.length - 1,
color: C.darkText,
fontSize: item.small ? fontSize - 1 : fontSize,
indentLevel: item.indent ? 1 : 0
}
}));
slide.addText(textArr, {
x, y, w, h,
fontFace: "Calibri", valign: "top", wrap: true
});
}
function addFooter(slide, text) {
slide.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 5.45, w: 10, h: 0.18,
fill: { color: C.greyBg }, line: { color: C.greyLine, width: 0.5 }
});
slide.addText(text, {
x: 0.2, y: 5.46, w: 9.6, h: 0.16,
fontSize: 7.5, italic: true, color: "888888",
fontFace: "Calibri", align: "center"
});
}
const REF = "Reddy & Murty, Essentials of FMT, 36th Ed. (2026), Chapter 23";
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
// Full dark bg
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: 10, h: 5.625,
fill: { color: C.darkBlue }, line: { color: C.darkBlue }
});
// Gold accent strip
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 2.55, w: 10, h: 0.06,
fill: { color: C.gold }, line: { color: C.gold }
});
s.addText("DIAGNOSIS OF INSANITY", {
x: 0.5, y: 1.0, w: 9, h: 1.2,
fontSize: 36, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri",
charSpacing: 2
});
s.addShape(pres.shapes.RECTANGLE, {
x: 2.5, y: 2.68, w: 5, h: 0.04,
fill: { color: C.gold }, line: { color: C.gold }
});
s.addText("Forensic Medicine & Toxicology", {
x: 0.5, y: 2.75, w: 9, h: 0.5,
fontSize: 16, color: C.lightBlue,
align: "center", fontFace: "Calibri", italic: true
});
s.addText("The Essentials of Forensic Medicine and Toxicology\n36th Edition (2026) — K.S. Narayan Reddy & O.P. Murty", {
x: 0.5, y: 3.4, w: 9, h: 0.7,
fontSize: 11, color: C.gold,
align: "center", fontFace: "Calibri"
});
s.addText("Chapter 23 — Medical Jurisprudence | Pages 463–465", {
x: 0.5, y: 4.9, w: 9, h: 0.4,
fontSize: 9, color: "7F8C8D",
align: "center", fontFace: "Calibri", italic: true
});
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — OUTLINE
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "OVERVIEW", "Topics Covered in This Presentation");
const steps = [
"1. Introduction & Definition of Insanity",
"2. Preliminary Steps & Documentation",
"3. Family History",
"4. Personal History (8 categories)",
"5. Physical Examination",
"6. Mental Status Examination (14 domains)",
"7. Other Investigations",
"8. Observation Period",
"9. Certification",
"10. Feigned vs Real Mental Illness (Table 23.3)",
"11. Lucid Interval & Comparison Table (Table 23.1)",
"12. Summary Flowchart",
];
// Two-column layout
const col1 = steps.slice(0, 6);
const col2 = steps.slice(6);
col1.forEach((item, i) => {
const y = 1.3 + i * 0.62;
const bg = i % 2 === 0 ? C.lightBlue : C.white;
s.addShape(pres.shapes.RECTANGLE, { x:0.3, y, w:4.5, h:0.55, fill:{color:bg}, line:{color:C.greyLine, width:0.5} });
s.addText(item, { x:0.45, y:y+0.05, w:4.2, h:0.45, fontSize:10.5, color:C.darkText, fontFace:"Calibri", valign:"middle" });
});
col2.forEach((item, i) => {
const y = 1.3 + i * 0.62;
const bg = i % 2 === 0 ? C.lightBlue : C.white;
s.addShape(pres.shapes.RECTANGLE, { x:5.1, y, w:4.55, h:0.55, fill:{color:bg}, line:{color:C.greyLine, width:0.5} });
s.addText(item, { x:5.25, y:y+0.05, w:4.2, h:0.45, fontSize:10.5, color:C.darkText, fontFace:"Calibri", valign:"middle" });
});
addFooter(s, REF);
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — INTRODUCTION
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "INTRODUCTION", "What is Insanity? Why Diagnose?");
addInfoBox(s,
"Insanity is a legal (not medical) term used for persons who are unable to adapt themselves to the ordinary social requirements due to some mental disease or defect. Indian law has not defined insanity.",
0.35, 1.25, 9.3, 0.72, C.lightBlue, C.darkBlue);
addSectionBar(s, "Clinical Importance", 2.1);
addBullets(s, [
{ text: "In a typical case, the diagnosis is easy." },
{ text: "In early stages — especially when no permanent delusions are present — and in borderline cases, the diagnosis becomes difficult." },
{ text: "Object of examination: to form an opinion about the patient's mind and the degree of responsibility." },
], 0.35, 2.47, 9.3, 1.15);
addInfoBox(s,
"Medico-legal significance: A person found insane at the time of committing an offence may not be held criminally responsible (S. 84, IPC India).",
0.35, 3.72, 9.3, 0.55, "FEF9E7", "7D6608");
addFooter(s, REF + ", p. 464");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — STEP 1: PRELIMINARIES
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "STEP 1: PRELIMINARIES", "Documentation Before Examination");
addSectionBar(s, "Mandatory Initial Documentation", 1.25);
addBullets(s, [
{ text: "Note the name, age, sex, and address of the person." },
{ text: "Record the time of beginning and end of each examination." },
{ text: "Identify the referring authority — court, police, or hospital." },
{ text: "Record who is present during the examination." },
], 0.35, 1.62, 9.3, 1.6);
addInfoBox(s,
"These initial details are essential for medico-legal validity. Any certificate issued must be traceable to specific examination sessions.",
0.35, 3.35, 9.3, 0.6, C.lightBlue, C.darkBlue);
addFooter(s, REF + ", p. 464");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — STEP 2: FAMILY HISTORY
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "STEP 2: FAMILY HISTORY", "Hereditary & Background Enquiry");
addSectionBar(s, "Key Areas to Enquire", 1.25);
addBullets(s, [
{ text: "Mental condition of the patient's parents and siblings." },
{ text: "Whether any family member suffered from:" },
{ text: "Chorea", indent: true, small: true },
{ text: "Epilepsy", indent: true, small: true },
{ text: "Frank mental illness (psychosis, etc.)", indent: true, small: true },
], 0.35, 1.62, 9.3, 1.8);
addInfoBox(s,
"Why it matters: Many mental illnesses have a genetic predisposition. A positive family history strengthens the diagnosis and helps rule out feigning.",
0.35, 3.55, 9.3, 0.6, C.lightBlue, C.darkBlue);
addFooter(s, REF + ", p. 464");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — STEP 3: PERSONAL HISTORY
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "STEP 3: PERSONAL HISTORY", "Eight Categories to Explore");
const rows = [
["#", "Category", "Details"],
["1", "Previous mental disease", "History of mental illness in parents"],
["2", "Environmental factors", "Over-protection, rejection, strictness, discrimination, emotional maladjustments in childhood/adolescence"],
["3", "Psychogenic factors", "Repression, emotional conflict, anxiety states"],
["4", "Organic diseases", "CVA, head injury, acute fevers, renal/cardiac disease, senile degeneration, toxaemias"],
["5", "Drug dependence", "Opium, pethidine, barbiturates, alcohol, cannabis"],
["6", "Domestic difficulties", "Marital, financial, family conflicts"],
["7", "Emotional shock", "Recent traumatic or grief events"],
["8", "Frustrations", "In life, love, sex, career, etc."],
];
const colW = [0.4, 2.2, 6.5];
const rowH = 0.37;
const startY = 1.22;
rows.forEach((row, i) => {
const y = startY + i * rowH;
const isHeader = i === 0;
const bg = isHeader ? C.darkBlue : (i % 2 === 0 ? C.greyBg : C.white);
const tc = isHeader ? C.white : C.darkText;
let xOff = 0.3;
colW.forEach((w, ci) => {
s.addShape(pres.shapes.RECTANGLE, { x:xOff, y, w, h:rowH, fill:{color:bg}, line:{color:C.greyLine, width:0.4} });
s.addText(row[ci], {
x: xOff + 0.05, y: y + 0.03, w: w - 0.1, h: rowH - 0.06,
fontSize: isHeader ? 10 : 9, bold: isHeader, color: tc,
fontFace: "Calibri", valign: "middle", wrap: true
});
xOff += w;
});
});
addFooter(s, REF + ", p. 464");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — STEP 4: PHYSICAL EXAMINATION
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "STEP 4: PHYSICAL EXAMINATION", "General & Systemic Assessment");
addSectionBar(s, "Key Points to Examine", 1.25);
const items = [
["Observation:", "Patient's manner of dressing, walking, bearing and gestures."],
["Morphology:", "Deformities and malformations in the head or body."],
["Vitals:", "Pulse rate and body temperature — both may be increased."],
["Tongue:", "May be furred."],
["Skin & Extremities:", "Skin is dry and wrinkled; hands and feet may be moist."],
["Complete Exam:", "Full examination to exclude any organic disease."],
];
items.forEach(([label, detail], i) => {
const y = 1.63 + i * 0.47;
s.addShape(pres.shapes.RECTANGLE, { x:0.35, y, w:9.3, h:0.42, fill:{color: i%2===0 ? C.lightBlue : C.white}, line:{color:C.greyLine, width:0.4} });
s.addText([
{ text: label + " ", options: { bold: true, color: C.darkBlue } },
{ text: detail, options: { color: C.darkText } }
], { x:0.5, y:y+0.03, w:9.0, h:0.36, fontSize:10.5, fontFace:"Calibri", valign:"middle", wrap:true });
});
addFooter(s, REF + ", p. 464");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — STEP 5: MENTAL STATUS EXAM (Part 1)
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "STEP 5: MENTAL STATUS EXAMINATION", "Part 1 of 2 — Domains 1 to 7");
const rows = [
["Domain", "Features to Note"],
["1. General Appearance", "Naked/dressed, dirty/clean habits, facial expression (vacant, grimacing, mask-like)"],
["2. Talk", "Mutism, aphonia, distraction, irrelevant speech, neologism, echolalia, perseveration, wandering speech, talkativeness"],
["3. Speech", "Coherent/incoherent, aphasia, lalling, lisping, drawling, slurring, stammering"],
["4. Writing", "Agraphia, flight of ideas, obscene or insulting language, unintelligible writing"],
["5. Behaviour", "Stereotypy, perseveration, mannerism, impulsiveness, stupor, automatic obedience, negativism, echopraxia"],
["6. Mood", "Euphoria, joy, anger, elation, exaltation, apathy, irritability, touchiness"],
["7. Memory", "Good/bad, concentration, appreciation, grasp"],
];
const colW = [2.4, 6.95];
const rowH = 0.5;
const startY = 1.22;
rows.forEach((row, i) => {
const y = startY + i * rowH;
const isH = i === 0;
const bg = isH ? C.darkBlue : (i % 2 === 0 ? C.greyBg : C.white);
const tc = isH ? C.white : C.darkText;
let xOff = 0.3;
colW.forEach((w, ci) => {
s.addShape(pres.shapes.RECTANGLE, { x:xOff, y, w, h:rowH, fill:{color:bg}, line:{color:C.greyLine, width:0.4} });
s.addText(row[ci], { x:xOff+0.06, y:y+0.03, w:w-0.12, h:rowH-0.06, fontSize:isH?10:9, bold:isH, color:tc, fontFace:"Calibri", valign:"middle", wrap:true });
xOff += w;
});
});
addFooter(s, REF + ", p. 464–465");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — STEP 5: MENTAL STATUS EXAM (Part 2)
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "STEP 5: MENTAL STATUS EXAMINATION", "Part 2 of 2 — Domains 8 to 14");
const rows = [
["Domain", "Features to Note"],
["8. Sleep", "Insomnia, hyposomnia, somnambulism, somnolentia"],
["9. Walking & Gait", "Stealthy, hurried, etc."],
["10. Attitude & Posture", "Proud, peculiar, over-erect, aggressive, worried"],
["11. Sexual Behaviour", "Behaviour towards same sex and opposite sex"],
["12. Attention", "Attentive, inattentive, fluctuating"],
["13. Thought Process", "Retardation, preoccupation, ambivalence, double orientation, power of orientation"],
["14. Thought Content", "Delusions, hallucinations, illusions, obsessions, self-consciousness"],
];
const colW = [2.4, 6.95];
const rowH = 0.5;
const startY = 1.22;
rows.forEach((row, i) => {
const y = startY + i * rowH;
const isH = i === 0;
const bg = isH ? C.darkBlue : (i % 2 === 0 ? C.greyBg : C.white);
const tc = isH ? C.white : C.darkText;
let xOff = 0.3;
colW.forEach((w, ci) => {
s.addShape(pres.shapes.RECTANGLE, { x:xOff, y, w, h:rowH, fill:{color:bg}, line:{color:C.greyLine, width:0.4} });
s.addText(row[ci], { x:xOff+0.06, y:y+0.03, w:w-0.12, h:rowH-0.06, fontSize:isH?10:9, bold:isH, color:tc, fontFace:"Calibri", valign:"middle", wrap:true });
xOff += w;
});
});
addFooter(s, REF + ", p. 465");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — INVESTIGATIONS
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "STEP 6: ADDITIONAL INVESTIGATIONS", "Pathological & Imaging Studies");
addSectionBar(s, "Investigations to Order", 1.25);
const items = [
["Blood Examination:", "Metabolic causes, infections, toxins, substance use."],
["Urine Analysis:", "Drug metabolites and metabolic disorders."],
["CSF Analysis:", "If CNS infection or inflammatory cause is suspected."],
["CT / MRI Brain:", "Structural lesions — tumours, haemorrhage, cortical atrophy."],
["EEG:", "Especially valuable in epilepsy-associated psychiatric states."],
];
items.forEach(([label, detail], i) => {
const y = 1.63 + i * 0.5;
s.addShape(pres.shapes.RECTANGLE, { x:0.35, y, w:9.3, h:0.45, fill:{color: i%2===0 ? C.lightBlue : C.white}, line:{color:C.greyLine, width:0.4} });
s.addText([
{ text: label + " ", options: { bold: true, color: C.darkBlue } },
{ text: detail, options: { color: C.darkText } }
], { x:0.5, y:y+0.04, w:9.0, h:0.37, fontSize:10.5, fontFace:"Calibri", valign:"middle", wrap:true });
});
addInfoBox(s,
"These investigations help exclude organic cerebral disease that can mimic primary mental illness. A negative workup supports a functional psychiatric diagnosis.",
0.35, 4.15, 9.3, 0.55, C.lightBlue, C.darkBlue);
addFooter(s, REF + ", p. 465");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 11 — OBSERVATION
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "OBSERVATION PERIOD", "Sustained Behavioural Watch");
// Three boxes side by side
const boxes = [
{ title: "WHERE", color: C.midBlue, items: ["General hospital / nursing home", "Psychiatric hospital or nursing home", "Any other suitable place", "Violent/criminal persons: in prison"] },
{ title: "DURATION", color: C.accent, items: ["Not to exceed 10 days ordinarily", "Extendable by Magistrate's permission in 10-day increments", "Maximum period: 30 days"] },
{ title: "WHEN TO OBSERVE", color: C.green, items: ["Different times of day", "When alone and in company", "While eating, reading, writing", "When UNAWARE of being observed (key to detecting feigning)"] },
];
boxes.forEach((box, i) => {
const x = 0.3 + i * 3.16;
s.addShape(pres.shapes.RECTANGLE, { x, y:1.25, w:3.0, h:0.38, fill:{color:box.color}, line:{color:box.color} });
s.addText(box.title, { x:x+0.05, y:1.25, w:2.9, h:0.38, fontSize:11, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", align:"center" });
s.addShape(pres.shapes.RECTANGLE, { x, y:1.63, w:3.0, h:3.3, fill:{color:C.white}, line:{color:box.color, width:0.8} });
const textArr = box.items.map((t, j) => ({
text: t,
options: { bullet: true, breakLine: j < box.items.length - 1, color: C.darkText }
}));
s.addText(textArr, { x:x+0.1, y:1.7, w:2.8, h:3.15, fontSize:10, fontFace:"Calibri", valign:"top", wrap:true });
});
addFooter(s, REF + ", p. 465");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 12 — CERTIFICATION
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "CERTIFICATION", "Issuing the Medico-Legal Certificate");
addSectionBar(s, "Rules for Certification", 1.25);
addBullets(s, [
{ text: "A certificate should NOT be issued after a single examination.", bold: true },
{ text: "Three examinations on different days and at different hours are recommended." },
{ text: "More examinations may be needed — a person may behave peculiarly at one examination due to drugs or delirium from fever." },
], 0.35, 1.63, 9.3, 1.1);
addSectionBar(s, "Contents of the Certificate", 2.9);
addBullets(s, [
{ text: "Clinical description of the patient." },
{ text: "Indicate the reasons for the diagnosis of the specified disorder." },
], 0.35, 3.27, 9.3, 0.7);
addInfoBox(s,
"Key principle: The certificate must be based on thorough, repeated assessments — not a snapshot of one interaction. This safeguards both the accused and the justice system.",
0.35, 4.1, 9.3, 0.6, "FEF9E7", "7D6608");
addFooter(s, REF + ", p. 465");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 13 — REAL vs FEIGNED (Table 23.3)
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "FEIGNED vs REAL MENTAL ILLNESS", "Table 23.3 — Reddy, FMT 36th Ed., p. 465");
const rows = [
["Trait", "Real Mental Illness", "Feigned Mental Illness"],
["Onset", "Gradual", "Sudden"],
["Motive", "Absent (no history of crime)", "Present (e.g., commission of crime)"],
["Predisposing factors", "Usually present (family h/o, monetary loss, grief)", "Absent"],
["Signs & symptoms", "Uniform; present even when unobserved", "Present only when observed; variable, exaggerated"],
["Mood", "Excited, depressed or fluctuating", "May overact to show abnormality"],
["Facial expression", "Peculiar — vacant or fixed excitement", "Frequently changing, exaggerated, voluntary"],
["Insomnia", "Present", "Cannot persist; sleeps soundly after 1–2 days"],
["Exertion", "Withstands fatigue/hunger for days", "Breaks down within a few days"],
["Habits", "Dirty and filthy", "Not dirty and filthy"],
["Skin & lips", "Dry, harsh", "Normal"],
["Frequent exam", "Does not mind", "Resents — for fear of detection"],
];
const colW = [2.2, 3.6, 3.55];
const rowH = 0.39;
const startY = 1.2;
rows.forEach((row, i) => {
const y = startY + i * rowH;
const isH = i === 0;
const bgLeft = isH ? C.darkBlue : (i%2===0 ? C.greyBg : C.white);
const bgMid = isH ? C.darkBlue : (i%2===0 ? C.lightGreen : "F0FAF4");
const bgRight = isH ? C.darkBlue : (i%2===0 ? C.lightRed : "FEF5F4");
const bgs = [bgLeft, bgMid, bgRight];
const tc = isH ? C.white : C.darkText;
let xOff = 0.3;
colW.forEach((w, ci) => {
s.addShape(pres.shapes.RECTANGLE, { x:xOff, y, w, h:rowH, fill:{color:bgs[ci]}, line:{color:C.greyLine, width:0.4} });
s.addText(row[ci], { x:xOff+0.05, y:y+0.03, w:w-0.1, h:rowH-0.06, fontSize:isH?9.5:8.5, bold:isH, color:tc, fontFace:"Calibri", valign:"middle", wrap:true });
xOff += w;
});
});
addFooter(s, REF + ", p. 465 (Table 23.3)");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 14 — LUCID INTERVAL
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "LUCID INTERVAL", "Temporary Clearing of Mental Symptoms");
addInfoBox(s,
"Definition: A period occurring in insanity during which all the symptoms of insanity disappear completely. The individual is able to judge his acts soundly, and becomes legally liable for his acts.",
0.35, 1.25, 9.3, 0.7, C.lightBlue, C.darkBlue);
addSectionBar(s, "Key Features", 2.1);
addBullets(s, [
{ text: "Duration varies from person to person and from time to time in the same person." },
{ text: "One cannot be certain about when a person passes again into a state of insanity." },
{ text: "If an offence is committed, the person cannot be completely held responsible — it is difficult to determine whether they were mentally abnormal at that precise moment." },
{ text: "Lucid intervals are common in mania and melancholia." },
], 0.35, 2.47, 9.3, 1.05);
addSectionBar(s, "Table 23.1: Lucid Interval — Insanity vs Head Injury", 3.65);
const li = [
["Trait", "Insanity", "Head Injury"],
["History", "History of insanity present", "History of injury to the head"],
["Consciousness", "Always conscious", "May be unconscious initially"],
["Duration", "Variable, unpredictable", "Usually short and definite"],
["Recurrence", "Recurs unpredictably", "After recovery, usually does not recur"],
];
const colW2 = [2.2, 3.5, 3.25];
li.forEach((row, i) => {
const y = 4.02 + i * 0.29;
const isH = i === 0;
const bg = isH ? C.midBlue : (i%2===0 ? C.greyBg : C.white);
const tc = isH ? C.white : C.darkText;
let xOff = 0.3;
colW2.forEach((w, ci) => {
s.addShape(pres.shapes.RECTANGLE, { x:xOff, y, w, h:0.28, fill:{color:bg}, line:{color:C.greyLine, width:0.4} });
s.addText(row[ci], { x:xOff+0.05, y:y+0.02, w:w-0.1, h:0.24, fontSize:isH?9:8.5, bold:isH, color:tc, fontFace:"Calibri", valign:"middle", wrap:true });
xOff += w;
});
});
addFooter(s, REF + ", p. 463 (Table 23.1)");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 15 — SUMMARY
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
addHeader(s, "SUMMARY", "Step-by-Step Approach to Diagnosis of Insanity");
const steps = [
["STEP 1", "PRELIMINARIES", "Name, age, sex, address; time of each examination"],
["STEP 2", "FAMILY HISTORY", "Mental illness, chorea, epilepsy in parents/siblings"],
["STEP 3", "PERSONAL HISTORY", "8 categories: previous illness, environment, organic, drugs, domestic, emotional, frustrations"],
["STEP 4", "PHYSICAL EXAM", "Appearance, vitals, tongue, skin; full exam to exclude organic disease"],
["STEP 5", "MENTAL STATUS EXAM", "14 domains: appearance, talk, speech, writing, behaviour, mood, memory, sleep, gait, posture, sex, attention, thought process/content"],
["STEP 6", "INVESTIGATIONS", "Blood, urine, CSF; CT/MRI brain; EEG"],
["STEP 7", "OBSERVATION", "Up to 30 days; various contexts; when unaware of observation"],
["STEP 8", "CERTIFICATION", "Min. 3 exams on different days; clinical description + reasons for diagnosis"],
];
steps.forEach(([step, heading, detail], i) => {
const y = 1.22 + i * 0.52;
s.addShape(pres.shapes.RECTANGLE, { x:0.3, y, w:1.1, h:0.47, fill:{color:C.midBlue}, line:{color:C.midBlue} });
s.addText(step, { x:0.3, y, w:1.1, h:0.47, fontSize:8.5, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
s.addShape(pres.shapes.RECTANGLE, { x:1.4, y, w:2.3, h:0.47, fill:{color:C.lightBlue}, line:{color:C.midBlue, width:0.4} });
s.addText(heading, { x:1.45, y, w:2.2, h:0.47, fontSize:9.5, bold:true, color:C.darkBlue, fontFace:"Calibri", valign:"middle" });
s.addShape(pres.shapes.RECTANGLE, { x:3.7, y, w:5.95, h:0.47, fill:{color: i%2===0 ? C.white : C.greyBg}, line:{color:C.greyLine, width:0.4} });
s.addText(detail, { x:3.8, y:y+0.03, w:5.75, h:0.41, fontSize:9, color:C.darkText, fontFace:"Calibri", valign:"middle", wrap:true });
});
addFooter(s, REF + ", Chapter 23");
}
// ════════════════════════════════════════════════════════════════════════════
// SLIDE 16 — THANK YOU
// ════════════════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.darkBlue}, line:{color:C.darkBlue} });
s.addShape(pres.shapes.RECTANGLE, { x:0, y:2.6, w:10, h:0.06, fill:{color:C.gold}, line:{color:C.gold} });
s.addText("THANK YOU", {
x:0.5, y:1.2, w:9, h:1.1,
fontSize:40, bold:true, color:C.white,
align:"center", valign:"middle", fontFace:"Calibri", charSpacing:4
});
s.addShape(pres.shapes.RECTANGLE, { x:2.5, y:2.72, w:5, h:0.04, fill:{color:C.gold}, line:{color:C.gold} });
s.addText("Reference", { x:0.5, y:2.85, w:9, h:0.35, fontSize:13, bold:true, color:C.gold, align:"center", fontFace:"Calibri" });
s.addText(
"K.S. Narayan Reddy & O.P. Murty\nThe Essentials of Forensic Medicine and Toxicology\n36th Edition (2026) — Chapter 23: Medical Jurisprudence\nDiagnosis of Insanity, pp. 463–465",
{ x:1, y:3.25, w:8, h:1.3, fontSize:12, color:C.lightBlue, align:"center", fontFace:"Calibri", lineSpacingMultiple:1.4 }
);
}
// ── WRITE FILE ────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/insanity-presentation/Diagnosis_of_Insanity_Reddy.pptx" })
.then(() => console.log("PPTX created successfully."))
.catch(e => { console.error(e); process.exit(1); });
cd /home/daytona/workspace/insanity-presentation && node create_pptx.js 2>&1
ls -lh /home/daytona/workspace/insanity-presentation/Diagnosis_of_Insanity_Reddy…
Diagnosis of Insanity Reddy
Presentation · PPTX
| # | Slide |
|---|---|
| 1 | Title slide (dark theme) |
| 2 | Outline / Overview |
| 3 | Introduction & Definition |
| 4 | Step 1 - Preliminaries |
| 5 | Step 2 - Family History |
| 6 | Step 3 - Personal History (full 8-row table) |
| 7 | Step 4 - Physical Examination |
| 8 | Step 5 - Mental Status Exam Part 1 (domains 1-7) |
| 9 | Step 5 - Mental Status Exam Part 2 (domains 8-14) |
| 10 | Step 6 - Investigations |
| 11 | Observation Period (3-column card layout) |
| 12 | Certification Rules |
| 13 | Table 23.3 - Real vs Feigned Mental Illness |
| 14 | Lucid Interval + Table 23.1 - Insanity vs Head Injury |
| 15 | Summary flowchart (all 8 steps) |
| 16 | Thank You & Reference slide (dark theme) |
Make short of 8 or 9 pages
~/insanity-presentation/create_pptx_short.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Diagnosis of Insanity";
pres.author = "Reddy & Murty, FMT 36th Edition";
const C = {
darkBlue: "1A3A5C",
midBlue: "2E6DA4",
lightBlue: "D6E4F0",
gold: "F39C12",
white: "FFFFFF",
darkText: "1C1C1C",
greyBg: "F4F6F8",
greyLine: "AAB4BE",
lightGreen:"EAFAF1",
lightRed: "FDEDEC",
};
const REF = "Reddy & Murty, Essentials of FMT, 36th Ed. (2026), Ch. 23";
// ── helpers ───────────────────────────────────────────────────────────────
function bg(s) {
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.greyBg}, line:{color:C.greyBg} });
}
function header(s, title, sub) {
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:1.05, fill:{color:C.darkBlue}, line:{color:C.darkBlue} });
s.addShape(pres.shapes.RECTANGLE, { x:0, y:1.05, w:10, h:0.04, fill:{color:C.gold}, line:{color:C.gold} });
s.addText(title, { x:0.3, y:0.06, w:9.4, h:0.56, fontSize:21, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
if (sub) s.addText(sub, { x:0.3, y:0.62, w:9.4, h:0.36, fontSize:10.5, italic:true, color:C.lightBlue, fontFace:"Calibri" });
}
function sectionBar(s, text, y) {
s.addShape(pres.shapes.RECTANGLE, { x:0.3, y, w:9.4, h:0.3, fill:{color:C.midBlue}, line:{color:C.midBlue} });
s.addText(text, { x:0.4, y, w:9.2, h:0.3, fontSize:10.5, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
}
function infoBox(s, text, x, y, w, h, bg2, tc) {
s.addShape(pres.shapes.RECTANGLE, { x, y, w, h, fill:{color:bg2||C.lightBlue}, line:{color:C.midBlue, width:0.5} });
s.addText(text, { x:x+0.1, y:y+0.06, w:w-0.2, h:h-0.12, fontSize:9.5, color:tc||C.darkBlue, fontFace:"Calibri", wrap:true, valign:"top" });
}
function footer(s, txt) {
s.addShape(pres.shapes.RECTANGLE, { x:0, y:5.44, w:10, h:0.185, fill:{color:C.greyBg}, line:{color:C.greyLine, width:0.5} });
s.addText(txt||REF, { x:0.2, y:5.445, w:9.6, h:0.175, fontSize:7.5, italic:true, color:"888888", fontFace:"Calibri", align:"center" });
}
function table(s, rows, colW, startY, rowH, headerColor) {
rows.forEach((row, i) => {
const y = startY + i * rowH;
const isH = i === 0;
const defBg = isH ? (headerColor||C.darkBlue) : (i%2===0 ? C.greyBg : C.white);
const tc = isH ? C.white : C.darkText;
let x = 0.3;
colW.forEach((w, ci) => {
const cellBg = Array.isArray(row[ci]) ? row[ci][1] : defBg;
const cellTxt = Array.isArray(row[ci]) ? row[ci][0] : row[ci];
s.addShape(pres.shapes.RECTANGLE, { x, y, w, h:rowH, fill:{color:cellBg}, line:{color:C.greyLine, width:0.4} });
s.addText(cellTxt, { x:x+0.06, y:y+0.03, w:w-0.12, h:rowH-0.06, fontSize:isH?9.5:8.5, bold:isH, color:isH?C.white:C.darkText, fontFace:"Calibri", valign:"middle", wrap:true });
x += w;
});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.darkBlue}, line:{color:C.darkBlue} });
s.addShape(pres.shapes.RECTANGLE, { x:0, y:2.5, w:10, h:0.06, fill:{color:C.gold}, line:{color:C.gold} });
s.addText("DIAGNOSIS OF INSANITY", {
x:0.5, y:0.9, w:9, h:1.2, fontSize:34, bold:true, color:C.white,
align:"center", valign:"middle", fontFace:"Calibri", charSpacing:2
});
s.addText("Forensic Medicine & Toxicology", {
x:0.5, y:2.62, w:9, h:0.45, fontSize:14, italic:true, color:C.lightBlue, align:"center", fontFace:"Calibri"
});
s.addText("K.S. Narayan Reddy & O.P. Murty\nEssentials of FMT, 36th Edition (2026) — Chapter 23", {
x:1, y:3.25, w:8, h:0.7, fontSize:11, color:C.gold, align:"center", fontFace:"Calibri"
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 2 — INTRODUCTION
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide(); bg(s);
header(s, "INTRODUCTION", "Definition & Medico-legal Significance");
infoBox(s,
"Insanity is a legal (not medical) term for persons unable to adapt to ordinary social requirements due to mental disease or defect. Indian law has not defined it formally.",
0.3, 1.2, 9.4, 0.65);
sectionBar(s, "Why Diagnosis Matters", 2.0);
const pts = [
{ text:"In a typical case diagnosis is easy; early stages and borderline cases are difficult.", options:{bullet:true, breakLine:true, color:C.darkText} },
{ text:"Aim: form an opinion about the patient's mind and the degree of responsibility.", options:{bullet:true, breakLine:true, color:C.darkText} },
{ text:"A person found insane at the time of an offence may not be held criminally responsible (S. 84, IPC).", options:{bullet:true, color:C.darkText} },
];
s.addText(pts, { x:0.3, y:2.35, w:9.4, h:1.4, fontSize:11, fontFace:"Calibri", valign:"top", wrap:true });
infoBox(s,
"Examination steps: Preliminaries → Family history → Personal history → Physical exam → Mental status exam → Investigations → Observation → Certification",
0.3, 3.9, 9.4, 0.65, "FEF9E7", "7D6608");
footer(s, REF + ", p. 464");
}
// ════════════════════════════════════════════════════════════
// SLIDE 3 — HISTORY (Family + Personal combined)
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide(); bg(s);
header(s, "HISTORY TAKING", "Family History & Personal History");
// Left panel — Family history
s.addShape(pres.shapes.RECTANGLE, { x:0.3, y:1.18, w:4.35, h:0.3, fill:{color:C.midBlue}, line:{color:C.midBlue} });
s.addText("Family History", { x:0.4, y:1.18, w:4.15, h:0.3, fontSize:10.5, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
const fh = [
{ text:"Mental condition of parents & siblings", options:{bullet:true, breakLine:true, color:C.darkText} },
{ text:"History of chorea, epilepsy or frank mental illness in family", options:{bullet:true, color:C.darkText} },
];
s.addShape(pres.shapes.RECTANGLE, { x:0.3, y:1.48, w:4.35, h:1.1, fill:{color:C.white}, line:{color:C.greyLine, width:0.5} });
s.addText(fh, { x:0.4, y:1.52, w:4.1, h:1.0, fontSize:10.5, fontFace:"Calibri", valign:"top", wrap:true });
// Right panel — Personal history
s.addShape(pres.shapes.RECTANGLE, { x:4.85, y:1.18, w:4.85, h:0.3, fill:{color:C.midBlue}, line:{color:C.midBlue} });
s.addText("Personal History (8 Categories)", { x:4.95, y:1.18, w:4.65, h:0.3, fontSize:10.5, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
const ph = [
["1","Previous mental disease in parents"],
["2","Environmental factors (home, parenting, inferiority complex)"],
["3","Psychogenic factors (repression, conflict, anxiety)"],
["4","Organic diseases (CVA, head injury, fevers, renal/cardiac)"],
["5","Drug dependence (opium, alcohol, cannabis, etc.)"],
["6","Domestic difficulties"],
["7","Emotional shock"],
["8","Frustrations in life, love, sex, career"],
];
ph.forEach(([n, txt], i) => {
const y = 1.48 + i * 0.5;
const bg2 = i%2===0 ? C.lightBlue : C.white;
s.addShape(pres.shapes.RECTANGLE, { x:4.85, y, w:4.85, h:0.48, fill:{color:bg2}, line:{color:C.greyLine, width:0.4} });
s.addText([{text:n+".", options:{bold:true, color:C.midBlue}}, {text:" "+txt, options:{color:C.darkText}}],
{ x:4.95, y:y+0.04, w:4.65, h:0.4, fontSize:9, fontFace:"Calibri", valign:"middle", wrap:true });
});
footer(s, REF + ", p. 464");
}
// ════════════════════════════════════════════════════════════
// SLIDE 4 — PHYSICAL EXAMINATION
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide(); bg(s);
header(s, "STEP 4: PHYSICAL EXAMINATION", "General & Systemic Assessment");
const items = [
["Observation", "Manner of dressing, walking, bearing and gestures"],
["Morphology", "Deformities and malformations in head or body"],
["Vitals", "Pulse rate & temperature — both may be increased"],
["Tongue", "May be furred"],
["Skin", "Dry and wrinkled; hands and feet moist"],
["Full Exam", "Complete examination to exclude any organic disease"],
];
items.forEach(([label, detail], i) => {
const y = 1.22 + i * 0.68;
const bg2 = i%2===0 ? C.lightBlue : C.white;
s.addShape(pres.shapes.RECTANGLE, { x:0.3, y, w:9.4, h:0.62, fill:{color:bg2}, line:{color:C.greyLine, width:0.4} });
s.addText([{text:label+": ", options:{bold:true, color:C.darkBlue}}, {text:detail, options:{color:C.darkText}}],
{ x:0.45, y:y+0.06, w:9.1, h:0.5, fontSize:11, fontFace:"Calibri", valign:"middle", wrap:true });
});
footer(s, REF + ", p. 464");
}
// ════════════════════════════════════════════════════════════
// SLIDE 5 — MENTAL STATUS EXAMINATION
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide(); bg(s);
header(s, "STEP 5: MENTAL STATUS EXAMINATION", "14 Domains — Record All Observations");
const domains = [
["1. General Appearance", "Naked/dressed, dirty/clean, facial expression (vacant, grimacing, mask-like)"],
["2. Talk", "Mutism, aphonia, echolalia, neologism, perseveration, wandering speech"],
["3. Speech", "Coherent/incoherent, aphasia, lisping, slurring, stammering"],
["4. Writing", "Agraphia, flight of ideas, obscene/unintelligible language"],
["5. Behaviour", "Stereotypy, stupor, negativism, echopraxia, automatic obedience"],
["6. Mood", "Euphoria, anger, elation, apathy, irritability"],
["7. Memory", "Concentration, grasp, appreciation"],
["8. Sleep", "Insomnia, somnambulism, somnolentia"],
["9. Gait & Posture", "Stealthy, hurried; proud, aggressive, worried"],
["10. Attention", "Attentive, inattentive, fluctuating"],
["11. Sex Behaviour", "Towards same/opposite sex"],
["12–14. Thought", "Process (retardation, ambivalence) & Content (delusions, hallucinations, illusions, obsessions)"],
];
// Two columns of 6 each
const half = Math.ceil(domains.length / 2);
for (let i = 0; i < domains.length; i++) {
const col = i < half ? 0 : 1;
const row = i < half ? i : i - half;
const x = col === 0 ? 0.3 : 5.1;
const w = 4.65;
const y = 1.18 + row * 0.72;
const bg2 = row%2===0 ? C.lightBlue : C.white;
s.addShape(pres.shapes.RECTANGLE, { x, y, w, h:0.66, fill:{color:bg2}, line:{color:C.greyLine, width:0.4} });
s.addText([{text:domains[i][0]+": ", options:{bold:true, color:C.darkBlue, fontSize:9}}, {text:domains[i][1], options:{color:C.darkText, fontSize:8.5}}],
{ x:x+0.08, y:y+0.04, w:w-0.16, h:0.58, fontFace:"Calibri", valign:"top", wrap:true });
}
footer(s, REF + ", p. 464–465");
}
// ════════════════════════════════════════════════════════════
// SLIDE 6 — INVESTIGATIONS + OBSERVATION + CERTIFICATION
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide(); bg(s);
header(s, "INVESTIGATIONS, OBSERVATION & CERTIFICATION", "Steps 6, 7 & 8");
// Investigations
sectionBar(s, "Step 6: Investigations", 1.18);
s.addText("Blood • Urine • CSF | CT/MRI Brain | EEG", {
x:0.3, y:1.52, w:9.4, h:0.32, fontSize:11, color:C.darkText, fontFace:"Calibri", valign:"middle"
});
// Observation
sectionBar(s, "Step 7: Observation Period", 1.95);
const obs = [
{ text:"Setting: General hospital, psychiatric home, or prison (for violent/criminal persons).", options:{bullet:true, breakLine:true, color:C.darkText} },
{ text:"Duration: Not to exceed 10 days; up to 30 days with Magistrate's permission.", options:{bullet:true, breakLine:true, color:C.darkText} },
{ text:"Watch at different times — alone, in company, eating, reading, and when UNAWARE of being observed.", options:{bullet:true, color:C.darkText} },
];
s.addText(obs, { x:0.3, y:2.3, w:9.4, h:0.95, fontSize:10.5, fontFace:"Calibri", valign:"top", wrap:true });
// Certification
sectionBar(s, "Step 8: Certification", 3.35);
const cert = [
{ text:"Do NOT issue a certificate after a single examination.", options:{bullet:true, breakLine:true, color:C.darkText, bold:true} },
{ text:"Minimum 3 examinations on different days and different hours.", options:{bullet:true, breakLine:true, color:C.darkText} },
{ text:"Certificate must contain: clinical description of the patient + reasons for the diagnosis.", options:{bullet:true, color:C.darkText} },
];
s.addText(cert, { x:0.3, y:3.7, w:9.4, h:1.0, fontSize:10.5, fontFace:"Calibri", valign:"top", wrap:true });
footer(s, REF + ", p. 465");
}
// ════════════════════════════════════════════════════════════
// SLIDE 7 — REAL vs FEIGNED (Table 23.3)
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide(); bg(s);
header(s, "REAL vs FEIGNED MENTAL ILLNESS", "Table 23.3 — Reddy, FMT 36th Ed., p. 465");
const rows = [
["Trait", "Real Mental Illness", "Feigned Mental Illness"],
["Onset", "Gradual", "Sudden"],
["Motive", "Absent", "Present (e.g., escape punishment)"],
["Predisposing factors", "Usually present", "Absent"],
["Signs & symptoms", "Uniform; present even unobserved", "Variable; present only when observed"],
["Facial expression", "Vacant or fixed excitement", "Frequently changing, voluntary"],
["Insomnia", "Present", "Cannot persist; sleeps after 1–2 days"],
["Exertion", "Withstands fatigue for days", "Breaks down within a few days"],
["Habits", "Dirty and filthy", "Not dirty and filthy"],
["Skin & lips", "Dry, harsh", "Normal"],
["Frequent exam", "Does not mind", "Resents — fears detection"],
];
const colW = [2.3, 3.55, 3.5];
const rowH = 0.4;
rows.forEach((row, i) => {
const y = 1.18 + i * rowH;
const isH = i === 0;
const bgs = isH
? [C.darkBlue, C.darkBlue, C.darkBlue]
: [i%2===0?C.greyBg:C.white, i%2===0?"E9F7EF":"F0FBF4", i%2===0?"FDEDEC":"FEF5F4"];
const tc = isH ? C.white : C.darkText;
let x = 0.3;
colW.forEach((w, ci) => {
s.addShape(pres.shapes.RECTANGLE, { x, y, w, h:rowH, fill:{color:bgs[ci]}, line:{color:C.greyLine, width:0.4} });
s.addText(row[ci], { x:x+0.06, y:y+0.04, w:w-0.12, h:rowH-0.08, fontSize:isH?9.5:8.5, bold:isH, color:tc, fontFace:"Calibri", valign:"middle", wrap:true });
x += w;
});
});
footer(s, REF + ", p. 465 (Table 23.3)");
}
// ════════════════════════════════════════════════════════════
// SLIDE 8 — LUCID INTERVAL
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide(); bg(s);
header(s, "LUCID INTERVAL", "Table 23.1 — Insanity vs Head Injury");
infoBox(s,
"Definition: A period in insanity during which all symptoms disappear completely. The person is able to judge his acts soundly and becomes legally liable for them.",
0.3, 1.18, 9.4, 0.62);
sectionBar(s, "Key Points", 1.92);
const pts = [
{ text:"Duration varies per person and from time to time in the same person.", options:{bullet:true, breakLine:true, color:C.darkText} },
{ text:"Cannot be certain when the person passes again into insanity — so he cannot be completely held responsible for an act during this period.", options:{bullet:true, breakLine:true, color:C.darkText} },
{ text:"Common in mania and melancholia.", options:{bullet:true, color:C.darkText} },
];
s.addText(pts, { x:0.3, y:2.27, w:9.4, h:0.9, fontSize:11, fontFace:"Calibri", valign:"top", wrap:true });
sectionBar(s, "Table 23.1: Lucid Interval — Insanity vs Head Injury", 3.28);
const li = [
["Trait", "Insanity", "Head Injury"],
["History", "History of insanity present", "History of injury to the head"],
["Consciousness", "Always conscious", "May be unconscious initially"],
["Duration", "Variable, unpredictable", "Short and usually definite"],
["Recurrence", "Recurs unpredictably", "Usually does not recur after recovery"],
];
const colW2 = [2.3, 3.55, 3.5];
li.forEach((row, i) => {
const y = 3.62 + i * 0.38;
const isH = i === 0;
const bg2 = isH ? C.midBlue : (i%2===0 ? C.greyBg : C.white);
const tc = isH ? C.white : C.darkText;
let x = 0.3;
colW2.forEach((w, ci) => {
s.addShape(pres.shapes.RECTANGLE, { x, y, w, h:0.36, fill:{color:bg2}, line:{color:C.greyLine, width:0.4} });
s.addText(row[ci], { x:x+0.06, y:y+0.03, w:w-0.12, h:0.3, fontSize:isH?9:8.5, bold:isH, color:tc, fontFace:"Calibri", valign:"middle", wrap:true });
x += w;
});
});
footer(s, REF + ", p. 463 (Table 23.1)");
}
// ════════════════════════════════════════════════════════════
// SLIDE 9 — THANK YOU / SUMMARY
// ════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{color:C.darkBlue}, line:{color:C.darkBlue} });
s.addShape(pres.shapes.RECTANGLE, { x:0, y:2.55, w:10, h:0.06, fill:{color:C.gold}, line:{color:C.gold} });
// 8-step quick summary on left
s.addShape(pres.shapes.RECTANGLE, { x:0.3, y:0.15, w:4.5, h:2.25, fill:{color:"162D48"}, line:{color:"162D48"} });
s.addText("8-STEP APPROACH", { x:0.35, y:0.18, w:4.4, h:0.35, fontSize:10, bold:true, color:C.gold, fontFace:"Calibri", align:"center" });
const steps = ["1. Preliminaries","2. Family History","3. Personal History","4. Physical Exam",
"5. Mental Status Exam","6. Investigations","7. Observation","8. Certification"];
steps.forEach((st, i) => {
s.addText(st, { x:0.35, y:0.54+i*0.22, w:4.4, h:0.22, fontSize:9.5, color:C.lightBlue, fontFace:"Calibri" });
});
s.addText("THANK YOU", {
x:5.1, y:0.5, w:4.5, h:1.0, fontSize:32, bold:true, color:C.white,
align:"center", valign:"middle", fontFace:"Calibri"
});
s.addShape(pres.shapes.RECTANGLE, { x:2.5, y:2.67, w:5, h:0.04, fill:{color:C.gold}, line:{color:C.gold} });
s.addText("Reference", { x:0.5, y:2.8, w:9, h:0.3, fontSize:11, bold:true, color:C.gold, align:"center", fontFace:"Calibri" });
s.addText(
"K.S. Narayan Reddy & O.P. Murty\nThe Essentials of Forensic Medicine and Toxicology, 36th Edition (2026)\nChapter 23 — Diagnosis of Insanity, pp. 463–465",
{ x:1, y:3.18, w:8, h:0.9, fontSize:11, color:C.lightBlue, align:"center", fontFace:"Calibri", lineSpacingMultiple:1.4 }
);
}
// ── WRITE ──────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/insanity-presentation/Diagnosis_Insanity_Short.pptx" })
.then(() => console.log("Done."))
.catch(e => { console.error(e); process.exit(1); });
cd /home/daytona/workspace/insanity-presentation && node create_pptx_short.js 2>…
ls -lh /home/daytona/workspace/insanity-presentation/Diagnosis_Insanity_Short.pp…
Diagnosis Insanity Short
Presentation · PPTX
| # | Slide |
|---|---|
| 1 | Title (dark theme) |
| 2 | Introduction & Definition |
| 3 | Family History + Personal History (both on one slide, side by side) |
| 4 | Physical Examination |
| 5 | Mental Status Examination (all 14 domains, two-column layout) |
| 6 | Investigations + Observation + Certification (Steps 6–8 combined) |
| 7 | Real vs Feigned Mental Illness — Table 23.3 |
| 8 | Lucid Interval + Table 23.1 |
| 9 | Thank You + 8-step quick summary |