alab_management.user_input module#

class UserInputView[source]#

Bases: object

Sample view manages the samples and their positions.

clean_up_user_input_collection()[source]#

Drop the sample position collection.

get_all_pending_requests()[source]#

Get all pending requests.

Returns a list of pending requests.

Return type:

list

get_request(request_id)[source]#

Get a request.

Returns a request.

Return type:

dict[str, Any]

insert_request(prompt, options, task_id=None, maintenance=False, category='Unknown Category')[source]#

Insert a request into the database.

Returns the request ObjectID

Return type:

ObjectId

retrieve_user_input(request_id)[source]#

Retrive response from user for a given request. Blocks until request is marked as completed.

Returns the user response, which is one of a list of options

Return type:

str

retrieve_user_input_with_note(request_id)[source]#

Retrive response from user for a given request. Blocks until request is marked as completed.

Returns the user response, which is one of a list of options

Return type:

tuple[str, str]

update_request_status(request_id, response, note)[source]#

Update the status of a request.

class UserRequestStatus(value)[source]#

Bases: Enum

Enum for user response.

ERROR = 'error'#
FULLFILLED = 'fulfilled'#
PENDING = 'pending'#
request_maintenance_input(prompt, options)[source]#

Request user input for maintenance through the dashboard. Blocks until response is given.

Parameters:
  • prompt (str) – prompt to give user

  • options (List[str]) – response options to give user

Returns:

response (str): user response as string

request_user_input(task_id, prompt, options, maintenance=False, category='Unknown Category')[source]#

Request user input through the dashboard. Blocks until response is given.

Parameters:
  • task_id (ObjectId) – task id requesting user input

  • prompt (str) – prompt to give user

  • options (List[str]) – response options to give user

  • maintenance (bool) – if true, mark this as a request for overall system maintenance

Return type:

str

Returns:

response (str): user response as string

request_user_input_with_note(task_id, prompt, options, maintenance=False, category='Unknown Category')[source]#

Request user input through the dashboard. Blocks until response. Returns response and note.

Parameters:
  • task_id (ObjectId) – task id requesting user input

  • prompt (str) – prompt to give user

  • options (List[str]) – response options to give user

  • maintenance (bool) – if true, mark this as a request for overall system maintenance

Return type:

tuple[str, str]

Returns:

response (str): user response as string note (str): note from the user