-
Notifications
You must be signed in to change notification settings - Fork 0
CLI | cli interface
Most functionalities of the CLI are accessible through the cli object and the modules it contains:
Each of this module is an EntityTable.
The cli.users interface (singleton of UserTable) allows to list, create, modify and delete users from the table user of the database.
-
Add a user to the database. This operation needs administrator privilege.
-
firstname[str]: User's first name. -
lastname[str]: User's last name. -
email[str]: User's email. It's also the ID used by the user to authenticate to the server. -
password[str]: User's password. As of now, the CLI doesn't encrypt the password. -
is_admin[bool]: Set the role of the user (deprecated since more role have been added).
The created user as an
Userobject. -
-
Fetch one or several users from the database. Alternatively you can use
cli.users.getById(id).-
id[int,list(int)]: The index in the database of the users to fetch, or a list of those.
A
Userentity ifidis an int, or aEntityList(User)ifìdis a list. -
-
Update a user of the database. Alternatively, you may call
entity.save(). This operation needs administrator privilege. -
Remove a user from the database. This operation need administrator privilege.
Alternatively you can use
del cli.users[id]whereidis the index of the user to delete in the database. Or simply:user.delete()whereuseris aUserentity.-
entities[int|User]: The user to delete or its id.
The deleted user as an
Userobject. -
-
List all users contained in the table
userof the database.The user list as an
EntityList(User)object.
A User object represents a single entity from the user table of the database.
-
id[int]: The index (and primary key) of the user. -
email[str]: The user's email. It's also the id used to authenticate the user. -
firstName[str]: The user's first name. -
lastName[str]: The user's last name. -
isAdmin[bool]: The user's role. (Deprecated since more role have been added.) - Inherited attributes from
Entity
The cli.images interface (singleton of ImageTable) allows to list, upload, modify, download and delete images from the table image of the database.
-
Upload an image (and optionally its preprocessing) and add an
imageentry to the database. This operation needs administrator privilege. This operation may take some time since after the image uploaded, it will be converted to jpeg if needed and a thumbnail will be computed.-
path[str]: Path to the image file to upload. -
type[str]: The acquisition type (fundus, OCT...). -
metadata[dict]: Optional metadata passed along the images. The original name of the image and its preprocessing are automatically stored inmetadata['filename']andmetadata['preprocessingFilename']. -
preprocessing[str]: Path to the preprocessed image to upload. IfNone, no preprocessing is associated with this image.
The created user as an
Imageobject. -
-
Fetch one or several images from the database. Alternatively you can use
cli.images.getById(id).-
id[int,list(int)]: The index in the database of the images to fetch, or a list of those.
A
Imageentity ifidis an int, or aEntityList(Image)ifìdis a list. -
-
Update an image of the database. Alternatively, you may call
image.save(). Uploading a new image or preprocessing is not yet implemented in the CLI. This operation needs administrator privilege.-
entity[Image]: The modified image to save in the database.
-
-
Remove an image from the database. This operation need administrator privilege.
Alternatively you can use
del cli.images[id]whereidis the index of the image to delete in the database. Or simply:image.delete()whereimageis aImageentity.-
entities[int|Image]: The image to delete or its id.
The deleted image as an
Imageobject. -
-
List all images contained in the table
imageof the database.The image list as an
EntityList(Image)object.
An Image object represents a single entity from the image table of the database.
-
id[int]: The index (and primary key) of the image. -
preprocessing[bool]:Trueif a preprocessing image is associated with this entity. -
metadata[dict]: The image metadata. -
type[str]: The image acquisition type. - Inherited attributes from
Entity
-
Download the image file.
-
out[str]: Path where the file will be written. (If none is passed the file is not stored on the disk).
The image as an array numpy. (Dimensions are
[height, width, channel], channels are in BGR order). -
-
Download the preprocessed image file.
-
out[str]: Path where the file will be written. (If none is passed the file is not stored on the disk).
The preprocessed image as an array numpy. (Dimensions are
[height, width, channel], channels are in BGR order). -
The cli.annotations interface (singleton of AnnotationTable) allows to add, list, modify, download and delete annotations from the table annotation of the database.
-
Create an annotation.
-
image[int|Image]: Id of the image orImageentity to which the annotation is linked. -
comment[str]: Comment stored along with the annotation. -
data[AnnotationData]: The graphical and non-graphical annotation data.
The created annotation as an
Annotationobject. -
-
Fetch one or several annotations from the database. Alternatively you can use
cli.annotations.getById(id).-
id[int,list(int)]: The index in the database of the annotation to fetch, or a list of those.
A
Annotationentity ifidis an int, or aEntityList(Annotation)ifìdis a list. -
-
Update an annotation of the database. Alternatively, you may call
entity.save(). A submit event is automatically generated in the database. This operation needs administrator privilege.-
entity[Annotation]: The modified annotation to save in the database.
-
-
List all annotations contained in the
annotationtable of the database.The annotation list as an
EntityList(Annotation)object.
An Annotation object represents a single entity from the annotation table of the database.
-
id[int]: The index (and primary key) of the annotation. -
comment[str]: Comment associated with the annotation. This comment is not visible from the frontend, it should be used as note created by and for the research team. -
image[Image]: The image to which this annotation is linked. Read-only -
submitEvent[SubmissionEvent]: The last submission event. Read-only - Inherited attributes from
Entity
-
Download the annotation data.
The annotation data as an
AnnotationData.
-
biomarkers[dict]: A dictionary containing the graphical annotation. The key encode the biomarker name and the value is a string containing a bitmap (png in base64 format) or an SVG. -
hierarchy[dict]: A dictionary describing the biomarkers hierarchy. -
nongraphic[dict]: A dictionary containing non-graphic annotation.
The cli.tasks interface (singleton of TasksTable) allows to add, list, modify and delete tasks from the table task of the database.
-
Create a task.
-
type[int|TaskType]: Id or aTaskTypeentity of the task of the type. -
annotation[int|Annotation|Image]: Id orAnnotationentity to modify to complete the task. If anImageis provided, an empty annotation is created on that image. -
complete[bool]: Mark this task as completed or incomplete. -
visible[bool]: Mark this task as visible or hidden. (Hidden task are not presented in the task list). -
comment[str]: Comment associated with the task. This comment is not visible from the frontend, it should be used as note created by and for the research team. -
assign_to[intUser]: If not None, the task is assigned to the provided user.
The created task as an
Taskobject. -
-
Fetch one or several annotations from the database. Alternatively you can use
cli.tasks.getById(id).-
id[int,list(int)]: The index in the database of the task to fetch, or a list of those.
A
Taskentity ifidis an int, or aEntityList(Task)ifìdis a list. -
-
Update a task of the database. Alternatively, you may call
task.save(). This operation needs administrator privilege.-
entity[Task]: The modified task to save in the database.
-
-
List all tasks contained in the
tasktable of the database.The task list as an
EntityList(Task)object. -
Remove a task from the database. This operation need administrator privilege.
Alternatively you can use
del cli.tasks[id]whereidis the index of the image to delete in the database. Or simply:task.delete()wheretaskis aTaskentity.-
entities[int|Task]: The task to delete or its id.
The deleted task as a
Taskobject. -
An Task object represents a single entity from the task table of the database.
-
id[int]: The index (and primary key) of the task. -
taskType[TaskType]: The task's type. -
annotation[Annotation]: The annotation modified by the task. -
isComplete[bool]: True if the task was marked as completed. -
isVisible[bool]: True if the task is visible. -
comment[str]: Comment associated with the annotation. This comment is not visible from the frontend, it should be used as note created by and for the research team. -
assignedUser[User]: The user to which this task is assigned. -
creator[User]: The user who created this task. Read-only - Inherited attributes from
Entity
The cli.task_types interface (singleton of TaskTypesTable) allows to add, list, modify and delete task types from the table taskType of the database.
-
Create a task type.
-
title[str]: Task type title. -
description[str]: Description of the task displayed next to the image in the annotation interface.
The created task type as an
TaskTypeobject. -
-
Fetch one or several task types from the database. Alternatively you can use
cli.task_types.getById(id).-
id[int,list(int)]: The index in the database of the task type to fetch, or a list of those.
A
TaskTypeentity ifidis an int, or aEntityList(TaskType)ifìdis a list. -
-
Update a task type of the database. Alternatively, you may call
entity.save(). This operation needs administrator privilege.-
entity[TaskType]: The modified task to save in the database.
-
-
List all task types contained in the
taskTypetable of the database.The task list as an
EntityList(TaskType)object. -
Remove a task type from the database. This operation need administrator privilege.
Alternatively you can use
del cli.task_types[id]whereidis the index of the image to delete in the database. Or simply:task_types.delete()where task_types is aTaskTypeentity.-
entities[int|TaskType]: The task type to delete or its id.
The deleted task type as a
TaskTypeobject. -
An TaskType object represents a single entity from the taskType table of the database.
-
id[int]: The index (and primary key) of the task type. -
title[str]: Task type's title. -
description[str]: Task type's description. - Inherited attributes from
Entity
The cli.submission_events interface (singleton of SumbissionEventTable) allows to list submission events from the table submissionEvents of the database.
-
Fetch one or several annotations from the database. Alternatively you can use
cli.submission_events.getById(id).-
id[int,list(int)]: The index in the database of the event to fetch, or a list of those.
A
SumbissionEvententity ifidis an int, or aEntityList(SumbissionEvent)ifìdis a list. -
-
List all submission contained in the
submissionEventstable of the database. Optionally events can be filtered.-
user[int|User]: A user or its id. If notNone, only events submitted by this user will be listed. -
image[int|Image]: An image or its id. If notNone, only events related to this image will be displayed.
The event matching the filter parameters as an
EntityList(SubmissionEvent)object. -
A SubmissionEvent object represents a single entity from the submissionEvent table of the database.
-
id[int]: The index (and primary key) of the event. -
description[str]: Submission's description. Some descriptions are generated automatically (for example when creating or cloning an annotation). -
date[str]: Submission's date. -
timestamp[float]: Time spent annotating since the last event (in minutes). -
user[User]: The user who made the submission. -
parentEventId[int]: The id of the parent submission event of this event. - Inherited attributes from
Entity
-
Fetch the parent event.
The parent event as a
SubmissionEvent. -
Retrieve all submission events in this event history. (This event parent, its parent, until the original submission).
An
EntityList(SubmissionEvent)containing all ancestors of this event and itself, sorted in chronological order.