Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theoretick/0966d0bc8fc764a103544aa65a07f947 to your computer and use it in GitHub Desktop.
Save theoretick/0966d0bc8fc764a103544aa65a07f947 to your computer and use it in GitHub Desktop.
Access Baby Tracker Data from Latest Backup on a Mac

Access Nighp Baby Tracker Data from Latest Backup on a Mac

Software Used

  • iTerm (and the utilities it offers) - You can use Terminal or even Finder with Archive Utility to extract data
  • sqlite3 cli - You can use any client that supports sqlite to browse the database

Pre-reqs

  • You must have iCloud Sync enabled in the Baby Tracker app
  • You must be signed into iCloud on you Mac
  • If you want the latest data from Baby Tracker, I’d recommend you do a manual backup from the Baby Tracker app

You can find information on Baby Tracker synchronization and backups at Baby Tracker.

Steps

1. Copy and Extract

In iTerm, run the following command to copy /latest/ and extract the latest backup to a folder called babytracker in the current working directory (pwd).

ls -dt ~/Library/Mobile\ Documents/iCloud\~com\~nighp\~babytracker/Documents/backups/* | \
head -1 | \
xargs -I{} cp {} ./babytracker.zip && \
unzip babytracker.zip -d babytracker && \
cd babytracker

Quick rundown on what each line does

  1. List the contents (backups) of the Baby Tracker backups folder with the the full path of the file, -d and ordered by time -t
  2. Take the first line of the output from 1
  3. Copy the file output from 2 into a file name babytracker.zip
  4. Unzip the babytracker.zip to a folder called babytracker
  5. Change the current working directory to babytracker

2. Connect to the sqlite db.

Part of the backup contents is a sqlite database titled EasyLog.db. We can connect to that database and access the data we have recorded.

Here is an example query to see the nursings that have notes from most to least recent

sqlite3 EasyLog.db "SELECT * FROM Nursing WHERE note IS NOT NULL ORDER BY Time DESC ;"

Check out Command Line Shell For SQLite for more you can do to explore the database and extract data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment