Finalize DSL
Finalize definition describes document validation and postprocessing logic that invoked on sign:
Features:
more strict validation before signing (Finalize profile)
extraction of the data into FHIR resources after signing
Description of top-level parameters:
:zen/tags
A Set
Should always be #{aidbox.sdc/Finalize zen/schema}
:document
A symbol
A reference to a document object, e.g. VitalsDocument
:profile
A symbol
An (optional) reference to FinalizeConstraints object (see below)
:export-engine
A symbol
Should always be aidbox.sdc/LispExport
:create
A Vector of LISP expressions
Please see below
:patch
A Vector of LISP expressions
Please see below
:delete
A Vector of LISP expressions
Please see belowExample of Finalize
document:
Example of Finalize
document:
:create/:delete/:patch
and LISP expressions
:create/:delete/:patch
and LISP expressionsLISP sub-language is used to specify expressions which transform data of the document into FHIR resources (e.g. Observations).
Inside of :create
structure, LISP's get-in
function is used to access data in the document. Other LISP functions are used to transform the data correspondingly and create a FHIR resource object (see an example above) Also in :create
structure you can use lisp templates to avoid repetitions for extracting common resources (e.g. Observations)
This code will create 3 Observations resources with given patient.
We have only 2 lisp templates
aidbox.sdc/gen-observation-template
- generate observations resourceaidbox.sdc/gen-repeated-observations-template
- generated observations for repeated values
lisp templates can be manually created by user.
Inside of :patch, :delete
LISP's expressions are used to return list of resources that should be updated or deleted.
Examples:
In :patch
section, patient's gender will be updated to the value from document In :delete
section, we query all Observations related to this patient that should be deleted
Last updated