Class: Insdc::Country
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Insdc::Country
- Includes:
- SharedBehaviour::Named
- Defined in:
- app/models/insdc/country.rb
Overview
be aware you may need to escape the square brackets if using zsh
Provides a controlled vocabulary describing names of countries or oceans/seas in accordance with the INSDC (www.insdc.org/)
In addition the list may contain non-geographic identifiers that are permitted by the EBI sample checklists (eg ‘not collected’) An example EBI checklist may be found here: www.ebi.ac.uk/ena/browser/view/ERC000011
The list can be populated via the rake:task bundle exec rake insdc:countries:import
To import from an alternative sample sheet, use bundle exec rake insdc:countries:import[other_accession]
Instance Attribute Summary collapse
-
#:name(: name) ⇒ String
The name of the country, ocean, sea or permitted non-geographic region.
-
#:sort_priority(: sort_priority) ⇒ Integer
Higher sort priorities are sorted towards the top of dropdown lists to aid picking.
-
#:validation_state(: validation_state) ⇒ Symbol
Indicates if a region is valid for selection or not.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from SharedBehaviour::Named
Methods inherited from ApplicationRecord
alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
Instance Attribute Details
#:name(: name) ⇒ String
Returns The name of the country, ocean, sea or permitted non-geographic region.
22 |
# File 'app/models/insdc/country.rb', line 22 attribute :name, :string |
#:sort_priority(: sort_priority) ⇒ Integer
Higher sort priorities are sorted towards the top of dropdown lists to aid picking
27 |
# File 'app/models/insdc/country.rb', line 27 attribute :sort_priority, :integer, default: 0 |
#:validation_state(: validation_state) ⇒ Symbol
This has been implemented as an enum for flexible extension at a later date.
Indicates if a region is valid for selection or not
33 |
# File 'app/models/insdc/country.rb', line 33 enum :validation_state, { valid: 0, invalid: 1 }, suffix: :state |
Class Method Details
.options ⇒ Object
47 48 49 |
# File 'app/models/insdc/country.rb', line 47 def self. sorted_for_select.pluck(:name) end |
Instance Method Details
#invalid! ⇒ Object
51 52 53 |
# File 'app/models/insdc/country.rb', line 51 def invalid! update!(validation_state: :invalid) end |