📢 BIOCHEM ASSIGNMENT Title: Jaundice The assignment should cover: • Types of jaundice – Pre-hepatic, Hepatic & Post-hepatic • Congenital hyperbilirubinemia • Gilbert’s syndrome • Crigler–Najjar syndrome • Other relevant conditions can be included if necessary. 📄 Length: 4 pages (front & back = 2 sheets) 📅 Deadline: 21st August 2026 Please make sure all the required topics are covered. Thank you! 😊

Reading File
Reading File
Reading File
Running Command

cd /tmp/workspace/attachments/bc496e43-63e2-41e7-a4b8-bc308701881c/ && python3 -c " import pdfplumber for f in ['Liver function test.pdf','Metabolism of bile.pdf','Pancreatic Function Test.pdf']: print('='*20, f, '='*20) with pdfplumber.open(f) as pdf: print('pages:', len(pdf.pages)) for i,page in enumerate(pdf.pages): t = page.extract_text() print(f'--- page {i+1} ---') print(t) " > extracted_text.txt 2>&1 wc -l extracted_text.txt

Reading File
Searching Content

"Jaundice" in .../bc496e43-63e2-41e7-a4b8-bc308701881c/extracted_text.txt

Searching Content

"Gilbert" in .../bc496e43-63e2-41e7-a4b8-bc308701881c/extracted_text.txt

Searching Content

"Crigler" in .../bc496e43-63e2-41e7-a4b8-bc308701881c/extracted_text.txt

Searching Content

"Bilirubin" in .../bc496e43-63e2-41e7-a4b8-bc308701881c/extracted_text.txt

This attachment has exactly the content needed. Let me read the relevant sections in detail (lines 100-250 for bilirubin metabolism, 380-935 for jaundice classification and congenital hyperbilirubinemias).
Reading File
Reading File
Reading File
Now let's read the congenital hyperbilirubinemia / Gilbert's / Crigler-Najjar sections (lines 550-935).
Reading File
Reading File
Reading File
Finding Sources
Searching PubMed

"Gilbert syndrome" OR "Crigler-Najjar"

Searching the Web

Crigler-Najjar syndrome type 1 vs type 2 UGT1A1 clinical features treatment

Running Command

mkdir -p /tmp/workspace/jaundice-assignment && ls -la /tmp/workspace/

Now writing the assignment as a Word document.
Writing File

~/jaundice-assignment/build_docx.py

#!/usr/bin/env python3
"""Build the Jaundice biochemistry assignment as a .docx file."""

from docx import Document
from docx.shared import Pt, Inches, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT
from docx.oxml.ns import qn
from docx.oxml import OxmlElement

doc = Document()

# ---------- Page setup (A4, moderate margins so 4 pages fit content nicely) ----------
section = doc.sections[0]
section.page_height = Cm(29.7)
section.page_width = Cm(21.0)
section.top_margin = Cm(1.8)
section.bottom_margin = Cm(1.8)
section.left_margin = Cm(2.0)
section.right_margin = Cm(2.0)

# ---------- Base style ----------
normal = doc.styles["Normal"]
normal.font.name = "Calibri"
normal.font.size = Pt(11)
normal.paragraph_format.space_after = Pt(4)
normal.paragraph_format.line_spacing = 1.08

# Heading colors
NAVY = RGBColor(0x1F, 0x3A, 0x5F)
MAROON = RGBColor(0x7A, 0x1F, 0x2B)

h1 = doc.styles["Heading 1"]
h1.font.name = "Calibri"
h1.font.size = Pt(15)
h1.font.color.rgb = NAVY
h1.font.bold = True
h1.paragraph_format.space_before = Pt(10)
h1.paragraph_format.space_after = Pt(4)

h2 = doc.styles["Heading 2"]
h2.font.name = "Calibri"
h2.font.size = Pt(12.5)
h2.font.color.rgb = MAROON
h2.font.bold = True
h2.paragraph_format.space_before = Pt(6)
h2.paragraph_format.space_after = Pt(2)


def add_footer_page_number():
    footer = section.footer
    p = footer.paragraphs[0]
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    run = p.add_run()
    fld_begin = OxmlElement('w:fldChar')
    fld_begin.set(qn('w:fldCharType'), 'begin')
    instr = OxmlElement('w:instrText')
    instr.text = "PAGE"
    fld_end = OxmlElement('w:fldChar')
    fld_end.set(qn('w:fldCharType'), 'end')
    run._r.append(fld_begin)
    run._r.append(instr)
    run._r.append(fld_end)


add_footer_page_number()


def add_table(headers, rows, col_widths=None, header_shade="1F3A5F"):
    table = doc.add_table(rows=1, cols=len(headers))
    table.style = "Light Grid Accent 1"
    table.alignment = WD_TABLE_ALIGNMENT.CENTER
    hdr_cells = table.rows[0].cells
    for i, htext in enumerate(headers):
        hdr_cells[i].text = ""
        p = hdr_cells[i].paragraphs[0]
        run = p.add_run(htext)
        run.bold = True
        run.font.size = Pt(9.5)
        run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
        # shading
        shd = OxmlElement('w:shd')
        shd.set(qn('w:fill'), header_shade)
        hdr_cells[i]._tc.get_or_add_tcPr().append(shd)
    for row in rows:
        cells = table.add_row().cells
        for i, val in enumerate(row):
            cells[i].text = ""
            p = cells[i].paragraphs[0]
            run = p.add_run(val)
            run.font.size = Pt(9.5)
    if col_widths:
        for row in table.rows:
            for i, w in enumerate(col_widths):
                row.cells[i].width = Cm(w)
    doc.add_paragraph().paragraph_format.space_after = Pt(2)
    return table


def p(text, bold=False, italic=False, size=11, space_after=4, align=None, color=None):
    para = doc.add_paragraph()
    para.paragraph_format.space_after = Pt(space_after)
    if align:
        para.alignment = align
    run = para.add_run(text)
    run.bold = bold
    run.italic = italic
    run.font.size = Pt(size)
    if color:
        run.font.color.rgb = color
    return para


def bullet(text, bold_lead=None):
    para = doc.add_paragraph(style="List Bullet")
    para.paragraph_format.space_after = Pt(2)
    if bold_lead:
        r = para.add_run(bold_lead)
        r.bold = True
        para.add_run(text)
    else:
        para.add_run(text)
    return para


# =========================================================================
# TITLE BLOCK
# =========================================================================
title_p = doc.add_paragraph()
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
title_run = title_p.add_run("JAUNDICE")
title_run.bold = True
title_run.font.size = Pt(24)
title_run.font.color.rgb = NAVY

subtitle_p = doc.add_paragraph()
subtitle_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
subtitle_run = subtitle_p.add_run(
    "Classification, Biochemical Basis and Congenital Hyperbilirubinemias"
)
subtitle_run.italic = True
subtitle_run.font.size = Pt(12.5)
subtitle_run.font.color.rgb = MAROON
subtitle_p.paragraph_format.space_after = Pt(10)

info_table = doc.add_table(rows=2, cols=2)
info_table.alignment = WD_TABLE_ALIGNMENT.CENTER
labels = [("Subject:", "Biochemistry"), ("Topic:", "Jaundice")]
for i, (k, v) in enumerate(labels):
    info_table.rows[i].cells[0].text = ""
    run = info_table.rows[i].cells[0].paragraphs[0].add_run(k)
    run.bold = True
    run.font.size = Pt(10)
    info_table.rows[i].cells[1].text = ""
    run2 = info_table.rows[i].cells[1].paragraphs[0].add_run(v)
    run2.font.size = Pt(10)
doc.add_paragraph().paragraph_format.space_after = Pt(2)

# =========================================================================
# 1. INTRODUCTION
# =========================================================================
doc.add_heading("1. Introduction", level=1)
p(
    "Jaundice, also called icterus, is the yellowish discolouration of the skin, sclera and mucous "
    "membranes caused by the deposition of bilirubin in tissues secondary to a raised serum bilirubin "
    "level (hyperbilirubinemia). It is not a disease by itself but a clinical sign of an underlying "
    "disturbance in bilirubin production, transport, conjugation or excretion. Jaundice becomes clinically "
    "detectable when serum bilirubin exceeds about 2-2.5 mg/dL, roughly twice the upper limit of the normal "
    "value (0.2-1.0 mg/dL)."
)

