posted 10 years ago
Dear Ernest,
Many thanks for your reply, I have since been able to get rules to activate in the interview, calculate and report defmodules. This is progress but the output I want for users is still not being displayed. Rules do activate but only some fire. I do not understand why serveral of the rules list 'activation' but do not fire? such as in the 'watch all' code below.
I have tried to take on our comments in your reply and have edited by code.
If I briefly tell you what I want the program to do this might lead to a better understanding. I want answers read from a user to be utalised in rules to output a basic analysis. I want to analysis symptoms of a user such as 'jaundice' to give a likelihood of developing cirrhosis. The idea of the program is basic enough, for each rule that fires a number is added to a total signifying the importance of having a paticular symptom. Additionally for each symptom or risk factor the user has, a short text is added to a list (for example "You have the liver disease symptom of jaundice.") as in my code to the multislot 'reasons' in the analysis deftemplate. For each symptom the user has a number such as 1 or 2 is added to the 'total' numeric slot in the analysis deftemplate. You said in your reply here that a lot of my rules attempt to call a function 'analysis' but this is simply a deftemplate name within my code and 'total' is the numeric slot I wish to add to as rules fire.
Once the 'total' and 'reasons' slots have been accordingly modified, the total is used to output a risk status to the user such as low, moderate or high and the multislot 'reasons' is printed out for the user to see a list of reasons as to why they have been assigned their level of risk. The rules in the defmodule 'report' are meant to print out risk status and list of reasons but they do not work as of yet. The rules in the report module are activated but do not fire. I think maybe I have wrote the code for rules in the report module somewhat incorrectly, I wonder if you can tell me where they would need to be changed.
One other problem is if I answer yes to all the symptoms then I seem to get a continues loop where rules are endlessly activated and facts seems to continuesly multiply such as f-25 up to f-200 on-going. The other error is that the slot 'total' is only added to once from what I see and not continuesly to get to a number such as 7 or 12.
Sorry for including all my code below, but I think it will help you understand what I have changed so far and the code is not that long. My current code is pasted below:
Many thanks if you can answer my questions and I appreciate your help kind Sir.