Right now, we're checking each possible condition separately when evaluating the homeless history score. If you group the number of months homeless and the number of times homeless according to the scoring handling, the homeless history score combinations can be put in a table like so:
This pull request creates the table shown as an independent data frame, looks at the the number of months and number of times homeless and groups them accordingly, and then simply looks up each value. It runs a little faster (1.6 seconds vs 0.6 seconds on my machine), is much shorter, and should be simpler to maintain if a score needs to be changed--update it in one spot instead of once per combination!
Right now, we're checking each possible condition separately when evaluating the homeless history score. If you group the number of months homeless and the number of times homeless according to the scoring handling, the homeless history score combinations can be put in a table like so:
This pull request creates the table shown as an independent data frame, looks at the the number of months and number of times homeless and groups them accordingly, and then simply looks up each value. It runs a little faster (1.6 seconds vs 0.6 seconds on my machine), is much shorter, and should be simpler to maintain if a score needs to be changed--update it in one spot instead of once per combination!