codeforamerica / balance

A text message system for checking one's EBT card balance (SNAP benefits and more)
MIT License
47 stars 37 forks source link

Standardize messages across all states #173

Open daguar opened 10 years ago

daguar commented 10 years ago

As a follow-up to #161, it is indeed possible for us to standardize messages across all states. This would mean that we would only have to implement a language once and it would apply to all states.

The approach I'd recommend would be to modify the MessageGenerator class to have a new method say_balance. It'd look a little something like this (totally off-the-cuff implementation for illustration only with English only):

def say_balance(food_stamp_balance, optional_balances = {})
  balance_message = "Hi! Your food stamp balance is #{food_stamp_balance}."
  if optional_balances[:cash_balance]
    balance_message += " Your cash balance is #{optional_balances[:cash_balance]}."
  end
  if optional_balances[:wic_balance]
    balance_message += " Your WIC balance is #{optional_balances[:wic_balance]}."
  end
  balance_message
end

Its usage would look like this:

mg = MessageGenerator.new(:english)
mg.say_balance(parsed_food_stamp_balance, :cash_balance => parsed_cash_balance)

This should be informed by more research in #18.

daguar commented 10 years ago

(edited to correct the secondary usage call to use proper method name)

daguar commented 10 years ago

Related to the question here and in #161, we now have a slight variation that shows why continuing to do this on a per-state basis may make sense.

North Carolina brands its SNAP program as "Food and Nutrition Services" (per http://www.ncdhhs.gov/dss/foodstamp/ ) and accordingly the NC brigade folks implemented the balance response as "Hi! Your food and nutrition benefits balance is #{ebt_amount}."

Let's think about and discuss this a bit more before making a call. I think it's going to be an emergent call based on the degree of variation, so I'm inclined to at least allow states to have state-specific ones (such as NC) but maybe standardize the others where possible using the above-described approach.