Delete analyze_project_preferences.py
Browse files- analyze_project_preferences.py +0 -136
analyze_project_preferences.py
DELETED
|
@@ -1,136 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
from typing import Dict, Any
|
| 3 |
-
from prompt_analyzer import create_handler
|
| 4 |
-
|
| 5 |
-
def analyze_project_preferences(sources_data: Dict[str, Any]) -> Dict[str, Any]:
|
| 6 |
-
"""Analyzes project preferences and technology choices using LLM"""
|
| 7 |
-
|
| 8 |
-
handler = create_handler()
|
| 9 |
-
combined_results = {}
|
| 10 |
-
|
| 11 |
-
for repo_name, repo_data in sources_data.items():
|
| 12 |
-
print(f"\nAnalyzing project preferences for repository: {repo_name}")
|
| 13 |
-
|
| 14 |
-
# Create repository-specific prompt
|
| 15 |
-
prompt = f"""
|
| 16 |
-
|
| 17 |
-
PROJECT PREFERENCES ANALYSIS
|
| 18 |
-
|
| 19 |
-
You are an expert in developer profiling and technical background analysis. Study this repository to build a comprehensive profile of the developer's technical preferences and knowledge domains.
|
| 20 |
-
|
| 21 |
-
Repository: {repo_name}
|
| 22 |
-
Languages: {repo_data.get('languages', 'Unknown')}
|
| 23 |
-
|
| 24 |
-
Project Structure:
|
| 25 |
-
{json.dumps(repo_data.get('structure', {}), indent=2)}
|
| 26 |
-
|
| 27 |
-
Configuration Files:
|
| 28 |
-
{json.dumps(repo_data.get('config_files', []), indent=2)}
|
| 29 |
-
|
| 30 |
-
Core Files:
|
| 31 |
-
{json.dumps(repo_data.get('samples', {}).get('core_files', {}), indent=2)}
|
| 32 |
-
|
| 33 |
-
Dependencies:
|
| 34 |
-
{json.dumps(repo_data.get('samples', {}).get('package_files', {}), indent=2)}
|
| 35 |
-
|
| 36 |
-
Analyze deeply to infer:
|
| 37 |
-
1. Technical background and expertise level
|
| 38 |
-
2. Problem-solving approaches and mathematical foundations
|
| 39 |
-
3. Security awareness and defensive programming practices
|
| 40 |
-
4. Development environment preferences
|
| 41 |
-
|
| 42 |
-
Generate detailed JSON analysis:
|
| 43 |
-
{{
|
| 44 |
-
"developer_profile": {{
|
| 45 |
-
"expertise_domains": [
|
| 46 |
-
{{
|
| 47 |
-
"domain": string, // e.g. "security", "data_science", "web_development"
|
| 48 |
-
"confidence": number, // 0-100
|
| 49 |
-
"evidence": [string]
|
| 50 |
-
}}
|
| 51 |
-
],
|
| 52 |
-
"knowledge_patterns": {{
|
| 53 |
-
"mathematical_foundations": [
|
| 54 |
-
{{
|
| 55 |
-
"area": string, // e.g. "graph_theory", "linear_algebra"
|
| 56 |
-
"usage_examples": [string],
|
| 57 |
-
"proficiency_level": string // "basic", "intermediate", "advanced"
|
| 58 |
-
}}
|
| 59 |
-
],
|
| 60 |
-
"algorithmic_preferences": {{
|
| 61 |
-
"common_approaches": [string],
|
| 62 |
-
"complexity_awareness": string,
|
| 63 |
-
"optimization_patterns": [string]
|
| 64 |
-
}},
|
| 65 |
-
"security_awareness": {{
|
| 66 |
-
"level": string, // "low", "medium", "high"
|
| 67 |
-
"defensive_patterns": [string],
|
| 68 |
-
"security_considerations": [string]
|
| 69 |
-
}}
|
| 70 |
-
}}
|
| 71 |
-
}},
|
| 72 |
-
"technical_choices": {{
|
| 73 |
-
"primary_languages": [
|
| 74 |
-
{{
|
| 75 |
-
"language": string,
|
| 76 |
-
"proficiency_indicators": [string],
|
| 77 |
-
"usage_patterns": [string]
|
| 78 |
-
}}
|
| 79 |
-
],
|
| 80 |
-
"frameworks": [
|
| 81 |
-
{{
|
| 82 |
-
"name": string,
|
| 83 |
-
"purpose": string,
|
| 84 |
-
"usage_patterns": [string],
|
| 85 |
-
"implementation_depth": string // "basic", "intermediate", "advanced"
|
| 86 |
-
}}
|
| 87 |
-
],
|
| 88 |
-
"development_environment": {{
|
| 89 |
-
"likely_editor": string,
|
| 90 |
-
"confidence": number,
|
| 91 |
-
"tooling_preferences": [string],
|
| 92 |
-
"evidence": [string]
|
| 93 |
-
}},
|
| 94 |
-
"testing_approach": {{
|
| 95 |
-
"methodology": string,
|
| 96 |
-
"frameworks": [string],
|
| 97 |
-
"coverage_patterns": string
|
| 98 |
-
}}
|
| 99 |
-
}},
|
| 100 |
-
"project_organization": {{
|
| 101 |
-
"architecture_style": {{
|
| 102 |
-
"pattern": string,
|
| 103 |
-
"consistency": number,
|
| 104 |
-
"key_characteristics": [string]
|
| 105 |
-
}},
|
| 106 |
-
"code_quality": {{
|
| 107 |
-
"standards_adherence": string,
|
| 108 |
-
"documentation_level": string,
|
| 109 |
-
"maintainability_indicators": [string]
|
| 110 |
-
}},
|
| 111 |
-
"deployment_patterns": {{
|
| 112 |
-
"infrastructure_preferences": [string],
|
| 113 |
-
"containerization_approach": string,
|
| 114 |
-
"ci_cd_sophistication": string
|
| 115 |
-
}}
|
| 116 |
-
}}
|
| 117 |
-
}}
|
| 118 |
-
|
| 119 |
-
Important:
|
| 120 |
-
1. Base all inferences on concrete evidence in the code
|
| 121 |
-
2. Indicate confidence levels where uncertain
|
| 122 |
-
3. Provide specific examples supporting each conclusion
|
| 123 |
-
4. Focus on unique/distinctive patterns
|
| 124 |
-
"""
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
try:
|
| 128 |
-
result = handler.generate_json_response(prompt)
|
| 129 |
-
if result:
|
| 130 |
-
combined_results[repo_name] = result
|
| 131 |
-
except Exception as e:
|
| 132 |
-
print(f"Error analyzing {repo_name}: {str(e)}")
|
| 133 |
-
combined_results[repo_name] = {"error": str(e)}
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
return combined_results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|