Import history from FitNotes, Strong, Hevy and Apple Health

Losing years of logging is the thing that stops people trying another
tracker, so Settings -> Data -> Import from another app now reads their
exports directly.

All of these ship the same thing in a different dialect: one row per set
with a date, an exercise name and some mix of weight/reps/distance/time.
So the parser builds a column map from the header rather than assuming
positions, and a new app is usually a few header aliases. Verified
against real exports from Strong (1903 sets) and Hevy, both FitNotes
column layouts, and an Apple Health body-mass extract.

Exercise matching is the part that decides whether this is useful.
Parenthetical qualifiers and BB/DB shorthand are normalised, names are
compared as an order-independent bag of words, and a curated table maps
the plain names people actually log onto the dataset's qualified ones -
without it, 'Squat' resolved to 'weighted squat' and 'Leg Press' to
'smith leg press'. Where a name stays genuinely ambiguous it is left
unmatched and becomes a custom exercise rather than guessed at: filing
years of training under the wrong lift is worse than a name the user can
see and fix. Nothing in the file is ever dropped.

A summary sheet shows workouts, sets, matches, misses and any unit
conversion before anything is written, and merging skips days that
already have data, so importing twice - or from two apps - never
duplicates a workout.
This commit is contained in:
Duarte Santos committed 2026-07-23 14:50:36 +02:00
1 parent fac45f9af9
commit 389315625c
16 files changed
+820 -13

No files matched your search

+8 -1
View File
@@ -7,7 +7,7 @@ import { webauthnOK, passkeyLogin, passkeyRegister, IS_ANDROID } from '../lib/ap
import { pushSupported, enablePush, disablePush, sendTestPush } from '../lib/push.js'
import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
import { DEMO, REPO } from '../lib/demo.js'
import { loadStarterPlan, confirmSheet } from '../sheets.jsx'
import { loadStarterPlan, confirmSheet, importFromApp } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
import { Section, Row, SelectRow, Switch, Segmented, Button, TextField } from '../components/ui.jsx'
@@ -18,6 +18,7 @@ export default function Settings() {
const { update, replaceState, setUser, pullState, pushState, signOut, resetDemo } = useStore()
const toast = useUI(s => s.toast)
const fileRef = useRef(null)
const importRef = useRef(null)
const doExport = () => {
const blob = new Blob([JSON.stringify(S, null, 2)], { type: 'application/json' })
@@ -128,10 +129,16 @@ export default function Settings() {
<Section title={t('Data')}>
<Row icon="download" iconTint="var(--blue)" title={t('Export backup (JSON)')} accessory="chevron" onClick={doExport} />
<Row icon="upload" iconTint="var(--blue)" title={t('Import backup')} accessory="chevron" onClick={() => fileRef.current.click()} />
<Row icon="shuffle" iconTint="var(--teal)" title={t('Import from another app')}
subtitle={t('FitNotes, Strong, Hevy — or body weight from Apple Health')}
accessory="chevron" onClick={() => importRef.current.click()} />
<Row icon="sparkles" iconTint="var(--acc)" title={t('Load starter plan (PPL)')} accessory="chevron" onClick={loadStarterPlan} />
<Row icon="trash" iconTint="var(--red)" title={t('Reset everything')} danger onClick={() => confirmSheet({ title: t('Reset everything?'), message: t('Deletes your plan, workouts and body weight on this device. This cannot be undone.'), confirmText: t('Delete everything'), danger: true, onConfirm: () => { replaceState(JSON.parse(JSON.stringify(DEF)), true); nav('/home'); toast(t('All data reset')) } })} />
</Section>
<input ref={fileRef} type="file" accept=".json,application/json" style={{ display: 'none' }} onChange={doImport} />
{/* Reset after reading so picking the same file twice still fires onChange. */}
<input ref={importRef} type="file" accept=".csv,.xml,text/csv,text/xml" style={{ display: 'none' }}
onChange={ev => { const f = ev.target.files[0]; if (f) importFromApp(f); ev.target.value = '' }} />
<Section title={t('Tip')}>
<Row icon="lightbulb" iconTint="var(--yellow)"