-
Notifications
You must be signed in to change notification settings - Fork 66
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
[10-10EZ] Boilerplate to generate filled out 10-10EZ pdf #20784
Changes from all commits
9c08b6d
57ac4c5
fd0d83a
f6256ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'pdf_fill/forms/form_base' | ||
|
||
module PdfFill | ||
module Forms | ||
class Va1010ez < FormBase | ||
FORM_ID = HealthCareApplication::FORM_ID | ||
|
||
KEY = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be updated to include all fields in future PRs, but for now we wanted to just get the basic generation/filling functionality out there. This work is not exposed externally anywhere either. |
||
'veteranFullName' => { | ||
key: 'F[0].P4[0].LastFirstMiddle[0]' | ||
} | ||
}.freeze | ||
|
||
def merge_fields(_options = {}) | ||
merge_full_name | ||
@form_data | ||
end | ||
|
||
private | ||
|
||
def merge_full_name | ||
@form_data['veteranFullName'] = | ||
combine_full_name(@form_data['veteranFullName']) | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
{ | ||
"isMedicaidEligible": true, | ||
"spouseAddress": { | ||
"street": "12345 Elm St", | ||
"city": "Houston", | ||
"postalCode": "77388", | ||
"country": "USA", | ||
"state": "TX" | ||
}, | ||
"spousePhone": "2122122121", | ||
"cohabitedLastYear": true, | ||
"sameAddress": false, | ||
"medicarePartAEffectiveDate": "2000-01-01", | ||
"medicareClaimNumber": "0123456", | ||
"isEnrolledMedicarePartA": true, | ||
"isCoveredByHealthInsurance": true, | ||
"providers": [ | ||
{ | ||
"insuranceName": "Aetna", | ||
"insurancePolicyHolderName": "Indiana Jones", | ||
"insurancePolicyNumber": "32345111", | ||
"insuranceGroupCode": "1233444" | ||
} | ||
], | ||
"deductibleMedicalExpenses": 0, | ||
"deductibleFuneralExpenses": 0, | ||
"deductibleEducationExpenses": 0, | ||
"spouseGrossIncome": 20, | ||
"spouseNetIncome": 21, | ||
"spouseOtherIncome": 22, | ||
"veteranGrossIncome": 60000, | ||
"veteranNetIncome": 0, | ||
"veteranOtherIncome": 0, | ||
"spouseFullName": { | ||
"first": "Jane", | ||
"middle": "marie", | ||
"last": "Jones" | ||
}, | ||
"spouseDateOfBirth": "1977-01-01", | ||
"dateOfMarriage": "2000-01-01", | ||
"maritalStatus": "Married", | ||
"purpleHeartRecipient": true, | ||
"isFormerPow": true, | ||
"postNov111998Combat": true, | ||
"disabledInLineOfDuty": true, | ||
"swAsiaCombat": true, | ||
"vietnamService": true, | ||
"exposedToRadiation": true, | ||
"radiumTreatments": true, | ||
"campLejeune": true, | ||
"discloseFinancialInformation": true, | ||
"lastServiceBranch": "air force", | ||
"lastEntryDate": "1998-01-01", | ||
"lastDischargeDate": "2004-01-01", | ||
"dischargeType": "honorable", | ||
"vaCompensationType": "lowDisability", | ||
"isAmericanIndianOrAlaskanNative": true, | ||
"isAsian": true, | ||
"isBlackOrAfricanAmerican": true, | ||
"isSpanishHispanicLatino": true, | ||
"isNativeHawaiianOrOtherPacificIslander": true, | ||
"isWhite": true, | ||
"hasDemographicNoAnswer": true, | ||
"isEssentialAcaCoverage": true, | ||
"vaMedicalFacility": "520GA", | ||
"wantsInitialVaContact": true, | ||
"email": "[email protected]", | ||
"homePhone": "3462636183", | ||
"mobilePhone": "3462636184", | ||
"veteranAddress": { | ||
"street": "321 Elm St", | ||
"city": "Houston", | ||
"postalCode": "77388", | ||
"country": "USA", | ||
"state": "TX" | ||
}, | ||
"gender": "M", | ||
"mothersMaidenName": "Test", | ||
"cityOfBirth": "Spring", | ||
"stateOfBirth": "TX", | ||
"veteranFullName": "Indiana Bill Jones II", | ||
"veteranSocialSecurityNumber": "234221243", | ||
"veteranDateOfBirth": "1980-01-01", | ||
"privacyAgreementAccepted": true, | ||
"dependents": [ | ||
{ | ||
"fullName": { | ||
"first": "Bob", | ||
"middle": "Joe", | ||
"last": "Jones" | ||
}, | ||
"dependentRelation": "Son", | ||
"socialSecurityNumber": "343221234", | ||
"dateOfBirth": "2000-02-01", | ||
"becameDependent": "2000-02-01", | ||
"attendedSchoolLastYear": true, | ||
"dependentEducationExpenses": 0, | ||
"disabledBefore18": false, | ||
"cohabitedLastYear": true, | ||
"grossIncome": 10, | ||
"netIncome": 11, | ||
"otherIncome": 12 | ||
} | ||
], | ||
"veteranHomeAddress": { | ||
"street": "123 Elm St", | ||
"city": "Houston", | ||
"postalCode": "77388", | ||
"country": "USA", | ||
"state": "TX" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,9 @@ | |
"stateOfBirth": "TX", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file was leftover from previous work to generate a 10-10EZ pdf. I updated it to test the full name functionality. In future PRs I will update the kitchent_sink and simple files to ensure they have the proper values for each, but for now I kept this since it had all of the required fields per the vets-json-schema for this form. |
||
"veteranFullName": { | ||
"first": "Indiana", | ||
"last": "Jones" | ||
"middle": "Bill", | ||
"last": "Jones", | ||
"suffix": "II" | ||
}, | ||
"veteranSocialSecurityNumber": "234221243", | ||
"veteranDateOfBirth": "1980-01-01", | ||
|
@@ -112,4 +114,4 @@ | |
"country": "USA", | ||
"state": "TX" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
# - :input_data_fixture_dir (String): Directory path for input data fixtures. Default to "pdf_fill/#{form_id}". | ||
# - :output_pdf_fixture_dir (String): Directory path for output PDF fixtures. Default to "pdf_fill/#{form_id}". | ||
# - :fill_options (Hash): Options to be passed to the `fill_form` method. Default empty. | ||
# - :test_data_types (Array): Array of form data to validate. Defaults to %w[simple kitchen_sink overflow] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated this shared_example to allow for testing just some of the data types, while keeping it backwards compatible by setting the default if it is not supplied. Naming things is hard, so open to a different name here. |
||
# | ||
# Example Usage: | ||
# | ||
|
@@ -23,16 +24,18 @@ | |
# use_vets_json_schema: true, | ||
# input_data_fixture_dir: 'modules/pensions/spec/pdf_fill/fixtures', | ||
# output_pdf_fixture_dir: 'modules/pensions/spec/pdf_fill/fixtures' | ||
# test_data_types: %w[simple] | ||
# } | ||
RSpec.shared_examples 'a form filler' do |options| | ||
form_id, factory = options.values_at(:form_id, :factory) | ||
form_id, factory, test_data_types = options.values_at(:form_id, :factory, :test_data_types) | ||
test_data_types ||= %w[simple kitchen_sink overflow] | ||
|
||
describe PdfFill::Filler, type: :model do | ||
context "form #{form_id}", run_at: '2017-07-25 00:00:00 -0400' do | ||
let(:input_data_fixture_dir) { options[:input_data_fixture_dir] || "spec/fixtures/pdf_fill/#{form_id}" } | ||
let(:output_pdf_fixture_dir) { options[:output_pdf_fixture_dir] || "spec/fixtures/pdf_fill/#{form_id}" } | ||
|
||
%w[simple kitchen_sink overflow].each do |type| | ||
test_data_types.each do |type| | ||
context "with #{type} test data" do | ||
let(:form_data) do | ||
return get_fixture_absolute("#{input_data_fixture_dir}/#{type}") unless options[:use_vets_json_schema] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
require 'pdf_fill/forms/va1010ez' | ||
require 'lib/pdf_fill/fill_form_examples' | ||
|
||
describe PdfFill::Forms::Va1010ez do | ||
include SchemaMatchers | ||
|
||
let(:form_data) do | ||
get_fixture('pdf_fill/10-10EZ/simple') | ||
end | ||
|
||
let(:form_class) do | ||
described_class.new(form_data) | ||
end | ||
|
||
it_behaves_like 'a form filler', { | ||
form_id: described_class::FORM_ID, | ||
factory: :health_care_application, | ||
input_data_fixture_dir: 'spec/fixtures/pdf_fill/10-10EZ', | ||
output_pdf_fixture_dir: 'spec/fixtures/pdf_fill/10-10EZ/unsigned', | ||
test_data_types: %w[simple] | ||
} | ||
|
||
describe '#merge_fields' do | ||
it 'merges the right fields' do | ||
expect(form_class.merge_fields.to_json).to eq( | ||
get_fixture('pdf_fill/10-10EZ/merge_fields').to_json | ||
) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is expected by
PdfFill::Filler
since it is generally expecting asaved_claim
model, but our hca model has the sameparsed_form
object as thesaved_claim
model so it appears to work fine.