Dear Jess Support Team,
 
I started writing a program that develops a small knowledge system for health assessment and longevity planning.  The health assessment system will evaluate a persons current health status based on input values for predefined risk factors and behavioral influences on longevity.  The program will ask the user a number of questions about his vital statistics and lifestyle habits.  Based on the answers provided, the system will predict the persons longevity.
 
I am having problems understanding how to translate my rules into jess codes.  Therefore, I would like to ask for your assistance in getting me started with this part. I've attached my codes to this e-mail; also, I've made a list of the rules I need to add to my program. 
 
Thank you for your help in advance!
Katie Truong
 
Rule No. If  Then
1 relative_weight=normal val=yes
2 heart_disease_risk=below_average hddanger=low
3 age=25_or_less and gender=m then base_longevity=72
4 weight=110_or_less and frame=small and gender=f relative_weight=normal
5 cholesteral=low and fat=high heart_desease_risk=below_average
6 salt=high blood_pressure=above_average
7 relative_weight=obese and heart_disease_risk=above_average and blook_pressure=above_average and smoker=yes outlook=bleak
8 race=black and origin=mediterranean risk=high
9 personality=aggressive personality_type=type_a
10 alcohol_consumption=moderate add=good
11 outlook=bleak and risk=unknown and add=good factor=none
12 base_longevity=72 and factor=none longevity=67_years


Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
;;; Katie Truong Health Assessment Adviser

;;   Possible answers to questions

(deftemplate health)
        (slot start)
        ;;(slot gender)
        (slot age)
        ;;(slot frame)
        ;;(slot fat)
        ;;(slot cholesterol)
        ;;(slot salt)


;; Health questions to obtain data from user

         
(deffacts question-data
  "Questions the system can ask."
  (question (ident begin) (type number)
            (text "Are you ready to begin? 1.Yes or 2.Quit"))
  (question (ident age) (type number)
            (text "How old are you? 1.25 or less, 2.25-55, or 3.55 or over"))
  (question (ident gender) (type number)
            (text "What is your gender? 1.Male or 2.Female"))
  (question (ident frame) (type number)
            (text "What is your frame? 1.Small or 2.Large"))
  (question (ident fat) (type number)
            (text "What is your unsaturated fat intake? 1.Normal or 2.High"))
  (question (ident cholesterol) (type number)
            (text "What is your animal fat intake? 1.Normal or 2.High"))
  (question (ident salt) (type number)
            (text "What is your salt intake? 1.Normal or 2.High"))
  (question (ident smoker) (number)
            (text "Are you a smoker? 1.Yes or 2.No"))
  (question (ident race) (type number)
            (text "What is your race? 1. Black, 2.Caucasian, or 3.Asian-Pacific"))
  (question (ident personality) (type number)
            (text "What is your personality like? 1.Agressive or 2.Docile"))
  (question (ident alcohol) (type number)
            (text "What is your alcohol consumption? 1.None, 2.Moderate, or 
3.Excessive"))
 

(defglobal ?*crlf* = "
")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Module ask

(defmodule ask)


(deffunction is-of-type (?answer ?type)
  "Check that the answer has the right form"
  (if (eq ?type yes-no) then
    (return (or (eq ?answer yes) (eq ?answer no)))
    else (if (eq ?type number) then
           (return (numberp ?answer)))
    else (return (> (str-length ?answer) 0))))
  (return))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Module startup

(defmodule startup)


(defrule print-banner
        => 
        (printout t "Type your name and press Enter>")
        bind ?name (read)
        (printout t crlf "*****************************" crlf)
        (printout t "Hello, " ?name "." crlf)
        (printout t "Welcome to the Health Assessment Adviser." crlf)
        (printout t "Please answer the following questions and" crlf)
        (printout t "I will predict your longevity." crlf)
        (printout t crlf "*****************************" crlf crlf))




Reply via email to