ContinuousCoveragePhenotype
Bases: Phenotype
ContinuousCoveragePhenotype identifies patients based on duration of observation data. ContinuousCoveragePhenotype requires an anchor phenotype, typically the entry criterion. It then identifies an observation time period that contains the anchor phenotype. The phenotype can then be used to identify patients with a user specified continuous coverage before or after the anchor phenotype. The returned Phenotype has the following interpretation:
DATE: If when='before', then DATE is the beginning of the coverage period containing the anchor phenotype. If when='after', then DATE is the end of the coverage period containing the anchor date. VALUE: Coverage (in days) relative to the anchor date. By convention, always non-negative.
There are two primary use cases for ContinuousCoveragePhenotype
- Identify patients with some minimum duration of coverage prior to anchor_phenotype date e.g. "identify patients with 1 year of continuous coverage prior to index date"
- Determine the date of loss to followup (right censoring) i.e. the duration of coverage after the anchor_phenotype event
Data for ContinuousCoveragePhenotype
This phenotype requires a table with PersonID and a coverage start date and end date. Depending on the datasource used, this information is a separate ObservationPeriod table or found in the PersonTable. Use an PhenexObservationPeriodTable to map required coverage start and end date columns.
PersonID | coverageStartDate | coverageEndDate |
---|---|---|
1 | 2009-01-01 | 2010-01-01 |
2 | 2008-01-01 | 2010-01-02 |
One assumption that is made by ContinuousCoveragePhenotype is that there are NO overlapping coverage periods.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Optional[str]
|
The name of the phenotype. |
'continuous_coverage'
|
domain
|
Optional[str]
|
The domain of the phenotype. Default is 'observation_period'. |
'OBSERVATION_PERIOD'
|
value_filter
|
Optional[ValueFilter]
|
Fitler returned persons based on the duration of coverage in days. |
None
|
anchor_phenotype
|
Optional[Phenotype]
|
An anchor phenotype defines the reference date with respect to calculate coverage. In typical applications, the anchor phenotype will be the entry criterion. |
None
|
when
|
Optional[str]
|
'before', 'after'. If before, the return date is the start of the coverage period containing the anchor_phenotype. If after, the return date is the end of the coverage period containing the anchor_phenotype. |
'before'
|
Example:
# make sure to create an entry phenotype, for example 'atrial fibrillation diagnosis'
entry_phenotype = CodelistPhenotype(...)
# one year continuous coverage prior to index
one_year_coverage = ContinuousCoveragePhenotype(
when = 'before',
value_filter = ValueFilter(
min_value=GreaterThanOrEqualTo(365)
),
anchor_phenotype = entry_phenotype
)
# determine the date of loss to followup
loss_to_followup = ContinuousCoveragePhenotype(
when = 'after',
anchor_phenotype = entry_phenotype
)
Source code in phenex/phenotypes/continuous_coverage_phenotype.py
namespaced_table
property
A PhenotypeTable has generic column names 'person_id', 'boolean', 'event_date', and 'value'. The namespaced_table appends the phenotype name to all of these columns. This is useful when joining multiple phenotype tables together.
Returns:
Name | Type | Description |
---|---|---|
table |
Table
|
The namespaced table for the current phenotype. |
execute(tables)
Executes the phenotype computation for the current object and its children. This method recursively iterates over the children of the current object and calls their execute method if their table attribute is None.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tables
|
Dict[str, PhenexTable]
|
A dictionary mapping table names to PhenexTable objects. See phenex.mappers.DomainsDictionary.get_mapped_tables(). |
required |
Returns:
Name | Type | Description |
---|---|---|
table |
PhenotypeTable
|
The resulting phenotype table containing the required columns. The PhenotypeTable will contain the columns: PERSON_ID, EVENT_DATE, VALUE. DATE is determined by the return_date parameter. VALUE is different for each phenotype. For example, AgePhenotype will return the age in the VALUE column. A MeasurementPhenotype will return the observed value for the measurement. See the specific phenotype of interest to understand more. |