Science Research Log Generator

Science Research Log Generator

Your testable prediction.

List all apparatus, chemicals, and tools used.

Summarize the sequence of steps taken (one step per line).

Raw Data Log

Record the results for each trial. The "Measured Value" should correspond to your Dependent Variable.

Trial # Independent Variable Setting Time (min) Measured Value (mL) Observations/Notes Actions

The main observations or trends drawn from the raw data.

Did the data support the hypothesis? What is the conclusion or what is the next experiment?

Final Protocol Review

Click "Next" or "Previous" to refresh this preview.

Dependent Variable: ${escapeHTML(data.depVar)}

Procedure Outline:

${formatParagraphs(data.procedure)}

3. Raw Data Log (${data.logEntries.length} Trials)

${logTableHTML.length > 0 ? logTableHTML : ''}
Trial # ${escapeHTML(data.indepVar)} Time (min) ${escapeHTML(data.depVar)} (mL) Observations
No trial data logged.

4. Analysis & Conclusion

Key Findings: ${escapeHTML(data.findings)}

Conclusion: ${escapeHTML(data.conclusion)}

`; }; const downloadTxt = () => { const data = getLogData(); let content = `SCIENCE RESEARCH LOG: ${data.title.toUpperCase()}\n`; content += "========================================================\n\n"; content += "1. SETUP & HYPOTHESIS\n"; content += "---------------------\n"; content += `Researcher: ${data.researcher}\n`; content += `Date: ${data.date}\n`; content += `Hypothesis: ${data.hypothesis}\n\n`; content += "2. METHODS & VARIABLES\n"; content += "----------------------\n"; content += `Materials: ${data.materials}\n`; content += `Independent Variable: ${data.indepVar}\n`; content += `Dependent Variable: ${data.depVar}\n`; content += `Procedure:\n${data.procedure}\n\n`; content += "3. RAW DATA LOG\n"; content += "----------------------\n"; content += `Trial # | ${data.indepVar.padEnd(20).substring(0, 20)} | Time (min) | ${data.depVar.padEnd(15).substring(0, 15)} | Observations\n`; content += "--------------------------------------------------------------------------------------------------\n"; data.logEntries.forEach((t, index) => { content += `${(index + 1).toString().padEnd(7)} | ${t.indepValue.padEnd(20).substring(0, 20)} | ${t.time.toString().padEnd(10)} | ${t.measuredValue.toString().padEnd(15)} | ${t.observation}\n`; }); content += "\n"; content += "4. ANALYSIS & CONCLUSION\n"; content += "----------------------\n"; content += `Key Findings: ${data.findings}\n\n`; content += `Conclusion: ${data.conclusion}\n`; const blob = new Blob([content], { type: 'text/plain;charset=utf-8' }); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = `research_log_${data.title.replace(/ /g, '_')}.txt`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(a.href); }; const downloadPDF = () => { if (typeof window.jspdf === 'undefined' || typeof window.jspdf.jsPDF === 'undefined') { alert('Error: jsPDF library not loaded.'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF('p', 'mm', 'a4'); const data = getLogData(); const margin = 15; const pageWidth = doc.internal.pageSize.getWidth(); const usableWidth = pageWidth - (margin * 2); let yPos = 20; const addText = (text, size, style, color = [52, 73, 94]) => { doc.setFontSize(size); doc.setFont(undefined, style); doc.setTextColor(color[0], color[1], color[2]); const lines = doc.splitTextToSize(text, usableWidth); if (lines.length * 5 + yPos > 280) { doc.addPage(); yPos = 20; } doc.text(lines, margin, yPos); yPos += (lines.length * 5) + 3; }; const addSectionTitle = (text) => { yPos += 5; doc.setFontSize(14); doc.setFont(undefined, 'bold'); doc.setTextColor(243, 156, 18); /* Orange */ doc.text(text, margin, yPos); doc.setDrawColor(224, 224, 224); doc.line(margin, yPos + 1, pageWidth - margin, yPos + 1); yPos += 8; }; // --- Build PDF Document --- doc.setFontSize(18); doc.setFont(undefined, 'bold'); doc.setTextColor(44, 62, 80); doc.text(`Science Research Log`, pageWidth / 2, yPos, { align: 'center' }); yPos += 8; doc.setFontSize(14); doc.text(data.title, pageWidth / 2, yPos, { align: 'center' }); yPos += 10; // 1. Setup addSectionTitle("1. Setup & Hypothesis"); addText(`Researcher: ${data.researcher}`, 11, 'bold'); addText(`Date: ${data.date}`, 11, 'bold'); addText(`Hypothesis: ${data.hypothesis}`, 11, 'normal'); // 2. Methods addSectionTitle("2. Methods & Variables"); addText(`Materials: ${data.materials}`, 11, 'normal'); addText(`Independent Variable: ${data.indepVar}`, 11, 'bold'); addText(`Dependent Variable: ${data.depVar}`, 11, 'bold'); addText(`Procedure:\n${data.procedure}`, 11, 'normal'); // 3. Raw Data Log addSectionTitle("3. Raw Data Log"); const logHead = [['Trial #', data.indepVar, 'Time (min)', `${data.depVar} (mL)`, 'Observations']]; const logBody = data.logEntries.map((t, index) => [ index + 1, t.indepValue, t.time, t.measuredValue, t.observation ]); doc.autoTable({ startY: yPos, head: logHead, body: logBody, theme: 'grid', styles: { fontSize: 8, cellPadding: 2, textColor: [52, 73, 94], valign: 'top' }, headStyles: { fillColor: [243, 156, 18], textColor: [255, 255, 255] }, columnStyles: { 0: { cellWidth: 15 }, 2: { cellWidth: 18 }, 3: { cellWidth: 25 }, 4: { cellWidth: 'auto' } }, margin: { left: margin, right: margin } }); yPos = doc.autoTable.previous.finalY + 10; // 4. Analysis addSectionTitle("4. Analysis & Conclusion"); addText(`Key Findings: ${data.findings}`, 11, 'normal'); addText(`Conclusion: ${data.conclusion}`, 11, 'normal'); doc.save(`research_log_${data.title.replace(/ /g, '_')}.pdf`); }; // --- Event Listeners --- // Tab Buttons tabButtons.forEach((btn, index) => { btn.addEventListener('click', () => showTab(index + 1)); }); // Next/Prev Navigation nextBtn.addEventListener('click', () => showTab(currentTab + 1)); prevBtn.addEventListener('click', () => showTab(currentTab - 1)); // Tab 3 Actions (Add, Remove, Edit) addTrialBtn.addEventListener('click', () => addTrial()); logTbody.addEventListener('click', (e) => { if (e.target.dataset.removeId) { removeTrial(parseInt(e.target.dataset.removeId)); } }); logTbody.addEventListener('blur', (e) => { if (e.target.tagName === 'TD' && e.target.isContentEditable) { const id = parseInt(e.target.dataset.id); const field = e.target.dataset.field; updateTrial(id, field, e.target.textContent); } }, true); // Tab 4 Actions downloadPdfBtn.addEventListener('click', downloadPDF); downloadTxtBtn.addEventListener('click', downloadTxt); // --- Initialization --- // Pre-populate with sample data addTrial({ indepValue: 'pH 5.0', time: 5, measuredValue: 0.8, observation: 'Slow bubbling.' }); addTrial({ indepValue: 'pH 7.0', time: 5, measuredValue: 3.5, observation: 'Vigorous reaction. Max output for this pH.' }); addTrial({ indepValue: 'pH 9.0', time: 5, measuredValue: 1.2, observation: 'Reaction dropped immediately.' }); // Finalize setup inputs setupInputs.researcher.value = "Dr. Alice Johnson"; setupInputs.date.value = new Date().toISOString().substring(0, 10); showTab(1); // Set initial state });
Scroll to Top