### Start SciNote Server (Initial Docker Image Build) Source: https://github.com/scinote-eln/scinote-web/wiki/Build-&-run This command, when run initially, is used to build the PostgreSQL Docker image locally. While typically used to start the server, in this context, it serves the purpose of setting up the database container. The output indicates the server is listening on port 3000. ```bash make run ``` -------------------------------- ### Clone SciNote Web Repository Source: https://github.com/scinote-eln/scinote-web/wiki/Build-&-run This command clones the SciNote web application from its GitHub repository to your local development machine. It's the first step in setting up the project locally. No specific dependencies are required beyond Git. ```bash git clone https://github.com/scinote-eln/scinote-web.git ``` -------------------------------- ### Access SciNote Docker Container Source: https://github.com/scinote-eln/scinote-web/wiki/Build-&-run This command provides access to the SciNote Docker container via a command-line interface (CLI). Once inside the container, you can execute various administrative commands related to the application's database and front-end setup. ```bash make cli ``` -------------------------------- ### Initialize and Migrate SciNote Database Source: https://github.com/scinote-eln/scinote-web/wiki/Build-&-run These Rails commands are executed within the SciNote Docker container to manage the PostgreSQL database. They include dropping an existing database, creating a new one, applying schema migrations, and seeding the database with initial data. These are crucial for a functional SciNote instance. ```bash rails db:drop rails db:create rails db:migrate rails db:seed ``` -------------------------------- ### Build SciNote Docker Images Source: https://github.com/scinote-eln/scinote-web/wiki/Build-&-run This command utilizes the Makefile to build the necessary Docker images for the SciNote application locally. This process may involve pulling base images like Ruby from the internet and can take some time. It's a prerequisite for running the application within Docker. ```bash make docker ``` -------------------------------- ### Start SciNote Background Worker Source: https://github.com/scinote-eln/scinote-web/wiki/Build-&-run This command starts the background worker process for SciNote. This process handles demanding tasks asynchronously. It should be run in a separate terminal window from the main server process to ensure background jobs are processed correctly. ```bash make worker ``` -------------------------------- ### Compile SciNote Front-end Assets Source: https://github.com/scinote-eln/scinote-web/wiki/Build-&-run While inside the SciNote Docker container, these commands are used to install front-end dependencies using Yarn (or npm as a fallback) and compile the Webpacker assets (JavaScript and CSS). This step ensures that the user interface is correctly built and bundled. ```bash yarn rails webpacker:compile ``` -------------------------------- ### Project Model Usage Examples (Ruby) Source: https://context7.com/scinote-eln/scinote-web/llms.txt Demonstrates how to use the Project model for organizing experiments and tasks. Examples include creating projects with metadata, archiving and restoring projects, and querying the project hierarchy. ```ruby # Create project with metadata project = team.projects.create!( name: "Q2 2024 Drug Screening", description: "High-throughput screening of compound library", visibility: :visible, start_date: Date.today, due_date: 3.months.from_now, created_by: current_user, metadata: { grant_id: "NIH-2024-12345", collaborators: ["University A", "Institute B"] } ) # Archive project project.update!(archived: true, archived_by: current_user) # Restore project project.update!(archived: false, restored_by: current_user) # Query project hierarchy experiments = project.experiments.includes(:my_modules) total_tasks = project.experiments.joins(:my_modules).count ``` -------------------------------- ### Repository (Inventory) Model Usage Examples (Ruby) Source: https://context7.com/scinote-eln/scinote-web/llms.txt Shows examples of managing inventory tables with typed columns using the Repository model. Includes creating inventories, adding columns with different data types, and creating inventory items with cells. ```ruby # Create inventory repository = team.repositories.create!( name: "Chemical Storage Inventory", created_by: current_user ) # Add columns with different data types name_column = repository.repository_columns.create!( name: "Chemical Name", data_type: "RepositoryTextValue", created_by: current_user ) stock_column = repository.repository_columns.create!( name: "Stock", data_type: "RepositoryStockValue", created_by: current_user, metadata: { unit_items: [ { data: "mL" }, { data: "L" } ] } ) expiration_column = repository.repository_columns.create!( name: "Expiration", data_type: "RepositoryDateValue", created_by: current_user ) # Create inventory item with cells item = repository.repository_rows.create!( name: "Sulfuric Acid 98%", created_by: current_user, last_modified_by: current_user ) ``` -------------------------------- ### Team Model Usage Examples (Ruby) Source: https://context7.com/scinote-eln/scinote-web/llms.txt Provides examples of using the Team model, which serves as the top-level workspace container. Includes creating new teams, adding users to teams, querying team projects, and checking team permissions. ```ruby # Create new team team = Team.create!( name: "Genomics Research Lab", description: "Focused on CRISPR and gene editing", created_by: current_user ) # Add user to team UserAssignment.create!( assignable: team, user: new_user, user_role: UserRole.find_predefined_viewer_role, assigned_by: current_user ) # Query team projects active_projects = team.projects.where(archived: false) recent_activities = team.activities.where('created_at > ?', 1.week.ago) # Check permissions can_create_projects?(team) # => true/false can_manage_team?(team) # => true/false ``` -------------------------------- ### Add Graphviz Buildpack Example Source: https://github.com/scinote-eln/scinote-web/wiki/Heroku An example demonstrating how to add the Graphviz buildpack to your Heroku application at a specific index. This is useful for applications that require Graphviz for diagram generation. ```heroku heroku buildpacks:add --index 2 https://github.com/weibeld/heroku-buildpack-graphviz.git ``` -------------------------------- ### Webhook Payload Example Source: https://context7.com/scinote-eln/scinote-web/llms.txt An example of the JSON payload structure sent to a configured webhook URL when specific events occur. ```APIDOC ## Webhook Payload Example Example of a webhook notification payload. ### Event `task_completed` ### Payload Structure ```json { "event": "task_completed", "timestamp": "2024-03-21T10:30:00.000Z", "data": { "task_id": 302, "task_name": "Apply Compound Treatment - Completed", "project_id": 42, "experiment_id": 88, "team_id": 1, "user": { "id": 23, "full_name": "Dr. Jane Smith" } } } ``` ### Fields - **event** (string) - The type of event that occurred. - **timestamp** (string) - The time the event occurred in ISO 8601 format. - **data** (object) - An object containing event-specific details. - **task_id** (integer) - The ID of the task. - **task_name** (string) - The name of the task. - **project_id** (integer) - The ID of the project. - **experiment_id** (integer) - The ID of the experiment. - **team_id** (integer) - The ID of the team. - **user** (object) - Information about the user who triggered the event. - **id** (integer) - The user's ID. - **full_name** (string) - The user's full name. ``` -------------------------------- ### Example application.yml Configuration for SciNote Source: https://github.com/scinote-eln/scinote-web/wiki/Environmental-variables This YAML file demonstrates the structure and common parameters for configuring SciNote, including secrets, file storage options (local and S3), and mailer settings. It serves as a template for setting up the application's environment. ```yaml # Secrets SECRET_KEY_BASE: "<>" PAPERCLIP_HASH_SECRET: "<>" # File storage # For local file storage PAPERCLIP_STORAGE: "filesystem" # For S3 file storage #PAPERCLIP_STORAGE: "s3" #AWS_ACCESS_KEY_ID: "" #AWS_REGION: "" #AWS_SECRET_ACCESS_KEY: "" #S3_BUCKET: "" #S3_HOST_NAME: "" # Mailer settings MAIL_FROM: "Example SciNote Assistant " MAIL_REPLYTO: "Example SciNote Assistant " SMTP_ADDRESS: "your.yoursmtp.com" SMTP_PORT: "25" SMTP_DOMAIN: "yoursmtp.com" SMTP_USERNAME: "user@yoursmtp.com" SMTP_PASSWORD: "<>" SMTP_AUTH_METHOD: "plain" MAIL_SERVER_URL: "scinote.yourdomain.com" # Sign-up process NEW_TEAM_ON_SIGNUP: "true" ENABLE_EMAIL_CONFIRMATIONS: "false" ENABLE_USER_REGISTRATION: "true" ``` -------------------------------- ### Webhook Payload Example Source: https://context7.com/scinote-eln/scinote-web/llms.txt Example of a JSON payload sent by SciNote ELN when a task is completed. It includes event details, timestamp, and associated task and user information. ```json { "event": "task_completed", "timestamp": "2024-03-21T10:30:00.000Z", "data": { "task_id": 302, "task_name": "Apply Compound Treatment - Completed", "project_id": 42, "experiment_id": 88, "team_id": 1, "user": { "id": 23, "full_name": "Dr. Jane Smith" } } } ``` -------------------------------- ### Mount Addon Engine in routes.rb Source: https://github.com/scinote-eln/scinote-web/blob/develop/lib/generators/addon/templates/README.md Details the process of mounting the addon's Rails engine in the main application's routes configuration. This makes the addon's routes accessible within the main application. ```ruby mount ${NAME}::Engine => '/' ``` -------------------------------- ### Create User Role with Permissions Source: https://context7.com/scinote-eln/scinote-web/llms.txt This example shows how to define a new custom user role within a team, specifying a name and a list of permissions. This is useful for fine-grained access control. ```bash curl -X POST "https://your-instance.com/api/v1/teams/1/user_roles" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "user_roles", "attributes": { "name": "Lab Technician", "permissions": [ "ProjectPermissions::READ", "ExperimentPermissions::READ", "ExperimentPermissions::MANAGE", "MyModulePermissions::READ", "MyModulePermissions::MANAGE", "RepositoryPermissions::READ", "RepositoryPermissions::ROWS_CREATE" ] } } }' ``` -------------------------------- ### Create Protocol Step with Checklist Source: https://context7.com/scinote-eln/scinote-web/llms.txt This example shows how to add a new step to a protocol, including an embedded checklist. It first creates the step and then adds individual checklist items with their text and status. ```bash # First create the step with an embedded checklist curl -X POST "https://your-instance.com/api/v1/teams/1/projects/42/experiments/88/tasks/301/protocols/450/steps" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "steps", "attributes": { "name": "Safety Checks", "position": 0, "description": "Complete all safety procedures before starting" } }, "included": [ { "type": "checklists", "attributes": { "name": "Pre-experiment Safety" } } ] }' # Then add checklist items curl -X POST "https://your-instance.com/api/v1/teams/1/projects/42/experiments/88/tasks/301/protocols/450/steps/1003/checklists/201/checklist_items" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "checklist_items", "attributes": { "text": "Verify biosafety cabinet is operational", "checked": false } } }' ``` -------------------------------- ### Retrieve Project Activities with GET Request Source: https://context7.com/scinote-eln/scinote-web/llms.txt Fetches the activity log for a specific project, including all changes and events. Supports pagination by page number and size. Requires project and team IDs. Returns a list of activities. ```bash curl -X GET "https://your-instance.com/api/v1/teams/1/projects/75/activities?page[number]=1&page[size]=50" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" ``` -------------------------------- ### Include Addon CSS in application.scss Source: https://github.com/scinote-eln/scinote-web/blob/develop/lib/generators/addon/templates/README.md Explains how to include addon-specific CSS files by adding a reference in the main application's `application.scss` file. This ensures the addon's styles are applied. ```css /* *= require ${FOLDERS_PATH}/application */ ``` -------------------------------- ### Get Protocols for Task with Rich Text Rendering (Bash) Source: https://context7.com/scinote-eln/scinote-web/llms.txt Retrieves protocols associated with a specific task, including steps and rich text rendering support. Requires team, project, experiment, and task IDs. The response includes detailed protocol and step information. ```bash curl -X GET "https://your-instance.com/api/v1/teams/1/projects/42/experiments/88/tasks/301/protocols?include=steps&render_rte=true" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" ``` -------------------------------- ### Export Project to JSON (Bash) Source: https://context7.com/scinote-eln/scinote-web/llms.txt Initiates an asynchronous export of an entire project's data, including experiments, tasks, protocols, and results, into a JSON file. The initial request returns a job ID, and a separate GET request is used to download the resulting zip file. ```bash curl -X POST "https://your-instance.com/api/service/projects_json_export" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "project_id": 42, "team_id": 1 }' # Response initiates background job { "job_id": "export-job-uuid-12345", "status": "processing", "message": "Export started. You will receive a notification when complete." } # Later, download the export curl -X GET "https://your-instance.com/zip_exports/download/export-job-uuid-12345" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --output project-export.json ``` -------------------------------- ### Create and Manage Repository Protocols Source: https://context7.com/scinote-eln/scinote-web/llms.txt Illustrates the creation of a protocol template in the repository, including adding steps with checklists and tables, publishing the protocol, and linking it to a task. Requires a Team object and current user. ```ruby # Create repository protocol (template) template_protocol = team.protocols.create!( name: "PCR Standard Protocol v3.0", description: "Updated protocol with new primer design guidelines", protocol_type: :in_repository_draft, created_by: current_user ) # Add steps with multiple element types step = template_protocol.steps.create!( name: "Prepare PCR Master Mix", position: 0, created_by: current_user ) # Add checklist to step checklist = step.checklists.create!(name: "Components") checklist.checklist_items.create!([ { text: "10X PCR Buffer - 5 µL", position: 0, created_by: current_user }, { text: "dNTP Mix (10 mM) - 1 µL", position: 1, created_by: current_user }, { text: "Forward Primer (10 µM) - 1 µL", position: 2, created_by: current_user }, { text: "Reverse Primer (10 µM) - 1 µL", position: 3, created_by: current_user }, { text: "Taq Polymerase - 0.5 µL", position: 4, created_by: current_user }, { text: "Template DNA - 1 µL", position: 5, created_by: current_user }, { text: "Water - to 50 µL", position: 6, created_by: current_user } ]) # Add table to step table_data = { data: [ ["Cycle", "Temperature", "Duration"], ["Initial Denaturation", "95°C", "5 min"], ["Denaturation (35x)", "95°C", "30 sec"], ["Annealing (35x)", "58°C", "30 sec"], ["Extension (35x)", "72°C", "1 min"], ["Final Extension", "72°C", "10 min"] ] } step.tables.create!(contents: table_data.to_json, created_by: current_user) # Publish protocol template_protocol.update!( protocol_type: :in_repository_published_original, published_on: Time.current ) # Link template to task task.protocols.first.update!( protocol_type: :linked, parent: template_protocol ) ``` -------------------------------- ### Create Project API (Bash) Source: https://context7.com/scinote-eln/scinote-web/llms.txt Creates a new project within a specified team. The request body must be in JSON format and include project attributes such as name, description, visibility, and optional metadata. Authentication is required. ```bash curl -X POST "https://your-instance.com/api/v1/teams/1/projects" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "projects", "attributes": { "name": "Protein Expression Study", "description": "Analyzing protein expression patterns", "visibility": "visible", "start_date": "2024-04-01", "due_date": "2024-09-30", "status": "active", "metadata": { "grant_number": "NIH-2024-001", "pi": "Dr. John Doe" } } } }' ``` -------------------------------- ### GET /api/health Source: https://context7.com/scinote-eln/scinote-web/llms.txt Performs a basic health check to determine if the API is operational. ```APIDOC ## GET /api/health Check API availability and system status. ### Method GET ### Endpoint `/api/health` ### Parameters None ### Request Example ```bash curl -X GET "https://your-instance.com/api/health" ``` ### Response #### Success Response (200) - **status** (string) - Indicates the API status (e.g., `ok`). - **timestamp** (string) - The timestamp of the health check. #### Response Example ```json { "status": "ok", "timestamp": "2024-03-21T10:00:00.000Z" } ``` ``` -------------------------------- ### Create Report with Custom Configuration Source: https://context7.com/scinote-eln/scinote-web/llms.txt This snippet demonstrates how to create a new report from project data using custom configuration. It requires an authorization token and specifies the report name, description, project ID, and grouping. ```bash curl -X POST "https://your-instance.com/api/v1/teams/1/reports" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "reports", "attributes": { "name": "Q1 2024 Research Summary", "description": "Comprehensive report of Q1 research activities", "project_id": 42, "grouped_by": "my_module" } } }' ``` -------------------------------- ### Create and Manage Tasks in an Experiment Source: https://context7.com/scinote-eln/scinote-web/llms.txt Demonstrates the creation of a task within an experiment, including adding protocols, steps, text, linking inventory, adding results, and updating task status. Requires an existing Experiment object and current user. ```ruby experiment = Experiment.find(88) # Create task task = experiment.my_modules.create!( name: "Western Blot Analysis", description: "Analyze protein expression levels", x: 100, # Canvas position y: 50, created_by: current_user ) # Add protocol to task protocol = task.protocols.create!( name: "Standard Western Blot Protocol", protocol_type: :in_module, created_by: current_user ) # Add steps to protocol step1 = protocol.steps.create!( name: "Prepare samples", position: 0, created_by: current_user ) step1.step_texts.create!(text: "

