From 6562fa93a149a5b6573199f5e4c236021da40bad Mon Sep 17 00:00:00 2001 From: cameron testerman <11036339+voidspooks@users.noreply.github.com> Date: Mon, 27 Apr 2026 12:47:00 -0500 Subject: [PATCH] feat(10-7959E): generate codegen_schema artifacts via Optimus Generated by Optimus (https://github.com/aquia-inc/optimus). All files require human review before merging. Files: - src/schemas/10-7959E/schema.js --- src/schemas/10-7959E/schema.js | 601 +++++++++++++++++++++++++++++++++ 1 file changed, 601 insertions(+) create mode 100644 src/schemas/10-7959E/schema.js diff --git a/src/schemas/10-7959E/schema.js b/src/schemas/10-7959E/schema.js new file mode 100644 index 00000000..fba74ca9 --- /dev/null +++ b/src/schemas/10-7959E/schema.js @@ -0,0 +1,601 @@ +const buildDefinitionReference = referenceId => ({ $ref: `#/definitions/${referenceId}` }); + +const schema = { + $schema: 'http://json-schema.org/draft-04/schema#', + type: 'object', + additionalProperties: false, + definitions: { + ssn: { + type: 'string', + pattern: '^\\d{3}-\\d{2}-\\d{4}$', + minLength: 11, + maxLength: 11, + example: '123-45-6789', + description: 'Social Security Number in format 999-99-9999', + }, + date: { + type: 'string', + format: 'date', + example: '1985-03-15', + description: 'ISO 8601 date string (YYYY-MM-DD)', + }, + usPhone: { + type: 'string', + pattern: '^\\(\\d{3}\\) \\d{3}-\\d{4}$', + minLength: 14, + maxLength: 14, + example: '(804) 555-1234', + description: 'US telephone number in format (999) 999-9999', + }, + zipCode: { + type: 'string', + pattern: '^\\d{5}(-\\d{4})?$', + minLength: 5, + maxLength: 10, + example: '23220', + description: 'US ZIP code, 5-digit or ZIP+4 format 99999 or 99999-9999', + }, + usState: { + type: 'string', + enum: [ + 'AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', + 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', + 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', + 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', + 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', + 'WY', 'AS', 'GU', 'MP', 'PR', 'VI', + ], + description: 'Two-letter US state or territory code', + }, + middleInitial: { + type: 'string', + pattern: '^[A-Za-z]$', + minLength: 1, + maxLength: 1, + description: 'Single alphabetic character middle initial', + }, + providerTaxId: { + type: 'string', + pattern: '^\\d{2}-\\d{7}$', + minLength: 10, + maxLength: 10, + example: '12-3456789', + description: 'Provider Employer Identification Number (EIN) in format XX-XXXXXXX', + }, + militaryTime: { + type: 'string', + pattern: '^([01]\\d|2[0-3])[0-5]\\d$', + minLength: 4, + maxLength: 4, + example: '0815', + description: '24-hour time in HHMM format, e.g. 0815 or 1430', + }, + currencyAmount: { + type: 'string', + pattern: '^\\d+(\\.\\d{1,2})?$', + example: '45.00', + description: 'Monetary amount as a string with up to 2 decimal places', + }, + fileAttachment: { + type: 'object', + additionalProperties: false, + required: ['confirmationCode', 'name'], + properties: { + confirmationCode: { + type: 'string', + description: 'UUID confirmation code returned by the file upload endpoint', + example: 'abc123-uuid-v4', + }, + name: { + type: 'string', + description: 'Original filename of the uploaded document', + maxLength: 255, + example: 'hotel-receipt.pdf', + }, + size: { + type: 'integer', + description: 'File size in bytes', + minimum: 1, + maximum: 20971520, + }, + }, + }, + personName: { + type: 'object', + additionalProperties: false, + properties: { + lastName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Smith', + description: 'Last name — alphabetic characters, hyphens, and apostrophes', + }, + firstName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Jane', + }, + middleInitial: buildDefinitionReference('middleInitial'), + }, + }, + domesticAddress: { + type: 'object', + additionalProperties: false, + required: ['streetAddress', 'city', 'state', 'zipCode'], + properties: { + streetAddress: { + type: 'string', + minLength: 1, + maxLength: 100, + example: '123 Main Street', + }, + city: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Richmond', + }, + state: buildDefinitionReference('usState'), + zipCode: buildDefinitionReference('zipCode'), + }, + }, + travelLeg: { + type: 'object', + additionalProperties: false, + required: [ + 'dateOfTravel', + 'departureCity', + 'departureState', + 'departureTime', + 'arrivalCity', + 'arrivalState', + 'arrivalTime', + ], + properties: { + dateOfTravel: buildDefinitionReference('date'), + departureCity: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Richmond', + }, + departureState: buildDefinitionReference('usState'), + departureTime: buildDefinitionReference('militaryTime'), + arrivalCity: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Baltimore', + }, + arrivalState: buildDefinitionReference('usState'), + arrivalTime: buildDefinitionReference('militaryTime'), + }, + }, + }, + + properties: { + // ───────────────────────────────────────────────────────────────────── + // SECTION I — PATIENT INFORMATION (Screen 2) + // ───────────────────────────────────────────────────────────────────── + patientInformation: { + type: 'object', + additionalProperties: false, + description: 'Section I: Patient Information — identity and contact details of the beneficiary patient', + required: [ + 'patientLastName', + 'patientFirstName', + 'patientSSN', + 'patientDateOfBirth', + 'patientStreetAddress', + 'patientCity', + 'patientState', + 'patientZip', + 'patientPhone', + ], + properties: { + patientLastName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Smith', + description: "Patient's last name", + }, + patientFirstName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Jane', + description: "Patient's first name", + }, + patientMiddleInitial: { + $ref: '#/definitions/middleInitial', + }, + patientSSN: { + $ref: '#/definitions/ssn', + }, + patientDateOfBirth: { + $ref: '#/definitions/date', + }, + patientStreetAddress: { + type: 'string', + minLength: 1, + maxLength: 100, + example: '123 Main Street', + description: "Patient's street address including apartment or unit number", + }, + patientCity: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Richmond', + }, + patientState: { + $ref: '#/definitions/usState', + }, + patientZip: { + $ref: '#/definitions/zipCode', + }, + patientPhone: { + $ref: '#/definitions/usPhone', + }, + }, + }, + + // ───────────────────────────────────────────────────────────────────── + // SECTION II — VETERAN SPONSOR INFORMATION (Screen 3) + // ───────────────────────────────────────────────────────────────────── + sponsorInformation: { + type: 'object', + additionalProperties: false, + description: 'Section II: Veteran Sponsor Information — the Veteran whose service establishes the beneficiary\'s program eligibility', + required: [ + 'sponsorLastName', + 'sponsorFirstName', + 'sponsorSSN', + ], + properties: { + sponsorLastName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Smith', + description: "Veteran sponsor's last name", + }, + sponsorFirstName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'John', + description: "Veteran sponsor's first name", + }, + sponsorMiddleInitial: { + $ref: '#/definitions/middleInitial', + }, + sponsorSSN: { + $ref: '#/definitions/ssn', + }, + }, + }, + + // ───────────────────────────────────────────────────────────────────── + // CLAIM TYPE GATE (Screen 4) + // ───────────────────────────────────────────────────────────────────── + claimIncludesTravel: { + type: 'string', + enum: ['yes', 'no'], + description: 'Whether the claim includes any travel-related expenses (Section III gate). Drives chapter-level conditional rendering.', + }, + + // ───────────────────────────────────────────────────────────────────── + // SECTION III — TRAVEL INFORMATION (Screens 5–12) + // Present only when claimIncludesTravel = "yes" + // ───────────────────────────────────────────────────────────────────── + travelInformation: { + type: 'object', + additionalProperties: false, + description: 'Section III: Travel Information — all travel, provider, attendant, and miscellaneous expense data. Only present when claimIncludesTravel is "yes".', + + // Note: at submission time vets-api should validate that + // travelInformation is present when claimIncludesTravel = "yes". + // Required array at the top level of travelInformation omits + // conditional sub-objects (povDetails, attendantInformation, + // travelReceiptConfirmationCodes) since their presence depends on + // runtime conditions checked in form depends() logic. + required: [ + 'providerWillBill', + 'providerCertification', + 'travelModes', + 'travelLegs', + 'attendantAccompanied', + ], + + properties: { + // Screen 5 — Provider Billing + providerWillBill: { + type: 'boolean', + description: 'Whether the provider will be billing VA directly for services (YES/NO per Section III). True = Yes, provider will bill VA.', + }, + + // Screen 6 — Provider Certification + providerCertification: { + type: 'object', + additionalProperties: false, + description: 'Provider certification of medical service — required for all travel claims', + required: [ + 'dateOfService', + 'providerTaxId', + 'certificationUploadConfirmationCode', + ], + properties: { + dateOfService: { + $ref: '#/definitions/date', + }, + providerTaxId: { + $ref: '#/definitions/providerTaxId', + }, + certificationUploadConfirmationCode: { + type: 'string', + description: 'Confirmation code UUID for the uploaded provider certification document', + example: 'abc123-uuid-v4', + }, + }, + }, + + // Screen 7 — Travel Mode + travelModes: { + type: 'array', + minItems: 1, + uniqueItems: true, + description: 'Mode(s) of travel used by the patient. At least one must be selected.', + items: { + type: 'string', + enum: ['airline', 'taxi', 'pov', 'bus', 'train', 'other'], + }, + }, + travelModeOtherSpecify: { + type: 'string', + minLength: 1, + maxLength: 100, + description: 'Required when "other" is included in travelModes. Free-text description of the other mode of travel.', + example: 'Ambulance transport', + }, + + // Screen 8 — Travel Dates (repeating legs) + travelLegs: { + type: 'array', + minItems: 1, + maxItems: 10, + description: 'Travel date entries — one object per travel leg. Minimum 1 required. Maximum 10 enforced in Phase 1 (pending OIVC confirmation — Open Question #17). Legs 3+ are rendered on a supplemental PDF page.', + items: { + $ref: '#/definitions/travelLeg', + }, + }, + + // Screen 9 — POV Mileage Details (conditional: present when travelModes includes "pov") + povDetails: { + type: 'object', + additionalProperties: false, + description: 'POV mileage details — present only when travelModes includes "pov". No receipt required per form instructions.', + required: [ + 'departureCity', + 'departureState', + 'arrivalCity', + 'arrivalState', + ], + properties: { + departureCity: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Richmond', + description: 'Departure city for POV mileage calculation', + }, + departureState: { + $ref: '#/definitions/usState', + }, + arrivalCity: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Baltimore', + description: 'Arrival city for POV mileage calculation', + }, + arrivalState: { + $ref: '#/definitions/usState', + }, + }, + }, + + // Screen 10 — Travel Receipts Upload + // (conditional: present when travelModes includes any non-"pov" mode) + travelReceiptConfirmationCodes: { + type: 'array', + minItems: 1, + description: 'Confirmation code UUIDs for uploaded travel receipt files. Required when any non-POV travel mode is selected. Each element corresponds to one uploaded receipt file.', + items: { + type: 'string', + description: 'Confirmation code UUID for an uploaded travel receipt file', + example: 'def456-uuid', + }, + }, + + // Screen 11 — Attendant Information + attendantAccompanied: { + type: 'boolean', + description: 'Whether an attendant accompanied the patient to the medical appointment. True = Yes.', + }, + attendantInformation: { + type: 'object', + additionalProperties: false, + description: 'Attendant name and relationship — required when attendantAccompanied is true', + required: [ + 'attendantLastName', + 'attendantFirstName', + 'attendantRelationship', + ], + properties: { + attendantLastName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Jones', + }, + attendantFirstName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Mary', + }, + attendantMiddleInitial: { + $ref: '#/definitions/middleInitial', + }, + attendantRelationship: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'parent', + description: 'Relationship of the attendant to the patient (e.g., parent, spouse, caregiver)', + }, + }, + }, + + // Screen 12 — Miscellaneous Expenses + miscellaneousExpenses: { + type: 'object', + additionalProperties: false, + description: 'Patient and attendant miscellaneous expenses — lodging, meals, other (parking, tolls, etc.). At least one non-zero amount required when this section is reached.', + properties: { + lodging: { + $ref: '#/definitions/currencyAmount', + }, + meals: { + $ref: '#/definitions/currencyAmount', + }, + other: { + $ref: '#/definitions/currencyAmount', + }, + receiptConfirmationCodes: { + type: 'array', + minItems: 1, + description: 'Confirmation code UUIDs for uploaded miscellaneous expense receipt files. Required when any expense amount is greater than zero.', + items: { + type: 'string', + description: 'Confirmation code UUID for an uploaded miscellaneous expense receipt', + example: 'jkl012-uuid', + }, + }, + }, + }, + }, + }, + + // ───────────────────────────────────────────────────────────────────── + // SECTION IV — CERTIFICATION (Screens 13–15) + // ───────────────────────────────────────────────────────────────────── + certification: { + type: 'object', + additionalProperties: false, + description: 'Section IV: Certification — signer identity, medical records release authorization, typed signature, and date. Constitutes a legally binding certification under 18 U.S.C. § 1001.', + required: [ + 'signerType', + 'certificationAcknowledged', + 'certificationSignature', + 'certificationDate', + ], + properties: { + // Screen 13 — Certification Signer Type + signerType: { + type: 'string', + enum: ['patient', 'thirdParty'], + description: 'Whether the certification is signed by the patient themselves or by a third-party (parent, legal guardian, or other authorized person) on the patient\'s behalf.', + }, + + // Screen 14 — Third-Party Signer Information + // (conditional: present only when signerType = "thirdParty") + thirdPartyInformation: { + type: 'object', + additionalProperties: false, + description: 'Third-party signer identity and contact information — required when signerType is "thirdParty". Per form instructions, all fields are required for third-party signers.', + required: [ + 'thirdPartyLastName', + 'thirdPartyFirstName', + 'thirdPartySSN', + 'thirdPartyStreetAddress', + 'thirdPartyCity', + 'thirdPartyState', + 'thirdPartyZip', + 'thirdPartyPhone', + ], + properties: { + thirdPartyLastName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Jones', + }, + thirdPartyFirstName: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Mary', + }, + thirdPartyMiddleInitial: { + $ref: '#/definitions/middleInitial', + }, + thirdPartySSN: { + $ref: '#/definitions/ssn', + }, + thirdPartyStreetAddress: { + type: 'string', + minLength: 1, + maxLength: 100, + example: '456 Oak Avenue', + }, + thirdPartyCity: { + type: 'string', + minLength: 1, + maxLength: 50, + example: 'Richmond', + }, + thirdPartyState: { + $ref: '#/definitions/usState', + }, + thirdPartyZip: { + $ref: '#/definitions/zipCode', + }, + thirdPartyPhone: { + $ref: '#/definitions/usPhone', + }, + }, + }, + + // Screen 15 — Certification Acknowledgment, Signature, Date + certificationAcknowledged: { + type: 'boolean', + description: 'Whether the signer has read and acknowledged the certification statement, federal penalties notice (18 U.S.C. § 1001), and medical records release authorization verbatim from Section IV of VA Form 10-7959E. Must be true to submit.', + }, + certificationSignature: { + type: 'string', + minLength: 1, + maxLength: 100, + description: 'Typed full legal name serving as electronic signature per the "type if electronic" instruction on VA Form 10-7959E, Section IV.', + example: 'Mary C Jones', + }, + certificationDate: { + $ref: '#/definitions/date', + }, + }, + }, + }, + + required: [ + 'patientInformation', + 'sponsorInformation', + 'claimIncludesTravel', + 'certification', + ], +}; + +export default schema; \ No newline at end of file