Class: MPI::Messages::AddPersonImplicitSearchMessage
- Inherits:
-
Object
- Object
- MPI::Messages::AddPersonImplicitSearchMessage
- Defined in:
- lib/mpi/messages/add_person_implicit_search_message.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#birth_date ⇒ Object
readonly
Returns the value of attribute birth_date.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#idme_uuid ⇒ Object
readonly
Returns the value of attribute idme_uuid.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#logingov_uuid ⇒ Object
readonly
Returns the value of attribute logingov_uuid.
-
#ssn ⇒ Object
readonly
Returns the value of attribute ssn.
Instance Method Summary collapse
- #build_body ⇒ Object private
- #build_patient ⇒ Object private
- #build_patient_person ⇒ Object private
- #build_registration_event ⇒ Object private
- #build_subject ⇒ Object private
- #build_subject_1 ⇒ Object private
- #combined_street ⇒ Object private
- #csp_identifier ⇒ Object private
- #csp_uuid ⇒ Object private
- #email_type ⇒ Object private
- #identifier ⇒ Object private
- #identifier_class_code ⇒ Object private
- #identifier_root ⇒ Object private
-
#initialize(first_name:, last_name:, ssn:, birth_date:, email: nil, address: nil, idme_uuid: nil, logingov_uuid: nil) ⇒ AddPersonImplicitSearchMessage
constructor
rubocop:disable Metrics/ParameterLists.
- #null_flavor_type ⇒ Object private
-
#perform ⇒ Object
rubocop:enable Metrics/ParameterLists.
- #ssn_class_code ⇒ Object private
- #ssn_root ⇒ Object private
- #validate_required_fields ⇒ Object private
Constructor Details
#initialize(first_name:, last_name:, ssn:, birth_date:, email: nil, address: nil, idme_uuid: nil, logingov_uuid: nil) ⇒ AddPersonImplicitSearchMessage
rubocop:disable Metrics/ParameterLists
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 14 def initialize(first_name:, last_name:, ssn:, birth_date:, email: nil, address: nil, idme_uuid: nil, logingov_uuid: nil) @first_name = first_name @last_name = last_name @ssn = ssn @email = email @address = address @birth_date = birth_date @idme_uuid = idme_uuid @logingov_uuid = logingov_uuid end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
11 12 13 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 11 def address @address end |
#birth_date ⇒ Object (readonly)
Returns the value of attribute birth_date.
11 12 13 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 11 def birth_date @birth_date end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
11 12 13 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 11 def email @email end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
11 12 13 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 11 def first_name @first_name end |
#idme_uuid ⇒ Object (readonly)
Returns the value of attribute idme_uuid.
11 12 13 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 11 def idme_uuid @idme_uuid end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
11 12 13 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 11 def last_name @last_name end |
#logingov_uuid ⇒ Object (readonly)
Returns the value of attribute logingov_uuid.
11 12 13 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 11 def logingov_uuid @logingov_uuid end |
#ssn ⇒ Object (readonly)
Returns the value of attribute ssn.
11 12 13 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 11 def ssn @ssn end |
Instance Method Details
#build_body ⇒ Object (private)
51 52 53 54 55 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 51 def build_body element = RequestHelper.build_control_act_process_element element << build_subject element end |
#build_patient ⇒ Object (private)
78 79 80 81 82 83 84 85 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 78 def build_patient element = RequestHelper.build_patient_element element << RequestHelper.build_id_null_flavor(type: null_flavor_type) element << RequestHelper.build_status_code element << build_patient_person element << RequestHelper.build_provider_organization element end |
#build_patient_person ⇒ Object (private)
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 87 def build_patient_person element = RequestHelper.build_patient_person_element element << RequestHelper.build_patient_person_name(given_names: [first_name], family_name: last_name) element << RequestHelper.build_patient_person_birth_date(birth_date:) element << RequestHelper.build_telecom(type: email_type, value: email) if address.present? element << RequestHelper.build_patient_person_address(street: combined_street, state: address[:state], city: address[:city], postal_code: address[:postal_code], country: address[:country]) end element << RequestHelper.build_identifier(identifier:, root: identifier_root) if ssn.present? element << RequestHelper.build_patient_identifier(identifier: ssn, root: ssn_root, class_code: ssn_class_code) end element << RequestHelper.build_patient_identifier(identifier:, root: identifier_root, class_code: identifier_class_code) element end |
#build_registration_event ⇒ Object (private)
63 64 65 66 67 68 69 70 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 63 def build_registration_event element = RequestHelper.build_registration_event_element element << RequestHelper.build_id_null_flavor(type: null_flavor_type) element << RequestHelper.build_status_code element << build_subject_1 element << RequestHelper.build_custodian element end |
#build_subject ⇒ Object (private)
57 58 59 60 61 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 57 def build_subject element = RequestHelper.build_subject_element element << build_registration_event element end |
#build_subject_1 ⇒ Object (private)
72 73 74 75 76 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 72 def build_subject_1 element = RequestHelper.build_subject_1_element element << build_patient element end |
#combined_street ⇒ Object (private)
109 110 111 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 109 def combined_street [address[:street], address[:street2]].compact.join(' ') end |
#csp_identifier ⇒ Object (private)
117 118 119 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 117 def csp_identifier idme_uuid ? Constants::IDME_FULL_IDENTIFIER : Constants::LOGINGOV_FULL_IDENTIFIER end |
#csp_uuid ⇒ Object (private)
121 122 123 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 121 def csp_uuid idme_uuid || logingov_uuid end |
#email_type ⇒ Object (private)
137 138 139 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 137 def email_type 'H' end |
#identifier ⇒ Object (private)
113 114 115 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 113 def identifier "#{csp_uuid}^#{csp_identifier}" end |
#identifier_class_code ⇒ Object (private)
141 142 143 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 141 def identifier_class_code 'PAT' end |
#identifier_root ⇒ Object (private)
145 146 147 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 145 def identifier_root MPI::Constants::VA_ROOT_OID end |
#null_flavor_type ⇒ Object (private)
125 126 127 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 125 def null_flavor_type 'UNK' end |
#perform ⇒ Object
rubocop:enable Metrics/ParameterLists
33 34 35 36 37 38 39 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 33 def perform validate_required_fields MPI::Messages::RequestBuilder.new(extension: MPI::Constants::ADD_PERSON, body: build_body).perform rescue => e Rails.logger.error "[AddPersonImplicitSearchMessage] Failed to build request: #{e.}" raise e end |
#ssn_class_code ⇒ Object (private)
133 134 135 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 133 def ssn_class_code 'SSN' end |
#ssn_root ⇒ Object (private)
129 130 131 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 129 def ssn_root '2.16.840.1.113883.4.1' end |
#validate_required_fields ⇒ Object (private)
43 44 45 46 47 48 49 |
# File 'lib/mpi/messages/add_person_implicit_search_message.rb', line 43 def validate_required_fields missing_values = [] missing_values << :last_name if last_name.blank? missing_values << :birth_date if birth_date.blank? missing_values << :credential_identifier if idme_uuid.blank? && logingov_uuid.blank? raise Errors::ArgumentError, "Required values missing: #{missing_values}" if missing_values.present? end |