Skip to content

MischaU8/datasette-annotate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

datasette-annotate

PyPI Changelog Tests License

Datasette plugin for annotating / labelling your training data.

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-annotate

Only the root actor will have access to create (write) annotations.

Usage

You can start the annotation process by going to the /database_name/table_name/-/annotate page. This table should be configured to specify which annotation labels can be selected, see below. Annotations will be written to the table table_name_annotations.

Configuration

To add annotations for a table it must have a primary key column. The possible labels for each table should be configured by adding the following settings to the metadata.json:

{
    "databases": {
        "my_database": {
            "tables": {
                "training_data": {
                    "plugins": {
                        "datasette-annotate": {
                            "labels": ["ABSTAIN", "HAM", "SPAM"]
                        }
                    }
                }
            }
        }
    }
}

If you are using metadata.yml the configuration should look like this:

databases:
  my_database:
    tables:
      training_data:
        plugins:
          datasette-annotate:
            labels:
              - ABSTAIN
              - HAM
              - SPAM

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-annotate
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest