AI-ExpertSystem-Simple

 view release on metacpan or  search on metacpan

examples/Doctor.xml  view on Meta::CPAN

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE knowledgebase SYSTEM "sie-1.0.dtd">
<knowledgebase>
 <goal>
  <attribute>type.disease</attribute>
  <text>Based on rudimentary knowledge, I believe the child has type.disease</text>
 </goal>
 <rules>
  <rule>
   <name>1</name>
   <conditions>
    <condition>
     <attribute>active.temp.over.101</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>fever</attribute>
     <value>yes</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>2</name>
   <conditions>
    <condition>
     <attribute>delayed.cough</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>cold</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>whooping.cough</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>3</name>
   <conditions>
    <condition>
     <attribute>scratchy.throat</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>clear.nasal.discharge</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>cold</attribute>
     <value>yes</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>4</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>cold</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>measle.rash</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>measles</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>5</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>squeaky.breath</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>vibration.chest</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>much.cough</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>cold</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>bronchitis</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>6</name>
   <conditions>
    <condition>
     <attribute>wheezing</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>cold</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>asthmatic.bronchitis</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>7</name>
   <conditions>
    <condition>
     <attribute>sinus.pain</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>cough.when.move</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>sinusitis</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>8</name>
   <conditions>
    <condition>
     <attribute>eczema</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>eczema</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>9</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>sputum</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>cough</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>fatigue</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>tuberculosis</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>10</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>tender.joints</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>fatigue</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>rheumatic.fever</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>11</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>touch.to.chest</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>headache</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>anterior.poliomyelitis</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>12</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>sore.throat</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>scarlet.rash</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>vomiting</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>headache</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>scarlet.fever</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>13</name>
   <conditions>
    <condition>
     <attribute>tonsils.swollen</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>vomiting</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>headache</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>high.fever</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>tonsillitis</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>14</name>
   <conditions>
    <condition>
     <attribute>rapid.breathing</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>cough</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>high.fever</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>pneumonia</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>15</name>
   <conditions>
    <condition>
     <attribute>high.fever</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>roseola</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>16</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>difficulty.breathing</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>hoarse.cough</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>cold</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>severe.croup</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>17</name>
   <conditions>
    <condition>
     <attribute>difficulty.breathing</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>hoarse.cough</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>croup</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>18</name>
   <conditions>
    <condition>
     <attribute>impetigo.rash</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>impetigo</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>19</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>inflammed.ears</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>serious.ear.infection</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>20</name>
   <conditions>
    <condition>
     <attribute>inflammed.ears</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>ear.infection</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>21</name>
   <conditions>
    <condition>
     <attribute>hives.rash</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>itching</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>hives</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>22</name>
   <conditions>
    <condition>
     <attribute>ivy.rash</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>itching</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>poison.ivy</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>23</name>
   <conditions>
    <condition>
     <attribute>scabies.rash</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>itching</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>scabies</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>24</name>
   <conditions>
    <condition>
     <attribute>measle.rash</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>german.measles</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>25</name>
   <conditions>
    <condition>
     <attribute>naval.pain</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>tender.abdomen</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>appendicitis</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>26</name>
   <conditions>
    <condition>
     <attribute>neck.swelling</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>mumps</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>27</name>
   <conditions>
    <condition>
     <attribute>nervous.disease</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>chorea</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>28</name>
   <conditions>
    <condition>
     <attribute>pox.rash</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>chicken.pox</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>29</name>
   <conditions>
    <condition>
     <attribute>prickly.rash</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>prickly.heat</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>30</name>
   <conditions>
    <condition>
     <attribute>rest.temp.over.100</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>fever</attribute>
     <value>yes</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>31</name>
   <conditions>
    <condition>
     <attribute>ringworm.rash</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>ringworm</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>32</name>
   <conditions>
    <condition>
     <attribute>sneeze</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>itchy.nose</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>allergy</value>
    </action>
   </actions>
  </rule>
  <rule>
   <name>33</name>
   <conditions>
    <condition>
     <attribute>fever</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>sore.throat</attribute>
     <value>yes</value>
    </condition>
    <condition>
     <attribute>dirty.white.patches</attribute>
     <value>yes</value>
    </condition>
   </conditions>
   <actions>
    <action>
     <attribute>type.disease</attribute>
     <value>diptheria</value>
    </action>
   </actions>
  </rule>
 </rules>
 <questions>
  <question>
   <attribute>squeaky.breath</attribute>
   <text>Does the child squeake as he breaths?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>itching</attribute>
   <text>Does the child complain of itchy or scratchy skin?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>high.fever</attribute>
   <text>Is the child's temperature over 103?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>fatigue</attribute>
   <text>Does the child complain of general fatigue?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>clear.nasal.discharge</attribute>
   <text>Does the child have a clear nasal discharge?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>tender.joints</attribute>
   <text>Does the child complain of tender joints?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>sputum</attribute>
   <text>Is the child producing sputum?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>sneeze</attribute>
   <text>Is the child sneezing?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>neck.swelling</attribute>
   <text>Does the child have extensive swelling in the side of his neck?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>ivy.rash</attribute>
   <text>Are there clusters of small blisters on reddened shiny skin?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>itchy.nose</attribute>
   <text>Does the child complain of an itchy nose?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>delayed.cough</attribute>
   <text>Did the child start coughing about one week after getting the cold?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>cough</attribute>
   <text>Does the child have a cough?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>impetigo.rash</attribute>
   <text>Are there pimples on the child with a partly brown crust?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>cough.when.move</attribute>
   <text>Does the child start coughing violently when he either lays down or gets up?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>vibration.chest</attribute>
   <text>Can you feel a vibration in the child's chest as he breaths?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>tender.abdomen</attribute>
   <text>Does the child have a tender abdomen on the right side?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>scratchy.throat</attribute>
   <text>Does the child have a scratchy throat?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>rapid.breathing</attribute>
   <text>Does the child have rapid, shallow breathing?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>vomiting</attribute>
   <text>Is the child vomiting?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>naval.pain</attribute>
   <text>Has the child complained of pain around his naval for several hours?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>inflammed.ears</attribute>
   <text>Does the child have inflammed ears?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>hoarse.cough</attribute>
   <text>Does the child have a hoarse cough?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>sinus.pain</attribute>
   <text>Does the child have any sinus pain?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>dirty.white.patches</attribute>
   <text>Does the child have dirty white patches on his tonsils?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>scarlet.rash</attribute>
   <text>Does the child have a red blush-like rash on his skin?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>scabies.rash</attribute>
   <text>Are there groups of pimples topped with scabs on the child?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>ringworm.rash</attribute>
   <text>Are there circular patches of rough skin on the child?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>prickly.rash</attribute>
   <text>Does the child have patches of tan-pink pimples?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>headache</attribute>
   <text>Does the child complain of headache?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>difficulty.breathing</attribute>
   <text>Does the child have difficulty breathing?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>active.temp.over.101</attribute>
   <text>Has the child been active in the last hour and his temp is greater than 101?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>wheezing</attribute>
   <text>Is the child wheezing?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>touch.to.chest</attribute>
   <text>Is it impossible for the child to touch his chin to his chest?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>tonsils.swollen</attribute>
   <text>Are the child's tonsils swollen with white patches on them?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>sore.throat</attribute>
   <text>Does the child have a sore throat?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>rest.temp.over.100</attribute>
   <text>Has the child been resting for over an hour and his temp is greater than 100?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>pox.rash</attribute>
   <text>Does the child's skin have separate, raised pimples, several with blisters?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>nervous.disease</attribute>
   <text>Does the child have twitching or writhing movements in DIFFERENT places?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>much.cough</attribute>
   <text>Does the child cough a lot, and cough syrup is roughly ineffective?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>measle.rash</attribute>
   <text>Does the child have flat pink spots on the skin?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>hives.rash</attribute>
   <text>Does the child have raised welts that are white in color?</text>
   <response>yes</response>
   <response>no</response>
  </question>
  <question>
   <attribute>eczema</attribute>
   <text>Does the child have patches of rough, red, rash, scaly skin?</text>
   <response>yes</response>
   <response>no</response>
  </question>
 </questions>
</knowledgebase>



( run in 0.238 second using v1.01-cache-2.11-cpan-4d50c553e7e )