From 69732295191f7a1bf42eb384810c667735705644 Mon Sep 17 00:00:00 2001 From: irfan-vicert Date: Mon, 5 Jan 2026 12:13:29 +0100 Subject: [PATCH 1/3] KOALA-3916: Added REMOVE_DOCUMENT_FROM_PATIENT effect --- _data/menus.yml | 3 + collections/_sdk/effects.md | 1 + collections/_sdk/effects/data_integration.md | 78 ++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 collections/_sdk/effects/data_integration.md diff --git a/_data/menus.yml b/_data/menus.yml index 13fc5a5b7..5c5b7a885 100644 --- a/_data/menus.yml +++ b/_data/menus.yml @@ -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. diff --git a/collections/_sdk/effects.md b/collections/_sdk/effects.md index f2217bc74..215e98331 100644 --- a/collections/_sdk/effects.md +++ b/collections/_sdk/effects.md @@ -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 | +| REMOVE_DOCUMENT_FROM_PATIENT | Can be used to remove/unlink a document from a patient in the Data Integration queue. |

diff --git a/collections/_sdk/effects/data_integration.md b/collections/_sdk/effects/data_integration.md new file mode 100644 index 000000000..69a99ec33 --- /dev/null +++ b/collections/_sdk/effects/data_integration.md @@ -0,0 +1,78 @@ +--- +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. + +## Removing a Document from a Patient + +To remove or unlink a document from a patient in the Data Integration queue, import the `RemoveDocumentFromPatient` class and create an instance of it. + +| Attribute | | Type | Description | +|-------------------|----------|---------------|---------------------------------------------------------------------------------------------------------------------| +| document_id | required | string or int | The ID of the IntegrationTask document to unlink from the patient. | +| patient_id | optional | string | The patient ID to specify which patient link to remove. If not provided, removes the current patient association. | +| confidence_scores | optional | dict | Confidence scores for the removal decision. See [Remove Confidence Scores](#remove-confidence-scores). | + +### Remove Confidence Scores + +The `confidence_scores` parameter accepts a dictionary with the following optional keys: + +| Key | Type | Description | +|---------|-------|----------------------------------------------------------------------------------------------------------------------------------| +| removal | float | Confidence score for the document removal decision (0.0-1.0). Higher values indicate greater confidence in the removal decision. | + +An example of removing a document from a patient: + +```python +from canvas_sdk.effects import Effect +from canvas_sdk.effects.data_integration import RemoveDocumentFromPatient +from canvas_sdk.events import EventType +from canvas_sdk.protocols import BaseProtocol + +from canvas_sdk.v1.data.integration_task import IntegrationTask + + +class Protocol(BaseProtocol): + RESPONDS_TO = [ + EventType.Name(EventType.INTEGRATION_TASK_UPDATED), + ] + + def compute(self) -> list[Effect]: + integration_task = IntegrationTask.objects.get(id=self.target) + + remove_document = RemoveDocumentFromPatient( + document_id=integration_task.id, + ) + + return [remove_document.apply()] +``` + +If a document could be linked to multiple patients, you can specify which patient to unlink: + +```python +from canvas_sdk.effects.data_integration import RemoveDocumentFromPatient + +remove_document = RemoveDocumentFromPatient( + document_id="d2194110-5c9a-4842-8733-ef09ea5ead11", + patient_id="patient-uuid-here", +) +``` + +An example of removing with confidence score: + +```python +from canvas_sdk.effects.data_integration import RemoveDocumentFromPatient + +remove_document = RemoveDocumentFromPatient( + document_id="d2194110-5c9a-4842-8733-ef09ea5ead11", + confidence_scores={"removal": 0.95}, +) +``` + +
+
+
From 6b23132aa400d76a8ee3d4d7892752aebdc32eb3 Mon Sep 17 00:00:00 2001 From: irfan-vicert Date: Fri, 23 Jan 2026 14:29:22 +0100 Subject: [PATCH 2/3] KOALA-3916: Doc update --- collections/_sdk/effects/data_integration.md | 42 +++++--------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/collections/_sdk/effects/data_integration.md b/collections/_sdk/effects/data_integration.md index 69a99ec33..4e9750ee6 100644 --- a/collections/_sdk/effects/data_integration.md +++ b/collections/_sdk/effects/data_integration.md @@ -11,19 +11,10 @@ The Canvas SDK allows you to manage documents in the Data Integration queue. To remove or unlink a document from a patient in the Data Integration queue, import the `RemoveDocumentFromPatient` class and create an instance of it. -| Attribute | | Type | Description | -|-------------------|----------|---------------|---------------------------------------------------------------------------------------------------------------------| -| document_id | required | string or int | The ID of the IntegrationTask document to unlink from the patient. | -| patient_id | optional | string | The patient ID to specify which patient link to remove. If not provided, removes the current patient association. | -| confidence_scores | optional | dict | Confidence scores for the removal decision. See [Remove Confidence Scores](#remove-confidence-scores). | - -### Remove Confidence Scores - -The `confidence_scores` parameter accepts a dictionary with the following optional keys: - -| Key | Type | Description | -|---------|-------|----------------------------------------------------------------------------------------------------------------------------------| -| removal | float | Confidence score for the document removal decision (0.0-1.0). Higher values indicate greater confidence in the removal decision. | +| Attribute | | Type | Description | +|-------------|----------|---------------|-------------------------------------------------------------------------------------------------------------------| +| document_id | required | string or int | The ID of the IntegrationTask document to unlink from the patient. | +| patient_id | optional | string | The patient ID to specify which patient link to remove. If not provided, removes the current patient association. | An example of removing a document from a patient: @@ -31,21 +22,17 @@ An example of removing a document from a patient: from canvas_sdk.effects import Effect from canvas_sdk.effects.data_integration import RemoveDocumentFromPatient from canvas_sdk.events import EventType -from canvas_sdk.protocols import BaseProtocol - -from canvas_sdk.v1.data.integration_task import IntegrationTask +from canvas_sdk.handlers import BaseHandler -class Protocol(BaseProtocol): - RESPONDS_TO = [ - EventType.Name(EventType.INTEGRATION_TASK_UPDATED), - ] +class RemoveDocumentHandler(BaseHandler): + RESPONDS_TO = EventType.Name(EventType.DOCUMENT_LINKED_TO_PATIENT) def compute(self) -> list[Effect]: - integration_task = IntegrationTask.objects.get(id=self.target) + document_id = self.event.target.id remove_document = RemoveDocumentFromPatient( - document_id=integration_task.id, + document_id=document_id, ) return [remove_document.apply()] @@ -62,17 +49,6 @@ remove_document = RemoveDocumentFromPatient( ) ``` -An example of removing with confidence score: - -```python -from canvas_sdk.effects.data_integration import RemoveDocumentFromPatient - -remove_document = RemoveDocumentFromPatient( - document_id="d2194110-5c9a-4842-8733-ef09ea5ead11", - confidence_scores={"removal": 0.95}, -) -``` -


From fcbf3a27dfbb644b9c60a7c00df7a758b93e4d76 Mon Sep 17 00:00:00 2001 From: irfan-vicert Date: Tue, 27 Jan 2026 12:15:28 +0100 Subject: [PATCH 3/3] KOALA-3916: doc update --- collections/_sdk/effects/data_integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collections/_sdk/effects/data_integration.md b/collections/_sdk/effects/data_integration.md index 4e9750ee6..4604d8537 100644 --- a/collections/_sdk/effects/data_integration.md +++ b/collections/_sdk/effects/data_integration.md @@ -13,7 +13,7 @@ To remove or unlink a document from a patient in the Data Integration queue, imp | Attribute | | Type | Description | |-------------|----------|---------------|-------------------------------------------------------------------------------------------------------------------| -| document_id | required | string or int | The ID of the IntegrationTask document to unlink from the patient. | +| document_id | required | string | The ID of the IntegrationTask document to unlink from the patient. | | patient_id | optional | string | The patient ID to specify which patient link to remove. If not provided, removes the current patient association. | An example of removing a document from a patient: