mirror of
https://github.com/azaion/gps-denied-desktop.git
synced 2026-04-23 01:36:35 +00:00
add features
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
# Feature: System Configuration
|
||||
|
||||
## Description
|
||||
|
||||
Handles loading, validation, and runtime management of system-wide configuration including camera parameters, operational area bounds, model paths, database connections, and API endpoints.
|
||||
|
||||
## Component APIs Implemented
|
||||
|
||||
- `load_config(config_path: str) -> SystemConfig`
|
||||
- `validate_config(config: SystemConfig) -> ValidationResult`
|
||||
- `get_camera_params(camera_id: Optional[str] = None) -> CameraParameters`
|
||||
- `update_config(section: str, key: str, value: Any) -> bool`
|
||||
|
||||
## External Tools and Services
|
||||
|
||||
- **PyYAML**: Configuration file parsing (YAML format)
|
||||
- **pydantic**: Data model validation and serialization
|
||||
- **os/pathlib**: File system operations for config file access
|
||||
|
||||
## Internal Methods
|
||||
|
||||
| Method | Purpose |
|
||||
|--------|---------|
|
||||
| `_parse_yaml_file` | Reads and parses YAML configuration file |
|
||||
| `_apply_defaults` | Applies default values for missing configuration keys |
|
||||
| `_validate_camera_params` | Validates camera parameters are within sensible bounds |
|
||||
| `_validate_paths` | Checks that configured paths exist |
|
||||
| `_validate_operational_area` | Validates operational area bounds are valid coordinates |
|
||||
| `_build_camera_matrix` | Constructs camera intrinsic matrix from parameters |
|
||||
| `_get_cached_config` | Returns cached configuration to avoid repeated file reads |
|
||||
|
||||
## Unit Tests
|
||||
|
||||
| Test Case | Description |
|
||||
|-----------|-------------|
|
||||
| `test_load_config_valid_yaml` | Load valid YAML config file, verify SystemConfig returned |
|
||||
| `test_load_config_missing_file_uses_defaults` | Missing config file returns default configuration |
|
||||
| `test_load_config_invalid_yaml_raises_error` | Malformed YAML raises appropriate error |
|
||||
| `test_load_config_partial_uses_defaults` | Partial config merges with defaults |
|
||||
| `test_validate_config_valid` | Valid configuration passes validation |
|
||||
| `test_validate_config_invalid_focal_length` | Focal length <= 0 fails validation |
|
||||
| `test_validate_config_invalid_sensor_size` | Sensor dimensions <= 0 fails validation |
|
||||
| `test_validate_config_invalid_resolution` | Resolution <= 0 fails validation |
|
||||
| `test_validate_config_invalid_operational_area` | Invalid lat/lon bounds fail validation |
|
||||
| `test_validate_config_missing_paths` | Non-existent paths fail validation |
|
||||
| `test_get_camera_params_default` | Get default camera returns valid parameters |
|
||||
| `test_get_camera_params_specific_camera` | Get specific camera ID returns correct parameters |
|
||||
| `test_get_camera_params_unknown_camera` | Unknown camera ID raises error |
|
||||
| `test_update_config_valid_key` | Update existing key succeeds |
|
||||
| `test_update_config_invalid_section` | Update non-existent section fails |
|
||||
| `test_update_config_invalid_key` | Update non-existent key fails |
|
||||
| `test_update_config_type_mismatch` | Update with wrong value type fails |
|
||||
|
||||
## Integration Tests
|
||||
|
||||
| Test Case | Description |
|
||||
|-----------|-------------|
|
||||
| `test_load_and_validate_full_config` | Load config file, validate, verify all sections accessible |
|
||||
| `test_config_persistence_after_update` | Update config at runtime, verify changes persist in memory |
|
||||
| `test_camera_params_consistency` | Camera params from get_camera_params match loaded config |
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Feature: Flight Configuration
|
||||
|
||||
## Description
|
||||
|
||||
Manages flight-specific configuration including operational altitude, frame spacing, and camera parameters per flight. Provides persistence and retrieval of flight configurations created during flight initialization.
|
||||
|
||||
## Component APIs Implemented
|
||||
|
||||
- `get_flight_config(flight_id: str) -> FlightConfig`
|
||||
- `save_flight_config(flight_id: str, config: FlightConfig) -> bool`
|
||||
- `get_operational_altitude(flight_id: str) -> float`
|
||||
- `get_frame_spacing(flight_id: str) -> float`
|
||||
|
||||
## External Tools and Services
|
||||
|
||||
- **F03 Flight Database**: Persistence layer for flight-specific configuration storage
|
||||
|
||||
## Internal Methods
|
||||
|
||||
| Method | Purpose |
|
||||
|--------|---------|
|
||||
| `_build_flight_config` | Constructs FlightConfig from stored data |
|
||||
| `_validate_flight_config` | Validates FlightConfig before persistence |
|
||||
| `_cache_flight_config` | Caches flight config in memory for fast retrieval |
|
||||
| `_invalidate_cache` | Clears cached flight config when updated |
|
||||
|
||||
## Unit Tests
|
||||
|
||||
| Test Case | Description |
|
||||
|-----------|-------------|
|
||||
| `test_get_flight_config_existing` | Get config for existing flight returns FlightConfig |
|
||||
| `test_get_flight_config_nonexistent` | Get config for non-existent flight raises error |
|
||||
| `test_save_flight_config_valid` | Save valid FlightConfig returns True |
|
||||
| `test_save_flight_config_invalid_flight_id` | Save with empty flight_id fails |
|
||||
| `test_save_flight_config_invalid_config` | Save with invalid config data fails |
|
||||
| `test_get_operational_altitude_existing` | Get altitude for existing flight returns value |
|
||||
| `test_get_operational_altitude_nonexistent` | Get altitude for non-existent flight raises error |
|
||||
| `test_get_operational_altitude_range` | Verify altitude within expected range (100-500m) |
|
||||
| `test_get_frame_spacing_existing` | Get frame spacing returns expected distance |
|
||||
| `test_get_frame_spacing_default` | Frame spacing returns reasonable default (~100m) |
|
||||
|
||||
## Integration Tests
|
||||
|
||||
| Test Case | Description |
|
||||
|-----------|-------------|
|
||||
| `test_save_and_retrieve_flight_config` | Save flight config via save_flight_config, retrieve via get_flight_config, verify data matches |
|
||||
| `test_flight_config_persists_to_database` | Save flight config, verify stored in F03 Flight Database |
|
||||
| `test_altitude_and_spacing_consistency` | Flight config altitude matches get_operational_altitude result |
|
||||
| `test_multiple_flights_isolation` | Multiple flights have independent configurations |
|
||||
|
||||
Reference in New Issue
Block a user