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

[DBEX] Update 0781 PDF fill of evidence & treatment data #21142

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
40 changes: 34 additions & 6 deletions lib/evss/disability_compensation_form/form0781.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ def create_form(incidents)
def create_form_v2
prepare_veteran_info.merge({
'events' => @form_content['events'],
'workBehaviors' => @form_content['workBehaviors'],
'healthBehaviors' => @form_content['healthBehaviors'],
'otherBehaviors' => @form_content['otherBehaviors'],
'behaviors' => aggregate_behaviors,
'behaviorsDetails' => @form_content['behaviorsDetails'],
'evidence' => @form_content['evidence'],
'traumaTreatment' => @form_content['traumaTreatment'],
'treatmentProviders' => @form_content['treatmentProviders'],
'evidence' => aggregate_supporting_evidence,
'treatmentNoneCheckbox' => @form_content['treatmentNoneCheckbox'],
'treatmentProviders' => aggregate_treatment_providers,
'treatmentProvidersDetails' => @form_content['treatmentProvidersDetails'],
'optionIndicator' => @form_content['optionIndicator'],
'additionalInformation' => @form_content['additionalInformation']
Expand All @@ -81,6 +79,36 @@ def prepare_veteran_info
}
end

def aggregate_behaviors
(@form_content['workBehaviors'] || {})
.merge(@form_content['healthBehaviors'] || {})
.merge(@form_content['otherBehaviors'] || {})
.select { |_key, value| value }
end

def aggregate_supporting_evidence
evidence = {}

evidence.merge!(@form_content['supportingEvidenceReports'] || {})
evidence.merge!(@form_content['supportingEvidenceRecords'] || {})
evidence.merge!(@form_content['supportingEvidenceWitness'] || {})
evidence.merge!(@form_content['supportingEvidenceOther'] || {})
evidence.merge!('none' => @form_content['supportingEvidenceNoneCheckbox']&.[]('none') || false)

if @form_content['supportingEvidenceUnlisted'].present?
evidence['other'] = true
evidence['otherDetails'] = @form_content['supportingEvidenceUnlisted']
end

evidence.select { |_key, value| value }
end

def aggregate_treatment_providers
(@form_content['treatmentReceivedVaProvider'] || {})
.merge(@form_content['treatmentReceivedNonVaProvider'] || {})
.select { |_key, value| value }
end

def split_incidents(incidents)
return nil if incidents.blank?

Expand Down
40 changes: 19 additions & 21 deletions lib/pdf_fill/forms/va210781v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Va210781v2 < FormBase
question_suffix: 'A'
}
},
'workBehaviors' => { # question_num: 10A
'behaviors' => { # question_num: 10A
'reassignment' => {
key: 'F[0].#subform[3].Request_For_A_Change_In_Occupational_Series_Or_Duty_Assignment[0]'
},
Expand All @@ -173,9 +173,7 @@ class Va210781v2 < FormBase
},
'performance' => {
key: 'F[0].#subform[3].Changes_In_Performance_Or_Performance_Evaluations[0]'
}
},
'healthBehaviors' => { # question_num: 10A
},
'consultations' => {
key: 'F[0].#subform[3].Increased_Decreased_Visits_To_A_Healthcare_Professional_Counselor_Or_Treatment_Facility[0]'
},
Expand All @@ -199,9 +197,7 @@ class Va210781v2 < FormBase
},
'screenings' => {
key: 'F[0].#subform[4].Tests_For_Sexually_Transmitted_Infections[0]'
}
},
'otherBehaviors' => { # question_num: 10A
},
'socialEconomic' => {
key: 'F[0].#subform[4].Economic_Or_Social_Behavioral_Changes[0]'
},
Expand Down Expand Up @@ -459,7 +455,7 @@ class Va210781v2 < FormBase
}
},
'evidence' => { # question_num: 12
'crisisCenter' => {
'crisis' => {
key: 'F[0].#subform[4].A_Rape_Crisis_Center_Or_Center_For_Domestic_Abuse[0]'
},
'counseling' => {
Expand All @@ -474,16 +470,16 @@ class Va210781v2 < FormBase
'police' => {
key: 'F[0].#subform[4].Civilian_Police_Reports[0]'
},
'medical' => {
'physicians' => {
key: 'F[0].#subform[4].Medical_Reports_From_Civilian_Physicians_Or_Caregivers_Who_Treated_You_Immediately_Following_The_Incident_Or_Sometime_Later[0]'
},
'clergy' => {
key: 'F[0].#subform[4].A_Chaplain_Or_Clergy[0]'
},
'peers' => {
'service' => {
key: 'F[0].#subform[4].Fellow_Service_Members[0]'
},
'journal' => {
'personal' => {
key: 'F[0].#subform[4].Personal_Diaries_Or_Journals[0]'
},
'none' => {
Expand Down Expand Up @@ -511,22 +507,22 @@ class Va210781v2 < FormBase
key: 'F[0].#subform[4].Treatment_No[0]'
},
'treatmentProviders' => { # question_num: 13B
'privateCare' => {
'nonVa' => {
key: 'F[0].#subform[4].Private_Healthcare_Provider[0]'
},
'vetCenter' => {
'vaCenters' => {
key: 'F[0].#subform[4].VA_Vet_Center[0]'
},
'communityCare' => {
'vaPaid' => {
key: 'F[0].#subform[4].Community_Care_Paid_For_By_VA[0]'
},
'vamc' => {
'medicalCenter' => {
key: 'F[0].#subform[4].VA_Medical_Center_And_Community_Based_Outpatient_Clinics[0]'
},
'cboc' => {
'communityOutpatient' => {
key: 'F[0].#subform[4].VA_Medical_Center_And_Community_Based_Outpatient_Clinics[0]'
},
'mtf' => {
'dod' => {
key: 'F[0].#subform[4].Department_Of_Defense_Military_Treatment_Facilities[0]'
}
},
Expand Down Expand Up @@ -629,7 +625,7 @@ class Va210781v2 < FormBase
},
{
label: 'Section III: Additional Information Associated with the In-service Traumatic Event(s)',
top_level_keys: %w[workBehaviors healthBehaviors otherBehaviors behaviorsDetails reportsDetails evidence]
top_level_keys: %w[behaviors behaviorsDetails reportsDetails evidence]
},
{
label: 'Section IV: Treatment Information',
Expand Down Expand Up @@ -690,11 +686,13 @@ def sanitize_phone(phone)
end

def set_treatment_selection
treated = @form_data['traumaTreatment']
return if treated.nil?
treated = (@form_data['treatmentProviders'] || {}).any?
not_treated = @form_data['treatmentNoneCheckbox']&.[]('none') || false

return if !treated && !not_treated

@form_data['treatment'] = treated ? 0 : 1
@form_data['noTreatment'] = treated ? 0 : 1
@form_data['noTreatment'] = not_treated ? 1 : 0
end

def process_reports
Expand Down
30 changes: 9 additions & 21 deletions spec/fixtures/pdf_fill/21-0781V2/kitchen_sink.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,15 @@
"unlistedReport": "incident report"
}
],
"workBehaviors": {
"behaviors": {
"reassignment": true,
"absences": false,
"performance": true
},
"healthBehaviors": {
"performance": true,
"consultations": false,
"episodes": true,
"medications": false,
"selfMedication": true,
"substances": false,
"appetite": true,
"pregnancy": false,
"screenings": true
},
"otherBehaviors": {
"socialEconomic": false,
"screenings": true,
"relationships": true,
"misconduct": false,
"unlisted": true
},
"behaviorsDetails": {
Expand All @@ -89,16 +79,14 @@
"other": true,
"otherDetails": "photographic evidence"
},
"traumaTreatment": false,
"treatmentProviders": {
"privateCare": true,
"vetCenter": false,
"communityCare": false,
"vamc": true,
"cboc": false,
"mtf": true,
"treatmentNoneCheckbox": {
"none": false
},
"treatmentProviders": {
"nonVa": true,
"medicalCenter": true,
"dod": true
},
"treatmentProvidersDetails": [
{
"facilityInfo": "Walter Reed, Bethesda, MD",
Expand Down
Binary file modified spec/fixtures/pdf_fill/21-0781V2/kitchen_sink.pdf
Binary file not shown.
34 changes: 11 additions & 23 deletions spec/fixtures/pdf_fill/21-0781V2/merge_fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,15 @@
}
}
],
"workBehaviors": {
"behaviors": {
"reassignment": true,
"absences": false,
"performance": true
},
"healthBehaviors": {
"performance": true,
"consultations": false,
"episodes": true,
"medications": false,
"selfMedication": true,
"substances": false,
"appetite": true,
"pregnancy": false,
"screenings": true
},
"otherBehaviors": {
"socialEconomic": false,
"screenings": true,
"relationships": true,
"misconduct": false,
"unlisted": true
},
"behaviorsDetails": {
Expand All @@ -110,16 +100,14 @@
"other": true,
"otherDetails": "photographic evidence"
},
"traumaTreatment": false,
"treatmentProviders": {
"privateCare": true,
"vetCenter": false,
"communityCare": false,
"vamc": true,
"cboc": false,
"mtf": true,
"treatmentNoneCheckbox": {
"none": false
},
"treatmentProviders": {
"nonVa": true,
"medicalCenter": true,
"dod": true
},
"treatmentProvidersDetails": [
{
"facilityInfo": "Walter Reed, Bethesda, MD",
Expand Down Expand Up @@ -168,8 +156,8 @@
"second": "45",
"third": "6789"
},
"treatment": 1,
"noTreatment": 1,
"treatment": 0,
"noTreatment": 0,
"reportsDetails": {
"police": "SVI, Dallas, TX, USA",
"other": "incident report"
Expand Down
39 changes: 13 additions & 26 deletions spec/fixtures/pdf_fill/21-0781V2/overflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,14 @@
"timing": "Summer of '69"
}
],
"workBehaviors": {
"behaviors": {
"reassignment": true,
"absences": false,
"performance": true
},
"healthBehaviors": {
"consultations": false,
"performance": true,
"episodes": true,
"medications": false,
"selfMedication": true,
"substances": false,
"appetite": true,
"pregnancy": false,
"screenings": true
},
"otherBehaviors": {
"socialEconomic": false,
"screenings": true,
"relationships": true,
"misconduct": false,
"unlisted": true
},
"behaviorsDetails": {
Expand All @@ -95,29 +84,27 @@
"unlisted": "Lorem ipsum dolor sit amet."
},
"evidence": {
"crisisCenter": true,
"crisis": true,
"counseling": true,
"family": true,
"faculty": true,
"police": true,
"medical": true,
"physicians": true,
"clergy": true,
"peers": true,
"journal": true,
"service": true,
"personal": true,
"none": true,
"other": true,
"otherDetails": "photographic evidence"
},
"traumaTreatment": false,
"treatmentProviders": {
"privateCare": true,
"vetCenter": false,
"communityCare": false,
"vamc": true,
"cboc": false,
"mtf": true,
"treatmentNoneCheckbox": {
"none": false
},
"treatmentProviders": {
"nonVa": true,
"medicalCenter": true,
"dod": true
},
"treatmentProvidersDetails": [
{
"facilityInfo": "Walter Reed, Bethesda, MD",
Expand Down
Binary file modified spec/fixtures/pdf_fill/21-0781V2/overflow.pdf
Binary file not shown.
Loading
Loading