Welcome to the final part of our template tutorial series. This session is all about taking your template creation skills to the next level by using complex AI commands to fully customise your templates in Heidi Health. Whether you need specific formats, dynamic content adjustments, or seamless integration of past clinical data, this guide will help you leverage Heidi’s advanced capabilities.
Is This Guide Right for You?
This guide is for you if:
Your basic templates are working but you need dynamic behaviour
You want different outputs based on patient data (e.g. age, conditions, lab values)
You’re building templates that handle multiple scenarios
You need to incorporate historical information from previous sessions
You want to create “macros” that auto-populate management plans
⚠️ Not quite ready? If you’re still getting comfortable with the basics, start here:
What’s in This Guide
Key Section | What You’ll Learn |
Conditional Logic | Create dynamic templates that adapt based on patient data |
Creating Clinical Macros | Auto-generate management plans based on conditions |
Integrating Historical Context into Current Documentation | Incorporate data from previous sessions |
Understanding Memory vs Templates vs Snippets | When to use each feature |
Case Study: Putting It All Together | A full advanced template walkthrough |
Advanced Troubleshooting | Complex issues and solutions |
Video Tutorial
Recap of Intermediate-Level Techniques
Before diving into advanced strategies, let's quickly review some of the intermediate techniques we discussed in the previous article:
Reformatting Templates: We explored how to modify templates using AI instructions to follow specific formatting guidelines, such as writing the "Subjective" section in narrative form without bullet points.
Types of AI Instructions: We introduced basic AI instructions to control content style, like using full sentences or formatting information line-by-line. The AI instructions can be specific to a particular placeholder or a particular section or they can be general instructions that are added at the top or bottom of your template separate from the sections/placeholders in your template.
Building on these concepts, we'll now explore more advanced AI commands to further customise your clinical notes.
Using the Template Builder for Advanced Edits
While this guide focuses on manual template editing for precise control, you can also use the template builder to make advanced changes. Simply describe what you want in plain English - here are some examples:
"Add conditional logic so that if the patient is under 18, include a note about guardian consent at the top of the note"
"If allergies are not mentioned, print “NKDA”
"Add historical notes handling so previous session info is incorporated but only today's transcript represents current findings"
The template builder will generate the appropriate syntax based on your input. You can then view and further refine the underlying code if needed.
Advanced AI Commands for Customisation
Heidi provides several built-in settings to help generate clinical notes in specific styles. However, you may need to override these defaults to meet particular requirements. Here’s how you can use advanced AI commands to tailor your templates.
Conditional Logic (If-Then Statements)
Conditional logic allows you to create dynamic templates that automatically adapt based on patient data. This is one of the most powerful advanced features.
How Conditional Logic Works
Basic structure:
(If [condition], print "[text]". If [alternative condition], print "[alternative text]".)
The condition can be based on anything mentioned in the transcript, contextual notes, or patient details- age, diagnoses, lab values, medications, etc.
Quick Reference: Conditional Logic Patterns
Pattern | Template Builder | Manual Syntax |
Simple If-Then | “If the patient is a smoker, add a line about smoking cessation including counselling provided and Quitline resources shared” |
|
If-Else | “If allergies aren’t mentioned, write NKDA” |
|
Age-based | “If patient is under 18, note guardian consent” |
|
Value-based | “If BMI is over 30, recommend weight management” |
|
Condition-based | “If diabetes is mentioned, include HbA1c follow-up” |
|
Example 1: Simple Conditional
Scenario: You want to include smoking cessation advice only for patients who smoke.
Template Builder: “If the patient is a smoker, add smoking cessation including counselling provided and Quitline resources shared”
Manual Edit:
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If the patient is a smoker, print "Smoking cessation counselling provided. Quitline resources shared." If the patient is a non-smoker, omit this statement entirely.)
Example 2: Age-Based Conditional
Scenario: You want different consent wording for paediatric vs adult patients.
Template Builder: “If patient is under 18, note that guardian consent was obtained”
Manual Edit:
[Consent] (If patient is under 18, print "Guardian/parent consent obtained for today's consultation." If patient is 18 or older, print "Patient consent obtained for today's consultation.")
Example 3: Lab Value Conditional
Scenario: You want to provide different recommendations based on HbA1c levels.
Template Builder: “Add glycaemic control assessment based on HbA1c level”
Manual Edit:
[Glycaemic assessment] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If HbA1c is above 8%, print "Poor glycaemic control - treatment intensification recommended." If HbA1c is between 7% and 8%, print "Suboptimal glycaemic control - review medication adherence and lifestyle factors." If HbA1c is 7% or below, print "Adequate glycaemic control - continue current management.")
Example 4: Multiple Conditions (AND/OR)
Scenario: You want screening recommendations for specific patient groups.
Template Builder: “If the patient is female AND over 50 AND hasn’t had a recent mammogram, recommend mammogram screening”
Manual Edit:
[Screening recommendations] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If the patient is female AND over 50 AND has not had a recent mammogram, print "Recommend mammogram screening - patient meets criteria for breast cancer screening." If these criteria are not all met, omit this recommendation entirely.)
Example 5: Nested Conditionals
Scenario: You want diabetes-specific advice, but only when diabetes is relevant.
Template Builder: “If diabetes is mentioned, assess glycaemic control based on HbA1c”
Manual Edit:
[Diabetes management] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If diabetes is mentioned, then: If HbA1c is above 7%, print "Poor glycaemic control - intensify treatment." If HbA1c is 7% or below, print "Adequate glycaemic control - continue current management." If diabetes is not mentioned, omit this section entirely.)
Conditional Logic Reference Table
Type | Example Instruction |
Simple Conditional |
|
Multiple Conditions (AND) |
|
Multiple Conditions (OR) |
|
Nested Conditionals |
|
Conditional + Formatting |
|
Verbatim Conditional |
|
Overall Template Conditional |
|
Creating Clinical Macros
Macros are pre-defined blocks of text that are automatically inserted into your template’s output when certain conditions are met. This makes macros an excellent tool for standardised management plans.
How Macros Work
A macro is a combination of conditional logic with verbatim text. When a conditional logic statement is met, the subsequent verbatim text will be printed.
You can insert multiple macros within a template, to prepare for multiple scenarios.
Example: CKD Management Macro
Scenario: You want different management plans to appear automatically based on creatinine levels.
Plan:
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If creatinine is above 1.5 mg/dL and less than or equal to 2.0 mg/dL, print:
"Management Plan for CKD Stage 1:
- Monitor kidney function tests (serum creatinine, eGFR) every 6-12 months
- Recommend lifestyle modifications: low-sodium diet, regular physical activity
- Blood pressure control: Aim for BP < 140/90 mmHg using ACE inhibitors or ARBs
- Avoid nephrotoxic drugs (e.g., NSAIDs), smoking and alcohol intake")
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If creatinine is above 2.0 mg/dL, print:
"Management Plan for CKD Stage 2:
- Monitor kidney function tests (serum creatinine, eGFR) every 3-6 months
- Low-protein diet (0.8 g/kg body weight per day), continue low-sodium diet
- Blood pressure control: Aim for BP < 130/80 mmHg with ACE inhibitors or ARBs
- Referral to nephrologist for assessment and co-management
- Discussed potential need for RRT if progression to Stage 3 or higher
- Encouraged vaccinations (influenza, pneumococcal, hepatitis B) as appropriate")
Understand this example: if the patient’s creatinine is mentioned as 1.8 mg/dL during the consult, the Stage 1 plan automatically appears. If it’s 2.3 mg/dL, the Stage 2 plan appears instead.
More Macro Examples
Hypertension Management:
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If systolic BP is greater than 160 mmHg, print:
"Hypertension Management - Severe:
- Immediate medication initiation/adjustment required
- Consider combination therapy - Review in 2 weeks
- Home BP monitoring recommended")
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If systolic BP is between 140 and 160 mmHg, print:
"Hypertension Management - Moderate:
- Lifestyle modifications: DASH diet, sodium restriction, exercise
- Medication review
- consider initiation if lifestyle measures insufficient
- Review in 4-6 weeks")
BMI-Based Advice:
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If BMI is greater than 30, print:
"Weight Management:
- Discussed health risks associated with obesity
- Lifestyle modification counselling provided
- Consider referral to dietitian
- Set realistic weight loss goal of 5-10% body weight over 6 months
- Review in 4 weeks")
Integrating Historical Context into Current Documentation
Often, it’s necessary to incorporate data from previous sessions or encounters to provide a comprehensive clinical picture. Heidi’s templates can dynamically pull in information from contextual notes (i.e., additional notes including past healthcare encounters) that you enter into the Context tab in Heidi.
There are 2 ways to do this within Heidi:
Linked sessions
Manually add historical context in the Context tab
1. Linked Sessions
Linked sessions allow you to incorporate historical patient data into your current documentation, enabling more comprehensive and continuous patient care rather than isolated snapshots.
How to Link a Session to a Patient
Open any session and click on the "Add Patient Details" input field
Select the patient you want to link the session to, or create a new patient if they aren't listed
The session will now be linked to that patient profile
How to Include Previous Sessions in Context:
For any linked session, you can choose which past sessions to include as context for your documentation. Sessions automatically appear with the three most recent previous sessions as default if you are using linked patients.
If you do not want them included, manually uncheck the box at the bottom left of the transcript window.
Key Considerations for Linked Sessions
Session limit: Capped at 3 past sessions at this stage to maintain high output quality - this is something we're looking to expand in future updates.
Context changes: If you change the sessions included in your context, a Sync button will appear to update your outputs accordingly.
Deleted sessions: If you delete your sessions, you won't be able to use this feature for those sessions.
2. Utilising Contextual Notes for Follow-Up Visits
This scenario works best if you would prefer not to link patients, and prefer to manually upload the past clinical note to the session each time. This gives you greater control of what history you’d like to upload.
Example scenario: suppose you are documenting a follow-up session for a burn patient and want to include relevant information from the initial consultation.
Include Past Context in Your Template:
First, find and copy the relevant details from the initial/previous session into the “Context” section, or upload a document containing historical patient information directly into the “Context” section.
Add Contextual Instructions into your template:
Include a global AI instruction such as:
(Contextual notes will contain clinical notes or summaries from previous healthcare encounters. Ensure these are summarised and incorporated into the current clinical notes for the same patient.)or
(Contextual notes will contain clinical notes or summaries from previous healthcare encounters. Historical information should be incorporated where relevant as background information. Only information from today's transcript should be documented as today's findings, examination results, or current status. Clearly distinguish between historical information and current findings.)
Save, Refresh, and Regenerate:
When you regenerate the output, Heidi will automatically pull in the relevant historical data, such as previous treatments, progress, or diagnostic results, and incorporate them into the current documentation.
This method ensures that your follow-up notes are complete, and accurately reflect the patient’s clinical history. This reduces redundancy, and improves clarity.
Leveraging Advanced Techniques for Enhanced Control
To make full use of these advanced commands, consider the following strategies:
Use Precise Language and Terminology:
Heidi’s AI responds best to specific terms and consistent wording. For example, use “transcript” to refer to conversations between the patient and clinician, or “contextual note” and “clinical note” to denote data from past healthcare encounters. This helps Heidi accurately interpret your instructions.
Experiment with Instruction Placement:
General AI instructions can sometimes work better at the start or end of a template. If an instruction isn’t performing as expected, try moving it.
Use Conditional Logic to Automate Decisions:
If-then statements can make your templates more dynamic and adaptive. Experiment with different scenarios to automate decisions based on patient data, like lab results, vital signs, or previous diagnoses.
Reference the Prompt glossary for Accurate Commands:
Heidi uses specific terms to label different data types. For example:
“Transcript” refers to the conversation text.
“Contextual notes” are summaries of previous healthcare encounters.
“Patient details” include personal information such as name, age, or pronouns.
“Clinical note” is the core document from which other documents are derived.
Using the correct terms from the glossary ensures Heidi correctly interprets your commands, leading to more accurate outputs.
Understanding Memory vs Templates vs Snippets
For advanced template users, it's important to understand when to use templates versus other Heidi features:
Feature | Best For | Scope | Examples |
Memory | Individual clinician or organisation-wide preferences that apply everywhere | All templates, all sessions | Date format (DD/MM/YYYY), spelling (Australian English), approved abbreviations |
Templates | Note-specific structure and conditional logic | One template type | SOAP format, referral letter structure, specialty-specific requirements |
Snippets | Reusable text blocks you insert manually | On-demand insertion | Standard patient education text, referral letter closings, safety netting advice |
When to Use Memory
✅ Use Memory for:
Date and time formats
Spelling conventions (UK/US/AU English)
Standard abbreviations you or your practice uses
Default units (metric/imperial)
Your practice details (name, address, contact)
When to Use Templates
✅ Use Templates for:
Note structure (SOAP, HOPC, problem-based)
Conditional logic (if-then statements)
Section-specific formatting
Document type requirements (referral vs progress note)
When to Use Snippets
✅ Use Snippets for:
Patient education materials you share frequently
Consent wording
Medication instructions
Referral letter sign-offs
Safety netting advice
Case Study: Putting It All Together
Let’s build a complete advanced template for a Diabetic Review that includes:
Conditional logic for glycaemic control assessment
Automatic management plan based on HbA1c
Integration of historical context
Dynamic screening recommendations
Complete Template: Diabetic Review
Diabetic Review Note
Date: [Date of consultation]
Patient: [Patient name], [Age] years old
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. Write as a brief statement.)
Reason for Visit: [Reason for today's diabetic review]
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. Write as a brief statement.)
Diabetes History: [Summary of diabetes history including type, duration, and previous complications] (Incorporate relevant history from contextual notes if provided. This represents historical background.)
Current Diabetes Management: [Current diabetes medications with doses] (Only include if explicitly mentioned in transcript, context or clinical note, else omit section entirely. Write as a bulleted list.)
Today's Assessment:
Glycaemic Control: [HbA1c result and interpretation] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If HbA1c is above 8%, print "Assessment: Poor glycaemic control requiring treatment intensification." If HbA1c is between 7% and 8%, print "Assessment: Suboptimal glycaemic control - review adherence and lifestyle factors." If HbA1c is 7% or below, print "Assessment: Adequate glycaemic control - continue current management.")
Blood Pressure: [Blood pressure reading] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely.)
Weight/BMI: [Weight and BMI if available] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely.)
Complications Screening: [Foot examination findings] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else print "Foot examination: Not performed today")
[Eye screening status] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else print "Retinal screening: Status unknown - consider referral")
[Renal function] (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely.)
Plan: (Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If HbA1c is above 8%, print: "Management Plan - Poor Control:
1. Medication adjustment: - [Specific changes to be determined by clinician] - Consider addition of second agent or insulin initiation
2. Lifestyle reinforcement:- Dietary review - refer to dietitian
- Exercise prescription
- 150 mins moderate activity per week
3. Monitoring:
- Increase home glucose monitoring frequency
- Repeat HbA1c in 3 months
4. Follow-up:
- Review in 4 weeks to assess response")
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If HbA1c is between 7% and 8%, print:
"Management Plan - Suboptimal Control:
1. Review medication adherence
2. Reinforce lifestyle measures
3. Repeat HbA1c in 3 months
4. Follow-up in 6-8 weeks")
(Only include if explicitly mentioned in transcript, contextual notes or clinical note, else omit section entirely. If HbA1c is 7% or below, print:
"Management Plan - Adequate Control:
1. Continue current medications unchanged
2. Annual complications screening due
3. Repeat HbA1c in 6 months
4. Routine follow-up in 3-6 months")
(Always refer to the patient by their name if available. Use Australian English spelling throughout. Use DD/MM/YYYY format for all dates.)
How This Template Works
Structure: Clear sections for history, current assessment, and plan
Historical context: Previous diabetes history pulled from contextual notes
Conditional assessments: Glycaemic control automatically interpreted based on HbA1c
Dynamic macros: Different management plans appear based on control level
Smart defaults: Screening sections show “not performed” if not mentioned
Global instructions: Consistent formatting throughout
Advanced Troubleshooting
Complex Layout Not Rendering Correctly
Problem: Your template has multiple sections and conditional logic, but the output is messy or incomplete.
Solutions:
Simplify and isolate - Temporarily remove sections to identify which one is causing issues
Check for conflicting instructions - Two instructions that contradict each other can cause unpredictable behaviour
Ensure conditionals are properly closed - Every “If” should have a clear outcome:
❌ (If diabetic, include HbA1c)
✅ (If diabetic, print "HbA1c monitoring recommended." If not diabetic, omit entirely.)
Try moving global instructions - Move from bottom to top of template (or vice versa)
Conditional Logic Not Triggering
Problem: Your if-then statements aren’t producing the expected output.
Solutions:
Match the terminology - Use terms that match what’s actually in the transcript:
❌ (If diabetic...)
✅ (If diabetes or diabetic is mentioned...)
Be more explicit - Specify exactly what triggers the condition:
❌ (If HbA1c is high...)
✅ (If HbA1c is above 7%...)
Check the data source - Ensure the information the condition relies on is actually in the transcript or contextual notes
Historical Context Being Confused with Today’s Findings
Problem: Heidi is mixing up historical information from context with current findings from today.
Solution: Add this global instruction:
(Historical notes from previous sessions are provided in contextual notes and should be incorporated where relevant as background information. Only information from today's transcript should be documented as today's findings, examination results, or current status. Do not present historical information as current findings.)
Sensitive Terms Being Filtered
Problem: Clinically relevant terms (including patient-reported profanity) are being removed from notes.
Solution: Add this instruction if clinically relevant:
(Include verbatim any clinically relevant language used by the patient, even if it includes profanity or sensitive terms, as this may be important for accurate clinical documentation.)
Best Practices for Advanced Templates
Do ✅
Start with a working basic template before adding advanced features
Test conditionals one at a time - add complexity gradually
Use clear, specific conditions - “If HbA1c > 8%” not “If HbA1c is high”
Include fallback options - what happens if the condition isn’t met?
Avoid ❌
Overcomplicating - if you need 10+ conditionals, consider multiple templates instead
Vague conditions - “If relevant” or “If appropriate” won’t work reliably
Nested conditionals more than 3 levels deep
Assuming Heidi can calculate - Note that while Heidi handles value comparisons well (e.g. "If BP > 160"), arithmetic calculations and date arithmetic are not reliable.
Prompt Glossary
We've created a prompt glossary with specific terms commonly used in our base prompts. Using these terms in your templates will lead to higher quality outputs.
Example: Always refer to the conversation between the clinician and patient as the 'transcript' rather than 'the conversation' or other variations.
Term | Definition |
transcript | The transcript of the conversation between the clinician and the patient. |
contextual notes | The context or contextual notes made by the clinician, which should be integrated into the foundation clinical note. |
patient details | Specific details about the patient that should be included in the document. |
structure | The preferred structure or format for the clinical note as specified by the clinician, essentially a note template. |
template | The pre-defined format or structure that the clinical note or document should adhere to. |
voice | The unique voice and style preferences of the clinician for writing the note. Brief, Goldilocks, Detailed & Super Detailed. |
language | The transcript is in US English and specifically trained on medical terminology. If you want to use British or Australian English, specifically use the terms UK English. |
date today | The current date in dd/mm/yyyy format, with instructions to reformat for US/Canada. |
healthcare encounter | How we refer to all information pertaining to today’s session, visit or consult, essentially the transcript, the contextual notes, patient details, date today etc. |
requirements | Specific requirements and instructions for writing the clinical note. |
clinical note | The foundation clinical note that needs to be mapped to the template. |
placeholder | Text in square brackets describing the type of medical information that should be displayed. |
AI instructions | Text in round brackets guiding how to treat or manipulate information. |
verbatim | Text in quotation marks that must be included word-for-word in the output. |
safety instruction | An AI instruction ensuring content is only included if explicitly mentioned, preventing the AI from inferring or assuming information. |
global instruction | An AI instruction placed at the top or bottom of a template that applies to the entire document rather than a specific section. |
conditional logic | If-then statements that create dynamic templates adapting to different clinical scenarios based on patient data. |
macro | A predefined block of text or instructions triggered by conditional logic based on specific criteria. |
What’s Next?
🎉 Congratulations! You’ve completed Heidi’s template tutorial series.
You now have the knowledge to create sophisticated, dynamic templates that can:
Adapt to different patient scenarios
Auto-generate management plans
Integrate historical context
Handle complex clinical workflows
Continue Learning
🌐 Template Community - Share your templates and learn from others
📖 Adding a Template to the Community - Contribute your creations
💬 Support - Reach out to our support team via the Help button
Quick Links
⬅️ Creating Templates in Heidi: A Basic Guide - Review the fundamentals
⬅️ Improving your Heidi Templates: An Intermediate Guide - Formatting and troubleshooting

