Medications

The Medications API is responsible for managing medications and prescriptions.

Examples

from canvas_core import events, logging
from canvas_core.medications.models import Prescription
logger = logging.get_logger(__name__)

@events.handle_event(events.PreRecordCreate[Prescription], origin=Prescription)
def handle_prescription_status_pre_create(event: events.PreRecordCreate[Prescription]) -> None:
    logger.info("Prescription will be created.")

@events.handle_event(events.PostRecordCreate[Prescription], origin=Prescription)
def handle_prescription_post_create(event: events.PostRecordCreate[Prescription]) -> None:
    logger.info("Prescription Created.")

@events.handle_event(events.PreRecordUpdate[Prescription], origin=Prescription)
def handle_prescription_pre_change(event: events.PreRecordUpdate[Prescription]) -> None:
    logger.info("Prescription will be updated.", diff=event.diff)

@events.handle_event(events.PostRecordUpdate[Prescription], origin=Prescription)
def handle_prescription_post_change(event: events.PostRecordUpdate[Prescription]) -> None:
    logger.info("Prescription Updated.", diff=event.diff)

API Reference

canvas_core.medications.get_medication_history_response_model() type[MedicationHistoryResponse]

Return the Medication model class.

canvas_core.medications.get_medication_model() type[Medication]

Return the Medication model class.

canvas_core.medications.get_prescription_model() type[Prescription]

Return the Prescription model class.

class canvas_core.medications.models.Medication(*args, **kwargs)

A record of a medication being taken by a patient.

exception DoesNotExist
exception MultipleObjectsReturned
property name: str

Retrieve the display name.

Returns:

The display value of the first coding associated with the object, if any.

Returns an empty string if no coding is found or the instance is not persisted yet.

Return type:

str

class canvas_core.medications.models.Prescription(*args, **kwargs)

An order for supplying medication to a patient.

exception DoesNotExist
exception MultipleObjectsReturned
class Status(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
property medication_name: str

Return the medication display name.