Class: V1::QcResultsUploadResource

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

Overview

Note:

Access this resource via the /v1/qc_results_uploads endpoint.

Provides a JSON:API representation of QcResultsUpload.

QcResultsUploadResource resource handles the uploading of QC results via CSV data.

Steps:

  1. Validate QcResultsUpload data (via QcResultsUploadFactory validation)

  2. Create QcResultsUpload entity

  3. Create QcDecisions, QcResults, QcDecisionResult entities

  4. Build QcResultMessages

  5. Publish QcResultMessages

Examples:

csv_data=$(jq -Rs . qc_results.csv)
curl -X POST http://localhost:3100/v1/qc_results_uploads \
  -H "Content-Type: application/vnd.api+json" \
  -H "Accept: application/vnd.api+json" \
  -d '{
    "data": {
      "type": "qc_results_uploads",
      "attributes": {
        "csv_data": '"${csv_data}"',
        "used_by": "extraction"
      }
    }
  }'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#csv_data=(value) ⇒ String (writeonly)

Returns the CSV data for the QC results upload.

Returns:

  • (String)

    the CSV data for the QC results upload



40
# File 'app/resources/v1/qc_results_upload_resource.rb', line 40

attributes :csv_data, :used_by

#used_by=(value) ⇒ String (writeonly)

Returns the process or system that uploaded the QC results.

Returns:

  • (String)

    the process or system that uploaded the QC results



40
# File 'app/resources/v1/qc_results_upload_resource.rb', line 40

attributes :csv_data, :used_by

Instance Method Details

#publish_messagesObject



48
49
50
# File 'app/resources/v1/qc_results_upload_resource.rb', line 48

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