Class: CandidApiClient::AsyncDiagnosesClient

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::AsyncDiagnosesClient

Parameters:



125
126
127
# File 'lib/candidhealth/diagnoses/client.rb', line 125

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



121
122
123
# File 'lib/candidhealth/diagnoses/client.rb', line 121

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:



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/candidhealth/diagnoses/client.rb', line 141

def create(request:, request_options: nil)
  Async do
    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
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)


218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/candidhealth/diagnoses/client.rb', line 218

def delete(diagnosis_id:, request_options: nil)
  Async do
    @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
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:



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/candidhealth/diagnoses/client.rb', line 187

def update(diagnosis_id:, name: nil, code_type: nil, code: nil, request_options: nil)
  Async do
    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
end