# =========================================================================
# 2. BILIRUBIN METABOLISM (brief foundation)
# =========================================================================
doc.add_heading("2. Normal Bilirubin Metabolism", level=1)
p(
    "Bilirubin is the end product of haem catabolism. About 70-80% is derived from the haemoglobin of "
    "senescent red blood cells destroyed by the reticuloendothelial system (spleen, liver, bone marrow), "
    "and the remainder from myoglobin, cytochromes and ineffective erythropoiesis."
)
bullet("Haem is oxidised by haem oxygenase to biliverdin (releasing Fe3+ and CO), which is then reduced by "
       "biliverdin reductase to unconjugated (indirect) bilirubin.")
bullet("Unconjugated bilirubin is water-insoluble and is transported in plasma bound to albumin to the "
       "liver.")
bullet("Hepatocytes take up bilirubin (assisted by the carrier protein ligandin) and conjugate it in the "
       "smooth endoplasmic reticulum with glucuronic acid, catalysed by UDP-glucuronosyltransferase "
       "(UGT1A1), forming water-soluble bilirubin diglucuronide (conjugated/direct bilirubin).")
bullet("Conjugated bilirubin is actively secreted into bile canaliculi (via the MRP2 transporter) and "
       "passes into the intestine, where gut bacteria convert it to urobilinogen. Most urobilinogen is "
       "oxidised to stercobilin and excreted in faeces (giving stool its brown colour); a small fraction "
       "is reabsorbed into the portal blood (enterohepatic urobilinogen cycle), and a part of this is "
       "excreted by the kidney as urobilin, giving urine its normal colour.")

# =========================================================================
# 3. CLASSIFICATION OF JAUNDICE
# =========================================================================
doc.add_heading("3. Classification of Jaundice", level=1)
p(
    "Depending on the site of the defect along the bilirubin pathway, jaundice is classified into three "
    "major types: pre-hepatic, hepatic and post-hepatic."
)

doc.add_heading("3.1 Pre-hepatic (Haemolytic) Jaundice", level=2)
p(
    "The excretory capacity of the liver itself is normal; jaundice results from excessive production of "
    "bilirubin that exceeds the liver's conjugating ability, so unconjugated bilirubin accumulates in "
    "blood. It is most often caused by excessive red-cell destruction (haemolysis)."
)
bullet("Intracorpuscular (intrinsic) defects: hereditary spherocytosis (membrane defect), "
       "haemoglobinopathies (sickle cell disease, thalassemia), glucose-6-phosphate dehydrogenase "
       "(G6PD) deficiency.")
bullet("Extracorpuscular (extrinsic) causes: mismatched blood transfusion / ABO incompatibility, malaria "
       "and other infections, drugs (sulpha drugs, anti-malarials), toxins and snake venom.")
p("Laboratory findings: raised unconjugated (indirect) bilirubin, normal liver enzymes, increased urinary "
  "and faecal urobilinogen, absent bilirubin in urine (acholuric jaundice), and evidence of haemolysis "
  "(raised reticulocyte count, raised LDH, low haptoglobin).", size=10.5)

doc.add_heading("3.2 Hepatic (Hepatocellular) Jaundice", level=2)
p(
    "Arises from disease of the hepatocytes themselves, impairing uptake, conjugation and/or secretion of "
    "bilirubin. Both unconjugated and conjugated bilirubin may rise, and liver enzymes (AST, ALT) are "
    "typically elevated because of hepatocellular injury."
)
bullet("Causes: viral hepatitis (A-E), alcoholic hepatitis, drug- or toxin-induced liver injury, "
       "autoimmune hepatitis, cirrhosis (including primary biliary cirrhosis), leptospirosis, hepatic "
       "malignancy.")
bullet("Clinical features: fatigue, loss of appetite, nausea, dark urine, pale/clay-coloured stools, "
       "abdominal swelling and, in severe cases, features of liver failure.")
p("Laboratory findings: elevated AST/ALT (hepatocellular pattern), variable rise in conjugated and "
  "unconjugated bilirubin, increased urinary urobilinogen, and bilirubinuria.", size=10.5)

doc.add_heading("3.3 Post-hepatic (Obstructive/Cholestatic) Jaundice", level=2)
p(
    "Results from obstruction to the flow of bile after it has been conjugated and secreted by the "
    "hepatocyte, so conjugated bilirubin regurgitates back into the blood."
)
bullet("Causes: gallstones (choledocholithiasis), carcinoma of the head of the pancreas or ampulla of "
       "Vater, biliary strictures, cholangiocarcinoma, liver flukes (Clonorchis sinensis), extrahepatic "
       "cholestasis.")
bullet("Clinical features: dark urine, pale/clay-coloured (acholic) stools, pruritus (itching from "
       "retained bile salts), steatorrhoea with malabsorption of fat-soluble vitamins, and "
       "hypercholesterolaemia with xanthomas in chronic cases.")
p("Laboratory findings: markedly raised conjugated bilirubin, alkaline phosphatase (ALP) and "
  "gamma-glutamyl transferase (GGT) rise disproportionately more than AST/ALT, bilirubinuria present, and "
  "urobilinogen is reduced or absent from urine and stool in complete obstruction.", size=10.5)

doc.add_heading("3.4 Comparative Summary", level=2)
add_table(
    ["Feature", "Pre-hepatic", "Hepatic", "Post-hepatic"],
    [
        ["Bilirubin type raised", "Unconjugated", "Both (mixed)", "Conjugated"],
        ["AST / ALT", "Normal", "Markedly raised", "Normal / mildly raised"],
        ["ALP / GGT", "Normal", "Mildly raised", "Markedly raised"],
        ["Urine bilirubin", "Absent", "Present", "Present (dark urine)"],
        ["Urine urobilinogen", "Increased", "Increased", "Decreased / absent"],
        ["Stool colour", "Normal / dark", "Pale", "Pale / clay-coloured (acholic)"],
        ["Example cause", "Haemolytic anaemia, G6PD deficiency", "Viral hepatitis, cirrhosis", "Gallstones, pancreatic head carcinoma"],
    ],
    col_widths=[3.2, 3.6, 3.6, 4.6],
)

# =========================================================================
# 4. CONGENITAL HYPERBILIRUBINEMIA
# =========================================================================
doc.add_heading("4. Congenital (Hereditary) Hyperbilirubinemia", level=1)
p(
    "These are inherited disorders of bilirubin metabolism that produce persistent or intermittent "
    "jaundice in the absence of haemolysis or overt liver disease. They are broadly grouped according to "
    "whether the defect affects conjugation (giving unconjugated hyperbilirubinemia - Gilbert syndrome "
    "and Crigler-Najjar syndrome) or hepatic excretion/transport of already-conjugated bilirubin (giving "
    "conjugated hyperbilirubinemia - Dubin-Johnson syndrome and Rotor syndrome). Interestingly, Gilbert "
    "syndrome and Crigler-Najjar syndrome types I and II all result from different mutations of the same "
    "gene, UGT1A1."
)

doc.add_heading("4.1 Gilbert's Syndrome", level=2)
bullet("Inheritance: autosomal dominant (or complex/polygenic); the commonest inherited hyperbilirubinemia, "
       "affecting up to 5-10% of the population; more common and more often symptomatic in males.")
bullet("Defect: mildly reduced activity (not absence) of hepatic UDP-glucuronosyltransferase (UGT1A1), "
       "usually due to a promoter polymorphism, causing decreased conjugation of bilirubin.")
bullet("Bilirubin: mild, fluctuating unconjugated hyperbilirubinemia; serum bilirubin rarely exceeds "
       "5 mg/dL and typically stays below 3 mg/dL.")
bullet("Precipitating factors: fasting/starvation, dehydration, febrile illness, physical stress, and "
       "menstruation may unmask or worsen the jaundice.")
bullet("Clinical course: entirely benign; liver histology and standard liver function tests (AST, ALT, "
       "ALP) are normal; there is no increase in morbidity or mortality, and no long-term treatment is "
       "generally required. Mild cases can respond to low-dose phenobarbital, which induces UGT1A1 "
       "activity.")

doc.add_heading("4.2 Crigler-Najjar Syndrome", level=2)
p("An autosomal recessive disorder caused by mutations in the UGT1A1 gene leading to more severe "
  "impairment of bilirubin conjugation than in Gilbert syndrome. Two clinical subtypes are recognised:")
add_table(
    ["Feature", "Type I", "Type II (Arias syndrome)"],
    [
        ["UGT1A1 activity", "Complete absence", "Severe but partial deficiency"],
        ["Serum bilirubin", "Very high (often >20 mg/dL)", "Lower, fluctuating (usually <20 mg/dL)"],
        ["Onset", "Presents at birth / early infancy", "May present later; milder course"],
        ["Kernicterus risk", "High - often fatal without treatment", "Low"],
        ["Response to phenobarbital", "No response", "Responds (bilirubin can fall significantly)"],
        ["Management", "Phototherapy, plasmapheresis, liver transplantation; gene therapy under trial", "Phenobarbital, phototherapy as needed"],
    ],
    col_widths=[3.5, 5.0, 6.5],
)
p(
    "Type I Crigler-Najjar syndrome is exceptionally rare (about 1 in a million live births) and is "
    "life-threatening: unconjugated bilirubin crosses into the brain and deposits in the basal ganglia, "
    "producing kernicterus (bilirubin encephalopathy) with risk of severe neurological damage or death "
    "if untreated. Because phenobarbital cannot induce an absent enzyme, type I does not respond to it, "
    "unlike type II. Newer approaches such as AAV-mediated UGT1A1 gene therapy have shown promising "
    "reductions in bilirubin levels in early clinical trials.",
    size=10.5,
)

doc.add_heading("4.3 Dubin-Johnson Syndrome", level=2)
bullet("Inheritance: autosomal recessive.")
bullet("Defect: mutation in the canalicular multidrug resistance protein 2 (MRP2/ABCC2) transporter, "
       "which impairs the active secretion of conjugated bilirubin from hepatocytes into bile.")
bullet("Bilirubin: conjugated (direct) hyperbilirubinemia; moderate, chronic or fluctuating jaundice.")
bullet("Clinical features: benign course; the liver may show a characteristic dark ('black liver') "
       "pigmentation on gross/histological examination due to accumulation of a melanin-like pigment; "
       "no treatment is usually required.")

doc.add_heading("4.4 Rotor Syndrome", level=2)
bullet("Inheritance: autosomal recessive, caused by combined deficiency of the hepatic organic anion "
       "transporters OATP1B1 and OATP1B3.")
bullet("Bilirubin: conjugated hyperbilirubinemia, similar to Dubin-Johnson syndrome but generally milder.")
bullet("Distinguishing feature: unlike Dubin-Johnson syndrome, the liver is grossly and histologically "
       "normal (no black pigmentation), and urinary coproporphyrin excretion pattern differs. It is a "
       "benign condition requiring no specific treatment.")

# =========================================================================
# 5. OTHER RELEVANT CONDITIONS
# =========================================================================
doc.add_heading("5. Other Relevant Conditions", level=1)

doc.add_heading("5.1 Neonatal (Physiological) Jaundice and Kernicterus", level=2)
p(
    "Neonatal jaundice is very common in the first week of life because the newborn liver has "
    "transiently low UGT1A1 activity combined with a higher bilirubin load from increased red-cell "
    "turnover. Physiological jaundice is usually mild and resolves within about 10 days. Pathological "
    "jaundice (requiring treatment/investigation) may result from haemolytic disease of the newborn "
    "(Rh or ABO incompatibility), G6PD deficiency, spherocytosis, or breast-milk jaundice (thought to be "
    "due to substances in breast milk that inhibit hepatic conjugation)."
)
p(
    "When unconjugated bilirubin exceeds the binding capacity of plasma albumin, free bilirubin can "
    "cross the immature blood-brain barrier and deposit in the basal ganglia, producing kernicterus - a "
    "serious and potentially fatal bilirubin encephalopathy. Management includes phototherapy (blue "
    "light converts bilirubin to water-soluble photoisomers that can be excreted without conjugation), "
    "and, in severe cases, exchange transfusion. Phenobarbital given to the mother before delivery can "
    "induce fetal UGT1A1 activity.",
    size=10.5,
)

doc.add_heading("5.2 Correlation with Liver Function Tests (LFTs)", level=2)
p(
    "Liver function tests help characterise the pattern and severity of jaundice, although they rarely "
    "give a specific diagnosis on their own. Key excretory/enzyme markers include:"
)
bullet("Serum bilirubin (total, conjugated and unconjugated) - the van den Bergh reaction distinguishes "
       "conjugated from unconjugated fractions.")
bullet("ALT and AST - markers of hepatocellular damage, disproportionately raised in hepatic jaundice.")
bullet("ALP and GGT - markers of cholestasis/biliary obstruction, disproportionately raised in "
       "post-hepatic jaundice.")
bullet("Prothrombin time (PT) and serum albumin - reflect the synthetic function of the liver and help "
       "assess severity/chronicity of hepatic dysfunction.")

# =========================================================================
# 6. CONCLUSION
# =========================================================================
doc.add_heading("6. Conclusion", level=1)
p(
    "Jaundice is a sign, not a disease, and reflects disturbed bilirubin homeostasis at one or more "
    "points along its production, transport, conjugation or excretion pathway. Classifying it as "
    "pre-hepatic, hepatic or post-hepatic, supported by a pattern-based interpretation of liver function "
    "tests, allows a rapid and logical approach to diagnosis. Among the congenital hyperbilirubinemias, "
    "Gilbert syndrome is common and entirely benign, Crigler-Najjar syndrome (especially type I) is rare "
    "but life-threatening, and Dubin-Johnson and Rotor syndromes cause benign conjugated "
    "hyperbilirubinemia due to defective hepatic transport rather than defective conjugation. "
    "Recognising these distinct biochemical mechanisms is essential for correct diagnosis, prognosis and "
    "avoidance of unnecessary investigation or treatment."
)

# =========================================================================
# REFERENCES
# =========================================================================
doc.add_heading("References", level=1)
refs = [
    "Harper's Illustrated Biochemistry, 32nd Edition - Chapter on Bile Pigment Metabolism.",
    "Robbins, Cotran & Kumar - Pathologic Basis of Disease, Section on Hereditary Hyperbilirubinemia.",
    "Goldman-Cecil Medicine, International Edition - Disorders of Bilirubin Metabolism Without Liver Disease.",
    "Yamada's Textbook of Gastroenterology, 7th Edition - Disorders of Bile Salt Conjugation and Transport.",
    "Sleisenger and Fordtran's Gastrointestinal and Liver Disease - Approach to the Patient with an Elevated Bilirubin Level.",
    "Course lecture notes: \"Liver Function Test (LFT)\" and \"Metabolism of Bile\" (Biochemistry course material).",
    "Markovic, A. P. et al. (2021). Jaundice as a Diagnostic and Therapeutic Problem: A General Practitioner's Approach. Digestive Diseases, 40(3), 362-369.",
    "Goluch, Z., Wierzbicka-Rucińska, A., Książek, E. et al. (2024). Nutrition in Gilbert's Syndrome - A Systematic Review of Clinical Trials According to the PRISMA Statement. Nutrients, 16(14), 2247. (Recent systematic review; PMID: 39064690).",
    "Aronson, S. et al. Gene therapy trial for Crigler-Najjar syndrome (AAV8-UGT1A1), published in New England Journal of Medicine, reporting sustained bilirubin reduction with UGT1A1 gene transfer.",
]
for r in refs:
    bp = doc.add_paragraph(style="List Number")
    bp.paragraph_format.space_after = Pt(3)
    run = bp.add_run(r)
    run.font.size = Pt(10)

out_path = "/tmp/workspace/jaundice-assignment/Jaundice_Biochemistry_Assignment.docx"
doc.save(out_path)
print("Saved:", out_path)
Running Command

cd /tmp/workspace/jaundice-assignment && python3 build_docx.py

Running Command

cd /tmp/workspace/jaundice-assignment && python3 -c " from docx import Document doc = Document('Jaundice_Biochemistry_Assignment.docx') words = 0 for p in doc.paragraphs: words += len(p.text.split()) for t in doc.tables: for row in t.rows: for cell in row.cells: words += len(cell.text.split()) print('total words (approx):', words) print('paragraphs:', len(doc.paragraphs)) print('tables:', len(doc.tables)) " ls -la /tmp/workspace/jaundice-assignment/

I've created the biochemistry assignment on Jaundice as a formatted Word document, built directly from your uploaded lecture PDFs ("Liver Function Test" and "Metabolism of Bile") plus authoritative textbooks (Harper's Biochemistry, Robbins Pathology, Goldman-Cecil Medicine, Yamada's Gastroenterology) and a recent PubMed systematic review.

Jaundice Biochemistry Assignment

Word Document · DOCX

