IRIS makes a grand entrance
Alright, let me take you back to October 11, 2024. me, my wife, and a hospital labour room buzzing with nerves and hope. My little girl Iris was on her way, and my wife was powering through contractions, we had this wild idea, to build something, I mean except for the contractions there was nothing much else to do. So I hunched over my laptop, hammering out this code to track the contractions. Itâs not the slickest thing Iâve ever written, and itâs definitely not some utopian masterpiece, but itâs THE best project Iâve ever done. Someday, Iris might read this and get a kick out of her dad and mom writing numbers out while she was making her grand entrance.
Why I Even Started This
Weâre in the labour room, my wifeâs gripping my hand, and the doctors asked us to time the contractions at first, how long they last, how far apart they are. Itâs chaos, and Iâm thinking, âI can do this better.â Iâd been jotting down times on my phone, and I figured, why not throw it into a machine and see the patterns? So, between reassuring my wife and pacing the room, I built a contraction trackerâstart times, durations, frequencies..all plotted out. It kept me sane, gave us data, and now itâs a keepsake from Irisâs first day.
What I Was Working With
I had a list of timestamps..66 of them..starting at 13:03:15 on October 11, 2024, and running past 17:56 (plus one outlier at 21:31 I trimmed later). These were when each contraction kicked off, down to microseconds because, well, precision felt right. Then, durationsâhow long each one lasted in seconds, from a quick 2.4 to a hefty 244. And frequenciesâtime between starts, calculated as:
where tit_it_i is the start time of contraction ( i ). First oneâs None since thereâs no âbefore.â I dumped this into a dictionary and turned it into a pandas DataFrameâdfâwith Start Time as the index, parsed as datetimes with pd.to_datetime.
Simple but Real Numbers
No fancy equations here, just basic arithmetic and some time juggling. For duration, itâs straight-up secondsâhow long my wife felt each squeeze. Frequencyâs the gap between starts, so for contraction ( I ):
To see patterns, I grouped contractions into 10-minute buckets. Thatâs just flooring the timestamps to the nearest 10 minutesâthink ât/600ââ 600, if youâre converting seconds from a base time, but pandas does it with index.floor('10T'). Then, I counted how many landed in each bucket:
Thatâs itâsimple sums and differences, but enough to spot trends when youâre bleary eyed and counting minutes.
Messy Coding
I used pandas for data wrangling and matplotlib for graphs. Loaded the data into a DataFrame, set the index, and plotted three things first:
fig, ax = plt.subplots(3, 1, figsize=(10, 10))
ax[0].plot(df.index, df['Duration (seconds)'], marker='o', linestyle='-', color='b')
ax[1].plot(df.index, df['Frequency (seconds)'], marker='o', linestyle='-', color='g')
ax[2].bar(contractions_per_10min.index, contractions_per_10min, width=0.008, color='r')
Then, I added a fourth plot to show each contractionâs span:
ax[3].scatter(df.index, [1] * len(df), color='b')
for i, row in df.iterrows():
ax[3].hlines(y=1, xmin=i, xmax=i + pd.to_timedelta(row['Duration (seconds)'], unit='s'), color='b')
Itâs rough, written fast between contractions, but it worked. The first three plots were duration over time, frequency over time, and a bar chart of contractions per 10 minutes. The fourth was a timelineâdots for starts, lines for how long each lasted. I stretched the x-axis with set_xlim to fit the longest duration. Not elegant, but it got the job done.
What I Saw
Hereâs where it gets real:

Top Plot (Duration): Blue line with dots, each contractionâs length in seconds. It starts around 49, dips to 2.4 (a blip!), then climbs later, some hitting 200+. No steady pattern, just labour doing its thing.
Second Plot (Frequency): Green line, time between starts. Early on, itâs erraticâ98 seconds, then 371, back to 51. Later, it tightens up, some as low as 25 secondsâshowing things speeding up.
Third Plot (10-min Count): Red bars, how many contractions per 10 minutes. Starts at 2-3, peaks around 5-6 later, then drops. A clear ramp up as we got closer.
Bottom Plot (Timeline): Blue dots and lines, each dotâs a start, each lineâs the duration. You can see them bunching up toward the end, durations stretching out.
The Story in the Numbers
The dataâs raw, just 66 contractions from 13:03 to 17:56âbut it paints a picture. Early on, durations bounced around 40-60 seconds, frequencies all over (50 to 370 seconds). By 15:00-16:00, frequencies dropped below 200 seconds more often, and durations crept upâsome past 100, even 244. The 10-minute count peaked around 16:00-17:00, hitting 6 contractions, then eased off. That fourth plot showed it bestâgaps shrinking, lines lengthening..Iris was coming fast.
What It Meant to Me
This wasnât just code..it was us, in that room, waiting for Iris. The plots showed labour picking up, fewer minutes between, longer squeezes. Was it perfect? Of course not, I wrote it half panicked, hands a bit shaking. Couldâve smoothed the data, added stats like mean duration: or variance , but I didnât need that then. It told us what mattered..things were moving, and fast.
For Iris someday: "hello Iris, this is your dad at one of his most stressed and happiest. Itâs not fancy, but itâs yours. I tracked your momâs strength, and you arrivedâperfect. Best project ever? Of course, because itâs tied to you."
Why Itâs Special
Iâve built plenty, a lot of mathematical models.. control systems of small satellites in geostationary orbits, aerodynamic lift capability in Martian atmosphere etc..but this? This was real-time, real-life, with my wifeâs courage and Irisâs first cry as the payoff. Maybe Irisâll tweak it one day, add some fany new spin to it or whateverâs hot in 2040. For now, itâs our little timestamped memory.