Appearance
Data Exchange
Arden Syntax makes it easy to read data from external sources, manipulate it, and then write results back. In Arden Syntax, data access like this is performed through a special READ statement only valid in the data slot.
READ
There are two main ways to read multiple values from a data source in Arden Syntax.
Curly braces syntax
You can use curly braces {} for a quick, flexible read. The content inside is unspecified, giving you a “formless” way to grab data.
Here, Na, Cl, and HCO3 are pulled from the database, then optionally structured into an AnionGap object for easier handling.
arden-syntax
data:
// in this example the data to calculate three anion gaps are retrieved
(Na, Cl, HCO3) := READ last 3 from {select sodium, chloride, bicarb from electro};READ AS
READ AS works much like the regular READ statement, but instead of returning separate lists for each query column, it gives you a single list of structured objects, with named attributes. You first declare the object structure (the attribute names), then use READ AS to fill it with data from your source.
arden-syntax
data:
AnionGap := Object [Na, Cl, HCO3];
gaps := READ AS AnionGap last 3 from {select sodium, chloride, bicarb from electro};This is especially useful when you want to work with records instead of juggling multiple lists of values.
READ As FHIR Object type
There’s also a FHIR specific variant of READ AS for directly querying a FHIR repository. Instead of defining your own object, you use pre-defined FHIR object types that are built into Arden Syntax.
Because these types are already known to the system, you don’t need to declare them with OBJECT and you can skip the curly braces {} normally used for mappings.
For example, fetching Observation records from a FHIR server works like this:
arden-syntax
data:
LET observations BE READ AS Observation
WHERE it.subject.type = "Patient"
AND it.status = "final"
AND it.code.coding.system = “http://loinc.org”
AND it.code.coding.code = “10155-0”;That returns a list of Observation objects, each with all the fields defined in the FHIR standard.
Note:
The <object-type> in READ AS here must be one of the official FHIR types defined the Arden specification
WRITE
Once your logic has run, you can write results back in the action slot. For example, you might update a FHIR resource, store a computed value, or trigger a workflow.
arden-syntax
action:
write result to FHIRObservation;This can do many things, like update a FHIR resource, store a computed value in a patient record or send an alert or message to a healthcare provider.