Class: CandidApiClient::DiagnosesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/diagnoses/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::DiagnosesClient

Parameters:



16
17
18
# File 'lib/candidhealth/diagnoses/client.rb', line 16

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



12
13
14
# File 'lib/candidhealth/diagnoses/client.rb', line 12

def request_client
  @request_client
end

Instance Method Details

#create(request:, request_options: nil) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis

Creates a new diagnosis for an encounter

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.diagnoses.create(request: { encounter_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", name: "string", code_type: ABF, code: "string" })

Parameters:

  • request (Hash)

    Request of type CandidApiClient::Diagnoses::Types::StandaloneDiagnosisCreate, as a Hash

    • :encounter_id (String)

    • :name (String)

    • :code_type (CandidApiClient::Diagnoses::Types::DiagnosisTypeCode)

    • :code (String)

  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/candidhealth/diagnoses/client.rb', line 32

def create(request:, request_options: nil)
  response = @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
    req.url "#{@request_client.get_url(environment: CandidApi, request_options: request_options)}/api/diagnoses/v2"
  end
  CandidApiClient::Diagnoses::Types::Diagnosis.from_json(json_object: response.body)
end

#delete(diagnosis_id:, request_options: nil) ⇒ Void

Deletes the diagnosis record associated with the provided ‘diagnosis_id`

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.diagnoses.delete(diagnosis_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:

  • (Void)


104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/candidhealth/diagnoses/client.rb', line 104

def delete(diagnosis_id:, request_options: nil)
  @request_client.conn.delete do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/diagnoses/v2/#{diagnosis_id}"
  end
end

#update(diagnosis_id:, name: nil, code_type: nil, code: nil, request_options: nil) ⇒ CandidApiClient::Diagnoses::Types::Diagnosis

Updates the diagnosis record matching the provided ‘diagnosis_id`

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.diagnoses.update(
  diagnosis_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  name: "string",
  code_type: ABF,
  code: "string"
)

Parameters:

  • diagnosis_id (String)
  • name (String) (defaults to: nil)

    Empty string not allowed.

  • code_type (CandidApiClient::Diagnoses::Types::DiagnosisTypeCode) (defaults to: nil)

    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.

  • code (String) (defaults to: nil)

    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

  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/candidhealth/diagnoses/client.rb', line 75

def update(diagnosis_id:, name: nil, code_type: nil, code: nil, request_options: nil)
  response = @request_client.conn.patch do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      name: name,
      code_type: code_type,
      code: code
    }.compact
    req.url "#{@request_client.get_url(environment: CandidApi,
                                       request_options: request_options)}/api/diagnoses/v2/#{diagnosis_id}"
  end
  CandidApiClient::Diagnoses::Types::Diagnosis.from_json(json_object: response.body)
end