View source with formatted comments or as raw
    1:- module(pas_guide,
    2          [ reason/1,
    3            contraindication/1,
    4            '-contraindication'/1,
    5            concomitant/2,
    6            indispensable/2,
    7            second_line/2,
    8            incompatibility/2
    9          ]).   10:- use_module(library(scasp)).   11:- use_module('PAS_rules').   12:- use_module('PAS_patient').   13
   14:- discontiguous
   15    evidence/1,
   16    diagnosis/1.   17
   18%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   19%% CHF Guide
   20%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   21
   22%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   23%% Guide Interface
   24%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   25
   26%% :- pred reason(T) :: 'there is a reason for @(T)'.
   27:- pred contraindication('T') ::
   28        'there is a danger in taking @(T)'.   29:- pred -contraindication('T') ::
   30        '@(T:treatment) is not harmful'.   31:- pred second_line('T0','T') ::
   32        '@(T:treatment) is the second choice of @(T0)'.   33:- pred concomitant('T0','T') ::
   34        '@(T:treatment) is concomitant if @(T0) is chosen'.   35:- pred indispensable('T0','T') ::
   36        '@(T:treatment) is indisplensable if @(T0) is chosen'.   37:- pred incompatibility('T0','T') ::
   38        '@(T:treatment) is incompatible with @(T0)'.   39
   40:- pred diagnosis(hf_with_reduced_ef) ::
   41        'the patient is diagnosed with heart failure with reduced \c
   42         ejection fraction'.   43
   44:- pred diagnosis('D') ::
   45        'the patient is diagnosed with @(D)'.   46
   47:- pred evidence(accf_stage_c) ::
   48        'the patient is in ACCF stage C'.   49:- pred evidence(pregnancy) ::
   50        'the patient is pregnant or planning to get pregnant'.   51:- pred evidence('E') ::
   52        'the patient is/has @(E)'.   53
   54%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   55%% Treatments Information
   56%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   57
   58%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   59%% 1. Reason: What are the reason for a treatment
   60
   61%Digoxin
   62%% "Digoxin can be beneficial in patients with HFrEF, unless
   63%% contraindicated, to decrease hospitalizations for HF."
   64
   65reason(digoxin) :-
   66    evidence(accf_stage_c),
   67    diagnosis(hf_with_reduced_ef).
   68
   69%Beta_blocker
   70reason(beta_blockers) :-
   71    evidence(accf_stage_c),
   72    diagnosis(hf_with_reduced_ef).
   73
   74%Anticoagulation
   75reason(anticoagulation) :-
   76    evidence(accf_stage_c),
   77    diagnosis(hf_with_reduced_ef),
   78    evidence(cardioembolic_stroke_risk_factor),
   79    diagnosis(atrial_fibrillation).
   80
   81%Ace_inhibitors
   82reason(ace_inhibitors) :-
   83    evidence(accf_stage_c),
   84    diagnosis(hf_with_reduced_ef).
   85
   86%Diuretics
   87reason(diuretics) :-
   88    evidence(accf_stage_c),
   89    diagnosis(hf_with_reduced_ef).
   90
   91%aldosterone_antagonist
   92reason(aldosterone_antagonist) :-
   93    evidence(accf_stage_c),
   94    evidence(lvef_equal_or_less_than_35_precent),
   95    evidence(nyha_class_4),
   96    evidence(normal_kidney_function),
   97    evidence(potassium_less_than_5_0).
   98
   99%Hydralazine and Isosorbide Dinitrate
  100reason(hydralazine) :-
  101    evidence(accf_stage_c),
  102    evidence(nyha_class_4),
  103    evidence(african_american),
  104    not discarded(ace_inhibitors),
  105    not discarded(beta_blockers).
  106
  107reason(isosorbide_dinitrate) :-
  108    evidence(accf_stage_c),
  109    evidence(nyha_class_4),
  110    evidence(african_american),
  111    not discarded(ace_inhibitors),
  112    not discarded(beta_blockers).
  113
  114
  115% Nonpharmacological Interventions
  116reason(specific_education) :-
  117    evidence(accf_stage_c),
  118    diagnosis(hf_with_reduced_ef).
  119
  120reason(exercise_training) :-
  121    evidence(accf_stage_c),
  122    diagnosis(hf_with_reduced_ef).
  123
  124reason(sodium_restriction) :-
  125    evidence(accf_stage_c),
  126    diagnosis(hf_with_reduced_ef).
  127
  128reason(continuous_positive_airway_pressure) :-
  129    evidence(accf_stage_c),
  130    diagnosis(hf_with_reduced_ef),
  131    evidence(sleepApnea).
  132
  133reason(cardiac_rehabilitation) :-
  134    evidence(accf_stage_c),
  135    diagnosis(hf_with_reduced_ef).
  136
  137
  138%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  139%% 2. contraindication: When is a danger in taking a treatment
  140
  141%Diagoxin
  142contraindication(digoxin) :-
  143    evidence(atrioventricular_block).
  144
  145%Ace_inhibitors
  146contraindication(ace_inhibitors):-
  147    case_history(angioedema).
  148contraindication(ace_inhibitors):-
  149    evidence(pregnancy).
  150
  151%Anticoagulation
  152%% "Anticoagulation is not recommended in patients with chronic HFrEF
  153%% without AF, a prior thromboembolic event, or a cardioembolic
  154%% source."
  155contraindication(anticoagulation) :-
  156    diagnosis(hf_with_reduced_ef),
  157    not evidence(cardioembolic_source),
  158    not diagnosis(atrial_fibrillation),
  159    not case_history(thromboembolism).
  160
  161contraindication(exercise_training) :-
  162    evidence(can_not_improve_functional_status).
  163
  164contraindication(X) :-
  165    case_contraindication(X).
  166
  167-contraindication(X) :-
  168    -case_contraindication(X).
  169
  170
  171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  172%% 4. second_line: What is the second choise if a treatment is not
  173%% available
  174
  175%Arbs
  176%% "ARBs are recommended in patients with HFrEF with current or prior
  177%% symptoms who are ACE inhibitor intolerant, unless contraindicated,
  178%% to reduce morbidity and mortality."
  179
  180second_line(ace_inhibitors, arbs).
  181
  182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  183%% 5. concomitat: What treatment is automatically chosen if is not
  184%% prohibited
  185
  186%Concomitat
  187%% "Diuretics should generally be combined with an ACE inhibitor, beta
  188%% blocker, and aldosterone antagonist.  Few patients with HF will be
  189%% able to maintain target weight without the use of diuretics."
  190
  191concomitant(ace_inhibitors, diuretics).
  192concomitant(beta_blockers, diuretics).
  193concomitant(aldosterone_antagonist, diuretics).
  194
  195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  196%% 6. indispensables: What treatment must be chosen
  197
  198%Indispensables
  199%% "In patients with a current or recent case_history of fluid retention,
  200%% beta blockers should not be prescribed without diuretics"
  201indispensable(beta_blockers, diuretics) :-
  202    case_history(fluid_retention).
  203
  204indispensable(hydralazine, isosorbide_dinitrate).
  205indispensable(hydralazine, beta_blockers).
  206indispensable(hydralazine, ace_inhibitors).
  207
  208%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  209%% 7. incompatibility: Which treatment can not be chosen together
  210
  211%Incompatibilities
  212%% "Routine combined use of an ACE inhibitor, ARB, and aldosterone
  213%% antagonist is potentially harmful for patients with HFrEF."
  214
  215incompatibility(ace_inhibitors,arbs).
  216incompatibility(aldosterone_antagonist,arbs).
  217incompatibility(ace_inhibitors,aldosterone_antagonist).
  218
  219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  220%% AUXILIAR PREDICATES INSIDE GUIDE
  221
  222% A1 evidence inference from patient information
  223evidence(cardioembolic_stroke_risk_factor):-
  224    case_history(hypertension).
  225evidence(cardioembolic_stroke_risk_factor):-
  226    diagnosis(diabetes).
  227evidence(cardioembolic_stroke_risk_factor):-
  228    case_history(stroke).
  229evidence(cardioembolic_stroke_risk_factor):-
  230    case_history(ischemic_attack).
  231evidence(cardioembolic_stroke_risk_factor):-
  232    evidence(over_75_years_old).
  233
  234evidence(over_75_years_old):-
  235    case_measurement(age, Data), Data > 75.
  236
  237% A2 diagnosis inference from patient information
  238diagnosis(hf_with_reduced_ef) :-
  239    case_measurement(lvef, Data), Data < 0.4.
  240evidence(creatinine_equal_or_less_than_2) :-
  241    case_measurement(creatinine, Data), Data =< 2.
  242evidence(glomerular_filtration_rate_greater_than_30) :-
  243    case_measurement(glomerular_filtration_rate, Data), Data > 30.
  244
  245evidence(normal_kidney_function) :-
  246    evidence(creatinine_equal_or_less_than_2).
  247evidence(normal_kidney_function) :-
  248    evidence(glomerular_filtration_rate_greater_than_30).
  249
  250evidence(potassium_less_than_5_0) :-
  251    case_measurement(potassium, Data), Data < 5.
  252
  253evidence(lvef_equal_or_less_than_35_precent) :-
  254    case_measurement(lvef, Data), Data =< 0.35.
  255
  256evidence(X) :-
  257    case_evidence(X).
  258diagnosis(X) :-
  259    case_diagnosis(X)