attachment
attachment

Write me good obstetrics history taking examples scenarios and in good

Asking for Preferences
Reading File
Reading File
Running Command

ls /home/daytona/workspace/ && ls /home/daytona/skills/docx/

Running Command

mkdir -p /home/daytona/workspace/obstetrics-scenarios && ls /home/daytona/skills…

Writing File

~/obstetrics-scenarios/generate.js

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

// ─── Helpers ───────────────────────────────────────────────────────────────
function heading1(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_1,
    spacing: { before: 320, after: 160 },
    children: [new TextRun({ text, bold: true, size: 32, font: "Arial", color: "1F3864" })]
  });
}

function heading2(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_2,
    spacing: { before: 240, after: 120 },
    children: [new TextRun({ text, bold: true, size: 26, font: "Arial", color: "2E74B5" })]
  });
}

function heading3(text) {
  return new Paragraph({
    spacing: { before: 180, after: 80 },
    children: [new TextRun({ text, bold: true, size: 24, font: "Arial", color: "375623" })]
  });
}

function body(text) {
  return new Paragraph({
    spacing: { after: 80 },
    children: [new TextRun({ text, size: 22, font: "Arial" })]
  });
}

function bullet(text) {
  return new Paragraph({
    spacing: { after: 60 },
    numbering: { reference: "bullets", level: 0 },
    children: [new TextRun({ text, size: 22, font: "Arial" })]
  });
}

function spacer() {
  return new Paragraph({ spacing: { after: 120 }, children: [new TextRun("")] });
}

function pageBreak() {
  return new Paragraph({ pageBreakBefore: true, children: [new TextRun("")] });
}

// Doctor line
function dLine(text) {
  return new Paragraph({
    spacing: { after: 80 },
    indent: { left: 0 },
    children: [
      new TextRun({ text: "Doctor:  ", bold: true, size: 22, font: "Arial", color: "1F3864" }),
      new TextRun({ text, size: 22, font: "Arial" })
    ]
  });
}

// Patient line
function pLine(text) {
  return new Paragraph({
    spacing: { after: 80 },
    indent: { left: 360 },
    children: [
      new TextRun({ text: "Patient: ", bold: true, size: 22, font: "Arial", color: "7B3F00" }),
      new TextRun({ text, size: 22, font: "Arial", italics: true })
    ]
  });
}

// Section label within dialogue
function sectionLabel(text) {
  return new Paragraph({
    spacing: { before: 180, after: 80 },
    shading: { type: ShadingType.SOLID, color: "D9E2F3", fill: "D9E2F3" },
    children: [new TextRun({ text: `[ ${text} ]`, bold: true, size: 20, font: "Arial", color: "1F3864" })]
  });
}

// Summary box row helper
function summaryRow(label, value) {
  return new TableRow({
    children: [
      new TableCell({
        width: { size: 3500, type: WidthType.DXA },
        shading: { type: ShadingType.SOLID, color: "D9E2F3", fill: "D9E2F3" },
        verticalAlign: VerticalAlign.CENTER,
        children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 20, font: "Arial" })] })]
      }),
      new TableCell({
        width: { size: 6000, type: WidthType.DXA },
        children: [new Paragraph({ children: [new TextRun({ text: value, size: 20, font: "Arial" })] })]
      })
    ]
  });
}

function summaryTable(rows) {
  return new Table({
    width: { size: 9500, type: WidthType.DXA },
    rows: rows.map(([l, v]) => summaryRow(l, v))
  });
}

// ─── SCENARIOS ─────────────────────────────────────────────────────────────

// SCENARIO 1 — Normal primigravida booking visit
const scenario1 = [
  heading2("SCENARIO 1: Normal Primigravida – First Antenatal Booking Visit"),
  body("Clinical Setting: Antenatal clinic | Patient: Ms. Amara Diallo, 24 years old"),
  spacer(),

  sectionLabel("BIODATA"),
  dLine("Good morning. My name is Dr. Mensah. May I know your full name?"),
  pLine("Good morning, doctor. My name is Amara Diallo."),
  dLine("How old are you, Ms. Diallo?"),
  pLine("I am 24 years old."),
  dLine("What is your occupation?"),
  pLine("I am a primary school teacher."),
  dLine("Are you married?"),
  pLine("Yes, I have been married for two years."),
  dLine("What is your religion?"),
  pLine("I am Christian."),
  dLine("Where do you live?"),
  pLine("I live in Adenta, Accra."),
  spacer(),

  sectionLabel("CHIEF COMPLAINT"),
  dLine("What brings you to the clinic today?"),
  pLine("Doctor, I think I am pregnant. I have missed my period for about three months now."),
  spacer(),

  sectionLabel("HISTORY OF PRESENT ILLNESS (HPI)"),
  dLine("How exactly did you notice? Tell me more."),
  pLine("I noticed I had not seen my period since January. I also started feeling nauseated, especially in the mornings, and my breasts have become tender and a bit bigger."),
  dLine("Have you done a pregnancy test?"),
  pLine("Yes, I did a urine test at a pharmacy last week and it was positive."),
  dLine("Are you experiencing any vomiting?"),
  pLine("Yes, some vomiting in the morning, but it has reduced recently."),
  dLine("Any lower abdominal pain?"),
  pLine("No, doctor."),
  dLine("Any vaginal bleeding or discharge?"),
  pLine("No bleeding. I sometimes notice a slight whitish discharge, but it has no smell and does not itch."),
  dLine("Have you noticed increased urge to pass urine?"),
  pLine("Yes, I urinate much more frequently now."),
  dLine("Any leg swelling, headaches, or problems with your vision?"),
  pLine("No, none of those."),
  dLine("Have you felt the baby move?"),
  pLine("Not yet, doctor."),
  spacer(),

  sectionLabel("OBSTETRIC HISTORY — Current Pregnancy"),
  dLine("When was the first day of your last menstrual period?"),
  pLine("It was on the 15th of January, 2026."),
  dLine("Is your period usually regular — coming every month?"),
  pLine("Yes, it is regular. It comes every 28 to 30 days."),
  dLine("So your expected date of delivery would be around the 22nd of October 2026. Have you attended any antenatal clinic before today?"),
  pLine("No, this is my first visit."),
  dLine("Have you had any investigations done — blood tests, ultrasound?"),
  pLine("Not yet."),
  dLine("Are you on any medication?"),
  pLine("I started taking folic acid that the pharmacy recommended."),
  spacer(),

  sectionLabel("OBSTETRIC HISTORY — Previous Pregnancies"),
  dLine("Have you ever been pregnant before?"),
  pLine("No, this is my first pregnancy."),
  dLine("Have you ever had a miscarriage or abortion?"),
  pLine("No, never."),
  spacer(),

  sectionLabel("PAST MEDICAL & SURGICAL HISTORY"),
  dLine("Do you have any medical conditions such as high blood pressure, diabetes, asthma, or sickle cell disease?"),
  pLine("No, doctor, I am generally healthy."),
  dLine("Have you ever had any surgery or been admitted to hospital?"),
  pLine("No, never."),
  spacer(),

  sectionLabel("PERSONAL, SOCIAL & ECONOMIC HISTORY"),
  dLine("Do you smoke or drink alcohol?"),
  pLine("No, I do not."),
  dLine("Does your husband also have any known medical conditions?"),
  pLine("Not that I know of. He seems healthy."),
  spacer(),

  sectionLabel("FAMILY HISTORY"),
  dLine("Is there any history of twins, diabetes, high blood pressure, or genetic conditions in your family?"),
  pLine("My mother has high blood pressure, but no one else that I know of."),
  spacer(),

  sectionLabel("REVIEW OF SYSTEMS"),
  dLine("Any tiredness or fatigue?"),
  pLine("Yes, I get tired easily."),
  dLine("Any leg cramps or indigestion?"),
  pLine("Some indigestion after eating. Leg cramps occasionally at night."),
  dLine("Any difficulty breathing or chest pain?"),
  pLine("No."),
  spacer(),

  body("Clinical Summary:"),
  summaryTable([
    ["Gravida / Parity", "G1 P0 (Primigravida)"],
    ["LMP", "15th January 2026"],
    ["EDD (Naegele's Rule)", "22nd October 2026"],
    ["Gestational Age", "~12 weeks"],
    ["Complications", "None identified"],
    ["Key Findings", "Morning sickness, breast tenderness, urinary frequency, mild leg cramps, physiological vaginal discharge"],
    ["Plan", "Full antenatal booking bloods, USS for dating, folic acid, iron, antenatal education"]
  ]),
  pageBreak()
];