Contents (≈1,700 words + 3 comparison tables, structured to run about 4 printed pages):
  1. Introduction — definition of jaundice/icterus and clinical detection threshold
  2. Normal bilirubin metabolism — haem breakdown, conjugation by UGT1A1, enterohepatic urobilinogen cycle (sets up the mechanism for everything after)
  3. Classification of jaundice
    • Pre-hepatic (haemolytic) — intra/extracorpuscular causes, lab pattern
    • Hepatic (hepatocellular) — viral hepatitis, cirrhosis, drug injury, lab pattern
    • Post-hepatic (obstructive) — gallstones, pancreatic head carcinoma, cholestatic pattern
    • Comparative summary table (bilirubin type, AST/ALT, ALP/GGT, urine/stool findings)
  4. Congenital hyperbilirubinemia — overview linking Gilbert's and Crigler-Najjar (UGT1A1 defects, unconjugated) vs Dubin-Johnson/Rotor (transport defects, conjugated)
    • Gilbert's syndrome — autosomal dominant, mild UGT1A1 deficiency, benign course
    • Crigler-Najjar syndrome — type I vs type II comparison table (enzyme activity, bilirubin levels, kernicterus risk, phenobarbital response, gene therapy note)
    • Dubin-Johnson syndrome — MRP2 defect, black liver pigmentation
    • Rotor syndrome — OATP1B1/1B3 defect, distinguishing features from Dubin-Johnson
  5. Other relevant conditions — neonatal jaundice, kernicterus, and LFT correlation (bilirubin fractions, ALT/AST vs ALP/GGT patterns, PT/albumin)
  6. Conclusion and a numbered reference list citing all sources used
All four required topics (pre-hepatic/hepatic/post-hepatic jaundice, congenital hyperbilirubinemia, Gilbert's syndrome, Crigler-Najjar syndrome) are covered in depth, plus Dubin-Johnson, Rotor syndrome, and neonatal jaundice as supplementary conditions. A quick check of recent literature (PMID 39064690, a 2024 systematic review on nutrition in Gilbert's syndrome) confirmed no contradictions to the standard textbook description used here.
If you'd like, I can adjust formatting (e.g., add a name/roll number field, change font, or trim/expand to hit an exact page count once you print it).

Bro I don’t want any tables in the docs I have to write by my hand

Reading File
I'll rewrite the document without any tables, converting all table content into bullet points and clear paragraphs instead.
Writing File

~/jaundice-assignment/build_docx.py

#!/usr/bin/env python3
"""Build the Jaundice biochemistry assignment as a .docx file (no tables - handwriting-friendly)."""

from docx import Document
from docx.shared import Pt, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
from docx.oxml import OxmlElement

doc = Document()

# ---------- Page setup (A4) ----------
section = doc.sections[0]
section.page_height = Cm(29.7)
section.page_width = Cm(21.0)
section.top_margin = Cm(1.8)
section.bottom_margin = Cm(1.8)
section.left_margin = Cm(2.0)
section.right_margin = Cm(2.0)

# ---------- Base style ----------
normal = doc.styles["Normal"]
normal.font.name = "Calibri"
normal.font.size = Pt(11)
normal.paragraph_format.space_after = Pt(4)
normal.paragraph_format.line_spacing = 1.1

NAVY = RGBColor(0x1F, 0x3A, 0x5F)
MAROON = RGBColor(0x7A, 0x1F, 0x2B)

h1 = doc.styles["Heading 1"]
h1.font.name = "Calibri"
h1.font.size = Pt(15)
h1.font.color.rgb = NAVY
h1.font.bold = True
h1.paragraph_format.space_before = Pt(10)
h1.paragraph_format.space_after = Pt(4)

h2 = doc.styles["Heading 2"]
h2.font.name = "Calibri"
h2.font.size = Pt(12.5)
h2.font.color.rgb = MAROON
h2.font.bold = True
h2.paragraph_format.space_before = Pt(6)
h2.paragraph_format.space_after = Pt(2)


def add_footer_page_number():
    footer = section.footer
    para = footer.paragraphs[0]
    para.alignment = WD_ALIGN_PARAGRAPH.CENTER
    run = para.add_run()
    fld_begin = OxmlElement('w:fldChar')
    fld_begin.set(qn('w:fldCharType'), 'begin')
    instr = OxmlElement('w:instrText')
    instr.text = "PAGE"
    fld_end = OxmlElement('w:fldChar')
    fld_end.set(qn('w:fldCharType'), 'end')
    run._r.append(fld_begin)
    run._r.append(instr)
    run._r.append(fld_end)


add_footer_page_number()


def p(text, bold=False, italic=False, size=11, space_after=4, align=None, color=None):
    para = doc.add_paragraph()
    para.paragraph_format.space_after = Pt(space_after)
    if align:
        para.alignment = align
    run = para.add_run(text)
    run.bold = bold
    run.italic = italic
    run.font.size = Pt(size)
    if color:
        run.font.color.rgb = color
    return para


def bullet(text, bold_lead=None, level=0):
    style = "List Bullet" if level == 0 else "List Bullet 2"
    para = doc.add_paragraph(style=style)
    para.paragraph_format.space_after = Pt(2)
    if bold_lead:
        r = para.add_run(bold_lead)
        r.bold = True
        para.add_run(text)
    else:
        para.add_run(text)
    return para


# =========================================================================
# TITLE BLOCK
# =========================================================================
title_p = doc.add_paragraph()
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
title_run = title_p.add_run("JAUNDICE")
title_run.bold = True
title_run.font.size = Pt(24)
title_run.font.color.rgb = NAVY

subtitle_p = doc.add_paragraph()
subtitle_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
subtitle_run = subtitle_p.add_run(
    "Classification, Biochemical Basis and Congenital Hyperbilirubinemias"
)
subtitle_run.italic = True
subtitle_run.font.size = Pt(12.5)
subtitle_run.font.color.rgb = MAROON
subtitle_p.paragraph_format.space_after = Pt(4)

info_p = doc.add_paragraph()
info_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = info_p.add_run("Subject: Biochemistry   |   Topic: Jaundice")
run.font.size = Pt(10)
run.italic = True
info_p.paragraph_format.space_after = Pt(10)

# =========================================================================
# 1. INTRODUCTION
# =========================================================================
doc.add_heading("1. Introduction", level=1)
p(
    "Jaundice, also called icterus, is the yellowish discolouration of the skin, sclera and mucous "
    "membranes caused by the deposition of bilirubin in tissues secondary to a raised serum bilirubin "
    "level (hyperbilirubinemia). It is not a disease by itself but a clinical sign of an underlying "
    "disturbance in bilirubin production, transport, conjugation or excretion. Jaundice becomes clinically "
    "detectable when serum bilirubin exceeds about 2-2.5 mg/dL, roughly twice the upper limit of the normal "
    "value (0.2-1.0 mg/dL)."
)

# =========================================================================
# 2. BILIRUBIN METABOLISM (brief foundation)
# =========================================================================
doc.add_heading("2. Normal Bilirubin Metabolism", level=1)
p(
    "Bilirubin is the end product of haem catabolism. About 70-80% is derived from the haemoglobin of "
    "senescent red blood cells destroyed by the reticuloendothelial system (spleen, liver, bone marrow), "
    "and the remainder from myoglobin, cytochromes and ineffective erythropoiesis."
)
bullet("Haem is oxidised by haem oxygenase to biliverdin (releasing Fe3+ and CO), which is then reduced by "
       "biliverdin reductase to unconjugated (indirect) bilirubin.")
bullet("Unconjugated bilirubin is water-insoluble and is transported in plasma bound to albumin to the "
       "liver.")
bullet("Hepatocytes take up bilirubin (assisted by the carrier protein ligandin) and conjugate it in the "
       "smooth endoplasmic reticulum with glucuronic acid, catalysed by UDP-glucuronosyltransferase "
       "(UGT1A1), forming water-soluble bilirubin diglucuronide (conjugated/direct bilirubin).")
bullet("Conjugated bilirubin is actively secreted into bile canaliculi (via the MRP2 transporter) and "
       "passes into the intestine, where gut bacteria convert it to urobilinogen. Most urobilinogen is "
       "oxidised to stercobilin and excreted in faeces (giving stool its brown colour); a small fraction "
       "is reabsorbed into the portal blood (enterohepatic urobilinogen cycle), and part of this is "
       "excreted by the kidney as urobilin, giving urine its normal colour.")

# =========================================================================
# 3. CLASSIFICATION OF JAUNDICE
# =========================================================================
doc.add_heading("3. Classification of Jaundice", level=1)
p(
    "Depending on the site of the defect along the bilirubin pathway, jaundice is classified into three "
    "major types: pre-hepatic, hepatic and post-hepatic."
)

