Job lifecycle
A job is one blood draw for one patient. Each job moves through a series of JobStatuses, and your integration drives most of those transitions with mutations.
Statuses
| Status | Meaning |
|---|---|
AVAILABLE | The job is open to vendors in its network. |
PUBLISHED | The job belongs to a vendor and has been published to that vendor's network of phlebotomists, but no technician is assigned yet. Natera can also publish a job directly to a vendor. |
ASSIGNED | The job has been assigned to a technician. |
SCHEDULED | The patient has confirmed an appointment time. |
ON_THE_WAY | The technician has started traveling. |
ON_SITE | The technician has arrived at the job site. |
IN_PROGRESS | The draw is in progress. |
COMPLETED | The job has been completed and the sample shipped. |
CANCELLED | The job no longer needs to be completed. |
Typical flow
-
Take the job. You learn about an
AVAILABLEjob from theJOB_AVAILABLEwebhook or fromjobConnection. FromAVAILABLE, a job goes one of two ways:- Assign it directly. Call
assignJobwith one of your technicians. The job becomes yours and moves straight toASSIGNED. - Publish it to your phlebotomists. Publish the job to your network, which moves it to
PUBLISHED. Then callassignJobonce a technician picks it up. Publishing is done from the MPX dashboard; the Vendor API doesn't have a publish mutation yet.
Natera can also publish a job directly to your vendor. When that happens you receive a
JOB_PUBLISHEDwebhook and assign it the same way. - Assign it directly. Call
-
Schedule. Once you've agreed a time with the patient, call
scheduleJobwith astartTimeand an optionalendTime. When rescheduling, you can include areason(RescheduleJobReasons) and anote. -
Report progress. Call
onTheWayJob,onSiteJobandinProgressJobas the technician progresses. -
Complete. Call
completeJobwith aCompletedJobReasonsvalue and, optionally, shippingtracking. Anoteis required for every reason exceptSample_Completely_Obtained_and_Shipped.
Other actions
declineJob: decline anAVAILABLEjob you don't want, with aJobDeclineReasonsvalue. Declined jobs no longer appear in yourjobConnectionresults while they remain available. You can't decline a job that already belongs to your vendor.unassignJob: remove the technician but keep the job with your vendor. The job returns toPUBLISHED.unclaimJob: give the job up. It returns toAVAILABLE.cancelJob: cancel with aCancelledJobReasonsvalue. Anoteis required when the reason isOther.addNoteJob: add a note of a givenJobNoteType.addJobTrackingNumber: add a shipment tracking number. WhencarrierisOTHER,othermust name the carrier.
Allowed states per mutation
If you call a mutation while the job is in a status it doesn't support, it fails with INVALID_JOB_STATE.
| Mutation | Fails when the job is |
|---|---|
assignJob | anything other than AVAILABLE or PUBLISHED |
scheduleJob | AVAILABLE, PUBLISHED, CANCELLED or COMPLETED |
onTheWayJob | AVAILABLE, PUBLISHED or ASSIGNED |
onSiteJob | AVAILABLE, PUBLISHED or ASSIGNED |
inProgressJob | AVAILABLE, PUBLISHED or ASSIGNED |
completeJob | AVAILABLE, PUBLISHED or ASSIGNED |
cancelJob | AVAILABLE |
unclaimJob | COMPLETED or CANCELLED |
addNoteJob | AVAILABLE |
addJobTrackingNumber | AVAILABLE |
| Attachment upload | AVAILABLE |
unassignJob has no status restriction, but fails with INVALID_JOB_ERROR if the job has no assignee.
Visibility
You can see and act on:
- jobs that belong to your vendor, and
AVAILABLEjobs whose network includes your vendor.
A job owned by another vendor returns JOB_NOT_FOUND from mutations. The job query returns INVALID_VENDOR_ERROR for it instead. See Error codes.