HCG Doubling Calculations
HCG Doubling Calculations
The HCG AI application tracks the progression of Human Chorionic Gonadotropin (β-hCG) levels to provide insights into early pregnancy development. By analyzing the rate at which HCG levels increase over time, the system identifies trends that may indicate a healthy progression, a potential miscarriage, or an ectopic pregnancy.
Understanding Doubling Time
In a typical early pregnancy, HCG levels generally double every 48 to 72 hours. As the pregnancy progresses and HCG levels exceed 6,000 mIU/mL, the doubling rate often slows down.
The application calculates the Doubling Time (T₂) using the following logarithmic formula:
T₂ = (t₂ - t₁) * log(2) / [log(HCG₂) - log(HCG₁)]
- t₁, t₂: The timestamps of the first and second blood tests.
- HCG₁, HCG₂: The HCG values (mIU/mL) at those respective times.
Logging HCG Entries
To generate doubling calculations, you must log at least two HCG blood test results.
Via the Web Interface
- Navigate to the Home tab.
- Enter the HCG Value (mIU/mL) and the Date the blood was drawn.
- (Optional) Enable Advanced details to provide your Last Menstrual Period (LMP) or Ovulation Date. This allows the AI to calculate the "Expected" HCG range for your specific gestational age.
- Click Save Entry.
Via the API
You can programmatically add entries to the tracking engine:
Endpoint: POST /api/hcg-entries
Request Body:
{
"date": "2023-10-25",
"hcgValue": 450,
"units": "mIU/mL",
"lmpDate": "2023-09-20",
"cycleLength": 28,
"notes": "First blood test"
}
Analysis & Risk Assessment
Once multiple entries exist, the system generates an analysis within the Analysis tab. The "Medical Risk Assessment" engine categorizes results into three levels:
| Risk Level | Description | Typical Indication | | :--- | :--- | :--- | | LOW | HCG is doubling within the 48-72 hour window. | Normal intrauterine pregnancy progression. | | MEDIUM | Doubling time is slower than 72 hours but still increasing. | May require closer monitoring or an early ultrasound to confirm location. | | HIGH | HCG levels are declining, plateauing, or rising extremely slowly. | Potential risk of biochemical pregnancy, miscarriage, or ectopic pregnancy. |
Advanced Contextual Adjustments
The calculation logic becomes more precise when providing "Advanced Details":
- LMP & Cycle Length: If you provide your Last Menstrual Period and average cycle length (typically 21–45 days), the app calculates your Gestational Age.
- Ovulation Date: If known, this is the most accurate metric for HCG comparison, as it bypasses the variability of follicular phase lengths.
- Z-Scores: The system calculates Z-scores to compare your specific HCG value against clinical median values for your exact day of pregnancy.
Usage Example: Retrieving Calculations
To fetch the history and let the frontend visualize the doubling curve:
async function getHcgProgression() {
const response = await fetch('/api/hcg-entries');
const entries = await response.json();
// Sort entries by date to visualize the trend
const sortedEntries = entries.sort((a, b) => new Date(a.date) - new Date(b.date));
console.log('HCG Trend:', sortedEntries);
}
[!IMPORTANT] Medical Disclaimer: These calculations are for educational and tracking purposes only. HCG doubling rates vary significantly between individuals. All results should be reviewed by a qualified healthcare professional.