Trouble with blocks annotation api

Im trying to use the new_manual and choice interfaces together using the blocks interface. The specific code is as follows:

    result =  {
    'view_id': 'ner_manual',  # Annotation interface to use
    'view_id': 'blocks',  # Annotation interface to use
    'dataset': dataset,  # ID of the current project. Used to associate the annotation with a project in the database.
    'stream': stream,  # Stream of annotation tasks in Prodigy's JSON format
    'exclude': exclude,  # List of dataset IDs whose annotations to exclude.
    'config': {  # Additional config settings, mostly for app UI
        'lang': 'en',
        'blocks' : [
            {'view_id': 'ner_manual'}, 
             {'view_id': 'html', 'html_template' : template_text },
             {'view_id': 'choice'},  # Annotation interface to use
             {'view_id': 'html', 'html_template': '<h4 style="text-align:left;color:#583fcf;">Type your comments here (optional):</h4>'},
             {"view_id": "text_input", "field_rows": 3},

However, all the labels are displayed at the start of the document as such:
[image removed]
The labels should not be aggregated at the start of the document like that.

At first i thought it was an issue with my input file, or the preprocessing done on the input stream. However when i comment out this specific line:

`'view_id': 'ner_manual', # Annotation interface to use

The UI gets magically fixed, of course now i cannot perform manual ner tagging on the documents

[image removed]

What do you think is the issue

Can you show an example of the data you're loading in? And did you double-check that it has "tokens" and the correct token references set if you're loading in pre-defined spans? This should be taken care of automatically if you use Prodigy's add_tokens preprocessor.

I think what might be happening here is this:

  • Something prevents the ner_manual UI block from rendering your existing spans correctly (e.g. because they don't specify the tokens they belong to).
  • If you remove the ner_manual block from your blocks, your "text" and "spans" will be rendered by the choice block – because that can also show a top-level text, and if there are "spans", it will highlight the spans. That's often useful if you're only using a choice block. But the choice block will just show the static text with entities – and that doesn't need any tokens, just the character offsets, because nothing is editable. So the spans display fine here.