Copyright | (c) Target RWE 2023 |
---|---|
License | BSD3 |
Maintainer | bbrown@targetrwe.com ljackman@targetrwe.com dpritchard@targetrwe.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data CohortSpec t m a = MkCohortSpec {
- runIndices :: NonEmpty (Event t m a) -> IndexSet a
- runCriteria :: NonEmpty (Event t m a) -> Interval a -> Criteria
- runVariables :: NonEmpty (Event t m a) -> Interval a -> VariableRow
- type CohortSpecMap t m a = Map Text (CohortSpec t m a)
- newtype SubjId = MkSubjId Text
- data Subject t m a = MkSubject {}
- data AttritionStatus
- data AttritionInfo = MkAttritionInfo {}
- data ObsId a = MkObsId {
- fromSubjId :: SubjId
- indexTime :: Interval a
- data ObsUnit a = MkObsUnit {
- obsId :: ObsId a
- obsData :: VariableRow
- data EvaluatedSubject a
- data SUnitData a = MkSUnitData {
- excludeUnits :: [(ObsId a, Text)]
- includeUnits :: [ObsUnit a]
- attritionSubj :: AttritionInfo
- data Cohort a = MkCohort {
- attritionInfo :: AttritionInfo
- cohortData :: [ObsUnit a]
- type CohortMap a = Map Text (Cohort a)
- eventsToSubject :: [(Text, Event t m a)] -> [Subject t m a]
- emptyCohort :: Cohort b
- emptyAttrition :: AttritionInfo
- alterAttrition :: AttritionStatus -> Map AttritionStatus Int -> Map AttritionStatus Int
- incrementAttritionForUnit :: AttritionStatus -> AttritionInfo -> AttritionInfo
- combineAttrition :: AttritionInfo -> AttritionInfo -> AttritionInfo
Documentation
data CohortSpec t m a Source #
A container for all logic needed to construct a cohort. The provided
functions will be run on subject-level data, subject-by-subject. Logic will
be executed as part of a
pipeline. The type CohortApp
CohortApp
itself
is not exported, but the user will create such a pipeline via the exported
cohortMain
.
Note runVariables
must construct *all* output variables. For a more
detailed explanation of the cohort-building pipeline, see the Hasklepias
module documentation from `hasklepias-main`.
MkCohortSpec | |
|
type CohortSpecMap t m a = Map Text (CohortSpec t m a) Source #
Container for CohortSpec
for different cohorts, as given by the Text
keys.
Wrapper for a Text
subject identifier. The wrapper allows us to
guarantee certain properties for subject identifiers, instead of allowing
arbitrary Text
.
Subject-level data. The API via CohortSpec allows programmers to
manipulate contents of subjData
only, not subjId
. Attempting to process
a Subject
without any events is ill-defined, hence the use of NonEmpty
.
data AttritionStatus Source #
Internal. Status used for final inclusion/exclusion and the key of
attritionByStatus
. An observational unit can have multiple Exclude
values but only be associated with a single ExcludeBY
.
Instances
data AttritionInfo Source #
Container for accumulated inclusion/exclusion counts.
Instances
Identifier for the unit element of a Cohort, ObsUnit
. fromSubjId
should refer to the subjId
of the Subject
from which an ObsUnit
was
constructed. There should be one ObsId
, and hence one ObsUnit
, per pair
formed from a given Subject
and each element of the subject's IndexSet
.
indexTime
gives the element of IndexSet
associated with this ObsUnit
.
MkObsId | |
|
Instances
ToJSON a => ToJSON (ObsId a) Source # | |
Defined in Cohort.Cohort toEncoding :: ObsId a -> Encoding toJSONList :: [ObsId a] -> Value toEncodingList :: [ObsId a] -> Encoding | |
Generic (ObsId a) Source # | |
(Show a, Ord a) => Show (ObsId a) Source # | |
Eq a => Eq (ObsId a) Source # | |
Ord a => Ord (ObsId a) Source # | |
type Rep (ObsId a) Source # | |
Defined in Cohort.Cohort type Rep (ObsId a) = D1 ('MetaData "ObsId" "Cohort.Cohort" "hasklepias-core-0.30.3-inplace" 'False) (C1 ('MetaCons "MkObsId" 'PrefixI 'True) (S1 ('MetaSel ('Just "fromSubjId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubjId) :*: S1 ('MetaSel ('Just "indexTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Interval a)))) |
There should be one ObsUnit
per pair formed from a given Subject
and
each element of the subject's IndexSet
.
MkObsUnit | |
|
data EvaluatedSubject a Source #
Internal type to hold the result of Cohort.Core.
. It
should not be used for any other purpose.evaluateSubj
SNoIndex SubjId |
|
SUnits (SUnitData a) |
Instances
(Show a, Ord a) => Show (EvaluatedSubject a) Source # | |
Defined in Cohort.Cohort showsPrec :: Int -> EvaluatedSubject a -> ShowS # show :: EvaluatedSubject a -> String # showList :: [EvaluatedSubject a] -> ShowS # |
Internal. Holds data for SUnits
.
MkSUnitData | |
|
Accumulated data from a single list of subjects, processed according to
the logic provided in a CohortSpec
. It is the output type of evalCohort
and should be produced nowhere else.
MkCohort | |
|
eventsToSubject :: [(Text, Event t m a)] -> [Subject t m a] Source #
Accumulate [(Text, Event t m a)]
into [Subject t m a]
. The former is
the 'flat' output format produced in EventDataTheory.parseEventLinesL'
.
emptyCohort :: Cohort b Source #
incrementAttritionForUnit :: AttritionStatus -> AttritionInfo -> AttritionInfo Source #
Internal. Increment AttritionInfo with a single unit's information. Does
not alter subjectsProcessed
.
combineAttrition :: AttritionInfo -> AttritionInfo -> AttritionInfo Source #
Combine two AttritionInfo
values by summing the counts, and taking the
union of attritionByStatus
, summing values for shared keys.