@sailboat-computer/validation
Version:
Validation framework for sailboat computer v3
101 lines • 2.99 kB
TypeScript
/**
* Signal K specific validation rules
*
* This file defines validation rules specialized for Signal K data.
* These rules leverage Signal K metadata and structure to validate sensor data.
*/
import { BaseValidationRule } from './base-rule';
import { ValidationResult, ValidationContext, RawSensorData } from '../types';
/**
* Signal K path validation rule
*
* Validates that a Signal K path follows the expected structure
* and contains valid components.
*/
export declare class SignalKPathValidationRule extends BaseValidationRule {
constructor();
validate(data: RawSensorData, context: ValidationContext): ValidationResult;
isApplicable(data: RawSensorData): boolean;
/**
* Check if a path follows valid Signal K format
*/
private isValidPath;
/**
* Extract path components
*/
private getPathComponents;
/**
* Validate navigation paths
*/
private validateNavigationPath;
/**
* Validate environment paths
*/
private validateEnvironmentPath;
/**
* Validate electrical paths
*/
private validateElectricalPath;
/**
* Validate propulsion paths
*/
private validatePropulsionPath;
}
/**
* Signal K source reliability rule
*
* Validates the reliability of a Signal K data source
* based on source metadata and history.
*/
export declare class SignalKSourceReliabilityRule extends BaseValidationRule {
constructor();
validate(data: RawSensorData, context: ValidationContext): ValidationResult;
isApplicable(data: RawSensorData): boolean;
/**
* Extract source type from source string
*/
private getSourceType;
/**
* Get reliability score for source type
*/
private getSourceTypeReliability;
/**
* Get reliability score for NMEA 0183 talker ID
*/
private getTalkerReliability;
/**
* Get reliability score for NMEA 2000 PGN
*/
private getPGNReliability;
}
/**
* Signal K update frequency rule
*
* Validates that Signal K data is being updated at an appropriate frequency
* based on the data type.
*/
export declare class SignalKUpdateFrequencyRule extends BaseValidationRule {
constructor();
validate(data: RawSensorData, context: ValidationContext): ValidationResult;
isApplicable(data: RawSensorData): boolean;
/**
* Get expected update frequency for a Signal K path
*/
private getExpectedUpdateFrequency;
}
/**
* Signal K delta validation rule
*
* Validates that Signal K delta updates are well-formed
* and contain the required fields.
*/
export declare class SignalKDeltaValidationRule extends BaseValidationRule {
constructor();
validate(data: RawSensorData, context: ValidationContext): ValidationResult;
isApplicable(data: RawSensorData): boolean;
}
/**
* Create all Signal K validation rules
*/
export declare function createSignalKValidationRules(): BaseValidationRule[];
//# sourceMappingURL=signal-k-rules.d.ts.map