This repo contains one Jupyter Notebook—GAP - Share.ipynb—that shows, step-by-step, how to predict birth weight at delivery from earlier-pregnancy ultrasound scans using the Gestation-Adjusted Projection (GAP) method and several published fetal-growth curves.
-
Reusable functions inside the notebook
make_interp* – builds a per-curve linear interpolatorcompute_predicted_bw_interp* – applies the GAP formula to each record
-
Median fetal weight tables for
- Brenner
- WHO General
- WHO Sex-specific
- INTERGROWTH-21
- GAP - Share.ipynb
- README.md
Before call the function compute_predicted_bw_interp
- Build your own variable of "ultra_days" and "deliv_days" based on your own dataset
- The estimated fetal weight by ultrasound in my dataset is called "f_weight", you can either change you variable to this name or change the function variable name before call it
- Same thing for the sex of the infants Then Call the function: There is a sample code to call the function: merged['predicted_bw_brenner'] = merged.apply(compute_predicted_bw_interp, axis=1,args=('brenner',)).astype("Int64") df["create new column of predicted bw"] = df.apply(compute_predicted_bw_interp,axis=1,args=('fetal curve you want to use',))
- Add a {week:int → median:int} dictionary at the top of the notebook.
- Pass the new curve name to compute_predicted_bw_interp. That’s it.