I am trying to program a scenario where a user will input two pieces of information, a 6-minute walk distance in meters at baseline (6MWDbaseline) and then a 6-minute walk distance in meters at 24-weeks (6MWD24weeks). I want the user to supply those pieces of information rather than me asserting them within the program. Once those numbers are entered they need to be applied to the equation: (6MWD24weeks - 6MWDbaseline) = x and then to this equation: x / 6MWDbaseline = y Where, if y >/= 0.2 then the program will denote success. If y is between 0.05-0.19 then the program will denote clinical improvement. If y is <0.049 then the program will denote failure.
I get an error early on in my script testing, before I can even try to program my 'clinical improvement' or 'failure' lines, that my user inputs of 6MWDbaseline and 6MWD24weeks are expected to be integers or floats. Any guidance on what I might be doing wrong?
CLIPS> (clear)
CLIPS> (defrule MAIN::6WMDbaseline-check
=>
(printout t "What is the distance on the baseline 6-minute walk distance in meters?" crlf)
(assert (6MWDbaseline (read))))
CLIPS> (defrule MAIN::6MWD24week-check
=>
(printout t "What is the distance on the 24-week 6-minute walk distance in meters?" crlf)
(assert (6MWD24week (read))))
CLIPS> (defrule MAIN::success-decision
(6MWDbaseline ?6MWDbaseline)
(6MWD24week ?6MWD24week)
=>
(if (- 6MWD24week 6MWDbaseline = x) and (/ x 6MWDbaseline >0.2))
then
(printout t "Primary outcome met, greater than 20% improvement in 6-minute walk distance" crlf))
[ARGACCES2] Function '-' expected argument #1 to be of type integer or float.
ERROR:
(defrule MAIN::success-decision
(6MWDbaseline ? 6MWDbaseline)
(6MWD24week ? 6MWD24week)
=>
(if (- 6MWD24week 6MWDbaseline = x)
CLIPS>
Thanks in advance for any assistance! Marnie