Class: V1::QcReceptionResource

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

Overview

Note:

This resource is write-only: its endpoint will not accept GET, PATCH, or DELETE requests.

Note:

Access this resource via the /v1/qc_receptions endpoint.

rubocop:disable Layout/LineLength Provides a JSON:API representation of QcReception model.

A QcReception makes an entry in qc_receptions for all the requests received TOL consumer on the qc_reception endpoint. Stores the qc data in qc_results table with the associated qc_reception_id

Steps:

  1. Create QcReception

  2. Create QcResults

  3. Publish qc result messages

For more information about JSON:API see the JSON:API Specifications or look at the JSONAPI::Resources package for the service implementation of the JSON:API standard. rubocop:enable Layout/LineLength

Examples:

POST request to create a new QC reception with QC results


curl -X POST "http://localhost:3100/v1/qc_receptions" \
  -H "Content-Type: application/vnd.api+json" \
  -H "Accept: application/vnd.api+json" \
  -d '{
    "data": {
      "type": "qc_receptions",
      "attributes": {
        "source": "tol-lab-share.tol",
        "qc_results_list": [
          {
            "final_nano_drop": "200",
            "final_nano_drop_230": "230",
            "post_spri_concentration": "10",
            "final_nano_drop_280": "280",
            "post_spri_volume": "20",
            "sheared_femto_fragment_size": "5",
            "shearing_qc_comments": "Comments",
            "labware_barcode": "FD20706500",
            "sample_external_id": "supplier_sample_name_DDD"
          }
        ]
      }
    }
  }'

Constant Summary collapse

PERMITTED_QC_FIELDS =
%w[
  labware_barcode
  sample_external_id
  sheared_femto_fragment_size
  post_spri_concentration
  post_spri_volume
  final_nano_drop_280
  final_nano_drop_230
  final_nano_drop
  shearing_qc_comments
  date_submitted
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#qc_results_list=(request_parameters) ⇒ Object (writeonly)

Sets the QC results list from the request parameters.

Parameters:

  • request_parameters (Array<Hash>)

    the request parameters for QC results

Raises:

  • (ArgumentError)

    if the request parameters are not an array



67
# File 'app/resources/v1/qc_reception_resource.rb', line 67

attributes :qc_results_list, :source

#source=(value) ⇒ String (writeonly)

Returns the source of the QC reception.

Returns:

  • (String)

    the source of the QC reception



67
# File 'app/resources/v1/qc_reception_resource.rb', line 67

attributes :qc_results_list, :source

Instance Method Details

#create_qc_results!Object

Creates QC results for the model.



67
# File 'app/resources/v1/qc_reception_resource.rb', line 67

attributes :qc_results_list, :source

#permitted_attributesArray<String>

Returns the list of permitted QC fields.

Returns:

  • (Array<String>)

    the list of permitted QC fields



67
# File 'app/resources/v1/qc_reception_resource.rb', line 67

attributes :qc_results_list, :source

#publish_messagesObject

Publishes messages for the QC reception.



67
# File 'app/resources/v1/qc_reception_resource.rb', line 67

attributes :qc_results_list, :source