doc.add_heading("3.1 Pre-hepatic (Haemolytic) Jaundice", level=2)
p(
    "The excretory capacity of the liver itself is normal; jaundice results from excessive production of "
    "bilirubin that exceeds the liver's conjugating ability, so unconjugated bilirubin accumulates in "
    "blood. It is most often caused by excessive red-cell destruction (haemolysis)."
)
bullet("Intracorpuscular (intrinsic) defects: hereditary spherocytosis (membrane defect), "
       "haemoglobinopathies (sickle cell disease, thalassemia), glucose-6-phosphate dehydrogenase "
       "(G6PD) deficiency.")
bullet("Extracorpuscular (extrinsic) causes: mismatched blood transfusion / ABO incompatibility, malaria "
       "and other infections, drugs (sulpha drugs, anti-malarials), toxins and snake venom.")
bullet("Laboratory findings: raised unconjugated (indirect) bilirubin, normal liver enzymes, increased "
       "urinary and faecal urobilinogen, absent bilirubin in urine (acholuric jaundice), and evidence of "
       "haemolysis (raised reticulocyte count, raised LDH, low haptoglobin).")

doc.add_heading("3.2 Hepatic (Hepatocellular) Jaundice", level=2)
p(
    "Arises from disease of the hepatocytes themselves, impairing uptake, conjugation and/or secretion of "
    "bilirubin. Both unconjugated and conjugated bilirubin may rise, and liver enzymes (AST, ALT) are "
    "typically elevated because of hepatocellular injury."
)
bullet("Causes: viral hepatitis (A-E), alcoholic hepatitis, drug- or toxin-induced liver injury, "
       "autoimmune hepatitis, cirrhosis (including primary biliary cirrhosis), leptospirosis, hepatic "
       "malignancy.")
bullet("Clinical features: fatigue, loss of appetite, nausea, dark urine, pale/clay-coloured stools, "
       "abdominal swelling and, in severe cases, features of liver failure.")
bullet("Laboratory findings: elevated AST/ALT (hepatocellular pattern), variable rise in conjugated and "
       "unconjugated bilirubin, increased urinary urobilinogen, and bilirubinuria.")

doc.add_heading("3.3 Post-hepatic (Obstructive/Cholestatic) Jaundice", level=2)
p(
    "Results from obstruction to the flow of bile after it has been conjugated and secreted by the "
    "hepatocyte, so conjugated bilirubin regurgitates back into the blood."
)
bullet("Causes: gallstones (choledocholithiasis), carcinoma of the head of the pancreas or ampulla of "
       "Vater, biliary strictures, cholangiocarcinoma, liver flukes (Clonorchis sinensis), extrahepatic "
       "cholestasis.")
bullet("Clinical features: dark urine, pale/clay-coloured (acholic) stools, pruritus (itching from "
       "retained bile salts), steatorrhoea with malabsorption of fat-soluble vitamins, and "
       "hypercholesterolaemia with xanthomas in chronic cases.")
bullet("Laboratory findings: markedly raised conjugated bilirubin; alkaline phosphatase (ALP) and "
       "gamma-glutamyl transferase (GGT) rise disproportionately more than AST/ALT; bilirubinuria is "
       "present; urobilinogen is reduced or absent from urine and stool in complete obstruction.")

doc.add_heading("3.4 Quick Comparison (for revision)", level=2)
p(
    "Pre-hepatic jaundice: unconjugated bilirubin raised, liver enzymes normal, urine bilirubin absent, "
    "urine urobilinogen increased, stool colour normal - caused mainly by haemolysis."
)
p(
    "Hepatic jaundice: both bilirubin fractions raised, AST/ALT markedly raised, urine bilirubin present, "
    "stool pale - caused mainly by hepatocellular disease such as hepatitis or cirrhosis."
)
p(
    "Post-hepatic jaundice: conjugated bilirubin raised, ALP/GGT markedly raised (AST/ALT near normal), "
    "urine bilirubin present (dark urine), stool pale/acholic, urobilinogen decreased or absent - caused "
    "mainly by biliary obstruction such as gallstones or pancreatic head carcinoma."
)

# =========================================================================
# 4. CONGENITAL HYPERBILIRUBINEMIA
# =========================================================================
doc.add_heading("4. Congenital (Hereditary) Hyperbilirubinemia", level=1)
p(
    "These are inherited disorders of bilirubin metabolism that produce persistent or intermittent "
    "jaundice in the absence of haemolysis or overt liver disease. They are broadly grouped according to "
    "whether the defect affects conjugation (giving unconjugated hyperbilirubinemia - Gilbert syndrome "
    "and Crigler-Najjar syndrome) or hepatic excretion/transport of already-conjugated bilirubin (giving "
    "conjugated hyperbilirubinemia - Dubin-Johnson syndrome and Rotor syndrome). Interestingly, Gilbert "
    "syndrome and Crigler-Najjar syndrome types I and II all result from different mutations of the same "
    "gene, UGT1A1."
)

doc.add_heading("4.1 Gilbert's Syndrome", level=2)
bullet("Inheritance: autosomal dominant (complex/polygenic pattern); the commonest inherited "
       "hyperbilirubinemia, affecting up to 5-10% of the population; more common and more often "
       "symptomatic in males.")
bullet("Defect: mildly reduced activity (not absence) of hepatic UDP-glucuronosyltransferase (UGT1A1), "
       "usually due to a promoter polymorphism, causing decreased conjugation of bilirubin.")
bullet("Bilirubin: mild, fluctuating unconjugated hyperbilirubinemia; serum bilirubin rarely exceeds "
       "5 mg/dL and typically stays below 3 mg/dL.")
bullet("Precipitating factors: fasting/starvation, dehydration, febrile illness, physical stress, and "
       "menstruation may unmask or worsen the jaundice.")
bullet("Clinical course: entirely benign; liver histology and standard liver function tests (AST, ALT, "
       "ALP) are normal; there is no increase in morbidity or mortality, and no long-term treatment is "
       "generally required. Mild cases can respond to low-dose phenobarbital, which induces UGT1A1 "
       "activity.")

doc.add_heading("4.2 Crigler-Najjar Syndrome", level=2)
p(
    "An autosomal recessive disorder caused by mutations in the UGT1A1 gene, leading to more severe "
    "impairment of bilirubin conjugation than in Gilbert syndrome. Two clinical subtypes are recognised."
)
bullet("Type I is the severe form: UGT1A1 activity is completely absent. Serum bilirubin is very high "
       "(often above 20 mg/dL) and presents at birth or in early infancy. It does not respond to "
       "phenobarbital because there is no enzyme left to induce. Untreated, it carries a high risk of "
       "kernicterus and is often fatal. Management options include intensive phototherapy, "
       "plasmapheresis, and ultimately liver transplantation; AAV-mediated UGT1A1 gene therapy is being "
       "trialled with promising early reductions in bilirubin.")
bullet("Type II (Arias syndrome) is the milder form: UGT1A1 activity is severely reduced but not absent. "
       "Serum bilirubin is lower and fluctuates, usually staying under 20 mg/dL. Because levels are "
       "lower, kernicterus is rare. Type II does respond to phenobarbital, which can substantially lower "
       "bilirubin, and this response is itself used to help distinguish it from type I.")

doc.add_heading("4.3 Dubin-Johnson Syndrome", level=2)
bullet("Inheritance: autosomal recessive.")
bullet("Defect: mutation in the canalicular multidrug resistance protein 2 (MRP2/ABCC2) transporter, "
       "which impairs the active secretion of conjugated bilirubin from hepatocytes into bile.")
bullet("Bilirubin: conjugated (direct) hyperbilirubinemia; moderate, chronic or fluctuating jaundice.")
bullet("Clinical features: benign course; the liver may show a characteristic dark ('black liver') "
       "pigmentation on gross/histological examination due to accumulation of a melanin-like pigment; "
       "no treatment is usually required.")

doc.add_heading("4.4 Rotor Syndrome", level=2)
bullet("Inheritance: autosomal recessive, caused by combined deficiency of the hepatic organic anion "
       "transporters OATP1B1 and OATP1B3.")
bullet("Bilirubin: conjugated hyperbilirubinemia, similar to Dubin-Johnson syndrome but generally milder.")
bullet("Distinguishing feature: unlike Dubin-Johnson syndrome, the liver is grossly and histologically "
       "normal (no black pigmentation), and the urinary coproporphyrin excretion pattern differs. It is "
       "a benign condition requiring no specific treatment.")

# =========================================================================
# 5. OTHER RELEVANT CONDITIONS
# =========================================================================
doc.add_heading("5. Other Relevant Conditions", level=1)

