api.admin.actions

Module Contents

Functions

reset_project(modeladmin, request, queryset)

download_without_text(modeladmin, request, queryset)

download_without_text_with_doc_names(modeladmin, ...)

download_projects_without_text(projects, with_doc_name)

download(modeladmin, request, queryset)

download_projects_with_text(projects)

retrieve_project_data(projects)

A function to convert a list of projects and:

clone_projects(modeladmin, request, queryset)

dataset_document_counts(dataset)

_reset_cdb_filters(id)

import_concepts_from_cdb(cdb_model_id)

reset_cdb_filters(modeladmin, request, queryset)

import_concepts(modeladmin, request, queryset)

delete_indexed_concepts(modeladmin, request, queryset)

remove_all_documents(modeladmin, request, queryset)

Attributes

logger

_dt_fmt

api.admin.actions.logger
api.admin.actions._dt_fmt = '%Y-%m-%d %H:%M:%S.%f'
api.admin.actions.reset_project(modeladmin, request, queryset)
api.admin.actions.download_without_text(modeladmin, request, queryset)
api.admin.actions.download_without_text_with_doc_names(modeladmin, request, queryset)
api.admin.actions.download_projects_without_text(projects, with_doc_name)
api.admin.actions.download(modeladmin, request, queryset)
api.admin.actions.download_projects_with_text(projects)
Parameters:

projects (django.db.models.QuerySet) –

api.admin.actions.retrieve_project_data(projects)
A function to convert a list of projects and:
  • their associated documents,

  • their associated annotations,

  • their associated Meta annotations and Relation Annotations

for serialization. Output schema is as follows: ((optional) indicates this field isn’t required for training a MedCAT model) { “projects”: [

{

“name”: “<project_name” # name of the project “id”: “<id>” # the auto-generated id of the project (optional) “project_group_id”: “<id>” # the auto-generated id of the project - nullable “project_group_name”: “<group_name>” # the name of the project group if set. “project_status”: “<project_status>” # status - either annotating, discontinued, complete “project_locked”: “<project_locked>” # locked - for no further annotations “cuis”: [“cui_1”, “cui_2” … ] # the CUI filter for the project, includes those from file / and text-box “meta_anno_defs”: [

# list of meta annotation tasks configured for this project. {

“name”: “Name of meta annotation task”, “values”: [

“<first value>”, “<second value>” …

],

}, … more meta_annotation tasks configured for this project

], “relation_anno_defs”: [

“<name1>”, “<name2>” … more relation annotation task names configured for this project

] “documents”: [

{ “id”: “<id>” # the auto-generated id of the document (optional) “name”: “<name>” # the name of the document (optional), but used in stat printing during training “text”: “<text>” # the text of the document “last_modified”: “<date time>” # the last modified-time (optional) “annotations”: [{

“id”: “<id>” # the auto-generated id of the document (optional) “name”: “<username string>” # the user who made the annotation (optional) “cui”: “<cui string>” # the cui label for this annotation “value”: “<string>” # the text span for this annotation “start”: <integer> # the start index of this annotation with respect to the document text “end”: <integer> # the end index of this annotation with respect to the document text “validated”: <boolean> # if the annotation has been marked by a human annotator “correct”: <boolean> # if the text span is correctly linked to the CUI of this annotation “deleted”: <boolean> # if the text span was incorrectly linked or ‘not’ linked by MedCAT due to low scores “alternative”: <boolean> # if the text span was incorrectly linked by MedCAT, then correctly linked by a human annotator “killed”: <boolean> # if a human annotator ‘terminated’ this annotation “irrelevant”: <boolean> # if a human annotator has marked an annotation as irrelevant (optional) “acc”: <float> # accuracy provided by MedCAT (optional) “comment”: “<comment string>” # the text entered by an annotator during annotation (optional) “meta_anns”: [

# list of meta annotations if applicable to project {

“name”: <string> # Meta anno task name, i.e. temporality “value”: <string> # the selected meta anno task value for, ie. “past” or “present” “acc”: <float> # default 1, (optional) “validated”: <boolean> # Meta annotation has been made by a human annotator, default (true)

}, … <more meta annotations of the same as above structure>

]}, … <more annotations of the same above structure>

] “relations”: [

{

“start_entity”: <integer> # id of above annotation that is the start of this relation “start_entity_cui”: “<string>” # the cui label of the start of this relation “start_entity_value”: <string> # value of the start annotation for this relation “start_entity_start_idx”: <integer> # start index of text span of start of relation “start_entity_end_idx”: <integer> # end index of text span of start of relation “end_entity”: <integer> # id of the above annotation that is the end of this relation “end_entity_cui”: “<string>” # the cui label of the end of this relation “end_entity_value”: <string> # value of the end annotation for this relation “end_entity_start_idx”: <integer> # end index of text span of end of relation “end_entity_end_idx”: <integer> # end index of text span of end of relation “user”: <string> # username of annotator for relation (optional) “relation”: <string> # label for this relation “validated”: <boolean> # if the annotation has been validated by a human annotator, default true.

} … < more relations of the samve above structure>

]

… <more documents of the same above structure>

]

]

Args:

projects (QuerySet): the projects to export data for.

Parameters:

projects (django.db.models.QuerySet) –

Return type:

Dict[str, List]

api.admin.actions.clone_projects(modeladmin, request, queryset)
api.admin.actions.dataset_document_counts(dataset)
api.admin.actions._reset_cdb_filters(id)
api.admin.actions.import_concepts_from_cdb(cdb_model_id)
Parameters:

cdb_model_id (int) –

api.admin.actions.reset_cdb_filters(modeladmin, request, queryset)
api.admin.actions.import_concepts(modeladmin, request, queryset)
api.admin.actions.delete_indexed_concepts(modeladmin, request, queryset)
api.admin.actions.remove_all_documents(modeladmin, request, queryset)