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
96 stars 70 forks source link

[VA Benefit Taxonomy] [Drupal] Prevent reciprocal Entity references for Pre-Requisite Benefits on VA Benefits Taxonomy terms #18731

Open davidmpickett opened 1 month ago

davidmpickett commented 1 month ago

Status

[2024-07-31] [Fran] Asked Daniel via Slack to async refine.

User Story or Problem Statement

AS AN Editor of the VA Benefit Taxonomy I NEED a safeguard to prevent the possibility of indicating a benefit relationship that is impossible in the real world

flowchart TB 
    X[houseboundAllowance] -->|field_va_benefit_prerequisite| Y[veteransPension]
    Y -->|field_va_benefit_prerequisite| X
    style X fill:#f2938c
    style Y fill:#f2938c    

Examples: Valid Pre-requisite relationships

These are from 18165

Model: Pre-requisite benefits

flowchart TB
    subgraph AB [Actual benefits]
    direction LR
        A(Benefit 1) -->|is a pre-requisite for| B(Benefit 2)
    end
    subgraph DE [Drupal entities]
    direction RL
    C[Term2] -->|field_va_benefit_prerequisite| D[Term1]
    style A fill:#00bde3,color:#fff
    style B fill:#00bde3,color:#fff
    style C fill:#f2938c
    style D fill:#f2938c
    end
    AB ~~~ DE

Example: VA health care

Counter Example: Housebound allowance

Proposed steps for Implementation

Acceptance Criteria

davidmpickett commented 1 month ago

@dsasser @mmiddaugh @FranECross I took a first pass at drafting up this Drupal implementation ticket. Might need a little tweaking in the tasks and ACs, but pretty confident that the basic story is there.

dsasser commented 1 month ago

Engineering Pre-Refinement

Point estimate: 1 (Using the below solution)

We can achieve this using existing contrib module (already in use in the site), Entity Reference Validators. Below shows the configuration options for the pre-requisite field that the module provides:

Screenshot 2024-08-07 at 2 23 32 PM

And this is the result when the constraint is triggered:

Screenshot 2024-08-07 at 2 42 50 PM