Learn R Programming

cliot (version 1.0.0)

calculate_pregnancy_due_date: Pregnancy Due Dates Calculator

Description

Calculates the Estimated Due Date (EDD) and current gestational age based on various clinical inputs. The calculator supports methods using the Last Menstrual Period (LMP), Date of Conception, or IVF Transfer dates (3-day or 5-day).

Usage

calculate_pregnancy_due_date(input_date, method = "LMP", cycle_length = 28)

Value

A list containing:

Estimated_Due_Date

The calculated date of delivery (40 weeks).

Gestational_Age

The current gestational age in weeks and days based on the system date.

Current_Trimester

The current trimester (1st, 2nd, or 3rd).

Arguments

input_date

Date or String (YYYY-MM-DD). The reference date corresponding to the chosen method (e.g., the date of the LMP).

method

String. The method used for calculation. Options: "LMP": Last Menstrual Period (Standard Naegele's Rule). "Conception": Date of conception/ovulation. "IVF_3_Day": Date of 3-day embryo transfer. "IVF_5_Day": Date of 5-day embryo transfer.

cycle_length

Numeric. The length of the patient's menstrual cycle in days. Only applicable when method is "LMP". Defaults to 28.

References

American College of Obstetricians and Gynecologists. Method for Estimating Due Date. Committee Opinion No. 700. Obstet Gynecol. 2017;129(5):e150-e154.

Examples

Run this code

# Example 1: Standard LMP (28 day cycle)
calculate_pregnancy_due_date("2023-01-01", "LMP")

# Example 2: Long Cycle (30 days)
calculate_pregnancy_due_date("2023-01-01", "LMP", 30)

# Example 3: IVF 5-Day Transfer
calculate_pregnancy_due_date("2023-01-15", "IVF_5_Day")

Run the code above in your browser using DataLab