;use inner&outer bound, then maybe rsm-fuzzy (in-package "LISA-USER") (lisa:consider-taxonomy) ;pull out a defclass macro to save time ;try to get as many DL like constraints in as possible ;look @nokia &swclos &cl-semantic work ;at least get acache defclass* in here (but doesn't lisa also have a metaclass?) ;utils::Define-Class trail-base () ) (defclass trail-base () ()) ;(utils::Define-Class patient (trial-base) id) (defclass patient (trial-base) (id)) ;(utils::Define-Class newborn (patient) ; fullterm-p apgar blood-gas encephalopathy-p) ;defclass newborn (patient) ;defclass newborn (trial-base) (defclass newborn () ((fullterm-p :initarg :fullterm-p :initform 'na) (gestAge :initarg :gestAge :initform nil) (apgar :initarg :apgar :initform nil) (bd :initarg :bd ;alt for apgar in this miniExmpl :initform nil) (blood-gas :initarg :blood-gas :initform nil) (encephalopathy-p :initarg :encephalopathy-p :initform 'na))) (watch :activations) (watch :facts) (watch :rules) (defrule startup () => (assert ((make-instance 'newborn :gestAge 9 ;:fullterm-p t :apgar 5 :blood-gas 7 :encephalopathy-p 't))) (assert ((make-instance 'newborn :gestAge 9 ;:fullterm-p t ;:apgar 5 :bd 16 :blood-gas 7 :encephalopathy-p 't))) (assert ((make-instance 'newborn :gestAge 9 ;:fullterm-p t :apgar 5 :blood-gas 8 :encephalopathy-p 't))) (assert ((make-instance 'newborn :gestAge 9 ;:fullterm-p t :apgar 5 :blood-gas 9 :encephalopathy-p 't))) ) ;consider 'measurment' instances, which can be viewed many ways(contextually?)incl symbolic rating* ;-mix fwd&bw to find things (agraph/screamer/prolog kn-works)ocelot/loom/etc ;(defrule fullterm () ; "set fullterm-p slot" ;could do w/an init-inst:after ; (?baby (newborn ; (gestAge 9))) ; => ; (modify ?baby ; (fullterm-p t))) ;better for 1shot inits: (defmethod initialize-instance :after ((Obj newborn) &rest args) ;&key &allow-other-keys (with-slots (gestAge fullterm-p) Obj (when (and (eq gestAge 9) (eq fullterm-p 'NA) ;(not fullterm-p) ) (format t "gAge:~a resets ~a" gestAge fullterm-p) (setf fullterm-p t)))) (defun test-hie0 (?bg ?ap) ;(when (and (< ?bg 7.1) (< ?ap 6)) ; (print "found one")) ;(when (and (<= 7.1 ?bg 8.1) (<= 6 ?ap 7)) ; (print "almost found one, score:")) (when (and (< ?bg 8.1) (< ?ap 7)) (if (and (< ?bg 7.1) (< ?ap 6)) (print "found one") (print "almost found one, score:"))) ) (defun ltn (a b) "lt or nil" ;not really safe to use (or (not a) (not b) (< a b))) (defun test-hie (?bg ?ap) (when (and (ltn ?bg 8.1) (ltn ?ap 7)) (if (and (ltn ?bg 7.1) (ltn ?ap 6)) (print "found one") (print "almost found one, score:"))) ) ;(trace test-hie) ;(trace ltn) ;OBJECTIVE: The objective of this study was to determine the efficacy of mild ;hypothermia via selective head cooling as a neuroprotective therapy in term ;infants with perinatal asphyxia. ;=STUDY DESIGN: =(incl crit ~=applicable criterion) ;Full-term newborns ;who had 5 min Apgar scores <6, ;first arterial blood gas pH<7.10 or BD>15 mEq/l, ;and with the clinical signs of encephalopathy ;were enrolled within 6 h after birth. (defrule hie-match () (newborn (fullterm-p t) (encephalopathy-p t) (apgar ?ap) (blood-gas ?bg) ) => (test-hie ?bg ?ap) ) ;can get cutoffs&err from kb; can get/est fz-memb from actual data ; # T # # # :ACTIVATIONS :FACTS :RULES # # TEST-HIE0 LTN TEST-HIE # T CL-USER(5): # LISA-USER(6): ==> F-0 (INITIAL-FACT) ==> Activation: STARTUP : (F-0) T LISA-USER(7): FIRE 1: STARTUP (F-0) gAge:9 resets NA==> F-1 (NEWBORN (GESTAGE 9) (BD NIL) (FULLTERM-P T) (BLOOD-GAS 7) (ENCEPHALOPATHY-P T) (APGAR 5)) ==> Activation: HIE-MATCH : (F-1) gAge:9 resets NA==> F-2 (NEWBORN (GESTAGE 9) (BD 16) (FULLTERM-P T) (BLOOD-GAS 7) (ENCEPHALOPATHY-P T) (APGAR NIL)) ==> Activation: HIE-MATCH : (F-2) gAge:9 resets NA==> F-3 (NEWBORN (GESTAGE 9) (BD NIL) (FULLTERM-P T) (BLOOD-GAS 8) (ENCEPHALOPATHY-P T) (APGAR 5)) ==> Activation: HIE-MATCH : (F-3) gAge:9 resets NA==> F-4 (NEWBORN (GESTAGE 9) (BD NIL) (FULLTERM-P T) (BLOOD-GAS 9) (ENCEPHALOPATHY-P T) (APGAR 5)) ==> Activation: HIE-MATCH : (F-4) FIRE 2: HIE-MATCH (F-1) "found one" FIRE 3: HIE-MATCH (F-2) "found one" FIRE 4: HIE-MATCH (F-3) "almost found one, score:" FIRE 5: HIE-MATCH (F-4) 5 LISA-USER(8): Evaluation stack: TPL:TOP-LEVEL-READ-EVAL-PRINT-LOOP <- TPL:START-INTERACTIVE-TOP-LEVEL LISA-USER(9): EOF ; Exiting @<62 local: /appli/lisa>