CLI Usage

Testing / QA

Run these commands to confirm StructaMed works end-to-end (recommended before submission).

# Run full test suite
cargo test --all

# One-command smoke test
./scripts/smoke.sh

# Strict fixtures must exit 0
cargo run -- selftest --fixtures tests/fixtures/clean/soap --template soap --strict
cargo run -- selftest --fixtures tests/fixtures/clean/hp --template hp --strict
cargo run -- selftest --fixtures tests/fixtures/clean/discharge --template discharge --strict

Note: Product name is StructaMed; the CLI command/binary name is clinote.

clinote parse --input note.txt --format soap \
  --out out.json --out-format json --bundle auto

clinote batch --input-dir notes --glob "*.txt" \
  --format hp --out-dir outputs --out-format csv

clinote sample --out-dir samples --n 6 --bundles 2

clinote validate --config clinote.toml

CLI Commands

# Validate a note (strict mode + exit code 2 on errors)
clinote validate notes.txt --template soap --strict

# Preview detected sections with line counts
clinote preview notes.txt --template hp

# Selftest a directory (recursive) and export outputs
clinote selftest --fixtures tests/fixtures --template soap --out selftest_outputs

# Selftest with glob + JSON summary
clinote selftest --fixtures "tests/fixtures/*.txt" --template discharge --json

Config reference

[formats.soap]
section_order = ["Subjective", "Objective", "Assessment", "Plan"]

heading_aliases = { "Hx" = "PMH", "Dx" = "Assessment" }

enable_fallback_heuristics = true

[bundle]
mode_default = "auto"
delimiters = ["----- NOTE -----", "=== VISIT ==="]

[csv]
layout = "wide"

glob_default = "*.txt"

Bundle mode

Interactive mode

Use --interactive with parse to:

Complex bundles: issues and mitigations

Warnings

Warnings are serialized in JSON output and included in batch reports. They include codes, severity, and line spans.