Project Info - additional fields

Hi,

I would like to add the file name to the text string that's being annotated. At the moment I have it included at the bottom of each text string so I can then easily remove it, although not ideal.

Is it possible to have it showing in the Project Info section perhaphs on the side of Prodigy?
It is key that the annotators can see the file name!

Anna

Hi! The sidebar is currently only really intended for the "static" project info that doesn't change, whereas the annotation card shows the current task content.

The "meta" field of the task is typically a good place to put meta information like that. It will be rendered in the bottom right corner of the card and in the JSON content, it'll be separate from the text so you shouldn't have to add/remove things from the string. For example:

{"text": "Some text here", "meta": {"filename": "my_file.pdf"}}

If you need more flexibility and want to control how the meta info is formatted, you could also look into the new blocks interface, introduced in v1.9. It lets you combine interfaces, so you could have your regular annotation UI plus an "html" block that displays the meta. The HTML blocks can also use an HTML template to render task properties, so you could do something like this:

blocks = [
    {"view_id": "text"},
    {"view_id": "html", "html_template": "<strong>{filename}</strong> ({filesize})"}
]

For each task the data could look like this:

{"text": "Some text here", "filename": "my_file.pdf", "filesize": "1mb"}
2 Likes

Fantastic! It had tried adding to JSON content but I can see from your line of code where I had gone wrong.

As always, many thanks @ines