Write quiz questions in the style of the course's real exams
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 30s
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 30s
Modelled on a real 50-question course exam and the V1 question set: - Stems are short and plain (usually 15-30 words, one paragraph, no scene-setting), end in the exam's own question phrasing, and about a third may ask directly about a fact the nurse uses. - Bold and underline are stripped from generated stems (plainStem). - Choices are concise and parallel: a term or value, a 4-12 word action or finding, or quoted speech; explanations go in "why" (1-2 sentences). - Distractors come from related facts in the material. - Select-all items have 6 choices with 2-5 correct, mostly 3 or 4. - The planner varies the kind of question instead of setting and role. - Review, proofread, "improve questions" and the outside-chatbot instructions follow the same rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5fef59b07b
commit
39a85ebb0c
6 changed files with 55 additions and 21 deletions
|
|
@ -322,6 +322,11 @@ export type GenerateRequest = z.infer<typeof generateRequestSchema>;
|
|||
|
||||
/* ------------------------------ prompts ------------------------------ */
|
||||
|
||||
/** Exam stems carry no emphasis: bold or underlined words in a generated stem become plain text. */
|
||||
export function plainStem(stem: string): string {
|
||||
return stem.replace(/\*\*(\S(?:[^*]*?\S)?)\*\*/g, '$1').replace(/__(\S(?:[^_]*?\S)?)__/g, '$1');
|
||||
}
|
||||
|
||||
/** How a rationale is laid out, so it reads at a glance instead of as one block of text. */
|
||||
const RATIONALE_FORMAT =
|
||||
'Format the rationale in Markdown for quick reading: one bold sentence with the key point, then 2 to 4 short bullet points (one idea each, such as the principle or framework, the physiology or drug action, the safety point). No long paragraphs, and do not repeat the choices\' "why" text, which is shown beside each choice.';
|
||||
|
|
@ -339,16 +344,16 @@ const QUESTION_SCHEMA = {
|
|||
enum: ['single', 'multi', 'numeric'],
|
||||
description: 'single = one correct answer; multi = select all that apply; numeric = a calculation the student answers by typing the number',
|
||||
},
|
||||
stem: { type: 'string', description: 'The question. Markdown allowed.' },
|
||||
stem: { type: 'string', description: 'The question, usually 15 to 30 words: a short situation with only the cues needed, then one direct question. One plain paragraph, no bold or italics.' },
|
||||
options: {
|
||||
type: 'array',
|
||||
description: 'Answer choices. For numeric questions: exactly one option, the correct answer with its unit (e.g. "12.5 mL"), correct = true, and "why" showing the calculation.',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
text: { type: 'string' },
|
||||
text: { type: 'string', description: 'The choice only, parallel to the other choices: a term or value, a short action or finding (about 4 to 12 words), or one or two sentences of quoted speech. No explanation tacked on.' },
|
||||
correct: { type: 'boolean' },
|
||||
why: { type: 'string', description: 'One sentence on why this choice is right or wrong.' },
|
||||
why: { type: 'string', description: '1 or 2 sentences: the specific clinical reason this choice is right or wrong.' },
|
||||
},
|
||||
required: ['text', 'correct', 'why'],
|
||||
},
|
||||
|
|
@ -397,16 +402,18 @@ const MATH_LEVELS: Record<string, string> = {
|
|||
|
||||
const NUMERIC_RULE = `- Only write calculation items when the source material itself involves calculations (or the request asks for medication math), and never more than the number allowed in the request. Calculation items (dosages, weight-based doses, IV and drip rates, conversions, intake and output) use type "numeric": the student types the number instead of choosing. Give exactly one option, the correct answer with its unit (for example "12.5 mL"), marked correct, with "why" showing the working. State the unit and the rounding rule in the stem ("Round to the nearest tenth."). Only the number is checked, so the student may leave out the unit.`;
|
||||
|
||||
const NCLEX_RULES = `Write NCLEX-style (Next Generation NCLEX) items:
|
||||
- Test clinical judgment at the application and analysis level: recognise cues, analyse, prioritise, choose and evaluate actions. Avoid pure recall.
|
||||
- Give a brief, realistic client scenario containing only relevant data (age, diagnosis, key findings, vital signs or lab values with units).
|
||||
- Vary how stems open, as a real exam does: with the client ("A 68-year-old client…", "A client with…"), the nurse's situation ("The nurse is caring for…", "After receiving report…"), the setting or role ("In the emergency department…", "The charge nurse…", "During discharge teaching…"), a finding, order or report ("A client with heart failure reports…", "The health care provider prescribes…"), or the question itself. Mix these so no single opening dominates the quiz.
|
||||
- Ask one clear question. Use priority wording where it fits (first, best, most important, requires immediate follow-up) and build it on a real framework: ABCs, Maslow, the nursing process, acute before chronic, unstable before stable, safety, least invasive first.
|
||||
const NCLEX_RULES = `Write NCLEX-style (Next Generation NCLEX) items that read like a real nursing exam:
|
||||
- Test clinical judgment: recognise cues, analyse, prioritise, choose and evaluate actions. Most questions are a short client situation that needs a decision, and many need two cues put together (a symptom plus a lab value, a risk factor plus a presentation, a treatment plus an adverse finding). About a third may ask directly about a fact the nurse uses, still framed around the nurse or client ("Which injection site is most appropriate?", "Which laboratory results should the nurse expect?", "Which mechanism of heat loss is the nurse most concerned about?"). Mix assessment, expected findings, complications, diagnostic results, treatment decisions, safety, teaching and priority questions.
|
||||
- Keep stems short and plain, usually 15 to 30 words: at most one or two sentences of situation with only the cues needed (the age, diagnosis, key findings, vital signs or lab values with units), then one direct question. Leave out scene-setting that does not change the answer (the unit, the clinic, the time of day). Typical questions: "Which action should the nurse take first?", "What is the nurse's priority action?", "Which finding requires follow-up?", "Which finding should the nurse report immediately?", "Which response by the nurse is best?", "Which statement by the parent indicates a need for further teaching?", "Which statement shows understanding?", "Which nursing action is contraindicated?", "Which client should the nurse assess first?", "Which instructions should the nurse include? Select all that apply." Write the stem as one paragraph, with no bold, italics or other emphasis.
|
||||
- Vary how stems open, as a real exam does: with the client ("A 4-year-old with…", "A client with…", "A newborn…"), the nurse ("The nurse is teaching…", "The nurse receives report on four clients."), a family member ("The parent of a…", "A parent calls the clinic…"), a time or event ("Two weeks after…", "Immediately after…", "During a well-child visit…"), or the question itself ("Which finding in a 2-day-old newborn…"). Mix these so no single opening dominates the quiz.
|
||||
- Use priority wording where it fits (first, best, most important, requires immediate follow-up) and build it on a real framework: ABCs, Maslow, the nursing process, acute before chronic, unstable before stable, safety, least invasive first.
|
||||
- Cover the client-needs areas where the material allows: safe and effective care, pharmacology, physiological adaptation, reduction of risk, health promotion, psychosocial integrity, delegation and assignment.
|
||||
- Every distractor must be plausible to a student with partial knowledge and wrong for a specific reason. Keep choices parallel in grammar and similar in length. Never use "all of the above" or "none of the above". Do not give the answer away through wording or length.
|
||||
- Multiple-choice items have exactly 4 choices with exactly one best answer. Select-all-that-apply items have 5 or 6 choices with 2 to 5 correct, and the stem ends with "Select all that apply."
|
||||
- Use generic drug names. Use current, standard practice.
|
||||
- The rationale teaches: state why the correct answer is correct, name the principle behind it, and give each choice its own "why".
|
||||
- Answer choices are concise and parallel. When the question asks for a term, site, tool, value or condition, each choice is just that ("Conduction", "Vastus lateralis", "FLACC scale", "0.8 mL"). Actions and findings are short phrases, usually 4 to 12 words ("Place the child in a knee-chest position", "Cola-colored urine and puffy eyelids"). Statements by a client or parent, and responses by the nurse, are quoted speech of one or two sentences. Do not tack explanations onto action or finding choices ("…so that…", "…to prevent…"): the explanation belongs in "why". A quoted nurse response may give its reason ("…because the symptoms can come back"), but then the other responses do too, so a reason never marks the answer. Write every choice of a question in the same form and about the same length, and do not let the correct one stand out as the longest, most specific or most qualified.
|
||||
- Build distractors from related facts in the same material: a similar condition, a different stage or time frame, another test or drug, an intervention that is right for a related condition, a common misconception. Each must be plausible to a student with partial knowledge and wrong for a specific reason, and at least two in every multiple-choice item need real content knowledge to rule out. No absurd, obviously unsafe or simple opposite-action choices, and never invent terms, conditions or procedures. Never use "all of the above" or "none of the above". Do not give the answer away through wording or length.
|
||||
- Multiple-choice items have exactly 4 choices with exactly one best answer. Select-all-that-apply items have exactly 6 choices with 2 to 5 correct, most often 3 or 4, and always at least one plausible wrong choice. The stem ends with "Select all that apply."
|
||||
- Never refer to the source in a stem or choice ("according to the study guide", "listed in the slides", "in the material"): every question reads as a standalone clinical question.
|
||||
- Use clear, direct exam language, without contractions or a conversational tone (quoted client statements may sound natural). Use generic drug names and current, standard practice.
|
||||
- Give each choice a "why" of 1 or 2 sentences with the specific clinical reason that choice is right or wrong, about that choice's own content rather than a restatement of the correct answer.
|
||||
- ${RATIONALE_FORMAT}
|
||||
${NUMERIC_RULE}`;
|
||||
|
||||
|
|
@ -944,6 +951,7 @@ async function runGeneration(app: AppContext, draftId: string, req: GenerateRequ
|
|||
`Topic labels must be broad (the main condition, drug class or body system, 1-3 words), not subtypes or aspects.${topicsSoFar.length ? ` Reuse these existing topics wherever they fit: ${topicsSoFar.slice(0, 40).join(', ')}.` : ''}`,
|
||||
difficulty === 'mixed' ? 'Mix difficulty: mostly medium, with a few easy and a few hard.' : `Difficulty: ${difficulty}.`,
|
||||
'Vary how the stems open (the client and their age, the nurse\'s situation, the setting, a finding or order, or the question itself) so no single opening dominates.',
|
||||
'Keep stems short and plain (usually 15 to 30 words, no bold, no scene-setting that does not change the answer), and keep answer choices concise and parallel with no explanation tacked on: the reasons go in each choice\'s "why".',
|
||||
draft.kind === 'quiz' ? openerAdvice(draft.questions) : '',
|
||||
sources.groups.length > 0 ? 'Spread the questions across the excerpts instead of clustering on one. Set "source" to the id of the excerpt each question is based on.' : '',
|
||||
req.source.deckId ? 'Turn the flashcards into questions: use each card\'s answer as the correct choice and write distractors that a student could confuse with it.' : '',
|
||||
|
|
@ -987,6 +995,7 @@ async function runGeneration(app: AppContext, draftId: string, req: GenerateRequ
|
|||
}
|
||||
if ('stem' in item && item.type === 'numeric' && (numericLeft === 0 || numericCount() >= numericCap)) continue; // over the calculation allowance; a top-up replaces it
|
||||
if (math && (!('stem' in item) || item.type !== 'numeric')) continue; // a math batch keeps only calculations
|
||||
if ('stem' in item) item.stem = plainStem(item.stem);
|
||||
if ('stem' in item && item.type !== 'numeric') item.options = shuffleOptions(item.options);
|
||||
seen.add(k);
|
||||
(items() as (DraftQuestion | DraftCard)[]).push(item);
|
||||
|
|
@ -1012,7 +1021,7 @@ async function runGeneration(app: AppContext, draftId: string, req: GenerateRequ
|
|||
task: 'plan',
|
||||
purpose: 'planning questions',
|
||||
modelId: req.modelId,
|
||||
system: `${baseSystem(db, req, hasSources)}\n\nYou plan NCLEX-style quizzes. List distinct angles, one per question: each names the client situation and the single decision or fact it tests, in one line (for example "Continuous IV heparin, aPTT 3x control with gum bleeding: first action"). No two angles may test the same decision, fact or teaching point, even in a different scenario. Vary the framing too: the setting (unit, clinic, home, emergency department), the nurse's role (bedside, charge nurse, delegating, teaching) and what prompts the question (a finding, a report, an order, a call light). Spread them over the client-needs areas the material supports (pharmacology, safety, prioritisation, delegation, teaching, lab values, complications, psychosocial). When the material is short, vary the situations and the area tested rather than repeating its points.`,
|
||||
system: `${baseSystem(db, req, hasSources)}\n\nYou plan NCLEX-style quizzes. List distinct angles, one per question: each names the client situation and the single decision or fact it tests, in one line (for example "Continuous IV heparin, aPTT 3x control with gum bleeding: first action"). No two angles may test the same decision, fact or teaching point, even in a different scenario. Vary the kind of question too: a priority action, a finding to report or follow up, an expected finding or lab result, teaching and what a statement shows about understanding, a nurse's response, which client to see first, delegation, and some direct questions about a fact the nurse uses (the right site, tool, test or precaution). Vary what prompts the question (a finding, a report, an order, a family member's question) without adding scene-setting that does not change the answer. Spread them over the client-needs areas the material supports (pharmacology, safety, prioritisation, delegation, teaching, lab values, complications, psychosocial). When the material is short, vary the situations and the area tested rather than repeating its points.`,
|
||||
messages: [
|
||||
{
|
||||
role: 'user',
|
||||
|
|
@ -1428,8 +1437,9 @@ export function startImprove(app: AppContext, input: z.input<typeof improveReque
|
|||
const system = `You are an expert nursing educator and item writer reviewing existing exam questions.
|
||||
Improve each question while keeping what it tests and its correct answer(s) unless the keyed answer is factually wrong (if so, fix it and say so at the start of the rationale).
|
||||
- Make the stem clear, complete and free of clues; fix grammar. Vary how the stems open so they do not all start the same way.
|
||||
- Replace weak or implausible distractors; keep choices parallel and similar in length; remove "all/none of the above".
|
||||
- Write a teaching rationale, and give every choice a one-sentence "why". ${RATIONALE_FORMAT}
|
||||
- Replace weak or implausible distractors with related facts a student could confuse; keep choices concise, parallel and similar in length (a term or value when the question asks for one, otherwise a short action or finding, or one or two sentences of quoted speech), with no explanation tacked on; remove "all/none of the above". Select-all items have 6 choices with 2 to 5 correct.
|
||||
- Keep stems short and plain: only the cues needed and one direct question, with no bold or other emphasis.
|
||||
- Write a teaching rationale, and give every choice a "why" of 1 or 2 sentences with its specific clinical reason. ${RATIONALE_FORMAT}
|
||||
- Keep the same question type unless it is clearly wrong for the content. Set a short topic label and a difficulty.
|
||||
Return the questions in the same order, one output question per input question.${req.instructions ? `\n\nAdditional instructions: ${req.instructions}` : ''}`;
|
||||
for (let i = 0; i < questions.length; i += 8) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue