All structs derive Debug, Clone, PartialEq, Serialize, and
Deserialize. Serde renames map Rust field names to MUSE XML element names.
The same renames apply to both XML and JSON serialization.
Top-level document struct. Maps to the <RestingECG> root element.
Module: resting_ecg
| Rust field | XML element | Type | Required |
|---|---|---|---|
patient_demographics |
PatientDemographics |
PatientDemographics |
Yes |
test_demographics |
TestDemographics |
TestDemographics |
Yes |
order_information |
OrderInformation |
Option<OrderInformation> |
No |
diagnosis |
Diagnosis |
Option<Diagnosis> |
No |
waveforms |
Waveform |
Vec<Waveform> |
No |
measurements |
RestingECGMeasurements |
Option<RestingEcgMeasurements> |
No |
pharma_data |
PharmaData |
Option<PharmaData> |
No |
extra_questions |
ExtraQuestions |
Option<ExtraQuestions> |
No |
Note: PharmaData and ExtraQuestions are placeholder structs for future
implementation.
Patient identification and demographic data.
Module: patient
| Rust field | XML element | Type | Required | Description |
|---|---|---|---|---|
patient_id |
PatientID |
String |
Yes | Unique patient identifier |
last_name |
PatientLastName |
Option<String> |
No | Patient last/family name |
first_name |
PatientFirstName |
Option<String> |
No | Patient first/given name |
age |
PatientAge |
Option<String> |
No | Patient age at time of test |
date_of_birth |
DateofBirth |
Option<String> |
No | Date of birth (MM/DD/YYYY) |
gender |
Gender |
Option<String> |
No | Patient gender |
race |
Race |
Option<String> |
No | Patient race |
Information about the ECG test acquisition.
Module: test_demographics
| Rust field | XML element | Type | Required | Description |
|---|---|---|---|---|
data_type |
DataType |
String |
Yes | Type of test (e.g. "Resting") |
site |
Site |
String |
Yes | Site code |
site_name |
SiteName |
Option<String> |
No | Human-readable site name |
acquisition_device |
AcquisitionDevice |
String |
Yes | Device model (e.g. "MAC5500HD") |
status |
Status |
String |
Yes | Test status (e.g. "Confirmed") |
acquisition_date |
AcquisitionDate |
String |
Yes | Date of acquisition (MM/DD/YYYY) |
acquisition_time |
AcquisitionTime |
String |
Yes | Time of acquisition (HH:MM:SS) |
acquisition_software_version |
AcquisitionSoftwareVersion |
Option<String> |
No | Software version |
Container for diagnosis statements.
Module: diagnosis
| Rust field | XML element | Type | Required | Description |
|---|---|---|---|---|
statements |
DiagnosisStatement |
Vec<DiagnosisStatement> |
No | List of diagnosis statements |
A single diagnosis statement with a flag and text.
Module: diagnosis
| Rust field | XML element | Type | Required | Description |
|---|---|---|---|---|
flag |
StmtFlag |
String |
Yes | Statement flag (e.g. "ENDSLINE", "CRITERIA") |
text |
StmtText |
String |
Yes | Statement text |
Common StmtFlag values:
| Flag | Meaning |
|---|---|
ENDSLINE |
End of a diagnosis line |
CRITERIA |
Criteria-based statement |
A waveform section containing lead data.
Module: waveform
| Rust field | XML element | Type | Required | Description |
|---|---|---|---|---|
waveform_type |
WaveformType |
String |
Yes | "Rhythm" or "Median" |
waveform_data |
WaveFormData |
Option<String> |
No | Raw waveform data (rarely used at this level) |
number_of_leads |
NumberofLeads |
u32 |
Yes | Number of leads in this waveform |
sample_type |
SampleType |
Option<String> |
No | Sample type descriptor |
sample_base |
SampleBase |
u32 |
Yes | Sample rate in Hz (typically 500) |
lead_data |
LeadData |
Vec<LeadData> |
No | Per-lead waveform data |
Waveform data for a single ECG lead.
Module: waveform
| Rust field | XML element | Type | Required | Description |
|---|---|---|---|---|
byte_count_total |
LeadByteCountTotal |
u32 |
Yes | Total bytes of waveform data |
time_offset |
LeadTimeOffset |
u32 |
Yes | Time offset in samples |
sample_count_total |
LeadSampleCountTotal |
u32 |
Yes | Total number of samples |
amplitude_units_per_bit |
LeadAmplitudeUnitsPerBit |
f64 |
Yes | Resolution (typically 4.88 uV/bit) |
amplitude_units |
LeadAmplitudeUnits |
String |
Yes | Unit label (e.g. "MICROVOLTS") |
high_limit |
LeadHighLimit |
Option<f64> |
No | High amplitude limit |
low_limit |
LeadLowLimit |
Option<f64> |
No | Low amplitude limit |
lead_id |
LeadID |
String |
Yes | Lead identifier (e.g. "I", "II", "V1") |
offset_first_sample |
LeadOffsetFirstSample |
Option<u32> |
No | Offset to first sample |
first_sample_baseline |
FirstSampleBaseline |
Option<i32> |
No | Baseline value for first sample |
sample_size |
LeadSampleSize |
u32 |
Yes | Bytes per sample (typically 2) |
lead_off |
LeadOff |
Option<String> |
No | Lead-off indicator |
data_crc32 |
LeadDataCRC32 |
Option<u32> |
No | CRC32 checksum of decoded waveform bytes |
waveform_data |
WaveFormData |
String |
Yes | Base64-encoded waveform samples |
Calculated ECG measurements from the resting test.
Module: measurements
| Rust field | XML element | Type | Required | Description |
|---|---|---|---|---|
ventricular_rate |
VentricularRate |
Option<String> |
No | Heart rate in BPM |
atrial_rate |
AtrialRate |
Option<String> |
No | Atrial rate in BPM |
pr_interval |
PRInterval |
Option<String> |
No | PR interval in ms |
qrs_duration |
QRSDuration |
Option<String> |
No | QRS duration in ms |
qt_interval |
QTInterval |
Option<String> |
No | QT interval in ms |
qt_corrected |
QTCorrected |
Option<String> |
No | Corrected QT interval in ms |
p_axis |
PAxis |
Option<String> |
No | P-wave axis in degrees |
r_axis |
RAxis |
Option<String> |
No | QRS axis in degrees |
t_axis |
TAxis |
Option<String> |
No | T-wave axis in degrees |
Order and referring physician information.
Module: order
| Rust field | XML element | Type | Required | Description |
|---|---|---|---|---|
order_number |
OrderNumber |
Option<String> |
No | Order number from HIS |
ordering_physician |
OrderingPhysician |
Option<String> |
No | Physician who ordered the test |
ordering_facility |
OrderingFacility |
Option<String> |
No | Facility name |
Error enum for all MUSE operations.
Module: error
| Variant | Description |
|---|---|
Io(std::io::Error) |
File I/O error |
Xml(quick_xml::DeError) |
XML deserialization error |
XmlSerialize(quick_xml::SeError) |
XML serialization error |
Json(serde_json::Error) |
JSON parse/serialize error |
MissingSection { section } |
Required XML section missing |
MissingElement { section, element } |
Required element missing within a section |
InvalidValue { field, message } |
Field value out of range or invalid |
Base64Decode { lead_id, message } |
Base64 decoding failed for lead waveform data |
Crc32Mismatch { lead_id, expected, actual } |
CRC32 checksum verification failed |
UnsupportedFormat(String) |
Unsupported file format |
| Lead ID | Description |
|---|---|
I |
Limb lead I |
II |
Limb lead II |
III |
Limb lead III (calculated) |
aVR |
Augmented vector right |
aVL |
Augmented vector left |
aVF |
Augmented vector foot |
V1 |
Precordial lead V1 |
V2 |
Precordial lead V2 |
V3 |
Precordial lead V3 |
V4 |
Precordial lead V4 |
V5 |
Precordial lead V5 |
V6 |
Precordial lead V6 |
V3r |
Right precordial V3 (pediatric 15-lead) |
V4r |
Right precordial V4 (pediatric 15-lead) |
V7 |
Posterior lead V7 (pediatric 15-lead) |