from pprint import pprint
from ADFmentor import ADFMentor
import os
questions = """
    ## Lesson 3 – Practical Test
Topic: Azure Data Factory – Dynamic CSV to SQL Pipeline

Task Code: PIPELINE002

Objective:
Design and implement a dynamic Azure Data Factory pipeline that processes multiple CSV files from Azure Blob Storage and loads them into Azure SQL Database.

Requirements:

1. Create a pipeline that reads files from a Blob Storage folder.
2. Use GetMetadata activity to retrieve child items.
3. Use Filter activity to select ONLY files with ".csv" extension.
4. Use ForEach activity to iterate over filtered files.
5. Inside ForEach:
   - Use Copy activity to load each CSV file into Azure SQL Database.
6. Configure ForEach to run in parallel (isSequential: false).
7. Parameterize the pipeline:
   - sourceFolder (string)
   - targetTable (string)
8. Use dynamic content so that:
   - Source dataset uses sourceFolder parameter
   - Sink dataset uses targetTable parameter
9. Add a notification activity that runs after successful completion of all file loads.
10. Ensure proper activity dependency chain.

Constraints:
- Hardcoded folder paths are NOT allowed.
- Hardcoded table names are NOT allowed.
- Filter must explicitly check for ".csv" extension.
- Pipeline must handle multiple files.

Submission:
- Export the pipeline JSON file.
- Include any required dataset parameter definitions.
"""

prompts = {
        "pipeline": """You are evaluating an Azure Data Factory pipeline submission. Assess the following:

    CORRECTNESS (70 points):
    - Does the pipeline correctly copy CSV files from Blob Storage to SQL Database?
    - Are GetMetadata, Filter, ForEach, and Copy activities configured properly?
    - Is the activity dependency chain correct?
    - Does it handle multiple files?

    BEST PRACTICES (10 points):
    - Proper use of parameterization
    - Efficient pipeline design
    - Clear naming conventions
    - Appropriate use of linked services and datasets

    PERFORMANCE (10 points):
    - Is ForEach set to parallel (isSequential: false)?
    - Efficient data movement patterns

    REQUIREMENTS ALIGNMENT (10 points):
    - Does it include all required activities (GetMetadata, Filter, ForEach, Copy, notification)?
    - Are parameters defined for sourceFolder and targetTable?

    Provide a score out of 100 and concise feedback (50-75 words).""",


        "text": """You are evaluating a written response about Azure Data Factory concepts. Assess:

    ACCURACY (70 points):
    - Is the information technically correct?
    - Are concepts explained accurately?

    COMPLETENESS (15 points):
    - Does the answer fully address the question?
    - Are key points covered?

    CLARITY (15 points):
    - Is the explanation clear and well-organized?

    Provide a score out of 100 and concise feedback (50-75 words).""",
}

import os
current_dir = os.path.dirname(os.path.abspath(__file__))

mentor = ADFMentor(api_key="AIzaSyA_rAFfWAakSmkH65Aa2H1tFCXSScSfvsk", model_name="gemini-2.5-flash-lite")

results = mentor.evaluate_all(
    answer_path=os.path.join(current_dir, "files", "pipeline.json"),
    questions=questions,
    prompts=prompts
)

print(results['feedback'])
print(results['score'])