labarchive-integration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LabArchives Integration

LabArchives集成

Overview

概述

LabArchives is an electronic lab notebook platform for research documentation and data management. Access notebooks, manage entries and attachments, generate reports, and integrate with third-party tools programmatically via REST API.
LabArchives是一个用于研究文档和数据管理的电子实验记录本平台。通过REST API以程序化方式访问实验记录本、管理条目和附件、生成报告,并与第三方工具集成。

When to Use This Skill

何时使用此技能

This skill should be used when:
  • Working with LabArchives REST API for notebook automation
  • Backing up notebooks programmatically
  • Creating or managing notebook entries and attachments
  • Generating site reports and analytics
  • Integrating LabArchives with third-party tools (Protocols.io, Jupyter, REDCap)
  • Automating data upload to electronic lab notebooks
  • Managing user access and permissions programmatically
当出现以下场景时应使用此技能:
  • 借助LabArchives REST API实现实验记录本自动化
  • 以程序化方式备份实验记录本
  • 创建或管理实验记录本条目和附件
  • 生成站点报告和分析数据
  • 将LabArchives与第三方工具(Protocols.io、Jupyter、REDCap)集成
  • 自动化上传数据至电子实验记录本
  • 以程序化方式管理用户访问权限

Core Capabilities

核心功能

1. Authentication and Configuration

1. 认证与配置

Set up API access credentials and regional endpoints for LabArchives API integration.
Prerequisites:
  • Enterprise LabArchives license with API access enabled
  • API access key ID and password from LabArchives administrator
  • User authentication credentials (email and external applications password)
Configuration setup:
Use the
scripts/setup_config.py
script to create a configuration file:
bash
python3 scripts/setup_config.py
This creates a
config.yaml
file with the following structure:
yaml
api_url: https://api.labarchives.com/api  # or regional endpoint
access_key_id: YOUR_ACCESS_KEY_ID
access_password: YOUR_ACCESS_PASSWORD
Regional API endpoints:
  • US/International:
    https://api.labarchives.com/api
  • Australia:
    https://auapi.labarchives.com/api
  • UK:
    https://ukapi.labarchives.com/api
For detailed authentication instructions and troubleshooting, refer to
references/authentication_guide.md
.
设置API访问凭证和LabArchives API集成的区域端点。
前提条件:
  • 已启用API访问权限的企业版LabArchives许可证
  • 来自LabArchives管理员的API访问密钥ID和密码
  • 用户认证凭证(邮箱和外部应用密码)
配置设置:
使用
scripts/setup_config.py
脚本创建配置文件:
bash
python3 scripts/setup_config.py
这将创建一个
config.yaml
文件,结构如下:
yaml
api_url: https://api.labarchives.com/api  # 或区域端点
access_key_id: YOUR_ACCESS_KEY_ID
access_password: YOUR_ACCESS_PASSWORD
区域API端点:
  • 美国/国际:
    https://api.labarchives.com/api
  • 澳大利亚:
    https://auapi.labarchives.com/api
  • 英国:
    https://ukapi.labarchives.com/api
有关详细的认证说明和故障排查,请参考
references/authentication_guide.md

2. User Information Retrieval

2. 用户信息检索

Obtain user ID (UID) and access information required for subsequent API operations.
Workflow:
  1. Call the
    users/user_access_info
    API method with login credentials
  2. Parse the XML/JSON response to extract the user ID (UID)
  3. Use the UID to retrieve detailed user information via
    users/user_info_via_id
Example using Python wrapper:
python
from labarchivespy.client import Client
获取后续API操作所需的用户ID(UID)和访问信息。
工作流:
  1. 使用登录凭证调用
    users/user_access_info
    API方法
  2. 解析XML/JSON响应以提取用户ID(UID)
  3. 使用UID通过
    users/user_info_via_id
    检索详细用户信息
Python包装器示例:
python
from labarchivespy.client import Client

Initialize client

初始化客户端

client = Client(api_url, access_key_id, access_password)
client = Client(api_url, access_key_id, access_password)

Get user access info

获取用户访问信息

login_params = {'login_or_email': user_email, 'password': auth_token} response = client.make_call('users', 'user_access_info', params=login_params)
login_params = {'login_or_email': user_email, 'password': auth_token} response = client.make_call('users', 'user_access_info', params=login_params)

Extract UID from response

从响应中提取UID

import xml.etree.ElementTree as ET uid = ET.fromstring(response.content)[0].text
import xml.etree.ElementTree as ET uid = ET.fromstring(response.content)[0].text

Get detailed user info

获取详细用户信息

params = {'uid': uid} user_info = client.make_call('users', 'user_info_via_id', params=params)
undefined
params = {'uid': uid} user_info = client.make_call('users', 'user_info_via_id', params=params)
undefined

3. Notebook Operations

3. 实验记录本操作

Manage notebook access, backup, and metadata retrieval.
Key operations:
  • List notebooks: Retrieve all notebooks accessible to a user
  • Backup notebooks: Download complete notebook data with optional attachment inclusion
  • Get notebook IDs: Retrieve institution-defined notebook identifiers for integration with grants/project management systems
  • Get notebook members: List all users with access to a specific notebook
  • Get notebook settings: Retrieve configuration and permissions for notebooks
Notebook backup example:
Use the
scripts/notebook_operations.py
script:
bash
undefined
管理实验记录本的访问权限、备份和元数据检索。
关键操作:
  • 列出实验记录本: 检索用户可访问的所有实验记录本
  • 备份实验记录本: 下载完整的实验记录本数据,可选择包含附件
  • 获取实验记录本ID: 检索机构定义的实验记录本标识符,用于与资助/项目管理系统集成
  • 获取实验记录本成员: 列出有权访问特定实验记录本的所有用户
  • 获取实验记录本设置: 检索实验记录本的配置和权限
实验记录本备份示例:
使用
scripts/notebook_operations.py
脚本:
bash
undefined

Backup with attachments (default, creates 7z archive)

带附件备份(默认,创建7z存档)

python3 scripts/notebook_operations.py backup --uid USER_ID --nbid NOTEBOOK_ID
python3 scripts/notebook_operations.py backup --uid USER_ID --nbid NOTEBOOK_ID

Backup without attachments, JSON format

不带附件备份,JSON格式

python3 scripts/notebook_operations.py backup --uid USER_ID --nbid NOTEBOOK_ID --json --no-attachments

**API endpoint format:**
https://<api_url>/notebooks/notebook_backup?uid=<UID>&nbid=<NOTEBOOK_ID>&json=true&no_attachments=false

For comprehensive API method documentation, refer to `references/api_reference.md`.
python3 scripts/notebook_operations.py backup --uid USER_ID --nbid NOTEBOOK_ID --json --no-attachments

**API端点格式:**
https://<api_url>/notebooks/notebook_backup?uid=<UID>&nbid=<NOTEBOOK_ID>&json=true&no_attachments=false

有关全面的API方法文档,请参考`references/api_reference.md`。

4. Entry and Attachment Management

4. 条目与附件管理

Create, modify, and manage notebook entries and file attachments.
Entry operations:
  • Create new entries in notebooks
  • Add comments to existing entries
  • Create entry parts/components
  • Upload file attachments to entries
Attachment workflow:
Use the
scripts/entry_operations.py
script:
bash
undefined
创建、修改和管理实验记录本条目及文件附件。
条目操作:
  • 在实验记录本中创建新条目
  • 为现有条目添加评论
  • 创建条目部分/组件
  • 向条目上传文件附件
附件工作流:
使用
scripts/entry_operations.py
脚本:
bash
undefined

Upload attachment to an entry

向条目上传附件

python3 scripts/entry_operations.py upload --uid USER_ID --nbid NOTEBOOK_ID --entry-id ENTRY_ID --file /path/to/file.pdf
python3 scripts/entry_operations.py upload --uid USER_ID --nbid NOTEBOOK_ID --entry-id ENTRY_ID --file /path/to/file.pdf

Create a new entry with text content

创建带文本内容的新条目

python3 scripts/entry_operations.py create --uid USER_ID --nbid NOTEBOOK_ID --title "Experiment Results" --content "Results from today's experiment..."

**Supported file types:**
- Documents (PDF, DOCX, TXT)
- Images (PNG, JPG, TIFF)
- Data files (CSV, XLSX, HDF5)
- Scientific formats (CIF, MOL, PDB)
- Archives (ZIP, 7Z)
python3 scripts/entry_operations.py create --uid USER_ID --nbid NOTEBOOK_ID --title "实验结果" --content "今日实验的结果..."

**支持的文件类型:**
- 文档(PDF、DOCX、TXT)
- 图片(PNG、JPG、TIFF)
- 数据文件(CSV、XLSX、HDF5)
- 科学格式(CIF、MOL、PDB)
- 存档文件(ZIP、7Z)

5. Site Reports and Analytics

5. 站点报告与分析

Generate institutional reports on notebook usage, activity, and compliance (Enterprise feature).
Available reports:
  • Detailed Usage Report: User activity metrics and engagement statistics
  • Detailed Notebook Report: Notebook metadata, member lists, and settings
  • PDF/Offline Notebook Generation Report: Export tracking for compliance
  • Notebook Members Report: Access control and collaboration analytics
  • Notebook Settings Report: Configuration and permission auditing
Report generation:
python
undefined
生成关于实验记录本使用情况、活动和合规性的机构报告(企业版功能)。
可用报告:
  • 详细使用报告:用户活动指标和参与度统计数据
  • 详细实验记录本报告:实验记录本元数据、成员列表和设置
  • PDF/离线实验记录本生成报告:用于合规性的导出跟踪
  • 实验记录本成员报告:访问控制和协作分析
  • 实验记录本设置报告:配置和权限审计
报告生成:
python
undefined

Generate detailed usage report

生成详细使用报告

response = client.make_call('site_reports', 'detailed_usage_report', params={'start_date': '2025-01-01', 'end_date': '2025-10-20'})
undefined
response = client.make_call('site_reports', 'detailed_usage_report', params={'start_date': '2025-01-01', 'end_date': '2025-10-20'})
undefined

6. Third-Party Integrations

6. 第三方集成

LabArchives integrates with numerous scientific software platforms. This skill provides guidance on leveraging these integrations programmatically.
Supported integrations:
  • Protocols.io: Export protocols directly to LabArchives notebooks
  • GraphPad Prism: Export analyses and figures (Version 8+)
  • SnapGene: Direct molecular biology workflow integration
  • Geneious: Bioinformatics analysis export
  • Jupyter: Embed Jupyter notebooks as entries
  • REDCap: Clinical data capture integration
  • Qeios: Research publishing platform
  • SciSpace: Literature management
OAuth authentication: LabArchives now uses OAuth for all new integrations. Legacy integrations may use API key authentication.
For detailed integration setup instructions and use cases, refer to
references/integrations.md
.
LabArchives可与众多科学软件平台集成。本技能提供了如何以程序化方式利用这些集成的指导。
支持的集成:
  • Protocols.io: 将实验方案直接导出至LabArchives实验记录本
  • GraphPad Prism: 导出分析结果和图表(版本8及以上)
  • SnapGene: 直接集成分子生物学工作流
  • Geneious: 生物信息学分析结果导出
  • Jupyter: 将Jupyter笔记本嵌入为条目
  • REDCap: 临床数据采集集成
  • Qeios: 研究出版平台
  • SciSpace: 文献管理
OAuth认证: LabArchives现在对所有新集成使用OAuth认证。旧版集成可能使用API密钥认证。
有关详细的集成设置说明和用例,请参考
references/integrations.md

Common Workflows

常见工作流

Complete notebook backup workflow

完整实验记录本备份工作流

  1. Authenticate and obtain user ID
  2. List all accessible notebooks
  3. Iterate through notebooks and backup each one
  4. Store backups with timestamp metadata
bash
undefined
  1. 认证并获取用户ID
  2. 列出所有可访问的实验记录本
  3. 遍历实验记录本并逐个备份
  4. 存储带有时间戳元数据的备份文件
bash
undefined

Complete backup script

完整备份脚本

python3 scripts/notebook_operations.py backup-all --email user@example.edu --password AUTH_TOKEN
undefined
python3 scripts/notebook_operations.py backup-all --email user@example.edu --password AUTH_TOKEN
undefined

Automated data upload workflow

自动化数据上传工作流

  1. Authenticate with LabArchives API
  2. Identify target notebook and entry
  3. Upload experimental data files
  4. Add metadata comments to entries
  5. Generate activity report
  1. 通过LabArchives API进行认证
  2. 确定目标实验记录本和条目
  3. 上传实验数据文件
  4. 向条目添加元数据评论
  5. 生成活动报告