doc.add_heading("5.1 Neonatal (Physiological) Jaundice and Kernicterus", level=2)
p(
    "Neonatal jaundice is very common in the first week of life because the newborn liver has "
    "transiently low UGT1A1 activity combined with a higher bilirubin load from increased red-cell "
    "turnover. Physiological jaundice is usually mild and resolves within about 10 days. Pathological "
    "jaundice (requiring treatment/investigation) may result from haemolytic disease of the newborn "
    "(Rh or ABO incompatibility), G6PD deficiency, spherocytosis, or breast-milk jaundice (thought to be "
    "due to substances in breast milk that inhibit hepatic conjugation)."
)
p(
    "When unconjugated bilirubin exceeds the binding capacity of plasma albumin, free bilirubin can "
    "cross the immature blood-brain barrier and deposit in the basal ganglia, producing kernicterus - a "
    "serious and potentially fatal bilirubin encephalopathy. Management includes phototherapy (blue "
    "light converts bilirubin to water-soluble photoisomers that can be excreted without conjugation), "
    "and, in severe cases, exchange transfusion. Phenobarbital given to the mother before delivery can "
    "induce fetal UGT1A1 activity."
)

doc.add_heading("5.2 Correlation with Liver Function Tests (LFTs)", level=2)
p(
    "Liver function tests help characterise the pattern and severity of jaundice, although they rarely "
    "give a specific diagnosis on their own. Key markers include:"
)
bullet("Serum bilirubin (total, conjugated and unconjugated) - the van den Bergh reaction distinguishes "
       "conjugated from unconjugated fractions.")
bullet("ALT and AST - markers of hepatocellular damage, disproportionately raised in hepatic jaundice.")
bullet("ALP and GGT - markers of cholestasis/biliary obstruction, disproportionately raised in "
       "post-hepatic jaundice.")
bullet("Prothrombin time (PT) and serum albumin - reflect the synthetic function of the liver and help "
       "assess severity/chronicity of hepatic dysfunction.")

# =========================================================================
# 6. CONCLUSION
# =========================================================================
doc.add_heading("6. Conclusion", level=1)
p(
    "Jaundice is a sign, not a disease, and reflects disturbed bilirubin homeostasis at one or more "
    "points along its production, transport, conjugation or excretion pathway. Classifying it as "
    "pre-hepatic, hepatic or post-hepatic, supported by a pattern-based interpretation of liver function "
    "tests, allows a rapid and logical approach to diagnosis. Among the congenital hyperbilirubinemias, "
    "Gilbert syndrome is common and entirely benign, Crigler-Najjar syndrome (especially type I) is rare "
    "but life-threatening, and Dubin-Johnson and Rotor syndromes cause benign conjugated "
    "hyperbilirubinemia due to defective hepatic transport rather than defective conjugation. "
    "Recognising these distinct biochemical mechanisms is essential for correct diagnosis, prognosis and "
    "avoidance of unnecessary investigation or treatment."
)

# =========================================================================
# REFERENCES
# =========================================================================
doc.add_heading("References", level=1)
refs = [
    "Harper's Illustrated Biochemistry, 32nd Edition - Chapter on Bile Pigment Metabolism.",
    "Robbins, Cotran & Kumar - Pathologic Basis of Disease, Section on Hereditary Hyperbilirubinemia.",
    "Goldman-Cecil Medicine, International Edition - Disorders of Bilirubin Metabolism Without Liver Disease.",
    "Yamada's Textbook of Gastroenterology, 7th Edition - Disorders of Bile Salt Conjugation and Transport.",
    "Sleisenger and Fordtran's Gastrointestinal and Liver Disease - Approach to the Patient with an Elevated Bilirubin Level.",
    "Course lecture notes: \"Liver Function Test (LFT)\" and \"Metabolism of Bile\" (Biochemistry course material).",
    "Markovic, A. P. et al. (2021). Jaundice as a Diagnostic and Therapeutic Problem: A General Practitioner's Approach. Digestive Diseases, 40(3), 362-369.",
    "Goluch, Z., Wierzbicka-Rucińska, A., Książek, E. et al. (2024). Nutrition in Gilbert's Syndrome - A Systematic Review of Clinical Trials According to the PRISMA Statement. Nutrients, 16(14), 2247. (Recent systematic review; PMID: 39064690).",
    "Gene therapy trial for Crigler-Najjar syndrome (AAV8-UGT1A1), published in New England Journal of Medicine, reporting sustained bilirubin reduction with UGT1A1 gene transfer.",
]
for r in refs:
    bp = doc.add_paragraph(style="List Number")
    bp.paragraph_format.space_after = Pt(3)
    run = bp.add_run(r)
    run.font.size = Pt(10)

out_path = "/tmp/workspace/jaundice-assignment/Jaundice_Biochemistry_Assignment.docx"
doc.save(out_path)
print("Saved:", out_path)
I need to use edit_file instead since the file exists. Let me overwrite it via execute (rm then write), which is simpler.
Running Command

rm /tmp/workspace/jaundice-assignment/build_docx.py

Writing File

~/jaundice-assignment/build_docx.py

#!/usr/bin/env python3
"""Build the Jaundice biochemistry assignment as a .docx file (no tables - handwriting-friendly)."""

from docx import Document
from docx.shared import Pt, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
from docx.oxml import OxmlElement

doc = Document()

# ---------- Page setup (A4) ----------
section = doc.sections[0]
section.page_height = Cm(29.7)
section.page_width = Cm(21.0)
section.top_margin = Cm(1.8)
section.bottom_margin = Cm(1.8)
section.left_margin = Cm(2.0)
section.right_margin = Cm(2.0)

# ---------- Base style ----------
normal = doc.styles["Normal"]
normal.font.name = "Calibri"
normal.font.size = Pt(11)
normal.paragraph_format.space_after = Pt(4)
normal.paragraph_format.line_spacing = 1.1

NAVY = RGBColor(0x1F, 0x3A, 0x5F)
MAROON = RGBColor(0x7A, 0x1F, 0x2B)

h1 = doc.styles["Heading 1"]
h1.font.name = "Calibri"
h1.font.size = Pt(15)
h1.font.color.rgb = NAVY
h1.font.bold = True
h1.paragraph_format.space_before = Pt(10)
h1.paragraph_format.space_after = Pt(4)

h2 = doc.styles["Heading 2"]
h2.font.name = "Calibri"
h2.font.size = Pt(12.5)
h2.font.color.rgb = MAROON
h2.font.bold = True
h2.paragraph_format.space_before = Pt(6)
h2.paragraph_format.space_after = Pt(2)


def add_footer_page_number():
    footer = section.footer
    para = footer.paragraphs[0]
    para.alignment = WD_ALIGN_PARAGRAPH.CENTER
    run = para.add_run()
    fld_begin = OxmlElement('w:fldChar')
    fld_begin.set(qn('w:fldCharType'), 'begin')
    instr = OxmlElement('w:instrText')
    instr.text = "PAGE"
    fld_end = OxmlElement('w:fldChar')
    fld_end.set(qn('w:fldCharType'), 'end')
    run._r.append(fld_begin)
    run._r.append(instr)
    run._r.append(fld_end)


add_footer_page_number()


def p(text, bold=False, italic=False, size=11, space_after=4, align=None, color=None):
    para = doc.add_paragraph()
    para.paragraph_format.space_after = Pt(space_after)
    if align:
        para.alignment = align
    run = para.add_run(text)
    run.bold = bold
    run.italic = italic
    run.font.size = Pt(size)
    if color:
        run.font.color.rgb = color
    return para


def bullet(text, bold_lead=None, level=0):
    style = "List Bullet" if level == 0 else "List Bullet 2"
    para = doc.add_paragraph(style=style)
    para.paragraph_format.space_after = Pt(2)
    if bold_lead:
        r = para.add_run(bold_lead)
        r.bold = True
        para.add_run(text)
    else:
        para.add_run(text)
    return para


# =========================================================================
# TITLE BLOCK
# =========================================================================
title_p = doc.add_paragraph()
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
title_run = title_p.add_run("JAUNDICE")
title_run.bold = True
title_run.font.size = Pt(24)
title_run.font.color.rgb = NAVY

subtitle_p = doc.add_paragraph()
subtitle_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
subtitle_run = subtitle_p.add_run(
    "Classification, Biochemical Basis and Congenital Hyperbilirubinemias"
)
subtitle_run.italic = True
subtitle_run.font.size = Pt(12.5)
subtitle_run.font.color.rgb = MAROON
subtitle_p.paragraph_format.space_after = Pt(4)

info_p = doc.add_paragraph()
info_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = info_p.add_run("Subject: Biochemistry   |   Topic: Jaundice")
run.font.size = Pt(10)
run.italic = True
info_p.paragraph_format.space_after = Pt(10)

