Skip to content

Instantly share code, notes, and snippets.

@lucaspoffo
Created May 4, 2020 22:29
Show Gist options
  • Save lucaspoffo/f73a6b7f810a337b1fda4d4a9183b8e8 to your computer and use it in GitHub Desktop.
Save lucaspoffo/f73a6b7f810a337b1fda4d4a9183b8e8 to your computer and use it in GitHub Desktop.
data Symptom = None | Slight | Medium | Severe deriving (Show, Eq, Enum, Ord)
tempature :: (RealFloat a) => a -> Symptom
tempature t
| t >= 35 && t <= 37 = None
| t < 35 || (t > 37 && t < 39) = Slight
| t >= 39 = Medium
heartRate :: (RealFloat a) => a -> Symptom
heartRate bpm
| bpm < 100 = None
| bpm >= 100 = Slight
respiratoryFrequency :: (RealFloat a) => a -> Symptom
respiratoryFrequency ipm
| ipm <= 18 = None
| ipm > 18 && ipm < 30 = Slight
| ipm >= 30 = Severe
paSystolic :: (RealFloat a) => a -> Symptom
paSystolic mmHg
| mmHg > 100 = None
| mmHg >= 90 && mmHg <= 100 = Medium
| mmHg < 90 = Severe
saO2 :: (RealFloat a) => a -> Symptom
saO2 p
| p >= 0.95 = None
| p < 0.95 = Severe
dyspnea :: Bool -> Symptom
dyspnea False = None
dyspnea True = Severe
age :: (RealFloat a) => a -> Symptom
age a
| a < 60 = None
| a >= 60 && a < 80 = Slight
| a >= 80 = Medium
comorbidities :: (Integral a) => a -> Symptom
comorbidities 0 = None
comorbidities 1 = Slight
comorbidities 2 = Medium
comorbidities a = Severe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment