LabReportTemplate

Introduction #

The LabReportTemplate, LabReportTemplateField, and LabReportTemplateFieldOption models represent templates for Point of Care (POC) labs and custom lab reports.

Basic Usage #

To retrieve a LabReportTemplate by identifier:

from canvas_sdk.v1.data.lab_report_template import LabReportTemplate

template = LabReportTemplate.objects.get(id="a1b2c3d4-e5f6-7890-abcd-ef1234567890")

To access a template’s fields and field options:

from canvas_sdk.v1.data.lab_report_template import LabReportTemplate

template = LabReportTemplate.objects.get(id="a1b2c3d4-e5f6-7890-abcd-ef1234567890")

for field in template.fields.all().order_by('sequence'):
    print(f"Field: {field.label}, Type: {field.field_type}, Required: {field.required}")

    for option in field.options.all():
        print(f"  Option: {option.label} ({option.key})")

Filtering #

Lab report templates can be filtered by any attribute that exists on the model. The model also provides convenient filter methods for common use cases.

from canvas_sdk.v1.data.lab_report_template import LabReportTemplate

active_templates = LabReportTemplate.objects.active()
inactive_templates = LabReportTemplate.objects.inactive()
matching_templates = LabReportTemplate.objects.search("glucose")
poc_templates = LabReportTemplate.objects.point_of_care()
custom_templates = LabReportTemplate.objects.custom()
builtin_templates = LabReportTemplate.objects.builtin()
results = LabReportTemplate.objects.active().point_of_care().search("a1c")

Attributes #

LabReportTemplate #

Field NameType
idUUID
dbidInteger
nameString
codeString
code_systemString
search_keywordsString
activeBoolean
customBoolean
pocBoolean
fieldsLabReportTemplateField[]

LabReportTemplateField #

Field NameType
dbidInteger
report_templateLabReportTemplate
sequenceInteger
codeString
code_systemString
labelString
unitsString
field_typeFieldType
requiredBoolean
optionsLabReportTemplateFieldOption[]

LabReportTemplateFieldOption #

Field NameType
dbidInteger
fieldLabReportTemplateField
labelString
keyString

Enumeration types #

FieldType #

ValueLabel
floatFloat
selectSelect
textText
checkboxCheckbox
radioRadio
arrayArray
labReportLab Report
remoteFieldsRemote Fields
autocompleteAutocomplete
dateDate