Make a prescription for a 47 year old lady who wanted to delay her period because of travelling

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

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not found"

Running Command

mkdir -p /home/daytona/workspace/prescription && ls /home/daytona/skills/docx/

Writing File

~/prescription/make_prescription.js

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

const today = new Date();
const dateStr = today.toLocaleDateString('en-GB', { day: '2-digit', month: 'long', year: 'numeric' });

// Helper: bold text run
const bold = (text, size = 24) => new TextRun({ text, bold: true, size });
const normal = (text, size = 22) => new TextRun({ text, size });
const italic = (text, size = 20) => new TextRun({ text, italics: true, size });

const noBorder = {
  top: { style: BorderStyle.NONE, size: 0, color: 'FFFFFF' },
  bottom: { style: BorderStyle.NONE, size: 0, color: 'FFFFFF' },
  left: { style: BorderStyle.NONE, size: 0, color: 'FFFFFF' },
  right: { style: BorderStyle.NONE, size: 0, color: 'FFFFFF' },
};

const thinBorder = {
  top: { style: BorderStyle.SINGLE, size: 6, color: '2E4057' },
  bottom: { style: BorderStyle.SINGLE, size: 6, color: '2E4057' },
  left: { style: BorderStyle.SINGLE, size: 6, color: '2E4057' },
  right: { style: BorderStyle.SINGLE, size: 6, color: '2E4057' },
};

