Uncategorized Clinical Document

Introduction #

The UncategorizedClinicalDocument and UncategorizedClinicalDocumentReview models represent uncategorized clinical documents and their reviews.

Basic Usage #

from canvas_sdk.v1.data import UncategorizedClinicalDocument, UncategorizedClinicalDocumentReview

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

Filtering #

Uncategorized clinical documents and reviews can be filtered by any attribute that exists on the models.

By review mode #

Filter documents by their review mode:

from canvas_sdk.v1.data import UncategorizedClinicalDocument
from canvas_sdk.commands.commands.review import ReviewMode

documents_to_review = UncategorizedClinicalDocument.objects.filter(review_mode=ReviewMode.REVIEW_REQUIRED)

Unreviewed documents #

To get uncategorized documents that have not been reviewed yet and require a review:

from canvas_sdk.v1.data import UncategorizedClinicalDocument
from canvas_sdk.commands.commands.review import ReviewMode
from django.db.models import Q

unreviewed_documents = UncategorizedClinicalDocument.objects.filter(Q(review_mode=ReviewMode.REVIEW_REQUIRED), (Q(review__committer__isnull=True) | Q(review__entered_in_error__isnull=False)))

Delegations #

A document review can be delegated to another staff member or team. The delegations for a document are available through two accessors:

from canvas_sdk.v1.data import UncategorizedClinicalDocument

document = UncategorizedClinicalDocument.objects.get(id="d2194110-5c9a-4842-8733-ef09ea5ead11")

# The full delegation history, oldest first.
history = document.delegations

# The current active delegation, or None when the document is with its owner.
current = document.active_delegation

See DocumentReviewDelegation for the delegation model and the DOCUMENT_DELEGATED event.

Document codings #

The code field comes from the document’s type, which is drawn from a fixed list rather than set freely — either the type selected in Data Integration, or, when a document is created through the FHIR DocumentReference endpoint, the LOINC code supplied in type.coding, which must match one of the codes below. Every coding uses the LOINC system (http://loinc.org). The document types stored as uncategorized clinical documents are:

Document typeCodeDisplay
Care Management Documents91983-7Care management note
Clinical Patient Intake Form64285-0Medical history screening form
Emergency Department Report96335-5Emergency department Summary note
External Medical Records11503-0Medical records
Home Care Report75503-3Patient’s home Note
Hospital Discharge Summary34105-7Hospital Discharge summary
Hospital History and Physical47039-3Hospital Admission history and physical note
Nursing Home34113-1Nursing facility Note
Operative Report11504-8Surgical operation note
Physical Exam Documents51848-0Evaluation note
Prescription Refill Request57833-6Prescription for medication
Rehabilitation Report34823-5Physical medicine and rehab Note
Uncategorized Clinical Document34109-9Note
In Office Testing Documents—none

Administrative document types are stored as PatientAdministrativeDocument instead. Lab reports, imaging reports and specialist consult reports have their own models, so their codings never appear here.

Accessing the document file #

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

from canvas_sdk.v1.data import UncategorizedClinicalDocument

record = UncategorizedClinicalDocument.objects.get(
    id="d2194110-5c9a-4842-8733-ef09ea5ead11"
)

# Presigned S3 URL to the document file, or None
url = record.document_url

The document reference #

Each record also has a DocumentReference pointing back at it. The document reference carries the document’s coding, category, and status, and represents the document in the FHIR API. Use document_url to get the file itself, and the document reference when you want that metadata.

To find it, resolve the ContentType at runtime from its stable app_label and model — never hardcode the per-environment dbid — and match object_id against the record’s dbid:

from canvas_sdk.v1.data import ContentType, DocumentReference, UncategorizedClinicalDocument

record = UncategorizedClinicalDocument.objects.get(
    id="d2194110-5c9a-4842-8733-ef09ea5ead11"
)

content_type = ContentType.objects.filter(
    app_label="api", model="uncategorizedclinicaldocument"
).first()

document = DocumentReference.objects.filter(
    content_type=content_type, object_id=record.dbid
).first()

url = document.document_url if document else None

Attributes #

UncategorizedClinicalDocument #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
patientPatient
originatorCanvasUser
assigned_byCanvasUser
reviewUncategorizedClinicalDocumentReview
teamTeam
codeDocumentCoding
nameString
review_modeDocumentReviewMode
junkedBoolean
requires_signatureBoolean
assigned_dateDateTime
team_assigned_dateDateTime
original_dateDate
commentString
priorityBoolean
documentFile (S3 key)
document_urlString (computed)

UncategorizedClinicalDocumentReview #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
originatorCanvasUser
committerCanvasUser
entered_in_errorCanvasUser
internal_commentString
message_to_patientString
statusString
patientPatient
patient_communication_methodString
reportsQuerySet[UncategorizedClinicalDocument]