Last active
April 2, 2023 10:10
-
-
Save dacr/8b00a4a9cf348985fd342db68b5afed1 to your computer and use it in GitHub Desktop.
A simplified doctor knowledge base. / published by https://github.com/dacr/code-examples-manager #2c09c2b5-b81c-45ed-80bb-c003ece6f4c5/e0160275843cf145b1a155a13271b2a85ba27c3f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// summary : A simplified doctor knowledge base. | |
// keywords : drools, mvel, ai | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : 2c09c2b5-b81c-45ed-80bb-c003ece6f4c5 | |
// created-on : 2019-10-22T14:07:19+02:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
package diagnosis | |
dialect "mvel" | |
// ------------------------------------------ | |
declare enum Strength NONE(0),LOW(1),MEDIUM(2),HIGH(3); | |
intensity: int | |
end | |
declare enum CoughingKind NONE(0),DRY(1), OILY(2); | |
kind: int | |
end | |
// ------------------------------------------ | |
declare Sickness end | |
declare Flu extends Sickness end | |
// ------------------------------------------ | |
declare Symptom end | |
declare Fever extends Symptom // --- Fièvre | |
strength:Strength | |
end | |
declare Coughing extends Symptom // --- Toux | |
strength:Strength | |
kind:CoughingKind | |
end | |
declare MuscleAche extends Symptom // --- Courbature | |
strength:Strength | |
end | |
// ------------------------------------------ | |
declare PatientTemperature | |
temperature: float | |
end | |
rule "no fever" when PatientTemperature(temperature < 38) then insert(new Fever(Strength.NONE)); end | |
rule "low fever" when PatientTemperature(temperature >= 38 && < 39) then insert(new Fever(Strength.LOW)); end | |
rule "medium fever" when PatientTemperature(temperature >= 39 && < 40) then insert(new Fever(Strength.MEDIUM)); end | |
rule "high fever" when PatientTemperature(temperature >= 40) then insert(new Fever(Strength.HIGH)); end | |
// ------------------------------------------ | |
rule "flu diagnostic" | |
when | |
Fever(strength.intensity >= Strength.MEDIUM.intensity) | |
MuscleAche(strength != Strength.NONE) | |
then | |
insert(new Flu()); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment