You are on page 1of 7

Terap-IA, a Knowledge-Based System for Pneumonia Treatment

Pilar Barrufet Josep Puyol-Gruart, Carles Sierra


Consorci Sanitari de Mataro Hospitals Arti cial Intelligence Research Institute (IIIA)
Lepant, 13. 08301 Mataro, Spain Spanish Scienti c Research Council (CSIC)
e-mail: pbarrufet@csm.scs.es Campus UAB. 08193 Bellaterra, Spain
e-mail: fpuyol,sierrag@iiia.csic.es

Abstract evolution of the severity of the illness or in some cases


the death.
Terap{IA is a knowledge-based system for the treat- In our approach we make two main assumptions:
ment of community-acquired pneumonia in adults.
In this paper we concentrate on its description and 1) Existence of a previous diagnosis: Normally a
implementation. The implementation has been made pneumonia is caused by only one microorganism, but
using Milord II, a modular language for knowledge- symptoms and signs are not speci c enough to deter-
based systems. We will stress the uncertainty mod- mine which one. Diagnosis usually gives evidence for
elling of the domain, with special emphasis on the two or three microorganisms possibly causing pneu-
Milord II capabilities for that purpose. monia. We will assume in this work that such diag-
nosis already exists. It can be obtained from another
knowledge-based system such as Pneumon{IA [6].
1 Description of the problem 2) Independence of treatments: We can indepen-
dently nd the best treatment for every microorgan-
ism appearing in a diagnosis. Moreover, these treat-
A community-acquired pneumonia is a frequent in- ments can be combined to give a treatment covering
fection, especially for people with chronic diseases all the possible causes. By \covering" we mean that a
and for old people. It is one of the most common treatment is speci c for a particular microorganism,
causes of mortality related to infectious diseases (the in other words, it \attacks" the microorganism.
rst in EEUU).
Besides the uncertainty of the diagnosis, data about
There are a lot of microorganisms causing pneumo- the patient is in many cases also uncertain and in-
nia. The diagnosis depends on the identi cation of complete.
the microorganism causing pneumonia. Nowadays,
with the available diagnostic methodology, it is still In the subsequent sections we will describe in de-
very dicult to determine which of the microorgan- tail how a solution to this problem has been imple-
isms is the infecting agent in a particular pneumo- mented. We begin with a conceptual structure of the
nia case. The research focused to determine which problem. After that we deal with the main ideas used
are the microorganisms causing pneumonia only suc- in the real implementation of Terap{IA, a knowledge-
ceeds in the 50% of the cases [1, 5]. Errors in diagno- based system for the automatic generation of treat-
sis can be fatal, for instance, to diagnose pneumococ- ments. Finally the conclusions and results obtained
cal pneumonia in a patient with legionella pneumonia up to date are presented.
may produce the death of the patient by the delay
of an adequate treatment.
Despite the uncertainty of the diagnosis, a treatment 2 Structure of the problem
has to be speedily administrated to avoid a negative
 This research has been supported by the Spanish In Figure 1 we can see the general conceptual struc-
Comision Interministerial de Ciencia y Tecnologa (CICYT) ture of Terap{IA. Brie y, a treatment for pneumonia
through the project SMASH (TIC96{1038{C04{01). is a set of upmost three antibiotics. The antibiotics
of the treatment must be possible to administrate to The system represents knowledge about all these as-
the patient and, cover all the diagnosed microorgan- pects of antibiotics.
isms |because one of them is possibly the cause of
pneumonia. The conceptual structure has four parts: Patient data From the pharmacological knowledge
rst, independently of the diagnosis the system de- explained above and the particular data of a patient,
termines all the antibiotics that is possible to admin- the system is able to deduce the best treatment for
istrate to the patient; second, from these antibiotics, that patient. The most important patient data is the
the system nds which are the most useful for each diagnosis2 consisting of a list of the microorganisms
of the microorganisms of the diagnosis; third, these possibly causing the pneumonia (normally upmost
treatments are combined producing a treatment cov- three microorganisms).
ering all the microorganisms of the diagnosis for that Other relevant data of the patient is relative to clin-
concrete patient; nally, the antibiotic combinations ical history, physical examination, laboratory test
are re ned with other criteria. and chest radiograph data, renal function, severity
The following sections describe how have we mapped of illness, allergic reactions, genetics alterations and
this structure into an operational knowledge-based so on.
system developed on top of Milord II. For instance, we have to take into account the in-
take of other drugs by the patient to avoid undesired
interactions among them. Another example is that
2.1 Ontology the administration of antibiotics before the onset of
pneumonia can produce that the microorganism pro-
The concepts managed in Terap{IA are those related ducing pneumonia develops resistance to some an-
to the pharmacological knowledge about pneumonia tibiotics.
treatments and those representing the clinical condi-
tion of the patient. The goal of the system is to nd
the best combination of antibiotics to treat a patient 2.2 Tasks
with pneumonia. During the treatment generation
process we \weigh" concepts, for instance, the an-
tibiotic adequacy, to give a ranking of nal results We have modelled the solution to the problem as a
hence, the clinician can decide to choose an option series of tasks that are performed in sequence (see
in the ranking taking into account his preferences. the boxes with text in bold in Figure 1).
Pharmacological knowledge Antibiotics are phar- A) The starting point of the system is to consider all
macological products for infections' treatment. An- the antibiotic groups. These groups are sieved con-
tibiotics belong to di erent pharmacological groups, sidering relevant data of the patient, that is, the task
sharing di erent properties. For instance, all antibi- consists in nding the degree of adequacy of every
otics of the same group have a similar spectrum of group of antibiotics to that patient. It is performed
activity, that is, the set of microorganisms covered taking into account data about pregnancy, allergic
by the antibiotics is similar. On the other hand, an- reactions to antibiotics, renal diseases or genetic al-
tibiotics belonging to the same group have di erent terations. The result of this task is the adequacy of
particular characteristics such as cost, administra- every group to a concrete patient. It is independent
tion route, interaction with other drugs, and so on. of the disease we want to treat.
For instance, amoxicillin and procaine-penicillin G B) Then, taking into account the diagnosis of the
belong to the group penicillins and they cover gram- patient, we dynamically generate (by selection) a set
positive bacteries, but amoxicillin is orally adminis- of treatment tasks, one for each microorganism that
trated and procaine-penicillin G is intramuscularly possibly caused the pneumonia.
administrated.
We consider an antibiotic treatment for a microor-
C) Taking into account the adequacy of every group
of antibiotics (task A) for the patient, every treat-
ganism as a set of antibiotics, normally one and, oc- ment task obtains the best set of antibiotics, for the
casionally two. An antibiotic combination is the re- treatment of the microorganism it is specialised on,
sult of covering more than one microorganism. It is
a set of one1 , two, or exceptionally three antibiotics. 2 In [6] the interested reader can nd an expert system for
the diagnosis of pneumonia written in a previous version of
1 Some antibiotics cover more than one microorganism. Milord II.
- Treatment1 - Antibiotics1
A B - Treatment2 - Antibiotics2
Antibiotic - Sieve - Antibiotic - Selection
Groups Groups
6 ... C ...
 Previous Diagnosis: - Treatmentn - Antibioticsn
Patient data: -microorganism1
- Pregnancy
- Allergy
- Renal failure
-microorganism2
...
-microorganismn
6 6
- Genetic alterations Pharmacological
knowledge: Pharmacological
- Speci city knowledge:
- Cost Patient data: - Adverse reactions
- Other conditions - Severity - Interactions
E D
? ???
Antibiotics Combinations  Sieve  Antibiotics Combinations  Combining

Figure 1: Architecture of Terap{IA application.

that belongs to those sieved groups. A treatment presented in Section 2.


task uses data about the patient, the more important
is the patient's severity of illness, and pharmacologi- Milord II is a modular language for knowledge-
cal knowledge about the interactions between drugs, based systems. In [2, 3, 4] the interested reader can
and their contrary e ects (previously known adverse nd a complete description of the language and its
reactions to some antibiotics in a concrete patient). logical semantics. We introduce it progressively by
means of examples from Terap{IA.
D) The sets of antibiotics adequate for each mi-
croorganism are then combined. Combinations are
produced by means of several criteria. For in- 3.1 Uncertainty
stance: do not combine antibiotics of the same group,
nor those of the same spectrum (equivalent anti- The approximate reasoning capability of Milord II
microorganisms activity) nor with di erent admin- is based on a family of nitely-valued logics which
istration route; we prefer monotherapy (one antibi- are local to each module and de ned as an algebra
otic) to combinations. of truth-values. This allows the system to use a de-
E) Finally, a new sieve is applied, now over the or- gree of truthness for the concepts involved in the
dered set of antibiotics combinations taking into ac- system, then giving graduated results in function of
count the speci city and cost, giving as nal result the inherent uncertainty of the data and knowledge
an ordered set of combinations that are the most ad- involved in the treatment of pneumonia.
equate for the treatment of the patient. The user-de ned logic of a module is composed by
The nal result of this process is an adequacy- the declarations of: 1) an ordered set of linguistics
ordered set of treatments (combinations of antibi- terms representing truthness degrees between true
otics) for a particular pneumonia case of a concrete and false and, 2) a conjunction operator.
patient. In Terap{IA we have used the same set of eight lin-
guistic terms and the same connective modelling in
all modules. The terms are the following: impossible,
3 Terap{IA very few possible, few possible, slightly possible, pos-
sible, quite possible, very possible and de nite, where
impossible stands for the boolean false and de nite
Terap{IA has been implemented using the Mi- for the boolean true.
lord II language. In this section we present a brief
schema of Terap{IA's architecture and which are the Table 1 represents the conjunction operator used in
decisions in the representation that ful ls the schema Terap{IA, where the linguistic terms are abbrevi-
ated. Terap{IA most concepts related to antecedents of the
patient are boolean propositions, for instance, the
i vf fp sp p qp vp d knowledge of whether the patient has or not previous
i i i i i i i i i adverse reactions to some antibiotics, or whether he
vf i vf vf vf vf vf vf vf is a ected or not by a chronic disease.
fp i vf vf fp fp fp fp fp
sp i vf fp sp sp sp sp sp Numerical variables: The value of a numerical
p i vf fp sp sp sp p p variable is a real number. For instance, the pres-
qp i vf fp sp sp p qp qp ence in the blood of a patient of creatinine (blood
vp i vf fp sp p qp vp vp substance which can reach toxic levels with a kid-
d i vf fp sp p qp vp d ney malfunction) or the number of leukocytes can be
numerical variables.
Table 1: Conjunction table for Terap{IA. Fuzzy propositions: In some cases we need to deal
with vague concepts. For instance, taking the exam-
The many-valued logic of a module is completely ple above, we may be interested in the truthness of
determined as soon as the set of linguistic terms the presence of creatinine useful to support a renal
and the conjunction operator are chosen. So, vary- failure of the patient, instead of the numerical value
ing these two features we may generate di erent of creatinine. Vagueness of concepts can be quanti-
multiple-valued logics. In Terap{IA we use the same ed by the degree of membership of a numerical value
logic for all modules. to a fuzzy set, so, the presence of creatinine can be
modelled by giving a fuzzy set (see Figure 2) that
takes as argument the numerical value of creatinine.
3.2 Propositions and variables presence of creatinine (creatinine)
6

Propositions and variables are the simplest knowl- 1


edge representation units in Milord II. They are ai+1 presence of creatinine (x)

90
x 200
named structures that represent the concepts dealt ai
within a module. Their declaration is made by bind- 0
0
-
300 creatinine(mmol=l)
ing an atomic name (identi er) with a set of at-
tributes. The attributes may be a long name, the Figure 2: Fuzzy set representing the concept creati-
type, relations with other propositions or variables, nine.
a question and so on. Propositions and variables
declarations can contain user-de ned relations with The value of a fuzzy proposition is obtained by the
other propositions and variables. We use this pos- application of the fuzzy membership function to the
sibility in this application, to model, for instance, value of a numerical variable obtained from the user
relations between antibiotics. of the system. This application returns a number in
The type is the only attribute that is mandatory the interval [0; 1]. The nal answer is the minimum
in propositions and variables declarations and de- interval of linguistic terms3 containing that number.
termines the set of allowed values a proposition or Linguistic variables: Their values belong to a
a variable can take, apart from the special value un- user-de ned nite set of linguistic values. Similarly
known, meaning ignorance of the value. to the case of fuzzy propositions we can declare a lin-
There are three types of propositions, boolean, many- guistic variable by giving, for every linguistic value,
valued and fuzzy; and three types of variables, nu- a fuzzy set with respect to a numerical variable.
merical, linguistic and set. Only many-valued propo- In Figure 3 we can see a representation of the concept
sitions or set variables can appear in the conclusions state of white blood cells (swbc for short) by means of
of rules, as well as in premises of rules. Boolean and three fuzzy sets (linguistic values), leukopenia, nor-
fuzzy propositions, and numerical and linguistic vari- mal and leukocytosis. Given a numerical value for
ables, are not deduced by the system, they are asked leukocytes the system can calculate the value for each
to the user and used only in the premises of rules. linguistic value |the value for swbc is leukopenia,
Boolean propositions: They represent concepts 3 For this purpose we consider the set of linguistic terms to
which can only be evaluated as either false or true. In be uniformly distributed in the interval [0; 1].
swbc is normal and swbc is leukocytosis| by apply- a penicillin can be administrated to a patient and
ing the corresponding fuzzy sets. his situation is severe then it is very few possi-
ble to administrate ampicillin, in Milord II syn-
6 swbc swbc swbc
leucopenia normal leucositosi tax: If penicillin and severe then conclude
1
C  B  ampicillin is vf.
CC BB A numerical expression is composed by numbers, nu-
0
0 0:2
C
3 5
B
10 12
- merical variables and arithmetic operations. For in-
leukocytes(103 cel=mm3 ) stance, If respiratory frequency is greater than 30
Figure 3: Linguistic variable representing the con- breaths/minute then we can conclude that tachypnea
cept leukocytes. is de nite.
We can build set expressions in a similar way as nu-
Many-valued propositions: The concepts repre- merical expressions. These expressions return de-
sented as many-valued propositions are those whose grees of inclusion, intersection and equality between
truth may be graded. That is the case of most de- two fuzzy sets. For instance, If the patient has al-
duced concepts, for instance, the degree of severity lergic reaction to penicillin then he is also allergic to
of illness of the patient or the degree of resistance of cephalosporins and cabapenems. In this case allergic
pneumococci to penicillin. to penicillin means that the set variable allergies has
Set variables: They are conjunctive fuzzy sets. An intersection with the crisp set fpenicilling.
example is the concept allergic reactions. It is a set For an example of linguistic variable we can use the
which domain is the set of possible allergic reactions previously de ned linguistic variable state of white
of the patient. If a patient has only an allergy to blood cells to say: If state of white blood cells
penicillin, the set variable allergic reactions is a set is leukopenia then there are analytical evidence of
with value true for penicillin and false for the other severity of pneumonia.
allergic reactions of the domain.
Conclusions of rules are simpler than conditions.
Given di erent set variables we could be interested Conclusions may appear on armative or on neg-
in applying fuzzy set relations and operations. For ative form. Only many-valued propositions and set
instance, we can compare di erent sets by comput- variables can be used as conclusions in rules. In fact
ing, its intersection degree or inclusion degree. For we have seen examples of conclusions if the exam-
example, we can say in which degree the set variable ples above. For instance the conclusion tachypnea
allergic reactions intersects with the crisp set with el- is de nite is about a many-valued proposition and,
ements penicillin and macrolides, that is, which is the the patient has allergic reaction to cephalosporins and
degree of the presence of penicillin and macrolides in cabapenems about a set variable.
the set allergies.

3.3 Rules 3.4 Modular structure

In Milord II, a rule is composed of an identi er, a The structural construct of Milord II is the mod-
premise (a conjunction of conditions), a conclusion, ule. A program consists of a set of modules that
and a truth-value. In the case of conditions contain- can recursively contain other modules, then forming
ing variables, the language is provided with a set of a hierarchy.
prede ned predicates that apply on them to produce
as result intervals of truth values. A module declaration can be clustered in the next
sets of components: hierarchy, interface, deductive
Premises of rules are conjunctions of elemental con- knowledge and control knowledge.
ditions either in armative or in negative form. Con-
ditions can contain propositions directly. - Hierarchy: Is a set of submodule declarations.
- Interface: It has two components, the import and
For instance, for the fuzzy proposition presence of the export interface. That is, which propositions
creatinine de ned above, we can say If presence and variables may be asked to the user (import) and
of creatinine then renal failure is de nite. An- those whose value is computed by the module (ex-
other example using many-valued propositions is If port).
- Deductive knowledge: It contains a dictionary dec- is penicillin-resistant to pneumococci microorganism,
laration, that is, the set of propositions and variables that is, whether penicillin is adequate to treat pneu-
(those belonging to the interface of the module and mococci or not.
other intermediate ones) and their attributes; a set
of rule declarations, that is, a set of propositional A data acquisition module usually deduces values for
weighted rules; and an inference system declaration, concepts di erent from those acquired from the pa-
that is, the local logic of the module. tient. For instance, one of them deduces penicillin-
- Control knowledge: It is expressed in a meta- resistant from the number of leukocytes (we consider
language which acts by re ection over the deductive that there is penicillin-resistant when the number of
knowledge and the hierarchy of submodules. leukocytes is less that 5000 cells per a mm3 .
The implementation of the conceptual scheme of Fig- Many concepts in the domain are vague. In some
ure 1 is made by programming several Milord II cases quantitative data is translated into a qualita-
modules (about one hundred). It is not possible tive one by means of fuzzy sets. For instance, it is
here to explain in detail every module of the system, easier for the expert to reason about the concept the
thought, we will give some idea of their commonali- state of white blood cells is normal than the number
ties by explaining groups of modules. of leukocytes is 7000 cel=mm3. This qualitative ab-
straction allows the expert to say, for example, that
Pharmacological model modules These modules there is penicillin-resistance of pneumococci when the
contain the knowledge about antibiotics for the Te- state of white blood cells is leukopenia. You can nd
rap{IA domain. We represent each antibiotic as a examples of qualitative abstractions in Section 3.2.
concept for which we declare to which pharmaco-
logical group it belongs; which is the administration Examples of this type of modules are: the related to
route of that antibiotic (oral or parenteral); the pos- the clinical history of the patient; his physical exami-
sible interactions with other drugs administrated to nation; his laboratory test and chest radiograph data;
the patient and which are the antibiotics with the the possible complications (for instance, associated
same activity. infectious diseases as meningitis or arthritis) and the
severity of illness.
For instance, erythromycin is an antibiotic that be-
longs to the group of macrolides, it interacts with Sieve modules group These modules, indepen-
another drug, teophylline, and it has the same sensi- dently of the microorganism we want to treat, modify
bility than the antibiotic doxycycline. The adminis- the current antibiotic treatment by eliminating the
tration source of this antibiotic can be both: oral or antibiotics belonging to concrete groups of antibi-
parenteral. otics of the list of possible treatments for a patient.
For instance, it is not possible to administrate an-
This information will be used by modules that rea- tibiotics of the group uoroquinolones to a pregnant
son about antibiotics. Following the example above patient, because it would a ect the fetus.
it is not adequate to administrate erythromycin to
a patient already taking teophylline, it is better to These modules use the pharmacological model mod-
administrate an antibiotic without interaction with ules and acquisition data modules to determine
teophylline, for instance, roxithromycin. which are the groups of antibiotics that is possible
to administrate to a given patient.
All the concepts above (antibiotics, pharmacologi-
cal groups of antibiotics, other drugs, administration The modules of this group are: pregnancy; allergies;
source) are declared into the pharmacological model renal failure; and genetic conditions. Each module
modules. Every propositions or variable declaration uses data about the patient (from the data acquisi-
contains relations with other propositions and vari- tion modules) and exports groups of antibiotics. The
ables, for instance, we declare that the antibiotic ery- truth-value of every group of antibiotics is weighted
thromycin belongs to the group of macrolides. taking into account the adequacy of that group of
antibiotics for the given patient. For instance, if the
Data acquisition modules These modules are the patient has allergic reaction to penicillin, the module
responsible of gathering the patient data that the of allergies gives to the penicillin group the truth-
expert has considered to be relevant for a correct value false.
treatment determination. For instance the number of
leukocytes in the blood of the patient is an important Operationally we start from a truth-value of de nite
laboratory test data. It is useful to determine if there for each group of antibiotics, and then every sieve
module sequentially \sieves" them, keeping the same to the concrete patient.
truth-value if there is no reason against the group, or
decrementing it if there is. When the truth-value is
false we consider that the group has been eliminated
from the list of potential groups. 4 Conclusions and Results
Microorganisms modules groups There are We have presented the Terap{IA knowledge-based
twenty-two groups of microorganism modules, one system. The application takes into account the nd-
group for each microorganism treated by Terap{IA. ings of the patient, knowledge about antibiotics and
Each group of microorganism modules uses the out- the diagnosis to nd the best treatment. We also
put obtained by the pharmacological model mod- have introduced Milord II as an appropriate tool
ules, data acquisition modules (specially those about and language to develop knowledge-based systems4 .
severity of the illness, adverse reactions and interac-
tions) and by the sieve modules group. They deduce The expert has developed a partial validation of
which antibiotics to use to treat a microorganism, the system contrasting real world cases of antibiotic
giving a truth-value for each antibiotic. The truth- treatment of pneumonia with the answers of Terap{
value of an antibiotic is obtained taking into account IA. The treatment for each previous diagnosis has
the truth-value of its group (obtained by the sieve been veri ed separately, producing hopeful results.
modules) and data about the patient.
The nal validation will be made by giving fty real
Given a diagnosis (one, two or three possible mi- world cases of pneumonia to four human experts and
croorganisms) the system only executes the microor- Terap{IA, and comparing the results.
ganisms' module groups corresponding to the mi-
croorganisms in the diagnosis.
Combination modules group These modules References
combine the results of the microorganisms modules.
The modules providing input to this task export [1] J. Almirall et al. Incidence of community-
truth-values for antibiotics. Truth-values represent adquired pneumonia and chamydia pneumoniae
the adequacy of antibiotics for treating the microor- infection: a prospective multicentre study. Eur
ganisms. The results of these modules are weitghed Respir, 6:14{18, 1993.
antibiotic combinations. [2] J. Puyol-Gruart, Llus Godo, and C. Sierra. Spe-
There are several criteria to combine the antibiotics, cialisation calculus and communication. Interna-
implemented in these modules. The combinations tional Journal of Approximate Reasoning, 1998.
are of one (monotherapy), two or upmost three an- To appear.
tibiotics. Some of the criteria are: [3] J. Puyol-Gruart and C. Sierra. Milord II: a lan-
- Combinations are never made with antibiotics be- guage description. Mathware and Soft Comput-
longing to the same group. ing, 4(3):299{338, 1997.
- Combinations are never made with antibiotics that [4] Josep Puyol-Gruart. MILORD II: A Lan-
have the same sensibility, that is, antibiotics that guage for Knowledge-Based Systems, volume 1 of
cover the same microorganisms. Monogra es del IIIA. IIIA{CSIC, 1996.
- Combinations are never made with antibiotics that
have di erent administration route (oral or par- [5] A. Torres, J. Serra-Batlles, A. Ferrer, and
enteral). P. Jimenez. Severe community-adquired pneumo-
- Given the same adequacy (truth-value) we prefer a nia. etiology prognosis and treatment. Am Rev
monotherapy than a combination with two or three Respir Dis, (144):312{318, 1991.
antibiotics. [6] A. Verdaguer. Pneumon{IA: Desenvolupa-
Sieve combinations modules group The com- ment i validacio d'un sistema expert d'ajuda
binations of antibiotics are \sieved" taking into ac- al diagnostic medic. PhD thesis, Universitat
count other criteria, as speci city or cost. Autonoma de Barcelona, 1989.
Finally, the system gives to the user the ordered set 4 This software is available for research and educational pur-
of antibiotic combinations possible to administrate poses. You can nd the last version and more information on
Milord II at http://www.iiia.csic.es/~milord.

You might also like