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

Update the vets-json schema #93506

Closed
3 tasks
oddball-lindsay opened this issue Sep 24, 2024 · 21 comments
Closed
3 tasks

Update the vets-json schema #93506

oddball-lindsay opened this issue Sep 24, 2024 · 21 comments
Assignees
Labels
accredited-representation-management-team Accredited Representation Management team backend frontend mvp Initial version of thing

Comments

@oddball-lindsay
Copy link
Contributor

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

  • Go through each screen for Appoint MVP and make sure it matches the schema

Acceptance Criteria

  • The frontend experience is aligned with the backend PDF from generation, in terms of information required.
  • The vets-json schema is the source of truth for all of the UI screens.
@opticbob
Copy link

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
Copy link
Contributor Author

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

@opticbob
Copy link

opticbob commented Nov 1, 2024

This has been started and the updates currently capture most of what we have required for processing the form. I'll have to confirm with @cosu419 if we need all fields in the PDF, just those we need to process the form, or those actually present in the front end form experience?

@opticbob
Copy link

opticbob commented Nov 4, 2024

@cosu419 confirmed that this should cover all fields in the source PDF forms, even those that aren't present in the online form fill workflow. I'm hoping to pick this up again tomorrow morning.

@oddball-lindsay
Copy link
Contributor Author

Two fields left for 21-22 and halfway through the 21-22a. Expecting to be ready for review today.

@opticbob
Copy link

opticbob commented Nov 5, 2024

After speaking with @holdenhinkle and @cosu419 the direction for this has shifted slightly. It should be ready for review before EOD tomorrow the 6th.

@opticbob
Copy link

opticbob commented Nov 6, 2024

The code for the schemas is done, I just need to go through the PR update process outlined in the vets-json-schema repo.

@opticbob
Copy link

opticbob commented Nov 8, 2024

This has been submitted for review.

@oddball-lindsay
Copy link
Contributor Author

@cosu419 ready for approval, then we need to wait for Platform review.

@opticbob
Copy link

The PR for this has been approved and merged. Next steps will be opening PRs in vets-api and vets-website to move them to the new schema version. I'll do that in the morning.

@opticbob
Copy link

Both PRs mentioned above have been approved by @holdenhinkle , we're just waiting for platform approval.

@oddball-lindsay
Copy link
Contributor Author

Seeing some failing tests, not related to our code but possibly related to the schema update from others. Guessing we won't get platform approval until the tests are passing.

@opticbob
Copy link

I'll start tracking down the failing tests tomorrow.

@opticbob
Copy link

Both vets-api and vets-website were previously on version 24.5.2 and the new version is 24.5.5. That means that vets-json-schema was updated twice without anyone bothering to update the other repos. I'll have to see what those changes were about and if they match the failing tests in both repos.

@opticbob
Copy link

Platform is looking into an approved PR for vets-api that fixes the broken tests but hasn't been merged yet for some reason. There is a similar PR for vets-website.

@opticbob
Copy link

There was no movement on this today as it rotated to a new platform support engineer. I'll directly ask for help in the platform support channel tomorrow to try to move this along.

@opticbob
Copy link

The author of the PRs that will fix my broken tests has updated those PRs and is working on getting them reviewed. If they are merged this ticket will be done.

@opticbob
Copy link

The author of the PRs mentioned above is working with Platform to get his PRs merged.

@opticbob
Copy link

The vets-api PR merged today and the author is working out the problems with the vets-website PR. Once that merges this ticket is complete.

@opticbob
Copy link

The author of the vets-website PR is getting support from Platform to get it merged. Once it merges this ticket is done, that PR will supersede the one I wrote that is full of other teams broken tests.

@opticbob
Copy link

A vets-website PR merged today that makes our vets-json-schema updates available in vets-website.

This ticket is now done.

There is a good slack discussion around how changes to vets-json-schema impacts vets-api and vets-website: https://dsva.slack.com/archives/CBU0KDSB1/p1732565952443369. There are some process changes suggested there and it sounds like some documentation may be updated to reflect those suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accredited-representation-management-team Accredited Representation Management team backend frontend mvp Initial version of thing
Projects
None yet
Development

No branches or pull requests

3 participants