% --------------------------------------------------------------------------
%   FILE:       PMF.PL
%   AUTHOR:     Tim Duncan
%   UPDATED:    Thu Aug  6 19:03:38 BST 1987
%   PURPOSE:    Problem Management Frames, Contextual Preference Rules, plus
%               Contextual Constraints, for ATTENDING (from sources).
% --------------------------------------------------------------------------


:- op(100,fx,*).
:- op(100,xfy,:).



/* cprule(Morepref,Lesspref,Context,Why) */

cprule(tmaskcricoid,trapidseq,[cad],
    [*comma,if,severe,*comma,since,it,allows,more,gradual,induction,
    with,less,danger,of,sudden,cardiac,decompensation]).
cprule(tinhal,tbalanced,[aaa],
    [since,it,allows,more,control,of,blood,pressure,
    and,therefore,less,chance,of,aneurysmal,rupture]).
cprule(tnormint,trapidseq,[not(full_stom)],     % anything except full_stomach
    [since,it,is,safer,should,the,patient,
    turn,out,to,have,a,difficult,airway]).
cprule(trapidseq,tawake,[unstable_neck,intoxication],
    [*comma,if,the,patient,is,extremely,uncooperative,
    *comma,since,in,these,circumstances,awake,intubation,might,
    result,in,further,neck,damage]).
cprule(tga,treg,[maoi,pregnancy],
    [since,there,is,probably,less,chance,of,rapid,prolonged,
    hypotension,which,would,be,detrimental,to,the,fetus,
    *comma,and,which,could,not,be,freely,treated,with,vasopressors]).



/* op_block(Op,Arcs_blocked) */

op_block(thr,[tepid,treg,tspinal]).
op_block(abdop,[tepid,treg,tspinal]).
op_block(leop,[tepid,treg,tspinal,tnb]).
op_block(ueop,[tnb,treg]).
op_block(aaa,[tepid,treg,tspinal]).         % aortic_aneurysmectomy
op_block(colectomy,[tepid,treg,tspinal]).
op_block(cholecystectomy,[tepid,treg,tspinal]).
op_block(tendon_repair,[tnb,treg]).


/* pmframe(Disease,Principles,Risks).
        principle(Features).
        risk(Arcname,Riskval,Features).
     or   risk(Arc:[Condition],Riskval,Features).
*/

pmframe(asthma,[
    principle([prefer(deep_anesthesia), danger(bronchospasm)]),
    principle([prefer(bronchodilators), danger(bronchospasm)]),
    principle([avoid(bronchospastics), danger(bronchospasm)])
       ],[
    risk(trapidseq,lowr,[desc([bronchospasm]), whensevere]),
    risk(tinhal,lowb,[desc([preventing,bronchospasm,by,keeping,the,
        anesthetic,level,deep]), whensevere]),
    risk(thalo,lowb,[desc([helping,prevent,bronchospasm,since,halothane,is,a,
        bronchodilator]), whensevere]),
    risk(tketamine,modb,[desc([suppressing,bronchospasm,since,
        ketamine,is,a,bronchodilator]), whensevere]),
    risk(tdtc,princ,3,lowr,[desc([bronchospasm]), mech(histamine),
        mechdesc([triggered,by,histamine,release]), whensevere]),
    risk(tmorph,lowr,[desc([bronchospasm]), mech(histamine),
        mechdesc([due,to,histamine,release]), whensevere]),
    risk(tmorphpm,lowr,[desc([bronchospasm]), mech(histamine),
        mechdesc([due,to,histamine,release]), whensevere]),
    risk(teth,lowr,[desc([initial,bronchospasm,due,to,airway,irritability]),
        whensevere]),
    risk(ttpl,lowr,[desc([bronchospasm]), whensevere]),
    risk(tawake,modr,[desc([bronchospasm]), whensevere]),
    risk(tbalanced,lowr,[desc([possible,bronchospasm,due,to,light,anesthesia])]),
    risk(tnosed:[not(acute_trauma)],modr,   /* conditional risk */                     
        [whensevere, desc([problems,with,the,patient,*apost_s,asthma])])
    ]).

