Skip to main content
Resource Publishing

Data Entry Template Schema

A data entry template defines structured form content used by clinicians when recording coded data. Completed fields are written to the patient's care record as coded notes, observations, or allergy/intolerance entries.

Note that the XML root element is still named consultationTemplate. This entity was renamed from Consultation Template to Data Entry Template, but the schema itself is unchanged, so templates already published stay valid and need no modification.

The version attribute on the root element is fixed and must be set to 1.0.

An optional <presentingReasonCodes> element (one or more <code> SNOMED CT concept IDs) can precede <form> to associate the template with specific presenting reasons, so it's suggested to the clinician when a matching reason for the encounter is recorded.

Example​

<?xml version="1.0" encoding="UTF-8"?>
<consultationTemplate version="1.0" templateName="Diabetes Annual Review">
<form title="Diabetes Annual Review">
<radioButtons name="bpControl" label="Blood pressure control">
<radioOption label="Well controlled (below 140/80)" value="controlled">
<ifChecked>
<careRecordNote code="163020007" heading="163020007"/>
</ifChecked>
</radioOption>
<radioOption label="Poorly controlled" value="uncontrolled">
<ifChecked>
<careRecordNote code="163030003" heading="163030003"/>
</ifChecked>
</radioOption>
</radioButtons>
<quantity name="hba1c" label="HbA1c (mmol/mol)" minValue="0" maxValue="200">
<ifValueSet>
<careRecordObservation code="1019431006" heading="1019431006" unitOfMeasure="767002"/>
</ifValueSet>
</quantity>
<checkboxGroup name="complications" label="Complications">
<checkboxOption label="Retinopathy" value="retinopathy">
<ifChecked>
<careRecordNote code="4855003" heading="4855003"/>
</ifChecked>
</checkboxOption>
<checkboxOption label="Neuropathy" value="neuropathy">
<ifChecked>
<careRecordNote code="230572002" heading="230572002"/>
</ifChecked>
</checkboxOption>
</checkboxGroup>
<quickActions name="reviewActions" label="Review actions" heading="413294000">
<futureAction name="referEye" label="Refer for eye screening"
conceptId="384729004"
dueDateType="DATE"
dueInMonths="3"/>
</quickActions>
</form>
</consultationTemplate>

Schema​

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:include schemaLocation="patient-query.xsd"/>
<!-- ===== Simple types ===== -->
<xs:simpleType name="snomedCode">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]+"/>
<xs:minLength value="6"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nonEmptyString">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<!-- A short tag shown after a field's label, e.g. QOF, AF006 or LCS -->
<xs:simpleType name="badgeText">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="12"/>
<xs:pattern value="\S(.*\S)?"/>
</xs:restriction>
</xs:simpleType>
<!-- Text shown to the clinician; no leading or trailing spaces -->
<xs:simpleType name="helpText">
<xs:restriction base="xs:string">
<xs:pattern value="\S(.*\S)?"/>
</xs:restriction>
</xs:simpleType>
<!-- A Twig-style boolean expression, see the displayIf and enabledIf documentation -->
<xs:simpleType name="conditionExpression">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<!-- ===== Attribute groups ===== -->
<!-- Hidden when displayIf is false; greyed out when enabledIf is false. Neither files anything then -->
<xs:attributeGroup name="displayConditionAttributes">
<xs:attribute name="displayIf" type="conditionExpression"/>
</xs:attributeGroup>
<xs:attributeGroup name="conditionAttributes">
<xs:attributeGroup ref="displayConditionAttributes"/>
<xs:attribute name="enabledIf" type="conditionExpression"/>
</xs:attributeGroup>
<xs:attributeGroup name="topLevelFormElementAttributes">
<xs:attributeGroup ref="conditionAttributes"/>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:ID">
<xs:pattern value="[A-Za-z][A-Za-z0-9_]+"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="label" type="xs:string"/>
<xs:attribute name="badge" type="badgeText"/>
<xs:attribute name="badgeDescription" type="nonEmptyString"/>
<xs:attribute name="tooltip" type="helpText"/>
<xs:attribute name="description" type="helpText"/>
</xs:attributeGroup>
<!-- A collapsible banner shows only its title until opened -->
<xs:attributeGroup name="bannerAttributes">
<xs:attributeGroup ref="displayConditionAttributes"/>
<xs:attribute name="title" type="helpText"/>
<xs:attribute name="collapsible" type="xs:boolean"/>
</xs:attributeGroup>
<!-- ===== Core container types ===== -->
<xs:complexType name="layoutElementContainerType">
<xs:sequence>
<!-- Permit any of these tags in any order in any number -->
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="section" type="sectionType"/>
<xs:element name="fieldset" type="fieldsetType"/>
<xs:element name="infoBanner" type="infoBannerType"/>
<xs:element name="warningBanner" type="warningBannerType"/>
<xs:element name="systemBanner" type="infoBannerType"/>
<xs:element name="codeHistory" type="codeHistoryType"/>
<xs:element name="observationHistory" type="observationHistoryType"/>
<xs:element name="medicationIssueHistory" type="medicationIssueHistoryType"/>
<xs:element name="checkbox" type="checkboxType"/>
<xs:element name="checkboxGroup" type="checkboxGroupType">
<!-- identity constraint on local element -->
<xs:key name="checkboxOptionValue">
<xs:selector xpath="./checkboxOption"/>
<xs:field xpath="@value"/>
</xs:key>
</xs:element>
<xs:element name="radioButtons" type="radioButtonsType">
<xs:key name="radioOptionValue">
<xs:selector xpath="./radioOption"/>
<xs:field xpath="@value"/>
</xs:key>
</xs:element>
<xs:element name="select" type="selectType">
<xs:key name="selectOptionValue">
<xs:selector xpath="./selectOption"/>
<xs:field xpath="@value"/>
</xs:key>
</xs:element>
<!-- Multi-value: each selectOption picked is added to a list beneath the dropdown -->
<xs:element name="multiSelect" type="multiSelectType">
<xs:key name="multiSelectOptionValue">
<xs:selector xpath="./selectOption"/>
<xs:field xpath="@value"/>
</xs:key>
</xs:element>
<!-- The clinician searches SNOMED CT under parentCodes; each code picked files the note with it -->
<xs:element name="codeSearch" type="codeSearchType"/>
<xs:element name="multiCodeSearch" type="codeSearchType"/>
<xs:element name="textInput" type="textInputType"/>
<xs:element name="textarea" type="textareaType"/>
<xs:element name="quantity" type="quantityType"/>
<xs:element name="date" type="dateType"/>
<xs:element name="time" type="timeType"/>
<xs:element name="bloodPressure" type="bloodPressureType"/>
<xs:element name="footer" type="xs:string"/>
<xs:element name="quickActions" type="quickActionsType"/>
<xs:element name="component" type="componentReferenceType"/>
<xs:element name="patientQueries" type="patientQueriesType"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="topLevelFormElementType">
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
</xs:complexType>
<!-- ===== Root: the ONLY global element... all templates must be in a consultationTemplate tag ===== -->
<xs:element name="consultationTemplate">
<xs:complexType>
<xs:sequence>
<xs:element name="presentingReasonCodes" type="presentingReasonCodesType" minOccurs="0"/>
<xs:element name="patientQueries" type="patientQueriesType" minOccurs="0"/>
<xs:element name="form" type="formType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="version" use="required" fixed="1.0"/>
<xs:attribute name="templateName" type="nonEmptyString"/>
<xs:attribute name="hideBadges" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<!-- ===== Form with required title ===== -->
<xs:complexType name="formType">
<xs:complexContent>
<xs:extension base="layoutElementContainerType">
<xs:attribute name="title" use="required" type="nonEmptyString"/>
<xs:attribute name="hideBadges" type="xs:boolean"/>
<xs:attributeGroup ref="conditionAttributes"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- ===== Patient queries a condition can run with query('#id'); the content is the patient query XML ===== -->
<xs:complexType name="patientQueriesType">
<xs:sequence>
<xs:element name="patientQuery" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z][A-Za-z0-9_\-]*"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:anyAttribute processContents="skip"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<!-- ===== Reference to a data entry template component, replaced by its content when compiled ===== -->
<xs:complexType name="componentReferenceType">
<xs:attribute name="id" use="required" type="nonEmptyString"/>
</xs:complexType>
<!-- ===== Presenting reason codes ===== -->
<xs:complexType name="presentingReasonCodesType">
<xs:sequence>
<xs:element name="code" type="snomedCode" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- ===== Layout element types ===== -->
<xs:complexType name="sectionType">
<xs:complexContent>
<xs:extension base="layoutElementContainerType">
<xs:attributeGroup ref="conditionAttributes"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="fieldsetType">
<xs:complexContent>
<xs:extension base="layoutElementContainerType">
<xs:attribute name="title" use="required" type="nonEmptyString"/>
<xs:attributeGroup ref="conditionAttributes"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="infoBannerType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="bannerAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="warningBannerType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="bannerAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<!-- ===== History elements: read-only display of the patient's entries of one kind coded from its code list ===== -->
<!-- Any coded entry other than a prescription issue -->
<xs:complexType name="codeHistoryType">
<xs:sequence>
<xs:element name="codeList" type="historyCodeListType"/>
</xs:sequence>
<xs:attribute name="label" use="required" type="nonEmptyString"/>
<xs:attribute name="display" type="historyDisplayType" default="latest"/>
<xs:attribute name="rows" type="historyRowsType" default="5"/>
<xs:attributeGroup ref="displayConditionAttributes"/>
</xs:complexType>
<!-- Observations, investigation results and investigation groups -->
<xs:complexType name="observationHistoryType">
<xs:sequence>
<xs:element name="codeList" type="historyCodeListType"/>
</xs:sequence>
<xs:attribute name="label" use="required" type="nonEmptyString"/>
<xs:attribute name="display" type="observationHistoryDisplayType" default="latest"/>
<xs:attribute name="rows" type="historyRowsType" default="5"/>
<xs:attribute name="span" type="historySpanType" default="2-years"/>
<xs:attributeGroup ref="displayConditionAttributes"/>
</xs:complexType>
<!-- Prescription issues; without a codeList it shows every issue -->
<xs:complexType name="medicationIssueHistoryType">
<xs:sequence>
<xs:element name="codeList" type="historyCodeListType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="label" use="required" type="nonEmptyString"/>
<xs:attribute name="type" type="historyPrescriptionType"/>
<xs:attribute name="display" type="historyDisplayType" default="latest"/>
<xs:attribute name="rows" type="historyRowsType" default="5"/>
<xs:attributeGroup ref="displayConditionAttributes"/>
</xs:complexType>
<xs:simpleType name="historyPrescriptionType">
<xs:restriction base="xs:string">
<xs:enumeration value="acute"/>
<xs:enumeration value="repeat"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="historyDisplayType">
<xs:restriction base="xs:string">
<xs:enumeration value="latest"/>
<xs:enumeration value="table"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="observationHistoryDisplayType">
<xs:restriction base="xs:string">
<xs:enumeration value="latest"/>
<xs:enumeration value="table"/>
<xs:enumeration value="graph"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="historyRowsType">
<xs:restriction base="xs:positiveInteger">
<xs:maxInclusive value="20"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="historySpanType">
<xs:restriction base="xs:string">
<xs:enumeration value="1-year"/>
<xs:enumeration value="2-years"/>
<xs:enumeration value="5-years"/>
<xs:enumeration value="all"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="historyCodeListType">
<xs:choice>
<xs:element name="codeListReference" type="nonEmptyString"/>
<xs:element name="codeListDefinition" type="codeListDefinitionElementType"/>
<xs:element name="fixedCodeList" type="fixedCodeListElementType"/>
</xs:choice>
</xs:complexType>
<!-- ===== Form control types ===== -->
<xs:complexType name="checkboxType">
<xs:all>
<xs:element name="ifChecked" type="ifCheckedType" minOccurs="0"/>
</xs:all>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
<xs:attribute name="text" use="required" type="nonEmptyString"/>
<xs:attribute name="value" use="required" type="nonEmptyString"/>
</xs:complexType>
<xs:complexType name="checkboxGroupType">
<xs:sequence>
<xs:element name="checkboxOption" type="checkboxOptionType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
<xs:attribute name="twoColumns" type="xs:boolean"/>
<xs:attribute name="combineNotes" type="xs:boolean"/>
</xs:complexType>
<xs:complexType name="checkboxOptionType">
<xs:all>
<xs:element name="ifChecked" type="ifCheckedType" minOccurs="0"/>
</xs:all>
<xs:attribute name="label" use="required" type="nonEmptyString"/>
<xs:attribute name="value" use="required" type="nonEmptyString"/>
</xs:complexType>
<xs:complexType name="radioButtonsType">
<xs:sequence>
<xs:element name="radioOption" type="radioOptionType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
</xs:complexType>
<xs:complexType name="radioOptionType">
<xs:all>
<xs:element name="ifChecked" type="ifCheckedType" minOccurs="0"/>
</xs:all>
<xs:attribute name="label" use="required" type="nonEmptyString"/>
<xs:attribute name="value" use="required" type="nonEmptyString"/>
</xs:complexType>
<xs:complexType name="selectType">
<xs:sequence>
<xs:element name="selectOption" type="selectOptionType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
</xs:complexType>
<xs:complexType name="multiSelectType">
<xs:complexContent>
<xs:extension base="selectType">
<xs:attribute name="combineNotes" type="xs:boolean"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="selectOptionType">
<xs:all>
<xs:element name="ifSelected" type="ifSelectedType" minOccurs="0"/>
</xs:all>
<xs:attribute name="label" use="required" type="nonEmptyString"/>
<xs:attribute name="value" use="required" type="nonEmptyString"/>
</xs:complexType>
<xs:simpleType name="snomedCodeList">
<xs:restriction>
<xs:simpleType>
<xs:list itemType="snomedCode"/>
</xs:simpleType>
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="codeSearchType">
<xs:all>
<xs:element name="ifSelected" type="ifCodePickedType"/>
</xs:all>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
<xs:attribute name="parentCodes" use="required" type="snomedCodeList"/>
</xs:complexType>
<!-- The note's code is the one picked, so it takes no code of its own -->
<xs:complexType name="ifCodePickedType">
<xs:all>
<xs:element name="careRecordNote" type="pickedCodeNoteType"/>
</xs:all>
</xs:complexType>
<xs:complexType name="pickedCodeNoteType">
<xs:attribute name="heading" type="snomedCode"/>
<xs:attribute name="headingDescription" type="nonEmptyString"/>
<xs:attribute name="note" type="xs:string"/>
</xs:complexType>
<xs:complexType name="textInputType">
<xs:all>
<xs:element name="ifTextSet" type="ifTextSetType"/>
</xs:all>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
</xs:complexType>
<xs:complexType name="textareaType">
<xs:all>
<xs:element name="ifTextSet" type="ifTextSetType"/>
</xs:all>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
</xs:complexType>
<xs:complexType name="quantityType">
<xs:all>
<xs:element name="ifValueSet" type="ifValueSetType"/>
</xs:all>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
<xs:attribute name="unit" type="xs:string"/>
<xs:attribute name="minValue" type="xs:float"/>
<xs:attribute name="maxValue" type="xs:float"/>
</xs:complexType>
<xs:complexType name="dateType">
<xs:all>
<xs:element name="ifValueSet" type="ifValueSetType" minOccurs="0"/>
</xs:all>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
<xs:attribute name="maxDate" type="xs:date"/>
<xs:attribute name="minDate" type="xs:date"/>
</xs:complexType>
<xs:complexType name="timeType">
<xs:complexContent>
<xs:extension base="topLevelFormElementType"/>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="bloodPressureType">
<xs:all>
<xs:element name="ifValueSet" type="ifValueSetType"/>
</xs:all>
<xs:attributeGroup ref="topLevelFormElementAttributes"/>
<xs:attribute name="decimalPlaces" type="xs:string"/>
<xs:attribute name="maxValue" type="xs:float"/>
<xs:attribute name="minValue" type="xs:float"/>
</xs:complexType>
<!-- ===== Quick action attribute group ===== -->
<xs:attributeGroup name="actionAttributes">
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:ID">
<xs:pattern value="[A-Za-z][A-Za-z0-9_]+"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="label" use="required" type="xs:string"/>
<xs:attributeGroup ref="conditionAttributes"/>
</xs:attributeGroup>
<!-- ===== Quick action types ===== -->
<xs:complexType name="simpleActionType">
<xs:attributeGroup ref="actionAttributes"/>
</xs:complexType>
<xs:complexType name="prescriptionActionType">
<xs:complexContent>
<xs:extension base="simpleActionType">
<xs:attribute name="drugCode" use="required" type="nonEmptyString"/>
<xs:attribute name="dosageInstruction" type="nonEmptyString"/>
<xs:attribute name="daysSupply" type="xs:positiveInteger"/>
<xs:attribute name="issueQuantity">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minExclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="prescriptionType">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="acute"/>
<xs:enumeration value="repeat"/>
<xs:enumeration value="variable-repeat"/>
<xs:enumeration value="repeat-dispensing"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="documentActionType">
<xs:complexContent>
<xs:extension base="simpleActionType">
<xs:attribute name="templateIdentifier" type="nonEmptyString"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="generalTaskActionType">
<xs:complexContent>
<xs:extension base="simpleActionType">
<xs:attribute name="description" type="nonEmptyString"/>
<xs:attribute name="priority">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="high"/>
<xs:enumeration value="normal"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="assigneeTeamId" type="nonEmptyString"/>
<xs:attribute name="assigneeStaffId" type="nonEmptyString"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="immunisationActionType">
<xs:complexContent>
<xs:extension base="simpleActionType">
<xs:attribute name="vaccineCode" type="nonEmptyString"/>
<xs:attribute name="patientGroup" type="immunisationPatientGroupType"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- Keys of PredefinedImmunisationProcedureListService's groups -->
<xs:simpleType name="immunisationPatientGroupType">
<xs:restriction base="xs:string">
<xs:enumeration value="at-risk-babies-and-children"/>
<xs:enumeration value="8-weeks"/>
<xs:enumeration value="12-weeks"/>
<xs:enumeration value="16-weeks"/>
<xs:enumeration value="1-year"/>
<xs:enumeration value="18-months"/>
<xs:enumeration value="3-years-4-months"/>
<xs:enumeration value="12-13-years"/>
<xs:enumeration value="14-years"/>
<xs:enumeration value="flu-at-risk-babies-6-months-to-2-years"/>
<xs:enumeration value="flu-at-risk-children-2-to-18-years"/>
<xs:enumeration value="flu-children-2-to-17-years"/>
<xs:enumeration value="over-65-years"/>
<xs:enumeration value="over-75-years"/>
<xs:enumeration value="pregnant-women"/>
<xs:enumeration value="adults-with-underlying-health-conditions"/>
<xs:enumeration value="travel"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="futureActionType">
<xs:complexContent>
<xs:extension base="simpleActionType">
<xs:attribute name="conceptId" use="required" type="nonEmptyString"/>
<xs:attribute name="dueDateType">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="UNKNOWN_DATE"/>
<xs:enumeration value="DATE"/>
<xs:enumeration value="MONTH_YEAR"/>
<xs:enumeration value="DATE_RANGE"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="dueInMonths" type="xs:integer"/>
<xs:attribute name="startsInMonths" type="xs:nonNegativeInteger"/>
<xs:attribute name="repeatFrequency" type="xs:positiveInteger"/>
<xs:attribute name="repeatPeriod">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="DAY"/>
<xs:enumeration value="WEEK"/>
<xs:enumeration value="YEAR"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="repeatOccurrences" type="xs:positiveInteger"/>
<xs:attribute name="codeDescription" type="nonEmptyString"/>
<xs:attribute name="details" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="communicationActionType">
<xs:complexContent>
<xs:extension base="simpleActionType">
<xs:attribute name="conceptId" use="required" type="nonEmptyString"/>
<xs:attribute name="messageBody" type="xs:string"/>
<xs:attribute name="templateId" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!--
bodySite is optional: omit it to open the procedure form with the body site blank, which
is right for a procedure that has no side or site to record.
-->
<xs:complexType name="procedureActionType">
<xs:complexContent>
<xs:extension base="simpleActionType">
<xs:attribute name="procedureCode" use="required" type="snomedCode"/>
<xs:attribute name="bodySite" type="snomedCode"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="quickActionsType">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="prescription" type="prescriptionActionType"/>
<xs:element name="immunisation" type="immunisationActionType"/>
<xs:element name="procedure" type="procedureActionType"/>
<xs:element name="fitNote" type="simpleActionType"/>
<xs:element name="referral" type="simpleActionType"/>
<xs:element name="investigationRequest" type="simpleActionType"/>
<xs:element name="document" type="documentActionType"/>
<xs:element name="futureAction" type="futureActionType"/>
<xs:element name="communication" type="communicationActionType"/>
<xs:element name="generalTask" type="generalTaskActionType"/>
</xs:choice>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:ID">
<xs:pattern value="[A-Za-z][A-Za-z0-9_]+"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="label" type="xs:string"/>
<xs:attribute name="heading" type="snomedCode"/>
<xs:attribute name="headingDescription" type="nonEmptyString"/>
<xs:attributeGroup ref="conditionAttributes"/>
</xs:complexType>
<!-- ===== Conditional blocks ===== -->
<xs:complexType name="ifCheckedType">
<xs:all>
<xs:element name="careRecordNote" type="careRecordNoteType" minOccurs="0"/>
<xs:element name="careRecordAllergyIntolerance" type="careRecordAllergyIntoleranceType" minOccurs="0"/>
</xs:all>
</xs:complexType>
<xs:complexType name="ifSelectedType">
<xs:all>
<xs:element name="careRecordNote" type="careRecordNoteType" minOccurs="0"/>
<xs:element name="careRecordAllergyIntolerance" type="careRecordAllergyIntoleranceType" minOccurs="0"/>
</xs:all>
</xs:complexType>
<xs:complexType name="ifTextSetType">
<xs:all>
<xs:element name="careRecordNote" type="careRecordNoteType"/>
</xs:all>
</xs:complexType>
<xs:complexType name="ifValueSetType">
<xs:all>
<xs:element name="careRecordObservation" type="careRecordObservationType"/>
</xs:all>
</xs:complexType>
<!-- ===== Care record elements ===== -->
<xs:complexType name="careRecordNoteType">
<xs:attribute name="code" type="snomedCode"/>
<xs:attribute name="heading" type="snomedCode"/>
<xs:attribute name="headingDescription" type="nonEmptyString"/>
<xs:attribute name="note" type="xs:string"/>
</xs:complexType>
<xs:complexType name="careRecordAllergyIntoleranceType">
<xs:attribute name="code" type="snomedCode"/>
<xs:attribute name="heading" type="snomedCode"/>
<xs:attribute name="headingDescription" type="nonEmptyString"/>
</xs:complexType>
<xs:complexType name="careRecordObservationType">
<xs:attribute name="code" use="required" type="snomedCode"/>
<xs:attribute name="heading" type="snomedCode"/>
<xs:attribute name="headingDescription" type="nonEmptyString"/>
<xs:attribute name="unitOfMeasure" type="snomedCode"/>
<xs:attribute name="additionalInformation" type="xs:string"/>
</xs:complexType>
</xs:schema>

