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

DNM: Integration form engine 2 #2273

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
01edd06
VATEAM-87714: Add KISS configuration for Digital Forms (#2213)
derekhouck Aug 6, 2024
fd22547
VATEAM-88634: Create a normalization layer for Digital Forms (#2215)
derekhouck Aug 10, 2024
49ce1af
Add OMB info to Digital Form GraphQL query
derekhouck Aug 29, 2024
0cec642
Normalize OMB info
derekhouck Aug 29, 2024
4d7dc20
Remove Date object from formatDate
derekhouck Sep 6, 2024
52edb57
VATEAM-90733: Normalize OMB info fields (#2252)
derekhouck Sep 12, 2024
b64c733
Add Identification Information fragment
derekhouck Sep 16, 2024
62fdaab
Import identificationInformation fragment into digitalForm fragment
derekhouck Sep 16, 2024
ee1a69f
Extract Identification Information fields
derekhouck Sep 16, 2024
9a6014e
Fix imports
derekhouck Sep 16, 2024
66f5048
VATEAM-87714: Add KISS configuration for Digital Forms (#2213)
derekhouck Aug 6, 2024
e3d84e6
VATEAM-88634: Create a normalization layer for Digital Forms (#2215)
derekhouck Aug 10, 2024
a314931
Merge branch 'main' into integration-form-engine-2
derekhouck Oct 2, 2024
3633329
Merge branch '90733-normalize-omb-info-section' into integration-form…
derekhouck Oct 2, 2024
628f6cb
Merge branch '91741-normalize-identification-information' into integr…
derekhouck Oct 2, 2024
0166a12
VATEAM-92265: Normalize Address Digital Form pattern output (#2301)
derekhouck Oct 4, 2024
02d5d12
VATEAM-94290: Remove "Digital Form:" from content-build output (#2304)
derekhouck Oct 9, 2024
1d80dde
Merge branch 'main' into integration-form-engine-2
derekhouck Oct 16, 2024
a0310be
VATEAM-93401: Normalize Phone and Email Digital Form pattern output (…
derekhouck Oct 16, 2024
00433c4
VATEAM-94709: Normalize Your Personal Information chapter (#2338)
derekhouck Nov 4, 2024
56aee27
VATEAM-93614: Normalize List and Loop pattern output (#2350)
derekhouck Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
*
* The "Address" Digital Form pattern.
*
* Pattern documentation:
* https://design.va.gov/patterns/ask-users-for/addresses
*
*/
module.exports = `
fragment address on ParagraphDigitalFormAddress {
fieldTitle
fieldMilitaryAddressCheckbox
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable @department-of-veterans-affairs/axe-check-required */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint disabled here


import { expect } from 'chai';
import address from './address.graphql';

describe('address fragment', () => {
it('includes fieldTitle', () => {
expect(address).to.have.string('fieldTitle');
});
it('includes fieldMilitaryAddressCheckbox', () => {
expect(address).to.have.string('fieldMilitaryAddressCheckbox');
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const address = require('./address.graphql');
const identificationInformation = require('./identificationInformation.graphql');
const nameAndDateOfBirth = require('./nameAndDateOfBirth.graphql');

/*
Expand All @@ -6,13 +8,19 @@ const nameAndDateOfBirth = require('./nameAndDateOfBirth.graphql');
*
*/
module.exports = `
${address}
${identificationInformation}
${nameAndDateOfBirth}

fragment digitalForm on NodeDigitalForm {
nid
entityLabel
fieldVaFormNumber
fieldOmbNumber
fieldRespondentBurden
fieldExpirationDate {
value
}
fieldChapters {
entity {
entityId
Expand All @@ -22,6 +30,8 @@ module.exports = `
entityLabel
}
}
...address
...identificationInformation
...nameAndDateOfBirth
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ describe('digitalForm fragment', () => {
expect(digitalForm).to.have.string('nid');
expect(digitalForm).to.have.string('entityLabel');
expect(digitalForm).to.have.string('fieldVaFormNumber');
expect(digitalForm).to.have.string('fieldOmbNumber');
expect(digitalForm).to.have.string('fieldChapters');
});

it('include OMB info', () => {
expect(digitalForm).to.have.string('fieldOmbNumber');
expect(digitalForm).to.have.string('fieldRespondentBurden');
expect(digitalForm).to.have.string('fieldExpirationDate');
});

describe('chapter fragments', () => {
it('imports the address fragment', () => {
expect(digitalForm).to.have.string('fragment address');
expect(digitalForm).to.have.string('...address');
});

it('imports the identificationInformation fragment', () => {
expect(digitalForm).to.have.string('fragment identificationInformation');
expect(digitalForm).to.have.string('...identificationInformation');
});

it('imports the nameAndDateOfBirth fragment', () => {
expect(digitalForm).to.have.string('fragment nameAndDateOfBirth');
expect(digitalForm).to.have.string('...nameAndDateOfBirth');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
*
* The "Identification Information" Digital Form pattern.
*
* Pattern documentation:
* https://design.va.gov/patterns/ask-users-for/social-security-number
*
*/
module.exports = `
fragment identificationInformation on ParagraphDigitalFormIdentificationInfo {
fieldTitle
fieldIncludeVeteranSService
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable @department-of-veterans-affairs/axe-check-required */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint disabled here


import { expect } from 'chai';
import identificationInformation from './identificationInformation.graphql';

describe('identificationInformation fragment', () => {
it('includes fieldTitle', () => {
expect(identificationInformation).to.have.string('fieldTitle');
});
it('includes fieldIncludeVeteranSService', () => {
expect(identificationInformation).to.have.string(
'fieldIncludeVeteranSService',
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,34 @@ const { logDrupal } = require('../../utilities-drupal');

const extractAdditionalFields = entity => {
const additionalFields = {};
const { entityId } = entity.type.entity;

if (entity.type.entity.entityId === 'digital_form_name_and_date_of_bi') {
additionalFields.includeDateOfBirth = entity.fieldIncludeDateOfBirth;
switch (entityId) {
case 'digital_form_address':
additionalFields.militaryAddressCheckbox =
entity.fieldMilitaryAddressCheckbox;
break;
case 'digital_form_name_and_date_of_bi':
additionalFields.includeDateOfBirth = entity.fieldIncludeDateOfBirth;
break;
case 'digital_form_identification_info':
additionalFields.includeServiceNumber =
entity.fieldIncludeVeteranSService;
break;
default:
break;
}

return additionalFields;
};
const extractForms = resultObject => resultObject?.data?.nodeQuery?.entities;

const formatDate = dateString => {
const removeLeadingZero = s => s.replace(/^0+/, '');
const [year, month, day] = dateString.split('-');
return `${removeLeadingZero(month)}/${removeLeadingZero(day)}/${year}`;
};

const normalizeChapter = ({ entity }) => {
return {
id: parseInt(entity.entityId, 10),
Expand All @@ -27,7 +46,11 @@ const normalizeForm = (form, logger = logDrupal) => {
cmsId: form.nid,
formId: form.fieldVaFormNumber,
title: form.entityLabel,
ombNumber: form.fieldOmbNumber,
ombInfo: {
expDate: formatDate(form.fieldExpirationDate.value),
ombNumber: form.fieldOmbNumber,
resBurden: form.fieldRespondentBurden,
},
chapters: form.fieldChapters.map(normalizeChapter),
};
} catch (error) {
Expand Down
Loading
Loading