// SCENARIO 2 — Multigravida with previous CS
const scenario2 = [
  heading2("SCENARIO 2: Multigravida with Previous Caesarean Section"),
  body("Clinical Setting: Antenatal clinic | Patient: Mrs. Fatima Al-Hassan, 32 years old, G3 P2"),
  spacer(),

  sectionLabel("BIODATA"),
  dLine("Good morning. I am Dr. Owusu. What is your name, please?"),
  pLine("Good morning, doctor. I am Fatima Al-Hassan."),
  dLine("How old are you?"),
  pLine("I am 32 years old."),
  dLine("Are you married?"),
  pLine("Yes, I am."),
  dLine("What do you do for a living?"),
  pLine("I am a trader."),
  spacer(),

  sectionLabel("CHIEF COMPLAINT"),
  dLine("What brings you here today?"),
  pLine("I am pregnant again and I want to register for antenatal care."),
  spacer(),

  sectionLabel("HISTORY OF PRESENT ILLNESS"),
  dLine("When was your last menstrual period?"),
  pLine("It was on the 10th of February 2026."),
  dLine("How many weeks pregnant do you think you are?"),
  pLine("About 14 weeks, I think."),
  dLine("Are you having any problems with this pregnancy so far?"),
  pLine("Not really. I have had some nausea and tiredness, but nothing serious."),
  dLine("Any vaginal bleeding or discharge?"),
  pLine("No bleeding. Just some mild discharge, which is normal for me in pregnancy."),
  dLine("Any lower abdominal pain or contractions?"),
  pLine("No."),
  dLine("Have you felt the baby move yet?"),
  pLine("Not yet, but in my last pregnancy I felt movement at about 18 weeks."),
  dLine("Any headache, visual disturbances, or swelling of the face and hands?"),
  pLine("No, none of that."),
  spacer(),

  sectionLabel("OBSTETRIC HISTORY — Previous Pregnancies"),
  dLine("You mentioned this is your third pregnancy. Let me ask about your previous ones. Starting with the first — when was it and where did you deliver?"),
  pLine("My first pregnancy was in 2018. I delivered at Korle Bu Teaching Hospital at full term — 40 weeks."),
  dLine("How long was your labour?"),
  pLine("About eight hours."),
  dLine("How was the baby delivered — normally or by operation?"),
  pLine("Normal delivery — through the vagina."),
  dLine("Was it a boy or a girl and what was the weight?"),
  pLine("A girl. She weighed 3.2 kilograms."),
  dLine("How is she now?"),
  pLine("She is well. She is 7 years old."),
  dLine("Any complications during or after delivery?"),
  pLine("No complications."),
  dLine("Did you breastfeed her?"),
  pLine("Yes, for about one year."),
  dLine("Now tell me about your second pregnancy."),
  pLine("My second pregnancy was in 2022. I also went to Korle Bu."),
  dLine("At what gestation did you deliver?"),
  pLine("At 38 weeks. They said the baby's head was too big and I needed an operation."),
  dLine("So that was a Caesarean section. Do you know why exactly?"),
  pLine("They said cephalopelvic disproportion — the baby's head could not fit through my pelvis."),
  dLine("What was the baby's weight?"),
  pLine("3.8 kilograms. A boy."),
  dLine("How is he now?"),
  pLine("He is fine, very active."),
  dLine("Any complications after the Caesarean?"),
  pLine("I had some wound pain for a while, but it healed well. No infection."),
  dLine("Did you breastfeed?"),
  pLine("Yes."),
  spacer(),

  sectionLabel("OBSTETRIC HISTORY — Miscarriages / Abortions"),
  dLine("Have you had any miscarriages or pregnancy losses?"),
  pLine("No."),
  spacer(),

  sectionLabel("ANTENATAL PROFILE"),
  dLine("What was your blood group the last time it was checked?"),
  pLine("I think it was O positive."),
  dLine("Do you know your HIV status?"),
  pLine("Yes, I was tested in my last pregnancy — I was negative."),
  dLine("Any known sickle cell status?"),
  pLine("I am AA — normal."),
  dLine("Are you on any medication currently?"),
  pLine("I take folic acid and I also take ferrous sulphate because I was told I had mild anaemia."),
  spacer(),

  sectionLabel("PAST MEDICAL HISTORY"),
  dLine("Do you have diabetes, hypertension, or asthma?"),
  pLine("No, doctor."),
  dLine("Apart from the Caesarean, have you had any other surgery?"),
  pLine("No."),
  spacer(),

  sectionLabel("SOCIAL & FAMILY HISTORY"),
  dLine("Do you smoke or take alcohol?"),
  pLine("No."),
  dLine("Any family history of twins, diabetes, or hypertension?"),
  pLine("My father has diabetes."),
  spacer(),

  body("Clinical Summary:"),
  summaryTable([
    ["Gravida / Parity", "G3 P2"],
    ["Obstetric Code", "2 previous deliveries: 1 SVD + 1 LSCS for CPD"],
    ["LMP", "10th February 2026"],
    ["EDD", "17th November 2026"],
    ["Gestational Age", "~14 weeks"],
    ["Key Risk Factors", "Previous LSCS — risk of uterine rupture, abnormal placentation"],
    ["Plan", "USS for placenta localisation, detailed anomaly scan, counselling re: VBAC vs repeat CS, GTT at 24–28 weeks (family Hx DM)"]
  ]),
  pageBreak()
];

// SCENARIO 3 — Teenage primigravida
const scenario3 = [
  heading2("SCENARIO 3: Teenage Primigravida – Unplanned Pregnancy"),
  body("Clinical Setting: Antenatal clinic | Patient: Miss Abena Sarpong, 17 years old"),
  spacer(),

  sectionLabel("BIODATA"),
  dLine("Good afternoon. Please come in and have a seat. I am Dr. Asante. What is your name?"),
  pLine("My name is Abena Sarpong."),
  dLine("How old are you, Abena?"),
  pLine("I am 17 years old."),
  dLine("Are you in school?"),
  pLine("I was in senior high school, but I had to stop."),
  dLine("Are you married?"),
  pLine("No."),
  spacer(),

  sectionLabel("CHIEF COMPLAINT"),
  dLine("What brings you to the clinic today?"),
  pLine("I am pregnant. My aunt brought me here."),
  spacer(),

  sectionLabel("HISTORY OF PRESENT ILLNESS"),
  dLine("When did you last see your period?"),
  pLine("About four months ago."),
  dLine("Have you done a pregnancy test?"),
  pLine("Yes, it was positive."),
  dLine("How have you been feeling since you found out?"),
  pLine("I feel very tired. I had a lot of vomiting in the first weeks but it has reduced now. I also feel like I am getting bigger."),
  dLine("Have you had any vaginal bleeding?"),
  pLine("No."),
  dLine("Any lower abdominal pain?"),
  pLine("Sometimes just a dull ache, but not severe."),
  dLine("Have you noticed swelling in your legs or face?"),
  pLine("A little swelling around my ankles in the evenings."),
  dLine("Any headache or blurred vision?"),
  pLine("Sometimes I have headaches."),
  dLine("Have you felt the baby move yet?"),
  pLine("Yes! I feel movements, especially at night."),
  spacer(),

  sectionLabel("OBSTETRIC HISTORY"),
  dLine("Is this your first pregnancy?"),
  pLine("Yes."),
  dLine("When was your last menstrual period exactly?"),
  pLine("It was around the 20th of January 2026."),
  dLine("Is your period usually regular?"),
  pLine("It comes every month, yes."),
  spacer(),

  sectionLabel("ANTENATAL VISITS & INVESTIGATIONS"),
  dLine("Have you been to any clinic before today?"),
  pLine("No. I was scared to come."),
  dLine("Have you had any blood tests or ultrasound done?"),
  pLine("No."),
  dLine("Are you on any medication?"),
  pLine("No, nothing."),
  spacer(),

  sectionLabel("PREGNANCY-RELATED SYMPTOMS"),
  dLine("Let me ask you about some common pregnancy symptoms. Do you have breast changes — tenderness or enlargement?"),
  pLine("Yes, they are bigger and tender."),
  dLine("Any constipation or indigestion?"),
  pLine("Yes, constipation."),
  dLine("Any leg cramps at night?"),
  pLine("Yes, especially in my right leg."),
  spacer(),

  sectionLabel("PAST MEDICAL HISTORY"),
  dLine("Do you have any medical conditions — sickle cell, high blood pressure, asthma?"),
  pLine("I was told as a child that I have sickle cell trait — AS."),
  dLine("Have you ever been admitted to hospital?"),
  pLine("Yes, once for malaria when I was 12."),
  spacer(),

  sectionLabel("SOCIAL HISTORY"),
  dLine("Do you smoke or drink alcohol?"),
  pLine("No, doctor."),
  dLine("Do you have any support at home?"),
  pLine("My aunt is helping me. My parents are not happy, but they are there."),
  spacer(),

  sectionLabel("FAMILY HISTORY"),
  dLine("Any conditions that run in your family?"),
  pLine("My mother has high blood pressure. My father also has diabetes."),
  spacer(),

  body("Clinical Summary:"),
  summaryTable([
    ["Gravida / Parity", "G1 P0 (Primigravida, adolescent)"],
    ["LMP", "~20th January 2026"],
    ["EDD", "~27th October 2026"],
    ["Gestational Age", "~16 weeks"],
    ["Key Risk Factors", "Adolescent pregnancy, late booking, sickle cell trait (AS), ankle oedema, headaches, no antenatal investigations"],
    ["Social Concerns", "School dropout, limited support, possible financial hardship"],
    ["Plan", "Urgent booking bloods incl. Hb electrophoresis, USS for dates & anomaly, BP monitoring, social worker referral, nutritional counselling"]
  ]),
  pageBreak()
];

