Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

fix(import): read Strong's measurements export as body weight

Conal Mullan77ceb4bfc812
diff --git a/docs/DATA_IMPORTS.md b/docs/DATA_IMPORTS.md
index cf53ca5a8..136b6fdb5 100644
--- a/docs/DATA_IMPORTS.md
+++ b/docs/DATA_IMPORTS.md
@@ -53,7 +53,9 @@ the result and pick `export.xml` under **Import from another app**. The file is
megabytes; openGym reads only the body-weight records from it, in whatever unit each one was saved
in, and keeps one weigh-in per day. Days that already have a weigh-in are left alone.
-A CSV with a date column and a weight column works the same way.
+A CSV with a date column and a weight column works the same way, and so does Strong's
+measurements export (Settings → Export Data, the file with *Measurement Type* and *Value*
+columns): only its weight rows are read, each in the unit it was logged in.
## Sharing a plan
diff --git a/frontend/src/lib/import-bodyweight.test.js b/frontend/src/lib/import-bodyweight.test.js
index 10f853431..ab35076e8 100644
--- a/frontend/src/lib/import-bodyweight.test.js
+++ b/frontend/src/lib/import-bodyweight.test.js
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { parseBodyweight } from './import-csv.js'
+import { parseBodyweight, parseImport } from './import-csv.js'
const record = (day, value, unit) => `<Record type="HKQuantityTypeIdentifierBodyMass" unit="${unit}" value="${value}" startDate="2026-09-${day} 08:00:00 +0000"/>`
@@ -25,3 +25,33 @@ describe('Apple Health body-weight units', () => {
expect(parseBodyweight(record('01', 80, 'kg')).converted).toBe(false)
})
})
+
+describe('Strong measurements export', () => {
+ // Header and rows as Strong 6 writes them: newest first, one measurement per row.
+ const STRONG = [
+ 'Date,Measurement Type,Value,Unit,Source',
+ '2026-10-12 08:15:25,Weight,114.75,kg,Strong',
+ '2026-10-11 10:54:54,Weight,114.85,kg,Strong',
+ '2026-10-11 10:55:10,Body Fat Percentage,28.5,%,Strong',
+ '2026-10-09 07:30:09,Weight,253,lbs,Strong',
+ ].join('\n')
+
+ it('reads the weight rows and nothing else', () => {
+ const parsed = parseImport(STRONG, { unit: 'kg' })
+ expect(parsed.kind).toBe('bodyweight')
+ expect(parsed.source).toBe('Strong')
+ expect(parsed.bodyweight.map(b => b.d)).toEqual(['2026-10-09', '2026-10-11', '2026-10-12'])
+ expect(parsed.bodyweight.map(b => b.w)).toEqual([114.8, 114.9, 114.8])
+ })
+
+ it('converts each row from its own unit', () => {
+ const parsed = parseBodyweight(STRONG, { unit: 'lb' })
+ expect(parsed.bodyweight.find(b => b.d === '2026-10-09').w).toBe(253)
+ expect(parsed.fileUnit).toBe('kg / lb')
+ expect(parsed.converted).toBe(true)
+ })
+
+ it('a file with no weight rows is not a body-weight file', () => {
+ expect(parseBodyweight('Date,Measurement Type,Value,Unit,Source\n2026-10-11,Waist,98,cm,Strong').error).toBe('unrecognised')
+ })
+})
diff --git a/frontend/src/lib/import-csv.js b/frontend/src/lib/import-csv.js
index 193927977..d523a24af 100644
--- a/frontend/src/lib/import-csv.js
+++ b/frontend/src/lib/import-csv.js
@@ -103,6 +103,9 @@ const COLUMNS = [
// shared alias list handed the session note's column to nobody. Hevy calls it the workout's
// description.
['workoutNote', ['workout notes', 'workout note', 'description']],
+ // Strong's measurements export (body weight among other measurements).
+ ['measurementType', ['measurement type']],
+ ['value', ['value']],
['note', ['comment', 'comments', 'notes', 'note', 'exercise notes']],
]
@@ -704,7 +707,7 @@ export function parseWorkoutCSV(text, { unit = 'kg', customEx = [] } = {}) {
export function parseBodyweight(text, { unit = 'kg' } = {}) {
const s = String(text)
const out = new Map() // iso date -> { w, t } (one weigh-in per day, the last)
- let fileUnit = ''
+ let fileUnit = '', source = 'Apple Health'
if (s.includes('HKQuantityTypeIdentifierBodyMass')) {
const re = /<Record[^>]*type="HKQuantityTypeIdentifierBodyMass"[^>]*>/g
@@ -729,6 +732,22 @@ export function parseBodyweight(text, { unit = 'kg' } = {}) {
const rows = parseCSV(s)
if (rows.length < 2) return { error: 'empty' }
const map = mapHeader(rows[0])
+ // Strong's measurements export: one row per measurement, "Measurement Type" saying which
+ // ("Weight", "Body Fat Percentage", a waist…), the number in "Value" and its own "Unit".
+ if (map.measurementType !== undefined && map.value !== undefined && map.date !== undefined) {
+ source = 'Strong'
+ for (let i = 1; i < rows.length; i++) {
+ const r = rows[i]
+ if (String(r[map.measurementType] ?? '').trim().toLowerCase() !== 'weight') continue
+ const when = parseWhen(String(r[map.date] ?? ''))
+ const w = num(r[map.value])
+ const u = String(r[map.weightUnit] ?? '').trim().toLowerCase()
+ const recUnit = u.startsWith('lb') ? 'lb' : u.startsWith('kg') ? 'kg' : ''
+ if (!when || !w || !bodyOk(w, recUnit || unit)) continue
+ out.set(when.d, { w, unit: recUnit, t: new Date(when.d).getTime() + (when.t ?? 0) })
+ }
+ return finishBodyweight(out, unit, source)
+ }
// a weight-only CSV: whichever weight column it has
const wCol = map.weightKg ?? map.weightLb ?? map.weight
const dCol = map.date ?? map.startTime
@@ -743,6 +762,12 @@ export function parseBodyweight(text, { unit = 'kg' } = {}) {
}
}
+ return finishBodyweight(out, unit, source, fileUnit)
+}
+
+/** The weigh-ins collected per day, converted to `unit` — each in its own record's unit if it
+ * had one, else the file's. */
+function finishBodyweight(out, unit, source, fileUnit = '') {
if (!out.size) return { error: 'unrecognised' }
const units = new Set([...out.values()].map(b => b.unit || fileUnit).filter(Boolean))
fileUnit = [...units].sort().join(' / ')
@@ -756,7 +781,7 @@ export function parseBodyweight(text, { unit = 'kg' } = {}) {
}
const dates = [...out.keys()].sort()
return {
- kind: 'bodyweight', source: 'Apple Health',
+ kind: 'bodyweight', source,
bodyweight: dates.map(d => ({ d, w: conv(out.get(d)), t: out.get(d).t || new Date(d).getTime() })),
fileUnit, converted, from: dates[0], to: dates[dates.length - 1],
}