% % $Id: hekate_case_cardio-clb.pl,v 1.3 2009-11-09 17:18:49 esimon Exp $ % % File generated by HeKatE Qt Editor ver. M6_9 % % HeaRT case % % % Copyright (C) 2006-9 by the HeKatE Project % % HeaRT has been develped by the HeKatE Project, % see http://hekate.ia.agh.edu.pl % % This file is part of HeaRT. % % HeaRT is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % HeaRT is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with HeaRT. If not, see . % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %:- ensure_loaded('heart.pl'). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TYPES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%% xtype [name: boolean, base: numeric, length: 1, scale: 0, desc: boolean, domain: [0,1] ]. xtype [name: integer, base: numeric, length: 10, scale: 0, desc: integer, domain: [-2147483648 to 2147483647] ]. xtype [name: basic_symptoms, base: symbolic, desc: 'Genaerale symptoms determining if there is tachycardia or bradycardia risk', domain: [brady_risk,tachy_risk] ]. xtype [name: basic_actions, base: symbolic, desc: 'Action to be taken when risk determined', domain: [brady_examination,tachy_examination] ]. xtype [name: brady_symptoms, base: symbolic, desc: 'More specific bradycardia symptoms', domain: [low_heart_rate,low_blood_pressure,heart_fibrillation,heart_failure] ]. xtype [name: brady_treatment_responses, base: symbolic, desc: 'Responses to applied treatment', domain: [patient_stable,good_resp_to_atropine,bad_resp_to_atropine] ]. xtype [name: brady_actions, base: symbolic, desc: 'Actions to be taken when symptoms diagnosed', domain: [observation,atropine] ]. xtype [name: patent_stability, base: symbolic, desc: 'First symtom to be determined when tachycardia risk', domain: [stable,unstable] ]. xtype [name: qrs_widths, base: numeric, length: 4, scale: 0, desc: 'Information about QRS comlpex width in miliseconds', domain: [0 to 1000] ]. xtype [name: qrs_rates, base: symbolic, desc: 'QRS complex rates', domain: [regular,irregular] ]. xtype [name: tachy_first_actions, base: symbolic, desc: 'First actions that may be taken after tachycardia risk diagnosed', domain: [cardioversion,treatment] ]. xtype [name: qrs_actions, base: symbolic, desc: 'Actions that supposed to be taken after QRS complx was examined', domain: [restore_sin_rythm,consult_specialist,amiodaron,beta_blockers,none] ]. xtype [name: treatment_conclusions, base: symbolic, desc: 'Actions to be taken when treatment of tachycardia finished', domain: [consultation,observation] ]. xtype [name: brady_sec_actions, base: symbolic, domain: [treatment,consultation] ]. %%%%%%%%%%%%%%%%%%%%%%%%% ATTRIBUTES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%% xattr [name: asystole_risk, abbrev: asys1, class: simple, type: boolean, comm: in, callback: [ask_combo_GUI,[asystole_risk]] ]. xattr [name: basic_action, abbrev: act_b, class: simple, type: basic_actions, comm: inter ]. xattr [name: basic_symptoms, abbrev: sym_b, class: simple, type: basic_symptoms, comm: in, callback: [ask_combo_GUI,[basic_symptoms]] ]. xattr [name: brady_first_action, abbrev: brad1, class: simple, type: brady_actions, comm: inter ]. xattr [name: brady_second_action, abbrev: brad3, class: simple, type: brady_sec_actions, comm: inter ]. xattr [name: brady_treatment_finish, abbrev: brad2, class: simple, type: treatment_conclusions, comm: out ]. xattr [name: brady_treatment_response, abbrev: brad, class: simple, type: brady_treatment_responses, comm: in, callback: [ask_combo_GUI,[brady_treatment_response]] ]. xattr [name: qrs_action, abbrev: qrs_a, class: simple, type: qrs_actions, comm: inter ]. xattr [name: qrs_rate, abbrev: qrs_r, class: simple, type: qrs_rates, comm: in, callback: [ask_combo_GUI,[qrs_rate]] ]. xattr [name: qrs_width, abbrev: qrs_w, class: simple, type: qrs_widths, comm: in, callback: [ask_numeric_GUI,[qrs_width]] ]. xattr [name: sinus_rate, abbrev: sinus, class: simple, type: boolean, comm: in, callback: [ask_combo_GUI,[sinus_rate]] ]. xattr [name: tachy_first_action, abbrev: t_fir, class: simple, type: tachy_first_actions, comm: inter ]. xattr [name: tachy_symptoms, abbrev: t_sym, class: simple, type: patent_stability, comm: in, callback: [ask_combo_GUI,[tachy_symptoms]] ]. xattr [name: tachy_treatment_finished, abbrev: tachy, class: simple, type: treatment_conclusions, comm: out ]. xattr [name: '{brady_symptoms}', abbrev: '{b_sy}', class: general, type: brady_symptoms, comm: in, callback: [ask_general_GUI,['{brady_symptoms}']] ]. %%%%%%%%%%%%%%%%%%%%%%%% TABLE SCHEMAS DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%% xschm 'TachyTreatment2': [sinus_rate,qrs_action] ==> [tachy_treatment_finished]. xschm 'TachyTreatment1': [qrs_width,qrs_rate,tachy_first_action] ==> [qrs_action]. xschm 'BradyTreatment1': [brady_treatment_response,brady_first_action] ==> [brady_second_action]. xschm 'TachyAdvDiagnosis': [tachy_symptoms,basic_action] ==> [tachy_first_action]. xschm 'BradyAdvDiagnosis': ['{brady_symptoms}',basic_action] ==> [brady_first_action]. xschm 'BasicDiagnosis': [basic_symptoms] ==> [basic_action]. xschm 'BradyTreatment2': [brady_second_action,asystole_risk] ==> [brady_treatment_finish]. %%%%%%%%%%%%%%%%%%%%%%%%%%%% RULES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%% xrule 'TachyTreatment2'/1: [sinus_rate eq 1, qrs_action eq restore_sin_rythm] ==> [tachy_treatment_finished set observation]. xrule 'TachyTreatment2'/2: [sinus_rate eq 0, qrs_action eq restore_sin_rythm] ==> [tachy_treatment_finished set consultation]. xrule 'TachyTreatment2'/3: [sinus_rate in [any], qrs_action in [none,amiodaron,beta_blockers]] ==> [tachy_treatment_finished set observation]. xrule 'TachyTreatment2'/4: [sinus_rate in [any], qrs_action eq consult_specialist] ==> [tachy_treatment_finished set consultation]. xrule 'TachyTreatment1'/1: [qrs_width lt 120, qrs_rate eq regular, tachy_first_action eq treatment] ==> [qrs_action set amiodaron]. xrule 'TachyTreatment1'/2: [qrs_width gte 120, qrs_rate eq irregular, tachy_first_action eq treatment] ==> [qrs_action set beta_blockers]. xrule 'TachyTreatment1'/3: [qrs_width lt 120, qrs_rate eq irregular, tachy_first_action eq treatment] ==> [qrs_action set consult_specialist]. xrule 'TachyTreatment1'/4: [qrs_width gte 120, qrs_rate eq regular, tachy_first_action eq treatment] ==> [qrs_action set restore_sin_rythm] :'TachyTreatment2'. xrule 'TachyTreatment1'/5: [qrs_width in [any], qrs_rate in [any], tachy_first_action eq cardioversion] ==> [qrs_action set none]. xrule 'BradyTreatment1'/1: [brady_treatment_response eq good_resp_to_atropine, brady_first_action eq atropine] ==> [brady_second_action set treatment] :'BradyTreatment2'. xrule 'BradyTreatment1'/2: [brady_treatment_response eq patient_stable, brady_first_action eq observation] ==> [brady_second_action set treatment] :'BradyTreatment2'. xrule 'BradyTreatment1'/3: [brady_treatment_response eq bad_resp_to_atropine, brady_first_action eq atropine] ==> [brady_second_action set consultation]. xrule 'TachyAdvDiagnosis'/1: [tachy_symptoms eq stable, basic_action eq tachy_examination] ==> [tachy_first_action set treatment] :'TachyTreatment1'. xrule 'TachyAdvDiagnosis'/2: [tachy_symptoms eq unstable, basic_action eq tachy_examination] ==> [tachy_first_action set cardioversion]. xrule 'BradyAdvDiagnosis'/1: ['{brady_symptoms}' notsim [low_heart_rate,low_blood_pressure,heart_fibrillation,heart_failure], basic_action eq brady_examination] ==> [brady_first_action set observation] :'BradyTreatment1'. xrule 'BradyAdvDiagnosis'/2: ['{brady_symptoms}' sim [low_heart_rate,low_blood_pressure,heart_fibrillation,heart_failure], basic_action eq brady_examination] ==> [brady_first_action set atropine] :'BradyTreatment1'. xrule 'BasicDiagnosis'/1: [basic_symptoms eq brady_risk] ==> [basic_action set brady_examination] :'BradyAdvDiagnosis'. xrule 'BasicDiagnosis'/2: [basic_symptoms eq tachy_risk] ==> [basic_action set tachy_examination] :'TachyAdvDiagnosis'. xrule 'BradyTreatment2'/1: [brady_second_action eq treatment, asystole_risk eq 1] ==> [brady_treatment_finish set consultation]. xrule 'BradyTreatment2'/2: [brady_second_action eq treatment, asystole_risk eq 0] ==> [brady_treatment_finish set observation]. xrule 'BradyTreatment2'/3: [brady_second_action eq consultation, asystole_risk in [any]] ==> [brady_treatment_finish set consultation]. %%%%%%%%%%%%%%%%%%%%%%%%% STATES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%% xstat 'Tachycardia': [basic_symptoms,brady_risk]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % File generated by HeKatE Qt Editor ver. M6_9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%% Callbacks %%%%%%%%%%%%%%%%%%%%%%%%%%%%% xcall ask_general_GUI: [AttName] >>> (jpl_new('skeleton.RequestInterface',[],T), alsv_domain(AttName,Domain,symbolic), Params = [AttName|Domain], term_to_atom(Params, AtomParams), jpl_call(T,request,['callbacks.input.TwoListsFetcher',AtomParams],Answer), atom_to_term(Answer,Answer2,_), alsv_new_val(AttName,Answer2)). xcall ask_combo_GUI : [AttName] >>> (jpl_new('skeleton.RequestInterface',[],T), alsv_domain(AttName,Domain,_), Params = [AttName|Domain], term_to_atom(Params, AtomParams), jpl_call(T,request,['callbacks.input.ComboBoxFetcher',AtomParams],Answer), atom_to_term(Answer,Answer2,_), alsv_new_val(AttName,Answer2)). xcall ask_numeric_GUI : [AttName] >>> (jpl_new('skeleton.RequestInterface',[],T), alsv_domain(AttName,[Min to Max],numeric), concat_atom(['[',AttName,',',Min,',',Max,']'],Parameters), jpl_call(T,request,['callbacks.input.SliderFetcher',Parameters],Answer), atom_to_term(Answer,Answer2,_), alsv_new_val(AttName,Answer2)).