Class: CaTissue::Participant
- Inherits:
-
Object
- Object
- CaTissue::Participant
- Includes:
- Person
- Defined in:
- lib/catissue/domain/participant.rb,
lib/catissue/domain/participant/clinical/duration.rb,
lib/catissue/domain/participant/clinical/chemotherapy.rb,
lib/catissue/domain/participant/clinical/radiation_therapy.rb,
lib/catissue/domain/participant/clinical/treatment_regimen.rb
Overview
The Participant domain class.
Defined Under Namespace
Modules: Clinical
Instance Method Summary collapse
-
#add_mrn(site, mrn) ⇒ CaTissue::ParticipantMedicalIdentifier
A new PMI which adds this Participant to the site with the MRN.
-
#collection_protocols ⇒ Object
Returns this Participant’s CollectionProtocolRegistration protocols.
-
#collection_site ⇒ CaTissue::Site
Returns the collection site for which this participant has a MRN.
-
#key ⇒ Object
The SSN if it exists, otherwise the first ParticipantMedicalIdentifier, if any, otherwise nil.
-
#medical_record_number ⇒ String
Returns the MRN for this participant.
-
#medical_record_numbers ⇒ <String>
This Participant’s medical record numbers.
-
#merge_attribute(attribute, newval, matches = nil) ⇒ Object
Overrides
CaRuby::Mergable.merge_attribute
to work around the caTissue bugs described in Participant.remove_phantom_medical_identifier. -
#specimens ⇒ <CTissue::Specimen>
All specimens collected from this participant.
Methods included from Person
Instance Method Details
#add_mrn(site, mrn) ⇒ CaTissue::ParticipantMedicalIdentifier
Returns a new PMI which adds this Participant to the site with the MRN.
77 78 79 |
# File 'lib/catissue/domain/participant.rb', line 77 def add_mrn(site, mrn) CaTissue::ParticipantMedicalIdentifier.new(:participant => self, :site => site, :medical_record_number => mrn) end |
#collection_protocols ⇒ Object
Returns this Participant’s CollectionProtocolRegistration protocols.
93 94 95 |
# File 'lib/catissue/domain/participant.rb', line 93 def collection_protocols collection_registrations.map { |reg| reg.protocol }.uniq end |
#collection_site ⇒ CaTissue::Site
Returns the collection site for which this participant has a MRN. If there is not exactly one such site, then this method returns nil. This method is a convenience for the common situation where a participant is enrolled at one site.
110 111 112 113 114 115 |
# File 'lib/catissue/domain/participant.rb', line 110 def collection_site return unless medical_identifiers.size == 1 site = medical_identifiers.first.site return if site.nil? site.site_type == Site::SiteType::COLLECTION ? site : nil end |
#key ⇒ Object
Returns the SSN if it exists, otherwise the first ParticipantMedicalIdentifier, if any, otherwise nil.
69 70 71 |
# File 'lib/catissue/domain/participant.rb', line 69 def key super or medical_identifiers.first end |
#medical_record_number ⇒ String
Returns the MRN for this participant. If this Participant does not have exactly one MRN, then this method returns nil. This method is a convenience for the common situation where a participant is enrolled at one site.
101 102 103 |
# File 'lib/catissue/domain/participant.rb', line 101 def medical_record_number return medical_identifiers.first.medical_record_number if medical_identifiers.size == 1 end |
#medical_record_numbers ⇒ <String>
Returns this Participant’s medical record numbers. Each medical record number is site-specific.
83 84 85 |
# File 'lib/catissue/domain/participant.rb', line 83 def medical_record_numbers medical_identifiers.map { |pmi| pmi.medicalRecordNumber } end |
#merge_attribute(attribute, newval, matches = nil) ⇒ Object
Overrides CaRuby::Mergable.merge_attribute
to work around the caTissue
bugs described in {CaTissue::Participant.remove_phantom_medical_identifier}.
61 62 63 64 65 66 |
# File 'lib/catissue/domain/participant.rb', line 61 def merge_attribute(attribute, newval, matches=nil) if attribute == :participant_medical_identifiers and newval then CaTissue::Participant.remove_phantom_medical_identifier(newval) end super end |
#specimens ⇒ <CTissue::Specimen>
Returns all specimens collected from this participant.
88 89 90 |
# File 'lib/catissue/domain/participant.rb', line 88 def specimens Jinx::Flattener.new(registrations.map { |cpr| cpr.specimens }) end |