Create a discharge summary using this data
mkdir -p /tmp/workspace/discharge-summary && ls /tmp/workspace/discharge-summary/
~/discharge-summary/create_summary.py
from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
doc = Document()
# --- Page margins ---
section = doc.sections[0]
section.top_margin = Inches(0.8)
section.bottom_margin = Inches(0.8)
section.left_margin = Inches(1.0)
section.right_margin = Inches(1.0)
# --- Default style ---
normal_style = doc.styles["Normal"]
normal_style.font.name = "Arial"
normal_style.font.size = Pt(11)
# ---- Helper: add a shaded heading row ----
def add_section_heading(doc, text):
p = doc.add_paragraph()
p.paragraph_format.space_before = Pt(8)
p.paragraph_format.space_after = Pt(2)
run = p.add_run(text.upper())
run.bold = True
run.font.size = Pt(11)
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
# Shade paragraph background
pPr = p._p.get_or_add_pPr()
shd = OxmlElement("w:shd")
shd.set(qn("w:val"), "clear")
shd.set(qn("w:color"), "auto")
shd.set(qn("w:fill"), "1F3864")
pPr.append(shd)
return p
def add_field_row(doc, label, value):
p = doc.add_paragraph()
p.paragraph_format.space_before = Pt(1)
p.paragraph_format.space_after = Pt(1)
label_run = p.add_run(f"{label}: ")
label_run.bold = True
label_run.font.size = Pt(11)
val_run = p.add_run(value)
val_run.font.size = Pt(11)
return p
def add_bullet(doc, text):
p = doc.add_paragraph(style="List Bullet")
p.paragraph_format.space_before = Pt(1)
p.paragraph_format.space_after = Pt(1)
run = p.add_run(text)
run.font.size = Pt(11)
return p
def add_body_text(doc, text):
p = doc.add_paragraph(text)
p.paragraph_format.space_before = Pt(2)
p.paragraph_format.space_after = Pt(2)
for run in p.runs:
run.font.size = Pt(11)
return p
# ===== HEADER =====
hosp_p = doc.add_paragraph()
hosp_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = hosp_p.add_run("BMH THODUPUZHA")
r.bold = True
r.font.size = Pt(16)
r.font.color.rgb = RGBColor(0x1F, 0x38, 0x64)
dept_p = doc.add_paragraph()
dept_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r2 = dept_p.add_run("Department of Neurosurgery")
r2.bold = True
r2.font.size = Pt(12)
r2.font.color.rgb = RGBColor(0x1F, 0x38, 0x64)
title_p = doc.add_paragraph()
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
title_p.paragraph_format.space_before = Pt(6)
r3 = title_p.add_run("DISCHARGE SUMMARY")
r3.bold = True
r3.font.size = Pt(14)
r3.underline = True
# Horizontal line
doc.add_paragraph("─" * 80)
# ===== PATIENT IDENTIFICATION =====
add_section_heading(doc, "Patient Information")
add_field_row(doc, "Name", "Dr. Krantiraj Popat Pawar")
add_field_row(doc, "Age / Sex", "61 Years / Male (presumed)")
add_field_row(doc, "IP Number", "IP-001")
add_field_row(doc, "Date of Admission", "28 July 2026")
add_field_row(doc, "Date of Discharge", "01 August 2026 (approx.)")
add_field_row(doc, "Treating Neurologist", "Dr. Jithin George")
add_field_row(doc, "Operating Surgeon", "Dr. Krantiraj Popat Pawar")
add_field_row(doc, "Department", "Neurosurgery – Neurosurgery OPD")
# ===== DIAGNOSIS =====
add_section_heading(doc, "Final Diagnosis")
add_bullet(doc, "Left Acute Subdural Hematoma (ASDH) with Mass Effect and Raised Intracranial Pressure")
add_bullet(doc, "Co-morbidities: Diabetes Mellitus (DM), Hypertension (HTN), Dyslipidaemia (DLP)")
# ===== PRESENTING COMPLAINTS =====
add_section_heading(doc, "Presenting Complaints")
add_bullet(doc, "Holocranial headache – 1 week duration")
add_bullet(doc, "1 episode of vomiting")
add_bullet(doc, "Reduced / slurred speech following initiation of medications at outside facility")
add_bullet(doc, "Word-finding difficulty (Mild Aphasia)")
add_bullet(doc, "Gait unsteadiness")
# ===== HISTORY =====
add_section_heading(doc, "History of Present Illness")
add_body_text(doc,
"A 61-year-old patient with known background of Diabetes Mellitus, Hypertension, and "
"Dyslipidaemia presented with a 1-week history of holocranial headache and one episode of "
"vomiting. The patient had previously been evaluated at Smita Hospital by Dr. Prasanth, "
"where medications were commenced. Following initiation of treatment, the patient developed "
"reduced speech, word-finding difficulty, and gait unsteadiness. The patient was referred "
"from Neurology (Dr. Jithin George) to Neurosurgery for further evaluation and management.")
# ===== CLINICAL FINDINGS =====
add_section_heading(doc, "Clinical Findings on Presentation")
add_field_row(doc, "Pulse Rate", "87 bpm")
add_field_row(doc, "Blood Pressure", "120/80 mmHg")
add_field_row(doc, "Neurological", "Mild Aphasia +")
add_field_row(doc, "Speech", "Reduced / Word-finding difficulty")
add_field_row(doc, "Gait", "Unsteady (Gait unsteadiness)")
# ===== INVESTIGATIONS =====
add_section_heading(doc, "Investigations")
add_bullet(doc, "MRI Brain Screening: Demonstrated Left Frontoparietal Acute Subdural Hematoma (SDH)")
add_bullet(doc, "CT Brain: Large left frontotemporoparietal acute subdural hematoma causing significant "
"mass effect with midline shift – confirmed emergency surgical decompression indication")
# ===== SURGICAL PROCEDURE =====
add_section_heading(doc, "Surgical Procedure")
add_field_row(doc, "Procedure", "Left Double Burr Hole Craniectomy with Evacuation of Acute Subdural Hematoma and Placement of Left Subdural Drain")
add_field_row(doc, "Pre-operative Diagnosis", "Left Acute Subdural Hematoma with Mass Effect and Raised Intracranial Pressure")
add_field_row(doc, "Post-operative Diagnosis", "Same as pre-operative diagnosis")
add_field_row(doc, "Surgeon", "Dr. Krantiraj Popat Pawar")
add_field_row(doc, "Anaesthesia", "General Endotracheal Anaesthesia")
add_field_row(doc, "Patient Position", "Supine, head elevated ~30 degrees and turned slightly to the right to expose left frontoparietal region; all pressure points padded")
doc.add_paragraph()
p = doc.add_paragraph()
r = p.add_run("Operative Findings:")
r.bold = True
r.font.size = Pt(11)
add_bullet(doc, "Tense acute left subdural hematoma encountered under pressure")
add_bullet(doc, "Thick fresh clot mixed with liquid blood evacuated through burr holes")
add_bullet(doc, "Underlying brain initially compressed; satisfactory re-expansion demonstrated following decompression")
add_bullet(doc, "No active cortical arterial bleeding identified")
add_bullet(doc, "Adequate haemostasis achieved")
doc.add_paragraph()
p2 = doc.add_paragraph()
r2 = p2.add_run("Procedure Summary:")
r2.bold = True
r2.font.size = Pt(11)
add_body_text(doc,
"After induction of general anaesthesia, the left frontoparietal scalp was shaved, prepared "
"with antiseptic solution, and draped in standard sterile fashion. Linear scalp incisions were "
"made over the left frontal and left parietal regions. Haemostasis of the scalp was achieved "
"using bipolar electrocautery. Burr holes were created with a high-speed perforator; bleeding "
"from the diploic bone was controlled with bone wax. The dura was coagulated and opened in a "
"cruciate fashion at both burr hole sites. Acute subdural blood under pressure was released. "
"Thick clot and liquid hematoma were evacuated using gentle suction and copious warm normal "
"saline irrigation. A soft catheter was gently advanced into the subdural space through each "
"burr hole to irrigate and evacuate residual hematoma until the returning fluid was clear. "
"Meticulous haemostasis was confirmed. A closed-system left subdural drain was inserted through "
"the posterior burr hole and brought out through a separate stab incision. Burr holes were "
"covered with absorbable haemostatic material. The galea was closed with interrupted 2-0 Vicryl "
"sutures; skin was closed with staples. Sterile dressings were applied.")
add_field_row(doc, "Estimated Blood Loss", "Approximately 100 mL")
add_field_row(doc, "Drains", "Left subdural open-system drain x1")
add_field_row(doc, "Specimens", "None")
add_field_row(doc, "Complications", "None")
# ===== POST-OPERATIVE COURSE =====
add_section_heading(doc, "Post-operative Course")
add_body_text(doc,
"The patient tolerated the procedure well. Immediately following surgery, the patient was "
"transferred to the Neurosurgical Intensive Care Unit (NSICU) in stable condition for "
"post-operative monitoring. Progressive neurological recovery was noted during the "
"post-operative period.")
# ===== REFERRALS =====
add_section_heading(doc, "Referrals")
add_field_row(doc, "Referring Department", "Neurology")
add_field_row(doc, "Referring Consultant", "Dr. Jithin George")
add_field_row(doc, "Referred To", "Neurosurgery – Dr. Krantiraj Popat Pawar")
# ===== DISCHARGE ADVICE =====
add_section_heading(doc, "Discharge Advice & Follow-up")
add_bullet(doc, "Continue prescribed medications for Diabetes Mellitus, Hypertension, and Dyslipidaemia")
add_bullet(doc, "Wound care: keep staple line clean and dry; return for staple removal as advised")
add_bullet(doc, "Avoid strenuous physical activity and head trauma")
add_bullet(doc, "Repeat CT/MRI Brain as advised by the treating surgeon")
add_bullet(doc, "Speech therapy referral for residual aphasia, if required")
add_bullet(doc, "Physiotherapy for gait rehabilitation, if required")
add_bullet(doc, "Follow-up in Neurosurgery OPD within 1 week of discharge")
add_bullet(doc, "Return immediately to emergency if: sudden worsening headache, altered consciousness, new neurological deficit, or fever")
# ===== CONDITION AT DISCHARGE =====
add_section_heading(doc, "Condition at Discharge")
add_field_row(doc, "General Condition", "Stable")
add_field_row(doc, "Neurological Status", "Improving – residual mild word-finding difficulty possible")
# ===== SIGNATURES =====
doc.add_paragraph()
sig_p = doc.add_paragraph()
sig_p.paragraph_format.space_before = Pt(20)
# Two-column signature using a table
table = doc.add_table(rows=2, cols=2)
table.style = "Table Grid"
for row in table.rows:
for cell in row.cells:
cell._tc.get_or_add_tcPr()
table.cell(0, 0).text = "\n\n_______________________________"
table.cell(0, 1).text = "\n\n_______________________________"
table.cell(1, 0).text = "Dr. Jithin George\nConsultant Neurologist\nBMH Thodupuzha"
table.cell(1, 1).text = "Dr. Krantiraj Popat Pawar\nConsultant Neurosurgeon\nBMH Thodupuzha"
for row in table.rows:
for cell in row.cells:
for para in cell.paragraphs:
for run in para.runs:
run.font.size = Pt(10)
# Footer note
doc.add_paragraph()
foot_p = doc.add_paragraph()
foot_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
fr = foot_p.add_run("This discharge summary was prepared on 01 August 2026 at BMH Thodupuzha – Neurosurgery Department")
fr.font.size = Pt(9)
fr.italic = True
fr.font.color.rgb = RGBColor(0x60, 0x60, 0x60)
# ===== SAVE =====
out_path = "/tmp/workspace/discharge-summary/Discharge_Summary_KrantirajPawar.docx"
doc.save(out_path)
print(f"Saved: {out_path}")
python3 /tmp/workspace/discharge-summary/create_summary.py
Discharge Summary KrantirajPawar
Word Document · DOCX
Tab cognitam plus of od or bd
Cognitam Plus tablet Citicoline Piracetam dosage OD BD frequency
https://www.1mg.com/drugs/cognitam-plus-tablet-674693
| Frequency | When used |
|---|---|
| BD (twice daily) | Standard recommended dosing for stroke rehabilitation, post-operative neuro recovery, cognitive enhancement |
| TDS (thrice daily) | For acute/severe cases - dose can be escalated up to 3-4 tablets/day in divided doses |
| OD | Not standard; insufficient to maintain therapeutic plasma levels of Piracetam |
Dose and duration should be guided by the neurosurgeon/neurologist based on recovery trajectory. Renal function should be checked before prescribing Piracetam, as dose adjustment is required in renal impairment (common in elderly DM/HTN patients like this one).