ReasonForVisit

Introduction #

This page covers three models:

  • ReasonForVisit — a Reason for Visit recorded on a note, and the anchor for the Reason for Visit command.
  • ReasonForVisitCoding — the codings on a recorded Reason for Visit.
  • ReasonForVisitSettingCoding — the configured codings an instance offers, used to populate the coding field when a Reason for Visit is recorded.

ReasonForVisit #

A ReasonForVisit is always associated with a note and a patient. To get one by identifier:

from canvas_sdk.v1.data import ReasonForVisit

rfv = ReasonForVisit.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")

From a patient or a note, use the reasons_for_visit attribute:

from canvas_sdk.v1.data import Note, Patient

patient = Patient.objects.get(id="1eed3ea2a8d546a1b681a2a45de1d790")
reasons = patient.reasons_for_visit.all()

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

Reading the narrative #

The text is exposed through the narrative property, which returns the free-text value when there is one and otherwise renders the structured narrative_json:

from canvas_sdk.v1.data import ReasonForVisit

rfv = ReasonForVisit.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")
text = rfv.narrative

Committed reasons for visit #

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

from canvas_sdk.v1.data import ReasonForVisit

committed = ReasonForVisit.objects.committed()

Codings #

Each ReasonForVisit exposes its codings through codings:

from canvas_sdk.v1.data import ReasonForVisit

rfv = ReasonForVisit.objects.get(id="b80b1cdc-2e6a-4aca-90cc-ebc02e683f35")
codings = rfv.codings.all()

Attributes #

ReasonForVisit #

Field NameTypeDescription
idUUIDThe universally unique identifier for this record.
dbidIntegerThe database identifier for this record.
createdDateTimeWhen the record was created.
modifiedDateTimeWhen the record was last modified.
originatorCanvasUserThe user who originated the command.
committerCanvasUserThe user who committed the command, if it has been committed.
entered_in_errorCanvasUserThe user who entered the record in error, if it has been.
patientPatientThe patient the reason for visit was recorded for.
noteNoteThe note it was recorded on.
narrativeStringThe reason for visit text.
codingslistThe ReasonForVisitCoding records on this reason for visit.

ReasonForVisitCoding #

Field NameTypeDescription
dbidIntegerThe database identifier for this coding record.
codeStringThe code representing the concept.
displayStringThe human-readable display name for the concept.
systemStringThe coding system.
versionStringThe version of the coding system.
user_selectedBooleanWhether a user chose this coding directly.
reason_for_visitReasonForVisitThe reason for visit this coding belongs to.

ReasonForVisitSettingCoding #

The ReasonForVisitSettingCoding model represents the coding information used to populate the coding field within a Reason For Visit in Canvas.

Basic Usage #

To retrieve a specific coding record by its identifier, use the model manager’s get method:

from canvas_sdk.v1.data import ReasonForVisitSettingCoding

rfv_coding = ReasonForVisitSettingCoding.objects.get(id="e2b1e1e3-3f52-4a0a-bb3a-123456789abc")

You can also filter records by attributes. For example, to get all codings from a specific coding system:

from canvas_sdk.v1.data import ReasonForVisitSettingCoding

codings = ReasonForVisitSettingCoding.objects.filter(system="http://snomed.info/sct")

Attributes #

ReasonForVisitSettingCoding #

Field NameTypeDescription
idUUIDThe universally unique identifier for this coding record.
dbidIntegerThe database identifier for this coding record.
codeStringThe code representing the concept.
displayStringThe human-readable display name for the concept.
systemStringThe coding system (e.g., http://snomed.info/sct).
versionStringThe version of the coding system.
durationArray of DurationAn array of durations (as Python timedelta objects) associated with the coding.
user_selectedBooleanThe active/inactive flag for this reason-for-visit coding: True = active, False = inactive.