Integration Task

Introduction #

The IntegrationTask and IntegrationTaskReview models represent incoming documents that need processing in Canvas. Integration tasks are created when documents arrive via fax, document upload, integration engine, or the patient portal. Each task can have one or more reviews that track who is responsible for processing the document and its current state.

Basic Usage #

To retrieve an IntegrationTask or IntegrationTaskReview by identifier, use the get method on the model manager:

from canvas_sdk.v1.data.integration_task import IntegrationTask, IntegrationTaskReview

task = IntegrationTask.objects.get(id="d2194110-5c9a-4842-8733-ef09ea5ead11")
review = IntegrationTaskReview.objects.get(id="c1a5a35a-4ee2-4a0e-85c0-21739dc8c4a8")

If you have a patient object, integration tasks can be accessed with the integration_tasks attribute on a Patient object:

from canvas_sdk.v1.data.patient import Patient

patient = Patient.objects.get(id="1eed3ea2a8d546a1b681a2a45de1d790")
tasks = patient.integration_tasks.all()

Accessing the document file #

The document_url property returns a presigned S3 URL for the document as Canvas received it, or None when the task has no file. The URL is valid for one hour, so generate it when you need it rather than storing it.

from canvas_sdk.v1.data.integration_task import IntegrationTask

task = IntegrationTask.objects.get(id="d2194110-5c9a-4842-8733-ef09ea5ead11")

# Presigned S3 URL to the received document, or None
url = task.document_url

Filtering #

Integration tasks and reviews can be filtered by any attribute that exists on the models.

By status #

Filter tasks by their processing status:

from canvas_sdk.v1.data.integration_task import IntegrationTask

# Get all unread tasks
unread = IntegrationTask.objects.unread()

# Get tasks pending review (UNREAD or READ)
pending = IntegrationTask.objects.pending_review()

# Get processed tasks (PROCESSED or REVIEWED)
processed = IntegrationTask.objects.processed()

# Get tasks with errors
errored = IntegrationTask.objects.with_errors()

# Get non-junked tasks
active = IntegrationTask.objects.not_junked()

By channel #

Filter tasks by their source channel:

from canvas_sdk.v1.data.integration_task import IntegrationTask

faxes = IntegrationTask.objects.faxes()
uploads = IntegrationTask.objects.uploads()
engine_tasks = IntegrationTask.objects.from_integration_engine()
portal_tasks = IntegrationTask.objects.from_patient_portal()

By patient #

from canvas_sdk.v1.data.integration_task import IntegrationTask

tasks = IntegrationTask.objects.for_patient("patient-id")

Filtering reviews #

from canvas_sdk.v1.data.integration_task import IntegrationTaskReview

# Get reviews for a specific task
reviews = IntegrationTaskReview.objects.for_task("task-id")

# Get active (non-junked) reviews
active_reviews = IntegrationTaskReview.objects.active()

# Get reviews by a specific reviewer
reviewer_reviews = IntegrationTaskReview.objects.by_reviewer("staff-id")

# Get reviews assigned to a specific team
team_reviews = IntegrationTaskReview.objects.by_team("team-id")

Attributes #

IntegrationTask #

Field NameTypeDescription
idUUID 
dbidInteger 
createdDateTime 
modifiedDateTime 
statusIntegrationTaskStatus 
typeString 
titleString 
documentFile (S3 key)The document as received
channelIntegrationTaskChannel 
patientPatient 
service_providerServiceProvider 
reviewsIntegrationTaskReview[] 
action_eventsIntegrationTaskActionEvent[]Faxes of this task, with their delivery status
document_urlString (computed)Presigned S3 URL for document, or None if unset
is_faxBoolean (computed)Whether this is a fax task
is_pendingBoolean (computed)Whether this task is pending review
is_processedBoolean (computed)Whether this task has been processed
has_errorBoolean (computed)Whether this task has an error
is_junkedBoolean (computed)Whether this task is junked

IntegrationTaskReview #

Field NameTypeDescription
idUUID 
dbidInteger 
createdDateTime 
modifiedDateTime 
taskIntegrationTask 
template_nameString 
document_keyString 
reviewerStaff 
team_reviewerTeam 
junkedBoolean 
is_activeBoolean (computed)Whether this review is active (not junked)

Enumeration types #

IntegrationTaskStatus #

ValueLabel
UNRUnread
UERUnread Error
REARead
ERRError
PROProcessed
REVReviewed
JUNJunk

IntegrationTaskChannel #

ValueLabel
faxFax
document_uploadDocument Upload
from_integration_engineFrom Integration Engine
from_patient_portalFrom Patient Portal