Form controls​

ElementDescriptionCare record hook
sectionGrouping container with no visible title. Supports displayIf and enabledIf.None
fieldsetGrouping container with a required title. Supports displayIf and enabledIf.None
infoBannerPlain-text information banner. Supports displayIf, title and collapsible.None
warningBannerWarning-style banner. Supports displayIf, title and collapsible.None
systemBannerSystem-style banner. Medicus uses it to replace an archived component's content. Supports displayIf, title and collapsible.None
checkboxSingle checkbox. Requires text and value.ifChecked
checkboxGroupMultiple checkboxes. Each checkboxOption has label and value. Optional twoColumns and combineNotes.ifChecked per option
radioButtonsRadio button group. Each radioOption has label and value.ifChecked per option
selectDropdown. Each selectOption has label and value.ifSelected per option
multiSelectDropdown where more than one option can be picked, each shown as a chip. Each selectOption has label and value. Optional combineNotes.ifSelected per option
codeSearchSearch box where the clinician picks one SNOMED CT code under its parentCodes, a space-separated list of concept ids, using the same constrained search as the rest of Medicus.ifSelected (required), a careRecordNote with no code, which files the picked code
multiCodeSearchAs codeSearch, but the clinician can pick several codes, each shown as a chip.ifSelected (required), filing one note per code picked
textInputSingle-line text.ifTextSet (required)
textareaMulti-line text.ifTextSet (required)
quantityNumeric entry. Optional unit, minValue, maxValue.ifValueSet (required)
dateDate picker. Optional minDate, maxDate (YYYY-MM-DD).ifValueSet (optional)
timeTime picker.None
bloodPressureBlood pressure entry. Optional minValue, maxValue, decimalPlaces.ifValueSet (required)
footerPlain-text footer string.None
codeHistoryRead-only view of the patient's coded entries of any kind with a code from its code list, as the latest entry or a table. Requires a label and a codeList. See Showing a patient's history.None
observationHistoryRead-only view of the patient's observations, investigation results and investigation groups with a code from its code list, as the latest entry, a table or a graph. Requires a label and a codeList. See Showing a patient's history.None
medicationIssueHistoryRead-only view of the patient's prescription issues, optionally only those with a code from its code list, as the latest entry or a table. Requires a label. See Showing a patient's history.None
quickActionsOne or more clinical action shortcuts (prescriptions, documents, referrals, future actions, communications, tasks). Requires a heading, a headingDescription, or both. An immunisation action needs a vaccineCode, a patientGroup, or both; a patientGroup alone opens the immunisation picker on that group. A futureAction can fill in the clinician's form: codeDescription, details, a due date counted in months from today (dueDateType with dueInMonths, plus startsInMonths for a range), and a repeat (repeatFrequency and repeatPeriod, ending after repeatOccurrences or never). A prescription can fill in a free-text dosageInstruction, daysSupply, issueQuantity and prescriptionType. A document with a templateIdentifier opens that document template, matched on the identifier shown on its overview page; without one, or when no usable template matches, it opens the New Document chooser. A generalTask can fill in its description, priority and an assignee (assigneeTeamId or assigneeStaffId).None
componentReference to a data entry template component. Requires an id, which is the component's identifier. Replaced by the component's current content when the template is compiled.From the component's content

