Development of Longitudinal, Linked Maternal-Infant Cohorts using the Epic Cosmos Electronic Health Record Dataset
1Department of Obstetrics and Gynecology, Stanford University School of Medicine, Stanford, California
2Department of Anesthesiology, Perioperative and Pain Medicine, Stanford University School of Medicine, Stanford, California
3Division of Neonatology, Children’s Hospital of Philadelphia, Philadelphia, Pennsylvania
4Department of Pediatrics, Perelman School of Medicine at the University of Pennsylvania, Philadelphia, Pennsylvania
5Division of Computational Medicine, Department of Medicine, Stanford University School of Medicine, Stanford, California
6Leonard Davis Institute of Health Economics, The University of Pennsylvania, Philadelphia, Pennsylvania
7Division of Pharmacoepidemiology and Pharmacoeconomics, Department of Medicine, Brigham and Women’s Hospital, Harvard Medical School, Boston, Massachusetts
*Corresponding author; email: stephanie.leonard@stanford.eduABSTRACT
Background
Epic Cosmos is a relatively new centralized electronic health record dataset with high potential utility in perinatal epidemiologic research.
Objectives
The study objectives were to develop replicable steps to create longitudinal, linked maternal-infant cohorts in Cosmos, assess completeness of key variables, evaluate potential selection bias with restrictions for longitudinal healthcare encounters, and provide an example epidemiologic analysis.
Methods
We created maternal-infant cohorts by starting with live births during 2023-2024 recorded in the BirthFact data table and joining with additional data tables as needed. We selected and created variables for perinatal characteristics, common comorbidities, and routinely measured vital signs and laboratory values, and assessed variable completeness. We sequentially restricted the birth cohort for maternal-infant linkage and longitudinal healthcare from first-trimester prenatal care encounter through infant follow-up care within 12 weeks post-discharge from birth hospitalization. Finally, we conducted an example analysis of the association between high systolic blood pressure in the first trimester (≥140 mm Hg) and later onset of preeclampsia among those with chronic hypertension.
Results
The total linked birth cohort included 2,624,186 pregnancies. Completeness was >90% for most variables assessed but was 77% for racial and ethnic group and 76% for body mass index at delivery. Characteristics of the cohort were similar to those reported for the entire United States birth population based on birth certificate data, including similar regional and racial-ethnic composition. Longitudinal cohort restriction requiring linked records from first trimester prenatal care through infant follow-up care reduced the cohort size to 509,148 pregnancies. However, restriction had minimal effects on cohort characteristics. In the example analysis, high systolic blood pressure was associated with increased risk of preeclampsia among those with chronic hypertension (aRR: 1.26; 95% CI: 1.22, 1.30).
Conclusions
This study provides a rigorous and reproducible approach to creating longitudinal, linked maternal-infant cohorts in Epic Cosmos and the analytical findings suggest high data quality and representativeness.
Article notes
Competing Interest Statement
KFH reports being an investigator on grants to her institution from UCB, Takeda and GSK for regulatory-mandated studies, unrelated to this work.
BACKGROUND
Electronic health record (EHR) systems have been widely adopted in clinical practice to document patients’ conditions, tests, and treatments1 and contain granular, longitudinal health information collected in real-world clinical settings. These data are potentially a rich source for epidemiologic studies, but concerns about data quality and representativeness have limited their use.2–4 Data quality concerns include missing measurements and encounters. Representativeness concerns stem from the fact that EHR based studies typically rely on data from a small number of healthcare organizations. Combining EHR data from many institutions for research purposes has historically been a major challenge. Further, perinatal epidemiologic research frequently requires linkage of maternal and infant records, which is challenging in many EHR data sources.
Epic Cosmos is a relatively new dataset that centralizes EHR data from hundreds of healthcare organizations.5 Epic is the leading EHR software vendor in the United States, and healthcare organizations that use Epic Systems’ EHR can now opt to contribute to Cosmos and access the Cosmos dataset. In Cosmos, information is pulled from all structured EHR fields, with high granularity of patient health information, including laboratory measurements, vital signs, and medications prescribed or administered. Organizations participating in Cosmos range from academic to community health systems, are located throughout the United States and select locations in Saudi Arabia, Lebanon, and Canada (currently), and continue to grow in number. The Cosmos dataset currently contains data from approximately 300 million patients seen at over 2,000 hospitals and 47,000 clinics.5
Interest in and use of Epic Cosmos for perinatal epidemiologic research are growing rapidly, creating a critical need to assess data quality and representativeness of maternal-infant cohorts in Cosmos.6–8 The goal of this study was to provide detailed, replicable steps to create longitudinal, linked maternal-infant cohorts in Cosmos, assess completeness of key variables, and evaluate potential selection bias via restrictions for longitudinal healthcare encounters. In addition, we sought to provide perinatal epidemiologic researchers with an applied example, by using the Cosmos dataset to estimate the association between systolic blood pressure (SBP) in the first trimester of pregnancy and later onset of preeclampsia among those with chronic hypertension.
Prior studies in selective study samples have found that individuals with higher SBP in the first trimester were more likely to develop preeclampsia.9–11 Screening for high SBP and modifying antihypertensive treatment early in pregnancy could be potential strategies to reduce the risk of preeclampsia, which affects approximately 30% of women with chronic hypertension and poses considerable risks to the pregnant woman and infant.12,13
METHODS
Cohort Creation
Steps taken for cohort creation are described here and in greater detail in Appendix 1. We first selected all births recorded in the Cosmos BirthFact table during January 1, 2023 to December 31, 2024. The BirthFact table is populated for a patient when an EHR is created for an infant and documentation is made in the delivery summary. New EHRs are typically only created for liveborn infants and the existence of a delivery summary indicates that the delivery occurred in the same healthcare organization that is contributing the data to Epic Cosmos. Therefore, pregnancies resulting in non-livebirths and those delivered at an organization that does not participate in Cosmos were not included. Such pregnancies would need to be identified using a different approach based on data tables other than BirthFact, including the PregnancyFact table. We selected 2023 to 2024 to have complete years of data and infant follow-up through 12 weeks post-discharge from birth hospitalization at the time of analysis, but the methods described here can be implemented for all available years in Cosmos when accounting for the necessary follow-up time in a given study. Data recorded in the BirthFact table are considered reliable as early as 2017 or when an organization started using Epic, whichever occurred later. Data are updated in Cosmos approximately every two weeks and we conducted analyses using data updated through 5/20/2026.
We then linked the birth records to pregnancy records by joining the BirthFact and PregnancyFact tables based on maternal records. The PregnancyFact table is populated when a patient receives healthcare during their pregnancy. The BirthFact table contains a record for each liveborn infant; for example, if an obstetric patient gives birth to liveborn twins, there will be two records in the BirthFact table and one record in the PregnancyFact table. Next, we linked to birth encounters during the same birth years (2023-2024) by joining to the EncounterFact table. The EncounterFact table contains a record for each encounter that a patient has with the healthcare organization that is documented in an EHR and encounters derived from billing data. We then removed unavailable birth encounters (i.e., missing, masked, deleted). BirthFact tables could be populated retrospectively by a clinician at a later date and not be linked to a birth encounter. Next, we identified twins and higher-order births and, if multiple birth dates, assigned the earlier date as the delivery date of the pregnancy. In some instances, a stillborn infant will have an EHR created, which will be captured by the BirthFact table. We therefore excluded any pregnancies with an ICD code indicative of stillbirth. We note that it is recommended to use both ICD-9 and ICD-10 across all data years in Epic Cosmos due to the common data mapping process. Such recommendations are detailed in the Epic Cosmos data documentation.
Study Variables
We selected and created variables that are frequently used in perinatal epidemiologic research and surveillance. All variables are detailed in Appendix 2, including time windows used for diagnoses, procedures, or measurements. We additionally created variables that are important in obstetric or neonatal health but not typically available or reliable in administrative claims or vital records data. For example, parity, body mass index (BMI), infant birthweight, and Apgar score are not well-captured in administrative claims data; hypertensive disorders, diabetes, and depression are not well-captured in vital records data; and blood pressure measurements and hemoglobin values are not well-captured in either administrative claims or vital records data. For gestational age, if one pregnancy had multiple gestational ages, we assigned the lowest. If no gestational age was available, we calculated it as the delivery date from the BirthFact table minus the estimated start date of the pregnancy from the PregnancyFact table. If that was missing, we set gestational age to missing. We calculated the last menstrual period as the delivery date minus the gestational age.
Longitudinal, Linked Maternal-Infant Cohorts
We then placed restrictions to identify maternal-infant dyads with continuity of healthcare capture in Epic beyond the birth hospitalization. Some patients give birth at hospitals that use Epic Systems for EHRs and participate in Cosmos, but receive their prenatal care in clinics that do not use Epic or do not participate in Cosmos such that these encounters are not captured in the Cosmos database. Excluding such patients is necessary for research questions with exposures, outcomes, or covariates that occur before or after the birth hospitalization, but reduce cohort size and therefore statistical power and may also induce selection bias. To examine this phenomenon, we started with the birth cohort and then added sequential restrictions based on encounter type, department of encounter, and timing of encounter relative to the start of pregnancy or date of delivery. First, we created a cohort with likely continuous healthcare documented in Epic throughout pregnancy and birth by requiring at least one prenatal care encounter in the first trimester (before gestational week 14) and at least one prenatal care encounter in the second trimester (from gestational week 14 to week 27). Second, we extended the restriction to require at least one postpartum care encounter within 12 weeks of delivery. Third, we added a requirement of at least one infant follow-up care encounter within 12 weeks of discharge from the birth hospitalization. These steps are further detailed in Appendix 3.
Statistical Analysis
We first calculated the frequencies and percentages of completeness for key perinatal variables. Next, we calculated the frequencies and percentages of maternal and neonatal characteristics in each of the four cohorts with increasingly restrictive longitudinal selection: (1) linked maternal-infant birth encounters, (2) birth and prenatal care encounters, (3) birth, prenatal, and postpartum care encounters, (4) birth, prenatal, postpartum, and infant follow-up care encounters. Finally, we conducted an example analysis, replicating the known association between high SBP in the first trimester of pregnancy and later onset of preeclampsia among pregnant individuals with chronic hypertension. For this analysis, we selected individuals with at least one prenatal care encounter in the first trimester from the total birth cohort. We then restricted to individuals with a diagnosis of chronic hypertension between three months prior to pregnancy and 20 weeks’ gestation and a SBP recorded during a first trimester prenatal care encounter. We defined high SBP as ≥140 mm Hg following hypertension guidelines of the American College of Obstetricians and Gynecologists.14 We estimated risk ratios (RR) with 95% confidence intervals (CI) using multivariable modified Poisson regression models with robust standard errors. We used multiple imputation by chained equations (50 imputations) to account for missing values of the covariates: maternal age (0.04%), insurance status (6.4%), and race-ethnicity (18.7%). Analysis was conducted in R version 4.5.1.
RESULTS
The total cohort of births during 2023-2024 included 2,711,582 pregnancies to 2,652,556 mothers and 3,552,710 infants (Figure 1). After restricting to linked maternal-infant records, there was a 3% reduction in the number of pregnancies and mothers and a 25% reduction in the number of infants. Maternal-infant linkage in the birth cohort requires that the infant was delivered at a Cosmos-participating healthcare organization, has a mother documented in their family history, and the delivery episode was recorded in the mother’s EHR. Therefore, an infant who received healthcare at a Cosmos-participating hospital or clinic but was born at a non-participating hospital could not be linked to a maternal record. Restricting the cohort to those with prenatal care encounters documented during the first and second trimesters, reduced the cohort size by an additional 62%. The excluded patients would be those who received prenatal care at a healthcare organization that does not participate in Epic Cosmos and those who received delayed or no prenatal care. Restricting the cohort to those with a postpartum visit, reduced the cohort size by 16%. Finally, requiring that there be a linked infant follow-up visit, reduced the cohort size by 41%. The cohort sizes in this most restrictive linked, longitudinal cohort were 501,178 pregnancies, 493,224 mothers, and 509,148 infants during the two-year study period. The cohort sizes differ for each group because a small proportion (∼1.5%) of mothers had more than one pregnancy during the two years and a small proportion (∼1.5%) of pregnancies were twins or higher-order multiples.
Data completeness varied among key perinatal variables (Table 1). Completeness was >97% for age, region of residence, rurality, parity, multiple gestation, gestational age, mode of birth, birthweight, and 5-minute Apgar score. It was lower (89-92%) for hemoglobin and blood pressure measurements during delivery hospitalization and for payer status. Completeness was lowest for racial-ethnic group (77%) and BMI at delivery (76%).
Maternal health characteristics were similar across the four cohorts with increasingly restrictive longitudinal records (Table 2). The cohorts were diverse with respect to racial-ethnic group, payer status, and region of residence in the United States. The mean maternal age was 30 years old and most individuals lived in metropolitan areas, were multiparous, and had a BMI ≥30 kg/m2 at delivery. In the total linked birth cohort, the prevalence of common morbidities was 11% for preeclampsia, 9% for gestational diabetes, 12% for depression, and 26% for anemia. At admission for delivery, mean hemoglobin was 11.8 g/dL (standard deviation (SD): 1.3) and mean blood pressure was 126/77 mm Hg (SD: 14.7 for systolic BP and 11.1 for diastolic BP).
Birth and infant characteristics were also similar across the four cohorts (Table 3). An exception was lower prevalence of extremely preterm birth (<28 wk), very low birthweight (<1500 g), and very low 5-minute Apgar score (0-3) in the cohort with an infant follow-up visit within 12 weeks of discharge from the birth hospitalization. In the total linked birth cohort, 3% of infants were twins, 33% were delivered by cesarean, 9% were born preterm (<37 wk), 9% had a low birthweight (<2500 g), and 2% had a low to moderate 5-minute Apgar score (<7).
The analysis of the association between high SBP in the first trimester and preeclampsia included 58,540 pregnancies. Of 2,624,186 pregnancies in the full cohort, 1,116,621 (43%) had a prenatal care encounter in the first trimester, 70,619 (6.3%) had a chronic hypertension diagnosis, and 58,540 (83%) had SBP recorded at a first-trimester prenatal encounter. The prevalence of high SBP (≥140 mm Hg) was 28.6%. Among those with a high SBP, the prevalence of preeclampsia was 39.1%, compared with 30.4% among those without a high SBP (Table 4). The RR for the association between high SBP and preeclampsia was 1.29 (95% CI: 1.25, 1.32) in the unadjusted regression model and 1.26 (95% CI: 1.22, 1.30) in the adjusted regression model.
Supporting information
ACKNOWLEDGMENTS
Data used in this study came from Epic Cosmos, a dataset created in collaboration with a community of health systems using Epic representing more than 300 million patient records from over 2,000 hospitals and 47,000 clinics as of April 2026. The community represents patients from all 50 states, D.C., Canada, Lebanon, and Saudi Arabia.
DATA AVAILABILITY STATEMENT
Access to the study dataset, Epic Cosmos, is available through participating healthcare organizations. Details are available at https://cosmos.epic.com/.
FUNDING STATEMENT
SAL is funded in part by a Career Development Award from the National Heart, Lung, and Blood Institute (K01HL171699); SCH and II are funded in part by Career Development Awards from the Eunice Kennedy Shriver National Institute of Child Health and Human Development (K23HD109426; K12HD103084). The content is solely the responsibility of the authors and does not necessarily represent the official views of the NIH.
CONFLICT OF INTEREST DISCLOSURE
KFH reports being an investigator on grants to her institution from UCB, Takeda and GSK for regulatory-mandated studies, unrelated to this work.
ETHICS APPROVAL STATEMENT
This study was determined to not be human subjects research by the Stanford Institutional Review Board.
SYNOPSIS
- Study question: The study sought to develop replicable steps for researchers to create longitudinal, linked maternal-infant cohorts using the Epic Cosmos electronic health record (EHR) dataset, assess completeness of key variables, evaluate potential selection bias with sequential restrictions for longitudinal healthcare encounters, and provide an example analysis.
- What’s already known: Epic Cosmos is a relatively new dataset with high potential for perinatal epidemiologic research because of its large size and granular information from structured EHR data.
- What this study adds: This study provides a rigorous and reproducible approach to creating longitudinal, linked maternal-infant cohorts in Epic Cosmos and found overall high completeness of key variables, and high representativeness of the United States. Cohort characteristics did not meaningfully change with longitudinal cohort selection.
COMMENT
This study demonstrated replicable steps for longitudinal, linked maternal-infant cohort creation using the Epic Cosmos dataset, found low missingness of key variables, and did not find evidence of selection bias with longitudinal cohort selection. In an applied analytical example using the cohort to replicate a known association, we found that high SBP (≥140 mm Hg) in the first trimester was associated with approximately 20-30% higher risk of developing preeclampsia among individuals with chronic hypertension. This example shows the utility of Cosmos for perinatal epidemiologic research questions that benefit from a very large, generalizable U.S.-based sample and utilize information recorded in structured EHR.
The Epic Cosmos maternal-infant cohort was found to be highly representative of the United States. Comparing the Cosmos 2023-2024 linked birth cohort to national birth certificate data from 2023,15 45% vs 41% lived in the South, 24% vs 20% in the Midwest, 17% vs 16% in the Northeast, and 14% vs 21% in the West. Racial-ethnic composition was also comparable in the Cosmos and birth certificate cohorts, with the largest groups being 46% vs 50% non-Hispanic White, 22% vs 26% Hispanic/Latino, and 15% vs 14% non-Hispanic Black.15 The prevalences of common conditions during pregnancy, including gestational diabetes, anemia, and depression, were similar to those reported in other large studies in the United States.16–19 Diagnoses in EHR data may be prone to overreporting, such as coding for the purpose of ordering a diagnostic test, and improved phenotyping of perinatal conditions by Cosmos users for accurate identification of conditions and their onset is an important area of work that will be widely beneficial.2 We also encourage researchers to apply filters that restrict time windows for the diagnosis during pregnancy and differentiate mutually exclusive conditions (e.g., preexisting diabetes and gestational diabetes.)
Data completeness in the Epic Cosmos maternal-infant cohort was found to be high overall. Missingness was less than 1% for key perinatal characteristics often derived from birth certificates and unavailable in claims datasets (e.g., parity, birthweight, Apgar score, rurality). Missingness was higher (∼10%) for vital signs and laboratory results routinely measured at delivery admission (blood pressure and hemoglobin), and highest (∼25%) for racial-ethnic group and BMI at delivery. As demonstrated in our example analysis, we would encourage researchers to use missing data techniques in their analyses with Cosmos to reduce the risk of bias.
Sequential restrictions for longitudinal cohort selection across the prenatal, perinatal, and neonatal periods reduced cohort size but did not indicate that selection bias was induced, which is reassuring. However, researchers should be aware that longitudinal cohort selection will exclude certain patient groups (e.g., patients with delayed or no prenatal care or those who switch healthcare organizations). Longitudinal restrictions did reduce cohort size considerably—from approximately 2.5 million pregnancies in the linked maternal-infant cohort to fewer than 500,000 pregnancies with longitudinal care from the first trimester through infant follow-up care. This reduction was likely driven by individuals who had a delivery at a Cosmos-participating healthcare organization but received prenatal or infant follow-up care at a healthcare organization that does not participate in Cosmos. Further, the numer of source data organizations in Cosmos increases over time as more and more organizations adopt Epic EHR systems. Researchers should be aware of this and take steps to mitigate induced bias, such as by restricting to source organizations with data across a full study period when conducting trend analyses.
Additional findings for researchers to note is that restriction to those with prenatal care and delivery encounters increased the prevalence of some comorbidities (e.g., antenatal depression from 12% to 17%). Further, restriction to those with infant follow-up care reduced the prevalence of extremely preterm birth, very low birthweight, and very low 5-minute Apgar score; these differences may reflect the exclusion of in-hospital neonatal deaths and transfer of high-risk newborns outside of Cosmos-participating organizations with this cohort restriction. We limited our study to births with over one year of follow-up data, which is an important consideration for studies examining outcomes of high-risk newborns, who will typically have long hospitalizations and may require hospital transfer.
This study has limitations. This initial study only included pregnancies that ended in a live birth and an area of future work is developing a robust approach to identify non-live births including stillbirths, spontaneous abortions and pregnancy terminations. This approach will be distinct and more complex as non-live births would not be captured in the BirthFact table and may not be recorded in the PregnancyFact table, depending on the types of any healthcare services received during pregnancy and the loss. Another important consideration for our results is that we did not place restrictions on variables, such as removing outlier values or requiring multiple records to confirm a diagnosis.
This was an intentional decision to make the cohort steps useful to a broad set of researchers, who would make such decisions in the analytical stage. For example, it would be possible in Cosmos for a researcher to require both a diagnosis of gestational diabetes and a positive 3-hour glucose tolerance test. Finally, it is important for researchers to know that Cosmos contains structured EHR data, including demographic information, vital signs, diagnoses, procedures, medications prescribed and administered, and laboratory test results. However, not all structured EHR data are currently available, including types of flowsheets and laboratory results that appear as a scanned document in a chart. Unstructured EHR data, such as clinical notes, are also not available.
In this study, we presented a rigorous and reproducible approach to creating longitudinal, linked maternal-infant cohorts in Epic Cosmos—a relatively new EHR dataset with a very large sample size and granular information from structured EHR data. Our findings demonstrate overall high completeness of key variables, high representativeness of the United States, and characteristics that do not meaningfully change with longitudinal cohort selection. We demonstrated the utility of the cohorts by analyzing the association between a vital sign measurement (systolic blood pressure) and a clinical outcome (preeclampsia superimposed on chronic hypertension). Overall, the study suggests that Epic Cosmos is a highly valuable data resource for perinatal epidemiologic research.