OS1 Services
Dispatch Service
Jobs and Objectives
11 min
introduction to jobs a job is the sequence of workflows to be executed to complete a single leg of an expected path of an order (point to point) an expected path is a path/route for the movement of the participants and/or containers to fulfill an order each segment of the route is referred to as a job (legs) examples for the order ‘pickup shipment from location a and deliver it to location b’, the expected path could have three legs/jobs for the order ‘go to location b and install the refrigerator, the expected path could have just one leg/job to create a job, call the create a new job endpoint request bodies are specified in json format the following examples show a request body for creating a job member description validation data type jobworkflowid job workflow id minlength 1 maxlength 64 string jobref (optional) external job reference minlength 1 maxlength 64 string objectives (optional) list of all objectives within the job minitems 1 objectiveref reference id for individual objectives minlength 4 maxlength 36 string objectives > location (optional) location can be passed as the location id minlength 1 maxlength 64 string location > address address where the job needs to be executed location > geolocation > long the range of longitude is 180 to 180 and can be upto 6 decimal places pattern ^(\\+| )?(? 180(? (? \\ 0{1,6})?)|(? \[0 9]|\[1 9]\[0 9]|1\[0 7]\[0 9])(? (? \\ \[0 9]{1,6})?))$ string location > geolocation > lat range of latitude is 90 to 90 and can be upto 6 decimal places pattern ^(\\+| )?(? 90(? (? \\ 0{1,6})?)|(? \[0 9]|\[1 8]\[0 9])(? (? \\ \[0 9]{1,6})?))$ string contact > contactid (optional) sds can be passed in contact minlength 1 maxlength 64 string contact > name contact name string contact > phone > countrycode country code of the mobile it belongs pattern ^\\+(\d{1}\\ )?(\d{1,3})$ string contact > phone > number phone number of the user minlength 4 maxlength 13 string contact > phone > ismobile whether the phone is of type mobile or telephone boolean contact > phone > areacode (optional) in case of type telephone, areacode of the telephone it belongs pattern ^\\+(\d{1}\\ )?(\d{1,3})$ string objective > input containers (optional) list of containers string batchid (optional) batch id minlength 1 maxlength 64 string jobtypename (optional) job type name minlength 3 maxlength 36 string jobtypeid job type id minlength 4 maxlength 64 string event meta (optional) metadata scheduledfor (optional) time slot scheduled for the job scheduledfor > startdatetime start date time number scheduledfor > enddatetime (optional) end date time number the attributes marked with ( ) are mandatory attributes { "jobworkflowid" "jobworkflow\ e768f61e 42bf 4aa6 8ff6 5030114d4307", "jobtypeid" "pickuptest 44d87031 f1f7 56b8 9a47 783dc874d2b6", "jobref" "jobref 02", "objectives" \[ { "objectiveref" "pickup", "contact" { "name" "worldlogistic", "phone" { "countrycode" "+91", "number" "9900889900", "ismobile" true, "areacode" "+91" } }, "location" { "address" { "buildingnumber" "746", "apartmentnumber" "1234", "addressline1" "housing board colony", "addressline2" "new housing board colony", "addressline3" "old street late", "city" "pune", "state" "maharashtra", "zipcode" "112356", "country" { "code" "ind", "name" "india" } }, "geolocation" { "lat" "86 74739", "long" "24 7283" } }, "input" { "items" \[ { "skuid" "id1" } ], "title" "title1" } } ] } attributes of a job a job has the following attributes attribute name data type expected purpose tenant id uuid the id of the tenant to whose data domain the job belongs job id uuid the system generated id of the job instructions (optional) array of json the instruction json schema is as follows 1\ id unique id for instruction 2\ containers list of containers associated with this instruction 3\ location location id of the location where the instruction is to be performed 4\ contact name and contact number of the customer (a secure data id if the real phone number is passed masked phone number can be passed directly) 5\ timeslot defines the preferred time slot for executing this instruction has two keys from and to which have the start & end epoch time of the time slot 6\ workflow workflow instance id (workflow instance is workflow id plus the input data for executing the workflow the instance is stored in the workflow service and passed as an id here ) 7\ next has two keys onsuccess and onfailure whose values denote the next instruction to be executed in case of current instruction success and failure respectively to create a custom job attribute, call the post attribute config for job endpoint request bodies are specified in json format the following examples show a request body for creating a custom job attribute here's your data converted into a markdown table member description validation data type attributes minitems 1 name attribute name minlength 1 maxlength 32 pattern ^\[a za z]{1,32}$ string description attribute description minlength 0 maxlength 256 string tags tag to be associated with the attribute string datatype data type string, number, boolean, object, array string indexed default false boolean validation specifies all the validations to be performed on an attribute when a participant of this type is created/updated { "attributes" \[ { "name" "job attribute", "description" "description of job attribute", "tags" \[ "job" ], "datatype" "number", "indexed" false, "defaultvalue" { "no" 10 }, "validation" { "range" { "min" 1, "max" 50 }, "required" true } } ] } objectives an objective is one or more execution tasks to be performed as a workflow for a container or set of containers at a given location it is possible that an objective can consist of one or more service ids and service ids in turn can contain one or more containers for example, a warehouse pickup can have multiple service ids and associated containers to pick up to complete a shipment, the operator needs to execute a sequence of jobs (set of actions) associated with it a job has the following entities in it customer, location, and time slot the following describes two different jobs pick up shipment s1 from location a (between 9 am & 10 am) and deliver to location b pick up shipment s2 from location a (between 9 am & 10 am) and deliver to location c if we examine these two jobs, we can see that they contain common areas such as location a and the time slot for pick up based on these common areas, we can convert these jobs into objectives the objective can then be defined as a group of jobs to be performed at a particular location in this example 4 different jobs are converted into objectives job 1 pick up shipment s1 from location a (between 9 am & 10 am) and deliver to location b job 2 pick up shipment s2 from location a (between 9 am & 10 am) and deliver to location c job 3 pick up shipment s3 from location d and deliver to location c job 4 pick up shipment s4 from location a (between 3 pm & 4 pm) and deliver it to location e these jobs are now converted into objectives based on location & time slots stop objective(s) location a pick up shipment s1; pick up shipment s2 location b deliver shipment s1 location d pick up shipment s3 location c deliver shipment s2; deliver shipment s3 location a pick up shipment s4 location e deliver shipment s4 📘 info the objectives are grouped together by the customer, location, and time slot for simplicity of explanation, the customer part has been excluded in the above examples the purpose of creating objectives is to enhance the working efficiency of operators and to eliminate areas of human errors you can pass multiple objectives within a workflow lifecycle of a job the platform provides a default of five states for an objective created this state denotes that an objective has been created assigned this state denotes that the objective has been assigned to a dispatch in progress the state denotes that the job is in progress the event store can give the exact sub state of this state completed this state denotes that the instruction list of the job was completed by the operator canceled this state denotes that the job has been canceled it simply states that the job the operator had to perform was added to a parent job