Badges on fields​

A field can show a short badge after its label, for example to mark it as a QOF or local enhanced service field.

AttributeMeaning
badgeThe badge text, up to 12 characters, for example QOF or AF006
badgeDescriptionWhat the badge means, shown on hover. Required when badge is set

Set hideBadges="true" on the root consultationTemplate element to hide every badge in the template, or on a form to hide the badges on that tab.

<quantity name="hba1c" label="HbA1c (mmol/mol)" badge="QOF" badgeDescription="Counts towards QOF DM006"/>

Help text on fields​

Any field can carry help text for the clinician. Both are optional, and the text can't start or end with a space.

AttributeShown as
tooltipAn info icon after the field's label, showing the text on hover
descriptionA line of text under the field's label

A banner with collapsible="true" shows only its title until the clinician opens it. A collapsible banner needs a title.

<quantity name="hba1c" label="HbA1c (mmol/mol)" tooltip="Use the most recent result"
description="Leave blank if not measured in the last 12 months"/>
<infoBanner title="Eligibility criteria" collapsible="true">Patients aged 18 or over with type 2 diabetes.</infoBanner>

Showing a patient's history​

codeHistory, observationHistory and medicationIssueHistory show a clinician the patient's care record entries of one kind, coded with a code from the element's code list, without them leaving the template. They record nothing and have no name, so they're never part of what the template files. Each takes only its own attributes, which the schema enforces.

