export function peerReviewFormSurvey(form: FormTs) {
// Academic Peer Review Form - Comprehensive manuscript evaluation
// Demonstrates: MatrixQuestion x2, StarRating, RatingScale, RadioButton, conditional visibility, dynamic labels
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Academic Peer Review',
computedValue: () => 'Confidential manuscript evaluation for editorial consideration',
customStyles: {
background: 'linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%)',
color: 'white',
padding: '28px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Manuscript Information
// ============================================
const manuscriptSection = form.addSubform('manuscriptSection', {
title: 'Manuscript Details'
});
manuscriptSection.addRow(row => {
row.addTextbox('manuscriptId', {
label: 'Manuscript ID/Number',
placeholder: 'e.g., MS-2024-0123',
isRequired: true
}, '1fr');
row.addTextbox('manuscriptTitle', {
label: 'Manuscript Title',
placeholder: 'Full title of the manuscript',
isRequired: true
}, '2fr');
});
manuscriptSection.addRow(row => {
row.addDropdown('manuscriptType', {
label: 'Manuscript Type',
options: [
{ id: 'original', name: 'Original Research Article' },
{ id: 'review', name: 'Review Article' },
{ id: 'short', name: 'Short Communication/Letter' },
{ id: 'case', name: 'Case Study' },
{ id: 'meta', name: 'Meta-Analysis' },
{ id: 'perspective', name: 'Perspective/Commentary' },
{ id: 'methods', name: 'Methods Paper' }
],
isRequired: true
}, '1fr');
row.addDropdown('reviewRound', {
label: 'Review Round',
options: [
{ id: 'first', name: 'First Review' },
{ id: 'revision-1', name: 'First Revision' },
{ id: 'revision-2', name: 'Second Revision' },
{ id: 'final', name: 'Final Review' }
],
defaultValue: 'first'
}, '1fr');
});
// ============================================
// SECTION 2: Quality Assessment Matrix
// ============================================
const qualitySection = form.addSubform('qualitySection', {
title: 'Quality Assessment',
isVisible: () => manuscriptSection.textbox('manuscriptTitle')?.value()?.trim() !== ''
});
qualitySection.addRow(row => {
row.addTextPanel('qualityIntro', {
computedValue: () => 'Evaluate each aspect of the manuscript using the scale below:',
customStyles: {
backgroundColor: '#eff6ff',
padding: '12px',
borderRadius: '6px',
borderLeft: '4px solid #2563eb',
marginBottom: '12px'
}
});
});
qualitySection.addRow(row => {
row.addMatrixQuestion('qualityMatrix', {
label: 'Rate each quality criterion (1=Poor, 2=Below Average, 3=Average, 4=Good, 5=Excellent):',
rows: [
{ id: 'originality', label: 'Originality & Novelty', isRequired: true },
{ id: 'significance', label: 'Significance to the Field', isRequired: true },
{ id: 'methodology', label: 'Research Methodology', isRequired: true },
{ id: 'analysis', label: 'Data Analysis & Interpretation', isRequired: true },
{ id: 'writing', label: 'Writing Quality & Clarity', isRequired: true },
{ id: 'structure', label: 'Organization & Structure', isRequired: true },
{ id: 'references', label: 'Literature Review & References', isRequired: true },
{ id: 'ethics', label: 'Ethical Standards', isRequired: true }
],
columns: [
{ id: '1', label: '1' },
{ id: '2', label: '2' },
{ id: '3', label: '3' },
{ id: '4', label: '4' },
{ id: '5', label: '5' }
],
striped: true,
fullWidth: true
});
});
// ============================================
// SECTION 3: Section-by-Section Rating
// ============================================
const sectionsSection = form.addSubform('sectionsSection', {
title: 'Section Ratings',
isVisible: () => qualitySection.matrixQuestion('qualityMatrix')?.areAllRequiredRowsAnswered() === true
});
sectionsSection.addRow(row => {
row.addStarRating('abstractRating', {
label: 'Abstract',
tooltip: 'Clear, comprehensive, accurately reflects content',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('introRating', {
label: 'Introduction',
tooltip: 'Context, rationale, clear research question',
maxStars: 5,
size: 'md'
}, '1fr');
});
sectionsSection.addRow(row => {
row.addStarRating('methodsRating', {
label: 'Methods',
tooltip: 'Reproducible, appropriate, well-described',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('resultsRating', {
label: 'Results',
tooltip: 'Clear presentation, appropriate statistics',
maxStars: 5,
size: 'md'
}, '1fr');
});
sectionsSection.addRow(row => {
row.addStarRating('discussionRating', {
label: 'Discussion',
tooltip: 'Interpretation, limitations, implications',
maxStars: 5,
size: 'md'
}, '1fr');
row.addStarRating('figuresRating', {
label: 'Figures & Tables',
tooltip: 'Quality, clarity, necessity',
maxStars: 5,
size: 'md'
}, '1fr');
});
// ============================================
// SECTION 4: Identified Issues
// ============================================
const issuesSection = form.addSubform('issuesSection', {
title: 'Identified Issues',
isVisible: () => qualitySection.matrixQuestion('qualityMatrix')?.areAllRequiredRowsAnswered() === true
});
issuesSection.addRow(row => {
row.addCheckboxList('majorIssues', {
label: 'Major Issues Identified (select all that apply):',
options: [
{ id: 'flawed-design', name: 'Fundamental design flaws' },
{ id: 'insufficient-data', name: 'Insufficient data/sample size' },
{ id: 'wrong-analysis', name: 'Inappropriate statistical analysis' },
{ id: 'unsupported-claims', name: 'Claims not supported by data' },
{ id: 'missing-controls', name: 'Missing or inadequate controls' },
{ id: 'ethical-concerns', name: 'Ethical concerns' },
{ id: 'not-novel', name: 'Lack of novelty' },
{ id: 'scope', name: 'Outside journal scope' }
],
orientation: 'vertical'
});
});
issuesSection.addRow(row => {
row.addCheckboxList('minorIssues', {
label: 'Minor Issues Identified:',
options: [
{ id: 'typos', name: 'Typographical errors' },
{ id: 'unclear-sections', name: 'Unclear explanations' },
{ id: 'missing-refs', name: 'Missing important references' },
{ id: 'figure-quality', name: 'Figure quality issues' },
{ id: 'formatting', name: 'Formatting inconsistencies' },
{ id: 'jargon', name: 'Excessive jargon' }
],
orientation: 'vertical'
});
});
// ============================================
// SECTION 5: Comments for Authors
// ============================================
const authorSection = form.addSubform('authorSection', {
title: 'Comments for Authors',
isVisible: () => qualitySection.matrixQuestion('qualityMatrix')?.areAllRequiredRowsAnswered() === true,
customStyles: { backgroundColor: '#f0fdf4', padding: '16px', borderRadius: '8px' }
});
authorSection.addRow(row => {
row.addTextPanel('authorNote', {
computedValue: () => 'These comments will be shared with the manuscript authors. Please be constructive and specific.',
customStyles: {
backgroundColor: '#dcfce7',
padding: '10px',
borderRadius: '6px',
borderLeft: '3px solid #22c55e',
fontSize: '13px',
marginBottom: '12px'
}
});
});
authorSection.addRow(row => {
row.addTextarea('summaryComments', {
label: 'Summary of the Manuscript',
placeholder: 'Brief summary of the work and its main contributions (2-3 sentences)...',
rows: 3,
autoExpand: true,
isRequired: true
});
});
authorSection.addRow(row => {
row.addTextarea('strengthsComments', {
label: 'Strengths',
placeholder: 'What are the main strengths of this work?',
rows: 4,
autoExpand: true
});
});
authorSection.addRow(row => {
row.addTextarea('weaknessesComments', {
label: 'Weaknesses & Areas for Improvement',
placeholder: 'List major and minor concerns with specific suggestions...',
rows: 5,
autoExpand: true,
isRequired: true
});
});
authorSection.addRow(row => {
row.addTextarea('specificComments', {
label: 'Specific Comments (with page/line references)',
placeholder: 'Page 3, Line 12: The claim that... needs clarification.\nFigure 2: Consider adding...',
rows: 5,
autoExpand: true
});
});
// ============================================
// SECTION 6: Confidential Comments for Editor
// ============================================
const editorSection = form.addSubform('editorSection', {
title: 'Confidential Comments for Editor',
isVisible: () => qualitySection.matrixQuestion('qualityMatrix')?.areAllRequiredRowsAnswered() === true,
customStyles: { backgroundColor: '#fef2f2', padding: '16px', borderRadius: '8px' }
});
editorSection.addRow(row => {
row.addTextPanel('editorNote', {
computedValue: () => 'These comments are CONFIDENTIAL and will NOT be shared with the authors.',
customStyles: {
backgroundColor: '#fee2e2',
padding: '10px',
borderRadius: '6px',
borderLeft: '3px solid #ef4444',
fontSize: '13px',
fontWeight: 'bold',
marginBottom: '12px'
}
});
});
editorSection.addRow(row => {
row.addTextarea('editorComments', {
label: 'Confidential comments for the editor',
placeholder: 'Your candid assessment, ethical concerns, conflicts of interest, or issues you cannot share with authors...',
rows: 4,
autoExpand: true
});
});
editorSection.addRow(row => {
row.addRatingScale('confidenceLevel', {
preset: 'likert-5',
label: 'How confident are you in your assessment of this manuscript?',
lowLabel: 'Not confident (outside my expertise)',
highLabel: 'Very confident (my core expertise)'
});
});
// ============================================
// SECTION 7: Recommendation
// ============================================
const recommendSection = form.addSubform('recommendSection', {
title: 'Publication Recommendation',
isVisible: () => authorSection.textarea('summaryComments')?.value()?.trim() !== ''
});
recommendSection.addRow(row => {
row.addRadioButton('recommendation', {
label: 'What is your recommendation for this manuscript?',
options: [
{ id: 'accept', name: 'Accept - Publish as is' },
{ id: 'minor', name: 'Minor Revision - Accept pending minor changes' },
{ id: 'major', name: 'Major Revision - Significant changes required' },
{ id: 'reject-encourage', name: 'Reject with Encouragement - Not ready, but has potential' },
{ id: 'reject', name: 'Reject - Fundamental issues or not suitable' }
],
orientation: 'vertical',
isRequired: true
});
});
recommendSection.addRow(row => {
row.addEmojiRating('publicationPotential', {
label: 'Overall publication potential',
preset: 'custom',
emojis: [
{ id: 'low', emoji: 'đ', label: 'Needs Work' },
{ id: 'medium', emoji: 'đ', label: 'Promising' },
{ id: 'high', emoji: 'đ', label: 'Strong' },
{ id: 'excellent', emoji: 'đ', label: 'Outstanding' }
],
size: 'lg',
alignment: 'center',
isVisible: () => recommendSection.radioButton('recommendation')?.value() !== null
});
});
recommendSection.addRow(row => {
row.addTextarea('recommendationJustification', {
label: () => {
const rec = recommendSection.radioButton('recommendation')?.value();
if (rec === 'accept') return 'Briefly explain why this manuscript is ready for publication:';
if (rec === 'reject') return 'Briefly explain the main reasons for rejection:';
return 'Please justify your recommendation:';
},
placeholder: 'Provide a brief justification for your decision...',
rows: 3,
autoExpand: true,
isRequired: true,
isVisible: () => recommendSection.radioButton('recommendation')?.value() !== null
});
});
// ============================================
// REVIEW SUMMARY
// ============================================
const summarySection = form.addSubform('summarySection', {
title: 'Review Summary',
isVisible: () => recommendSection.radioButton('recommendation')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summary', {
computedValue: () => {
const title = manuscriptSection.textbox('manuscriptTitle')?.value();
const msId = manuscriptSection.textbox('manuscriptId')?.value();
const msType = manuscriptSection.dropdown('manuscriptType')?.value();
const recommendation = recommendSection.radioButton('recommendation')?.value();
const potential = recommendSection.emojiRating('publicationPotential')?.value();
const confidence = editorSection.ratingScale('confidenceLevel')?.value();
// Calculate average quality score
const qualityMatrix = qualitySection.matrixQuestion('qualityMatrix')?.value();
let avgQuality = 'N/A';
if (qualityMatrix) {
const values = Object.values(qualityMatrix).map(v => parseInt(v as string) || 0);
if (values.length > 0) {
avgQuality = (values.reduce((a, b) => a + b, 0) / values.length).toFixed(1);
}
}
// Get section ratings
const abstract = sectionsSection.starRating('abstractRating')?.value() || 0;
const intro = sectionsSection.starRating('introRating')?.value() || 0;
const methods = sectionsSection.starRating('methodsRating')?.value() || 0;
const results = sectionsSection.starRating('resultsRating')?.value() || 0;
const discussion = sectionsSection.starRating('discussionRating')?.value() || 0;
const figures = sectionsSection.starRating('figuresRating')?.value() || 0;
const sectionCount = [abstract, intro, methods, results, discussion, figures].filter(x => x > 0).length;
const sectionAvg = sectionCount > 0
? ((abstract + intro + methods + results + discussion + figures) / sectionCount).toFixed(1)
: 'N/A';
const majorIssues = issuesSection.checkboxList('majorIssues')?.value() || [];
const minorIssues = issuesSection.checkboxList('minorIssues')?.value() || [];
let summary = 'đ PEER REVIEW SUMMARY\n';
summary += 'â'.repeat(30) + '\n\n';
if (msId) summary += `đ Manuscript: ${msId}\n`;
if (title) summary += `đ Title: ${title.substring(0, 50)}${title.length > 50 ? '...' : ''}\n`;
if (msType) summary += `đ Type: ${msType}\n\n`;
summary += `đ Quality Score: ${avgQuality}/5\n`;
summary += `đ Section Average: ${sectionAvg}/5\n`;
if (majorIssues.length > 0 || minorIssues.length > 0) {
summary += `\nâ ī¸ Issues: ${majorIssues.length} major, ${minorIssues.length} minor\n`;
}
if (recommendation) {
const recLabels: Record<string, string> = {
'accept': 'â
Accept',
'minor': 'đ Minor Revision',
'major': 'đ Major Revision',
'reject-encourage': 'âŠī¸ Reject (Encourage)',
'reject': 'â Reject'
};
summary += `\nđ¯ Recommendation: ${recLabels[recommendation] || recommendation}\n`;
}
if (potential) {
const potLabels: Record<string, string> = {
'low': 'Needs Work',
'medium': 'Promising',
'high': 'Strong',
'excellent': 'Outstanding'
};
summary += `đ Potential: ${potLabels[potential] || potential}\n`;
}
if (confidence) {
summary += `đ Reviewer Confidence: ${confidence}/5\n`;
}
return summary;
},
customStyles: () => {
const recommendation = recommendSection.radioButton('recommendation')?.value();
const baseStyles = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '13px'
};
if (recommendation === 'accept') {
return { ...baseStyles, backgroundColor: '#dcfce7', borderLeft: '4px solid #22c55e' };
} else if (recommendation === 'minor') {
return { ...baseStyles, backgroundColor: '#dbeafe', borderLeft: '4px solid #3b82f6' };
} else if (recommendation === 'major') {
return { ...baseStyles, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
} else if (recommendation === 'reject' || recommendation === 'reject-encourage') {
return { ...baseStyles, backgroundColor: '#fee2e2', borderLeft: '4px solid #ef4444' };
}
return { ...baseStyles, backgroundColor: '#f8fafc', borderLeft: '4px solid #64748b' };
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Review',
isVisible: () => recommendSection.radioButton('recommendation')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Review Submitted Successfully',
message: 'Thank you for your thorough review. Your expertise and time contribution to the peer review process is invaluable to maintaining academic standards.'
});
}