Installation
OctoFHIR FHIRPath provides multiple installation options depending on your use case.
CLI Tool
Section titled “CLI Tool”The command-line interface is the easiest way to get started with FHIRPath evaluation.
Install from Source
Section titled “Install from Source”# Clone the repositorygit clone https://github.com/octofhir/fhirpath-rscd fhirpath-rs
# Install the CLI toolcargo install --path fhirpath-cli
Verify Installation
Section titled “Verify Installation”# Check if the CLI tool is installed correctlyoctofhir-fhirpath --help
Rust Library
Section titled “Rust Library”To use FHIRPath in your Rust project, add it as a dependency.
Add to Cargo.toml
Section titled “Add to Cargo.toml”[dependencies]fhirpath-core = "0.1.0"
Basic Usage
Section titled “Basic Usage”use fhirpath_core::evaluator::evaluate_expression;use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> { let fhir_resource: Value = serde_json::from_str(r#" { "resourceType": "Patient", "name": [{"given": ["John"]}] } "#)?;
let result = evaluate_expression("name.given", fhir_resource)?; println!("Result: {:?}", result); Ok(())}
Node.js Package
Section titled “Node.js Package”For JavaScript and TypeScript projects, install the Node.js bindings.
Install via npm
Section titled “Install via npm”npm install fhirpath-node
Install via yarn
Section titled “Install via yarn”yarn add fhirpath-node
Basic Usage
Section titled “Basic Usage”const { evaluateExpression } = require('fhirpath-node');
const patient = { resourceType: "Patient", name: [{ given: ["John"] }]};
const result = evaluateExpression("name.given", patient);console.log("Result:", result);
Requirements
Section titled “Requirements”- Rust: Version 1.70 or higher for building from source
- Node.js: Version 16 or higher for Node.js bindings
- Operating System: Linux, macOS, or Windows
Next Steps
Section titled “Next Steps”Once you have installed OctoFHIR FHIRPath, check out the Quick Start guide to learn how to use it effectively.