CSV Export Feature for Final Report Generation¶
Overview¶
The src/workflows/generate_final_report.py script now includes functionality to export all generated tables as individual CSV files. This feature makes it easy to collect and analyze the final results in a structured format.
New Functionality¶
CSV Export Method¶
- Method:
export_tables_to_csv(output_dir: Path) - Location:
ReportGeneratorclass - Purpose: Exports all generated tables as individual CSV files
Output Directory¶
- Default Location:
data/report/(configurable viaCSV_OUTPUT_DIR) - Auto-creation: Directory is created automatically if it doesn't exist
Generated CSV Files¶
The following CSV files are generated when the script runs:
Basic Statistics Tables¶
match_type_counts.csv- Count of matches by type (name, semantic, etc.)avg_score_by_type.csv- Average similarity scores by match typematches_by_framework.csv- Number of matches by source frameworkmatches_by_project.csv- Number of matches by target project
Pattern Analysis Tables (if patterns exist)¶
source_pattern_analysis.csv- Where patterns originate fromadoption_pattern_analysis.csv- Where patterns are adopted/usedpatterns_by_match_count.csv- Patterns sorted by match frequencyavg_score_by_pattern.csv- Average similarity scores by patternpatterns_in_[framework].csv- Patterns found in each framework (e.g.,patterns_in_qiskit.csv)
Additional Tables¶
top_matched_concepts.csv- Top 20 most frequently matched conceptsunmatched_patterns.csv- List of patterns not found in any project (if any)
Usage¶
The CSV export is automatically triggered when running the main script:
# The export happens automatically in the main() function
python src/workflows/generate_final_report.py
Or programmatically:
from src.workflows.generate_final_report import ReportGenerator
import pandas as pd
# Load your data
df = pd.read_csv("your_data.csv")
patterns = {"pattern1", "pattern2"}
# Create generator and export
generator = ReportGenerator(df, patterns)
generator.export_tables_to_csv(Path("output/directory"))
File Structure¶
data/
└── report/
├── match_type_counts.csv
├── avg_score_by_type.csv
├── matches_by_framework.csv
├── matches_by_project.csv
├── source_pattern_analysis.csv
├── adoption_pattern_analysis.csv
├── patterns_by_match_count.csv
├── avg_score_by_pattern.csv
├── patterns_in_qiskit.csv
├── patterns_in_pennylane.csv
├── patterns_in_classiq.csv
├── top_matched_concepts.csv
└── unmatched_patterns.csv
Benefits¶
- Easy Data Collection: All results in one organized location
- Structured Format: CSV files can be easily imported into Excel, R, Python, etc.
- Individual Analysis: Each table can be analyzed separately
- Automated: No manual intervention required
- Consistent Naming: Clear, descriptive filenames for easy identification
Integration¶
The CSV export is seamlessly integrated into the existing workflow: - Runs automatically after generating TXT and Markdown reports - Uses the same data structures already computed for the reports - Maintains consistency with the existing report generation process