This package implements a Swift 4.2 version of the stroke pre-hospital triage model at https://github.com/aymannnn/stroke, extended to allow comparisons of multiple primary stroke centers.
The StrokeModel package exposes the following classes:
StrokeModel
, an encapsulating class that provides public functions for running the modelInputs
, a class containing all of the direct model inputs, andSex
, an enum for patient sex (one of the model inputs)StrokeCenter
, an open class storing information about a stroke center under consideration, including travel time(s)SingleRunResults
andMultiRunResults
, encapsulating model outputs, along with the structStrategy
defining the possible triage decisionsRace
, an enum namespace encapsulating several enums and the functionscoreFrom
for use in computing the RACE score, and static functionstoNIHSS
andfromNIHSS
for converting between RACE and NIHSS.
The simplest way to run the model is to use the optional initializer
Inputs(sex: Sex, age: Int, race: Double, timeSinceSymptoms: Double,
primaryTimes: [Double], transferTimes: [Double],
comprehensiveTimes: [Double])
to generate model inputs (this will be nil
if and only if primaryTimes
and transferTimes
are different lengths) then create a model object via StrokeModel(inputs)
and run it using either StrokeModel.run
or StrokeModel.runWithVariance
. The results class exposes a string
property that summarizes results, along with various constants for more details.
The package was developed and tested on macOS, but should also run on Linux. In testing (on the Windows Subsystem for Linux), multithreading via Grand Central Dispatch worked only intermittently, so runWithVariance
includes a useGCD
argument that can revert all computations to a more stable but slower single-threaded mode which is safer on Linux. Tests on Linux do not use GCD.