quantrs2_tytan/advanced_performance_analysis/
reporting.rs

1//! Report generation and visualization
2
3use super::*;
4
5/// Analysis report
6#[derive(Debug, Clone)]
7pub struct AnalysisReport {
8    /// Report type
9    pub report_type: ReportType,
10    /// Report title
11    pub title: String,
12    /// Report content
13    pub content: ReportContent,
14    /// Generation timestamp
15    pub timestamp: Instant,
16    /// Report metadata
17    pub metadata: ReportMetadata,
18}
19
20/// Report types
21#[derive(Debug, Clone, PartialEq, Eq)]
22pub enum ReportType {
23    PerformanceSummary,
24    DetailedAnalysis,
25    TrendAnalysis,
26    BenchmarkReport,
27    BottleneckAnalysis,
28    OptimizationReport,
29    ComparisonReport,
30    Custom { report_name: String },
31}
32
33/// Report content
34#[derive(Debug, Clone)]
35pub struct ReportContent {
36    /// Executive summary
37    pub executive_summary: String,
38    /// Key findings
39    pub key_findings: Vec<String>,
40    /// Detailed sections
41    pub sections: Vec<ReportSection>,
42    /// Visualizations
43    pub visualizations: Vec<Visualization>,
44    /// Appendices
45    pub appendices: Vec<Appendix>,
46}
47
48/// Report section
49#[derive(Debug, Clone)]
50pub struct ReportSection {
51    /// Section title
52    pub title: String,
53    /// Section content
54    pub content: String,
55    /// Subsections
56    pub subsections: Vec<Self>,
57    /// Figures and tables
58    pub figures: Vec<Figure>,
59}
60
61/// Visualization
62#[derive(Debug, Clone)]
63pub struct Visualization {
64    /// Visualization type
65    pub viz_type: VisualizationType,
66    /// Title
67    pub title: String,
68    /// Data
69    pub data: VisualizationData,
70    /// Configuration
71    pub config: RenderingConfig,
72}
73
74/// Visualization types
75#[derive(Debug, Clone, PartialEq, Eq)]
76pub enum VisualizationType {
77    LineChart,
78    BarChart,
79    Histogram,
80    ScatterPlot,
81    BoxPlot,
82    HeatMap,
83    NetworkGraph,
84    Timeline,
85    Dashboard,
86}
87
88/// Visualization data
89#[derive(Debug, Clone)]
90pub enum VisualizationData {
91    TimeSeries {
92        x: Vec<f64>,
93        y: Vec<f64>,
94    },
95    Scatter {
96        x: Vec<f64>,
97        y: Vec<f64>,
98    },
99    Histogram {
100        values: Vec<f64>,
101        bins: usize,
102    },
103    HeatMap {
104        matrix: Array2<f64>,
105    },
106    Network {
107        nodes: Vec<String>,
108        edges: Vec<(usize, usize)>,
109    },
110}
111
112/// Rendering configuration
113#[derive(Debug, Clone)]
114pub struct RenderingConfig {
115    /// Width
116    pub width: usize,
117    /// Height
118    pub height: usize,
119    /// Color scheme
120    pub color_scheme: String,
121    /// Labels
122    pub labels: HashMap<String, String>,
123    /// Style options
124    pub style_options: HashMap<String, String>,
125}
126
127/// Figure
128#[derive(Debug, Clone)]
129pub struct Figure {
130    /// Figure caption
131    pub caption: String,
132    /// Figure data
133    pub data: FigureData,
134    /// Figure position
135    pub position: FigurePosition,
136}
137
138/// Figure data
139#[derive(Debug, Clone)]
140pub enum FigureData {
141    Table {
142        headers: Vec<String>,
143        rows: Vec<Vec<String>>,
144    },
145    Image {
146        path: String,
147        alt_text: String,
148    },
149    Chart {
150        visualization: Visualization,
151    },
152}
153
154/// Figure position
155#[derive(Debug, Clone, PartialEq, Eq)]
156pub enum FigurePosition {
157    Here,
158    Top,
159    Bottom,
160    Page,
161    Float,
162}
163
164/// Appendix
165#[derive(Debug, Clone)]
166pub struct Appendix {
167    /// Appendix title
168    pub title: String,
169    /// Appendix content
170    pub content: AppendixContent,
171}
172
173/// Appendix content
174#[derive(Debug, Clone)]
175pub enum AppendixContent {
176    RawData { data: String },
177    Code { language: String, code: String },
178    Configuration { config: String },
179    References { references: Vec<String> },
180}
181
182/// Report metadata
183#[derive(Debug, Clone)]
184pub struct ReportMetadata {
185    /// Author
186    pub author: String,
187    /// Version
188    pub version: String,
189    /// Format
190    pub format: ReportFormat,
191    /// Tags
192    pub tags: Vec<String>,
193    /// Recipients
194    pub recipients: Vec<String>,
195}
196
197/// Report formats
198#[derive(Debug, Clone, PartialEq, Eq)]
199pub enum ReportFormat {
200    PDF,
201    HTML,
202    Markdown,
203    LaTeX,
204    JSON,
205    XML,
206}