Skip to main content
fi-fhir docs

Global Options

CLI Reference

Complete reference for the fi-fhir command-line interface.

Global Options

fi-fhir [global-options] <command> [command-options]

Global Options:
  --config FILE       Configuration file path
  --verbose, -v       Enable verbose output
  --quiet, -q         Suppress non-error output
  --json              Output in JSON format
  --help, -h          Show help
  --version           Show version

Commands Overview

CommandDescription
parseParse healthcare messages to semantic events
workflowRun events through workflows
profileManage source profiles
validateValidate profiles and messages
fhirFHIR resource operations
configConfiguration management
serveStart GraphQL API server
subscriptionManage FHIR subscriptions
eventstoreEvent sourcing operations
projectionProjection management
terminologyTerminology database operations
etlETL pipeline for terminology
storageObject storage operations
companionEDI companion guide operations

parse

Parse healthcare messages into semantic events.

Usage

fi-fhir parse [options] [FILE...]

Options

OptionDescription
--format FORMATInput format: hl7v2, csv, edi, cda, fhir
--profile FILESource profile to use
--prettyPretty-print JSON output
--source NAMESource system name
--output FILEOutput file (default: stdout)
--explain-warningsAdd LLM-powered explanations to warnings
--extract-clinicalExtract clinical entities from documents

Examples

# Parse HL7v2 message
fi-fhir parse --format hl7v2 --pretty message.hl7

# Parse with custom profile
fi-fhir parse --format hl7v2 --profile epic_adt.yaml message.hl7

# Parse EDI claim
fi-fhir parse --format edi --pretty claim.x12

# Parse CSV file
fi-fhir parse --format csv --pretty patients.csv

# Parse CDA document
fi-fhir parse --format cda --pretty clinical_doc.xml

# Parse multiple files
fi-fhir parse --format hl7v2 messages/*.hl7 > all_events.json

# Parse with LLM warning explanations
fi-fhir parse --format hl7v2 --explain-warnings --pretty message.hl7

# Extract clinical entities from MDM document
fi-fhir parse --format hl7v2 --extract-clinical mdm_message.hl7

workflow

Run events through workflow routes.

Usage

fi-fhir workflow <subcommand> [options]

Subcommands

workflow run

Execute a workflow on events.

fi-fhir workflow run [options] [EVENT_FILE]
OptionDescription
--config FILEWorkflow configuration file
--dry-runExecute without side effects
--route NAMERun specific route only
# Run workflow on events from stdin
cat events.json | fi-fhir workflow run --config workflow.yaml

# Dry-run mode
fi-fhir workflow run --dry-run --config workflow.yaml events.json

# Run specific route
fi-fhir workflow run --route critical_alerts --config workflow.yaml events.json

workflow validate

Validate workflow configuration.

fi-fhir workflow validate FILE
fi-fhir workflow validate workflow.yaml

workflow simulate

Test workflow with simulated actions.

fi-fhir workflow simulate --config FILE --events FILE

workflow generate

Generate workflow YAML from natural language description using LLM.

fi-fhir workflow generate "DESCRIPTION"
fi-fhir workflow generate --interactive "DESCRIPTION"
OptionDescription
--interactiveInteractive mode for complex workflows
--model MODELLLM model to use
--output FILEOutput file (default: stdout)
# Generate workflow from description
fi-fhir workflow generate "Route critical lab results to the pager system"

# Interactive mode
fi-fhir workflow generate --interactive "Create a workflow for ADT events"

# Save to file
fi-fhir workflow generate "Alert on ICU admissions" --output icu_alerts.yaml

workflow explain

Generate human-readable explanation of a workflow.

fi-fhir workflow explain FILE
OptionDescription
--format FORMATOutput format: markdown, text, json
# Explain workflow in markdown
fi-fhir workflow explain workflow.yaml

# JSON output for programmatic use
fi-fhir workflow explain --format json workflow.yaml

workflow cel

Generate CEL filter expression from natural language.

fi-fhir workflow cel "DESCRIPTION"
OptionDescription
--testTest expression against sample event
--event FILESample event for testing
# Generate CEL expression
fi-fhir workflow cel "patient over 65 with abnormal lab results"

# Test against sample event
fi-fhir workflow cel --test --event sample.json "patient admitted to ICU"

profile

Manage source profiles.

Usage

fi-fhir profile <subcommand> [options]

Subcommands

profile infer

Generate a profile from sample messages.

fi-fhir profile infer [options] FILES...
OptionDescription
--output FILEOutput profile file
--name NAMEProfile name
fi-fhir profile infer --output inferred.yaml samples/*.hl7

profile lint

Check profile for best practices.

fi-fhir profile lint FILE
fi-fhir profile lint my_profile.yaml

validate

Validate profiles and messages.

Usage

fi-fhir validate <subcommand> [options] FILE

Subcommands

validate profile

Validate a source profile.

fi-fhir validate profile FILE

validate message

Validate a healthcare message.

fi-fhir validate message --format FORMAT [--profile FILE] FILE

fhir

FHIR resource operations.

Usage

fi-fhir fhir <subcommand> [options]

Subcommands

fhir validate

Validate FHIR resources.

fi-fhir fhir validate [options] FILE
OptionDescription
--profile NAMEProfile to validate against (e.g., us-core)
--strictEnable strict validation
fi-fhir fhir validate patient.json
fi-fhir fhir validate --profile us-core bundle.json

fhir generate

Generate FHIR from events.

cat events.json | fi-fhir fhir generate --profile us-core

config

Configuration management.

Usage

fi-fhir config <subcommand>

Subcommands

config show

Display current configuration.

fi-fhir config show

config validate

Validate configuration file.

fi-fhir config validate [FILE]

config env

Show environment variable mappings.

fi-fhir config env

serve

Start the GraphQL API server.

Usage

fi-fhir serve [options]

Options

OptionDescription
--host HOSTBind address (default: 0.0.0.0)
--port PORTPort number (default: 8080)
--tls-cert FILETLS certificate file
--tls-key FILETLS key file
# Start server
fi-fhir serve --port 8080

# With TLS
fi-fhir serve --port 8443 --tls-cert cert.pem --tls-key key.pem

subscription

Manage FHIR subscriptions.

Usage

fi-fhir subscription <subcommand> [options]

Subcommands

SubcommandDescription
listList active subscriptions
status IDGet subscription status
createCreate new subscription
delete IDDelete subscription
pause IDPause subscription
resume IDResume subscription
serveStart subscription receiver
validateValidate subscription config
testTest subscription connectivity

eventstore

Event sourcing operations.

Usage

fi-fhir eventstore <subcommand> [options]

Subcommands

SubcommandDescription
initInitialize event store
statsShow event store statistics
streamsList event streams
read STREAMRead events from stream
append STREAMAppend events to stream
# Initialize PostgreSQL event store
fi-fhir eventstore init --driver postgres --dsn ${DATABASE_URL}

# Show statistics
fi-fhir eventstore stats

# Read from a stream
fi-fhir eventstore read patient-MRN12345 --limit 10

projection

Projection management.

Usage

fi-fhir projection <subcommand> [options]

Subcommands

SubcommandDescription
listList projections
status NAMEGet projection status
run NAMERun projection
rebuild NAMERebuild projection from events
# List all projections
fi-fhir projection list

# Rebuild patient timeline projection
fi-fhir projection rebuild patient-timeline --from 2024-01-01

terminology

Terminology database operations.

Usage

fi-fhir terminology <subcommand> [options]

Subcommands

SubcommandDescription
initInitialize terminology database
load SYSTEMLoad terminology (loinc, snomed, icd10)
statusShow loaded terminologies
crosswalkCross-reference codes between systems
searchSemantic search for terminology codes
indexManage terminology embedding index
# Initialize database
fi-fhir terminology init --driver postgres --dsn ${DATABASE_URL}

# Load LOINC
fi-fhir terminology load loinc --file loinc.csv

# Check status
fi-fhir terminology status

# Cross-walk ICD-10 to SNOMED
fi-fhir terminology crosswalk --from icd10 --to snomed E11.9

# Semantic search (finds codes by meaning)
fi-fhir terminology search --query "blood sugar" --vocabulary loinc --limit 10
fi-fhir terminology search --query "chest pain" --vocabulary snomed

# Build embedding index for fast semantic search
fi-fhir terminology index build --vocabulary loinc --source ./data/LoincTable.csv
fi-fhir terminology index status

etl

ETL pipeline for terminology data.

Usage

fi-fhir etl <subcommand> [options]

Subcommands

SubcommandDescription
syncSynchronize terminology sources
fetchFetch terminology files
statusShow ETL pipeline status

storage

Object storage operations.

Usage

fi-fhir storage <subcommand> [options]

Subcommands

SubcommandDescription
testTest storage connectivity
ls PATHList objects
get PATHDownload object
put PATHUpload object
rm PATHDelete object
# Test S3 connectivity
fi-fhir storage test

# List objects
fi-fhir storage ls events/2024/

# Download file
fi-fhir storage get events/2024/01/event.json

companion

EDI companion guide operations.

Usage

fi-fhir companion <subcommand> [options]

Subcommands

SubcommandDescription
listList available companion guides
show NAMEShow companion guide details
validateValidate EDI against companion guide
# List built-in guides
fi-fhir companion list

# Show guide details
fi-fhir companion show bcbs-837p

# Validate EDI
fi-fhir companion validate --guide bcbs-837p claim.x12

Environment Variables

VariableDescription
FI_FHIR_CONFIGConfiguration file path
FI_FHIR_LOG_LEVELLog level (debug, info, warn, error)
FI_FHIR_DATABASE_URLDatabase connection string
FI_FHIR_FHIR_ENDPOINTDefault FHIR server endpoint
FI_FHIR_TRACING_ENABLEDEnable distributed tracing
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry collector endpoint
LLM_BASE_URLLLM API endpoint (OpenAI-compatible)
LLM_API_KEYLLM API authentication key
LLM_DEFAULT_MODELDefault model for LLM operations
LLM_QUALITY_MODELModel for complex LLM tasks

Exit Codes

CodeDescription
0Success
1General error
2Configuration error
3Validation error
4Network/connectivity error
5Authentication error

See Also