const doc = new Document({
  sections: [{
    properties: {
      page: {
        margin: { top: 720, bottom: 720, left: 900, right: 900 }
      }
    },
    children: [

      // ─── HEADER: Clinic / Doctor Info ────────────────────────────────────
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 0 },
        children: [
          new TextRun({ text: 'Dr. Sarah Mitchell', bold: true, size: 32, color: '2E4057' }),
        ]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 0 },
        children: [
          new TextRun({ text: 'MBBS, MRCOG  |  Consultant Obstetrician & Gynaecologist', size: 20, color: '555555' }),
        ]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 0 },
        children: [
          new TextRun({ text: 'Reg. No.: GMC-1234567', size: 20, color: '555555' }),
        ]
      }),
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 40 },
        children: [
          new TextRun({ text: 'Harmony Women\'s Health Clinic  |  42 Park Lane, London W1K 2AB  |  Tel: 020 7946 0123', size: 18, color: '777777' }),
        ]
      }),

      // Divider line
      new Paragraph({
        border: {
          bottom: { style: BorderStyle.SINGLE, size: 12, color: '2E4057' }
        },
        spacing: { after: 200 },
        children: []
      }),

      // ─── PRESCRIPTION TITLE ──────────────────────────────────────────────
      new Paragraph({
        alignment: AlignmentType.CENTER,
        spacing: { after: 200 },
        children: [
          new TextRun({ text: 'PRESCRIPTION', bold: true, size: 30, color: '2E4057', underline: { type: UnderlineType.SINGLE } }),
        ]
      }),

      // ─── PATIENT DETAILS TABLE ───────────────────────────────────────────
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        borders: {
          top: { style: BorderStyle.NONE },
          bottom: { style: BorderStyle.NONE },
          left: { style: BorderStyle.NONE },
          right: { style: BorderStyle.NONE },
          insideH: { style: BorderStyle.NONE },
          insideV: { style: BorderStyle.NONE },
        },
        rows: [
          new TableRow({
            children: [
              new TableCell({
                borders: noBorder,
                width: { size: 50, type: WidthType.PERCENTAGE },
                children: [
                  new Paragraph({
                    children: [
                      bold('Patient Name: ', 22),
                      normal('Ms. Jane Doe', 22),
                    ]
                  })
                ]
              }),
              new TableCell({
                borders: noBorder,
                width: { size: 50, type: WidthType.PERCENTAGE },
                children: [
                  new Paragraph({
                    children: [
                      bold('Date: ', 22),
                      normal(dateStr, 22),
                    ]
                  })
                ]
              }),
            ]
          }),
          new TableRow({
            children: [
              new TableCell({
                borders: noBorder,
                children: [
                  new Paragraph({
                    children: [
                      bold('Age / Sex: ', 22),
                      normal('47 years / Female', 22),
                    ]
                  })
                ]
              }),
              new TableCell({
                borders: noBorder,
                children: [
                  new Paragraph({
                    children: [
                      bold('Weight: ', 22),
                      normal('__________ kg', 22),
                    ]
                  })
                ]
              }),
            ]
          }),
          new TableRow({
            children: [
              new TableCell({
                borders: noBorder,
                columnSpan: 2,
                children: [
                  new Paragraph({
                    children: [
                      bold('Address: ', 22),
                      normal('__________________________________________________', 22),
                    ]
                  })
                ]
              }),
            ]
          }),
        ]
      }),

      new Paragraph({ spacing: { after: 120 }, children: [] }),

      // Indication
      new Paragraph({
        spacing: { after: 80 },
        children: [
          bold('Indication: ', 22),
          normal('Menstrual postponement prior to travel', 22),
        ]
      }),

      // ─── Rx SECTION ──────────────────────────────────────────────────────
      new Paragraph({
        spacing: { after: 60, before: 100 },
        children: [
          new TextRun({ text: 'Rx', bold: true, size: 36, color: '2E4057' }),
        ]
      }),

      // Drug table
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        borders: {
          top: { style: BorderStyle.SINGLE, size: 6, color: '2E4057' },
          bottom: { style: BorderStyle.SINGLE, size: 6, color: '2E4057' },
          left: { style: BorderStyle.SINGLE, size: 6, color: '2E4057' },
          right: { style: BorderStyle.SINGLE, size: 6, color: '2E4057' },
          insideH: { style: BorderStyle.SINGLE, size: 4, color: 'AAAAAA' },
          insideV: { style: BorderStyle.SINGLE, size: 4, color: 'AAAAAA' },
        },
        rows: [
          // Header row
          new TableRow({
            tableHeader: true,
            children: [
              new TableCell({
                shading: { fill: '2E4057' },
                children: [new Paragraph({ children: [new TextRun({ text: '#', bold: true, size: 20, color: 'FFFFFF' })] })]
              }),
              new TableCell({
                shading: { fill: '2E4057' },
                children: [new Paragraph({ children: [new TextRun({ text: 'Drug', bold: true, size: 20, color: 'FFFFFF' })] })]
              }),
              new TableCell({
                shading: { fill: '2E4057' },
                children: [new Paragraph({ children: [new TextRun({ text: 'Dose', bold: true, size: 20, color: 'FFFFFF' })] })]
              }),
              new TableCell({
                shading: { fill: '2E4057' },
                children: [new Paragraph({ children: [new TextRun({ text: 'Route', bold: true, size: 20, color: 'FFFFFF' })] })]
              }),
              new TableCell({
                shading: { fill: '2E4057' },
                children: [new Paragraph({ children: [new TextRun({ text: 'Frequency', bold: true, size: 20, color: 'FFFFFF' })] })]
              }),
              new TableCell({
                shading: { fill: '2E4057' },
                children: [new Paragraph({ children: [new TextRun({ text: 'Duration / Instructions', bold: true, size: 20, color: 'FFFFFF' })] })]
              }),
            ]
          }),
          // Drug 1: Norethisterone
          new TableRow({
            children: [
              new TableCell({ children: [new Paragraph({ children: [normal('1', 20)] })] }),
              new TableCell({
                children: [
                  new Paragraph({ children: [new TextRun({ text: 'Norethisterone', bold: true, size: 20 })] }),
                  new Paragraph({ children: [italic('(5 mg tablets)', 18)] }),
                ]
              }),
              new TableCell({ children: [new Paragraph({ children: [normal('5 mg', 20)] })] }),
              new TableCell({ children: [new Paragraph({ children: [normal('Oral', 20)] })] }),
              new TableCell({ children: [new Paragraph({ children: [normal('Three times daily (TDS)', 20)] })] }),
              new TableCell({
                children: [
                  new Paragraph({ children: [normal('Start 3 days before expected period. Continue daily until period delay is no longer required. Stop when ready for period to resume (period typically begins 2–3 days after stopping).', 20)] })
                ]
              }),
            ]
          }),
        ]
      }),

      new Paragraph({ spacing: { after: 200 }, children: [] }),

      // ─── INSTRUCTIONS TO PATIENT ─────────────────────────────────────────
      new Paragraph({
        spacing: { after: 80 },
        children: [bold('Instructions to Patient:', 22)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        bullet: { level: 0 },
        children: [normal('Take norethisterone 5 mg three times a day, starting 3 days before your period is due.', 20)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        bullet: { level: 0 },
        children: [normal('Continue taking it throughout your travel period or for as long as you need to delay menstruation (safe for up to 10–14 days of use).', 20)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        bullet: { level: 0 },
        children: [normal('Your period will usually return within 2–3 days of stopping the tablets.', 20)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        bullet: { level: 0 },
        children: [normal('This is NOT a contraceptive — continue using your usual contraception if required.', 20)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        bullet: { level: 0 },
        children: [normal('If you experience nausea, bloating, breast tenderness, or breakthrough bleeding, contact your doctor.', 20)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        bullet: { level: 0 },
        children: [normal('Avoid use if you have a history of thrombosis (blood clots), liver disease, or unexplained vaginal bleeding.', 20)]
      }),

      new Paragraph({ spacing: { after: 200 }, children: [] }),

      // ─── CONTRAINDICATIONS / CAUTIONS NOTE ──────────────────────────────
      new Paragraph({
        spacing: { after: 80 },
        children: [bold('Clinical Notes:', 22)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        children: [normal('• Mechanism: Norethisterone (a synthetic progestogen) maintains the secretory endometrium, preventing shedding until withdrawn.', 20)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        children: [normal('• Contraindications: Active or history of thromboembolic disease, severe hepatic impairment, known/suspected hormone-dependent tumours, undiagnosed vaginal bleeding, pregnancy.', 20)]
      }),
      new Paragraph({
        spacing: { after: 60 },
        children: [normal('• Caution: Norethisterone is not a reliable contraceptive at this dose. Caution in patients with cardiovascular risk factors; long-haul flights increase DVT risk independently.', 20)]
      }),

      new Paragraph({ spacing: { after: 300 }, children: [] }),

      // ─── SIGNATURE BLOCK ─────────────────────────────────────────────────
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        borders: {
          top: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.NONE },
          left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE },
          insideH: { style: BorderStyle.NONE }, insideV: { style: BorderStyle.NONE },
        },
        rows: [
          new TableRow({
            children: [
              new TableCell({
                borders: noBorder,
                width: { size: 50, type: WidthType.PERCENTAGE },
                children: [
                  new Paragraph({ children: [normal('Next Review: _______________________', 20)] }),
                ]
              }),
              new TableCell({
                borders: noBorder,
                width: { size: 50, type: WidthType.PERCENTAGE },
                verticalAlign: VerticalAlign.BOTTOM,
                children: [
                  new Paragraph({
                    alignment: AlignmentType.RIGHT,
                    children: [normal('____________________________', 20)]
                  }),
                  new Paragraph({
                    alignment: AlignmentType.RIGHT,
                    children: [bold('Dr. Sarah Mitchell', 22)]
                  }),
                  new Paragraph({
                    alignment: AlignmentType.RIGHT,
                    children: [italic('Signature & Stamp', 18)]
                  }),
                ]
              }),
            ]
          })
        ]
      }),

      // Footer note
      new Paragraph({
        spacing: { before: 300 },
        border: { top: { style: BorderStyle.SINGLE, size: 4, color: 'AAAAAA' } },
        alignment: AlignmentType.CENTER,
        children: [
          new TextRun({ text: 'This prescription is valid for 30 days from the date of issue. For queries contact the clinic at the address above.', size: 16, italics: true, color: '888888' })
        ]
      }),

    ]
  }]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('/home/daytona/workspace/prescription/Menstrual_Delay_Prescription.docx', buffer);
  console.log('Done: Menstrual_Delay_Prescription.docx created');
});
Running Command

