?? project.clp
字號:
; check for availability of ldl after reaching box t1
(defrule check-ldl-at-t1 "Check for ldl"
?f1 <- (patient2 (ldl ?ldl)
(done ?done)
(state ?state)
(name ?name))
(test (= ?ldl -1)) ; see other rules with ldl > 0
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state t1)))
=>
(printout t crlf
"Please input patient " ?name "'s ldl value [-1 if no value]"crlf)
(bind ?answer (read))
(if (and (numberp ?answer) (> ?answer 0)) then
(modify ?f1 (ldl ?answer)) ; do not modify state here
else
(printout t crlf
"-------------------------------------------------------"crlf)
(printout t "Please obtain ldl test on" ?name crlf)
(printout t
"-------------------------------------------------------"crlf)
(modify ?f1 (done yes))))
; rule to check the age of the ldl value
; for treated patient must be after treatment
(defrule check-treat-ldl-date "after treatment begins"
?f1 <- (patient2 (name ?name) (ldl-date ?ldl-date)
(treatment-date ?treatment-date)
(done ?done) (state ?state))
(test (< ?ldl-date ?treatment-date))
(test (= 0 (str-compare ?done no)))
=>
(printout t "-------------------------------------------------------"crlf)
(printout t "| Last ldl value for " ?name
" is before the latest treatment." crlf)
(printout t "| Please obtain a value on treatment." crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes)))
; Rule for box t4 chd low risk
(defrule ruleT4 "no chd low risk"
?f1 <- (patient2 (name ?name) (done ?done) (risk ?risk)
(state ?state) (chd ?chd))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?chd no)))
(test (= 0 (str-compare ?state t1))) ; state
(test (< ?risk 2))
=>
(modify ?f1 (state t4)))
; Rule for box t5 chd high risk
(defrule ruleT5 "no chd high risk"
?f1 <- (patient2 (name ?name) (done ?done) (risk ?risk)
(state ?state) (chd ?chd))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?chd no)))
(test (= 0 (str-compare ?state t1))) ; state
(test (>= ?risk 2))
=>
(modify ?f1 (state t5)))
; Rule for box t6 chd high risk
(defrule ruleT6 "no chd high risk"
?f1 <- (patient2 (name ?name) (done ?done)
(state ?state) (chd ?chd))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?chd yes)))
(test (= 0 (str-compare ?state t1))) ; state
=>
(modify ?f1 (state t6)))
; Rule for box t4 responding
(defrule ruleT4good "responding"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl)
(state ?state) (treatment ?treatment))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state t4))) ; state
(test (< ?ldl 160))
=>
(printout t crlf)
(printout t "Patient " ?name " is responding well to "
?treatment " therapy"crlf)
(printout t "-------------------------------------------------------"crlf)
(printout t "| The LDL of "?ldl" is below the goal of 160 mg/dl"crlf)
(printout t "| Continue the current therapy |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes) (state tgood)))
; Rule for box t4 not responding
(defrule ruleT4bad "not responding"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl)
(state ?state) (treatment ?treatment))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state t4))) ; state
(test (> ?ldl 160))
=>
(printout t crlf)
(printout t "Patient " ?name " is not responding well to "
?treatment " therapy" crlf)
(printout t "-------------------------------------------------------"crlf)
(printout t "| The LDL of "?ldl" is above the goal of 160 mg/dl"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (state tbad)))
; Rule for box t5 responding
(defrule ruleT5good "responding"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl)
(state ?state) (treatment ?treatment))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state t5))) ; state
(test (< ?ldl 130))
=>
(printout t crlf)
(printout t "Patient " ?name " is responding well to "
?treatment " therapy" crlf)
(printout t "-------------------------------------------------------"crlf)
(printout t "| The LDL of "?ldl" is below the goal of 130 mg/dl"crlf)
(printout t "| Continue the current therapy |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes) (state tgood)))
; Rule for box t5 not responding
(defrule ruleT5bad "not responding"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl)
(state ?state) (treatment ?treatment))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state t5))) ; state
(test (> ?ldl 130))
=>
(printout t crlf)
(printout t "Patient " ?name " is not responding well to "
?treatment " therapy"crlf)
(printout t "-------------------------------------------------------"crlf)
(printout t "| The LDL of "?ldl" is above the goal of 130 mg/dl"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (state tbad)))
; Rule for box t6 responding
(defrule ruleT6good "responding"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl)
(state ?state) (treatment ?treatment))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state t6))) ; state
(test (< ?ldl 100))
=>
(printout t crlf)
(printout t "Patient " ?name " is responding well to "
?treatment " therapy"crlf)
(printout t "-------------------------------------------------------"crlf)
(printout t "| The LDL of "?ldl" is below the goal of 100 mg/dl"crlf)
(printout t "| Continue the current therapy |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes) (state tgood)))
; Rule for box t6 not responding
(defrule ruleT6bad "not responding"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl)
(state ?state) (treatment ?treatment))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state t6))) ; state
(test (> ?ldl 100))
=>
(printout t crlf)
(printout t "Patient " ?name " is not responding well to "
?treatment " therapy"crlf)
(printout t "-------------------------------------------------------"crlf)
(printout t "| The LDL of "?ldl" is above the goal of 100 mg/dl"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (state tbad)))
; Rule for early non responders
(defrule ruleTbadearly "not responding"
?f1 <- (patient2 (name ?name) (done ?done) (treatment-date ?treatment-date)
(state ?state))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state tbad))) ; state
(test (not (six-months ?treatment-date)))
=>
(printout t "| Patient has been on treatment for less than 6 months|"crlf)
(printout t "| Continue treatment for 6 months before evaluating |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes)(state tz)))
; Rule for late nonresponders to diet
(defrule ruleTbaddiet1 "no chd low risk"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl) (chd ?chd)
(treatment ?treatment) (treatment-date ?treatment-date)
(risk ?risk) (state ?state))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state tbad))) ; state
(test (= 0 (str-compare ?chd no)))
(test (= 0 (str-compare ?treatment diet)))
(test (six-months ?treatment-date))
(test (< ?risk 2))
(test (< ?ldl 190))
=>
(printout t "| Although patient has not responded to diet, |"crlf)
(printout t "| the LDL is not high enough to justify drug therapy. |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes)(state tz)))
; Rule for late nonresponders to diet
(defrule ruleTbaddiet2 "no chd high risk"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl) (chd ?chd)
(treatment ?treatment) (treatment-date ?treatment-date)
(risk ?risk) (state ?state))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state tbad))) ; state
(test (= 0 (str-compare ?chd no)))
(test (= 0 (str-compare ?treatment diet)))
(test (six-months ?treatment-date))
(test (>= ?risk 2))
(test (< ?ldl 160))
=>
(printout t "| Although patient has not responded to diet, |"crlf)
(printout t "| the LDL is not high enough to justify drug therapy. |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes)(state tz)))
; Rule for late nonresponders to diet
(defrule ruleTbaddiet3 "with chd"
?f1 <- (patient2 (name ?name) (done ?done) (ldl ?ldl) (chd ?chd)
(treatment ?treatment) (treatment-date ?treatment-date)
(state ?state))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state tbad))) ; state
(test (= 0 (str-compare ?chd yes)))
(test (= 0 (str-compare ?treatment diet)))
(test (six-months ?treatment-date))
(test (< ?ldl 130))
=>
(printout t "| Although patient has not responded to diet, |"crlf)
(printout t "| the LDL is not high enough to justify drug therapy. |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes)(state tz)))
; Rule for late nonresponders to diet who are drug candidates
(defrule ruleTbaddiet4 "candidates for drug therapy"
?f1 <- (patient2 (name ?name) (done ?done)
(treatment ?treatment) (treatment-date ?treatment-date)
(state ?state))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state tbad))) ; state
(test (= 0 (str-compare ?treatment diet)))
(test (six-months ?treatment-date))
=>
(printout t "| Consider advancing to drug therapy. |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes)(state tz)))
; Rule for late nonresponders to drug therapy
(defrule ruleTbaddrug "candidates for drug therapy"
?f1 <- (patient2 (name ?name) (done ?done)
(treatment ?treatment) (treatment-date ?treatment-date)
(state ?state))
(test (= 0 (str-compare ?done no)))
(test (= 0 (str-compare ?state tbad))) ; state
(test (= 0 (str-compare ?treatment drug)))
(test (six-months ?treatment-date))
=>
(printout t "| Consider advancing therapy. |"crlf)
(printout t "-------------------------------------------------------"crlf)
(modify ?f1 (done yes)(state tz)))
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -