prestoncabe / dmn-benefit-toolbox

Scaffolding for modeling public benefits' eligibility logic with Decision Model and Notation (DMN)
2 stars 1 forks source link

Allow eligibility checks to be provided as inputs #15

Closed prestoncabe closed 2 months ago

prestoncabe commented 3 months ago

If an eligibility check is provided in the inputs, then we should just use what was provided (if it is true or false) instead of calculating the check.

For example, if the body of the request to /benefits/phlPreK includes the following:

{
    "inputs": {
        "livesInPhiladelphia": true // or false
        // ... (other inputs left out for brevity)
    }
}

Then any calculation that would normally be done to determine whether livesInPhiladelphia should be true or true will be short-circuited, and the provided true will be used for the overall eligibility calculation:

{
    "eligibility": {
        "result": true,
        "checks": {
            "livesInPhiladelphia": true // forwarded from the inputs
            // ...
        },
    },
    "estimation": {
        // ...
    },
    "inputs": {
        // ...
    }
}