$npx -y skills add K-Dense-AI/scientific-agent-skills --skill labarchive-integrationElectronic lab notebook API integration. Access notebooks, manage entries/attachments, backup notebooks, integrate with Protocols.io/Jupyter/REDCap, for programmatic ELN workflows.
| 1 | # LabArchives Integration |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | This skill should be used when: |
| 10 | - Working with LabArchives REST API for notebook automation |
| 11 | - Backing up notebooks programmatically |
| 12 | - Creating or managing notebook entries and attachments |
| 13 | - Generating site reports and analytics |
| 14 | - Integrating LabArchives with third-party tools (Protocols.io, Jupyter, REDCap) |
| 15 | - Automating data upload to electronic lab notebooks |
| 16 | - Managing user access and permissions programmatically |
| 17 | |
| 18 | ## Core Capabilities |
| 19 | |
| 20 | ### 1. Authentication and Configuration |
| 21 | |
| 22 | Set up API access credentials and regional endpoints for LabArchives API integration. |
| 23 | |
| 24 | **Prerequisites:** |
| 25 | - Enterprise LabArchives license with API access enabled |
| 26 | - API access key ID and password from LabArchives administrator |
| 27 | - User authentication credentials (email and external applications password) |
| 28 | |
| 29 | **Configuration setup:** |
| 30 | |
| 31 | Use the `scripts/setup_config.py` script to create a configuration file: |
| 32 | |
| 33 | ```bash |
| 34 | python3 scripts/setup_config.py |
| 35 | ``` |
| 36 | |
| 37 | This creates a `config.yaml` file with the following structure: |
| 38 | |
| 39 | ```yaml |
| 40 | api_url: https://api.labarchives.com/api # or regional endpoint |
| 41 | access_key_id: YOUR_ACCESS_KEY_ID |
| 42 | access_password: YOUR_ACCESS_PASSWORD |
| 43 | ``` |
| 44 | |
| 45 | **Regional API endpoints:** |
| 46 | - US/International: `https://api.labarchives.com/api` |
| 47 | - Australia: `https://auapi.labarchives.com/api` |
| 48 | - UK: `https://ukapi.labarchives.com/api` |
| 49 | |
| 50 | For detailed authentication instructions and troubleshooting, refer to `references/authentication_guide.md`. |
| 51 | |
| 52 | ### 2. User Information Retrieval |
| 53 | |
| 54 | Obtain user ID (UID) and access information required for subsequent API operations. |
| 55 | |
| 56 | **Workflow:** |
| 57 | |
| 58 | 1. Call the `users/user_access_info` API method with login credentials |
| 59 | 2. Parse the XML/JSON response to extract the user ID (UID) |
| 60 | 3. Use the UID to retrieve detailed user information via `users/user_info_via_id` |
| 61 | |
| 62 | **Example using Python wrapper:** |
| 63 | |
| 64 | ```python |
| 65 | from labarchivespy.client import Client |
| 66 | |
| 67 | # Initialize client |
| 68 | client = Client(api_url, access_key_id, access_password) |
| 69 | |
| 70 | # Get user access info |
| 71 | login_params = {'login_or_email': user_email, 'password': auth_token} |
| 72 | response = client.make_call('users', 'user_access_info', params=login_params) |
| 73 | |
| 74 | # Extract UID from response |
| 75 | import xml.etree.ElementTree as ET |
| 76 | uid = ET.fromstring(response.content)[0].text |
| 77 | |
| 78 | # Get detailed user info |
| 79 | params = {'uid': uid} |
| 80 | user_info = client.make_call('users', 'user_info_via_id', params=params) |
| 81 | ``` |
| 82 | |
| 83 | ### 3. Notebook Operations |
| 84 | |
| 85 | Manage notebook access, backup, and metadata retrieval. |
| 86 | |
| 87 | **Key operations:** |
| 88 | |
| 89 | - **List notebooks:** Retrieve all notebooks accessible to a user |
| 90 | - **Backup notebooks:** Download complete notebook data with optional attachment inclusion |
| 91 | - **Get notebook IDs:** Retrieve institution-defined notebook identifiers for integration with grants/project management systems |
| 92 | - **Get notebook members:** List all users with access to a specific notebook |
| 93 | - **Get notebook settings:** Retrieve configuration and permissions for notebooks |
| 94 | |
| 95 | **Notebook backup example:** |
| 96 | |
| 97 | Use the `scripts/notebook_operations.py` script: |
| 98 | |
| 99 | ```bash |
| 100 | # Backup with attachments (default, creates 7z archive) |
| 101 | python3 scripts/notebook_operations.py backup --uid USER_ID --nbid NOTEBOOK_ID |
| 102 | |
| 103 | # Backup without attachments, JSON format |
| 104 | python3 scripts/notebook_operations.py backup --uid USER_ID --nbid NOTEBOOK_ID --json --no-attachments |
| 105 | ``` |
| 106 | |
| 107 | **API endpoint format:** |
| 108 | ``` |
| 109 | https://<api_url>/notebooks/notebook_backup?uid=<UID>&nbid=<NOTEBOOK_ID>&json=true&no_attachments=false |
| 110 | ``` |
| 111 | |
| 112 | For comprehensive API method documentation, refer to `references/api_reference.md`. |
| 113 | |
| 114 | ### 4. Entry and Attachment Management |
| 115 | |
| 116 | Create, modify, and manage notebook entries and file attachments. |
| 117 | |
| 118 | **Entry operations:** |
| 119 | - Create new entries in notebooks |
| 120 | - Add comments to existing entries |
| 121 | - Create entry parts/components |
| 122 | - Upload file attachments to entries |
| 123 | |
| 124 | **Attachment workflow:** |
| 125 | |
| 126 | Use the `scripts/entry_operations.py` script: |
| 127 | |
| 128 | ```bash |
| 129 | # Upload attachment to an entry |
| 130 | python3 scripts/entry_operations.py upload --uid USER_ID --nbid NOTEBOOK_ID --entry-id ENTRY_ID --file /path/to/file.pdf |
| 131 | |
| 132 | # Create a new entry with text content |
| 133 | python3 scripts/entry_operations.py create --uid USER_ID --nbid NOTEBOOK_ID --title "Experiment Results" --content "Results from today's experiment..." |
| 134 | ``` |
| 135 | |
| 136 | **Supported file types:** |
| 137 | - Documents (PDF, DOCX, TXT) |
| 138 | - Images (PNG, JPG, TIFF) |
| 139 | - Data files (CSV, XLSX, HDF5) |
| 140 | - Scientific formats (CIF, MOL, PDB) |
| 141 | - Archives (ZIP, 7Z) |
| 142 | |
| 143 | ### 5. Site Repo |