15. Research Documentation
thorough documentation ensures research integrity, enables collaboration, and supports long-term reproducibility. Local AI assists in creating and maintaining research records throughout the project lifecycle.
Lab Notebook Generation
Structured digital notebooks capture experimental procedures:
# Research notebook entry generation
def generate_notebook_entry(experiment, observations, metadata):
"""Create structured lab notebook entry."""
prompt = f"""Generate a detailed lab notebook entry with:
- Date and experiment identifier
- Objective and hypothesis
- Materials and equipment used
- Step-by-step procedure
- Raw observations (preserve original data)
- Preliminary analysis
- Next steps
Experiment: {experiment}
Observations: {observations}
Metadata: {metadata}
Use clear, dated entries following [institution] notebook standards."""
entry = local_model.generate(prompt)
return entry
Protocol Documentation
Standard operating procedures require precise, unambiguous language:
def document_protocol(steps, equipment, safety_notes):
"""Generate detailed protocol documentation."""
prompt = f"""Write a detailed, reproducible protocol document.
Include:
- Purpose and scope
- Required materials and equipment
- Safety considerations
- Step-by-step procedure with critical parameters
- Quality control checkpoints
- Troubleshooting guide
Steps: {steps}
Equipment: {equipment}
Safety Notes: {safety_notes}"""
protocol = local_model.generate(prompt)
return protocol
Method Section Extraction
Generate methods text from experimental records:
def extract_methods_text(notebook_entries, protocols):
"""Generate manuscript methods from documentation."""
prompt = f"""Write a Methods section for a journal manuscript
based on these lab records. Combine relevant entries into
coherent subsections. Maintain enough detail for replication.
Notebook Entries: {notebook_entries}
Protocols Used: {protocols}"""
methods_text = local_model.generate(prompt)
return methods_text
Version-Controlled Documentation
Maintain documentation alongside code and data:
# Documentation versioning
class ResearchDocumentation:
def create_documentation_commit(self, docs, changes_summary):
"""Create versioned documentation snapshot."""
commit = {
'timestamp': datetime.now(),
'documentation': docs,
'changes': changes_summary,
'linked_experiments': self.get_recent_experiments()
}
self.repository.add(commit)
return commit.hash
def compare_documentation_versions(self, version_a, version_b):
"""Generate changelog between documentation versions."""
prompt = f"""Compare these two documentation versions and
summarize what changed:
Version A: {version_a}
Version B: {version_b}"""
changelog = local_model.generate(prompt)
return changelog
Create a research documentation system that processes daily experimental notes, generates structured entries with timestamps and metadata, maintains links between notebooks and raw data files, and exports formatted documentation for manuscript methods sections.