A codeList takes any of the three forms a patient query's code list takes: a codeListReference to a published code list, an inline codeListDefinition with inclusion and exclusion rules, or a fixedCodeList. See Code Lists. medicationIssueHistory uses dm+d codes, the other two use SNOMED CT. The code list is resolved each time the template opens, so a newly published version of a referenced code list applies straight away.

Code history​

codeHistory looks at every coded entry, wherever it was filed: observations, investigation results, groups and requests, problems, allergies, immunisations, medication administrations, referrals, documents, fit notes, notes, procedures and communications, but not prescriptions or issues. Immunisations match on the immunisation code, not the vaccine product. Immunisations not given, discarded documents and cancelled referrals are left out. Use it when a code could have been filed as more than one kind of entry.

Attribute or childRequiredDescription
labelRequiredText shown before the entry.
displayOptionallatest (default) shows the latest entry on one line and table shows the most recent entries in a table with the columns Date, Code and Note.
rowsOptionalRows in the table, from 1 to 20. Defaults to 5. Only used with display="table".
displayIfOptionalA condition for showing it. See Showing and enabling content with conditions.
codeListRequiredThe codes to look for.

A coded entry's Note is a note's text, an entry's additional information, a fit note's comments, a communication's summary or a measurement's value. A document's Code opens the document.