Integration workflow example (Jupyter → LabArchives)

集成工作流示例(Jupyter → LabArchives)

  1. Export Jupyter notebook to HTML or PDF
  2. Use entry_operations.py to upload to LabArchives
  3. Add comment with execution timestamp and environment info
  4. Tag entry for easy retrieval
  1. 将Jupyter笔记本导出为HTML或PDF格式
  2. 使用entry_operations.py上传至LabArchives
  3. 添加包含执行时间戳和环境信息的评论
  4. 为条目添加标签以便检索

Python Package Installation

Python包安装

Install the
labarchives-py
wrapper for simplified API access:
bash
git clone https://github.com/mcmero/labarchives-py
cd labarchives-py
uv pip install .
Alternatively, use direct HTTP requests via Python's
requests
library for custom implementations.
安装
labarchives-py
包装器以简化API访问:
bash
git clone https://github.com/mcmero/labarchives-py
cd labarchives-py
uv pip install .
或者,使用Python的
requests
库直接发送HTTP请求以实现自定义功能。

Best Practices

最佳实践

  1. Rate limiting: Implement appropriate delays between API calls to avoid throttling
  2. Error handling: Always wrap API calls in try-except blocks with appropriate logging
  3. Authentication security: Store credentials in environment variables or secure config files (never in code)
  4. Backup verification: After notebook backup, verify file integrity and completeness
  5. Incremental operations: For large notebooks, use pagination and batch processing
  6. Regional endpoints: Use the correct regional API endpoint for optimal performance
  1. 速率限制: 在API调用之间设置适当的延迟,避免被限流
  2. 错误处理: 始终将API调用包裹在try-except块中,并进行适当的日志记录
  3. 认证安全: 将凭证存储在环境变量或安全配置文件中(绝不要硬编码在代码中)
  4. 备份验证: 实验记录本备份后,验证文件的完整性和完备性
  5. 增量操作: 对于大型实验记录本,使用分页和批量处理
  6. 区域端点: 使用正确的区域API端点以获得最佳性能

Troubleshooting

故障排查

Common issues:
  • 401 Unauthorized: Verify access key ID and password are correct; check API access is enabled for your account
  • 404 Not Found: Confirm notebook ID (nbid) exists and user has access permissions
  • 403 Forbidden: Check user permissions for the requested operation
  • Empty response: Ensure required parameters (uid, nbid) are provided correctly
  • Attachment upload failures: Verify file size limits and format compatibility
For additional support, contact LabArchives at support@labarchives.com.
常见问题:
  • 401 Unauthorized(未授权): 验证访问密钥ID和密码是否正确;检查您的账户是否已启用API访问权限
  • 404 Not Found(未找到): 确认实验记录本ID(nbid)存在且用户拥有访问权限
  • 403 Forbidden(禁止访问): 检查用户对请求操作的权限
  • 空响应: 确保正确提供了必填参数(uid、nbid)
  • 附件上传失败: 验证文件大小限制和格式兼容性
如需额外支持,请联系LabArchives:support@labarchives.com

Resources

资源

This skill includes bundled resources to support LabArchives API integration:
本技能包含配套资源以支持LabArchives API集成:

scripts/

scripts/

  • setup_config.py
    : Interactive configuration file generator for API credentials
  • notebook_operations.py
    : Utilities for listing, backing up, and managing notebooks
  • entry_operations.py
    : Tools for creating entries and uploading attachments
  • setup_config.py
    :用于API凭证的交互式配置文件生成器
  • notebook_operations.py
    :用于列出、备份和管理实验记录本的工具
  • entry_operations.py
    :用于创建条目和上传附件的工具

references/

references/

  • api_reference.md
    : Comprehensive API endpoint documentation with parameters and examples
  • authentication_guide.md
    : Detailed authentication setup and configuration instructions
  • integrations.md
    : Third-party integration setup guides and use cases
  • api_reference.md
    :包含参数和示例的全面API端点文档
  • authentication_guide.md
    :详细的认证设置和配置说明
  • integrations.md
    :第三方集成设置指南和用例