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 1 - JSONify the service taxonomy data #18909

Closed davidmpickett closed 1 month ago

davidmpickett commented 1 month ago

User Story or Problem Statement

AS A FE developer on VA.gov, I NEED to have a JSON object I can query that contains data from Drupal BECAUSE Querying Drupal directly from a public app is a no-no

Background from #15054

drupal download using GraphQL in metalsmith and how to use in vets-website

The Cerner->VistA method was instituted because lots of disparate parts were relying on flippers per-facility to determine if that facility needed a link to Cerner or VistA portal. Whether a facility was Cerner or VisA was placed behind a redux slice that got data from drupal en masse. It is a fairly reusable approach. We should use the action built for that process to load in our data-- method is reasonably understandable.

Plan

  1. We can use the existing methods for pulling data from drupal in content-build. Modeling on (src/site/stages/build/drupal/static-data-files/vamcFacilitySupplementalStatus/index.js in content-build)
  2. We can use the existing methods for pulling data from drupal generated json into vets-website. Modeling on src/platform/utilities/cerner/dsot.js and src/platform/site-wide/drupal-static-data/source-files/vamc-ehr/connect/index.js
  3. We can use selectors similar to vamc-ehr to use the drupal data.
    1. Just one selector for all data needed for the autocomplete
    2. Data has 4 booleans that are probably of importance. Some terms only apply to certain facilities (VBA,Vet Center,VAMC,TRICARE). It is unknown if we should make one file for each of these conditions or do some processing in app/on device. There are only 125 taxonomy entries so on-device is not too cumbersome.
    3. Consider the Moderation State (Draft, Published, etc)?
    4. Do we want to exclude terms that have 0 number of uses to prevent giving users options we know will have no results?

GraphQL

Rudimentary query -- needs additional details:

{
  taxonomyTermQuery(
    offset: 0
    filter: {conditions: [{operator: EQUAL, field: "vid", value: ["health_care_service_taxonomy"]}]}
  ) {
    count
    entities {
      ... on TaxonomyTermHealthCareServiceTaxonomy {
        name
        fieldAlsoKnownAs
        fieldCommonlyTreatedCondition
        fieldHealthServiceApiId
        fieldServiceTypeOfCare
        fieldShowForVetCenters
        fieldShowForVbaFacilities
        fieldShowForVamcFacilities
        fieldTricareSpecificService
      }
    }
  }
}

fields that can be used in snake_case (convert to camel)

### Specific fields to include
- [x] Name
- [x] Health Service API ID
- [x] Show for VAMC Facilities
- [x] Patient friendly name (VAMC) - aka
- [x] Common conditions (VAMC)
- [x] Service description (VAMC)
- [x] TRICARE service description?
- [x] Show for TRICARE Facilities only?
- [x] Published / Unpublished?
- [x] Number of uses?

QA

Acceptance Criteria

jilladams commented 1 month ago

Including VBA and Vet Center services in the data pull isn't add'l complexity but does affect file size for the JSON file, which loads in page load. So that has performance impact for rural / low bandwidth site visitors. We can assess filesize implications as we go. Let's keep all of the terms in the data for future extensibility.

jilladams commented 1 month ago

Notes on probable shape of the object: https://github.com/department-of-veterans-affairs/va.gov-cms/issues/18910#issuecomment-2285067653

eselkin commented 1 month ago
  1. Excluded 0 count uses in the data stored
  2. Add data to KISS source
  3. Added selectors in vets-website PR
jilladams commented 1 month ago

@eselkin (cc @Agile6MSkinner ) is there anything we can do to validate this in Prod yet? Or do we need Steps 2 & 3 present in order to do so?

eselkin commented 1 month ago

You can see it in action at

https://www.va.gov/data/cms/va-healthcare-services.json

The vets-website selectors you can't really see until they get used.

jilladams commented 1 month ago

Nice! Closing.