Observation history​

observationHistory looks at observations, investigation results and investigation groups. A group, such as a full blood count, counts for the latest entry but isn't listed in a table, and a graph plots only values.

Attribute or childRequiredDescription
labelRequiredText shown before the entry.
displayOptionallatest (default) shows the latest entry on one line, table shows the most recent entries in a table with the columns Date, Measurement, Value and Notes, and graph plots numeric values over time.
rowsOptionalRows in the table, from 1 to 20. Defaults to 5. Only used with display="table".
spanOptionalHow far back the graph goes: 1-year, 2-years (default), 5-years or all. Only used with display="graph".
displayIfOptionalA condition for showing it.
codeListRequiredThe codes to look for.

A graph only plots entries with a numeric value in the latest entry's unit, joins them with a line and labels the latest one; a blood pressure plots its systolic and diastolic values as two lines.

Medication issue history​

medicationIssueHistory looks at prescription issues, dated by their issue date.

Attribute or childRequiredDescription
labelRequiredText shown before the entry.
typeOptionalacute shows only acute issues and repeat only repeat, variable repeat and repeat dispensing issues. Leave it out to show both.
displayOptionallatest (default) shows the latest issue on one line and table shows the most recent issues in a table with the columns Issue Date, Medication, Dosage and Quantity.
rowsOptionalRows in the table, from 1 to 20. Defaults to 5. Only used with display="table".
displayIfOptionalA condition for showing it.
codeListOptionalThe dm+d codes to look for. Leave it out to show every issue, whatever was issued.

What each shows​

The latest entry is the one with the most recent date across every code. Every date is the date the entry shows in the care record, except an issue's, which is its issue date. Only draft and finalised entries count. The latest entry shows on one line as the label, the entry and its details, then the date, and a line with no matching entry shows the label followed by -. A table lists the most recent entries newest first; an empty detail is left blank.

<?xml version="1.0" encoding="UTF-8"?>
<consultationTemplate version="1.0">
<form title="Review">
<observationHistory label="Blood pressure" display="graph" span="5-years">
<codeList>
<fixedCodeList>
<codes>
<code>75367002</code>
</codes>
</fixedCodeList>
</codeList>
</observationHistory>
<codeHistory label="Diabetes">
<codeList>
<codeListDefinition>
<rules>
<inclusion>&lt;&lt; 73211009</inclusion>
</rules>
</codeListDefinition>
</codeList>
</codeHistory>
<medicationIssueHistory label="Metformin" display="table" rows="3">
<codeList>
<fixedCodeList>
<codes>
<code>109081006</code>
</codes>
</fixedCodeList>
</codeList>
</medicationIssueHistory>
<medicationIssueHistory label="Repeat medication" type="repeat" display="table" rows="10"/>
</form>
</consultationTemplate>

Showing and enabling content with conditions​

A tab (form), section, fieldset, banner, history element, field, quickActions block or quick action can carry a condition, for example to show a local enhanced service's tab only to the practices that provide it, or to ask for details only once "Other" is chosen.

AttributeWhen the condition is false
displayIfThe element isn't shown, and nothing files from it
enabledIfThe element is shown greyed out and can't be answered, and nothing files from it. Not allowed on banners or history elements

An element can have both. A false displayIf hides the element whatever enabledIf says. Hiding or disabling a tab, section or fieldset does the same to everything inside it. An answer in a field that becomes hidden or disabled is cleared.

Writing a condition​

A condition uses the same syntax as Twig. Combine terms with and, or, not and brackets, where and is worked out before or. Compare with ==, !=, <, <=, >, >=, in and not in. Values are text in single quotes, numbers, true, false and lists such as ['a', 'b'].

TermMeans
register.asthmaThe patient is on the register. Each register is its name in camelCase, such as register.copd or register.chronicKidneyDisease
patient.age, patient.ageInMonths, patient.ageInWeeksThe patient's age on the day the template was first used
patient.sexfemale, male or unknown
org.icb, org.subIcbThe practice's ICB or sub-ICB location, compared by ODS code or by name, such as org.icb == 'Herefordshire and Worcestershire'
org.odsCodeThe practice's own ODS code
field.inhalerThe answer to the field named inhaler. On its own it means the field has an answer, or for a checkbox that it's ticked. Use 'mdi' in field.devices for a checkbox group or multi-select
query('nhs-england/AST_REG')The patient is selected by a patient query Medicus ships
query('report:<id>')The patient is selected by one of the practice's custom reports. Not allowed in a template shared in a package
query('#poorControl')The patient is selected by a patient query written in the template, inside <patientQueries>

XML doesn't allow < or & inside an attribute. Write &lt; and &amp;, or turn the comparison round (18 > patient.age) and write "and" in a name.