pmframe(liver_disease,[
    principle([avoid(hepatotoxins), danger(hepatic_damage)])
       ],[
    risk(thalo,lowr,[desc([halothane,induced,hepatotoxicity]), questrisk])
    ]).

pmframe(crf,[
    principle([avoid(renal_toxins), danger(renal_damage)]),
    principle([avoid(renal_excreted_drugs), danger(compromised_excretion)])
       ],[
    risk(teth,lowr,[desc([renal,toxicity,due,to,metabolic,release,of,
        fluoride,ion]), questrisk]),
    risk(tgall,modr, [desc([prolonged,postoperative,paralysis,due,to,
        compromised,renal,excretion])]),
    risk(thighpav,lowr,[desc([prolonged,postoperative,paralysis,due,to,
        compromised,renal,excretion])]),
    risk(tdtc,none,[wellchos, desc([it,is,reliably,metabolized,by,the,liver])]),
    risk(thalo,none,[wellchos, desc([it,has,minimal,nephrotoxicity])])
    ]).

pmframe(hypovolemia,[
    principle([avoid(hypotensive_techniques), danger(hypotension)]),
    principle([prefer(hypertensive_techniques), danger(hypotension)])
       ],[
    risk(tinhal,modr,[desc([hypotension]), prob(hypovolemia),
        probdesc([in,the,presence,of,hypovolemia]), type(hypotension)]),
    risk(tinhalin,modr,[desc([hypotension]), prob(hypovolemia),
        probdesc([in,the,presence,ofhypovolemia]), type(hypotension)]),
    risk(ttpl,lowr,[desc([hypotension]), prob(hypovolemia), possrisk,
        probdesc([in,the,presence,of,hypovolemia]), type(hypotension)]),
    risk(tdrop,modr,[desc([hypotension]), prob(hypovolemia),
        probdesc([in,the,presence,of,hypovolemia]), mech(alphablock),
        mechdesc([due,to,alpha,blockade]), type(hypotension)]),
    risk(tmorph,lowr,[desc([hypotension]), prob(hypovolemia),
        probdesc([in,the,presence,of,hypovolemia]), mech(histamine),
        mechdesc([since,morphine,can,trigger,histamine,release]),
        type(hypotension)]),
    risk(tdtc,lowr,[desc([hypotension]), prob(hypovolemia),
        probdesc([in,the,presence,of,hypovolemia]), mech(histamine),
        mechdesc([since,curare,can,induce,histamine,release]),
        type(hypotension)]),
    risk(tketamine,modb,[desc([helping,avoid,hypotension,since,ketamine,is,
        supportive,of,blood,pressure])]),
    risk(tbalanced,lowb,[desc([maintaining,blood,presssure]),
        prob(hypovolemia), probdesc([in,the,presence,of,hypovolemia])]),
    risk(tconduct,highr,[desc([severe,hypotension,due,to,sympathectomy]),
        prob(hypovolemia), probdesc([in,a,hypovolemic,patient]),
        type(hypotension)])
    ]).


pmframe(hbp,[
    principle([prefer(hypotensive_techniques),danger(hypertension)]),
    principle([avoid(hypertensive_techniques),danger(hypertension)])
       ],[
    risk(tinhal,modb,[desc([giving,better,control,of,blood,pressure])]),
    risk(tdtc,lowb,[desc([helping,to,prevent,hypertension])]),
    risk(tmorph,lowb,[desc([helping,to,prevent,hypertension])]),
    risk(tketamine,highr,[desc([exacerbation,of,the,patient,
        *apost_s,underlying,hypertension]), type(hypertension)]),
    risk(tbalanced,lowr,[riskspec, desc([may,not,give,adequate,
        control,of,hypertension]), type(hypertension)])
    ]).

pmframe(cva,[
    principle([avoid(depolarizers),danger(hyperkalemia)])
       ],[
    risk(tsux,highr,[desc([life-threatening,hyperkalemia]),
        cond([the,stroke,is,recent,and,involves,hemiparesis])])
    ]).

