
Pregnancy analyses with PVgravID
Source:vignettes/articles/PVgravID_extension.Rmd
PVgravID_extension.RmdOverview
Pregnancy-related reports can represent an important population of interest in pharmacovigilance analyses. However, pregnancy is not represented by a single standardized indicator in spontaneous reporting databases, making the identification of relevant reports challenging.
The PVgravID package complements DiAna by providing
rule-based algorithms for identifying pregnancy-related reports in
pharmacovigilance databases. It implements three published algorithms
and uses the data structure adopted by DiAna.
This vignette illustrates a typical workflow in which DiAna is used to prepare FAERS data, PVgravID is used to identify pregnancy-related reports, and the resulting report identifiers are passed back to DiAna for downstream analyses.
For details on the pregnancy-identification algorithms themselves, see the PVgravID documentation.
Installation
PVgravID is currently available from GitHub and can be installed
using pak:
# install.packages("pak")
pak::pak("Uppsala-Monitoring-Centre/PVgravID")Load DiAna and PVgravID:
library(DiAna)
library(PVgravID)
library(data.table)Prepare FAERS data with DiAna
PVgravID can operate on FAERS data prepared using the standard DiAna workflow.
First, specify the most recent FAERS quarter to include:
FAERS_version <- "25Q1"
import("DEMO")All quarters up to and including the selected FAERS version are included.
The imported Demo table contains the report identifiers
that can be passed to PVgravID.
Identify pregnancy-related reports
The main PVgravID function is
generate_pregnancy_flags().
It evaluates reports against the inclusion and exclusion criteria used by the pregnancy-identification algorithms implemented in PVgravID.
matrix_flagged_for_pregnancy <- generate_pregnancy_flags(
pids_vct = Demo$primaryid
)The resulting table contains one row per report together with the individual pregnancy-related criteria and the final classifications generated by the different algorithms.
For example, reports identified by the UMC algorithm can be obtained with:
UMC_pregnancy_reports <-
matrix_flagged_for_pregnancy[
UMC == TRUE
]$primaryid
length(UMC_pregnancy_reports)The same principle can be applied to the other algorithms implemented in PVgravID.
Use pregnancy reports in DiAna
The report identifiers returned by PVgravID can be passed directly to DiAna functions.
This makes it possible to use pregnancy status to define the population for subsequent pharmacovigilance analyses.
Descriptive analysis
For example, the characteristics of reports identified as
pregnancy-related by the UMC algorithm can be summarized using
descriptive():
descr_table <- descriptive(
UMC_pregnancy_reports
)
descr_tableA reference population can also be supplied to compare pregnancy-related reports with another group of reports.
For example:
set.seed(123)
reference_reports <- sample(
Demo$primaryid,
10000
)
descr_comp_table <- descriptive(
UMC_pregnancy_reports,
RG = reference_reports
)
descr_comp_tableThe definition of the reference population should be determined by the research question rather than by convenience.
Restrict a disproportionality analysis to pregnancy reports
Pregnancy may be associated with both exposure to particular medicines and the occurrence or reporting of particular events. Consequently, the population in which disproportionality is estimated can materially affect the result.
The report identifiers generated by PVgravID can be supplied to DiAna as a restriction.
First import the required drug data:
import("DRUG")We can then compare a disproportionality analysis in the complete database with one restricted to reports identified as pregnancy-related:
restrictions <- list(
"Crude" = Demo$primaryid,
"Pregnancy" = UMC_pregnancy_reports
)
drug <- "anti-d immunoglobulin"
event <- "nausea"
disproportionality_df <- data.table()
for (n in seq_along(restrictions)) {
restriction_name <- names(restrictions)[n]
restriction_pids <- restrictions[[n]]
result <- disproportionality_analysis(
drug_selected = drug,
reac_selected = event,
temp_drug = Drug[
role_cod %in% c("PS", "SS", "I")
],
restriction = restriction_pids
)[
, population := restriction_name
]
disproportionality_df <- rbindlist(
list(disproportionality_df, result),
fill = TRUE
)
}
disproportionality_dfThe results can then be compared to investigate how restricting the analysis to pregnancy-related reports affects the observed disproportionality.
Comparing pregnancy definitions
PVgravID implements multiple pregnancy-identification algorithms. These algorithms do not necessarily identify exactly the same reports.
Rather than assuming that one definition is appropriate for every analysis, users may compare results obtained using different pregnancy definitions.
For example:
restrictions <- list(
"All reports" = Demo$primaryid,
"UMC" = matrix_flagged_for_pregnancy[
UMC == TRUE
]$primaryid,
"EMA" = matrix_flagged_for_pregnancy[
EMA == TRUE
]$primaryid,
"Sakai" = matrix_flagged_for_pregnancy[
SakaiHPPV == TRUE
]$primaryid
)These populations can then be passed to DiAna analyses in the same way as the pregnancy restriction shown above.
Differences between results can provide useful information about the sensitivity of an analysis to the operational definition of pregnancy.
Tailoring pregnancy definitions
PVgravID also provides functionality for modifying the inclusion and exclusion criteria used to define pregnancy-related reports.
This can be useful when a research question requires a definition that differs from one of the published algorithms.
Because changing these criteria changes the population under study, any tailored definition should be specified before examining the results where possible and documented clearly when reporting the analysis.
For details on defining custom criteria, visualizing algorithm overlap, and examining the reasons individual reports are included or excluded, see the PVgravID Getting Started vignette.
Considerations
PVgravID identifies reports that meet rule-based definitions of pregnancy-related reporting. These classifications should not automatically be interpreted as confirmed pregnancy exposures or outcomes.
The algorithms differ in their scope, inclusion criteria, exclusion criteria, and intended use. The choice of algorithm therefore forms part of the definition of the study population and can influence downstream DiAna analyses.
For a detailed discussion of these issues, see PVgravID: Caveats and Considerations.
Reproducibility
When reporting an analysis combining DiAna and PVgravID, consider documenting:
- the DiAna and PVgravID package versions;
- the FAERS version and observation period;
- preprocessing and deduplication choices;
- the pregnancy-identification algorithm used;
- any modifications to the algorithm or its criteria;
- the definition of any reference or background population; and
- how the pregnancy classification was incorporated into the downstream analysis.