Coding Gap Events

Introduction #

The CreateCodingGapEvent, ValidateCodingGapEvent, AssessCodingGapEvent, and DeferCodingGapEvent models are records of the actions taken on a coding gap: create, validate, assess, and defer. Each model is the anchor for the corresponding coding gap command.

A coding gap itself is represented by a DetectedIssue together with its DetectedIssueEvidence. These four models record only the actions taken on the coding gap. A coding gap event’s detected_issue foreign key is nullable, so expect events without an associated DetectedIssue.

These are audit records of create, validate, assess, and defer actions — useful for reporting, deduplication logic, and risk adjustment and HCC (Hierarchical Condition Category) coding gap analytics. A plugin does not perform these actions through these models. Each is performed instead through its own command — the Create Coding Gap, Validate Coding Gap, Assess Coding Gap, and Defer Coding Gap commands respectively.

Basic usage #

To get a coding gap event by identifier, use the get method on the model manager. Each of the four models is imported from canvas_sdk.v1.data:

from canvas_sdk.v1.data import CreateCodingGapEvent

create_event = CreateCodingGapEvent.objects.get(id="61a1853f-168f-4ed3-80d2-44e5d144bcf3")

All four models expose the same manager, so get, filter, and committed are available on each.

Accessing events from a patient or note #

The coding gap events for a patient or note are reachable through reverse accessors. For each model, the accessor name is the same on Patient and on Note:

ModelPatient & Note reverse accessorDetectedIssue reverse accessor
CreateCodingGapEventcreated_detected_issuescreated_coding_gap_events
ValidateCodingGapEventassessed_detected_issuesvalidated_coding_gap_events
AssessCodingGapEventassessed_coding_gapsassessed_coding_gap_events
DeferCodingGapEventdeferred_detected_issuesdeferred_coding_gap_events

For a patient, use the accessor on the Patient object:

from canvas_sdk.v1.data.patient import Patient

patient = Patient.objects.get(id="1eed3ea2a8d546a1b681a2a45de1d790")
create_events = patient.created_detected_issues.all()

The same records are reachable from the note they were recorded on, with the matching accessor on the Note object:

from canvas_sdk.v1.data.note import Note

note = Note.objects.get(id="89992c23-c298-4118-864a-26cb3e1ae822")
defer_events = note.deferred_detected_issues.all()

Accessing events from a detected issue #

For a given coding gap, each model’s events are reachable from the DetectedIssue through its own reverse accessor:

ModelDetectedIssue reverse accessor
CreateCodingGapEventcreated_coding_gap_events
ValidateCodingGapEventvalidated_coding_gap_events
AssessCodingGapEventassessed_coding_gap_events
DeferCodingGapEventdeferred_coding_gap_events
from canvas_sdk.v1.data.detected_issue import DetectedIssue

detected_issue = DetectedIssue.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")
create_events = detected_issue.created_coding_gap_events.all()

Assessed coding gaps on a condition #

AssessCodingGapEvent records the conditions a coding gap was assessed against through its conditions many-to-many relationship:

from canvas_sdk.v1.data import AssessCodingGapEvent

assess_event = AssessCodingGapEvent.objects.get(id="0b2f2f8c-3c2c-4d9e-9a1a-2b6a4c7d8e90")
conditions = assess_event.conditions.all()

When a clinician accepts a coding gap with Accept and Assess, conditions holds one condition for each picked diagnosis, and the note gets an assessment of each one. In the command’s data, this option’s status value is "accept and diagnose".

  • If the patient already has a charted condition with the diagnosis’s ICD-10 code, the command uses that condition instead of adding a duplicate. A resolved or investigative condition becomes active again.
  • Otherwise, the command records a new condition.
  • With Show in problem list on, which is the default, each condition becomes a problem list item. It takes the Category Domain picked in the command, and a charted condition keeps its own domain when none is picked. With the box off, each condition becomes an encounter diagnosis, with no domain.

Entering the Assess Coding Gap command in error enters in error the conditions it recorded and the assessments it added. A charted condition it used stays on the chart, with its earlier categories and onset date. If the command made that condition active again, the condition is resolved again, unless an assessment committed afterward uses it.

For a given condition, the assess events it was included in are reachable with the assessed_coding_gaps accessor on a Condition object:

from canvas_sdk.v1.data import Condition

condition = Condition.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")
assess_events = condition.assessed_coding_gaps.all()

Committed records #

The committed method returns records that have been committed and not entered in error:

from canvas_sdk.v1.data import CreateCodingGapEvent

committed_create_events = CreateCodingGapEvent.objects.committed()

The committed method is available on all four managers.

Attributes #

CreateCodingGapEvent #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
originatorCanvasUser
committerCanvasUser
entered_in_errorCanvasUser
patientPatient
noteNote
detected_issueDetectedIssue

ValidateCodingGapEvent #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
originatorCanvasUser
committerCanvasUser
entered_in_errorCanvasUser
patientPatient
noteNote
detected_issueDetectedIssue

AssessCodingGapEvent #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
originatorCanvasUser
committerCanvasUser
entered_in_errorCanvasUser
patientPatient
noteNote
detected_issueDetectedIssue
conditionsCondition[]

DeferCodingGapEvent #

Field NameType
idUUID
dbidInteger
createdDateTime
modifiedDateTime
originatorCanvasUser
committerCanvasUser
entered_in_errorCanvasUser
patientPatient
noteNote
detected_issueDetectedIssue