pmframe(cad,[
    principle([prefer(gentle_induction),danger(hypotension),
        danger(ischemia)]),
    principle([avoid(hypotension),danger(hypotension),
        danger(ischemia)]),
    principle([avoid(tachycardia),danger(ischemia)])
       ],[
    risk(tinhalin,lowr,[desc([hypotension]),type(hypotension)]),
    risk(tatr,lowr,[desc([ischemia,due,to,tachycardia]), possrisk,
        type(hypotension)]),
    risk(ttpl,lowr,[desc([hypotension,from,cardiac,depression]),
        whensevere, type(hypotension)]),
    risk(tmaskcricoid,modb,[desc([helping,avoid,hypotension]),whensevere]),
    risk(tdtc,lowr,[desc([hypotension]), mech(histamine),
        mechdesc([due,to,histamine,release]),whensevere, type(hypotension)]),
    risk(tgall,highr,[desc([ischemia,due,to,tachycardia])]),
    risk(tawake,highr,[desc([ischemia]),whensevere]),
    risk(trapidseq,modr,[desc([cardiac,compromise]),whensevere,
        type(hypotension)]),
    risk(tketamine,highr,[desc([hypertension,and,ischemia]),
        type(hypertension)]),
    risk(tconduct,highr,[desc([hypotension,and,cardiac,decompensation]),
        whensevere, type(hypotension)])
    ]).

pmframe(full_stom,[
    principle([avoid(aspiration),danger(aspiration)])
       ],[
    risk(trapidseq,lowr,[desc([aspiration]),noprint,type(aspiration)]),
    risk(tmaskcricoid,lowr,[desc([aspiration]),noprint,type(aspiration)]),
    risk(tnormint,extremer,[desc([aspiration]),type(aspiration)]),
    risk(tnointub,extremer,[desc([aspiration]),type(aspiration)])
    ]).

pmframe(pene_eye,[
    principle([avoid(increased_iop),danger(eye_morbidity)])
       ],[
    risk(tsux,highr,[desc([eye,morbidity]), mech(iiop),
        mechdesc([from,increased,intraocular,pressure])]),
    risk(tawake,highr,[desc([eye,morbidity]), mech(iiop),
        mechdesc([from,increased,intraocular,pressure])]),
    risk(tketamine,highr,[desc([eye,morbidity]), mech(iiop),
        mechdesc([from,increased,intraocular,pressure]) ])
    ]).

pmframe(aaa,[
    principle([avoid(hypertension),danger(ruptured_aaa)])
       ],[
    risk(tketamine,modr,[desc([aneurysmal,rupture]), mech(hypertension),
        mechdesc([induced,by,hypertension]), type(hypertension)]),
    risk(tbalanced,modr,[whensevere,desc([aneurysmal,rupture]),
        mech(hypertension), mechdesc([induced,by,hypertension]),
        type(hypertension)]),
    risk(tawake,modr,[possrisk,desc([aneurysmal,rupture]),
        mech(hypertension), mechdesc([induced,by,hypertension])]),
    risk(tnosed,modr,[desc([increased,aneurysmal,tension]),
        mech(hypertension),mechdesc([induced,by,hypertension])])
    ]).

pmframe(headop,[   ],[
    risk(tnointub,extremer,[desc([inadequate,control,of,ventilation])])
    ]).

pmframe(cea,[   ],[
    risk(tnointub,extremer,[desc([inadequate,control,of,ventilation])])
    ]).

pmframe(aortic_aneurysmectomy,[   ],[
    risk(tconduct,modr,[desc([insufficient,control,of,
        cardiorespiratory,stability,in,such,a,major,case])])
    ]).

pmframe(abdop,[   ],[
    risk(tnointub,modr,[desc([inadequate,control,of,ventilation]),
        prob(abdop),probdesc([in,a,patient,undergoing,abdominal,surgery])]),
    risk(tnomrelaxant:[not(myasthenia)],modr,
        [desc([inadequate,surgical,relaxation])])
    ]).

pmframe(cholecystectomy,[   ],[
    risk(tmorph,modr,[desc([biliary,spasm])]),
    risk(tmorphpm,modr,[desc([biliary,spasm])]),
    risk(tconduct,lowr,[desc([impaired,respiration,due,to,
        upper,abdominal,retraction])])
    ]).

pmframe(craniotomy,[   ],[
    risk(tnointub,highr,[desc([inadequate,control,of,ventilation]),
        prob(craniotomy),
        probdesc([in,a,patient,undergoing,a,neurosurgical,procedure]) ]),
    risk(tnomrelaxant,modr,[desc([inadequate,suppression,of,movement])])
    ]).


pmframe(increased_icp,[
    principle([avoid(hypercarbia),danger(increased_icp)])
       ],[
    risk(tnointub,modr,[desc([inadequate,ability,to,hyperventilate,
        the,patient])]),
    risk(tinhal,lowr,[desc([increased,cerebral,blood,flow,which,
        could,*comma,however,*comma,be,counteracted,by,hyperventilation])]),
    risk(tconduct,modr,[desc([herniation,from,dural,puncture]),
        prob(increased_icp),
        probdesc([in,a,patient,with,increased,*allcaps,icp]),
        whensevere]),
    risk(tpmnarc,modr,[desc([increased,*allcaps,icp]),
        mech(hypercarbia), mechdesc([due,to,hypercarbia])]),
    risk(ttpl,modb,[desc([decreasing,cerebral,blood,flow])]),
    risk(tketamine,highr,[desc([a,severe,increase,in,*allcaps,icp])]),
    risk(tinhalin,modr,[desc([increased,*allcaps,icp]),
        mech(icbf),mechdesc([due,to,increased,cerebral,blood,flow])]),
    risk(tawake,highr,[desc([increased,*allcaps,icp])]),
    risk(tsux,modr,[desc([slight,transient,increased,*allcaps,icp])]),
    risk(teth,modr,[desc([increased,seizure,activity])]),
    risk(tbalanced,modb,[desc([reducing,cerebral,blood,flow])])
    ]).

pmframe(aw_bleed,[
    principle([avoid(aspiration),danger(aspiration)])
       ],[
    risk(tsed,modr,[desc([depressing,airway,reflexes,allowing,possible,
        aspiration]),type(awprob)]),
    risk(tawake,modb,[desc([maintaining,protective,reflexes,
        until,after,intubation])]),
    risk(trapidseq,highr,[desc([aspiration]), prob(esoph_bleed),
        probdesc([in,the,presence,of,active,upper,airway,bleeding]),
        type(aspiration)]),
    risk(tmaskcricoid,highr,[desc([aspiration]), prob(esoph_bleed),
        probdesc([in,the,presence,of,active,upper,airway,bleeding]),
        type(aspiration)])
    ]).

pmframe(tachycardia,[
    principle([avoid(tachycardia),danger(tachycardia)])
       ],[
    risk(tanti,lowr,[desc([exacerbating,the,patient,*apost_s,tachycardia])]),
    risk(tgall,lowr,[desc([increasing,the,patient,*apost_s,tachycardia])])
    ]).

pmframe(difficult_aw,[
    principle([prefer(slow_induction),danger(aw_loss)])
       ],[
    risk(tsed,modr,[desc([compromising,the,patient,*apost_s,airway]),
        type(awprob)]),
    risk(trapidseq,highr,[prob(difficult_aw),
        probdesc([due,to,the,difficult,airway]),
        desc([possible,life-threatening,problems,with,intubation,
        and,ventilation]), type(awprob)]),
    risk(tmaskcricoid,highr,[prob(difficult_aw),
        probdesc([due,to,the,difficult,airway]),
        desc([possible,life-threatening,problems,with,
        intubation,and,ventilation]), type(awprob)]),
    risk(tnormint,highr,[prob(difficult_aw),
        probdesc([due,to,the,difficult,airway]),
        desc([possible,life-threatening,problems,with,
        intubation,and,ventilation]), type(awprob)]),
    risk(tawake,modb,[desc([preserving,airway,reflexes,
        and,respiration,until,the,airway,is,secured])]),
    risk(ttpl,highr,[desc([apnea,and,airway,obstruction]), prob(difficult_aw),
        probdesc([in,the,presence,of,a,difficult,airway]),
        nointub,type(awprob)]),
    risk(tinhalin,modb,[desc([maintaining,spontaneous,ventilation,
        during,induction]), nointub]),
    risk(tketamine,modr,[desc([possible,airway,difficulties]),
        nointub,type(awprob)])
    ]).

pmframe(facial_trauma,[
    principle([danger(aw_loss)])
       ],[
    risk(tsed,modr,[desc([depressing,airway,reflexes]),type(awprob)]),
    risk(tnointub,highr,[desc([aspiration,of,blood,and,airway,obstruction]),
        type(awprob)]),
    risk(tnormint,highr,[desc([aspiration,of,blood,and,airway,obstruction]),
        type(awprob)]),
    risk(tawake,highb,[desc([preserving,airway,reflexes,and,
        respiration,until,the,airway,is,secured]), type(awprob)]),
    risk(tnasal,highr,[desc([further,trauma]),
        cond([if,there,is,damage,to,the,nasal,cavity,or,the,base,of,
        the,skull])])
    ]).

pmframe(unstable_neck,[
    principle([danger(neck_damage)])
       ],[
    risk(tpmnarc,lowr,[desc([vomiting,exacerbating,the,neck,problem])]),
    risk(tnointub,highr,[desc([poor,airway,control])]),
    risk(tawake,modb,[desc([preserving,options,if,difficulties,are,
        encountered])]),
    risk(tnormint,modr,[desc([exacerbation,of,the,neck,problems]),
        cond([if,intubation,is,difficult])]),
    risk(trapidseq,modr,[desc([exacerbation,of,the,neck,problems]),
        cond([if,intubation,is,difficult])]),
    risk(tmaskcricoid,modr,[desc([exacerbation,of,the,neck,problems])])
    ]).


pmframe(intoxication,[   ],[
    risk(tawake,modr,[desc([problems,due,to,poor,patient,cooperation])])
    ]).


pmframe(cerebral_aneur,[
    principle([prefer(hypotensive_techniques),danger(ruptured_aneurysm)])
       ],[
    risk(tketamine,highr,[desc([aneurysmal,rupture,due,to,hypertension])]),
    risk(tinhalin,highb,[desc([preventing,aneurysmal,rupture,
        by,keeping,anesthesia,deep,and,blood,pressure,controlled])]),
    risk(trapidseq,highr,[desc([aneurysmal,rupture,due,to,
        light,anesthesia,during,intubation])]),
    risk(tawake,highr,[desc([aneurysmal,rupture,due,to,coughing,
        *comma,straining,*comma,and,hypertension])]),
    risk(tinhal,modb,[desc([preventing,aneurysmal,rupture,by,
        controlling,blood,pressure])]),
    risk(tbalanced,modr,whensevere,[desc([aneurysmal,rupture]),
        mech(hypertension),mechdesc([induced,by,hypertension])])
    ]).

pmframe(carotid_dis,[
    principle([avoid(hypotensive_techniques),danger(cerebral_hypoperfusion)])
       ],[
    risk(tatr,modb,[desc([protecting,against,carotid,sinus,stimulation])]),
    risk(trob,modb,[desc([protecting,against,carotid,sinus,stimulation])]),
    risk(tdrop,modr,[desc([intraoperative,hypotension,due,to,
        alpha,blockade]), possrisk,type(hypotension)]),
    risk(tketamine,highr,[desc([increased,cerebral,metabolic,
        rate,and,excitation])]),
    risk(teth,modr,[desc([obscuring,eeg,changes]),
        cond([if,eeg,monitoring,is,used])]),
    risk(tinhal,lowr,[desc([hypotension,and,poor,cerebral,perfusion]),
        type(hypotension)]),
    risk(tinhalin,modr,[desc([hypotension,and,poor,cerebral,perfusion]),
        type(hypotension)]),
    risk(tdtc,modr,[desc([poor,cerebral,perfusion,from,hypotension]),
        mech(histamine), mechdesc([due,to,histamine,release]),
        type(hypotension)]),
    risk(tmorph,modr,[desc([hypotension,and,poor,cerebral,perfusion]),
        mech(histamine), mechdesc([due,to,histamine,release]),
        type(hypotension)]),
    risk(tpento,modr,[desc([eeg,slowing]),
        cond([if,eeg,monitoring,is,used])])
    ]).

