Skip to content

Installation

OctoFHIR FHIRPath provides multiple installation options depending on your use case.

The command-line interface is the easiest way to get started with FHIRPath evaluation.

Terminal window
# Clone the repository
git clone https://github.com/octofhir/fhirpath-rs
cd fhirpath-rs
# Install the CLI tool
cargo install --path fhirpath-cli
Terminal window
# Check if the CLI tool is installed correctly
octofhir-fhirpath --help

To use FHIRPath in your Rust project, add it as a dependency.

[dependencies]
fhirpath-core = "0.1.0"
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(())
}

For JavaScript and TypeScript projects, install the Node.js bindings.

Terminal window
npm install fhirpath-node
Terminal window
yarn add fhirpath-node
const { evaluateExpression } = require('fhirpath-node');
const patient = {
resourceType: "Patient",
name: [{ given: ["John"] }]
};
const result = evaluateExpression("name.given", patient);
console.log("Result:", result);
  • 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

Once you have installed OctoFHIR FHIRPath, check out the Quick Start guide to learn how to use it effectively.