hasklepias-core-0.30.3: Domain-aware tools and types for constructing epidemiological cohorts
Copyright(c) Target RWE 2023
LicenseBSD3
Maintainerbbrown@targetrwe.com ljackman@targetrwe.com dpritchard@targetrwe.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cohort.Core

Description

This is module supplies the logic for how cohorts are processed based on the user-defined CohortSpecMap. It is intended to be used internally to `hasklepias-main` and not re-exported from there.

For high-level documentation of the cohort-processing pipeline, see the Hasklepias module documentation from `hasklepias-main`.

Command-line options, defined in `hasklepias-main`, should not affect the internal logic of cohort processing. Only the CohortSpec should be able to do so.

Note subjData is processed *only* via the logic provided in CohortSpec.

Synopsis

Documentation

evalSubjAtIndex :: CohortSpec t m a -> Subject t m a -> Interval a -> Either (ObsId a, Text) (ObsUnit a) Source #

Evaluate a subject at a single index time, producing Left if there were any Exclude among the computed Criteria, and otherwise returning Right (ObsUnit b) with variables computed via runVariables.

evalSubj :: CohortSpec t m a -> Subject t m a -> EvaluatedSubject a Source #

Compute IndexSet, Criteria and variables for a given subject via strict fold on the IndexSet. Returns SNoIndex if and only if IS.null idxs. As reflected in the definition of EvaluatedSubject, runVariables is computed only for units whose Criteria have status Include. This also updates the attritionSubj, the AttritionInfo associated with this subject.

evalCohort :: CohortSpec t m a -> [Subject t m a] -> Cohort a Source #

Processes the cohort-building logic provided in CohortSpec on a list of Subjects. Subjects are processes one-by-one, and AttritionInfo is accumulated as each subject is processed. Subjects whose set of index times is empty are counted only in the subjectsProcessed field of AttritionInfo.

Each Subject produces one ObsUnit in the Cohort for each element of the subject's IndexSet such that all Criteria associated with that index time have status Include. If at least one element of the Criteria for an index time has status Exclude, no variables are computed and the exclusion is recorded in the AttritionInfo.

evalCohortMap :: CohortSpecMap t m a -> [Subject t m a] -> CohortMap a Source #

A convenience function to apply evalCohort to a fixed list of subjects, once for each element of a CohortMapSpec. Each element of the CohortMapSpec represents a different, user-provided cohort-building logic.