// SCENARIO 4 — Pre-eclampsia presentation
const scenario4 = [
  heading2("SCENARIO 4: Multigravida Presenting with Headache and Leg Swelling at 34 Weeks (? Pre-eclampsia)"),
  body("Clinical Setting: Antenatal clinic / Emergency | Patient: Mrs. Ama Boateng, 35 years old, G3 P2"),
  spacer(),

  sectionLabel("BIODATA"),
  dLine("Good morning, Mrs. Boateng. I am Dr. Kyei. How can I help you today?"),
  pLine("Good morning, doctor. I am 34 weeks pregnant and I have been having bad headaches and my legs are very swollen."),
  spacer(),

  sectionLabel("CHIEF COMPLAINT"),
  dLine("How long have you had these headaches?"),
  pLine("For the past three days. They are at the front of my head, very pounding."),
  dLine("Have you taken anything for the headaches?"),
  pLine("I took paracetamol but it did not help much."),
  dLine("Any blurred vision or seeing spots or flashing lights?"),
  pLine("Yes! Yesterday evening I saw some flashing lights and my vision was blurry for a short time."),
  dLine("Any pain under your ribs — on the right side?"),
  pLine("Yes, doctor, a dull ache on the right side just under my ribs."),
  dLine("Any swelling of the face or hands, not just the legs?"),
  pLine("My face looked puffy this morning, and my rings are tight on my fingers."),
  dLine("Have you had any fits or convulsions?"),
  pLine("No, thank God."),
  dLine("Any vaginal bleeding?"),
  pLine("No."),
  dLine("Have you been monitoring your blood pressure at home?"),
  pLine("I checked it yesterday at the pharmacy and the lady said it was high — she wrote 150 over 100 on a paper."),
  dLine("Have you had high blood pressure before this pregnancy?"),
  pLine("No, never."),
  dLine("Is the baby still moving well?"),
  pLine("The movements have reduced a bit in the last two days. I used to feel strong kicks but now it is less."),
  spacer(),

  sectionLabel("CURRENT PREGNANCY HISTORY"),
  dLine("When was your last menstrual period?"),
  pLine("The 10th of October 2025."),
  dLine("Have you been attending antenatal clinic regularly?"),
  pLine("Yes, I come every month. Last time was three weeks ago and everything was normal."),
  dLine("Were any investigations done at booking?"),
  pLine("Yes — blood group, HIV, blood count. All were normal. I had an ultrasound at 20 weeks which was also normal."),
  dLine("Are you on any medications?"),
  pLine("I take ferrous sulphate and folic acid."),
  spacer(),

  sectionLabel("PREVIOUS OBSTETRIC HISTORY"),
  dLine("You mentioned this is your third pregnancy. Any problems in the previous ones?"),
  pLine("My first delivery was normal in 2018, a boy, 3.1 kg. No problems."),
  dLine("And the second?"),
  pLine("Also normal delivery in 2021, a girl, 2.9 kg. But at the end of that pregnancy I also had some swelling and they said my blood pressure was a little high, but I did not need medication."),
  dLine("Did it resolve after delivery?"),
  pLine("Yes, within a few weeks everything went back to normal."),
  spacer(),

  sectionLabel("PAST MEDICAL & SURGICAL HISTORY"),
  dLine("Any chronic medical conditions?"),
  pLine("No, doctor."),
  dLine("Any kidney problems?"),
  pLine("No."),
  spacer(),

  sectionLabel("FAMILY HISTORY"),
  dLine("Does anyone in your family have hypertension or pre-eclampsia?"),
  pLine("My mother had eclampsia in one of her pregnancies — she had fits, but she survived."),
  spacer(),

  sectionLabel("SOCIAL HISTORY"),
  dLine("Do you smoke or drink alcohol?"),
  pLine("No."),
  spacer(),

  body("Clinical Summary:"),
  summaryTable([
    ["Gravida / Parity", "G3 P2"],
    ["Gestational Age", "34 weeks"],
    ["Presenting Symptoms", "Severe frontal headache, visual disturbances (flashing lights/blurring), right upper quadrant pain, generalised oedema (face, hands, legs), reduced fetal movements"],
    ["BP recorded at pharmacy", "150/100 mmHg"],
    ["Key Risk Factors", "Previous borderline gestational hypertension, maternal family history of eclampsia"],
    ["Likely Diagnosis", "Pre-eclampsia with severe features (? HELLP syndrome)"],
    ["Urgent Actions", "Admit, IV access, BP monitoring, urinalysis for protein, CBC, LFTs, RFTs, uric acid, coagulation, CTG / BPP, MgSO4 assessment, HDU/ICU liaison, steroids for fetal lung maturity"]
  ]),
  pageBreak()
];

// SCENARIO 5 — Previous miscarriages
const scenario5 = [
  heading2("SCENARIO 5: Multigravida with Recurrent Miscarriages – Anxious Early Booking"),
  body("Clinical Setting: Early Pregnancy Unit | Patient: Mrs. Grace Mensah, 30 years old, G4 P1"),
  spacer(),

  sectionLabel("BIODATA"),
  dLine("Good morning, Mrs. Mensah. Please take a seat. I am Dr. Ofori. How are you?"),
  pLine("Not too well, doctor. I am very worried. I am pregnant again and I am scared."),
  spacer(),

  sectionLabel("CHIEF COMPLAINT"),
  dLine("Tell me what is worrying you."),
  pLine("I have had three pregnancies that did not go well. I lost two babies, and one was a miscarriage early on. Now I am pregnant again and I am very anxious."),
  spacer(),

  sectionLabel("HISTORY OF PRESENT ILLNESS"),
  dLine("When was your last menstrual period?"),
  pLine("The 1st of April 2026."),
  dLine("Have you done a pregnancy test?"),
  pLine("Yes, it is positive."),
  dLine("How are you feeling now? Any bleeding or cramping?"),
  pLine("I have some mild cramping, no bleeding. But every little cramp frightens me."),
  dLine("Any nausea or vomiting?"),
  pLine("Yes, which is actually reassuring me a bit."),
  dLine("Any vaginal discharge?"),
  pLine("Mild whitish discharge, no smell."),
  spacer(),

  sectionLabel("HISTORY OF PREVIOUS PREGNANCIES"),
  dLine("Let me go through each of your previous pregnancies carefully. Starting with the first."),
  pLine("My first pregnancy was in 2018. I carried it to 38 weeks and delivered normally. A girl — she is healthy, she is 7 now."),
  dLine("Any complications?"),
  pLine("None."),
  dLine("Did you breastfeed?"),
  pLine("Yes, for a year."),
  dLine("And the second pregnancy?"),
  pLine("That was in 2020. I lost it at 10 weeks. I had bleeding and cramping, and the scan showed no heartbeat. They said it was a missed miscarriage."),
  dLine("Where was it managed?"),
  pLine("At Ridge Hospital. They did a small operation — ERPC — to clean out the womb."),
  dLine("Any blood transfusion needed?"),
  pLine("No, thankfully."),
  dLine("Were you given any cause for the miscarriage?"),
  pLine("They said it was probably just chromosomal — bad luck."),
  dLine("And the third pregnancy?"),
  pLine("In 2022. I got to 22 weeks. Then I had painless bleeding and my waters broke early. The baby was delivered but she was too small and could not survive. She died within a few hours."),
  dLine("Do you know if the cervix was involved — like an incompetent cervix?"),
  pLine("Yes! They said my cervix opened too early. That is what caused it."),
  dLine("Any infection at the time?"),
  pLine("They tested and said there was a mild infection — something with the membranes."),
  dLine("Did you have a blood transfusion?"),
  pLine("No."),
  dLine("Were you seen by a specialist after that loss?"),
  pLine("Yes, I went to a recurrent pregnancy loss clinic. They did many tests — some were normal but they said I might have a weak cervix."),
  dLine("And the fourth pregnancy?"),
  pLine("That was last year, 2025. It ended at 8 weeks — another miscarriage. Bleeding and cramping. I passed it on my own at home."),
  dLine("Did you go to hospital?"),
  pLine("Yes, they scanned and confirmed it was complete. No operation needed."),
  spacer(),

  sectionLabel("INVESTIGATIONS DONE (Recurrent Loss Clinic)"),
  dLine("Do you have a record of the tests done at the recurrent loss clinic?"),
  pLine("I brought my file. They tested for antiphospholipid syndrome — one test was borderline positive. They also checked my chromosomes and my husband's — both normal. Uterine scan showed a small fibroid but they said it is not causing the losses."),
  spacer(),

  sectionLabel("PAST MEDICAL HISTORY"),
  dLine("Any medical conditions — clotting disorders, autoimmune disease, diabetes?"),
  pLine("No diagnosed conditions apart from the antiphospholipid borderline result."),
  spacer(),

  sectionLabel("MEDICATIONS"),
  dLine("Are you on any treatment for the antiphospholipid result?"),
  pLine("The doctor told me to start low-dose aspirin when I become pregnant again. I have been taking it since I found out."),
  spacer(),

  sectionLabel("FAMILY & SOCIAL HISTORY"),
  dLine("Any similar pregnancy losses in your family?"),
  pLine("My sister also had two miscarriages, but she now has two children."),
  dLine("How is your husband coping with all of this?"),
  pLine("He is supportive but also very scared. We both are."),
  spacer(),

  body("Clinical Summary:"),
  summaryTable([
    ["Gravida / Parity", "G5 P1 (1 living child, 2 early miscarriages, 1 mid-trimester loss)"],
    ["LMP", "1st April 2026"],
    ["EDD", "8th January 2027"],
    ["Gestational Age", "~7 weeks"],
    ["Key Risk Factors", "Recurrent pregnancy loss, cervical incompetence (previous 2nd trimester loss), borderline antiphospholipid syndrome, uterine fibroid"],
    ["Current Medications", "Low-dose aspirin 75mg OD"],
    ["Plan", "Early USS for viability & dates, haematology review (LMWH ± aspirin for APS), plan cervical cerclage at ~12–14 weeks, early anomaly scan, close surveillance, psychological support"]
  ]),
  pageBreak()
];

// SCENARIO 6 — Grand multipara with prolonged labour
const scenario6 = [
  heading2("SCENARIO 6: Grand Multipara – Emergency Admission with Prolonged Labour"),
  body("Clinical Setting: Labour Ward / Emergency | Patient: Mrs. Mariama Conteh, 40 years old, G6 P5"),
  spacer(),

  sectionLabel("BIODATA"),
  dLine("Good evening, I am Dr. Tagoe. Can you hear me clearly? I need to ask you some important questions."),
  pLine("Yes, doctor. Please help me. I have been in labour since this morning."),
  spacer(),

  sectionLabel("CHIEF COMPLAINT & HPI"),
  dLine("Since what time did the contractions start?"),
  pLine("From about 6 o'clock this morning. They were mild at first."),
  dLine("It is now 8 o'clock in the evening. That is about 14 hours. How often are the contractions coming now?"),
  pLine("They are very strong and coming every 2 to 3 minutes. I feel like I want to push but nothing is coming out."),
  dLine("Any vaginal bleeding?"),
  pLine("Some blood with the show, but now there is more blood than before."),
  dLine("Any vaginal fluid loss — has the water bag broken?"),
  pLine("Yes, the water broke about 6 hours ago. It was clear at first but I think it has become a bit greenish."),
  dLine("Are you still feeling the baby move?"),
  pLine("I felt movements earlier but not much in the last few hours."),
  dLine("Do you have any pain between contractions? Like a constant abdominal pain?"),
  pLine("Yes, doctor, there is a pain that does not go away between contractions. My belly is very tender."),
  spacer(),

  sectionLabel("CURRENT PREGNANCY HISTORY"),
  dLine("When was your last menstrual period?"),
  pLine("I cannot remember exactly. But I went for antenatal care and they said I was 39 weeks."),
  dLine("Did you attend antenatal clinic regularly?"),
  pLine("I came three times. They said everything was normal."),
  dLine("What was the baby's position at your last visit?"),
  pLine("They said the head was down."),
  dLine("Do you know your blood group and haemoglobin level?"),
  pLine("I know I am B positive. The haemoglobin — I cannot remember. They said it was a little low."),
  spacer(),

  sectionLabel("PREVIOUS OBSTETRIC HISTORY"),
  dLine("This is your sixth pregnancy. Please tell me briefly about your previous deliveries."),
  pLine("All five were normal vaginal deliveries. The smallest baby was 3.0 kg and the biggest was 4.5 kg."),
  dLine("Did you have any complications — tearing, bleeding, retained placenta?"),
  pLine("After my fourth baby I lost a lot of blood and I was given a blood transfusion."),
  dLine("Any previous caesarean section?"),
  pLine("No, never."),
  dLine("All five babies alive and well?"),
  pLine("Four are fine. One died as a newborn at 3 days — they said there was an infection."),
  spacer(),

  sectionLabel("PAST MEDICAL HISTORY"),
  dLine("Any medical conditions — diabetes, high blood pressure?"),
  pLine("I was told in the last pregnancy that my blood pressure was a little high, but they did not give me medicines."),
  dLine("Any known anaemia?"),
  pLine("I was told I was anaemic and given iron tablets."),
  spacer(),

  sectionLabel("SOCIAL & FAMILY HISTORY"),
  dLine("Do you have someone with you tonight?"),
  pLine("My co-wife is outside."),
  dLine("Any family history of twins or bleeding disorders?"),
  pLine("My mother had twins once."),
  spacer(),

  body("Clinical Summary:"),
  summaryTable([
    ["Gravida / Parity", "G6 P5 (Grand multipara)"],
    ["Gestational Age", "39 weeks"],
    ["Duration of Labour", "~14 hours; membrane rupture ~6 hours (meconium-stained liquor)"],
    ["Key Risk Factors", "Grand multiparity (uterine rupture risk, PPH risk), prolonged labour, meconium-stained liquor, reduced fetal movements, constant abdominal pain (? uterine rupture), previous PPH requiring transfusion, likely anaemia"],
    ["Likely Diagnosis", "Obstructed/prolonged labour ± uterine rupture — OBSTETRIC EMERGENCY"],
    ["Urgent Actions", "Immediate obstetric assessment, IV access x2, cross-match blood, Foley catheter, CTG / fetal HR, urgent USS, prepare for emergency LSCS, involve senior consultant immediately, ensure blood products available"]
  ]),
  pageBreak()
];

