wrs audiometry report templte

Asking for Preferences
Reading File
Reading File
Running Command

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

Running Command

mkdir -p /home/daytona/workspace/wrs-audiometry

Writing File

~/wrs-audiometry/create_wrs_template.js

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

// ─── Helpers ───────────────────────────────────────────────────────────────────

const DARK_BLUE  = "1F4E79";
const MID_BLUE   = "2E75B6";
const LIGHT_BLUE = "D6E4F0";
const HEADER_BG  = "2E75B6";
const WHITE      = "FFFFFF";
const LIGHT_GREY = "F2F2F2";
const BORDER_COL = "A0A0A0";

function hRule() {
  return new Paragraph({
    border: { bottom: { color: MID_BLUE, space: 1, style: BorderStyle.SINGLE, size: 12 } },
    spacing: { after: 80 }
  });
}

function sectionHeading(text) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, color: DARK_BLUE, size: 26, font: "Arial" })],
    spacing: { before: 200, after: 80 },
    shading: { type: ShadingType.SOLID, color: LIGHT_BLUE, fill: LIGHT_BLUE },
    indent: { left: 120 }
  });
}

function labelValue(label, value = "_____________________________") {
  return new Paragraph({
    children: [
      new TextRun({ text: `${label}: `, bold: true, size: 22, font: "Arial" }),
      new TextRun({ text: value, size: 22, font: "Arial", underline: { type: UnderlineType.SINGLE } })
    ],
    spacing: { after: 60 }
  });
}

function inlineFields(pairs) {
  // pairs = [{label, width}]
  const runs = [];
  pairs.forEach((p, i) => {
    runs.push(new TextRun({ text: `${p.label}: `, bold: true, size: 22, font: "Arial" }));
    runs.push(new TextRun({ text: "_".repeat(p.width || 20), size: 22, font: "Arial" }));
    if (i < pairs.length - 1) runs.push(new TextRun({ text: "     ", size: 22, font: "Arial" }));
  });
  return new Paragraph({ children: runs, spacing: { after: 60 } });
}

function noteText(text) {
  return new Paragraph({
    children: [new TextRun({ text, size: 20, font: "Arial", italics: true, color: "555555" })],
    spacing: { after: 40 }
  });
}

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

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

function tableCell(text, opts = {}) {
  const { bold = false, center = false, bg = null, color = "000000", size = 20 } = opts;
  const shading = bg ? { type: ShadingType.SOLID, color: bg, fill: bg } : undefined;
  return new TableCell({
    children: [new Paragraph({
      alignment: center ? AlignmentType.CENTER : AlignmentType.LEFT,
      children: [new TextRun({ text, bold, color, size, font: "Arial" })],
    })],
    shading,
    margins: { top: 80, bottom: 80, left: 120, right: 120 },
    verticalAlign: VerticalAlign.CENTER
  });
}

function headerCell(text) {
  return tableCell(text, { bold: true, center: true, bg: HEADER_BG, color: WHITE, size: 20 });
}

// ─── WRS Score Table ───────────────────────────────────────────────────────────
// Columns: Presentation Level (dB HL), Ear, List Used, # Correct / 50, WRS %,
//          With/Without HA, Notes

