1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//! Manifest parsing and streaming functionality
//!
//! This module provides efficient streaming parsing of MIDAS manifest files,
//! with duplicate detection and memory-bounded processing for large manifests.
//! It supports multiple manifest versions, dataset analysis, and flexible
//! filtering capabilities.
//!
//! # Key Features
//!
//! - **Streaming parsing**: Memory-efficient processing of large manifest files
//! - **Duplicate detection**: Prevents redundant file processing with configurable limits
//! - **Version management**: Handles multiple manifest versions with compatibility checking
//! - **Dataset analysis**: Extracts dataset summaries and metadata for interactive selection
//! - **Flexible filtering**: Supports filtering by dataset, county, and quality version
//! - **Configurable URLs**: Uses centralized constants for maintainable URL management
//!
//! # Module Organization
//!
//! - [`types`] - Core data structures (ManifestStats, ManifestConfig, ManifestVersion, DatasetSummary)
//! - [`version_manager`] - Manifest version discovery, compatibility checking, and management
//! - [`streaming`] - Core streaming parser with duplicate detection and memory management
//! - [`analysis`] - Dataset discovery, filtering, and summary generation
//! - [`utils`] - Convenience functions for common operations
//! - [`tests`] - Integration tests for complex scenarios
//!
//! # Examples
//!
//! ## Basic Streaming
//!
//! ```rust,no_run
//! use futures::StreamExt;
//! use midas_fetcher::app::manifest::{ManifestStreamer, ManifestConfig};
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let config = ManifestConfig::default();
//! let mut streamer = ManifestStreamer::with_config(config);
//! let mut stream = streamer.stream("manifest.txt").await?;
//!
//! while let Some(result) = stream.next().await {
//! match result {
//! Ok(file_info) => {
//! println!("Found file: {}", file_info.file_name);
//! }
//! Err(e) => {
//! eprintln!("Error processing line: {}", e);
//! }
//! }
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ## Dataset Analysis
//!
//! ```rust,no_run
//! use midas_fetcher::app::manifest::collect_datasets_and_years;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let datasets = collect_datasets_and_years("manifest.txt").await?;
//!
//! for (name, summary) in &datasets {
//! println!("Dataset: {}", name);
//! println!(" Versions: {:?}", summary.versions);
//! println!(" Counties: {:?}", summary.counties);
//! println!(" Files: {}", summary.file_count);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ## Filtering Files
//!
//! ```rust,no_run
//! use midas_fetcher::app::manifest::filter_manifest_files;
//! use midas_fetcher::app::models::QualityControlVersion;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let files = filter_manifest_files(
//! "manifest.txt",
//! Some("uk-daily-temperature-obs"),
//! Some("devon"),
//! &QualityControlVersion::V1,
//! ).await?;
//!
//! println!("Found {} filtered files", files.len());
//! # Ok(())
//! # }
//! ```
//!
//! ## Version Management
//!
//! ```rust,no_run
//! use midas_fetcher::app::manifest::ManifestVersionManager;
//! use midas_fetcher::app::CedaClient;
//! use std::path::PathBuf;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let cache_dir = PathBuf::from("./cache");
//! let mut manager = ManifestVersionManager::new(cache_dir);
//! let client = CedaClient::new().await?;
//!
//! // Discover available versions
//! manager.discover_available_versions(&client).await?;
//!
//! // Auto-select latest compatible version
//! if let Some(version) = manager.auto_select_compatible_version(&client).await? {
//! println!("Selected version: {}", version.version);
//! }
//! # Ok(())
//! # }
//! ```
// Re-export main public API for backward compatibility
pub use ;
pub use ManifestStreamer;
pub use ;
pub use ;
pub use ;
// Re-export for convenience
pub use ManifestStreamer as Streamer;
pub use ManifestVersionManager as VersionManager;