Module: CaTissue::CollectibleEventParameters

Included in:
CollectionEventParameters, ReceivedEventParameters
Defined in:
lib/catissue/helpers/collectible_event_parameters.rb,
lib/catissue/migration/shims.rb,
lib/catissue/migration/migratable.rb

Overview

A CollectibleEventParameters is a SpecimenEventParameters which pertains to Specimen or SpecimenCollectionGroup collection at the point of tissue acquisition from the participant or receival at the tissue bank.

Instance Method Summary collapse

Instance Method Details

#match_in_owner_scope(others) ⇒ Object

Returns the SpecimenEventParameters in others which matches this CollectibleEventParameters in the scope of an owner Specimen or SCG. This method relaxes Jinx::Resource.match_in_owner_scope for a CollectibleEventParameters that matches any SpecimenEventParameters in others of the same class, since there can be at most one CollectibleEventParameters of a given class for a given SCG.



14
15
16
# File 'lib/catissue/helpers/collectible_event_parameters.rb', line 14

def match_in_owner_scope(others)
  others.detect { |other| minimal_match?(other) }
end

#migrate_specimen(spc, row) ⇒ Specimen?

Returns the given Specimen spc unless this CollectibleEventParameters already has a SCG owner. A CollectibleEventParameters is preferentially set to a migrated SCG rather than a migrated Specimen.

Overrides Jinx::Migratable.migratable__target_value to confer precedence to a SCG over a Specimen when setting this event parameters’ owner. If the migrated collection includes both a Specimen and a SCG, then this event parameters specimen reference is ambiguous, but the specimen_collection_group reference is not.

Parameters:

  • spc (Specimen)

    the migrated owner specimen

Returns:

  • (Specimen, nil)

    spc unless there is already a SCG owner



109
110
111
# File 'lib/catissue/migration/shims.rb', line 109

def migrate_specimen(spc, row)
  spc unless specimen_collection_group
end

#migrate_specimen_collection_group(scg, row) ⇒ SpecimenCollectionGroup

Returns scg.

Parameters:

Returns:

See Also:



97
98
99
100
101
# File 'lib/catissue/migration/shims.rb', line 97

def migrate_specimen_collection_group(scg, row)
  # unset the specimen parent if necessary
  self.specimen = nil if specimen and scg
  scg
end