AppleHealth2CSV is a personal ETL tool and reusable Rust framework for transforming personal data into formats that are easy to inspect, research, and import into other workflows. The default pipeline processes Apple Health exports and writes grouped CSV files into a ZIP archive. I created it to make apple health exports more manageable to manually upload to chatgpt chats.
The command-line default is intentionally still Apple Health:
gpt-os <INPUT_FILE> <OUTPUT_ZIP>Internally, the pipeline is now composed from source, transform policy, and sink components so future data sources can be added without making Apple Health the whole application architecture.
- Default Apple Health source for
export.xmlfiles or ZIP archives containingexport.xml. - Explicit pipeline registry with
apple-healthsource andcsv-zipsink defaults. - Materialized grouped engine: extraction streams records, then the engine groups records in memory before writing output.
- Apple Health transform policy for grouping
Recordelements bytype, grouping other elements by name, and sorting date-like records. - Source-neutral record projection so sinks do not require Apple Health records to implement CSV-specific traits.
- Parallel CSV ZIP output with safe encoded entry names and temporary-file persistence before replacing the target archive.
- Strict parse errors by default, with optional tolerant mode that skips malformed records and reports skipped counts.
cargo build --releasegpt-os [OPTIONS] <INPUT_FILE> <OUTPUT_ZIP><INPUT_FILE>: Apple Healthexport.xmlor a ZIP archive containing anexport.xmlmember.<OUTPUT_ZIP>: Destination ZIP archive containing grouped CSV files.
-v, --verbose: Enable verbose logging.--no-metrics: Disable end-of-run metrics on stdout.--source <SOURCE>: Source adapter. Defaults toapple-health.--sink <SINK>: Sink adapter. Defaults tocsv-zip.--tolerant: Skip malformed record-level parse failures and report skipped counts.-h, --help: Show usage information.
gpt-os -v export.zip my_health_data.zipThe runtime path is:
CliShell -> PipelineRegistry -> PipelineSpec -> Extractor -> TransformPolicy -> MaterializedEngine -> RecordProjection -> CsvZipSink
Key modules:
src/pipeline.rs: resolves the default Apple Health CSV ZIP pipeline.src/core.rs: framework traits, materialized engine, extraction events, runtime reports, and error policy.src/transform.rs: transform policy trait for grouping, sorting, and filtering.src/record.rs: source-neutral record projection trait used by sinks.src/apple_health/: Apple Health extraction, records, and transform policy.src/sinks/csv_zip.rs: parallel CSV ZIP sink with safe entry names and temporary-file persistence.
See docs/PROJECT_STRUCTURE.md for the full file map.
cargo fmt --check
cargo check --all-targets
cargo test --all-targets
cargo clippy --all-targets --all-features -- -D warningsThe tests cover the default CLI pipeline, XML-vs-ZIP input equivalence, malformed XML behavior, tolerant mode, safe ZIP entry names, source-neutral record projection, and a synthetic non-Apple framework pipeline.
The Criterion benchmark in benches/flamegraph.rs runs the CLI against a generated synthetic Apple Health-style XML export by default. This keeps benchmark inputs private-data-free while exercising a real-sized pipeline path.
$env:GPT_OS_BENCH_RECORDS = "100000"
cargo bench --bench flamegraphTo benchmark a private local Apple Health export, set GPT_OS_BENCH_INPUT:
$env:GPT_OS_BENCH_INPUT = "C:\path\to\export.zip"
cargo bench --bench flamegraphPrivate Apple Health exports should stay outside source control.
This project is licensed under the MIT License. See LICENSE.