Class: CandidApiClient::PreEncounter::Patients::V1::AsyncV1Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/pre_encounter/patients/v_1/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::PreEncounter::Patients::V1::AsyncV1Client

Parameters:



552
553
554
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 552

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



548
549
550
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 548

def request_client
  @request_client
end

Instance Method Details

#create(request:, skip_duplicate_check: nil, request_options: nil) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::Patient

Adds a patient. VersionConflictError is returned when the patient’s external ID

is already in use.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.create(skip_duplicate_check: true, request: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, other_names: [{ family: "string", given: ["string"], use: USUAL, period: {  } }], gender: MAN, birth_date: DateTime.parse(2023-01-15), social_security_number: "string", biological_sex: FEMALE, sexual_orientation: HETEROSEXUAL, race: AMERICAN_INDIAN_OR_ALASKA_NATIVE, ethnicity: HISPANIC_OR_LATINO, disability_status: DISABLED, marital_status: ANNULLED, deceased: DateTime.parse(2024-01-15T09:30:00.000Z), multiple_birth: 1, primary_address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }, other_addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }], primary_telecom: { value: "string", use: HOME }, other_telecoms: [{ value: "string", use: HOME }], email: "string", electronic_communication_opt_in: true, photo: "string", language: "string", external_provenance: { external_id: "string", system_name: "string" }, contacts: [{ relationship: [SELF], name: { family: "string", given: ["string"], use: USUAL, period: {  } }, telecoms: [{ value: "string", use: HOME }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }], period: {  }, hipaa_authorization: true }], general_practitioners: [{ name: { family: "string", given: ["string"], use: USUAL, period: {  } }, type: PRIMARY, npi: "string", telecoms: [{ value: "string", use: HOME }], addresses: , period: {  }, canonical_id: "string" }], filing_order: { coverages: ["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"] }, non_insurance_payers: ["string"], non_insurance_payer_associations: [{ id: "string" }], guarantor: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, telecom: { value: "string", use: HOME }, email: "string", birth_date: DateTime.parse(2023-01-15), address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } } }, self_pay: true, authorizations: [{ payer_id: "string", payer_name: "string", authorization_number: "string", cpt_code: "string", units: VISIT }], referrals: [{ provider: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, type: PRIMARY, npi: "string", telecoms: [{ value: "string", use: HOME }], addresses: , period: {  }, canonical_id: "string" }, referral_number: "string" }], primary_service_facility_id: "string", do_not_invoice_reason: BANKRUPTCY })

Parameters:

  • skip_duplicate_check (Boolean) (defaults to: nil)
  • request (Hash)

    Request of type CandidApiClient::PreEncounter::Patients::V1::Types::MutablePatient, as a Hash

    • :name (Hash)

      • :family (String)

      • :given (Array<String>)

      • :use (CandidApiClient::PreEncounter::Common::Types::NameUse)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_names (Array<CandidApiClient::PreEncounter::Common::Types::HumanName>)

    • :gender (CandidApiClient::PreEncounter::Common::Types::Gender)

    • :birth_date (Date)

    • :social_security_number (String)

    • :biological_sex (CandidApiClient::PreEncounter::Common::Types::Sex)

    • :sexual_orientation (CandidApiClient::PreEncounter::Common::Types::SexualOrientation)

    • :race (CandidApiClient::PreEncounter::Common::Types::Race)

    • :ethnicity (CandidApiClient::PreEncounter::Common::Types::Ethnicity)

    • :disability_status (CandidApiClient::PreEncounter::Common::Types::DisabilityStatus)

    • :marital_status (CandidApiClient::PreEncounter::Patients::V1::Types::MaritalStatus)

    • :deceased (DateTime)

    • :multiple_birth (Integer)

    • :primary_address (Hash)

      • :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)

      • :line (Array<String>)

      • :city (String)

      • :state (String)

      • :postal_code (String)

      • :country (String)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)

    • :primary_telecom (Hash)

      • :value (String)

      • :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)

    • :email (String)

    • :electronic_communication_opt_in (Boolean)

    • :photo (String)

    • :language (String)

    • :external_provenance (Hash)

      • :external_id (String)

      • :system_name (String)

    • :contacts (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Contact>)

    • :general_practitioners (Array<CandidApiClient::PreEncounter::Common::Types::ExternalProvider>)

    • :filing_order (Hash)

      • :coverages (Array<String>)

    • :non_insurance_payers (Array<String>)

    • :non_insurance_payer_associations (Array<CandidApiClient::PreEncounter::Common::Types::CanonicalNonInsurancePayerAssociation>)

    • :guarantor (Hash)

      • :name (Hash)

        • :family (String)

        • :given (Array<String>)

        • :use (CandidApiClient::PreEncounter::Common::Types::NameUse)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

      • :telecom (Hash)

        • :value (String)

        • :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

      • :email (String)

      • :birth_date (Date)

      • :address (Hash)

        • :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)

        • :line (Array<String>)

        • :city (String)

        • :state (String)

        • :postal_code (String)

        • :country (String)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

    • :self_pay (Boolean)

    • :authorizations (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Authorization>)

    • :referrals (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Referral>)

    • :primary_service_facility_id (String)

    • :do_not_invoice_reason (CandidApiClient::PreEncounter::Patients::V1::Types::DoNotInvoiceReason)

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

Returns:



647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 647

def create(request:, skip_duplicate_check: nil, 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.params = {
        **(request_options&.additional_query_parameters || {}),
        "skip_duplicate_check": skip_duplicate_check
      }.compact
      req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/patients/v1"
    end
    CandidApiClient::PreEncounter::Patients::V1::Types::Patient.from_json(json_object: response.body)
  end
end

#create_with_mrn(request:, skip_duplicate_check: nil, request_options: nil) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::Patient

Adds a patient and hydrates their MRN with a pre-existing MRN. Once this patient

is created their MRN will not be editable. InvalidMRNError is returned when the
MRN is greater than 20 characters. VersionConflictError is returned when the
patient's external ID is already in use.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.create_with_mrn(skip_duplicate_check: true, request: { mrn: "string", name: { family: "string", given: ["string"], use: USUAL, period: {  } }, other_names: [{ family: "string", given: ["string"], use: USUAL, period: {  } }], gender: MAN, birth_date: DateTime.parse(2023-01-15), social_security_number: "string", biological_sex: FEMALE, sexual_orientation: HETEROSEXUAL, race: AMERICAN_INDIAN_OR_ALASKA_NATIVE, ethnicity: HISPANIC_OR_LATINO, disability_status: DISABLED, marital_status: ANNULLED, deceased: DateTime.parse(2024-01-15T09:30:00.000Z), multiple_birth: 1, primary_address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }, other_addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }], primary_telecom: { value: "string", use: HOME }, other_telecoms: [{ value: "string", use: HOME }], email: "string", electronic_communication_opt_in: true, photo: "string", language: "string", external_provenance: { external_id: "string", system_name: "string" }, contacts: [{ relationship: [SELF], name: { family: "string", given: ["string"], use: USUAL, period: {  } }, telecoms: [{ value: "string", use: HOME }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }], period: {  }, hipaa_authorization: true }], general_practitioners: [{ name: { family: "string", given: ["string"], use: USUAL, period: {  } }, type: PRIMARY, npi: "string", telecoms: [{ value: "string", use: HOME }], addresses: , period: {  }, canonical_id: "string" }], filing_order: { coverages: ["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"] }, non_insurance_payers: ["string"], non_insurance_payer_associations: [{ id: "string" }], guarantor: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, telecom: { value: "string", use: HOME }, email: "string", birth_date: DateTime.parse(2023-01-15), address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } } }, self_pay: true, authorizations: [{ payer_id: "string", payer_name: "string", authorization_number: "string", cpt_code: "string", units: VISIT }], referrals: [{ provider: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, type: PRIMARY, npi: "string", telecoms: [{ value: "string", use: HOME }], addresses: , period: {  }, canonical_id: "string" }, referral_number: "string" }], primary_service_facility_id: "string", do_not_invoice_reason: BANKRUPTCY })

Parameters:

  • skip_duplicate_check (Boolean) (defaults to: nil)
  • request (Hash)

    Request of type CandidApiClient::PreEncounter::Patients::V1::Types::MutablePatientWithMrn, as a Hash

    • :mrn (String)

    • :name (Hash)

      • :family (String)

      • :given (Array<String>)

      • :use (CandidApiClient::PreEncounter::Common::Types::NameUse)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_names (Array<CandidApiClient::PreEncounter::Common::Types::HumanName>)

    • :gender (CandidApiClient::PreEncounter::Common::Types::Gender)

    • :birth_date (Date)

    • :social_security_number (String)

    • :biological_sex (CandidApiClient::PreEncounter::Common::Types::Sex)

    • :sexual_orientation (CandidApiClient::PreEncounter::Common::Types::SexualOrientation)

    • :race (CandidApiClient::PreEncounter::Common::Types::Race)

    • :ethnicity (CandidApiClient::PreEncounter::Common::Types::Ethnicity)

    • :disability_status (CandidApiClient::PreEncounter::Common::Types::DisabilityStatus)

    • :marital_status (CandidApiClient::PreEncounter::Patients::V1::Types::MaritalStatus)

    • :deceased (DateTime)

    • :multiple_birth (Integer)

    • :primary_address (Hash)

      • :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)

      • :line (Array<String>)

      • :city (String)

      • :state (String)

      • :postal_code (String)

      • :country (String)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)

    • :primary_telecom (Hash)

      • :value (String)

      • :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)

    • :email (String)

    • :electronic_communication_opt_in (Boolean)

    • :photo (String)

    • :language (String)

    • :external_provenance (Hash)

      • :external_id (String)

      • :system_name (String)

    • :contacts (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Contact>)

    • :general_practitioners (Array<CandidApiClient::PreEncounter::Common::Types::ExternalProvider>)

    • :filing_order (Hash)

      • :coverages (Array<String>)

    • :non_insurance_payers (Array<String>)

    • :non_insurance_payer_associations (Array<CandidApiClient::PreEncounter::Common::Types::CanonicalNonInsurancePayerAssociation>)

    • :guarantor (Hash)

      • :name (Hash)

        • :family (String)

        • :given (Array<String>)

        • :use (CandidApiClient::PreEncounter::Common::Types::NameUse)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

      • :telecom (Hash)

        • :value (String)

        • :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

      • :email (String)

      • :birth_date (Date)

      • :address (Hash)

        • :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)

        • :line (Array<String>)

        • :city (String)

        • :state (String)

        • :postal_code (String)

        • :country (String)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

    • :self_pay (Boolean)

    • :authorizations (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Authorization>)

    • :referrals (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Referral>)

    • :primary_service_facility_id (String)

    • :do_not_invoice_reason (CandidApiClient::PreEncounter::Patients::V1::Types::DoNotInvoiceReason)

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

Returns:



763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 763

def create_with_mrn(request:, skip_duplicate_check: nil, 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.params = {
        **(request_options&.additional_query_parameters || {}),
        "skip_duplicate_check": skip_duplicate_check
      }.compact
      req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/patients/v1/with_mrn"
    end
    CandidApiClient::PreEncounter::Patients::V1::Types::Patient.from_json(json_object: response.body)
  end
end

#deactivate(id:, version:, request_options: nil) ⇒ Void

Sets a patient as deactivated. The path must contain the most recent version to

prevent race conditions. Deactivating historic versions is not supported.
Subsequent updates via PUT to the patient will "reactivate" the patient and set
the deactivated flag to false.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.deactivate(id: "string", version: "string")

Parameters:

Returns:

  • (Void)


1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 1010

def deactivate(id:, version:, 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: PreEncounter,
                                         request_options: request_options)}/patients/v1/#{id}/#{version}"
    end
  end
end

#get(id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::Patient

Gets a patient.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.get(id: "string")

Parameters:

Returns:



837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 837

def get(id:, request_options: nil)
  Async do
    response = @request_client.conn.get 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: PreEncounter,
                                         request_options: request_options)}/patients/v1/#{id}"
    end
    CandidApiClient::PreEncounter::Patients::V1::Types::Patient.from_json(json_object: response.body)
  end
end

#get_history(id:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Patients::V1::Types::Patient>

Gets a patient along with it’s full history. The return list is ordered by

version ascending.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.get_history(id: "string")

Parameters:

Returns:



863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 863

def get_history(id:, request_options: nil)
  Async do
    response = @request_client.conn.get 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: PreEncounter,
                                         request_options: request_options)}/patients/v1/#{id}/history"
    end
    parsed_json = JSON.parse(response.body)
    parsed_json&.map do |item|
      item = item.to_json
      CandidApiClient::PreEncounter::Patients::V1::Types::Patient.from_json(json_object: item)
    end
  end
