department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
97 stars 69 forks source link

[AutoSuggest for "Service type"] Step 2 - Ability to search within JSONified data #18910

Open davidmpickett opened 1 month ago

davidmpickett commented 1 month ago

[2024-08-16] Need outputs from #18909 in order to finalize ACs

User Story or Problem Statement

18909 converted Drupal data from the Service Taxonomy into a JSON object. Now we need to create functions that search that JSON object based on given text input to find and rank possible matches.

Notes from #15054

Search logic is based on 526ez Form https://www.va.gov/find-forms/about-form-21-526ez/. If login is needed to view the form, there's a Github login or Laura can help identify the right person to ask.

Here's the file with the autosuggest logic src/applications/disability-benefits/all-claims/pages/addDisabilities.js in vets-website

And here's their schema src/applications/disability-benefits/all-claims/content/disabilityLabels.js

However, it does not suggest one thing if it's related to some other condition only if it's typing is closely related. So a nephro prefix does not bring up renal or kidney anything or vice-versa

Also, as a side reference: src/platform/forms-system/src/js/fields/AutosuggestField.jsx This is the field React Component Not a fuzzy match or special kind of search

The autocomplete field is somewhat complex, but does not do any fuzzy matching or nearest matching, just substring search.

Steps for Implementation

Acceptance Criteria

eselkin commented 1 month ago

my theory is the object will be

{
  "fieldHealthServiceApiId1": {
    "name": "xyz",
    "aka": "abc",
    "commonConditions": "long string with conditions",
    "showVetCenters": false,
    "showVBA": false,
    "showVAMC": true,
    "showTricareSpecific": false
  }
}     

since we won't do any fuzzy matching,

  1. either postprocess in content-build or object entries in vets-website
  2. filter on whether service should be searched through,
  3. filter substr match on name || aka || commonConditions