<?xml version="1.0" encoding="UTF-8"?>
<consultationTemplate version="1.0" templateName="Asthma Review">
<patientQueries>
<patientQuery id="poorControl" focus="patients">
<name>Poor control</name>
</patientQuery>
</patientQueries>
<form title="Review">
<radioButtons name="inhaler" label="Inhaler">
<radioOption label="Metered dose" value="mdi"/>
<radioOption label="Other" value="other"/>
</radioButtons>
<textInput name="inhalerOther" label="Which inhaler?" displayIf="field.inhaler == 'other'">
<ifTextSet>
<careRecordNote heading="717371000000107" note="Inhaler"/>
</ifTextSet>
</textInput>
<checkbox name="spacerChecked" text="Spacer technique checked" value="checked" enabledIf="field.inhaler == 'mdi'">
<ifChecked>
<careRecordNote heading="717371000000107" note="Spacer technique checked"/>
</ifChecked>
</checkbox>
</form>
<form title="Young people" displayIf="(register.asthma or register.copd) and 18 > patient.age">
<infoBanner displayIf="query('#poorControl')">Asthma control may be poor.</infoBanner>
</form>
<form title="Local enhanced service" displayIf="org.icb == 'Herefordshire and Worcestershire' or org.odsCode in ['G83001', 'G83002']">
<infoBanner>Only practices in the service see this tab.</infoBanner>
</form>
</consultationTemplate>

How a condition is decided​

The patient's part of a condition (registers, age, sex, the practice and queries) is decided once, when the clinician first uses the template, and kept with what they record. Reopening the template later shows the same tabs and fields, even if the patient has since come off a register or had a birthday. Register membership is worked out overnight, so a patient coded with asthma today is on the register tomorrow.

The fields' part is decided as the clinician answers, and again when the answers are saved.

A query that can't be run, or a reference that no longer exists, leaves its element shown, with a warning that it may not apply to this patient.

Queries inside a hidden tab, section or fieldset aren't run, so put a slow query's element inside the container it belongs to.

Checks on the template design​

Medicus refuses a condition it can't read, an unknown register, term or function, a field or inline query the template doesn't have, an ICB or sub-ICB name it doesn't know, enabledIf on a banner, and fields whose conditions depend on each other in a loop. It warns about an ICB or sub-ICB code it doesn't recognise, comparing a field with a value that isn't one of its options, and comparing an age with text.

Building conditions in the Design tab​

A tab's, section's, fieldset's, field's or quick actions' Edit window has a Display Condition and an Enable Condition. A banner has a Display Condition only. Each condition is a group of rules: All, Any or None of them must be true, and a group can hold other groups. A rule checks another field's answer, a register, the patient's age or sex, the practice's ICB, sub-ICB location or ODS code, or a patient query written in the template or shipped by Medicus. Custom reports and a field compared with another field can only be written on the XML tab, and a condition like that shows read-only in the Edit window.

Seeing conditions while you build​

The Design tab shows each condition as "Shown when" or "Enabled when". A tab's condition is shown at the top of the tab, a section's or fieldset's under its title, and a field's or quick action's beneath it.

The Preview tab's "Preview as" panel shows the template as a patient you describe. It asks only for what the template's conditions use: the registers named, the patient's age or sex, the practice's ICB, sub-ICB location or ODS code, and whether each query matches. An ICB or sub-ICB location can be typed as a code or a name. The preview and its journal leave out anything that patient wouldn't see.

Care record filing​

AttributeRequired onDescription
careRecordNote @codeOptionalSNOMED CT concept ID for the note.
careRecordNote @headingOne of heading or headingDescriptionSNOMED CT concept ID used as the note heading.
careRecordNote @headingDescriptionOne of heading or headingDescriptionFree-text heading. With heading, it replaces the SNOMED CT term as the heading's text.
careRecordNote @noteOptionalAdditional free-text note.
careRecordAllergyIntolerance @codeOptionalSNOMED CT concept ID for the allergy/intolerance.
careRecordAllergyIntolerance @headingOne of heading or headingDescriptionSNOMED CT concept ID used as the heading.
careRecordAllergyIntolerance @headingDescriptionOne of heading or headingDescriptionFree-text heading. With heading, it replaces the SNOMED CT term as the heading's text.
careRecordObservation @codeRequiredSNOMED CT concept ID for the observation.
careRecordObservation @headingOne of heading or headingDescriptionSNOMED CT concept ID used as the heading.
careRecordObservation @headingDescriptionOne of heading or headingDescriptionFree-text heading. With heading, it replaces the SNOMED CT term as the heading's text.
careRecordObservation @unitOfMeasureOptionalSNOMED CT concept ID for the unit.
careRecordObservation @additionalInformationOptionalExtra context stored with the observation.

Combining ticked options into one note​

Set combineNotes="true" on a checkboxGroup or multiSelect to file the ticked options' notes as one note, rather than one note each. Only careRecordNote elements without a code are combined. Coded notes and allergies still file one per option.

The note reads as the group's label, a colon, then each ticked option's note text separated by commas, for example Mobility: Fully mobile, gait normal, no falls. Ticking or unticking an option later updates that one note. Every uncoded note in the group must use the same heading.

Default headings​

Medicus provides a standard set of SNOMED CT concept IDs to use as the heading value on care record elements and quickActions:

Concept IDDescription
717121000000105History
715851000000102Examination
37331000000100Impression (proxy code)
717371000000107Plan
note

Care record elements and quickActions need a heading, a headingDescription, or both. This differs from patient questionnaire templates, where heading is not part of the schema.

A heading with a SNOMED CT concept ID files under any heading in the consultation with the same concept ID, whatever its text. A free-text heading files under a heading with the same text and no concept ID.