end

#get_multi(limit: nil, mrn: nil, page_token: nil, sort_field: nil, sort_direction: nil, request_options: nil) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::PatientPage

Searches for patients that match the query parameters.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.get_multi(
  limit: 1,
  mrn: "string",
  page_token: "string",
  sort_field: "string",
  sort_direction: ASC
)

Parameters:

Returns:



803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 803

def get_multi(limit: nil, mrn: nil, page_token: nil, sort_field: nil, sort_direction: nil,
              request_options: nil)
  Async do
    response = @request_client.conn.get 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.params = {
        **(request_options&.additional_query_parameters || {}),
        "limit": limit,
        "mrn": mrn,
        "page_token": page_token,
        "sort_field": sort_field,
        "sort_direction": sort_direction
      }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/patients/v1/get_multi"
    end
    CandidApiClient::PreEncounter::Patients::V1::Types::PatientPage.from_json(json_object: response.body)
  end
end

#scan(since:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Patients::V1::Types::Patient>

Scans up to 100 patient updates. The since query parameter is inclusive, and the

result list is ordered by updatedAt ascending.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.scan(since: DateTime.parse(2024-01-15T09:30:00.000Z))

Parameters:

Returns:



1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 1070

def scan(since:, request_options: nil)
  Async do
    response = @request_client.conn.get 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.params = { **(request_options&.additional_query_parameters || {}), "since": since }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/patients/v1/updates/scan"
    end
    parsed_json = JSON.parse(response.body)
    parsed_json&.map do |item|
      item = item.to_json
      CandidApiClient::PreEncounter::Patients::V1::Types::Patient.from_json(json_object: item)
    end
  end
end

#search(mrn: nil, similar_name_ordering: nil, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Patients::V1::Types::Patient>

Returns a list of Patients based on the search criteria.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.search(mrn: "string", similar_name_ordering: "string")

Parameters:

  • mrn (String) (defaults to: nil)
  • similar_name_ordering (String) (defaults to: nil)

    A string that is used to order similar names in search results.

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

Returns:



1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 1035

def search(mrn: nil, similar_name_ordering: nil, request_options: nil)
  Async do
    response = @request_client.conn.get 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.params = {
        **(request_options&.additional_query_parameters || {}),
        "mrn": mrn,
        "similar_name_ordering": similar_name_ordering
      }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/patients/v1"
    end
    parsed_json = JSON.parse(response.body)
    parsed_json&.map do |item|
      item = item.to_json
      CandidApiClient::PreEncounter::Patients::V1::Types::Patient.from_json(json_object: item)
    end
  end
end

#update(id:, version:, request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::Patient

Updates a patient. The path must contain the most recent version to prevent race

conditions. Updating historic versions is not supported.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.patients.v_1.update(
  id: "string",
  version: "string",
  request: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, other_names: [{ family: "string", given: ["string"], use: USUAL, period: {  } }], gender: MAN, birth_date: DateTime.parse(2023-01-15), social_security_number: "string", biological_sex: FEMALE, sexual_orientation: HETEROSEXUAL, race: AMERICAN_INDIAN_OR_ALASKA_NATIVE, ethnicity: HISPANIC_OR_LATINO, disability_status: DISABLED, marital_status: ANNULLED, deceased: DateTime.parse(2024-01-15T09:30:00.000Z), multiple_birth: 1, primary_address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }, other_addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }], primary_telecom: { value: "string", use: HOME }, other_telecoms: [{ value: "string", use: HOME }], email: "string", electronic_communication_opt_in: true, photo: "string", language: "string", external_provenance: { external_id: "string", system_name: "string" }, contacts: [{ relationship: [SELF], name: { family: "string", given: ["string"], use: USUAL, period: {  } }, telecoms: [{ value: "string", use: HOME }], addresses: [{ use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } }], period: {  }, hipaa_authorization: true }], general_practitioners: [{ name: { family: "string", given: ["string"], use: USUAL, period: {  } }, type: PRIMARY, npi: "string", telecoms: [{ value: "string", use: HOME }], addresses: , period: {  }, canonical_id: "string" }], filing_order: { coverages: ["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"] }, non_insurance_payers: ["string"], non_insurance_payer_associations: [{ id: "string" }], guarantor: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, telecom: { value: "string", use: HOME }, email: "string", birth_date: DateTime.parse(2023-01-15), address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } } }, self_pay: true, authorizations: [{ payer_id: "string", payer_name: "string", authorization_number: "string", cpt_code: "string", units: VISIT }], referrals: [{ provider: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, type: PRIMARY, npi: "string", telecoms: [{ value: "string", use: HOME }], addresses: , period: {  }, canonical_id: "string" }, referral_number: "string" }], primary_service_facility_id: "string", do_not_invoice_reason: BANKRUPTCY }
)

Parameters:

  • id (String)
  • version (String)
  • request (Hash)

    Request of type CandidApiClient::PreEncounter::Patients::V1::Types::MutablePatient, as a Hash

    • :name (Hash)

      • :family (String)

      • :given (Array<String>)

      • :use (CandidApiClient::PreEncounter::Common::Types::NameUse)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_names (Array<CandidApiClient::PreEncounter::Common::Types::HumanName>)

    • :gender (CandidApiClient::PreEncounter::Common::Types::Gender)

    • :birth_date (Date)

    • :social_security_number (String)

    • :biological_sex (CandidApiClient::PreEncounter::Common::Types::Sex)

    • :sexual_orientation (CandidApiClient::PreEncounter::Common::Types::SexualOrientation)

    • :race (CandidApiClient::PreEncounter::Common::Types::Race)

    • :ethnicity (CandidApiClient::PreEncounter::Common::Types::Ethnicity)

    • :disability_status (CandidApiClient::PreEncounter::Common::Types::DisabilityStatus)

    • :marital_status (CandidApiClient::PreEncounter::Patients::V1::Types::MaritalStatus)

    • :deceased (DateTime)

    • :multiple_birth (Integer)

    • :primary_address (Hash)

      • :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)

      • :line (Array<String>)

      • :city (String)

      • :state (String)

      • :postal_code (String)

      • :country (String)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_addresses (Array<CandidApiClient::PreEncounter::Common::Types::Address>)

    • :primary_telecom (Hash)

      • :value (String)

      • :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

    • :other_telecoms (Array<CandidApiClient::PreEncounter::Common::Types::ContactPoint>)

    • :email (String)

    • :electronic_communication_opt_in (Boolean)

    • :photo (String)

    • :language (String)

    • :external_provenance (Hash)

      • :external_id (String)

      • :system_name (String)

    • :contacts (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Contact>)

    • :general_practitioners (Array<CandidApiClient::PreEncounter::Common::Types::ExternalProvider>)

    • :filing_order (Hash)

      • :coverages (Array<String>)

    • :non_insurance_payers (Array<String>)

    • :non_insurance_payer_associations (Array<CandidApiClient::PreEncounter::Common::Types::CanonicalNonInsurancePayerAssociation>)

    • :guarantor (Hash)

      • :name (Hash)

        • :family (String)

        • :given (Array<String>)

        • :use (CandidApiClient::PreEncounter::Common::Types::NameUse)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

      • :telecom (Hash)

        • :value (String)

        • :use (CandidApiClient::PreEncounter::Common::Types::ContactPointUse)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

      • :email (String)

      • :birth_date (Date)

      • :address (Hash)

        • :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)

        • :line (Array<String>)

        • :city (String)

        • :state (String)

        • :postal_code (String)

        • :country (String)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

    • :self_pay (Boolean)

    • :authorizations (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Authorization>)

    • :referrals (Array<CandidApiClient::PreEncounter::Patients::V1::Types::Referral>)

    • :primary_service_facility_id (String)

    • :do_not_invoice_reason (CandidApiClient::PreEncounter::Patients::V1::Types::DoNotInvoiceReason)

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

Returns:



980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
# File 'lib/candidhealth/pre_encounter/patients/v_1/client.rb', line 980

def update(id:, version:, request:, request_options: nil)
  Async do
    response = @request_client.conn.put 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: PreEncounter,
                                         request_options: request_options)}/patients/v1/#{id}/#{version}"
    end
    CandidApiClient::PreEncounter::Patients::V1::Types::Patient.from_json(json_object: response.body)
  end
end