Class: CandidApiClient::Diagnoses::Types::Diagnosis
- Inherits:
-
Object
- Object
- CandidApiClient::Diagnoses::Types::Diagnosis
- Defined in:
- lib/candidhealth/diagnoses/types/diagnosis.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#code ⇒ String
readonly
Empty string not allowed.
-
#code_type ⇒ CandidApiClient::Diagnoses::Types::DiagnosisTypeCode
readonly
Typically, providers submitting claims to Candid are using ICD-10 diagnosis codes.
- #created_at ⇒ DateTime readonly
- #diagnosis_id ⇒ String readonly
- #encounter_id ⇒ String readonly
-
#name ⇒ String
readonly
Empty string not allowed.
- #updated_at ⇒ DateTime readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis
Deserialize a JSON object to an instance of Diagnosis.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(diagnosis_id:, created_at:, updated_at:, encounter_id:, code_type:, code:, name: OMIT, additional_properties: nil) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Diagnosis to a JSON object.
Constructor Details
#initialize(diagnosis_id:, created_at:, updated_at:, encounter_id:, code_type:, code:, name: OMIT, additional_properties: nil) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 67 def initialize(diagnosis_id:, created_at:, updated_at:, encounter_id:, code_type:, code:, name: OMIT, additional_properties: nil) @diagnosis_id = diagnosis_id @created_at = created_at @updated_at = updated_at @encounter_id = encounter_id @name = name if name != OMIT @code_type = code_type @code = code @additional_properties = additional_properties @_field_set = { "diagnosis_id": diagnosis_id, "created_at": created_at, "updated_at": updated_at, "encounter_id": encounter_id, "name": name, "code_type": code_type, "code": code }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
39 40 41 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 39 def additional_properties @additional_properties end |
#code ⇒ String (readonly)
Returns Empty string not allowed. Should be of the appropriate format for the provided ‘code_type`. Must obey the ICD-10 format if an ICD-10 code_type is provided, specifically:
-
Letter
-
Digit
-
Digit or the letter ‘A` or `B`
-
(Optional) Period ‘.`
-
Up to 4 (or as few as 0) letters and digits.
37 38 39 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 37 def code @code end |
#code_type ⇒ CandidApiClient::Diagnoses::Types::DiagnosisTypeCode (readonly)
Returns Typically, providers submitting claims to Candid are using ICD-10 diagnosis codes. If you are using ICD-10 codes, the primary diagnosis code listed on the claim should use the ABK code_type. If more than one diagnosis is being submitted on a claim, please use ABF for the rest of the listed diagnoses. If you are using ICD-9 diagnosis codes, use BK and BF for the principal and following diagnosis code(s) respectively.
28 29 30 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 28 def code_type @code_type end |
#created_at ⇒ DateTime (readonly)
15 16 17 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 15 def created_at @created_at end |
#diagnosis_id ⇒ String (readonly)
13 14 15 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 13 def diagnosis_id @diagnosis_id end |
#encounter_id ⇒ String (readonly)
19 20 21 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 19 def encounter_id @encounter_id end |
#name ⇒ String (readonly)
Returns Empty string not allowed.
21 22 23 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 21 def name @name end |
#updated_at ⇒ DateTime (readonly)
17 18 19 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 17 def updated_at @updated_at end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis
Deserialize a JSON object to an instance of Diagnosis
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 94 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) diagnosis_id = struct["diagnosis_id"] created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?) updated_at = (DateTime.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?) encounter_id = struct["encounter_id"] name = struct["name"] code_type = struct["code_type"] code = struct["code"] new( diagnosis_id: diagnosis_id, created_at: created_at, updated_at: updated_at, encounter_id: encounter_id, name: name, code_type: code_type, code: code, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
129 130 131 132 133 134 135 136 137 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 129 def self.validate_raw(obj:) obj.diagnosis_id.is_a?(String) != false || raise("Passed value for field obj.diagnosis_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") obj.encounter_id.is_a?(String) != false || raise("Passed value for field obj.encounter_id is not the expected type, validation failed.") obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.code_type.is_a?(CandidApiClient::Diagnoses::Types::DiagnosisTypeCode) != false || raise("Passed value for field obj.code_type is not the expected type, validation failed.") obj.code.is_a?(String) != false || raise("Passed value for field obj.code is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Diagnosis to a JSON object
119 120 121 |
# File 'lib/candidhealth/diagnoses/types/diagnosis.rb', line 119 def to_json(*_args) @_field_set&.to_json end |