# =========================================================================
# 1. INTRODUCTION
# =========================================================================
doc.add_heading("1. Introduction", level=1)
p(
    "Jaundice, also called icterus, is the yellowish discolouration of the skin, sclera and mucous "
    "membranes caused by the deposition of bilirubin in tissues secondary to a raised serum bilirubin "
    "level (hyperbilirubinemia). It is not a disease by itself but a clinical sign of an underlying "
    "disturbance in bilirubin production, transport, conjugation or excretion. Jaundice becomes clinically "
    "detectable when serum bilirubin exceeds about 2-2.5 mg/dL, roughly twice the upper limit of the normal "
    "value (0.2-1.0 mg/dL)."
)

# =========================================================================
# 2. BILIRUBIN METABOLISM (brief foundation)
# =========================================================================
doc.add_heading("2. Normal Bilirubin Metabolism", level=1)
p(
    "Bilirubin is the end product of haem catabolism. About 70-80% is derived from the haemoglobin of "
    "senescent red blood cells destroyed by the reticuloendothelial system (spleen, liver, bone marrow), "
    "and the remainder from myoglobin, cytochromes and ineffective erythropoiesis."
)
bullet("Haem is oxidised by haem oxygenase to biliverdin (releasing Fe3+ and CO), which is then reduced by "
       "biliverdin reductase to unconjugated (indirect) bilirubin.")
bullet("Unconjugated bilirubin is water-insoluble and is transported in plasma bound to albumin to the "
       "liver.")
bullet("Hepatocytes take up bilirubin (assisted by the carrier protein ligandin) and conjugate it in the "
       "smooth endoplasmic reticulum with glucuronic acid, catalysed by UDP-glucuronosyltransferase "
       "(UGT1A1), forming water-soluble bilirubin diglucuronide (conjugated/direct bilirubin).")
bullet("Conjugated bilirubin is actively secreted into bile canaliculi (via the MRP2 transporter) and "
       "passes into the intestine, where gut bacteria convert it to urobilinogen. Most urobilinogen is "
       "oxidised to stercobilin and excreted in faeces (giving stool its brown colour); a small fraction "
       "is reabsorbed into the portal blood (enterohepatic urobilinogen cycle), and part of this is "
       "excreted by the kidney as urobilin, giving urine its normal colour.")

# =========================================================================
# 3. CLASSIFICATION OF JAUNDICE
# =========================================================================
doc.add_heading("3. Classification of Jaundice", level=1)
p(
    "Depending on the site of the defect along the bilirubin pathway, jaundice is classified into three "
    "major types: pre-hepatic, hepatic and post-hepatic."
)

doc.add_heading("3.1 Pre-hepatic (Haemolytic) Jaundice", level=2)
p(
    "The excretory capacity of the liver itself is normal; jaundice results from excessive production of "
    "bilirubin that exceeds the liver's conjugating ability, so unconjugated bilirubin accumulates in "
    "blood. It is most often caused by excessive red-cell destruction (haemolysis)."
)
bullet("Intracorpuscular (intrinsic) defects: hereditary spherocytosis (membrane defect), "
       "haemoglobinopathies (sickle cell disease, thalassemia), glucose-6-phosphate dehydrogenase "
       "(G6PD) deficiency.")
bullet("Extracorpuscular (extrinsic) causes: mismatched blood transfusion / ABO incompatibility, malaria "
       "and other infections, drugs (sulpha drugs, anti-malarials), toxins and snake venom.")
bullet("Laboratory findings: raised unconjugated (indirect) bilirubin, normal liver enzymes, increased "
       "urinary and faecal urobilinogen, absent bilirubin in urine (acholuric jaundice), and evidence of "
       "haemolysis (raised reticulocyte count, raised LDH, low haptoglobin).")

doc.add_heading("3.2 Hepatic (Hepatocellular) Jaundice", level=2)
p(
    "Arises from disease of the hepatocytes themselves, impairing uptake, conjugation and/or secretion of "
    "bilirubin. Both unconjugated and conjugated bilirubin may rise, and liver enzymes (AST, ALT) are "
    "typically elevated because of hepatocellular injury."
)
bullet("Causes: viral hepatitis (A-E), alcoholic hepatitis, drug- or toxin-induced liver injury, "
       "autoimmune hepatitis, cirrhosis (including primary biliary cirrhosis), leptospirosis, hepatic "
       "malignancy.")
bullet("Clinical features: fatigue, loss of appetite, nausea, dark urine, pale/clay-coloured stools, "
       "abdominal swelling and, in severe cases, features of liver failure.")
bullet("Laboratory findings: elevated AST/ALT (hepatocellular pattern), variable rise in conjugated and "
       "unconjugated bilirubin, increased urinary urobilinogen, and bilirubinuria.")

doc.add_heading("3.3 Post-hepatic (Obstructive/Cholestatic) Jaundice", level=2)
p(
    "Results from obstruction to the flow of bile after it has been conjugated and secreted by the "
    "hepatocyte, so conjugated bilirubin regurgitates back into the blood."
)
bullet("Causes: gallstones (choledocholithiasis), carcinoma of the head of the pancreas or ampulla of "
       "Vater, biliary strictures, cholangiocarcinoma, liver flukes (Clonorchis sinensis), extrahepatic "
       "cholestasis.")
bullet("Clinical features: dark urine, pale/clay-coloured (acholic) stools, pruritus (itching from "
       "retained bile salts), steatorrhoea with malabsorption of fat-soluble vitamins, and "
       "hypercholesterolaemia with xanthomas in chronic cases.")
bullet("Laboratory findings: markedly raised conjugated bilirubin; alkaline phosphatase (ALP) and "
       "gamma-glutamyl transferase (GGT) rise disproportionately more than AST/ALT; bilirubinuria is "
       "present; urobilinogen is reduced or absent from urine and stool in complete obstruction.")

doc.add_heading("3.4 Quick Comparison (for revision)", level=2)
p(
    "Pre-hepatic jaundice: unconjugated bilirubin raised, liver enzymes normal, urine bilirubin absent, "
    "urine urobilinogen increased, stool colour normal - caused mainly by haemolysis."
)
p(
    "Hepatic jaundice: both bilirubin fractions raised, AST/ALT markedly raised, urine bilirubin present, "
    "stool pale - caused mainly by hepatocellular disease such as hepatitis or cirrhosis."
)
p(
    "Post-hepatic jaundice: conjugated bilirubin raised, ALP/GGT markedly raised (AST/ALT near normal), "
    "urine bilirubin present (dark urine), stool pale/acholic, urobilinogen decreased or absent - caused "
    "mainly by biliary obstruction such as gallstones or pancreatic head carcinoma."
)

# =========================================================================
# 4. CONGENITAL HYPERBILIRUBINEMIA
# =========================================================================
doc.add_heading("4. Congenital (Hereditary) Hyperbilirubinemia", level=1)
p(
    "These are inherited disorders of bilirubin metabolism that produce persistent or intermittent "
    "jaundice in the absence of haemolysis or overt liver disease. They are broadly grouped according to "
    "whether the defect affects conjugation (giving unconjugated hyperbilirubinemia - Gilbert syndrome "
    "and Crigler-Najjar syndrome) or hepatic excretion/transport of already-conjugated bilirubin (giving "
    "conjugated hyperbilirubinemia - Dubin-Johnson syndrome and Rotor syndrome). Interestingly, Gilbert "
    "syndrome and Crigler-Najjar syndrome types I and II all result from different mutations of the same "
    "gene, UGT1A1."
)

doc.add_heading("4.1 Gilbert's Syndrome", level=2)
bullet("Inheritance: autosomal dominant (complex/polygenic pattern); the commonest inherited "
       "hyperbilirubinemia, affecting up to 5-10% of the population; more common and more often "
       "symptomatic in males.")
bullet("Defect: mildly reduced activity (not absence) of hepatic UDP-glucuronosyltransferase (UGT1A1), "
       "usually due to a promoter polymorphism, causing decreased conjugation of bilirubin.")
bullet("Bilirubin: mild, fluctuating unconjugated hyperbilirubinemia; serum bilirubin rarely exceeds "
       "5 mg/dL and typically stays below 3 mg/dL.")
bullet("Precipitating factors: fasting/starvation, dehydration, febrile illness, physical stress, and "
       "menstruation may unmask or worsen the jaundice.")
bullet("Clinical course: entirely benign; liver histology and standard liver function tests (AST, ALT, "
       "ALP) are normal; there is no increase in morbidity or mortality, and no long-term treatment is "
       "generally required. Mild cases can respond to low-dose phenobarbital, which induces UGT1A1 "
       "activity.")

