department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
281 stars 197 forks source link

Pre-fill veteran military history #88432

Closed mjknight50 closed 3 weeks ago

mjknight50 commented 1 month ago

Overview

Building off this previous ticket, we would like to auto-populate the military history for veterans.

This work should be done behind a flipper. Deletion of the flipper is being tracked in this ticket: https://github.com/department-of-veterans-affairs/va.gov-team/issues/88486

The following fields could be pre-populated. The fields with strikethrough seemed difficult to map to the API so I would suggest skipping them for now unless you see an obvious match that I did not.

(note, there could be an array of service history)

  1. Branch of Service (required) --> branch_of_service
  2. Dates initially entered active duty (required) --> start_date
  3. Final release date from active duty (required) --> end_date
  4. Military Service Number --> Not sure what this corresponds to, but I have asked here: https://dsva.slack.com/archives/C063D0M76HX/p1721138480386589
  5. ~Place of your last separation~
  6. ~Did you serve under another name?~
  7. ~Have you ever been a prisoner of war?~

https://developer.va.gov/explore/api/veteran-service-history-and-eligibility/docs?version=current

The values should be available from this function, passing in the ICN: VAProfile::MilitaryPersonnel::ServiceHistoryResponse /lib/va_profile/military_personnel/service.rb

Sample data from API:

{
  "data": [
    {
      "id": "2305d238-dee4-5c98-858a-f912e3c059f8",
      "type": "service-history-episodes",
      "attributes": {
        "first_name": "Jessie",
        "last_name": "Price",
        "branch_of_service": "Air Force",
        "service_type": "Active Duty",
        "start_date": "1991-05-29",
        "end_date": "2011-06-30",
        "pay_grade": "E07",
        "component_of_service": "Air Force",
        "discharge_status": "honorable",
        "separation_reason": "SUFFICIENT SERVICE FOR RETIREMENT",
        "service_episode_combat_pay": false,
        "deployments": [
          {
            "start_date": "1948-10-10",
            "end_date": "1949-10-09",
            "location": "KOR"
          }
        ]
      }
    }
  ],
  "militarySummary": {
    "first_name": "Jessie",
    "last_name": "Price",
    "active_duty_status": "N",
    "combat_service_indicator": true,
    "duty_status_code": "02",
    "duty_status_text": "Not on active duty: ",
    "total_number_of_regular_active_duty_days": 444,
    "total_number_of_reserve_active_duty_days": 90,
    "total_number_of_guard_active_duty_days": 60,
    "total_number_of_training_days": 10
  }
}
TaiWilkin commented 1 month ago

It looks like the API used by the prefill for military history is currently https://depo-platform-documentation.scrollhelp.site/developer-docs/va-profile under Military Personnel. According to VAProfile::Prefill::MilitaryInformation, the service branch codes returned are the ones returned by https://sandbox-api.va.gov/services/benefits-reference-data/v1/service-branches, specifically:

{"code":"USMA","description":"US Military Academy"},
{"code":"MM","description":"Merchant Marine"},
{"code":"AF","description":"Air Force"},
{"code":"ARMY","description":"Army"},
{"code":"AFR","description":"Air Force Reserves"},
{"code":"PHS","description":"Public Health Service"},
{"code":"AAC","description":"Army Air Corps or Army Air Force"},
{"code":"WAC","description":"Women's Army Corps"},
{"code":"NOAA","description":"National Oceanic & Atmospheric Administration"},
{"code":"SF","description":"Space Force"},
{"code":"NAVY","description":"Navy"},
{"code":"N ACAD","description":"Naval Academy"},
{"code":"OTH","description":"Other"},
{"code":"ARNG","description":"Army National Guard"},
{"code":"CG","description":"Coast Guard"},
{"code":"MC","description":"Marine Corps"},
{"code":"AR","description":"Army Reserves"},
{"code":"CGR","description":"Coast Guard Reserves"},
{"code":"MCR","description":"Marine Corps Reserves"},
{"code":"NR","description":"Navy Reserves"},
{"code":"ANG","description":"Air National Guard"},
{"code":"AF ACAD","description":"Air Force Academy"},
{"code":"CG ACAD","description":"Coast Guard Academy"}

The branches of service listed in Pensions (Army, Navy, Air Force , Coast Guard, Marine Corps, Space Force, USPHS, NOAA) all appear on this list; however, there are also additional branches listed here. If a service period includes a branch NOT available on the Pensions form, should we ignore it when prefilling?

Also, which branches/service periods should qualify as "Active Duty" for the purpose of the first entry and last exit from Active Duty? Currently, I'm including all service periods and selecting the earliest start date and latest end date.

mjknight50 commented 1 month ago

After meeting with the VBA team, it looks like the Date initially entered active duty is pretty straight forward from their perspective. The Final release date from active duty should be the last date where service_type = "Active Duty"

I also learned that military service number is always your social security number if you started after 1971.

matt4su commented 1 month ago

We just go the go ahead to proceed by prepoulating the current “initial entered” and “final release date” fields on the form with the relevant dates from their last branch of service.

TaiWilkin commented 1 month ago

@mjknight50 It looks like the available values for service_type in the model returned eventually returned by VAProfile::MilitaryPersonnel::ServiceHistoryResponse are actually 'Military Service' and 'Academy Attendance' (it looks like the value in the response for service_type is ignored). Do we think 'Military Service' would be equivalent to active service, or should I add the service_type to the models as a new field?

matt4su commented 1 month ago

Agreed we would add email, telephone number and mobile number to Applicant Information section as part of this ticket. When the fields are available, populate but make editable.

TaiWilkin commented 1 month ago

The flipper is on in Staging now. This can be tested with user vets.gov.user+233@gmail.com.

aplatt-coforma commented 4 weeks ago

Tested on staging with the noted user vets.gov.user+233@gmail.com. Verified that the email, phone and mobile was prefilled when a starting a new application Verified that email, phone, mobile can edited and saved when returning to an in progress application Verified that the military history is pre-filled Verified that the military history can be edited and saved when returned to an in progress applicaiton

One issue we encountered was when pre filling service number, Veterans who enrolled after 1971 have their SSN as their service number, so that's what we're using for them. The front-end validation for that field is trigged since it doesn't match the expected service number format.

Screenshot 2024-08-09 at 8.32.05 AM.png
matt4su commented 3 weeks ago

Feedback from our VBA Stakeholder (Derek Uttley) is that we should remove format validation from this field. Any data provided in this field could be useful downstream and will save the Veteran some keystrokes, the VBA team will take whatever the system provides in this field.

aplatt-coforma commented 3 weeks ago

Logged a new ticket to remove the field validation https://github.com/department-of-veterans-affairs/va.gov-team/issues/90673.

Closing this ticket as completed. Once we complete #90673, then we can enable on PROD