Class: V1::Ont::RunResource

Inherits:
JSONAPI::Resource
  • Object
show all
Defined in:
app/resources/v1/ont/run_resource.rb

Overview

Note:

Access this resource via the /v1/ont/runs/ endpoint.

Provides a JSON:API representation of Ont::Run.

Attributes:

  • experiment_name: The name of the experiment.

  • state: The state of the run.

  • rebasecalling_process: The rebasecalling process of the run.

  • created_at: The creation timestamp of the run.

  • ont_instrument_id: The ID of the associated instrument.

  • flowcell_attributes: The attributes of the flowcells in the run.

Filters:

  • experiment_name: Filter runs by experiment name.

  • state: Filter runs by state.

Primary relationships:

Relationship trees:

  • flowcells.pool

Examples:

curl -X GET "http://localhost:3100/v1/ont/runs" -H "accept: application/vnd.api+json"

curl -X GET "http://localhost:3100/v1/ont/runs/1?include=flowcells.pool" \
     -H "accept: application/vnd.api+json"

curl -X POST "http://localhost:3100/v1/ont/runs" \
 -H "accept: application/vnd.api+json" \
 -H "Content-Type: application/vnd.api+json" \
 -d '{
    "data": {
    "type": "runs",
    "attributes": {
      "experiment_name": "Experiment 1",
      "state": "pending",
      "rebasecalling_process": "process_1",
      "ont_instrument_id": 1,
      "flowcell_attributes": [
        {
          "id": 1,
          "flowcell_id": "flowcell_1",
          "position": "A1",
          "ont_pool_id": 1
        },
       {
          "id": 2,
          "flowcell_id": "flowcell_2",
          "position": "B1",
          "ont_pool_id": 2
       }
      ]
     }
    }
   }'

curl -X PATCH "http://localhost:3100/v1/ont/runs/1" \
 -H "accept: application/vnd.api+json" \
 -H "Content-Type: application/vnd.api+json" \
 -d '{"data": {"type": "runs", "id": "1", "attributes": {"state": "completed"}}}'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#created_atString

Returns the creation timestamp of the run.

Returns:

  • (String)

    the creation timestamp of the run



87
88
# File 'app/resources/v1/ont/run_resource.rb', line 87

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#experiment_nameString

Returns the name of the experiment.

Returns:

  • (String)

    the name of the experiment



87
88
# File 'app/resources/v1/ont/run_resource.rb', line 87

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#flowcell_attributesArray<Hash>

Returns the attributes of the flowcells in the run.

Returns:

  • (Array<Hash>)

    the attributes of the flowcells in the run



87
88
# File 'app/resources/v1/ont/run_resource.rb', line 87

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#ont_instrument_idInteger

Returns the ID of the associated instrument.

Returns:

  • (Integer)

    the ID of the associated instrument



87
88
# File 'app/resources/v1/ont/run_resource.rb', line 87

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#rebasecalling_processString

Returns the rebasecalling process of the run.

Returns:

  • (String)

    the rebasecalling process of the run



87
88
# File 'app/resources/v1/ont/run_resource.rb', line 87

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#stateString

Returns the state of the run.

Returns:

  • (String)

    the state of the run



87
88
# File 'app/resources/v1/ont/run_resource.rb', line 87

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

Class Method Details

.default_sortObject



103
104
105
# File 'app/resources/v1/ont/run_resource.rb', line 103

def self.default_sort
  [{ field: 'created_at', direction: :desc }]
end

Instance Method Details

#fetchable_fieldsObject



120
121
122
# File 'app/resources/v1/ont/run_resource.rb', line 120

def fetchable_fields
  super - [:flowcell_attributes]
end

#publish_messagesObject



124
125
126
# File 'app/resources/v1/ont/run_resource.rb', line 124

def publish_messages
  Messages.publish(@model, Pipelines.ont.message)
end