pmframe(coagulopathy,[
    principle([danger(aw_bleeding)])
       ],[
    risk(tintub,modr,[desc([airway,bleeding,from,intubation])]),
    risk(tnasal,highr,[desc([uncontrolled,epistaxis])])
    ]).

pmframe(hx_pat,[
    principle([danger(pat)])
       ],[
    risk(tatr,lowr,[desc([inducing,pat])]),
    risk(tpav,lowr,[desc([inducing,pat])]),
    risk(tgall,modr,[desc([inducing,pat])]),
    risk(tbalanced,lowr,[desc([inducing,pat])])
    ]).

pmframe(wpw,[
    principle([danger(pat)])
       ],[
    risk(tatr,lowr,[desc([inducing,pat])]),
    risk(ttpl,lowr,[desc([inducing,aberrant,conduction,and,pat]),
        possrisk]),
    risk(tpav,lowr,[desc([inducing,pat])]),
    risk(tgall,lowr,[desc([inducing,pat])]),
    risk(tbalanced,modb,[desc([having,minimal,circulatory,disturbance])])
    ]).

pmframe(myasthenia,[
    principle([avoid(relaxants),danger(muscle_compromise)])
       ],[
    risk(trelaxant,highr,[desc([prolonged,postoperative,paralysis])]),
    risk(trapidseq,modr,[desc([prolonged,paralysis,from,whichever,
        muscle,relaxant,is,used])])
    ]).

pmframe(hyperkalemia,[
    principle([danger(ex_hyperkalemia)])
       ],[
    risk(tsux,highr,[desc([life-threatening,exacerbation,of,
        the,patient,*apost_s,hyperkalemia])])
    ]).

pmframe(morbid_obesity,[   ],[
    risk(tconduct,highr,[desc([respiratory,impairment])]),
    risk(tinhal,modb,[desc([allowing,high,inspired,oxygen])]),
    risk(trapidseq,highr,[desc([lifethreatening,difficulty,with,
        ventilation,and,intubation]), cond([if,the,patient,
        has,a,difficult,airway])]),
    risk(tawake,modb,[desc([securing,the,airway,safely]),
        prob(morbid_obesity),probdesc([in,a,morbidly,obese,patient])])
    ]).

pmframe(copd,[
    principle([danger(hypoxemia)])
       ],[
    risk(tinhal,modb,[desc([allowing,a,high,inspired,oxygen,concentration])])
    ]).

pmframe(bowel_obstr,[
    principle([danger(bowel_gas)])
       ],[
    risk(tn2o,lowr,[desc([expansion,of,bowel,air,cavities])])
    ]).

pmframe(maoi,[
    principle([danger(hypertensive_crises)])
       ],[
    risk(tpmnarc,modr,[desc([triggering,hypertensive,crisis])]),
    risk(tbalanced,modr,[desc([hypertensive,crisis,triggered,by,the,
        use,of,narcotics]), possrisk]),
    risk(tconduct,modr,[desc([hypotension,whose,treatment,would,be,
        problematic]), whensevere]),
    risk(tga,modr,[desc([hypertensive,crisis]), possrisk])
    ]).

pmframe(pregnancy,[
    principle([danger(fetal_damage)])
       ],[
    risk(tvalium,modr,[desc([teterogenicity])])
    ]).
