Skip to content

Specification: Bodybuilding - Zoro Sync (Z2 Orchestrated)

Owner: Zoro (fitness) + Jimmy Neutron (infrastructure) Status: DESIGNED — pending Z2 container deployment Source file: /Users/nnamdi/Library/CloudStorage/OneDrive-Personal/hinata-onedrive/Bodybuilding - Zoro Sync.xlsx


Architecture: Z2-Orchestrated Excel Reconciliation

OneDrive syncs the Excel tracker between phone and Mac. Z2 orchestrates the reconciliation pipeline — no Mac dependency at runtime.

Pipeline

┌─────────────────────────────────┐
│ Phone (OneDrive app)            │
│ Michael logs session in Excel   │
└──────────────┬──────────────────┘
               │ (OneDrive sync)

┌─────────────────────────────────┐
│ Mac (CloudStorage mount)        │
│ ~/Library/CloudStorage/         │
│   OneDrive-Personal/            │
│   hinata-onedrive/              │
│   Bodybuilding - Zoro Sync.xlsx │
└──────────────┬──────────────────┘
               │ (NFS or rsync to Z2)

┌─────────────────────────────────┐
│ Z2 — zoro-sync container        │
│ 1. Detect file change           │
│ 2. reconcile_gym_data.py        │
│ 3. Emit fitness.session_logged  │
│ 4. Append reconciled data       │
└────────────────────────────��────┘

Data flow

  1. Michael logs a gym session in Excel on phone (OneDrive)
  2. OneDrive syncs Bodybuilding - Zoro Sync.xlsx to Mac CloudStorage mount
  3. Z2 (zoro-sync container) detects the file change via periodic poll or NFS watch
  4. reconcile_gym_data.py runs:
    • Loads Excel (Input tab, GymData table)
    • Loads Apple Health data (CSV from parse-apple-health.py if available)
    • Applies reconciliation rules (see below)
    • Appends reconciled rows back to Excel
  5. Event emitted: fitness.session_logged → ct100 PostgreSQL events table
  6. Optional: fitness.pr_set if a personal record detected

Reconciliation rules (deterministic)

FieldPriority sourceReason
WeightApple Health (auto)Scale auto-reports
RPE / IntensityExcel (manual)Subjective — only Michael knows
Sets / RepsExcel (manual)Apple Watch doesn't track rep counts
DateExcel (manual)Session date as logged
Exercise nameExcel (manual)Canonical exercise taxonomy

Prerequisites

  • [ ] Bodybuilding - Zoro Sync.xlsx formatted as Excel Table named GymData
  • [ ] Column mapping defined (Excel ↔ Apple Health)
  • [ ] Z2 zoro-sync container deployed (Debian 12 LXC, Python 3.11, openpyxl, pandas)
  • [ ] NFS mount or rsync from Mac OneDrive → Z2 working
  • [ ] update-bodybuilding.py ported to Z2 container (currently referenced in event-kinds)

Z2 container spec (zoro-sync)

yaml
container: zoro-sync
type: LXC (Debian 12)
dependencies: python3.11, openpyxl, pandas
mount: /mnt/onedrive (NFS from Mac CloudStorage or rsync target)
scripts:
  - reconcile_gym_data.py     # Core reconciliation logic
  - update-bodybuilding.py    # Event emission to ct100 postgres
cron: "*/15 * * * *"          # Check for file changes every 15 min
events_emitted:
  - fitness.session_logged
  - fitness.pr_set
repo: hinata-z2 (zoro-sync/ folder)

Tool signature

python
def reconcile_and_append(manual_df, auto_df, rules):
    """
    1. Merge manual_df and auto_df on 'Date'.
    2. Apply conflict rules (weight_final = auto_weight if exists).
    3. Append resulting rows to Excel 'GymData' table via openpyxl.
    """

See also: supreme-court/runtime/event-kinds · reference_approved-ip-addresses · federation/colonel_saitama-foundation_zoro-fitness_context