Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set the pregnancy status to post partum status if not pregnant #251

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/aca_entities/atp/operations/aces/generate_xml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ def remove_flagged_params(record)
applicant['non_ssn_apply_reason'] = nil if param_flags.include?('drop_non_ssn_apply_reason')
applicant['is_ssn_applied'] = nil if param_flags.include?('drop_non_ssn_apply_reason')
applicant['vlp_document'] = nil if param_flags.include?('drop_vlp_document')
applicant['vlp_document'] = nil if param_flags.include?('drop_vlp_document')
if param_flags.include?('post_partum_is_pregnancy')
post_partum = applicant.dig('pregnancy_information', 'is_post_partum_period')
pregnant = applicant.dig('pregnancy_information', 'is_pregnant')
applicant["pregnancy_information"]["is_pregnant"] = pregnant || post_partum
end
applicant['incomes'].each do |income|
income['start_on'] = nil if param_flags.include?('drop_income_start_on')
income['end_on'] = nil if param_flags.include?('drop_income_end_on')
Expand Down
14 changes: 14 additions & 0 deletions spec/aca_entities/atp/operations/aces/generate_xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@
expect(texts.present?).to be_falsey
end
end

context 'pregnancy status defer to post partum' do
it 'should populate the PersonPregnancyStatus/StatusIndictor with true' do
param_flags = { 'drop_param_flags' => ['post_partum_is_pregnancy'] }
flagged_payload = payload_hash.merge(param_flags)
flagged_payload["family"]["magi_medicaid_applications"]["applicants"].first["pregnancy_information"]["is_pregnant"] = false
flagged_payload["family"]["magi_medicaid_applications"]["applicants"].first["pregnancy_information"]["is_post_partum_period"] = true
result = described_class.new.call(flagged_payload.to_json)
doc = Nokogiri::XML.parse(result.value!)
texts = doc.xpath("//hix-core:PersonPregnancyStatus/hix-core:StatusIndicator", namespaces)
expect(texts.present?).to be_truthy
expect(texts&.first&.content&.strip).to eq "true"
end
end
end
end
end