Skip to content

Exception generating narrative with latest base IG template #141

Description

@brynrhodes

The narrative for library content will produce an exception similar to the following:

Exception generating Narrative: Unable to Parse HTML - node 'DateTime' has unexpected content '=' (last text = ' default Interval[@2026-01-01T00:00:00.000Z, @2027-01-01T00:00:00.000Z) context Patient define "Qualifying Encounter": CQMCommon."Inpatient Encounter" InpatientEncounter where InpatientEncounter.hospitalizationWithObservation ( ).lengthInDays ( ) ' at line 2234 column 84

This occurs when the CQL source for the library has an XML-relevant symbol such as > in the source. The fix is to use the .escape('html') function of FHIRPath to escape the CQL source for use in XML contexts.

Note that for context, this seems to have started happening with the new FHIR language-specific templates. The .escape used to be part of the content template but it was removed because it resulted in duplicate escaping when used in FHIR narrative rendering. Something seems to have changed in that processing such that that automatic escaping by the FHIR rendering layer is no longer happening, so it needs to be done by the liquid template directly.

Note that this likely needs to happen for library-content but also for primary-logic-definition.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions