Arden Syntax basics Educational material, part 3 Medexter Healthcare Borschkegasse 7/5 A-1090 Vienna www.medexter.com www.meduniwien.ac.at/kpa (academic) Better care, patient safety, and quality assurance by Medexter, Vienna, Austria Identifying an MLM • An MLM can be identified by using the following three pieces of information: – Name, as given in the MLMname slot – Institution, as given in the institution slot – Version, as given in the version slot • Example: The MLM with the following maintenance category maintenance: title: Simplified body mass index;; mlmname: BodyMassIndexSimple;; arden: Version 2.9;; version: 1.00;; institution: Medexter Healthcare;; ... can be addressed using the following MLM definition in the data slot: bmiMLM := MLM 'BodyMassIndexSimple' FROM INSTITUTION "Medexter Healthcare"; Note: If there are multiple MLMs with the same name and institution, the MLM with the latest version number is used; also, if a called MLM is from the same institution as the calling MLM, it is no longer necessary to write the institution explicitly. 2 Data types – Fundamentals I • Null: Data type that signifies unknown data • Boolean: Includes two truth values (true and false); logical operators use three-valued logic by using null to signify the third value (unknown) TRUE FALSE NULL • Number: No distinction is made between integer and floating point numbers 7 7.34323 • String: Stream of characters "This is a string constant." 3 Data types – Fundamentals II • Time: Refers to points in time; times before 1800-01-01 are not valid 2017-07-12T00:00:12 2017-07-12 • Duration: Signifies an interval of time 19.01 YEARS 3 DAYS 1 HOUR 2 MINUTES 54.6 SECONDS • Time-of-day: Refers to points in time that are not directly linked to a specific date 23:20:00 • Day-of-week: Special data type referring to specific days of the week; represented by constants or integer MONDAY (1) TUESDAY (2) ... SUNDAY (7) 4 Data types – Fundamentals III • List: An ordered set of elements; each element can be an arbitrary data type (lists cannot contain lists as elements) 4, 3, 5 3, TRUE, 5, NULL ,1 () • Object: May contain multiple named attributes, each of which may contain any valid data type MedicationDose := OBJECT [Medication, Dose, Status]; dose := NEW MedicationDose WITH "Ampicillin", "500mg", "Active"; // dose refers to an object with the fields medication, dose, status "Ampicillin" := dose.Medication; 5 Data types – Primary Time • In addition to its value part, each data value has a primary time part and a degree of applicability. • Primary time represents the value part’s time of creation, measurement, examination, etc. • By default, primary time is null. • Can be accessed using the time of operator. 2017-03-15T00:00:00 := TIME OF laboratory_result; • Database query results should contain both, the value and the primary time. – Might be the time when a blood test was drawn from the patient. – Might be the time when a medication order was placed. – Which time of a database entry is taken as primary time is left to the Arden Syntax implementer. 6 Expressions – Fundamentals • Statement: A statement specifies a logical constraint or an action to be performed. All statements except for the last statement in a slot must end with a semicolon (;). LET var1 BE 0; // equal to: var1 := 0; • Constant: Any data value that is explicitly represented is called a constant. TRUE "this is a string" • Variable: A variable is a placeholder for a data value or special constructs (e.g., an event, MLM, message, or destination) and represents this value in any subsequent expressions. An assignment statement is used to assign a value to a variable. LET var1 BE 0; var2 := MLM 'BodyMassIndexSimple' FROM INSTITUTION "Medexter Healthcare"; var3 := var1 + 1; • Operator: An expression may contain an operator and a number of sub-expressions called arguments. 3 + 5 //where + is the operator, 3 and 5 are the arguments 7 Statements – Fundamentals I • Assignment: Places the value of an expression into a variable. <variable> := <expression>; LET <variable> BE <expression>; • Include: Includes object, MLM, event, interface, and resource definitions from another MLM mlm2 := MLM 'my_mlm2' FROM INSTITUTION "my institution"; INCLUDE mlm2; 8 Statements – Fundamentals II • If-Then: Permits conditional execution based on the value of an expression. – There are three different types of if-then statements: If-Then: If-Then-Else: If-Then-ElseIf: Block1 is executed Block1 is executed if Block1 is executed if if condition is true condition is true, otherwise condition1 is true, if (if condition is false or condition2 is true block2 anything other than true) is executed, in all other block2 is executed cases block3 is executed IF <cond1> THEN IF <cond> THEN IF <cond> THEN <block1> <block1> <block1> ELSEIF <cond2> THEN ENDIF; ELSE <block2> <block2> ELSE ENDIF; <block3> ENDIF; 9 Statements – Fundamentals III • Loops – While Loop: Loops as long as the condition is equal to true WHILE <condition> DO <block> ENDDO; – For Loop: Loops over the elements of a list FOR i IN (1 SEQTO 10) DO ... // i can be used inside of the loop ENDDO; FOR i IN list_of_values DO ... ENDDO; • Conclude: Ends execution in the logic slot; if the conclude statement has a single true as argument, the action slot is executed immediately; otherwise the MLM terminates instantly • Argument: If a calling instance passes parameters to the called MLM, the MLM retrieves the parameters via the argument statement • Return: Returns the provided parameter to the calling instance (which may be another MLM or an external instance) 10
Description: