PERC Rule for Pulmonary Embolism

Used to exclude the risk of pulmonary embolism

Description
Used to exclude the diagnosis of pulmonary embolism, based on a 2004 study of 3148 patients
Academic References
Kline JA, Courtney DM, Kabrhel C, et al. Prospective multicenter evaluation of the pulmonary embolism rule-out criteria. J Thromb Haemost. 2008;6(5):772-780. doi:10.1111/j.1538-7836.2008.02944.x
See: https://www.ncbi.nlm.nih.gov/pubmed/18318689
Kline JA, Mitchell AM, Kabrhel C, Richman PB, Courtney DM. Clinical criteria to prevent unnecessary diagnostic testing in emergency department patients with suspected pulmonary embolism. J Thromb Haemost. 2004;2(8):1247-1255. doi:10.1111/j.1538-7836.2004.00790.x
See: https://www.ncbi.nlm.nih.gov/pubmed/15304025
Code Version Id
103c3339-b3d9-4653-835f-2e7d6d4dcdf5
// 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"
        }