sensorml

Crates.iosensorml
lib.rssensorml
version0.1.5
created_at2025-10-12 05:38:02.084496+00
updated_at2025-10-27 19:08:59.556333+00
descriptionSensorML parser and serializer supporting XML and JSON formats
homepagehttps://codeberg.org/Cooperatief-Meten-Natuurlijk-UA/sensorml
repositoryhttps://codeberg.org/Cooperatief-Meten-Natuurlijk-UA/sensorml
max_upload_size
id1878971
size64,077
(meten-natuurlijk)

documentation

https://docs.rs/sensorml

README

SensorML ๐Ÿ›ฐ๏ธ

Crates.io Docs.rs Coverage Mutants

A minimalist, testable Rust crate for parsing and serializing SensorML documents in XML and JSON. Designed for integration with mapping layers, adapters, and future transformation pipelines.

โœจ Features

  • Parse SensorML from XML and JSON
  • Serialize SensorML to XML and JSON
  • Validate sensor references and ISO 8601 timestamps
  • High test coverage and mutation resistance
  • Depends only on serde, quick-xml, and chrono

๐Ÿ“ฆ Installation

Add to your Cargo.toml:

sensorml = "0.1"

๐Ÿ“š Example

use sensorml::model::{SensorMLDocument, Sensor, Observation};
use sensorml::format::json;

let doc = SensorMLDocument {
    sensors: vec![Sensor {
        id: "sensor-1".into(),
        sensor_type: "temperature".into(),
        unit: "Celsius".into(),
        description: Some("Outdoor sensor".into()),
    }],
    observations: vec![Observation {
        sensor_id: "sensor-1".into(),
        timestamp: "2025-10-11T10:00:00Z".into(),
        value: "18.5".into(),
    }],
};

let json = json::serialize_to_json(&doc)?;
let parsed = json::parse_from_json(&json)?;
parsed.validate()?; // checks sensor references and timestamp format

๐Ÿงช Testing

cargo test
cargo tarpaulin
cargo mutants

๐Ÿ“„ License

MIT ยฉ 2025 Egon Kastelijn

Commit count: 0

cargo fmt