// SCENARIO 7 — Gestational diabetes screening
const scenario7 = [
  heading2("SCENARIO 7: Multigravida at 26 Weeks – Gestational Diabetes Risk Assessment"),
  body("Clinical Setting: Routine Antenatal Clinic | Patient: Mrs. Priscilla Osei, 38 years old, G3 P2"),
  spacer(),

  sectionLabel("BIODATA"),
  dLine("Good morning, Mrs. Osei. I am Dr. Nkrumah. Please tell me what brings you today."),
  pLine("Good morning. I am here for my routine 26-week visit. I also want to ask about the sugar test because I read online that I might need one."),
  spacer(),

  sectionLabel("CHIEF COMPLAINT & HPI"),
  dLine("Any symptoms you have noticed that concern you?"),
  pLine("I have been more thirsty than usual and I urinate very often — more than what I would expect in pregnancy. I also feel very tired."),
  dLine("Any vulval itching or abnormal discharge?"),
  pLine("Yes, some itching 'down there' for the past two weeks."),
  dLine("Any headache or visual changes?"),
  pLine("No."),
  dLine("Any leg swelling?"),
  pLine("Just mild ankle swelling at the end of the day."),
  dLine("Are you feeling fetal movements?"),
  pLine("Yes, baby is very active."),
  dLine("Any abdominal pain or vaginal bleeding?"),
  pLine("No."),
  spacer(),

  sectionLabel("OBSTETRIC HISTORY — Current Pregnancy"),
  dLine("When was your LMP?"),
  pLine("The 20th of November 2025."),
  dLine("Have your antenatal visits been regular?"),
  pLine("Yes, this is my fourth visit."),
  dLine("What investigations were done at booking?"),
  pLine("Blood group A positive, HIV negative, Hb 11.2, syphilis negative. I had an ultrasound at 12 weeks — normal."),
  dLine("Are you on any medications?"),
  pLine("Folic acid and ferrous sulphate."),
  spacer(),

  sectionLabel("PREVIOUS OBSTETRIC HISTORY"),
  dLine("Tell me about your first pregnancy."),
  pLine("In 2015 — normal delivery at 39 weeks, a girl, 3.2 kg. No problems."),
  dLine("And the second?"),
  pLine("In 2020. I was diagnosed with gestational diabetes and I had to control my diet. The baby was big — 4.6 kg — and they had to use a vacuum to deliver him. He had some low sugar at birth but was fine after a few days."),
  dLine("Was insulin or medication required during that pregnancy?"),
  pLine("I was on metformin for a few weeks towards the end."),
  dLine("Did the diabetes resolve after delivery?"),
  pLine("Yes, my sugars went back to normal."),
  dLine("Any miscarriages?"),
  pLine("No."),
  spacer(),

  sectionLabel("PAST MEDICAL HISTORY"),
  dLine("Any diabetes, hypertension, or PCOS?"),
  pLine("No diabetes diagnosed outside of pregnancy. I was told I might have borderline PCOS years ago but nothing was confirmed."),
  dLine("Any thyroid disease?"),
  pLine("I was treated for an underactive thyroid two years ago. I am on levothyroxine."),
  spacer(),

  sectionLabel("FAMILY HISTORY"),
  dLine("Diabetes in the family?"),
  pLine("My father has type 2 diabetes. My maternal grandmother also."),
  spacer(),

  sectionLabel("SOCIAL HISTORY"),
  dLine("Smoking, alcohol?"),
  pLine("No."),
  dLine("What is your diet like?"),
  pLine("I eat a lot of rice and fufu. I love sweet drinks. I have been trying to cut down."),
  dLine("How much do you weigh currently?"),
  pLine("At my last visit I was 88 kg. I started at 82 kg."),
  spacer(),

  body("Clinical Summary:"),
  summaryTable([
    ["Gravida / Parity", "G3 P2"],
    ["Gestational Age", "26 weeks"],
    ["Presenting Symptoms", "Polydipsia, polyuria, vulval candidiasis, fatigue — all consistent with hyperglycaemia"],
    ["Key Risk Factors", "Previous GDM (metformin-treated), macrosomic baby (4.6 kg), family history of T2DM (father, grandmother), obesity (pre-pregnancy BMI elevated), PCOS query, hypothyroidism"],
    ["Likely Diagnosis", "Recurrent gestational diabetes mellitus"],
    ["Plan", "Urgent OGTT (75g), fasting glucose, HbA1c, urine for glucose/protein, vaginal swab for candida, dietitian referral, glucose diary, fundal height measurement, serial growth scans, liaise with endocrine team"]
  ]),
  pageBreak()
];

// ─── TITLE PAGE & INTRO ────────────────────────────────────────────────────
const titlePage = [
  new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { before: 2000, after: 400 },
    children: [new TextRun({ text: "OBSTETRICS HISTORY TAKING", bold: true, size: 48, font: "Arial", color: "1F3864" })]
  }),
  new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { after: 200 },
    children: [new TextRun({ text: "Clinical Scenario Workbook", bold: true, size: 32, font: "Arial", color: "2E74B5" })]
  }),
  new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { after: 200 },
    children: [new TextRun({ text: "Reproductive Health | OBGYN Clinical Practice", size: 24, font: "Arial", color: "595959" })]
  }),
  spacer(),
  new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { after: 160 },
    children: [new TextRun({ text: "7 Dialogue-Based Scenarios", size: 24, font: "Arial", italics: true, color: "595959" })]
  }),
  spacer(),
  new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { after: 80 },
    children: [new TextRun({ text: "Prepared for: Medical & Midwifery Students", size: 22, font: "Arial", color: "595959" })]
  }),
  pageBreak()
];

// ─── HOW TO USE ─────────────────────────────────────────────────────────────
const howToUse = [
  heading1("How to Use This Workbook"),
  body("Each scenario follows the standard obstetric history taking framework:"),
  spacer(),
  bullet("Biodata — name, age, occupation, marital status, religion, address"),
  bullet("Chief Complaint (C/C) — reason for the visit"),
  bullet("History of Present Illness (HPI) — detailed account of the presenting symptoms"),
  bullet("Review of Systems — systematic enquiry of all organ systems"),
  bullet("Obstetric History — current pregnancy details (gravida, parity, LMP, EDD, gestational age, antenatal profile, pregnancy-related symptoms, complications)"),
  bullet("History of Previous Pregnancies — for each: gestation, place, mode of delivery, baby outcome, complications, blood transfusion, breastfeeding"),
  bullet("History of Previous Miscarriages — date, gestation, management, cause, ERPC, transfusion"),
  bullet("Past Medical & Surgical History"),
  bullet("Personal, Social & Economic History"),
  bullet("Family History"),
  spacer(),
  body("Each scenario ends with a Clinical Summary Table capturing the key clinical points and management plan."),
  spacer(),
  body("EDD Calculation (Naegele's Rule): LMP day + 7 days; LMP month − 3; LMP year + 1."),
  spacer(),
  body("Gravida = total number of pregnancies (including current). Parity = number of deliveries ≥ 20 weeks (alive or stillbirth). Example: G3 P2 = 3 pregnancies, 2 deliveries."),
  pageBreak()
];

// ─── TABLE OF SCENARIOS ─────────────────────────────────────────────────────
const tocSection = [
  heading1("Scenarios at a Glance"),
  new Table({
    width: { size: 9500, type: WidthType.DXA },
    rows: [
      new TableRow({
        tableHeader: true,
        children: [
          new TableCell({ width: { size: 1000, type: WidthType.DXA }, shading: { type: ShadingType.SOLID, color: "1F3864", fill: "1F3864" }, children: [new Paragraph({ children: [new TextRun({ text: "#", bold: true, size: 20, font: "Arial", color: "FFFFFF" })] })] }),
          new TableCell({ width: { size: 4000, type: WidthType.DXA }, shading: { type: ShadingType.SOLID, color: "1F3864", fill: "1F3864" }, children: [new Paragraph({ children: [new TextRun({ text: "Scenario", bold: true, size: 20, font: "Arial", color: "FFFFFF" })] })] }),
          new TableCell({ width: { size: 2000, type: WidthType.DXA }, shading: { type: ShadingType.SOLID, color: "1F3864", fill: "1F3864" }, children: [new Paragraph({ children: [new TextRun({ text: "Patient", bold: true, size: 20, font: "Arial", color: "FFFFFF" })] })] }),
          new TableCell({ width: { size: 2500, type: WidthType.DXA }, shading: { type: ShadingType.SOLID, color: "1F3864", fill: "1F3864" }, children: [new Paragraph({ children: [new TextRun({ text: "Key Focus", bold: true, size: 20, font: "Arial", color: "FFFFFF" })] })] })
        ]
      }),
      ...[
        ["1", "Normal Primigravida – First Booking Visit", "24-year-old, G1P0", "Normal ANC booking"],
        ["2", "Multigravida with Previous Caesarean Section", "32-year-old, G3P2", "Previous LSCS / CPD"],
        ["3", "Teenage Primigravida – Unplanned Pregnancy", "17-year-old, G1P0", "Adolescent, late booking"],
        ["4", "Headache & Leg Swelling at 34 Weeks", "35-year-old, G3P2", "? Pre-eclampsia"],
        ["5", "Recurrent Miscarriages – Anxious Booking", "30-year-old, G5P1", "Recurrent pregnancy loss"],
        ["6", "Grand Multipara – Prolonged Labour Emergency", "40-year-old, G6P5", "Obstructed labour / ? Rupture"],
        ["7", "Gestational Diabetes Risk at 26 Weeks", "38-year-old, G3P2", "GDM recurrence"]
      ].map(([num, title, patient, focus]) =>
        new TableRow({
          children: [
            new TableCell({ children: [new Paragraph({ children: [new TextRun({ text: num, size: 20, font: "Arial" })] })] }),
            new TableCell({ children: [new Paragraph({ children: [new TextRun({ text: title, size: 20, font: "Arial" })] })] }),
            new TableCell({ children: [new Paragraph({ children: [new TextRun({ text: patient, size: 20, font: "Arial" })] })] }),
            new TableCell({ children: [new Paragraph({ children: [new TextRun({ text: focus, size: 20, font: "Arial" })] })] })
          ]
        })
      )
    ]
  }),
  pageBreak()
];

// ─── ASSEMBLE DOCUMENT ─────────────────────────────────────────────────────
const doc = new Document({
  numbering: {
    config: [
      {
        reference: "bullets",
        levels: [{
          level: 0, format: LevelFormat.BULLET, text: "\u2022",
          alignment: AlignmentType.LEFT,
          style: { paragraph: { indent: { left: 720, hanging: 360 } } }
        }]
      }
    ]
  },
  styles: {
    default: {
      document: { run: { font: "Arial", size: 22 } }
    },
    paragraphStyles: [
      {
        id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 32, bold: true, font: "Arial", color: "1F3864" },
        paragraph: { spacing: { before: 320, after: 160 }, outlineLevel: 0 }
      },
      {
        id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 26, bold: true, font: "Arial", color: "2E74B5" },
        paragraph: { spacing: { before: 240, after: 120 }, outlineLevel: 1 }
      }
    ]
  },
  sections: [{
    properties: {},
    children: [
      ...titlePage,
      ...howToUse,
      ...tocSection,
      ...scenario1,
      ...scenario2,
      ...scenario3,
      ...scenario4,
      ...scenario5,
      ...scenario6,
      ...scenario7
    ]
  }]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('/home/daytona/workspace/obstetrics-scenarios/Obstetrics_History_Taking_Scenarios.docx', buffer);
  console.log('Done!');
}).catch(err => {
  console.error('Error:', err);
  process.exit(1);
});
Running Command

cd /home/daytona/workspace/obstetrics-scenarios && node generate.js 2>&1

Running Command

python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/worksp…

Running Command

ls -lh /home/daytona/workspace/obstetrics-scenarios/Obstetrics_History_Taking_Sc…

Your document is ready:

Obstetrics History Taking Scenarios

Word Document · DOCX


Here is what is inside:
#ScenarioPatientKey Clinical Focus
1Normal Primigravida – First Booking Visit24-year-old, G1P0Routine ANC booking, normal pregnancy
2Multigravida with Previous Caesarean Section32-year-old, G3P2Previous LSCS for CPD, VBAC counselling
3Teenage Primigravida – Unplanned Pregnancy17-year-old, G1P0Late booking, sickle cell trait, social support
4Headache & Leg Swelling at 34 Weeks35-year-old, G3P2Pre-eclampsia with severe features
5Recurrent Miscarriages – Anxious Early Booking30-year-old, G5P1Cervical incompetence, antiphospholipid syndrome
6Grand Multipara – Prolonged Labour Emergency40-year-old, G6P5Obstructed labour, ? uterine rupture
7Gestational Diabetes Risk at 26 Weeks38-year-old, G3P2Recurrent GDM, macrosomia history
Each scenario includes:
  • A full doctor–patient dialogue structured exactly to your framework (Biodata → C/C → HPI → Obstetric Hx → Previous pregnancies → PMH/SH/FH)
  • Colour-coded section labels (e.g. [ BIODATA ], [ CHIEF COMPLAINT ])
  • A clinical summary table at the end with gravida/parity, EDD, key risk factors, diagnosis, and management plan
  • An introductory guide page explaining how to calculate EDD, gravida/parity notation, and how to use the workbook

Obstetrics cases presentation examples

Asking for Preferences
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/obstetrics-cases-pptx

Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.

1. Ovulation, fertilisation, and implantation reproductive health comprehensive notes as a pptx

Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/ovulation-fertilisation-pptx

Writing File

~/ovulation-fertilisation-pptx/generate.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Ovulation, Fertilisation & Implantation";
pres.author = "Reproductive Health";

// ── COLOUR PALETTE ──────────────────────────────────────────────────────────
const C = {
  navy:    "0D2B55",  // dominant dark
  teal:    "1A7A8A",  // section accent
  gold:    "E8A020",  // highlight accent
  cream:   "F5F0E8",  // light bg
  white:   "FFFFFF",
  lightBlue:"D6EAF8",
  darkText:"1A1A2E",
  midGrey: "5A6070",
  green:   "1B7A4E",
  red:     "B03030",
  pink:    "F0E0EC",
  purple:  "5B2D8E",
};

// ── HELPERS ──────────────────────────────────────────────────────────────────
function addSlideNumber(slide) {
  // subtle slide number bottom right
}

// Title slide
function titleSlide() {
  const s = pres.addSlide();
  // deep navy bg
  s.background = { color: C.navy };
  // decorative top bar gold
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.18, fill: { color: C.gold }, line: { color: C.gold } });
  // decorative bottom bar teal
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.43, w: 10, h: 0.18, fill: { color: C.teal }, line: { color: C.teal } });
  // topic tag
  s.addText("REPRODUCTIVE HEALTH", { x: 0.5, y: 0.35, w: 9, h: 0.4, fontSize: 12, color: C.gold, bold: true, charSpacing: 4, fontFace: "Arial" });
  // main title
  s.addText("Ovulation, Fertilisation\n& Implantation", {
    x: 0.7, y: 1.0, w: 8.6, h: 2.5, fontSize: 44, color: C.white, bold: true, fontFace: "Arial", align: "center", valign: "middle"
  });
  // subtitle line
  s.addShape(pres.ShapeType.rect, { x: 3, y: 3.4, w: 4, h: 0.05, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText("Comprehensive Notes – Early Human Development", {
    x: 0.5, y: 3.55, w: 9, h: 0.55, fontSize: 16, color: C.lightBlue, italic: true, fontFace: "Arial", align: "center"
  });
  s.addText("Sources: Langman's Medical Embryology · The Developing Human · Creasy & Resnik's MFM · Guyton & Hall", {
    x: 0.5, y: 5.0, w: 9, h: 0.4, fontSize: 10, color: "AAAACC", fontFace: "Arial", align: "center"
  });
}

// Section divider slide
function sectionDivider(number, title, subtitle, bgColor) {
  const s = pres.addSlide();
  s.background = { color: bgColor || C.teal };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.25, h: 5.625, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText(`0${number}`, { x: 0.5, y: 1.0, w: 2, h: 1.5, fontSize: 80, color: C.white, bold: true, fontFace: "Arial", transparency: 30 });
  s.addText(title, { x: 0.5, y: 2.3, w: 9, h: 1.0, fontSize: 36, color: C.white, bold: true, fontFace: "Arial" });
  s.addText(subtitle, { x: 0.5, y: 3.2, w: 8.5, h: 0.7, fontSize: 16, color: C.lightBlue, italic: true, fontFace: "Arial" });
}

// Standard content slide (title + bullets)
function contentSlide(title, bullets, accentColor) {
  const s = pres.addSlide();
  s.background = { color: C.cream };
  // top title bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.0, fill: { color: accentColor || C.navy }, line: { color: accentColor || C.navy } });
  s.addText(title, { x: 0.4, y: 0.08, w: 9.2, h: 0.85, fontSize: 22, color: C.white, bold: true, fontFace: "Arial", valign: "middle" });
  // left accent line
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.1, w: 0.07, h: 4.1, fill: { color: C.gold }, line: { color: C.gold } });
  // bullets
  const items = bullets.map((b, i) => {
    if (b.startsWith("__")) {
      // sub-bullet
      return { text: b.replace(/^__/, ""), options: { bullet: { indent: 40 }, breakLine: i < bullets.length - 1, fontSize: 14, color: C.midGrey, fontFace: "Arial", indentLevel: 1 } };
    }
    return { text: b, options: { bullet: true, breakLine: i < bullets.length - 1, fontSize: 15.5, color: C.darkText, fontFace: "Arial", bold: b.startsWith("**") } };
  }).map(item => {
    if (item.text && item.text.startsWith("**")) {
      return { text: item.text.replace(/^\*\*/, ""), options: { ...item.options, bold: true, color: C.navy } };
    }
    return item;
  });
  s.addText(items, { x: 0.5, y: 1.1, w: 9.2, h: 4.3, valign: "top", margin: [10, 10, 0, 20] });
}

// Two-column slide
function twoColSlide(title, leftTitle, leftItems, rightTitle, rightItems, accentColor) {
  const s = pres.addSlide();
  s.background = { color: C.cream };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.0, fill: { color: accentColor || C.navy }, line: { color: accentColor || C.navy } });
  s.addText(title, { x: 0.4, y: 0.08, w: 9.2, h: 0.85, fontSize: 22, color: C.white, bold: true, fontFace: "Arial", valign: "middle" });

  // Left panel
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.1, w: 4.4, h: 4.3, fill: { color: C.white }, line: { color: C.teal, pt: 1.5 } });
  s.addText(leftTitle, { x: 0.4, y: 1.15, w: 4.2, h: 0.45, fontSize: 14, bold: true, color: C.teal, fontFace: "Arial" });
  const lItems = leftItems.map((b, i) => ({ text: b, options: { bullet: true, breakLine: i < leftItems.length - 1, fontSize: 13.5, color: C.darkText, fontFace: "Arial" } }));
  s.addText(lItems, { x: 0.45, y: 1.6, w: 4.15, h: 3.7, valign: "top" });

  // Right panel
  s.addShape(pres.ShapeType.rect, { x: 5.3, y: 1.1, w: 4.4, h: 4.3, fill: { color: C.white }, line: { color: C.gold, pt: 1.5 } });
  s.addText(rightTitle, { x: 5.4, y: 1.15, w: 4.2, h: 0.45, fontSize: 14, bold: true, color: C.gold, fontFace: "Arial" });
  const rItems = rightItems.map((b, i) => ({ text: b, options: { bullet: true, breakLine: i < rightItems.length - 1, fontSize: 13.5, color: C.darkText, fontFace: "Arial" } }));
  s.addText(rItems, { x: 5.45, y: 1.6, w: 4.15, h: 3.7, valign: "top" });
}

// Highlight / key fact slide
function keyFactSlide(title, bigFact, subText, color) {
  const s = pres.addSlide();
  s.background = { color: color || C.navy };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.15, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText(title, { x: 0.5, y: 0.3, w: 9, h: 0.6, fontSize: 16, color: C.gold, bold: true, fontFace: "Arial", charSpacing: 2 });
  s.addText(bigFact, { x: 0.5, y: 1.1, w: 9, h: 2.8, fontSize: 28, color: C.white, bold: true, fontFace: "Arial", align: "center", valign: "middle", wrap: true });
  s.addShape(pres.ShapeType.rect, { x: 2, y: 3.85, w: 6, h: 0.06, fill: { color: C.teal }, line: { color: C.teal } });
  s.addText(subText, { x: 0.5, y: 3.95, w: 9, h: 1.4, fontSize: 14, color: C.lightBlue, fontFace: "Arial", align: "center", italic: true, wrap: true });
}

// Step process slide (numbered steps horizontally)
function processSlide(title, steps, accentColor) {
  const s = pres.addSlide();
  s.background = { color: C.cream };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.0, fill: { color: accentColor || C.teal }, line: { color: accentColor || C.teal } });
  s.addText(title, { x: 0.4, y: 0.08, w: 9.2, h: 0.85, fontSize: 22, color: C.white, bold: true, fontFace: "Arial", valign: "middle" });

  const n = steps.length;
  const bw = 9.0 / n;
  steps.forEach((step, i) => {
    const x = 0.5 + i * bw;
    const boxColor = i % 2 === 0 ? C.navy : C.teal;
    s.addShape(pres.ShapeType.rect, { x, y: 1.25, w: bw - 0.15, h: 3.9, fill: { color: boxColor }, line: { color: boxColor }, rounding: true });
    s.addText(`${i + 1}`, { x, y: 1.35, w: bw - 0.15, h: 0.6, fontSize: 22, color: C.gold, bold: true, fontFace: "Arial", align: "center" });
    s.addText(step.title, { x: x + 0.05, y: 1.9, w: bw - 0.2, h: 0.55, fontSize: 13, color: C.white, bold: true, fontFace: "Arial", align: "center", wrap: true });
    s.addText(step.body, { x: x + 0.05, y: 2.45, w: bw - 0.2, h: 2.5, fontSize: 11, color: C.lightBlue, fontFace: "Arial", align: "left", valign: "top", wrap: true });
  });
}

// Summary / table slide
function tableSlide(title, headers, rows, accentColor) {
  const s = pres.addSlide();
  s.background = { color: C.cream };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.0, fill: { color: accentColor || C.navy }, line: { color: accentColor || C.navy } });
  s.addText(title, { x: 0.4, y: 0.08, w: 9.2, h: 0.85, fontSize: 22, color: C.white, bold: true, fontFace: "Arial", valign: "middle" });

  const tableRows = [
    headers.map(h => ({ text: h, options: { bold: true, color: C.white, fill: C.teal, fontSize: 13, fontFace: "Arial", align: "center" } })),
    ...rows.map((row, ri) => row.map(cell => ({
      text: cell,
      options: { color: C.darkText, fill: ri % 2 === 0 ? C.white : C.lightBlue, fontSize: 12, fontFace: "Arial" }
    })))
  ];
  s.addTable(tableRows, { x: 0.3, y: 1.1, w: 9.4, h: 4.2, border: { pt: 0.5, color: "CCCCCC" }, rowH: 0.52 });
}

// Image-focus slide (image URL + caption + bullets)
function imageSlide(title, imgUrl, caption, bullets, accentColor) {
  const s = pres.addSlide();
  s.background = { color: C.cream };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.0, fill: { color: accentColor || C.teal }, line: { color: accentColor || C.teal } });
  s.addText(title, { x: 0.4, y: 0.08, w: 9.2, h: 0.85, fontSize: 22, color: C.white, bold: true, fontFace: "Arial", valign: "middle" });
  // image
  s.addImage({ path: imgUrl, x: 0.3, y: 1.1, w: 4.5, h: 3.5 });
  s.addText(caption, { x: 0.3, y: 4.6, w: 4.5, h: 0.8, fontSize: 10, color: C.midGrey, italic: true, fontFace: "Arial", wrap: true });
  // bullets right
  const items = bullets.map((b, i) => ({ text: b, options: { bullet: true, breakLine: i < bullets.length - 1, fontSize: 13.5, color: C.darkText, fontFace: "Arial" } }));
  s.addText(items, { x: 5.1, y: 1.15, w: 4.6, h: 4.3, valign: "top" });
}

// ── OUTLINE slide ─────────────────────────────────────────────────────────
function outlineSlide() {
  const s = pres.addSlide();
  s.background = { color: C.navy };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.15, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText("LECTURE OUTLINE", { x: 0.5, y: 0.3, w: 9, h: 0.5, fontSize: 14, color: C.gold, bold: true, charSpacing: 4, fontFace: "Arial" });
  const topics = [
    ["01", "Ovarian Folliculogenesis & Hormonal Control"],
    ["02", "The Process of Ovulation"],
    ["03", "Corpus Luteum – Formation & Function"],
    ["04", "Oocyte Transport"],
    ["05", "Capacitation & The Acrosome Reaction"],
    ["06", "Fertilisation – Phases 1, 2 & 3"],
    ["07", "Results & Significance of Fertilisation"],
    ["08", "Cleavage, Morula & Blastocyst Formation"],
    ["09", "Implantation – Attachment & Invasion"],
    ["10", "Trophoblast Differentiation & hCG"],
    ["11", "Clinical Correlates & Key Facts"],
  ];
  topics.forEach(([num, text], i) => {
    const y = 0.9 + i * 0.42;
    s.addShape(pres.ShapeType.rect, { x: 0.4, y: y + 0.03, w: 0.5, h: 0.32, fill: { color: C.teal }, line: { color: C.teal } });
    s.addText(num, { x: 0.4, y: y + 0.02, w: 0.5, h: 0.32, fontSize: 11, color: C.gold, bold: true, fontFace: "Arial", align: "center" });
    s.addText(text, { x: 1.05, y: y, w: 8.5, h: 0.4, fontSize: 14, color: C.white, fontFace: "Arial", valign: "middle" });
  });
}

// =============================================================
// BUILD ALL SLIDES
// =============================================================

// 1. Title
titleSlide();

// 2. Outline
outlineSlide();

// ── SECTION 1: FOLLICULOGENESIS ──────────────────────────────────────────
sectionDivider(1, "Ovarian Folliculogenesis", "Hormonal control & follicle maturation", C.navy);

contentSlide("The Menstrual (Ovarian) Cycle – Overview", [
  "**Average cycle length: 28 days (range 21–35 days)**",
  "Divided into: Follicular phase (days 1–14) and Luteal phase (days 15–28)",
  "Follicular phase: FSH drives follicle development; rising oestrogen feeds back on pituitary",
  "Mid-cycle: LH surge triggers ovulation (day 14 in a 28-day cycle)",
  "Luteal phase: Corpus luteum secretes progesterone to prepare endometrium",
  "Progesterone causes the 'secretory' / progestational endometrial stage",
  "If no fertilisation → corpus luteum regresses → progesterone falls → menstruation",
], C.navy);

contentSlide("Follicle Development – From Primordial to Graafian", [
  "**Primordial follicle:** primary oocyte arrested in prophase I of meiosis + single layer of flat follicular cells",
  "**Primary follicle:** follicular cells become cuboidal granulosa cells; zona pellucida forms around oocyte",
  "**Secondary (antral) follicle:** fluid-filled antrum develops; cumulus oophorus forms; theca layers differentiate",
  "**Theca interna:** vascular & glandular – secretes androgens → converted to oestrogen by granulosa cells",
  "**Theca externa:** capsule-like, contains smooth muscle",
  "Angiogenesis factor from thecal cells promotes vascular growth for nutritive support",
  "**Mature vesicular (Graafian) follicle:** up to 25 mm diameter; oocyte in cumulus oophorus; ready to ovulate",
], C.teal);

contentSlide("Hormonal Regulation of Folliculogenesis", [
  "**FSH (Follicle-Stimulating Hormone):** from anterior pituitary; drives early follicle development and oestrogen production",
  "**LH (Luteinising Hormone):** required for final maturation of vesicular follicle",
  "**Oestrogen:** produced by follicular + thecal cells; rises steeply before LH surge",
  "High oestrogen → positive feedback → triggers mid-cycle LH surge",
  "**LH surge causes three key events:**",
  "__Completion of meiosis I by primary oocyte (→ secondary oocyte + polar body)",
  "__Initiation of meiosis II (arrested at metaphase II until fertilisation)",
  "__Luteinisation of follicular stromal cells + follicular rupture (ovulation)",
], C.navy);

// ── SECTION 2: OVULATION ─────────────────────────────────────────────────
sectionDivider(2, "Ovulation", "LH surge, follicle rupture & oocyte release", C.teal);

contentSlide("Mechanism of Ovulation", [
  "**Timing:** occurs 24–36 hours after the LH peak (12–24 h in some texts)",
  "LH surge → rapid growth of Graafian follicle → creates cystic bulge on ovarian surface",
  "**Stigma:** small avascular spot appears at the apex of the bulge",
  "LH → ↑ collagenase activity → digestion of collagen fibres surrounding follicle",
  "↑ Prostaglandin levels (from LH surge) → smooth muscle contractions in ovarian wall",
  "Intrafollicular pressure + smooth muscle contraction of theca externa → rupture at stigma",
  "**Secondary oocyte** (with cumulus oophorus cells = corona radiata) is expelled into peritoneal cavity",
  "Oocyte is arrested in metaphase II – meiosis II only completed if fertilisation occurs",
], C.teal);

keyFactSlide(
  "KEY CLINICAL FACT — OVULATION",
  "Ovulation occurs ~14 days BEFORE the next expected period\n(not always day 14 of the cycle)",
  "Mittelschmerz = mid-cycle lower abdominal pain at ovulation.\nBasal body temperature rises ~0.2–0.5°C after ovulation (progesterone effect).\nLH surge detection is the basis of ovulation predictor kits.",
  C.teal
);

// ── SECTION 3: CORPUS LUTEUM ─────────────────────────────────────────────
sectionDivider(3, "Corpus Luteum", "Formation, function & fate", C.green);

twoColSlide(
  "Corpus Luteum – Formation & Fate",
  "If NO Fertilisation",
  [
    "Granulosa + theca interna cells vascularised after follicle rupture",
    "Under LH influence: cells acquire yellowish lipid pigment → lutein cells",
    "Corpus luteum secretes OESTROGEN + PROGESTERONE",
    "Reaches max development ~9 days after ovulation",
    "If no fertilisation: luteolysis (degeneration) occurs",
    "Leaves corpus albicans (white fibrous scar)",
    "↓ Progesterone → endometrial breakdown → menstruation",
  ],
  "If Fertilisation OCCURS",
  [
    "Developing embryo secretes human Chorionic Gonadotrophin (hCG)",
    "hCG is structurally similar to LH → rescues corpus luteum from luteolysis",
    "Corpus luteum becomes corpus luteum of PREGNANCY",
    "Continues to secrete oestrogen + progesterone for first 8–10 weeks",
    "Placenta takes over steroidogenesis at ~10–12 weeks (luteo-placental shift)",
    "This is the basis of the pregnancy test – detecting hCG in urine/serum",
  ],
  C.green
);

// ── SECTION 4: OOCYTE TRANSPORT ──────────────────────────────────────────
sectionDivider(4, "Oocyte Transport", "Fimbriae, cilia & the uterine tube journey", C.purple);

contentSlide("Oocyte Transport to the Uterine Tube", [
  "**Before ovulation:** fimbriae of the uterine tube sweep over the ovarian surface rhythmically",
  "Oocyte (surrounded by cumulus oophorus cells = corona radiata) is swept into the tube",
  "Once inside, cumulus cells withdraw cytoplasmic processes from zona pellucida and lose contact",
  "**Two propulsive forces in the tube:**",
  "__Peristaltic muscular contractions of the tubal wall",
  "__Cilia on the tubal mucosal epithelium beat towards uterus",
  "Rate of transport regulated by oestrogen (fast) and progesterone (slow) – ensures timing for fertilisation",
  "**Site of fertilisation:** ampullary region of uterine tube (widest part, closest to ovary)",
  "Fertilised oocyte reaches the uterine cavity in approximately 3–4 days",
  "Unfertilised oocyte degenerates within 12–24 hours if not fertilised",
], C.purple);

// ── SECTION 5: CAPACITATION & ACROSOME REACTION ──────────────────────────
sectionDivider(5, "Capacitation & The Acrosome Reaction", "Preparing sperm for fertilisation", C.navy);

twoColSlide(
  "Sperm Journey & Preparation for Fertilisation",
  "Capacitation",
  [
    "200–300 million sperm deposited in vagina",
    "Only ~1% enter cervix; even fewer reach ampulla",
    "Sperm travel cervix → uterus → tube in 30 min to 6 hours",
    "Capacitation = ~7 hours of conditioning in female reproductive tract",
    "Occurs mainly through epithelial interactions in the uterine tube",
    "Glycoprotein coat & seminal plasma proteins removed from acrosomal plasma membrane",
    "Only capacitated sperm can penetrate corona radiata",
    "Sperm become less motile at isthmus; reactivated at ovulation by cumulus chemoattractants",
  ],
  "Acrosome Reaction",
  [
    "Occurs AFTER binding to zona pellucida",
    "Zona pellucida proteins (ZP3) induce the reaction",
    "Acrosomal cap fuses with sperm plasma membrane",
    "Releases hydrolytic enzymes: acrosin + trypsin-like substances",
    "These enzymes digest a path through the zona pellucida",
    "Essential for sperm to penetrate zona and reach oocyte membrane",
    "Only ONE sperm ultimately fuses with the oocyte",
  ],
  C.navy
);

// ── SECTION 6: FERTILISATION ─────────────────────────────────────────────
sectionDivider(6, "Fertilisation", "The three phases of gamete fusion", C.teal);

processSlide(
  "Fertilisation – Three Phases (Langman's Embryology)",
  [
    { title: "Phase 1\nCorona Radiata Penetration", body: "Capacitated sperm penetrate the cumulus cells surrounding the oocyte.\n\nEnzymes (hyaluronidase) released from acrosome break down the intercellular matrix.\n\nTubal secretions also assist.\n\nMany sperm required for this phase." },
    { title: "Phase 2\nZona Pellucida Penetration", body: "Acrosomal enzymes (acrosin + trypsin-like) digest zona pellucida.\n\nZP3 protein on zona pellucida induces & sustains acrosome reaction.\n\nSperm head presses against oocyte membrane.\n\nMultiple sperm may reach here, but only one penetrates." },
    { title: "Phase 3\nOocyte & Sperm Membrane Fusion", body: "Sperm plasma membrane fuses with oocyte plasma membrane.\n\nSperm head enters oocyte cytoplasm; sperm tail left behind.\n\nCortical reaction: cortical granules release enzymes → zona reaction → zona becomes impenetrable.\n\nPrevents polyspermy." },
  ],
  C.teal
);

contentSlide("Events After Membrane Fusion", [
  "**Completion of Meiosis II:** oocyte completes second meiotic division → mature oocyte (ootid) + second polar body",
  "**Formation of female pronucleus:** maternal chromosomes in vesicular nucleus",
  "**Formation of male pronucleus:** sperm nucleus decondenses and enlarges",
  "**Syngamy:** male and female pronuclei come together in the centre of the cell",
  "**Zygote:** chromosomes from both pronuclei intermingle on first cleavage spindle",
  "Zygote contains 46 chromosomes (23 from each parent) – diploid restored",
  "**Zona reaction / cortical reaction:** prevents additional sperm penetration (block to polyspermy)",
  "**Metabolic activation:** initiates cleavage (cell division) of the zygote",
], C.teal);

// ── SECTION 7: RESULTS OF FERTILISATION ─────────────────────────────────
sectionDivider(7, "Results & Significance of Fertilisation", "What fertilisation achieves", C.gold + "44");

tableSlide(
  "Results of Fertilisation – Summary Table",
  ["Result", "Mechanism", "Significance"],
  [
    ["Completion of meiosis II", "Sperm penetration triggers release of oocyte meiotic arrest", "Mature ootid formed + 2nd polar body expelled"],
    ["Restoration of diploidy (46 chromosomes)", "Male (23) + female (23) pronuclei combine", "Full genome for new individual restored"],
    ["Determination of chromosomal sex", "X-bearing sperm → 46,XX (female); Y-bearing sperm → 46,XY (male)", "Sex determined at fertilisation, not later"],
    ["Genetic variation", "Independent assortment + crossing over during meiosis", "Unique combination of parental genes"],
    ["Initiation of cleavage", "Metabolic activation of ootid", "Zygote begins to divide and develop"],
    ["Block to polyspermy", "Cortical reaction → zona reaction", "Only one sperm fertilises the oocyte"],
  ],
  C.navy
);

// ── SECTION 8: CLEAVAGE, MORULA & BLASTOCYST ─────────────────────────────
sectionDivider(8, "Cleavage, Morula & Blastocyst", "From zygote to implantation-ready embryo", C.teal);

contentSlide("Cleavage – Early Cell Division", [
  "**Cleavage:** rapid mitotic divisions of zygote; cells (blastomeres) get progressively smaller",
  "**2-cell stage:** ~30 hours after fertilisation",
  "**4-cell stage:** ~40 hours",
  "**12–16 cell stage (morula):** ~3 days after fertilisation",
  "Blastomeres surrounded by zona pellucida throughout cleavage",
  "**Compaction (8-cell stage):** blastomeres maximise cell-cell contact via gap junctions",
  "Compaction segregates inner cells (ICM) from outer cells (trophoblast)",
  "**Inner cell mass (ICM / embryoblast):** gives rise to the embryo proper and all fetal tissues",
  "**Outer cell mass (trophoblast):** gives rise to placenta and extraembryonic membranes",
], C.teal);

contentSlide("Blastocyst Formation & Zona Hatching", [
  "**~Day 4:** morula enters uterine cavity",
  "Fluid penetrates zona pellucida into intercellular spaces of ICM → coalesce into single cavity",
  "**Blastocele:** fluid-filled cavity of the blastocyst",
  "**Blastocyst structure:** embryoblast (ICM) at one pole + trophoblast (flattened epithelial wall)",
  "**~Day 5:** zona pellucida disappears ('hatching') – essential for implantation to begin",
  "**~Day 6:** trophoblastic cells over embryoblast pole begin to penetrate uterine epithelium",
  "**L-selectin** on trophoblast cells + carbohydrate receptors on uterine epithelium mediate initial 'capture'",
  "Integrins (trophoblast) + extracellular matrix molecules (laminin, fibronectin) enable deeper attachment and invasion",
], C.teal);

// ── SECTION 9: IMPLANTATION ──────────────────────────────────────────────
sectionDivider(9, "Implantation", "Blastocyst attachment, invasion & decidualisation", C.navy);

contentSlide("Window of Implantation & Endometrial Receptivity", [
  "**Window of implantation:** days 20–24 of a 28-day cycle (LH+7 to LH+11)",
  "Endometrium in secretory phase under progesterone influence",
  "**Pinopodia** (surface projections of luminal epithelium) appear during the window – marker of receptivity",
  "**Key molecular mediators of attachment:**",
  "__HB-EGF (heparin-binding EGF-like growth factor): expressed by endometrial epithelium (pinopodia); receptors ErbB1 & ErbB4 on polar trophoblast – CRITICAL for blastocyst attachment",
  "__LIF (Leukemia Inhibitory Factor): signals to both blastocyst and endometrial epithelium",
  "__HOXA10 / HOXA11: homeobox transcription factors in endometrial stroma",
  "__WNT signalling pathway in endometrial epithelium",
  "Both E2 (oestradiol) and P4 (progesterone) necessary for HB-EGF and receptor expression",
], C.navy);

contentSlide("Stages of Implantation", [
  "**1. Apposition:** loose, reversible initial contact of blastocyst with endometrium (~day 6)",
  "**2. Adhesion:** firmer attachment via L-selectin ('capture'), integrins, laminin, and fibronectin",
  "**3. Invasion:** trophoblast cells actively invade into endometrial stroma",
  "Polar trophectoderm (TE) overlying ICM → first cells to contact and invade endometrium",
  "Syncytiotrophoblast (multinucleated, noninvasive) covers placenta for transport & endocrine function",
  "Primitive syncytium (multinucleated invasive cells) secretes enzymes that break down decidual cells & matrix",
  "**Lacunae** form between decidual cells → coalesce into intervillous space",
  "Lacunae filled with endometrial glandular secretions → histiotrophic nutrition for early embryo",
  "By end of week 1: blastocyst superficially implanted in endometrial stroma",
], C.navy);

contentSlide("Trophoblast Differentiation After Implantation", [
  "**CTB (Cytotrophoblast):** stem/progenitor cells; self-renewing",
  "CTB differentiates down two pathways:",
  "**1. Syncytiotrophoblast (STB):** non-invasive multinucleated cells covering placental surface; handles transport + endocrine function (produces hCG, progesterone, oestrogen)",
  "**2. Extravillous Cytotrophoblast (EVT):** highly invasive; anchors gestation; remodels maternal spiral arteries",
  "EVT differentiation occurs under physiologic hypoxia (<30 mmHg, <3% O₂) in first trimester",
  "HIF (hypoxia-inducible factor) stabilised under low O₂ → key role in EVT specification",
  "**Spiral artery remodelling:** EVT converts muscular spiral arteries → wide, low-resistance vessels for placental blood supply",
  "Defective spiral artery remodelling → pre-eclampsia, FGR",
], C.navy);

keyFactSlide(
  "KEY FACT — hCG & THE PREGNANCY TEST",
  "hCG is produced by the syncytiotrophoblast from ~day 8–9 post-fertilisation\nDoubles every 48–72 hours in early pregnancy\nDetectable in urine from ~10–14 days post-ovulation",
  "hCG rescues the corpus luteum from luteolysis by mimicking LH.\nPeak hCG levels: ~8–10 weeks of gestation, then falls.\nBeta-hCG is the basis of all urine and serum pregnancy tests.\nMolar pregnancy & choriocarcinoma → markedly elevated hCG.",
  C.teal
);

// ── SECTION 10: CLINICAL CORRELATES ─────────────────────────────────────
sectionDivider(10, "Clinical Correlates", "Key facts for clinical practice", C.red);

twoColSlide(
  "Clinical Correlates – Ovulation & Fertilisation",
  "Ovulation Disorders",
  [
    "Anovulation: most common cause of irregular cycles & infertility",
    "Cause: low FSH/LH (e.g. hypothalamic amenorrhoea, hyperprolactinaemia, PCOS)",
    "Clomiphene citrate or letrozole: induces ovulation by blocking oestrogen negative feedback",
    "Risk: multiple follicles → multiple pregnancy (10× higher than general population)",
    "OPK (ovulation predictor kit): detects LH surge in urine",
    "Basal body temperature (BBT) chart: post-ovulatory rise in BBT confirms ovulation",
  ],
  "Fertilisation Failure & ART",
  [
    "Tubal occlusion (e.g. post-PID): prevents sperm-oocyte meeting in ampulla",
    "IVF (In Vitro Fertilisation): oocytes retrieved, fertilised in lab, embryo transferred to uterus",
    "First IVF baby: Louise Brown, 1978 (Edwards & Steptoe)",
    "ICSI (Intracytoplasmic Sperm Injection): single sperm injected directly into oocyte",
    "Polyspermy in IVF: prevented by zona reaction + careful insemination technique",
    "Sex selection possible via preimplantation genetic testing (PGT)",
  ],
  C.red
);

twoColSlide(
  "Clinical Correlates – Implantation & Early Pregnancy",
  "Failed / Abnormal Implantation",
  [
    "Ectopic pregnancy: implantation outside uterine cavity (95% tubal)",
    "Risk factors: PID, tubal surgery, previous ectopic, IVF",
    "Most common site: ampulla of uterine tube",
    "Implantation in tube → rupture → haemorrhage → surgical emergency",
    "Defective endometrial receptivity: uterine polyps, fibroids, adhesions (Asherman's syndrome)",
    "Recurrent implantation failure (RIF) in IVF cycles: antiphospholipid syndrome, uterine anomalies",
  ],
  "Pre-eclampsia & Trophoblast",
  [
    "Defective EVT invasion → incomplete spiral artery remodelling",
    "→ High-resistance placental circulation → ischaemia/hypoxia",
    "→ Release of anti-angiogenic factors (sFlt-1, sEng) into maternal circulation",
    "→ Systemic endothelial dysfunction → hypertension + proteinuria",
    "HB-EGF defects also associated with abnormal implantation & pre-eclampsia",
    "Aspirin 75–150 mg from 12 weeks: reduces pre-eclampsia risk in high-risk patients",
  ],
  C.red
);

// ── SECTION 11: COMPREHENSIVE SUMMARY ─────────────────────────────────────
sectionDivider(11, "Comprehensive Timeline", "From LH surge to implantation – day by day", C.teal);

tableSlide(
  "Day-by-Day Timeline: Ovulation to Implantation",
  ["Day / Timing", "Event", "Key Detail"],
  [
    ["Day 0 (LH surge)", "LH surge peaks", "Meiosis I completed; meiosis II initiated (arrested metaphase II)"],
    ["Day 0 + 12–36 h", "Ovulation", "Secondary oocyte + corona radiata expelled; stigma ruptures"],
    ["Day 0 → Day 1", "Oocyte in uterine tube", "Fimbriae sweep oocyte in; propelled to ampulla by cilia + peristalsis"],
    ["Day 1 (within 24 h)", "Fertilisation (if sperm present)", "Phases 1–3; cortical reaction; pronuclei form; zygote created"],
    ["Day 1.5 (~30 h)", "2-cell stage", "First cleavage division"],
    ["Day 2 (~40 h)", "4-cell stage", "Second cleavage division"],
    ["Day 3", "Morula (12–16 cells)", "Compaction occurs; ICM vs trophoblast specified"],
    ["Day 4", "Blastocyst forms; enters uterus", "Blastocele cavity forms; zona pellucida begins to thin"],
    ["Day 5", "Zona hatching", "Zona pellucida disappears; blastocyst free in uterine cavity"],
    ["Day 6–7", "Implantation begins", "Polar trophectoderm adheres to endometrium; L-selectin capture"],
    ["Day 8–9", "Invasion & hCG production", "Syncytiotrophoblast invades; hCG detectable; corpus luteum rescued"],
    ["End of Week 2", "Deep implantation complete", "Lacunae form; histiotrophic nutrition begins; bilaminar disc"],
  ],
  C.navy
);

// ── FINAL REVIEW SLIDE ────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.background = { color: C.navy };
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.18, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText("KEY POINTS TO REMEMBER", { x: 0.5, y: 0.3, w: 9, h: 0.5, fontSize: 14, color: C.gold, bold: true, charSpacing: 4, fontFace: "Arial" });
  const keyPoints = [
    "LH surge → ovulation 24–36 h later; secondary oocyte arrested in metaphase II",
    "Fertilisation occurs in the AMPULLA; sperm must undergo capacitation (~7 h) + acrosome reaction first",
    "Cortical reaction after sperm entry → zona reaction → block to polyspermy",
    "Fertilisation restores diploidy (46 chromosomes) and determines chromosomal sex",
    "Morula → blastocyst: ICM = embryo; trophoblast = placenta",
    "Zona hatching (~day 5) is prerequisite for implantation",
    "Window of implantation: days 20–24; HB-EGF is the critical attachment molecule",
    "hCG from syncytiotrophoblast rescues corpus luteum → maintains progesterone for first trimester",
    "Defective EVT spiral artery remodelling underlies pre-eclampsia pathophysiology",
  ];
  const items = keyPoints.map((b, i) => ({ text: b, options: { bullet: true, breakLine: i < keyPoints.length - 1, fontSize: 14, color: C.white, fontFace: "Arial" } }));
  s.addText(items, { x: 0.5, y: 0.9, w: 9, h: 4.5, valign: "top" });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.44, w: 10, h: 0.18, fill: { color: C.teal }, line: { color: C.teal } });
  s.addText("Sources: Langman's Medical Embryology | The Developing Human (Moore) | Creasy & Resnik's MFM | Guyton & Hall Physiology | Histology Ross & Pawlina", {
    x: 0.3, y: 5.2, w: 9.4, h: 0.25, fontSize: 9, color: "AAAACC", fontFace: "Arial", align: "center"
  });
}

// =============================================================
// WRITE FILE
// =============================================================
pres.writeFile({ fileName: "/home/daytona/workspace/ovulation-fertilisation-pptx/Ovulation_Fertilisation_Implantation.pptx" })
  .then(() => console.log("Done!"))
  .catch(e => { console.error(e); process.exit(1); });
Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.