function wrsScoreTable() {
  const cols = [
    "Presentation Level (dB HL)",
    "Ear",
    "Word List Used",
    "# Correct / 50",
    "WRS (%)",
    "Condition",
    "Notes"
  ];
  const colWidths = [1500, 900, 1400, 1400, 900, 1300, 1600];

  const headerRow = new TableRow({
    tableHeader: true,
    children: cols.map(c => headerCell(c))
  });

  // 6 data rows
  const dataRows = Array.from({ length: 6 }).map(() =>
    new TableRow({
      children: cols.map((_, i) => tableCell("", { bg: i % 2 === 0 ? WHITE : LIGHT_GREY }))
    })
  );

  return new Table({
    rows: [headerRow, ...dataRows],
    columnWidths: colWidths,
    width: { size: 9000, type: WidthType.DXA },
    borders: {
      top:    { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      left:   { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      right:  { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      insideH:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      insideV:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
    }
  });
}

// ─── PTA Summary Table ─────────────────────────────────────────────────────────
function ptaSummaryTable() {
  const rows = [
    ["Measure", "Right Ear (dB HL)", "Left Ear (dB HL)", "Right HA", "Left HA"],
    ["PTA (500, 1k, 2k Hz)", "", "", "", ""],
    ["PTA (1k, 2k, 4k Hz)", "", "", "", ""],
    ["SRT (dB HL)", "", "", "", ""],
    ["MCL (dB HL)", "", "", "", ""],
    ["UCL (dB HL)", "", "", "", ""],
  ];

  return new Table({
    rows: rows.map((row, ri) =>
      new TableRow({
        tableHeader: ri === 0,
        children: row.map((cell, ci) =>
          ri === 0
            ? headerCell(cell)
            : tableCell(cell, { bg: ci === 0 ? LIGHT_BLUE : (ri % 2 === 0 ? LIGHT_GREY : WHITE), bold: ci === 0 })
        )
      })
    ),
    columnWidths: [2200, 1700, 1700, 1700, 1700],
    width: { size: 9000, type: WidthType.DXA },
    borders: {
      top:    { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      left:   { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      right:  { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      insideH:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      insideV:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
    }
  });
}

// ─── WRS Interpretation Table ──────────────────────────────────────────────────
function interpretationReferenceTable() {
  const rows = [
    ["WRS (%)", "Interpretation"],
    ["90 - 100%", "Normal / Slight Difficulty"],
    ["78 - 88%", "Mild Difficulty"],
    ["66 - 76%", "Moderate Difficulty"],
    ["54 - 64%", "Poor"],
    ["< 54%",    "Very Poor"],
  ];

  const bgMap = ["E2EFDA", "E2EFDA", "FFEB9C", "FFEB9C", "FFD7D7", "FFD7D7"];

  return new Table({
    rows: rows.map((row, ri) =>
      new TableRow({
        tableHeader: ri === 0,
        children: row.map((cell, ci) =>
          ri === 0
            ? headerCell(cell)
            : tableCell(cell, { bg: bgMap[ri], bold: ci === 0, center: false, size: 20 })
        )
      })
    ),
    columnWidths: [1800, 3200],
    width: { size: 5000, type: WidthType.DXA },
    borders: {
      top:    { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      left:   { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      right:  { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      insideH:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
      insideV:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
    }
  });
}

// ─── Document ──────────────────────────────────────────────────────────────────

const doc = new Document({
  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: DARK_BLUE },
        paragraph: { spacing: { before: 240, after: 120 }, outlineLevel: 0 }
      },
      {
        id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 26, bold: true, font: "Arial", color: MID_BLUE },
        paragraph: { spacing: { before: 180, after: 80 }, outlineLevel: 1 }
      }
    ]
  },

  sections: [{
    properties: {
      page: {
        margin: { top: 720, bottom: 720, left: 900, right: 900 },
        size: { width: 12240, height: 15840 }
      }
    },

    headers: {
      default: new Header({
        children: [
          new Table({
            rows: [new TableRow({
              children: [
                new TableCell({
                  children: [new Paragraph({
                    children: [new TextRun({ text: "AUDIOLOGY DEPARTMENT", bold: true, size: 26, color: WHITE, font: "Arial" })],
                  })],
                  shading: { type: ShadingType.SOLID, color: DARK_BLUE, fill: DARK_BLUE },
                  margins: { top: 80, bottom: 80, left: 200, right: 200 },
                  width: { size: 5000, type: WidthType.DXA }
                }),
                new TableCell({
                  children: [new Paragraph({
                    alignment: AlignmentType.CENTER,
                    children: [new TextRun({ text: "WORD RECOGNITION SCORE (WRS) REPORT", bold: true, size: 24, color: WHITE, font: "Arial" })],
                  })],
                  shading: { type: ShadingType.SOLID, color: DARK_BLUE, fill: DARK_BLUE },
                  margins: { top: 80, bottom: 80, left: 200, right: 200 },
                  width: { size: 4000, type: WidthType.DXA }
                }),
                new TableCell({
                  children: [
                    new Paragraph({
                      alignment: AlignmentType.RIGHT,
                      children: [new TextRun({ text: "CONFIDENTIAL", bold: true, size: 18, color: "FFD700", font: "Arial" })],
                    }),
                  ],
                  shading: { type: ShadingType.SOLID, color: DARK_BLUE, fill: DARK_BLUE },
                  margins: { top: 80, bottom: 80, left: 200, right: 200 },
                  width: { size: 2500, type: WidthType.DXA }
                })
              ]
            })],
            columnWidths: [5000, 4000, 2500],
            width: { size: 11500, type: WidthType.DXA },
            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 } }
          })
        ]
      })
    },

    footers: {
      default: new Footer({
        children: [
          new Paragraph({
            alignment: AlignmentType.CENTER,
            children: [
              new TextRun({ text: "Audiologist Signature: ______________________    Date: ____________    Page ", size: 18, font: "Arial", color: "555555" }),
              new PageNumber(),
              new TextRun({ text: "    |  This report is for clinical use only. Retain in patient medical record.", size: 18, font: "Arial", color: "555555" })
            ],
            border: { top: { style: BorderStyle.SINGLE, size: 4, color: MID_BLUE, space: 4 } }
          })
        ]
      })
    },

    children: [

      // ── PATIENT INFORMATION ────────────────────────────────────────────────
      spacer(80),
      sectionHeading("  PATIENT INFORMATION"),
      spacer(40),

      new Table({
        rows: [
          new TableRow({ children: [
            tableCell("Patient Name:", { bold: true, size: 20 }),
            tableCell("", {}),
            tableCell("Date of Birth:", { bold: true, size: 20 }),
            tableCell("", {}),
            tableCell("Sex:", { bold: true, size: 20 }),
            tableCell("", {}),
          ]}),
          new TableRow({ children: [
            tableCell("MRN / Patient ID:", { bold: true, size: 20 }),
            tableCell("", {}),
            tableCell("Referral Source:", { bold: true, size: 20 }),
            tableCell("", {}),
            tableCell("Date of Test:", { bold: true, size: 20 }),
            tableCell("", {}),
          ]}),
          new TableRow({ children: [
            tableCell("Audiologist:", { bold: true, size: 20 }),
            tableCell("", {}),
            tableCell("Facility / Clinic:", { bold: true, size: 20 }),
            tableCell("", {}),
            tableCell("Test Room:", { bold: true, size: 20 }),
            tableCell("", {}),
          ]}),
        ],
        columnWidths: [1800, 2600, 1800, 2200, 1100, 1500],
        width: { size: 11000, type: WidthType.DXA },
        borders: {
          top:    { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          left:   { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          right:  { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideH:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideV:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
        }
      }),

      spacer(80),

      // ── RELEVANT HISTORY ──────────────────────────────────────────────────
      sectionHeading("  RELEVANT HISTORY & REFERRAL REASON"),
      spacer(40),
      inlineFields([{ label: "Chief Complaint", width: 40 }, { label: "Duration", width: 18 }]),
      inlineFields([{ label: "Previous Audiological Testing", width: 20 }, { label: "Hearing Aid Use", width: 20 }]),
      inlineFields([{ label: "Noise Exposure", width: 20 }, { label: "Tinnitus", width: 15 }, { label: "Vertigo", width: 15 }]),
      labelValue("Other Relevant History"),

      spacer(60),

      // ── TEST CONDITIONS ───────────────────────────────────────────────────
      sectionHeading("  TEST CONDITIONS"),
      spacer(40),
      new Table({
        rows: [
          new TableRow({ children: [
            tableCell("Transducer Type:", { bold: true, size: 20 }),
            tableCell("  Insert earphones    Supra-aural headphones    Sound-field    Bone conductor", { size: 20 }),
          ]}),
          new TableRow({ children: [
            tableCell("Masking Used:", { bold: true, size: 20 }),
            tableCell("  Yes   No     Masking Level: ___ dB HL (Right)    ___ dB HL (Left)", { size: 20 }),
          ]}),
          new TableRow({ children: [
            tableCell("Word List Material:", { bold: true, size: 20 }),
            tableCell("  NU-6    W-22    CID W-22    HINT    BKB    Other: _____________", { size: 20 }),
          ]}),
          new TableRow({ children: [
            tableCell("Presentation Mode:", { bold: true, size: 20 }),
            tableCell("  Recorded (specify): ___________________    Live voice    Monitored live voice", { size: 20 }),
          ]}),
          new TableRow({ children: [
            tableCell("Response Mode:", { bold: true, size: 20 }),
            tableCell("  Open-set verbal    Written    Pointing (closed set)    Other: ____________", { size: 20 }),
          ]}),
          new TableRow({ children: [
            tableCell("Testing Condition:", { bold: true, size: 20 }),
            tableCell("  Unaided    Aided (HA)    Aided (CI)    Binaural    Other: ______________", { size: 20 }),
          ]}),
          new TableRow({ children: [
            tableCell("Calibration Date:", { bold: true, size: 20 }),
            tableCell("  _____________     Equipment Model: _________________________________", { size: 20 }),
          ]}),
        ],
        columnWidths: [2400, 8600],
        width: { size: 11000, type: WidthType.DXA },
        borders: {
          top:    { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          left:   { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          right:  { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideH:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideV:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
        }
      }),

      spacer(80),

      // ── AUDIOMETRIC SUMMARY ───────────────────────────────────────────────
      sectionHeading("  AUDIOMETRIC SUMMARY (PTA / SRT / MCL / UCL)"),
      noteText("  Fill in threshold values (dB HL). PTA = pure-tone average."),
      spacer(40),
      ptaSummaryTable(),

      spacer(80),

      // ── WRS RESULTS ───────────────────────────────────────────────────────
      sectionHeading("  WORD RECOGNITION SCORE (WRS) RESULTS"),
      noteText("  Enter results for each test run. Add rows as needed. Condition: UA = Unaided, HA = Hearing Aid, CI = Cochlear Implant."),
      spacer(40),
      wrsScoreTable(),

      spacer(40),
      noteText("  * WRS (%) = (# correct / total words presented) x 100.  Standard list = 50 words (half-list = 25 words)."),
      noteText("  * Performance-Intensity (PI) Function: if rollover suspected, test at multiple levels above SRT."),

      spacer(80),

      // ── ROLLOVER INDEX ───────────────────────────────────────────────────
      sectionHeading("  ROLLOVER INDEX (if applicable)"),
      spacer(40),
      new Table({
        rows: [
          new TableRow({ children: [
            headerCell(""),
            headerCell("Right Ear"),
            headerCell("Left Ear"),
          ]}),
          new TableRow({ children: [
            tableCell("WRS Max (%)", { bold: true, bg: LIGHT_BLUE }),
            tableCell("", {}),
            tableCell("", {}),
          ]}),
          new TableRow({ children: [
            tableCell("WRS at Higher Level (%)", { bold: true, bg: LIGHT_BLUE }),
            tableCell("", {}),
            tableCell("", {}),
          ]}),
          new TableRow({ children: [
            tableCell("Rollover Index (RI)", { bold: true, bg: LIGHT_BLUE }),
            tableCell("", {}),
            tableCell("", {}),
          ]}),
          new TableRow({ children: [
            tableCell("Interpretation", { bold: true, bg: LIGHT_BLUE }),
            tableCell("  Normal (<0.45)    Abnormal (>=0.45)", { size: 20 }),
            tableCell("  Normal (<0.45)    Abnormal (>=0.45)", { size: 20 }),
          ]}),
        ],
        columnWidths: [3000, 4000, 4000],
        width: { size: 11000, type: WidthType.DXA },
        borders: {
          top:    { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          left:   { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          right:  { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideH:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideV:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
        }
      }),
      noteText("  RI = (WRS max - WRS at high level) / WRS max.  RI >= 0.45 suggests retrocochlear pathology."),

      spacer(80),

      // ── INTERPRETATION GUIDE ──────────────────────────────────────────────
      sectionHeading("  INTERPRETATION REFERENCE"),
      spacer(40),
      interpretationReferenceTable(),

      spacer(80),

      // ── CLINICAL INTERPRETATION ───────────────────────────────────────────
      sectionHeading("  CLINICAL INTERPRETATION"),
      spacer(40),
      inlineFields([
        { label: "Right Ear WRS", width: 12 },
        { label: "Interpretation", width: 30 }
      ]),
      inlineFields([
        { label: "Left Ear WRS", width: 12 },
        { label: "Interpretation", width: 30 }
      ]),
      spacer(40),
      bodyText("Summary / Clinical Comments:"),
      new Paragraph({
        children: [new TextRun({ text: "", size: 22, font: "Arial" })],
        border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL, space: 40 } },
        spacing: { before: 60, after: 120 }
      }),
      new Paragraph({
        children: [new TextRun({ text: "", size: 22, font: "Arial" })],
        border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL, space: 40 } },
        spacing: { before: 60, after: 120 }
      }),
      new Paragraph({
        children: [new TextRun({ text: "", size: 22, font: "Arial" })],
        border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL, space: 40 } },
        spacing: { before: 60, after: 120 }
      }),

      spacer(80),

      // ── RECOMMENDATIONS ───────────────────────────────────────────────────
      sectionHeading("  RECOMMENDATIONS"),
      spacer(40),
      new Table({
        rows: [
          new TableRow({ children: [
            headerCell("Recommendation"),
            headerCell("Details / Referral"),
            headerCell("Priority"),
          ]}),
          ...[
            "Hearing Aid Evaluation",
            "Cochlear Implant Evaluation",
            "ENT / Otology Referral",
            "Medical Management",
            "Aural Rehabilitation",
            "Repeat Audiological Evaluation",
            "Other"
          ].map((item, i) =>
            new TableRow({ children: [
              tableCell(`  ${item}`, { bold: false, bg: i % 2 === 0 ? WHITE : LIGHT_GREY }),
              tableCell("", { bg: i % 2 === 0 ? WHITE : LIGHT_GREY }),
              tableCell("  High / Medium / Low", { bg: i % 2 === 0 ? WHITE : LIGHT_GREY, size: 18 }),
            ]})
          )
        ],
        columnWidths: [3200, 5800, 2000],
        width: { size: 11000, type: WidthType.DXA },
        borders: {
          top:    { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          left:   { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          right:  { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideH:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideV:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
        }
      }),

      spacer(80),

      // ── NEXT APPOINTMENT ─────────────────────────────────────────────────
      sectionHeading("  FOLLOW-UP & SIGN-OFF"),
      spacer(40),
      inlineFields([
        { label: "Next Appointment Date", width: 20 },
        { label: "Appointment Type", width: 30 }
      ]),
      spacer(60),

      new Table({
        rows: [
          new TableRow({ children: [
            tableCell("Audiologist Name (Print):", { bold: true }),
            tableCell("", {}),
            tableCell("Registration / License No.:", { bold: true }),
            tableCell("", {}),
          ]}),
          new TableRow({ children: [
            tableCell("Signature:", { bold: true }),
            tableCell("", {}),
            tableCell("Date:", { bold: true }),
            tableCell("", {}),
          ]}),
          new TableRow({ children: [
            tableCell("Report Reviewed By:", { bold: true }),
            tableCell("", {}),
            tableCell("Designation:", { bold: true }),
            tableCell("", {}),
          ]}),
        ],
        columnWidths: [2200, 3300, 2200, 3300],
        width: { size: 11000, type: WidthType.DXA },
        borders: {
          top:    { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          left:   { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          right:  { style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideH:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
          insideV:{ style: BorderStyle.SINGLE, size: 4, color: BORDER_COL },
        }
      }),

      spacer(60),
      noteText("  This report was generated on: __________________ and forms part of the patient's permanent audiological record."),

    ]
  }]
});

Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync("/home/daytona/workspace/wrs-audiometry/WRS_Audiometry_Report_Template.docx", buf);
  console.log("SUCCESS: file written");
}).catch(err => {
  console.error("ERROR:", err);
  process.exit(1);
});
Running Command

cd /home/daytona/workspace/wrs-audiometry && node create_wrs_template.js

Editing File

~/wrs-audiometry/create_wrs_template.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/wrs-audiometry/create_wrs_template.js'
Editing File

~/wrs-audiometry/create_wrs_template.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/wrs-audiometry/create_wrs_template.js'
Running Command

cd /home/daytona/workspace/wrs-audiometry && node create_wrs_template.js

Running Command

python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/wrs-audiometry/WRS_Audiometry_Report_Template.docx

Running Command

ls -lh /home/daytona/workspace/wrs-audiometry/WRS_Audiometry_Report_Template.docx && python3 -c " import zipfile, sys path = '/home/daytona/workspace/wrs-audiometry/WRS_Audiometry_Report_Template.docx' with zipfile.ZipFile(path) as z: names = z.namelist() print('Files inside .docx:', names[:10]) # Check word/document.xml exists and has content with z.open('word/document.xml') as f: content = f.read() print('document.xml size:', len(content), 'bytes') print('Valid XML start:', content[:50]) "

The file is valid (15KB, proper DOCX ZIP structure, 116KB of XML content). Here's your template:

WRS Audiometry Report Template

Word Document · DOCX


Here's what's included in the template:
Header
  • Department name, report title, and "CONFIDENTIAL" label in a blue banner across the top of every page.
Sections
SectionContents
Patient InformationName, DOB, Sex, MRN, Referral Source, Date, Audiologist, Clinic, Test Room
Relevant HistoryChief complaint, duration, previous testing, HA use, noise exposure, tinnitus, vertigo
Test ConditionsTransducer type, masking, word list material (NU-6/W-22/HINT/BKB), presentation mode, response mode, testing condition, calibration date
Audiometric SummaryPTA (500-1k-2k Hz and 1k-2k-4k Hz), SRT, MCL, UCL - right/left unaided and aided
WRS Results TablePresentation level, ear, word list, # correct/50, WRS%, condition (UA/HA/CI), notes - 6 rows
Rollover IndexWRS max, WRS at higher level, RI calculation, normal/abnormal cutoff (>=0.45)
Interpretation ReferenceColor-coded guide: Normal (90-100%), Mild (78-88%), Moderate (66-76%), Poor (54-64%), Very Poor (<54%)
Clinical InterpretationRight/left WRS labels + free-text comment lines
RecommendationsChecklist table: HA eval, CI eval, ENT referral, medical mgmt, aural rehab, follow-up, other - with priority column
Follow-up & Sign-offNext appointment, audiologist name/license/signature, reviewer sign-off
Footer - Signature line, date, and page number on every page.
This is a shared conversation. Sign in to Orris to start your own chat.