csdif-core 0.1.3

Core library for modeling, validating, and transforming CSDIF data
Documentation
// csdif_core/src/mapper.rs
// SPDX-License-Identifier: MIT

use sensorml::model::SensorMLDocument;

pub trait InitiativeMapper {
    fn map_to_sensorml(
        &self,
        input: &serde_json::Value,
        context: &dyn ContextProvider,
    ) -> Result<SensorMLDocument, MappingError>;
}

/// Provides context for mapping, such as station metadata.
pub trait ContextProvider {
    fn get_station_profile(&self, id: &str) -> Result<StationProfile, ContextError>;
}

/// Represents a mapping error.
#[derive(Debug)]
pub struct MappingError {
    pub message: String,
}

/// Represents a context lookup error.
#[derive(Debug)]
pub enum ContextError {
    NotFound,
    InvalidFormat,
}

/// Dummy struct for station metadata (expand later).
#[derive(Debug)]
pub struct StationProfile {
    pub id: String,
}