Add to your Cargo.toml:
[dependencies]
ge-healthcare-muse = "0.1.0"cargo install ge-healthcare-musegit clone https://github.com/sixarm/ge-healthcare-muse-rust-crate.git
cd ge-healthcare-muse-rust-crate
cargo build --releaseThe binary will be at target/release/ge-healthcare-muse.
ge-healthcare-muse convert --input patient-ecg.xml --output patient-ecg.jsonge-healthcare-muse convert --input patient-ecg.json --output patient-ecg.xmlge-healthcare-muse info --input patient-ecg.xmlge-healthcare-muse validate --input patient-ecg.xml --verify-crcuse ge_healthcare_muse::{io_xml, io_json, RestingEcg};
use std::path::Path;
fn main() -> Result<(), ge_healthcare_muse::MuseError> {
// Read a MUSE XML file
let ecg = io_xml::read_xml_file(Path::new("patient-ecg.xml"))?;
// Access patient data
println!("Patient ID: {}", ecg.patient_demographics.patient_id);
if let Some(ref name) = ecg.patient_demographics.last_name {
println!("Last name: {}", name);
}
// Convert to JSON
let json = io_json::to_json(&ecg)?;
println!("{}", json);
// Write as JSON file
io_json::write_json_file(Path::new("patient-ecg.json"), &ecg)?;
Ok(())
}use ge_healthcare_muse::{io_xml, io_json};
use std::path::Path;
fn main() -> Result<(), ge_healthcare_muse::MuseError> {
// XML -> Struct -> JSON -> Struct -> XML
let ecg1 = io_xml::read_xml_file(Path::new("input.xml"))?;
let json = io_json::to_json(&ecg1)?;
let ecg2 = io_json::from_json(&json)?;
let xml = io_xml::to_xml(&ecg2)?;
// ecg1 and ecg2 are structurally equal
assert_eq!(ecg1, ecg2);
Ok(())
}- CLI Reference for full command-line documentation
- Library API Guide for using the crate in your Rust project
- Data Structures for all types and their XML mappings
- Waveform Data for working with ECG waveform data