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 Name | Type | Description |
|---|---|---|
| id | UUID | |
| dbid | Integer | |
| created | DateTime | |
| modified | DateTime | |
| status | IntegrationTaskStatus | |
| type | String | |
| title | String | |
| document | File (S3 key) | The document as received |
| channel | IntegrationTaskChannel | |
| patient | Patient | |
| service_provider | ServiceProvider | |
| reviews | IntegrationTaskReview[] | |
| action_events | IntegrationTaskActionEvent[] | Faxes of this task, with their delivery status |
| document_url | String (computed) | Presigned S3 URL for document, or None if unset |
| is_fax | Boolean (computed) | Whether this is a fax task |
| is_pending | Boolean (computed) | Whether this task is pending review |
| is_processed | Boolean (computed) | Whether this task has been processed |
| has_error | Boolean (computed) | Whether this task has an error |
| is_junked | Boolean (computed) | Whether this task is junked |
IntegrationTaskReview #
| Field Name | Type | Description |
|---|---|---|
| id | UUID | |
| dbid | Integer | |
| created | DateTime | |
| modified | DateTime | |
| task | IntegrationTask | |
| template_name | String | |
| document_key | String | |
| reviewer | Staff | |
| team_reviewer | Team | |
| junked | Boolean | |
| is_active | Boolean (computed) | Whether this review is active (not junked) |
Enumeration types #
IntegrationTaskStatus #
| Value | Label |
|---|---|
| UNR | Unread |
| UER | Unread Error |
| REA | Read |
| ERR | Error |
| PRO | Processed |
| REV | Reviewed |
| JUN | Junk |
IntegrationTaskChannel #
| Value | Label |
|---|---|
| fax | Fax |
| document_upload | Document Upload |
| from_integration_engine | From Integration Engine |
| from_patient_portal | From Patient Portal |