Lysate cells and quantify protein

") # Link inventory items to task task.my_module_repository_rows.create!( repository_row: RepositoryRow.find(5001), assigned_by: current_user ) # Add result result = task.results.create!( name: "Blot Image", created_by: current_user, last_modified_by: current_user ) # Attach asset to result result.result_assets.create!( asset: Asset.create!( file: uploaded_file, created_by: current_user, team: task.team ) ) # Update task status task.update!(my_module_status_id: MyModuleStatus.find_by(name: "Completed").id) ``` -------------------------------- ### Get Project Activities Source: https://context7.com/scinote-eln/scinote-web/llms.txt Retrieves the activity log for a specific project, detailing all changes and events. ```APIDOC ## Get Project Activities ### Description Retrieve activity log for a project showing all changes and events. ### Method GET ### Endpoint `/api/v1/teams/{team_id}/projects/{project_id}/activities` ### Parameters #### Path Parameters - **team_id** (integer) - Required - The ID of the team the project belongs to. - **project_id** (integer) - Required - The ID of the project to retrieve activities for. #### Query Parameters - **page[number]** (integer) - Optional - The page number for pagination. - **page[size]** (integer) - Optional - The number of activities per page. ### Response #### Success Response (200 OK) - **data** (array) - An array of activity objects. - **id** (string) - The ID of the activity. - **type** (string) - The type of resource ('activities'). - **attributes** (object) - Contains the activity details. - **type_of** (string) - The type of event (e.g., 'create_project'). - **message** (string) - A description of the event. - **created_at** (string) - The timestamp when the activity occurred. - **user** (object) - Information about the user who performed the action. - **full_name** (string) - The full name of the user. #### Response Example ```json { "data": [ { "id": "1234", "type": "activities", "attributes": { "type_of": "create_project", "message": "Project 'Protein Expression Study' was created", "created_at": "2024-03-20T10:00:00.000Z", "user": { "full_name": "Dr. Jane Smith" } } } ] } ``` ``` -------------------------------- ### GET /api/status Source: https://context7.com/scinote-eln/scinote-web/llms.txt Provides detailed status information about the API, including version, database connectivity, and background job status. ```APIDOC ## GET /api/status Check API availability and system status with detailed information. ### Method GET ### Endpoint `/api/status` ### Parameters None ### Request Example ```bash curl -X GET "https://your-instance.com/api/status" ``` ### Response #### Success Response (200) - **status** (string) - Indicates the overall system status (e.g., `ok`). - **version** (string) - The current API version. - **database** (string) - The status of the database connection (e.g., `connected`). - **storage** (string) - The status of the storage system (e.g., `available`). - **background_jobs** (string) - The status of background job processing (e.g., `running`). #### Response Example ```json { "status": "ok", "version": "7.6.2", "database": "connected", "storage": "available", "background_jobs": "running" } ``` ``` -------------------------------- ### GET /api/v1/teams/{teamId}/inventories Source: https://context7.com/scinote-eln/scinote-web/llms.txt Retrieves a list of all inventories within a team, with options for pagination and filtering by creation time. ```APIDOC ## GET /api/v1/teams/{teamId}/inventories ### Description Get all inventories within a team with filtering by creation time. ### Method GET ### Endpoint `/api/v1/teams/{teamId}/inventories` ### Query Parameters - **page[number]** (integer) - Optional - The page number for pagination. - **page[size]** (integer) - Optional - The number of items per page. - **filter[created_at_from]** (string) - Optional - Filter inventories created on or after this date (YYYY-MM-DD). ### Request Example ```bash curl -X GET "https://your-instance.com/api/v1/teams/1/inventories?page[number]=1&page[size]=20&filter[created_at_from]=2024-01-01" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" ``` ### Response #### Success Response (200) - **data** (array) - An array of inventory objects. - **id** (string) - The unique identifier for the inventory. - **type** (string) - The type of the resource, always `inventories`. - **attributes** (object) - Contains the inventory's details. - **name** (string) - The name of the inventory. - **archived** (boolean) - Whether the inventory is archived. - **created_at** (string) - The timestamp when the inventory was created. #### Response Example ```json { "data": [ { "id": "12", "type": "inventories", "attributes": { "name": "Chemical Inventory", "archived": false, "created_at": "2024-02-01T10:00:00.000Z" } }, { "id": "13", "type": "inventories", "attributes": { "name": "Equipment Registry", "archived": false, "created_at": "2024-02-15T14:30:00.000Z" } } ] } ``` ``` -------------------------------- ### Create New Task with POST Request Source: https://context7.com/scinote-eln/scinote-web/llms.txt Creates a new task within a specified experiment. Allows setting task name, description, position (x, y coordinates), and metadata. Requires team, project, and experiment IDs. Returns the newly created task details upon success. ```bash curl -X POST "https://your-instance.com/api/v1/teams/1/projects/42/experiments/88/tasks" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ \ "data": { \ "type": "tasks", \ "attributes": { \ "name": "Apply Compound Treatment", \ "description": "Add drug compound at specified concentration", \ "x": 150, \ "y": 20, \ "metadata": { \ "treatment_time": "24h", \ "temperature": "37C" \ } \ } \ } \ }' ``` -------------------------------- ### GET /teams/{team_id}/repositories/{repository_id}/export?format=csv Source: https://context7.com/scinote-eln/scinote-web/llms.txt Exports inventory items and their values from a specific repository in CSV format. ```APIDOC ## GET /teams/{team_id}/repositories/{repository_id}/export?format=csv ### Description Exports inventory items and their values from a specific repository in CSV format. ### Method GET ### Endpoint /teams/{team_id}/repositories/{repository_id}/export ### Parameters #### Path Parameters - **team_id** (integer) - Required - The ID of the team. - **repository_id** (integer) - Required - The ID of the inventory repository. #### Query Parameters - **format** (string) - Required - Must be "csv" for CSV export. ### Request Example ```bash curl -X GET "https://your-instance.com/teams/1/repositories/12/export?format=csv" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --output chemical-inventory.csv ``` ### Response #### Success Response (200 OK) A CSV file containing the inventory data. #### CSV Output Example: ```csv ID,Name,Concentration,Storage Condition,Stock Quantity,Expiration Date 5001,Ethanol 99.9%,99.9%,Room Temperature,500 mL,2025-12-31 5002,Acetone HPLC Grade,99.5%,Room Temperature,250 mL,2024-12-31 ``` ``` -------------------------------- ### GET /api/v1/teams/{teamId}/inventories/{inventoryId}/inventory_items Source: https://context7.com/scinote-eln/scinote-web/llms.txt Retrieves a list of items within a specific inventory, with support for filtering and preloading cell data. ```APIDOC ## GET /api/v1/teams/{teamId}/inventories/{inventoryId}/inventory_items ### Description Get items from an inventory with filtering and cell value preloading. ### Method GET ### Endpoint `/api/v1/teams/{teamId}/inventories/{inventoryId}/inventory_items` ### Query Parameters - **filter[archived]** (boolean) - Optional - Filter items by their archived status (e.g., `false`). - **include** (string) - Optional - Include related data, e.g., `inventory_cells`. - **page[number]** (integer) - Optional - The page number for pagination. ### Request Example ```bash curl -X GET "https://your-instance.com/api/v1/teams/1/inventories/12/inventory_items?filter[archived]=false&include=inventory_cells&page[number]=1" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" ``` ### Response #### Success Response (200) - **data** (array) - An array of inventory item objects. - **id** (string) - The unique identifier for the inventory item. - **type** (string) - The type of the resource, always `inventory_items`. - **attributes** (object) - Contains the inventory item's details. - **name** (string) - The name of the inventory item. - **created_at** (string) - The timestamp when the item was created. - **updated_at** (string) - The timestamp when the item was last updated. - **archived** (boolean) - Whether the item is archived. - **relationships** (object) - Relationships to other resources. - **inventory_cells** (object) - Relationship to inventory cells. - **data** (array) - Array of cell objects with `id` and `type`. - **included** (array) - Included related resources, such as inventory cells. - **id** (string) - The unique identifier for the inventory cell. - **type** (string) - The type of the resource, always `inventory_cells`. - **attributes** (object) - Contains the cell's details. - **value** (object) - The value of the cell. - **data** (string) - The cell data. - **unit** (string) - The unit of the cell data. - **column_id** (integer) - The ID of the column this cell belongs to. #### Response Example ```json { "data": [ { "id": "5001", "type": "inventory_items", "attributes": { "name": "Ethanol 99.9%", "created_at": "2024-02-05T09:00:00.000Z", "updated_at": "2024-02-05T09:00:00.000Z", "archived": false }, "relationships": { "inventory_cells": { "data": [ {"id": "7001", "type": "inventory_cells"}, {"id": "7002", "type": "inventory_cells"} ] } } } ], "included": [ { "id": "7001", "type": "inventory_cells", "attributes": { "value": { "data": "500", "unit": "mL" }, "column_id": 25 } } ] } ``` ``` -------------------------------- ### Include Addon JavaScript in application.js.erb Source: https://github.com/scinote-eln/scinote-web/blob/develop/lib/generators/addon/templates/README.md Shows how to include addon-specific JavaScript files by referencing them in the main application's `application.js.erb` file. This requires the addon to be structured correctly. ```javascript //= require ${FOLDERS_PATH} ``` -------------------------------- ### Create New Heroku Application Source: https://github.com/scinote-eln/scinote-web/wiki/Heroku Creates a new Heroku application directly from the command line. This command initializes a new Heroku project linked to your current directory. ```heroku heroku create ``` -------------------------------- ### Create List Column and Items (Bash) Source: https://context7.com/scinote-eln/scinote-web/llms.txt First, creates a dropdown list type inventory column. Second, adds predefined options to this list column. This allows for standardized selection of values for a given inventory field. Requires team ID, inventory ID, and an authorization token. ```bash # Create list column curl -X POST "https://your-instance.com/api/v1/teams/1/inventories/12/inventory_columns" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "inventory_columns", "attributes": { "name": "Storage Condition", "data_type": "RepositoryListValue" } } }' # Then create list items curl -X POST "https://your-instance.com/api/v1/teams/1/inventories/12/inventory_columns/29/inventory_list_items" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "inventory_list_items", "attributes": { "data": "Room Temperature" } } }' ``` -------------------------------- ### Add Gem Dependency in Gemfile Source: https://github.com/scinote-eln/scinote-web/blob/develop/lib/generators/addon/templates/README.md Specifies how to add the addon as a dependency within the main SciNote application's Gemfile. This ensures the addon's code is included in the project build. ```ruby gem '${FULL_UNDERSCORE_NAME}', path: 'addons/${ADDON_NAME}' ``` -------------------------------- ### Assign User to Project with Role Source: https://context7.com/scinote-eln/scinote-web/llms.txt This snippet illustrates how to assign an existing user to a specific project with a predefined user role. It requires the team ID, project ID, user ID, and user role ID. ```bash curl -X POST "https://your-instance.com/api/v1/teams/1/projects/42/project_user_assignments" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "project_user_assignments", "attributes": { "user_id": 23, "user_role_id": 15 } } }' ``` -------------------------------- ### GET /api/v1/teams/{teamId}/projects/{projectId}/experiments/{experimentId}/tasks/{taskId}/protocols Source: https://context7.com/scinote-eln/scinote-web/llms.txt Retrieves a list of protocols associated with a specific task, with support for rich text rendering of protocol steps. ```APIDOC ## GET /api/v1/teams/{teamId}/projects/{projectId}/experiments/{experimentId}/tasks/{taskId}/protocols ### Description Get protocols associated with a task including rich text rendering support. ### Method GET ### Endpoint `/api/v1/teams/{teamId}/projects/{projectId}/experiments/{experimentId}/tasks/{taskId}/protocols` ### Query Parameters - **include** (string) - Optional - Include related data, e.g., `steps`. - **render_rte** (boolean) - Optional - Whether to render rich text editor content, e.g., `true`. ### Request Example ```bash curl -X GET "https://your-instance.com/api/v1/teams/1/projects/42/experiments/88/tasks/301/protocols?include=steps&render_rte=true" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/vnd.api+json" ``` ### Response #### Success Response (200) - **data** (array) - An array of protocol objects. - **id** (string) - The unique identifier for the protocol. - **type** (string) - The type of the resource, always `protocols`. - **attributes** (object) - Contains the protocol's details. - **name** (string) - The name of the protocol. - **description** (string) - A description of the protocol. - **protocol_type** (string) - The type of protocol (e.g., `in_module`). - **created_at** (string) - The timestamp when the protocol was created. - **updated_at** (string) - The timestamp when the protocol was last updated. - **relationships** (object) - Relationships to other resources. - **steps** (object) - Relationship to protocol steps. - **data** (array) - Array of step objects with `id` and `type`. - **included** (array) - Included related resources, such as steps. - **id** (string) - The unique identifier for the step. - **type** (string) - The type of the resource, always `steps`. - **attributes** (object) - Contains the step's details. - **name** (string) - The name of the step. - **position** (integer) - The order of the step in the protocol. - **completed** (boolean) - Whether the step is completed. - **description** (string) - The rich text description of the step. #### Response Example ```json { "data": [ { "id": "450", "type": "protocols", "attributes": { "name": "Cell Culture Protocol v2.1", "description": "Standard operating procedure for HeLa cell culture", "protocol_type": "in_module", "created_at": "2024-03-12T09:15:00.000Z", "updated_at": "2024-03-12T09:15:00.000Z" }, "relationships": { "steps": { "data": [ {"id": "1001", "type": "steps"}, {"id": "1002", "type": "steps"} ] } } } ], "included": [ { "id": "1001", "type": "steps", "attributes": { "name": "Thaw cells", "position": 0, "completed": true, "description": "

Thaw cryovial in 37°C water bath

" } } ] } ``` ```