cd /home/daytona/workspace/prescription && node make_prescription.js 2>&1

Running Command

python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/prescription/Menstrual_Delay_Prescription.docx 2>&1

Running Command

ls -lh /home/daytona/workspace/prescription/Menstrual_Delay_Prescription.docx && python3 -c "import zipfile; z=zipfile.ZipFile('/home/daytona/workspace/prescription/Menstrual_Delay_Prescription.docx'); print('Valid ZIP/DOCX. Contents:', z.namelist()[:8])"

The file is valid. Here's the prescription:

Menstrual Delay Prescription

Word Document · DOCX


What the prescription contains

Drug prescribed: Norethisterone 5 mg tablets, three times daily (TDS), orally.
Rationale (from Berek & Novak's Gynecology): Norethisterone is a synthetic progestogen. Taken continuously, it maintains the secretory endometrium and prevents shedding. Menstruation typically resumes 2–3 days after stopping the tablets.
How to use:
  • Start taking it 3 days before the expected period date
  • Continue throughout travel (safe for up to 10–14 days)
  • Period returns 2–3 days after stopping
Key cautions included in the prescription:
  • Not a contraceptive at this dose — usual contraception should be continued
  • Avoid in: history of thromboembolic disease, liver disease, hormone-dependent tumours, undiagnosed vaginal bleeding, pregnancy
  • Long-haul travel independently increases DVT risk — advise the patient to stay hydrated and mobile on the flight
The document is formatted as a professional clinic prescription with patient details, doctor credentials, a drug table with dosing, patient instructions, clinical notes, and a signature block. Fill in the placeholder fields (patient name, weight, address) before use.
Disclaimer: This is a sample/template prescription for educational purposes. It must be reviewed, modified, and signed by a licensed clinician before being issued to any patient.
This is a shared conversation. Sign in to Orris to start your own chat.