-
Notifications
You must be signed in to change notification settings - Fork 204
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
526ez | Pull disability list from Lighthouse API #41302
Comments
@jacobworrell after talking to @Mottie I'm realizing that there needs to be backend work done before we can start this ticket. |
@Mottie do we need to make a second story for the backend work that this depends on? |
Yes, we would need another ticket for backend work to set up communication with Lighthouse. |
@RakshindaAslam This looks like a good candidate for Team Carbs (DBEX Squad 2) to take on. |
@tblackwe - This could be blocked by the ongoing LH migration work. Good item for 16th minute today. |
Noting I removed the blocker on this since the referenced issue has been closed |
Posting some initial findings from the website repo here. I haven't directly investigated the API endpoint as @micahaspyr was going to look into that; I also don't have a sandbox API key yet but will request one. Findings SummaryThere are actually a few places that reference the static disabilities list . 1. The autocomplete form input for adding a new disability, as referenced in the original ticket above. // Ideally, this would show the validation on the array itself (or the name
// field in an array item), but that's not working.
'ui:validations': [requireDisability],
items: {
condition: autosuggest.uiSchema(
autoSuggestTitle,
() =>
Promise.resolve(
Object.entries(disabilityLabels).map(([key, value]) => ({
id: key,
label: value,
})),
),
{ I validated this by hardcoding my own values in place of the mapping over 2. A mapping of the disability list values to lower case strings, called This is referenced in the following validation code, which appears to happen on form submit. As documented in the code, we have a check that prevents a user submitting a disability name longer than 256 characters; if the name is present in our existing list of disabilities, we ignore that restriction // We're using a validator for length instead of adding a maxLength schema
// property because the validator is only applied conditionally - when a user
// chooses a disability from the list supplied to autosuggest, we don't care
// about the length - we only care about the length of unique user-entered
// disability names. We could've done this with `updateSchema` but this seems
// lighter-touch.
if (
!LOWERED_DISABILITY_DESCRIPTIONS.includes(fieldData.toLowerCase()) &&
fieldData.length > 255
) {
err.addError('Condition names should be less than 256 characters');
} 3. Another form pre-submittal callback which appears to update the form metadata submitted to the backend to include the code for the disability. I believe this happens anyway if the user selects one of the existing disability names, but presumably we still need this check in some cases // new disabilities that match a name on our mapped list need their
// respective classification code added
const addClassificationCodeToNewDisabilities = formData => {
const { newDisabilities } = formData;
if (!newDisabilities) {
return formData;
}
const flippedDisabilityLabels = {};
Object.entries(disabilityLabels).forEach(([code, description]) => {
flippedDisabilityLabels[description?.toLowerCase()] = code;
});
const newDisabilitiesWithClassificationCodes = newDisabilities.map(
disability => {
const { condition } = disability;
if (!condition) {
return disability;
}
const loweredDisabilityName = condition?.toLowerCase();
return flippedDisabilityLabels[loweredDisabilityName]
? _.set(
'classificationCode',
flippedDisabilityLabels[loweredDisabilityName],
disability,
)
: disability;
},
);
return _.set(
'newDisabilities',
newDisabilitiesWithClassificationCodes,
formData,
);
}; 4. In the "follow up" dropdown a user can use to select a disability that caused another disability causedByDisability: {
'ui:title':
'Please choose the disability that caused the new disability you’re claiming here.',
'ui:required': (formData, index) =>
formData.newDisabilities[index]?.cause === 'SECONDARY' &&
getDisabilitiesList(formData, index).length > 0,
'ui:options': {
labels: disabilityLabels,
updateSchema: (formData, primarySchema, primaryUISchema, index) => {
const disabilitiesList = getDisabilitiesList(formData, index);
if (!disabilitiesList.length) {
return {
'ui:hidden': true,
};
}
return {
enum: disabilitiesList,
};
},
},
}, 5. Two validation tests which references the static file directly. Note there are likely other tests/new tests we would write that cover this workflow as well My Open Questions Remaining
|
|
Yep this list isn't queryable for matching text as the disabilities endpoint just returns everything or the scope of however many you want. I think this doesn't really solve much by hitting the lighthouse endpoint. I'm not sure how often the disabilities list changes, but we could just have an endpoint that returns a selected subset of data from the large json set. Seems the most practical way to me |
The list has changed once in the 3.5 years I've been working on VA products. |
Actually, I forgot that the separation location code loads in the list of locations and uses it in the autocomplete input |
Backend: ready to move to in progress from initial spike - medium complexity due to unknown PR/Testing requirements, but simple from a code implementation perspective / plus front end and backend deployment Frontend: need @NB28VT input |
@austinjprice front end insight: Ready to move forward on the front end, also medium timebox due to unknown PR/Testing requirements. The testing paradigm is the one part I didn't really get to explore. Overall could either be complex or relatively straightforward I think it will depend on what kind of feedback I can get early. That being said, from the demo check-in today it sounds like we may be blocked on this pending guidance from other teams. |
Reviewed in Sprint review with feedback regarding dependencies around other teams working on this problem along with potential UX concerns. @austinjprice to follow up and connect the right parties |
same as with this ticket: https://app.zenhub.com/workspaces/disability-benefits-experience-team-carbs-6470c8bfffee9809b2634a52/issues/gh/department-of-veterans-affairs/va.gov-team/59815 Moving to icebox for now until conversation around next steps |
To remove from bug board and move to technical debt, pending discussion with team |
Description
Lighthouse provides a list of disabilities (
/disabilities
). We need to switch from loading in the static disabilities labels list (27KB) to that endpoint which has the most up-to-date list.Open questions
Acceptance Criteria
Tasks
disabilityLabels.js
fileDefinition of done
The text was updated successfully, but these errors were encountered: