// Copyright (C) 2023 Calcarta
module Calcarta.Calculation.Perc_rule_for_pulmonary_embolism.Code
open Calcarta.CodeResource.Standard
type Patient = {
[<Name("Age < 50")>]
Age : bool
[<Name("Pulse < 100")>]
Pulse : bool
[<Name("Pulse oximetry > 94%")>]
PulseOximetry : bool
[<Name("Unilateral leg swelling present")>]
[<Description("Asymmetrical calfswhen the legs are raised by the heels off of the bed by the examiner")>]
UnilateralLegSwelling : bool
[<Name("Haemoptysis present")>]
[<Description("Patient report of coughing up any blood in the last week")>]
Haemoptysis : bool
[<Name("Recent surgery")>]
[<Description("Has had either surgery or trauma requiring treatment with general anaesthesia in the previous 4 weeks")>]
RecentSurgery : bool
[<Name("Prior PE or DVT")>]
[<Description("Personal history of PE or DVT requiring treatment")>]
PriorPeOrDvt : bool
[<Name("Hormone use")>]
[<Description("Oral contraceptives, hormone replacement or estrogenic hormone use in male or female patients")>]
HormoneUse : bool
}
type Output = {
[<Name("PE excluded")>]
PeExcluded : bool
[<Name("PE risk")>]
Risk : string
}
[<Name("", AppliesTo = Argument.Output)>]
[<Description("", AppliesTo = Argument.Output)>]
[<Unit("", AppliesTo = Argument.Output)>]
let perc_rule_for_pulmonary_embolism (patient : Patient) =
if not patient.Age ||
not patient.Pulse ||
not patient.PulseOximetry ||
patient.UnilateralLegSwelling ||
patient.Haemoptysis ||
patient.RecentSurgery ||
patient.PriorPeOrDvt ||
patient.HormoneUse
then
{
PeExcluded = false
Risk = "Cannot exclude risk of PE"
}
else
{
PeExcluded = true
Risk = "<2% chance of PE"
}