Why Rules for Vaccines?

Most people, and in fact, many programmers, don’t understand why a rule-based approach is better for some application areas. Let me try to explain.

A computer does one thing at a time. It executes instructions. Usually it’s one instruction after another, but sometimes there are branching instructions. These basically say in this condition go here next, otherwise go there next.

You often see this type of flow of control represented in flow charts. Flow charts are often used in designing software.

Pricing Example

Pricing is one of the application areas that is notoriously difficult to code using conventional techniques. Consider these simplified rules for old school phone pricing:

If weekday and day time then cost is 10 cents per minute.
If weekday and night time then cost is 7 cents per minute.
If weekend and day time then cost is 6 cents per minute.
If weekend and night time then cost is 4 cents per minute.

Now, a human looking at the rules, and told whether a call was made during the week or not and during the day or not, could easily determine the cost of the call.

But a programmer, writing software to automate these rules, needs to superimpose some flow of control on them. Immediately a decision has to be made as to where to start. Does the program start by asking if it’s a weekday and then asking if it’s day or night? Or does it start by asking if it’s day or night, and then if it’s a weekend or not?

Now, it’s certainly possible to write that software, but problems arise when the rules change, and the software needs to change. Imagine if management decided to make Friday evenings the same as weekends, and holidays the same as weekends? So where do these changes get put in the program? Well it depends on those flow of control decisions.

Rule-based programming is different. For this example, a programmer using a rule language would write the rules, well, exactly as they were written. In any order, without worrying about flow of control issues.

Instead, a rule-based programming language has a component called a “reasoning engine” that takes input, such as weekday or weekend and day or night, and uses those inputs to dynamically select the rule that applies.

Vaccination Analysis and Forecasting

The problem of analyzing a child’s vaccination history, and then determining which doses of which vaccines will be required next, is one of those problems that are very difficult to code with step-by-step programming languages, but relatively easy using a rule-based approach.

Here are some of the complications. There are vaccines for the individual diseases: measles, mumps and rubella. There is a combination vaccine, MMR, that includes all three. But measles requires two doses, the others only one. So MMR is a two dose vaccine. But what if the child already had some single doses?

Those happen to also be live virus vaccines. There are rules about them as well, and you can’t give a live virus vaccine without waiting some time period, maybe a month, after other live viruses. So if a child is due for an MMR in two weeks, but had a Varicella (another live virus) a week ago, then the next MMR can only be given after three weeks.

The vaccines with 4 and 5 dose schedules get even more complex. There is a standard sequence to give the vaccines, but what if one was missing, or given at an incorrect interval? There are then modified schedules to use instead. More rules, more exceptions…

As with our beginning easy example, it’s certainly possible to write a program to handle all this, but there is so much flow of control information superimposed on the rules that it becomes near impossible to maintain. It becomes what is called, “spaghetti code” with hopelessly tangled flow of control strands.

Suppose the CDC comes out with guidelines for Covid-19 for children. Where do those rules get added? And of course there’s complexities on them as well as there are different vendors, and boosters and…

But with a rule-based approach, the new rules for Covid-19 can be simply entered as new rules. And the software is off and running.

In writing VacLogic, I used my own rule-based tools and technology. But they’re not the only ones. Programmers can find other tools to enable this application, and/or write their own reasoning engines and rule languages.

VacLogic Lawsuit

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Verified by MonsterInsights