From eb428cc5ad84c07e54442ae905d38e56318140be Mon Sep 17 00:00:00 2001 From: Tom Searle Date: Fri, 26 Apr 2024 16:33:34 +0100 Subject: [PATCH] CU-86948qbfu: Add meta anno and relation defs for easier parsing during analysis of exports --- webapp/api/api/admin.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webapp/api/api/admin.py b/webapp/api/api/admin.py index a2239a5b..1cff5fa4 100644 --- a/webapp/api/api/admin.py +++ b/webapp/api/api/admin.py @@ -158,6 +158,23 @@ def retrieve_project_data(projects: QuerySet) -> Dict[str, List]: "name": "" # the auto-generated id of the project (optional) "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) @@ -226,6 +243,9 @@ def retrieve_project_data(projects: QuerySet) -> Dict[str, List]: out['cuis'] = project.cuis out['project_status'] = project.project_status out['project_locked'] = project.project_locked + out['meta_anno_defs'] = [{'name': t.name, 'values': [v.name for v in t.values.all()]} + for t in project.tasks.all()] + out['relation_anno_defs'] = [r.label for r in project.relations.all()] out['documents'] = [] if project.cuis_file is not None and project.cuis_file: