Class: Retab::ClassificationWorkflowArtifact

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_artifacts/classification_workflow_artifact.rb

Constant Summary collapse

HASH_ATTRS =
{
  id: :id,
  file: :file,
  model: :model,
  categories: :categories,
  n_consensus: :n_consensus,
  instructions: :instructions,
  output: :output,
  consensus: :consensus,
  usage: :usage,
  created_at: :created_at,
  operation: :operation
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

#inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ ClassificationWorkflowArtifact

Returns a new instance of ClassificationWorkflowArtifact.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 35

def initialize(json)
  hash = self.class.normalize(json)
  @id = hash[:id]
  @file = hash[:file] ? Retab::FileRef.new(hash[:file]) : nil
  @model = hash[:model]
  @categories = (hash[:categories] || []).map { |item| item ? Retab::Category.new(item) : nil }
  @n_consensus = hash[:n_consensus]
  @instructions = hash[:instructions]
  @output = hash[:output] ? Retab::ClassificationDecision.new(hash[:output]) : nil
  @consensus = hash[:consensus] ? Retab::ClassificationConsensus.new(hash[:consensus]) : nil
  @usage = hash[:usage] ? Retab::RetabUsage.new(hash[:usage]) : nil
  @created_at = hash[:created_at]
  @operation = hash[:operation]
end

Instance Attribute Details

#categoriesObject

Returns the value of attribute categories.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def categories
  @categories
end

#consensusObject

Returns the value of attribute consensus.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def consensus
  @consensus
end

#created_atObject

Returns the value of attribute created_at.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def created_at
  @created_at
end

#fileObject

Returns the value of attribute file.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def file
  @file
end

#idObject

Returns the value of attribute id.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def id
  @id
end

#instructionsObject

Returns the value of attribute instructions.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def instructions
  @instructions
end

#modelObject

Returns the value of attribute model.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def model
  @model
end

#n_consensusObject

Returns the value of attribute n_consensus.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def n_consensus
  @n_consensus
end

#operationObject

Returns the value of attribute operation.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def operation
  @operation
end

#outputObject

Returns the value of attribute output.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def output
  @output
end

#usageObject

Returns the value of attribute usage.



22
23
24
# File 'lib/retab/workflow_artifacts/classification_workflow_artifact.rb', line 22

def usage
  @usage
end