doc.add_heading("4.2 Crigler-Najjar Syndrome", level=2)
p(
    "An autosomal recessive disorder caused by mutations in the UGT1A1 gene, leading to more severe "
    "impairment of bilirubin conjugation than in Gilbert syndrome. Two clinical subtypes are recognised."
)
bullet("Type I is the severe form: UGT1A1 activity is completely absent. Serum bilirubin is very high "
       "(often above 20 mg/dL) and presents at birth or in early infancy. It does not respond to "
       "phenobarbital because there is no enzyme left to induce. Untreated, it carries a high risk of "
       "kernicterus and is often fatal. Management options include intensive phototherapy, "
       "plasmapheresis, and ultimately liver transplantation; AAV-mediated UGT1A1 gene therapy is being "
       "trialled with promising early reductions in bilirubin.")
bullet("Type II (Arias syndrome) is the milder form: UGT1A1 activity is severely reduced but not absent. "
       "Serum bilirubin is lower and fluctuates, usually staying under 20 mg/dL. Because levels are "
       "lower, kernicterus is rare. Type II does respond to phenobarbital, which can substantially lower "
       "bilirubin, and this response is itself used to help distinguish it from type I.")

doc.add_heading("4.3 Dubin-Johnson Syndrome", level=2)
bullet("Inheritance: autosomal recessive.")
bullet("Defect: mutation in the canalicular multidrug resistance protein 2 (MRP2/ABCC2) transporter, "
       "which impairs the active secretion of conjugated bilirubin from hepatocytes into bile.")
bullet("Bilirubin: conjugated (direct) hyperbilirubinemia; moderate, chronic or fluctuating jaundice.")
bullet("Clinical features: benign course; the liver may show a characteristic dark ('black liver') "
       "pigmentation on gross/histological examination due to accumulation of a melanin-like pigment; "
       "no treatment is usually required.")

doc.add_heading("4.4 Rotor Syndrome", level=2)
bullet("Inheritance: autosomal recessive, caused by combined deficiency of the hepatic organic anion "
       "transporters OATP1B1 and OATP1B3.")
bullet("Bilirubin: conjugated hyperbilirubinemia, similar to Dubin-Johnson syndrome but generally milder.")
bullet("Distinguishing feature: unlike Dubin-Johnson syndrome, the liver is grossly and histologically "
       "normal (no black pigmentation), and the urinary coproporphyrin excretion pattern differs. It is "
       "a benign condition requiring no specific treatment.")

# =========================================================================
# 5. OTHER RELEVANT CONDITIONS
# =========================================================================
doc.add_heading("5. Other Relevant Conditions", level=1)

doc.add_heading("5.1 Neonatal (Physiological) Jaundice and Kernicterus", level=2)
p(
    "Neonatal jaundice is very common in the first week of life because the newborn liver has "
    "transiently low UGT1A1 activity combined with a higher bilirubin load from increased red-cell "
    "turnover. Physiological jaundice is usually mild and resolves within about 10 days. Pathological "
    "jaundice (requiring treatment/investigation) may result from haemolytic disease of the newborn "
    "(Rh or ABO incompatibility), G6PD deficiency, spherocytosis, or breast-milk jaundice (thought to be "
    "due to substances in breast milk that inhibit hepatic conjugation)."
)
p(
    "When unconjugated bilirubin exceeds the binding capacity of plasma albumin, free bilirubin can "
    "cross the immature blood-brain barrier and deposit in the basal ganglia, producing kernicterus - a "
    "serious and potentially fatal bilirubin encephalopathy. Management includes phototherapy (blue "
    "light converts bilirubin to water-soluble photoisomers that can be excreted without conjugation), "
    "and, in severe cases, exchange transfusion. Phenobarbital given to the mother before delivery can "
    "induce fetal UGT1A1 activity."
)

doc.add_heading("5.2 Correlation with Liver Function Tests (LFTs)", level=2)
p(
    "Liver function tests help characterise the pattern and severity of jaundice, although they rarely "
    "give a specific diagnosis on their own. Key markers include:"
)
bullet("Serum bilirubin (total, conjugated and unconjugated) - the van den Bergh reaction distinguishes "
       "conjugated from unconjugated fractions.")
bullet("ALT and AST - markers of hepatocellular damage, disproportionately raised in hepatic jaundice.")
bullet("ALP and GGT - markers of cholestasis/biliary obstruction, disproportionately raised in "
       "post-hepatic jaundice.")
bullet("Prothrombin time (PT) and serum albumin - reflect the synthetic function of the liver and help "
       "assess severity/chronicity of hepatic dysfunction.")

# =========================================================================
# 6. CONCLUSION
# =========================================================================
doc.add_heading("6. Conclusion", level=1)
p(
    "Jaundice is a sign, not a disease, and reflects disturbed bilirubin homeostasis at one or more "
    "points along its production, transport, conjugation or excretion pathway. Classifying it as "
    "pre-hepatic, hepatic or post-hepatic, supported by a pattern-based interpretation of liver function "
    "tests, allows a rapid and logical approach to diagnosis. Among the congenital hyperbilirubinemias, "
    "Gilbert syndrome is common and entirely benign, Crigler-Najjar syndrome (especially type I) is rare "
    "but life-threatening, and Dubin-Johnson and Rotor syndromes cause benign conjugated "
    "hyperbilirubinemia due to defective hepatic transport rather than defective conjugation. "
    "Recognising these distinct biochemical mechanisms is essential for correct diagnosis, prognosis and "
    "avoidance of unnecessary investigation or treatment."
)

# =========================================================================
# REFERENCES
# =========================================================================
doc.add_heading("References", level=1)
refs = [
    "Harper's Illustrated Biochemistry, 32nd Edition - Chapter on Bile Pigment Metabolism.",
    "Robbins, Cotran & Kumar - Pathologic Basis of Disease, Section on Hereditary Hyperbilirubinemia.",
    "Goldman-Cecil Medicine, International Edition - Disorders of Bilirubin Metabolism Without Liver Disease.",
    "Yamada's Textbook of Gastroenterology, 7th Edition - Disorders of Bile Salt Conjugation and Transport.",
    "Sleisenger and Fordtran's Gastrointestinal and Liver Disease - Approach to the Patient with an Elevated Bilirubin Level.",
    "Course lecture notes: \"Liver Function Test (LFT)\" and \"Metabolism of Bile\" (Biochemistry course material).",
    "Markovic, A. P. et al. (2021). Jaundice as a Diagnostic and Therapeutic Problem: A General Practitioner's Approach. Digestive Diseases, 40(3), 362-369.",
    "Goluch, Z., Wierzbicka-Rucinska, A., Ksiazek, E. et al. (2024). Nutrition in Gilbert's Syndrome - A Systematic Review of Clinical Trials According to the PRISMA Statement. Nutrients, 16(14), 2247. (Recent systematic review; PMID: 39064690).",
    "Gene therapy trial for Crigler-Najjar syndrome (AAV8-UGT1A1), published in New England Journal of Medicine, reporting sustained bilirubin reduction with UGT1A1 gene transfer.",
]
for r in refs:
    bp = doc.add_paragraph(style="List Number")
    bp.paragraph_format.space_after = Pt(3)
    run = bp.add_run(r)
    run.font.size = Pt(10)

out_path = "/tmp/workspace/jaundice-assignment/Jaundice_Biochemistry_Assignment.docx"
doc.save(out_path)
print("Saved:", out_path)
Running Command

cd /tmp/workspace/jaundice-assignment && python3 build_docx.py && python3 -c " from docx import Document doc = Document('Jaundice_Biochemistry_Assignment.docx') print('tables:', len(doc.tables)) words = sum(len(p.text.split()) for p in doc.paragraphs) print('words:', words) "

Done — tables removed. The document now uses plain paragraphs and bullet points throughout (including the comparison sections, which are written as short descriptive paragraphs instead of a grid), so it's easy to copy out by hand.

Jaundice Biochemistry Assignment

Word Document · DOCX

Same full content as before (~1,700 words, all required topics covered), just reformatted:
  • Section 3.4 "Quick Comparison" (pre-hepatic vs hepatic vs post-hepatic) is now three short paragraphs instead of a table.
  • Section 4.2 Crigler-Najjar Type I vs Type II is now two bullet points instead of a table.
  • No grids/tables anywhere in the doc — just headings, paragraphs, and bullet lists you can transcribe directly.
This is a shared conversation. Sign in to Orris to start your own chat.