Skip to content

Commit

Permalink
map carrier names to names provided by client in h41/h36 and fix cop …
Browse files Browse the repository at this point in the history
…issues
  • Loading branch information
saipraveen18 committed Dec 5, 2023
1 parent bbb70aa commit 1574093
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Metrics/AbcSize:
Max: 50

Metrics/ClassLength:
Max: 200
Max: 300

Metrics/ModuleLength:
Max: 200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def construct_insurance_coverage(tax_households, policy)
ApplicableCoverageMonthNum: prepend_zeros(calendar_month.to_s, 2),
QHPPolicyNum: policy.policy_id,
QHPIssuerEIN: policy.insurance_provider.fein,
IssuerNm: policy.insurance_provider.title,
IssuerNm: fetch_insurance_provider_title(policy.insurance_provider.title),
PolicyCoverageStartDt: policy.start_on,
PolicyCoverageEndDt: policy.end_on,
TotalQHPMonthlyPremiumAmt: format('%.2f', total_premium),
Expand All @@ -65,6 +65,15 @@ def construct_insurance_coverage(tax_households, policy)
end
end

def fetch_insurance_provider_title(title)
{
"Anthem Blue Cross and Blue Shield" => "Anthem Health Plans of Maine Inc",
"Harvard Pilgrim Health Care" => "Harvard Pilgrim Health Care Inc",
"Community Health Options" => "Maine Community Health Options",
"Taro Health" => "Taro Health Plan of Maine Inc"
}[title] || title
end

def effectuated_for_month?(tax_households, calendar_month)
month = Date::MONTHNAMES[calendar_month]
calendar_month_coverages = tax_households.collect do |tax_household|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Fdsh
module H36
module Request
# BuildH36TaxHouseholdsPayload
# rubocop:disable Metrics/ClassLength
class BuildH36TaxHouseholdsPayload
include Dry::Monads[:result, :do, :try]

Expand Down Expand Up @@ -286,7 +285,6 @@ def decrypt_ssn(encrypted_ssn)
AcaEntities::Operations::Encryption::Decrypt.new.call({ value: encrypted_ssn }).value!.gsub("-", "")
end
end
# rubocop:enable Metrics/ClassLength
end
end
end
2 changes: 0 additions & 2 deletions app/operations/fdsh/h41/insurance_policies/enqueue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module InsurancePolicies
# 5. Find H41 Transmissions(Corrected, Original, and Void) for given reporting year
# 6. creates database model Transmittable::TransactionsTransmissions, the join table between Transactions and H41 Transmissions
# 7. Updates all the :untransmitted transactions that map to the subject
# rubocop:disable Metrics/ClassLength
class Enqueue
include Dry::Monads[:result, :do]

Expand Down Expand Up @@ -321,7 +320,6 @@ def validate(params)
Success(params)
end
end
# rubocop:enable Metrics/ClassLength
end
end
end
11 changes: 10 additions & 1 deletion app/operations/fdsh/h41/request/build_1095a_payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,19 @@ def construct_covered_individuals(covered_individuals)
end

def construct_policy(policy, provider)
{ MarketPlacePolicyNum: policy.policy_id, PolicyIssuerNm: provider.title,
{ MarketPlacePolicyNum: policy.policy_id, PolicyIssuerNm: fetch_insurance_provider_title(provider.title),
PolicyStartDt: policy.start_on, PolicyTerminationDt: policy.end_on }
end

def fetch_insurance_provider_title(title)
{
"Anthem Blue Cross and Blue Shield" => "Anthem Health Plans of Maine Inc",
"Harvard Pilgrim Health Care" => "Harvard Pilgrim Health Care Inc",
"Community Health Options" => "Maine Community Health Options",
"Taro Health" => "Taro Health Plan of Maine Inc"
}[title] || title
end

def construct_premium_information(tax_household)
{
JanPremiumInformation: premium_information(tax_household, 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,41 @@
expect(result.success?).to be_truthy
expect(result.success.first.keys).to include(:InsuranceCoverages)
end

context "carrier name mapping" do
context "when provider name exists in the mapping" do
let(:provider_title) { "Taro Health" }

it "returns the mapped value" do
agreement = family.households.first.insurance_agreements.first
insurance_policies = agreement.insurance_policies
params = {
insurance_policies: insurance_policies,
max_month: max_month
}

result = ::Fdsh::H36::Request::BuildH36InsurancePoliciesPayload.new.call(params)
issuer_name = result.success[0][:InsuranceCoverages][0][:IssuerNm]
expect(issuer_name).to eq("Taro Health Plan of Maine Inc")
end
end

context "when provider name does not exist in the mapping" do
let(:provider_title) { "Anthem Health" }

it "returns the provided value is" do
agreement = family.households.first.insurance_agreements.first
insurance_policies = agreement.insurance_policies
params = {
insurance_policies: insurance_policies,
max_month: max_month
}

result = ::Fdsh::H36::Request::BuildH36InsurancePoliciesPayload.new.call(params)
issuer_name = result.success[0][:InsuranceCoverages][0][:IssuerNm]
expect(issuer_name).to eq(provider_title)
end
end
end
end
end
22 changes: 22 additions & 0 deletions spec/operations/fdsh/h41/request/build_1095a_payload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,28 @@
end
end

context "carrier name mapping" do
context "when provider name exists in the mapping" do
let(:provider_title) { "Taro Health" }
let(:transaction_type) { :corrected }
let(:record_sequence_num) { 'batch_id|file_id|record_id' }

it "returns the mapped value" do
expect(subject.success[:Policy][:PolicyIssuerNm]).to eq("Taro Health Plan of Maine Inc")
end
end

context "when provider name does not exist in the mapping" do
let(:provider_title) { "Anthem Health" }
let(:transaction_type) { :corrected }
let(:record_sequence_num) { 'batch_id|file_id|record_id' }

it "returns the provided value" do
expect(subject.success[:Policy][:PolicyIssuerNm]).to eq(provider_title)
end
end
end

context 'for original transaction_type' do
let(:transaction_type) { :original }
let(:record_sequence_num) { nil }
Expand Down
4 changes: 3 additions & 1 deletion spec/shared_examples/family_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@
}
end

let(:provider_title) { "MAINE COMMUNITY HEALTH OPTIONS" }

let(:contract_holder) do
{
hbx_id: "1000595",
Expand Down Expand Up @@ -357,7 +359,7 @@

let(:insurance_provider) do
{
title: "MAINE COMMUNITY HEALTH OPTIONS",
title: provider_title,
hios_id: "123456",
fein: "311705652",
insurance_products: [insurance_product]
Expand Down
4 changes: 3 additions & 1 deletion spec/shared_examples/family_response3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,11 @@
]
end

let(:provider_title) {"MAINE COMMUNITY HEALTH OPTIONS" }

let(:insurance_provider) do
{
title: "MAINE COMMUNITY HEALTH OPTIONS",
title: provider_title,
hios_id: "123456",
fein: "311705652",
insurance_products: [insurance_product]
Expand Down

0 comments on commit 1574093

Please sign in to comment.