scientific-skills/labarchive-integration/references/integrations.md
LabArchives integrates with numerous scientific software platforms to streamline research workflows. This document covers programmatic integration approaches, automation strategies, and best practices for each supported platform.
Export protocols directly from Protocols.io to LabArchives notebooks.
Use cases:
Setup:
Programmatic approach:
# Export Protocols.io protocol as HTML/PDF
# Then upload to LabArchives via API
def import_protocol_to_labarchives(client, uid, nbid, protocol_id):
"""Import Protocols.io protocol to LabArchives entry"""
# 1. Fetch protocol from Protocols.io API
protocol_data = fetch_protocol_from_protocolsio(protocol_id)
# 2. Create new entry in LabArchives
entry_params = {
'uid': uid,
'nbid': nbid,
'title': f"Protocol: {protocol_data['title']}",
'content': protocol_data['html_content']
}
response = client.make_call('entries', 'create_entry', params=entry_params)
# 3. Add protocol metadata as comment
entry_id = extract_entry_id(response)
comment_params = {
'uid': uid,
'nbid': nbid,
'entry_id': entry_id,
'comment': f"Protocols.io ID: {protocol_id}
Version: {protocol_data['version']}"
}
client.make_call('entries', 'create_comment', params=comment_params)
return entry_id
Updated: September 22, 2025
Export analyses, graphs, and figures directly from Prism to LabArchives.
Use cases:
Setup:
Programmatic approach:
# Upload Prism files to LabArchives via API
def upload_prism_analysis(client, uid, nbid, entry_id, prism_file_path):
"""Upload GraphPad Prism file to LabArchives entry"""
import requests
url = f'{client.api_url}/entries/upload_attachment'
files = {'file': open(prism_file_path, 'rb')}
params = {
'uid': uid,
'nbid': nbid,
'entry_id': entry_id,
'filename': os.path.basename(prism_file_path),
'access_key_id': client.access_key_id,
'access_password': client.access_password
}
response = requests.post(url, files=files, data=params)
return response
Supported file types:
Updated: September 8, 2025
Direct integration for molecular biology workflows, plasmid maps, and sequence analysis.
Use cases:
Setup:
File format support:
Programmatic workflow:
def upload_snapgene_file(client, uid, nbid, entry_id, snapgene_file):
"""Upload SnapGene file with preview image"""
# Upload main SnapGene file
upload_attachment(client, uid, nbid, entry_id, snapgene_file)
# Generate and upload preview image (requires SnapGene CLI)
preview_png = generate_snapgene_preview(snapgene_file)
upload_attachment(client, uid, nbid, entry_id, preview_png)
Bioinformatics analysis export from Geneious to LabArchives.
Use cases:
Supported exports:
File formats:
Embed Jupyter notebooks as LabArchives entries for reproducible computational research.
Use cases:
Workflow:
def export_jupyter_to_labarchives(notebook_path, client, uid, nbid):
"""Export Jupyter notebook to LabArchives"""
import nbformat
from nbconvert import HTMLExporter
# Load notebook
with open(notebook_path, 'r') as f:
nb = nbformat.read(f, as_version=4)
# Convert to HTML
html_exporter = HTMLExporter()
html_exporter.template_name = 'classic'
(body, resources) = html_exporter.from_notebook_node(nb)
# Create entry in LabArchives
entry_params = {
'uid': uid,
'nbid': nbid,
'title': f"Jupyter Notebook: {os.path.basename(notebook_path)}",
'content': body
}
response = client.make_call('entries', 'create_entry', params=entry_params)
# Upload original .ipynb file as attachment
entry_id = extract_entry_id(response)
upload_attachment(client, uid, nbid, entry_id, notebook_path)
return entry_id
Best practices:
Clinical data capture integration with LabArchives for research compliance and audit trails.
Use cases:
Integration approach:
Example workflow:
def sync_redcap_to_labarchives(redcap_api_token, client, uid, nbid):
"""Sync REDCap data to LabArchives"""
# Fetch REDCap data
redcap_data = fetch_redcap_data(redcap_api_token)
# Create LabArchives entry
entry_params = {
'uid': uid,
'nbid': nbid,
'title': f"REDCap Data Export {datetime.now().strftime('%Y-%m-%d')}",
'content': format_redcap_data_html(redcap_data)
}
response = client.make_call('entries', 'create_entry', params=entry_params)
return response
Compliance features:
Research publishing platform integration for preprints and peer review.
Use cases:
Workflow:
Literature management and citation integration.
Use cases:
Features:
LabArchives now uses OAuth 2.0 for new third-party integrations.
OAuth flow for app developers:
def labarchives_oauth_flow(client_id, client_secret, redirect_uri):
"""Implement OAuth 2.0 flow for LabArchives integration"""
import requests
# Step 1: Get authorization code
auth_url = "https://mynotebook.labarchives.com/oauth/authorize"
auth_params = {
'client_id': client_id,
'redirect_uri': redirect_uri,
'response_type': 'code',
'scope': 'read write'
}
# User visits auth_url and grants permission
# Step 2: Exchange code for access token
token_url = "https://mynotebook.labarchives.com/oauth/token"
token_params = {
'client_id': client_id,
'client_secret': client_secret,
'redirect_uri': redirect_uri,
'grant_type': 'authorization_code',
'code': authorization_code # From redirect
}
response = requests.post(token_url, data=token_params)
tokens = response.json()
return tokens['access_token'], tokens['refresh_token']
OAuth advantages:
For tools not officially supported, develop custom integrations:
class LabArchivesIntegration:
"""Template for custom LabArchives integrations"""
def __init__(self, config_path):
self.client = self._init_client(config_path)
self.uid = self._authenticate()
def _init_client(self, config_path):
"""Initialize LabArchives client"""
with open(config_path) as f:
config = yaml.safe_load(f)
return Client(config['api_url'],
config['access_key_id'],
config['access_password'])
def _authenticate(self):
"""Get user ID"""
# Implementation from authentication_guide.md
pass
def export_data(self, source_data, nbid, title):
"""Export data to LabArchives"""
# Transform data to HTML
html_content = self._transform_to_html(source_data)
# Create entry
params = {
'uid': self.uid,
'nbid': nbid,
'title': title,
'content': html_content
}
response = self.client.make_call('entries', 'create_entry', params=params)
return extract_entry_id(response)
def _transform_to_html(self, data):
"""Transform data to HTML format"""
# Custom transformation logic
pass
Integration not appearing in LabArchives:
File upload failures:
Authentication errors:
For integration-specific issues:
Potential integrations for custom development:
For custom integration development, contact LabArchives for API partnership opportunities.