Select Page

Can Learning InRule be Taxing?

by | Jul 14, 2014

Fellow InRulian Jim Wray and I were buying our lunches at a nearby downtown Chicago store recently when we discovered some weird inconsistencies in the taxes we paid. If you’ve ever read Freakonomics by Stephen Levitt, or have some familiarity with basic economic principles, you might be aware of the notion that any tax basically has two purposes: 1) to collect revenue, and 2) to incentivize behavior. But how can taxes incentivize behavior if the tax rules are nearly impossible to decipher?

I set out to educate myself on the byzantine, confusing Chicago retail food tax codes, and in the process found an excellent case scenario for employing InRule’s business language rules. You won’t believe how crazy some of the tax rules can be.

About Learning InRule

Before I get to my tax rule application, some quick background. I’m a learning professional with a programming background, and I’m one of the newest InRulians. Familiar as I am with Dr. Benjamin Bloom’s taxonomy of learning domains, I realized the best way to learn the nuances of employing a rule engine efficiently was to create. So I created a rule application which helps to shed some light on what we pay and why.

Basic Chicago Food Taxes

It took a while for me to figure this out, but the basic food taxes we pay in downtown Chicago for food change depending upon several disparate factors.

Here are some of the weird pieces of logic I needed to write rules for:

  • The base rate for “prepared” food in downtown Chicago is 9.25%
  • Bottled soft drinks are taxed at 3%, but soft drinks from a fountain are taxed at 9%!
  • Water bottles are taxed at a flat $.05 per bottle.
  • If prepared food is served in a location that contains seating for the patrons, and if that restaurant falls within a certain specific set of ZIP codes (the MPEA tax), an additional 1% tax is applied, raising the total sales tax to 10.25%!

Sometimes It’s about the Questions

There are a whole bunch of reasons why this logic is perfect for a rule engine, not the least of which is that taxes and tax laws change. The City of Chicago tweaks taxes regularly to raise money. So I put the taxes into a rule application. But it wasn’t easy to figure out where to start.

Here were some of the questions I faced while designing this rule application:

  • Should I use calculated fields, or handle all calculations within rules?
  • How would I handle the MPEA ZIP tax?
  • Should my rules be easily scalable?
  • What should I leave out of the rule app?
  • Once I had it working, how could I make the logic more transparent to an end user?

The answers to those questions helped me map out my schema and my rules. In the process I learned a lot about making rule applications efficient.

If you’re curious, here are the nuts and bolts of what I did:

  1. I used a collection to represent each item on the order.
  2. Each order item (food or drink) generally had to have its taxes calculated separately.
  3. I used vocabulary to handle calculation of the MPEA ZIP tax area, looking up the ZIP code in an inline table.
  4. I then summed up the totals of each item on the order (i.e. in the collection).

To give you a sense of how I kept the business logic transparent, here’s how I ran the MPEA tax calculations using my vocabulary template. The end product looks pretty simple, huh?

The entire rule app is posted on the InRule Support Site if you’d like to check it out.

Lessons Learned

Here are some of the more interesting lessons I’ve learned (or remembered) throughout this process:

  • If you want to learn something, get deeply involved in it: most of us learn most deeply by creating.
  • Getting a rule application to work is great; making it more readable to a business user is what turns a rule author into a pro.
  • Learn to build vocabulary templates. They’ll make your rule apps look smoother, and will save you some headaches as your rule application expands.
  • Chicago retail food taxes are tricky! It’s funny how much more you’ll pay for prepared food (9.25% to 10.25%) than non-prepared food (2.25%). That’s a savings of $.56 on a $7 lunch! Save money by preparing your own!
  • If you have to order a soft drink in downtown Chicago, go with the bottled drink to save 6% on the cost of the beverage ($.06 for every $1 spent).




We’d love to share company and product updates with you! Please enter your email address to subscribe to monthly updates from InRule. 

If at any time you want to unsubscribe, you can easily do so by clicking “unsubscribe” at the bottom of every message we send or visiting this page.