action_list_patient ()

action_list_patient ()

Function prototype

action_list_patient (session, id , action{, path = NULL} {, action_context = NULL})

API Version2.7.8 and higher

This function returns a list of possible actions that can be executed by a PATIENT or a PATIENT'S ASSOCIATE.Depending on the "action" parameter the function will return the available choices for the active patient.

The "EVENT" action will return the possible MESSAGES that can be posted by a patient as they have been defined in the program template by associating EVENT stage, context "PATIENT" in context visibility and Insertion permission to "Patient".


The difference between this function and action_list_case () is that this function is called from the PATIENT point of view, while action_list_case () is called from the PROFESSIONAL point of view (a professional can execute actions on a patient that are not allowed to the patient itself).

The input parameter “action” describes the type of action

Input

parameters:

  • session: is the session token obtained in the session_init() call
  • id: is a CASE reference id (mandatory) of the active patient.
  • action: type of actions requested. If null, then the list of available actions will be returned. Possible values:
    • empty: the function will return a list of available actions
    • "EVENT": the function will return all the available NOTIFICATION actions for the CASE
    • "CASE": the function returns available TASKS for the CASE.
  • path: The goal of this parameter is to organize the actions hierarchically (as in a file tree where path represents the subdirectory). When calling action_list_patient(), some of the actions returned may be of type PATH, in which case the value of the path returned can be used to make a subsequent call to action_list_patient() to get the actions nested in that path.
  • action_context: JSON structure that the function will use as context information to generate the list of actions. See ACTION CONTEXT (JSON) for more information

Output

parameters:

  • result: XML with the list of possible actions. Each action in the XML contains:
    • ref: action reference. If the action is of class PATH, then this it can be used to call again the function passing the value in the path parameter to obtain a new list of actions
    • name: short name in the active session’s language
    • description: description in the active session’s language
    • class: PATH | ACTION
    • type: action type
  • ErrorMsg: If any error occurs, then this value contains a description of the error translated to the current language
  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES

Request

sample:

patient_action_list ( “LCAAAAAAAAAAAA”, "232", "NOTIFICATION", "", "{program: 323}" );

Response

sample:


<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<result>
	<actions>
		<description>Select an action</description>
   		<action>
			<ref>action_token</ref>
			<name>short_name</name>
			<description>desc</description>
			<class>ACTION</class>
		</action>
		<action>...</action>
	</actions>
</result>
<ErrorMsg></ErrorMsg>
<ErrorCode></ErrorCode>



Notes:


Return Error codes

ERROR CODE

INVALID_TOKEN

The session token provided is not valid

INSUFFICIENT_PRIVILEGES

The session user does not have the necessary privileges to create request the 'action' indicated

NVALID_JSON

The JSON string provided in parameter action_context has an invalid format

CASE.NOT_FOUND

The CASE reference provided in parameter action_context does not correspond to an existing CASE

TEAM.NOT_FOUND

The TEAM reference provided in parameter action_context does not correspond to a valid TEAM

PROGRAM.NOT_FOUNDThe PROGRAM reference provided in parameter action_context does not correspond to a valid PROGRAM
INVALID_DATEThe date value provided in parameter action_context does not have a valid format