lib/catissue/domain/specimen_collection_group.rb
def add_defaults_local
      super
      # the default event
      self.collection_protocol_event ||= default_collection_event

      # the default collection status and received parameters
      if received? then
        self.collection_status ||= 'Complete'
      else
        self.collection_status ||= 'Pending'
        create_default_received_event_parameters
      end
      # the default collection event
      unless collected? then
        create_default_collection_event_parameters
      end

      # the default site
      self.collection_site ||= default_site
      
      # the default CT statuses
      make_default_consent_tier_statuses
    end
def add_defaults_local
      super
      # the default event
      self.collection_protocol_event ||= default_collection_event

      # the default collection status and received parameters
      if received? then
        self.collection_status ||= 'Complete'
      else
        self.collection_status ||= 'Pending'
        create_default_received_event_parameters
      end
      # the default collection event
      unless collected? then
        create_default_collection_event_parameters
      end

      # the default site
      self.collection_site ||= default_site
      
      # the default CT statuses
      make_default_consent_tier_statuses
    end
Adds defaults as follows:
 * The default collection event is the first event in the protocol registered with this SCG.
 * The default collection status is 'Complete' if there is a received event, 'Pending' otherwise.
 * The default collection site is the CP site, if this SCG is {#received?} and there is only CP one,
   otherwise the {CaTissue::Site.default_site}.
 * The default conset tier status is 'Complete' if there is a received event, 'Pending' otherwise.
 * A default ReceivedEventParameters is added to this SCG if the collection status is
   'Complete' and there is no other ReceivedEventParameters. The receiver is an arbitrary
   protocol coordinator.

 @raise [Jinx::ValidationError] if the default ReceivedEventParameters could not be created because
   there is no protocol or protocol coordinator
 @see CollectionProtocol#first_event