Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _data/menus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,9 @@ effects_module:
- title: "Custom HTML and Django Templates"
url: /sdk/layout-effect/#custom-html-and-django-templates
description: Render custom HTML using Django templates.
- title: "Data Integration"
url: /sdk/effect-data-integration/
description: Manage documents in the Data Integration queue.
- title: "Create Calendar"
url: /sdk/calendar-create-effect/
description: Create a calendar for a provider.
Expand Down
1 change: 1 addition & 0 deletions collections/_sdk/effects.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ The following effects are available to be applied in Canvas.
| RESCHEDULE_APPOINTMENT | Can be used to reschedule an appointment. Check out [Appointment Effects](/sdk/effect-notes/#reschedule-appointment). |
| RESCHEDULE_SCHEDULE_EVENT | Can be used to reschedule a schedule event. Check out [Schedule Event Effects](/sdk/effect-notes/#reschedule-schedule-event). |
| APPOINTMENT__SLOTS__POST_SEARCH_RESULTS | Can be used to modify slot availability when scheduling an appointment |
| ASSIGN_DOCUMENT_REVIEWER | Can be used to assign a staff member or team as reviewer to a document in the Data Integration queue. |

<br/>
<br/>
Expand Down
124 changes: 124 additions & 0 deletions collections/_sdk/effects/data_integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
title: "Data Integration"
slug: "effect-data-integration"
excerpt: "Manage documents in the Data Integration queue."
hidden: false
---

The Canvas SDK allows you to manage documents in the Data Integration queue.

## Assigning a Document Reviewer

To assign a staff member or team as a reviewer to a document in the Data Integration queue, import the `AssignDocumentReviewer` class and create an instance of it.

| Attribute | | Type | Description |
|-------------------|----------|---------------------------|--------------------------------------------------------------------------------------------------------------------|
| document_id | required | string or int | The ID of the IntegrationTask document to assign a reviewer to. |
| reviewer_id | optional | string or int | The Staff key of the reviewer to assign. |
| team_id | optional | string or int | The Team UUID to assign. |
| priority | optional | [Priority](#priority) | Priority level for the review. Defaults to `NORMAL`. |
| review_mode | optional | [ReviewMode](#reviewmode) | Review mode for the document. Defaults to `REVIEW_REQUIRED`. |
| confidence_scores | optional | dict | Confidence scores for document identification. See [Confidence Scores](#confidence-scores). |

### Priority

| Value | Description |
|--------|------------------------------------------------|
| NORMAL | Standard priority (default). |
| HIGH | Elevated priority for time-sensitive documents.|

### ReviewMode

| Value | Description |
|---------------------|------------------------------------------------------|
| REVIEW_REQUIRED | Document requires active review and action (default).|
| ALREADY_REVIEWED | Document was already reviewed offline. |
| REVIEW_NOT_REQUIRED | Document does not require review. |

### Confidence Scores

The `confidence_scores` parameter accepts a dictionary with the following optional keys:

| Key | Type | Description |
|-------------|-------|---------------------------------------------------------|
| document_id | float | Confidence score for document identification (0.0-1.0). |

An example of assigning a staff reviewer:

```python
from canvas_sdk.effects import Effect
from canvas_sdk.effects.data_integration import AssignDocumentReviewer, Priority, ReviewMode
from canvas_sdk.events import EventType
from canvas_sdk.protocols import BaseProtocol

from canvas_sdk.v1.data.integration_task import IntegrationTask
from canvas_sdk.v1.data.staff import Staff


class Protocol(BaseProtocol):
RESPONDS_TO = [
EventType.Name(EventType.INTEGRATION_TASK_CREATED),
]

def compute(self) -> list[Effect]:
integration_task = IntegrationTask.objects.get(id=self.target)
reviewer = Staff.objects.get(last_name="Smith")

assign_reviewer = AssignDocumentReviewer(
document_id=integration_task.id,
reviewer_id=reviewer.id,
priority=Priority.NORMAL,
review_mode=ReviewMode.REVIEW_REQUIRED,
)

return [assign_reviewer.apply()]
```

An example of assigning a team reviewer:

```python
from canvas_sdk.effects import Effect
from canvas_sdk.effects.data_integration import AssignDocumentReviewer, Priority
from canvas_sdk.events import EventType
from canvas_sdk.protocols import BaseProtocol

from canvas_sdk.v1.data.integration_task import IntegrationTask
from canvas_sdk.v1.data.team import Team


class Protocol(BaseProtocol):
RESPONDS_TO = [
EventType.Name(EventType.INTEGRATION_TASK_CREATED),
]

def compute(self) -> list[Effect]:
integration_task = IntegrationTask.objects.get(id=self.target)
team = Team.objects.get(name="Document Review")

assign_reviewer = AssignDocumentReviewer(
document_id=integration_task.id,
team_id=team.id,
priority=Priority.HIGH,
)

return [assign_reviewer.apply()]
```

You can assign both a staff member and a team to the same document:

```python
from canvas_sdk.effects.data_integration import AssignDocumentReviewer, Priority, ReviewMode

assign_reviewer = AssignDocumentReviewer(
document_id="d2194110-5c9a-4842-8733-ef09ea5ead11",
reviewer_id="staff-key-here",
team_id="team-uuid-here",
priority=Priority.HIGH,
review_mode=ReviewMode.REVIEW_REQUIRED,
confidence_scores={"document_id": 0.95},
)
```

<br/>
<br/>
<br/>
Loading