Natural reworded openers and exam formatting on finished quizzes
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 29s

Checked against a quiz generated from four neuro and mental health
lectures:
- The opener rewording now asks for the plain, active openings a real
  exam uses and rules out inverted sentences ("Two days of vomiting have
  left a client weak", "An order is received for…"). It steps in only
  above 30% of a quiz, since the exam's most common opener was 24%.
- The finished set is tidied after review: plain stems, no closing
  period on phrase choices, and first-person choices to a "Which
  statement…" question in quotes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-16 15:17:24 -07:00
parent 39a85ebb0c
commit f738fbe7be
5 changed files with 68 additions and 15 deletions

View file

@ -22,8 +22,11 @@ export function stemOpener(stem: string): string {
.join(' ');
}
/** Openers used by more than a quarter of the questions (at least 4), and which of them to reword. */
export function repeatedOpeners(questions: Pick<DraftQuestion, 'stem' | 'type'>[], share = 0.25): { opener: string; example: string; total: number; reword: number[] }[] {
/**
* Openers used by more than 30% of the questions (at least 4), and which of them to reword. A real
* course exam's most common opener ("A 4-year-old…") covered about a quarter of its items.
*/
export function repeatedOpeners(questions: Pick<DraftQuestion, 'stem' | 'type'>[], share = 0.3): { opener: string; example: string; total: number; reword: number[] }[] {
if (questions.length < 8) return [];
const allow = Math.max(3, Math.floor(questions.length * share));
const groups = new Map<string, number[]>();
@ -71,11 +74,12 @@ export function acceptRewording(original: Pick<DraftQuestion, 'stem' | 'type'>,
return next;
}
const OPENER_SYSTEM = `You edit NCLEX-style questions for variety. Too many stems in this quiz open the same way. Reword only the opening of each listed stem so the quiz reads like a real exam, where items open in many ways, for example:
- with the nurse's situation: "The nurse is caring for…", "While reviewing the morning laboratory results, the nurse notes…", "After receiving report, the nurse…"
- with the setting or role: "On a medical-surgical unit…", "In the emergency department…", "The charge nurse is making assignments…", "During discharge teaching…"
- with a finding, order or report: "A client with heart failure reports…", "The health care provider prescribes…", "Two hours after surgery, a client's…"
- or with the question itself when the scenario is short: "Which finding in a client receiving… requires immediate follow-up?"
const OPENER_SYSTEM = `You edit NCLEX-style questions for variety. Too many stems in this quiz open the same way. Reword only the opening of each listed stem so the quiz reads like a real nursing exam. Real exam items open in plain, natural ways, for example:
- with the nurse: "The nurse is caring for a client who…", "The nurse is teaching a client who…", "The nurse assesses a client…", "The nurse receives report on…"
- with a family member, when the original involves one: "The parent of a client with…", "A family member asks…"
- with a time or event: "Two days after a stroke, a client…", "Immediately after a seizure, the client…", "During discharge teaching, a client…"
- with the question itself when the situation is short: "Which finding in a client receiving phenytoin requires immediate follow-up?"
Keep each stem the way a person writing an exam would say it, in the active voice with a person as the subject. Never invert the sentence to put a symptom, order or test result first ("Two days of vomiting have left a client weak", "An order is received for…", "Assessment of a client reveals…", "Expressive aphasia affects a client…", "Clear fluid is noted in…"). Do not add a setting or details that are not in the original.
Openings with the client's age are fine elsewhere in the quiz; these stems just need a different opening from the repeated one.
Keep everything the question tests: the same client facts, every number exactly (age, vital signs, lab values, doses), the same question asked, and an ending of "Select all that apply." where there is one. Include the age only where it is in the original, but it need not come first. Use "client", never "patient". Make the listed stems open differently from one another too. Call submit_stems once with every listed question.`;