;; ;; as regras, e definicoes de atributos e contexto em mycin ;; ;; ;; CONTEXTO ;; ;; (defcontext contexto ;; lista-de-atributos-para-perguntar-valor-de-cara ;; lista-de-atributos-objetivos) (setq *contextos* (list (defcontext patient (name sex age) ()) (defcontext culture (site days-old) ()) (defcontext organism () (identity)) )) ;;; ;;; ATRIBUTOS ;;; (defparm nome-do-atributo ;;; contexto-do-atributo ;;; possiveis-valores ;;; prompt ;;; pergunte-valor-ao-usuario-antes-de-deduzir ;;; ) ;;; O valor do prompt 'e um string de formato que vai ser ;;; aplicado da seguinte forma ;;; ;;; (format t prompt contexto-atual contexto-pai contexto-avo ...) ;;; O valor de possiveis-valores e' ;;; ;;; t qq valor e' possivel ;;; (member a b c ..) apenas os valores atomicos a,b, c.. sao possiveis ;;; numberp o valor deve ser numerico ;;; yes/no resposta e' yes ou no ;; atributos de patient (defparm name patient t "Patient's name:" t) (defparm sex patient (member male female) "Sex:" t) (defparm age patient numberp "Age:" t) (defparm burn patient (member no mild serious) "Is ~a a burn patient? If so mild or serious" t) (defparm compromised-host patient yes/no "Is ~a a compromised host?" t) (defparm leukopenia patient yes/no "Does the patient ~a has leukopenia?" t) (defparm immunosuppressed patient yes/no "Is the patient ~a immunosuppressed?" t) (defparm wbc patient numberp "What is ~a white-cells blood count" t) ;; atributos de culture (defparm site culture (member blood saliva) "Where was culture ~a taken from?" t) (defparm days-old culture numberp "How old (in days) is ~a?" t) ;; atributos de organism (defparm identity organism (member pseudomas klebsiela enterobacteriaceae staphylococcus bacteroides streptococcus) "What is the identity (genus) of ~a" t) (defparm gram organism (member acid-fast pos neg) "What is the gram stain of ~a ?" t) (defparm morphology organism (member roc coccus) "Is ~a a rod or coccus?" t) (defparm aerobicity organism (member aerobic anaerobic) "What is the aerobicity of ~a" t) (defparm growth-conformation organism (member chains pairs clumps) "What is the growth pattern of ~a" t) ;;; ;;; as REGRAS ;;; (defrule 1 if (immunosuppressed patient is yes) then 1.0 (compromised-host patient is yes) ) (defrule 2 if (leukopenia patient is yes) then 1.0 (immunosuppressed patient is yes) ) (defrule 3 if (wcb patient < 2.5) then 0.9 (leukopenia pateint is yes)) (defrule 52 if (site culture is blood) (gram organism is neg) (morphology organism is rod) (burn patient is serious) then 0.4 (identity organism is pseudomonas) ) (defrule 71 if (gram organism is pos) (morphology organism is coccus) (growth-conformation organism is clumps) then 0.7 (identity organism is staphylococcus) ) (defrule 73 if (site culture is blood) (gram organism is neg) (morphology organism is rod) (aerobicity organism is anaerobic) then 0.9 (identity organism is bacteroides) ) (defrule 75 if (gram organism is neg) (morphology organism is rod) (compromised-host organism is yes) then 0.6 (identity organism is pseudomonas) ) (defrule 107 if (gram organism is neg) (morphology organism is rod) (aerobicity organism is aerobic) then 0.8 (identity organism is enterobacteriaceae) ) (defrule 165 if (gram organism is pos) (morphology organism is coccus) (growth-conformation organism is chains) then 0.7 (identity organism is streptococcus) )