Class: Ecoportal::API::GraphQL::Diff::Pairing::Candidate

Inherits:
Struct
  • Object
show all
Defined in:
lib/ecoportal/api/graphql/diff/pairing/candidate.rb

Overview

A scored pairing proposal: source object (id-space A) <-> target object (id-space B), with the aggregate confidence and the per-signal breakdown that produced it.

source/target are the raw field docs (Hashes) being paired. score is 0.0..1.0. signals maps signal-name => contribution (for transparency + the ledger + Product's Field-ID data). matched_by names the dominant signal (e.g. :genome, :label, :ledger).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#matched_byObject

Returns the value of attribute matched_by

Returns:

  • (Object)

    the current value of matched_by



12
13
14
# File 'lib/ecoportal/api/graphql/diff/pairing/candidate.rb', line 12

def matched_by
  @matched_by
end

#scoreObject

Returns the value of attribute score

Returns:

  • (Object)

    the current value of score



12
13
14
# File 'lib/ecoportal/api/graphql/diff/pairing/candidate.rb', line 12

def score
  @score
end

#signalsObject

Returns the value of attribute signals

Returns:

  • (Object)

    the current value of signals



12
13
14
# File 'lib/ecoportal/api/graphql/diff/pairing/candidate.rb', line 12

def signals
  @signals
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



12
13
14
# File 'lib/ecoportal/api/graphql/diff/pairing/candidate.rb', line 12

def source
  @source
end

#targetObject

Returns the value of attribute target

Returns:

  • (Object)

    the current value of target



12
13
14
# File 'lib/ecoportal/api/graphql/diff/pairing/candidate.rb', line 12

def target
  @target
end

Instance Method Details

#source_idObject



13
14
15
# File 'lib/ecoportal/api/graphql/diff/pairing/candidate.rb', line 13

def source_id
  source && source['id']
end

#target_idObject



17
18
19
# File 'lib/ecoportal/api/graphql/diff/pairing/candidate.rb', line 17

def target_id
  target && target['id']
end

#to_hObject



21
22
23
24
25
26
# File 'lib/ecoportal/api/graphql/diff/pairing/candidate.rb', line 21

def to_h
  {
    source_id: source_id, target_id: target_id, score: score,
    matched_by: matched_by, signals: signals
  }.compact
end