Skip to content

Use example JSON to set selected facet state in the app #4612

@MillenniumFalconMechanic

Description

Overview

As part of the AI Facet Selection PoC, the frontend should be able to consume the example query-to-facet JSON and translate it into the app’s selected facet state. This allows us to validate the end-to-end flow before backend integration is complete.

See search input mocks here, here, here, here, and here.
See selected state mocks here and here.

Requirements

  • Fetch the example JSON response at http://localhost:3000/api/v0/facets/response.json.
  • Parse the returned facet mappings and update the existing facet-selection state accordingly.
  • Ensure the UI reflects the interpreted selections exactly as if a user had manually clicked the facets.

Possible Approaches

  • Modify the existing "Search all filters" input box to fetch the JSON on hit of enter, or,
  • switch out the existing "Search all filters" input box with a new component that handles the fetch on hit of enter, or,
  • something else?

Note that you do not have to send the user input at the moment as the JSON is hard-coded. Note also that eventually there will be a toggle at the top of the panel to switch between the manual and AI search modes.

Background

Acceptance Criteria

  • When the app fetches the mock JSON, the corresponding facets visually appear as selected.
  • No backend dependency; the front-end should function using only the example response.
  • All facet IDs and values align with those used on the dev site.

Out of Scope

  • Handling of unmatched facets and terms (specifically, the MONDO:0005015, foobar and foobaz values in the JSON).
  • Display of AI-specific UI including filter format toggle, AI-generated indicators on chips, and AI search summary detail (i.e. "matched", "unmatched").
Image Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions