Skip to contents

This function estimates the pregnancy start and end dates for Commercial Claims or Medicaid MarketScan patients and applies hierarchy logic to resolve conflicts. It processes the data through multiple stages, resolving conflicts for ectopic, abortion, stillbirth, preterm, delivery, unclassified loss, postpartum, and trimester outcomes.

Usage

apply_pregnancy_start_end_hierarchy(outcome_hierarchy_final)

Arguments

outcome_hierarchy_final

A data frame containing patient data with variables such as enrolid, svcdate, code, outcome, trimester_code_clean, and others.

Value

A data frame with the applied pregnancy start and end hierarchy logic, containing variables such as enrolid, svcdate, code, outcome, trimester_code_clean, and others.

Examples

if (FALSE) {
trimester_hierarchy_final <- apply_trimester_hierarchy(patients)
outcome_hierarchy_final <- apply_outcome_hierarchy(trimester_hierarchy_final)
pregnancy_data_cleaned <- apply_pregnancy_start_end_hierarchy(outcome_hierarchy_final)
}