Skip to content

Runtime facts ​

Records how each Smart Forms version behaves, as small typed data rather than code. The rules reason from these facts; they never run Smart Forms.

Each fact describes one behaviour of one component, such as "populate evaluates an itemPopulationContext as FHIRPath, whatever its language". Facts are kept per component and per verified version, so factsAt returns the facts of exactly the versions compat selected. A fact does not name a rule: several rules can read one fact, and a new Smart Forms version can change a fact without changing a rule.

Every fact carries its evidence:

  • reproduced: a test that runs the pinned npm package and shows the behaviour. Every populate and template-extract fact is reproduced.
  • source-only: a permalink into the Smart Forms source at the release commit. The renderer has no test harness yet, so its facts are source-only, and a rule's message claims only what the source shows.

A fact can also list the aehrc/smart-forms issues that report its behaviour as a bug. When a release with the fix is verified, its facts leave the behaviour out, and the rule stops reporting for that version with no rule change.

FileWhat it recordsRead by
languages.tsHow a component handles the language of an expression at each location it reads: FHIRPath only, FHIRPath or query, or anything as FHIRPathSite eligibility, unsupported-expression-language
prerequisites.tsWhat a component needs before it reads an expression there, such as an itemPopulationContext on a group with child itemsSite eligibility, Population model
names.tsNames SDC defines that a component does not supply: %questionnaire and %qitemquestionnaire-variable-unavailable
embeddings.tsHow population fills the {{%…}} embeddings of an x-fhir-queryunsupported-query-embedding
variables.tsHow names are stored and when variables are evaluated, such as one value per name for the whole form, and population's evaluation orderPopulation model, variable-name-collision, repeating-group-variable, named-expression-not-referenceable
source-queries.tsWhich sourceQueries results population binds, and under which namesPopulation model
extraction.tsHow template-extract finds templates and reads their templateExtractContext. Kept per template-extract version only, because extraction is checked only when selected.unsupported-template-extract-context

Rule names are shown without their smart-forms/ prefix. Reference: Smart Forms runtime facts in the design plan describes each behaviour, with its source.

Schema ​

Code ​

In packages/plugin-smart-forms/src/facts/: