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
283 stars 203 forks source link

Update the vets-json schema #93506

Open oddball-lindsay opened 1 month ago

oddball-lindsay commented 1 month ago

Background

We want to make sure the vets-json schema pairs with what the form is expecting, to align the frontend experience with the backend PDF from generation.

Tasks

Acceptance Criteria

opticbob commented 1 week ago

A possiblity of the kinds of data we need updated:

``` import _ from 'lodash'; import constants from '../../common/constants'; import schemaHelpers from '../../common/schema-helpers'; import definitions from '../../common/definitions'; import { states50AndDC } from '../../common/address'; const stateCodes = [...states50AndDC.map(state => state.value)]; const countryCodes = ['US', 'CA', 'MX', 'Other']; // Example country codes const schema = { $schema: 'http://json-schema.org/draft-04/schema#', title: 'Representation Management - PDF Generator', type: 'object', properties: { record_consent: { type: 'boolean', description: "Indicates whether the veteran has consented to the record." }, consent_address_change: { type: 'boolean', description: "Specifies if the veteran consents to an address change." }, consent_limits: { type: 'array', description: "Contains consent limitations based on the veteran’s conditions.", items: { type: 'string', enum: ['ALCOHOLISM', 'DRUG_ABUSE', 'HIV', 'SICKLE_CELL'], example: 'ALCOHOLISM' } }, conditions_of_appointment: { type: 'array', description: "Conditions related to the appointment of the representative.", items: { type: 'string', example: "condition1" } }, claimant: { type: 'object', additionalProperties: false, properties: { name: definitions.name, date_of_birth: { type: 'string', format: 'date', description: "The claimant's date of birth in 'YYYY-MM-DD' format.", example: '1980-01-01' }, relationship: { type: 'string', description: "The relationship of the claimant to the veteran.", example: 'Spouse', maxLength: 30 }, phone: { type: 'string', description: "The claimant's phone number (10 digits).", pattern: "^[0-9]{10}$", example: '1234567890' }, email: definitions.email, address: { type: 'object', additionalProperties: false, properties: { address_line1: { description: "Street address with number and name. Required if claimant information provided.", type: "string", pattern: "^([-a-zA-Z0-9'.,&#]([-a-zA-Z0-9'.,&# ])?)+$", maxLength: 30, example: "123 Main St" }, address_line2: { type: "string", maxLength: 5, example: "Apt 4B" }, city: { description: "City for the address. Required if claimant information provided.", type: "string", example: "Cityville", maxLength: 18 }, state_code: { description: "State for the address. Required if claimant information provided.", type: "string", pattern: "^[A-Z]{2}$", example: "NY" }, country: { description: "Country of the address. Required if claimant information provided.", type: "string", example: "US" }, zip_code: { description: "Zipcode (First 5 digits) of the address. Required if claimant information provided.", type: "string", pattern: "^[0-9]{5}$", example: "12345" }, zip_code_suffix: { description: "Zipcode (Last 4 digits) of the address.", type: "string", pattern: "^[0-9]{4}$", example: "6789" } } } }, required: ['name', 'date_of_birth', 'relationship', 'address'] }, representative: { type: 'object', additionalProperties: false, properties: { organization_id: { type: 'string', description: "The organization ID of the representative's organization.", example: "ORG123" }, id: { type: 'string', description: "The representative’s unique ID.", example: "REP456" }, type: { type: 'string', description: "The type of representative.", enum: ['ATTORNEY', 'AGENT', 'INDIVIDUAL', 'VSO_REPRESENTATIVE'], example: "ATTORNEY" }, phone: { type: 'string', description: "The representative’s phone number (10 digits).", pattern: "^[0-9]{10}$", example: "0987654321" }, email: definitions.email, name: definitions.name, address: { type: 'object', additionalProperties: false, properties: { address_line1: { description: "Street address with number and name. Required if representative information provided.", type: "string", pattern: "^([-a-zA-Z0-9'.,&#]([-a-zA-Z0-9'.,&# ])?)+$", maxLength: 30, example: "456 Oak St" }, address_line2: { type: "string", maxLength: 5, example: "" }, city: { description: "City for the address. Required if representative information provided.", type: "string", example: "Townsville", maxLength: 18 }, state_code: { description: "State for the address. Required if representative information provided.", type: "string", pattern: "^[A-Z]{2}$", example: "CA" }, country: { description: "Country of the address. Required if representative information provided.", type: "string", example: "US" }, zip_code: { description: "Zipcode (First 5 digits) of the address. Required if representative information provided.", type: "string", pattern: "^[0-9]{5}$", example: "98765" }, zip_code_suffix: { description: "Zipcode (Last 4 digits) of the address.", type: "string", pattern: "^[0-9]{4}$", example: "4321" } } } }, required: ['organization_id', 'id', 'type', 'address'] }, veteran: { type: 'object', additionalProperties: false, properties: { ssn: { type: 'string', description: "The veteran’s Social Security Number (9 digits).", pattern: "^[0-9]{9}$", example: "123456789" }, va_file_number: { type: 'string', description: "The veteran's VA file number (9 digits).", pattern: "^[0-9]{9}$", example: "987654321" }, date_of_birth: { type: 'string', format: 'date', description: "The veteran's date of birth in 'YYYY-MM-DD' format.", example: '1970-02-15' }, service_number: { type: 'string', description: "The veteran’s service number (9 digits).", pattern: "^[0-9]{9}$", example: "123456789" }, service_branch: { type: 'string', description: "The veteran's branch of service.", enum: ['ARMY', 'NAVY', 'AIR_FORCE', 'MARINE_CORPS', 'COAST_GUARD', 'SPACE_FORCE', 'NOAA', 'USPHS'], example: 'ARMY' }, service_branch_other: { type: 'string', description: "Custom input for the veteran’s branch of service if not listed.", maxLength: 30, example: "" }, phone: { type: 'string', description: "The veteran’s phone number (10 digits).", pattern: "^[0-9]{10}$", example: "1112223333" }, email: definitions.email, insurance_numbers: { type: 'array', description: "The veteran’s insurance numbers.", items: { type: 'string', example: "INS123" } }, name: definitions.name, address: { type: 'object', additionalProperties: false, properties: { address_line1: { description: "Street address with number and name. Required if veteran information provided.", type: "string", pattern: "^([-a-zA-Z0-9'.,&#]([-a-zA-Z0-9'.,&# ])?)+$", maxLength: 30, example: "789 Pine St" }, address_line2: { type: "string", maxLength: 5, example: "" }, city: { description: "City for the address. Required if veteran information provided.", type: "string", example: "Villageville", maxLength: 18 }, state_code: { description: "State for the address. Required if veteran information provided.", type: "string", pattern: "^[A-Z]{2}$", example: "TX" }, country: { description: "Country of the address. Required if veteran information provided.", type: "string", example: "US" }, zip_code: { description: "Zipcode (First 5 digits) of the address. Required if veteran information provided.", type: "string", pattern: "^[0-9]{5}$", example: "54321" }, zip_code_suffix: { description: "Zipcode (Last 4 digits) of the address.", type: "string", pattern: "^[0-9]{4}$", example: "9876" } } } }, required: ['ssn', 'name', 'date_of_birth', 'address'] } }, required: ['record_consent', 'claimant', 'representative', 'veteran'], definitions: { date: { format: 'date', type: 'string' }, email: { type: 'string', format: 'email', description: "A valid email address." }, ssn: { type: 'string', pattern: '^[0-9]{9}$', description: "The veteran’s Social Security Number (9 digits)." }, name: { type: 'object', description: "An object containing a person's first, middle, and last name.", properties: { first: { type: 'string', maxLength: 12, description: "The person's first name.", example: "Robert" }, middle: { type: 'string', maxLength: 1, description: "The person's middle initial.", example: "C" }, last: { type: 'string', maxLength: 18, description: "The person's last name.", example: "Johnson" } }, required: ['first', 'last'] } } }; export default schema; ```
oddball-lindsay commented 1 week ago

@opticbob this ticket does not have any dependencies -- QA changes will not affect the work needed.