:py:mod:`api.admin.actions` =========================== .. py:module:: api.admin.actions Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: api.admin.actions.reset_project api.admin.actions.download_without_text api.admin.actions.download_without_text_with_doc_names api.admin.actions.download_projects_without_text api.admin.actions.download api.admin.actions.download_projects_with_text api.admin.actions.retrieve_project_data api.admin.actions.clone_projects api.admin.actions.dataset_document_counts api.admin.actions._reset_cdb_filters api.admin.actions.import_concepts_from_cdb api.admin.actions.reset_cdb_filters api.admin.actions.import_concepts api.admin.actions.delete_indexed_concepts api.admin.actions.remove_all_documents Attributes ~~~~~~~~~~ .. autoapisummary:: api.admin.actions.logger api.admin.actions._dt_fmt .. py:data:: logger .. py:data:: _dt_fmt :value: '%Y-%m-%d %H:%M:%S.%f' .. py:function:: reset_project(modeladmin, request, queryset) .. py:function:: download_without_text(modeladmin, request, queryset) .. py:function:: download_without_text_with_doc_names(modeladmin, request, queryset) .. py:function:: download_projects_without_text(projects, with_doc_name) .. py:function:: download(modeladmin, request, queryset) .. py:function:: download_projects_with_text(projects) .. py:function:: 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": "" # the auto-generated id of the project (optional) "project_group_id": "" # the auto-generated id of the project - nullable "project_group_name": "" # the name of the project group if set. "project_status": "" # status - either annotating, discontinued, complete "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": [ "", "" ... ], }, ... more meta_annotation tasks configured for this project ], "relation_anno_defs": [ "", "" ... more relation annotation task names configured for this project ] "documents": [ { "id": "" # the auto-generated id of the document (optional) "name": "" # the name of the document (optional), but used in stat printing during training "text": "" # the text of the document "last_modified": "" # the last modified-time (optional) "annotations": [{ "id": "" # the auto-generated id of the document (optional) "name": "" # the user who made the annotation (optional) "cui": "" # the cui label for this annotation "value": "" # the text span for this annotation "start": # the start index of this annotation with respect to the document text "end": # the end index of this annotation with respect to the document text "validated": # if the annotation has been marked by a human annotator "correct": # if the text span is correctly linked to the CUI of this annotation "deleted": # if the text span was incorrectly linked or 'not' linked by MedCAT due to low scores "alternative": # if the text span was incorrectly linked by MedCAT, then correctly linked by a human annotator "killed": # if a human annotator 'terminated' this annotation "irrelevant": # if a human annotator has marked an annotation as irrelevant (optional) "acc": # accuracy provided by MedCAT (optional) "comment": "" # the text entered by an annotator during annotation (optional) "meta_anns": [ # list of meta annotations if applicable to project { "name": # Meta anno task name, i.e. temporality "value": # the selected meta anno task value for, ie. "past" or "present" "acc": # default 1, (optional) "validated": # Meta annotation has been made by a human annotator, default (true) }, ... ]}, ... ] "relations": [ { "start_entity": # id of above annotation that is the start of this relation "start_entity_cui": "" # the cui label of the start of this relation "start_entity_value": # value of the start annotation for this relation "start_entity_start_idx": # start index of text span of start of relation "start_entity_end_idx": # end index of text span of start of relation "end_entity": # id of the above annotation that is the end of this relation "end_entity_cui": "" # the cui label of the end of this relation "end_entity_value": # value of the end annotation for this relation "end_entity_start_idx": # end index of text span of end of relation "end_entity_end_idx": # end index of text span of end of relation "user": # username of annotator for relation (optional) "relation": # label for this relation "validated": # if the annotation has been validated by a human annotator, default true. } ... < more relations of the samve above structure> ] ... ] ] } Args: projects (QuerySet): the projects to export data for. .. py:function:: clone_projects(modeladmin, request, queryset) .. py:function:: dataset_document_counts(dataset) .. py:function:: _reset_cdb_filters(id) .. py:function:: import_concepts_from_cdb(cdb_model_id) .. py:function:: reset_cdb_filters(modeladmin, request, queryset) .. py:function:: import_concepts(modeladmin, request, queryset) .. py:function:: delete_indexed_concepts(modeladmin, request, queryset) .. py:function:: remove_all_documents(modeladmin, request, queryset)