View source with formatted comments or as raw
    1:- module(pas_rules,
    2          [ chose/1,
    3            discarded/1
    4          ]).    5:- use_module(library(scasp)).    6:- use_module('PAS_guide').    7:- use_module('PAS_patient').    8
    9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   10%%                                        %%
   11%%     The Physician advisory system      %%
   12%%                                        %%
   13%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   14
   15:- pred chose('T') :: '@(T:treatment) has been chosen'.   16:- pred recommendation('T') :: 'it is a recommendation to use @(T)'.   17:- pred discarded('T') :: '@(T) is discarded'.   18:- pred available('T') :: 'available holds for @(T)'.   19:- pred exclude('T') :: '@(T:treatment) is excluded'.   20
   21:- show chose/1, recommendation/1, discarded/1.   22:- show not contraindication/1.   23:- show not evidence/1, not history/1, not diagnosis/1.   24:- show not exclude/1, not discarded/1.   25
   26%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   27%% The doctor need to select certain treatments
   28%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   29
   30chose(X) :- recommendation(X),  not exclude(X), not discarded(X).
   31
   32discarded(X) :- not available(X).
   33available(X) :- not discarded(X).
   34
   35%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   36%% There are some rules to chose/recommentd treatments
   37%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   38
   39%% 1. Aggressive Reasoning: The aggressive reasoning pattern can be
   40%% stated as "take an action (e.g., recommend treatment) inot f there
   41%% is a reason; no evidence of contraindication means there is no
   42%% danger in taking that action".
   43
   44recommendation(T) :-
   45    reason(T),
   46    not contraindication(T).
   47
   48%% 2. Conservative Reasoning: This reasoning pattern is stated as "A
   49%% reason for a recommendation is not enough; evidence that the
   50%% recommendation is not harmful must be available".
   51
   52recommendation(T) :-
   53    reason(T),
   54    -contraindication(T).
   55
   56%% 3. Anti-recommendation: The anti-recommendation pattern is stated
   57%% as "a choice can be prohibited if evidence of contraindication can
   58%% be found"
   59
   60%% contraindication/1.
   61
   62%% 4. Preference: The preference pattern is stated as "use the
   63%% second-line choice when the first-line choice is not available".
   64
   65recommendation(T2) :-
   66    second_line(T1,T2),
   67    reason(T1),
   68    contraindication(T1),
   69    not contraindication(T2).
   70
   71%% 5. Concomitant Choice: The concomitant choice pattern is stated as
   72%% "if a choice is made, some other choices are automatically in
   73%% effect unless they are prohibited."
   74
   75exclude(T0) :-
   76    concomitant(T0,T),
   77    recommendation(T),
   78    not chose(T).
   79
   80%% 6. Indispensable Choice: The indispensable choice pattern is stated
   81%% as "if a choice is made, some other choices must also be made; if
   82%% those choices can't be made, then the first choice is revoked".
   83
   84exclude(T0) :-
   85    indispensable(T0,T),
   86    not chose(T).
   87
   88%% 7. Incompatible Choice: The incompatibility pattern is stated as
   89%% "some choices cannot be in effect at the same time"
   90
   91exclude(T2) :-
   92    incompatibility(T1,T2),
   93    not discarded(T1).
   94exclude(T1) :-
   95    incompatibility(T1,T2),
   96    not discarded(T2)