ID is null although I give an ID value from .CSV file

Hi, As you can see in the picture, although I tried to get "ID" from my CSV file, it doesnot show up here. Can you let me know what's happening here? Below is my code for recipe:

# -*- coding: utf-8 -*-
import csv
import prodigy

@prodigy.recipe('feedback_recipe',
            dataset=prodigy.recipe_args['dataset'],
            file_path=("C:/Users/.......feedback_prodigy_test.csv", "positional", None, str))

def feedback_recipe(dataset, file_path):
    """Annotate the feedbacks using different labels."""
    def custom_csv_loader(file_path):
        with open(file_path, encoding="utf-8") as csvfile:
            reader = csv.DictReader(csvfile)
            for row in reader:    
                text = row.get('Feedback_Explanation')   
                id = row.get('ResponseId')
                yield {'text': text, 'meta': {'id':id}}     # load in the CSV file
                
    stream = custom_csv_loader("C:/Users/......feedback_prodigy_test.csv")            
    stream = add_options(stream)  # add options to each task

    return {
          'dataset': dataset,   # save annotations in this dataset
          'view_id': 'choice',  # use the choice interface
          'config': {'choice_style': 'multiple'},
          'stream':stream,
      }

def on_exit(controller):
    # Get all annotations in the dataset, filter out the accepted tasks,
    # count them by the selected options and print the counts.
    examples = controller.db.get_dataset(controller.dataset)
    examples = [eg for eg in examples if eg["answer"] == "accept"]
    for option in ("IVR Issues", "Customer Complaints", "Questions", "Button Issue", "UI & UX Issue", "Usage Display", "View Bill Issue", "Pay Bill Issue", "High Bill", "Payment Arrangement", "Autopay", 
                   "Budget Billing", "Equal Payment Plan", "Suggestions", "Others"):
        count = len([eg for eg in examples if option in eg["accept"]])
        print(f"Annotated {count} {option} examples")
    
def add_options(stream):
    # Helper function to add options to every task in a stream
    options = [
        {"id": "IVR Issues", "text": "IVR Issues"},
        {"id": "Online Order Issue", "text": "Online Order Issue"},
        {"id": "Service Information", "text": "Service Information"},
        {"id": "Account Changes", "text": "Account Changes"},
        {"id": "Paperless Billing", "text": "Paperless Billing"},
        {"id": "Others", "text": "Others"},
    ]
    for task in stream:
        task["options"] = options
        yield task

How does your CSV file look? In your code, you're using row.get('ResponseId'), so it'll use whatever the value of the ResponseId column is, and fall back to None / null if the column doesn't exist. If the column name is actually ID, you should be using ID here.

My csv file looks like this. I am using the right column name, but it doesn't get captured.

This looks reasonable to me. Maybe try adding some print statements to see if it fails? If the id variable in your code is None, then your CSV reader is somehow not picking up the column from the file.

If it's set correctly in your code, maybe try naming the key something else, like, "response_id"? (Not sure why id would be causing a conflict here, but if that's the case, we can investigate further.)

Hi Ines, I actually tried everything. Atlast found the issue, but not sure how to solve it.
It seems like the CSV reader is not picking the first column. When I place the "id" column in a different column, it reads. Similarly, I tried to place the "text" column in the first column of the csv file, this time, it doesn't read the "text" column as I placed it there. I know this is not a prodigy issue. But, can you guide me how to resolve this. What am I missing?

Not sure, I don 't really work with CSV files much... maybe try Google or StackOverflow, and maybe try setting the delimter and rows explicitly? Or use pandas instead, maybe that does some more magic under the hood.