This wiki has undergone a migration to Confluence found Here
Difference between revisions of "Arden Syntax:Implementation Guide:Basic Tasks"
Jump to navigation
Jump to search
Karstenf77 (talk | contribs) (Created page with "== Basic Tasks == === Sort a List of Objects ===") |
Karstenf77 (talk | contribs) |
||
Line 2: | Line 2: | ||
=== Sort a List of Objects === | === Sort a List of Objects === | ||
+ | |||
+ | maintenance: | ||
+ | title: sample_sort_objects;; | ||
+ | mlmname: sample_sort_objects;; | ||
+ | arden: Version 2.9;; | ||
+ | version: 1.0;; | ||
+ | institution: Medexter Healthcare;; | ||
+ | author: Karsten Fehre;; | ||
+ | specialist: ;; | ||
+ | date: 2013-11-13;; | ||
+ | validation: testing;; | ||
+ | library: | ||
+ | purpose: ;; | ||
+ | explanation: ;; | ||
+ | keywords: ;; | ||
+ | citations: ;; | ||
+ | links: ;; | ||
+ | knowledge: | ||
+ | type: data_driven;; | ||
+ | data: | ||
+ | guidResult := object [ // result object: result of guidline query | ||
+ | compliance, // the compliance of the patient to a guidline | ||
+ | eOfIntervention, // the "ease of intervention" | ||
+ | text]; // the text | ||
+ | ;; | ||
+ | priority: ;; | ||
+ | evoke: ;; | ||
+ | logic: | ||
+ | |||
+ | result_list := (); | ||
+ | |||
+ | resGuid1 := new guidResult with false, 12, "The patient is not in compliance with the guideline."; | ||
+ | result_list := result_list, resGuid1; | ||
+ | |||
+ | resGuid2 := new guidResult with true, 70, "The patient is in compliance with the guideline."; | ||
+ | result_list := result_list, resGuid2; | ||
+ | |||
+ | resGuid3 := new guidResult with true, 23, "The patient is in compliance with the guideline."; | ||
+ | result_list := result_list, resGuid3; | ||
+ | |||
+ | // sorting the result | ||
+ | sorted_list := (); | ||
+ | for en in result_list do | ||
+ | inserted := false; | ||
+ | n := 1; | ||
+ | list_size := count sorted_list; | ||
+ | mylist := mylist, list_size; | ||
+ | while not inserted do | ||
+ | if list_size = 0 then | ||
+ | sorted_list := sorted_list, en; | ||
+ | inserted := true; | ||
+ | elseif n <= list_size then | ||
+ | el := sorted_list[n]; | ||
+ | if ((el.compliance = false) and (en.compliance = false)) and (el.eOfIntervention > en.eOfIntervention) then | ||
+ | sorted_list := sorted_list[1 seqto (n-1)], en, sorted_list[n seqto list_size]; | ||
+ | inserted := true; | ||
+ | elseif (el.compliance = true) and (en.compliance = false) then | ||
+ | sorted_list := sorted_list[1 seqto (n-1)], en, sorted_list[n seqto list_size]; | ||
+ | inserted := true; | ||
+ | elseif ((el.compliance = true) and (en.compliance = true)) and (el.eOfIntervention > en.eOfIntervention) then | ||
+ | sorted_list := sorted_list[1 seqto (n-1)], en, sorted_list[n seqto list_size]; | ||
+ | inserted := true; | ||
+ | endif; | ||
+ | else | ||
+ | sorted_list := sorted_list, en; | ||
+ | inserted := true; | ||
+ | endif; | ||
+ | |||
+ | n := n +1; | ||
+ | enddo; | ||
+ | enddo; | ||
+ | conclude true; | ||
+ | ;; | ||
+ | action: | ||
+ | return sorted_list; | ||
+ | ;; | ||
+ | urgency: ;; | ||
+ | end: |
Revision as of 21:52, 15 November 2013
Basic Tasks
Sort a List of Objects
maintenance: title: sample_sort_objects;; mlmname: sample_sort_objects;; arden: Version 2.9;; version: 1.0;; institution: Medexter Healthcare;; author: Karsten Fehre;; specialist: ;; date: 2013-11-13;; validation: testing;; library: purpose: ;; explanation: ;; keywords: ;; citations: ;; links: ;; knowledge: type: data_driven;; data: guidResult := object [ // result object: result of guidline query compliance, // the compliance of the patient to a guidline eOfIntervention, // the "ease of intervention" text]; // the text ;; priority: ;; evoke: ;; logic: result_list := (); resGuid1 := new guidResult with false, 12, "The patient is not in compliance with the guideline."; result_list := result_list, resGuid1; resGuid2 := new guidResult with true, 70, "The patient is in compliance with the guideline."; result_list := result_list, resGuid2; resGuid3 := new guidResult with true, 23, "The patient is in compliance with the guideline."; result_list := result_list, resGuid3;
// sorting the result sorted_list := (); for en in result_list do inserted := false; n := 1; list_size := count sorted_list; mylist := mylist, list_size; while not inserted do if list_size = 0 then sorted_list := sorted_list, en; inserted := true; elseif n <= list_size then el := sorted_list[n]; if ((el.compliance = false) and (en.compliance = false)) and (el.eOfIntervention > en.eOfIntervention) then sorted_list := sorted_list[1 seqto (n-1)], en, sorted_list[n seqto list_size]; inserted := true; elseif (el.compliance = true) and (en.compliance = false) then sorted_list := sorted_list[1 seqto (n-1)], en, sorted_list[n seqto list_size]; inserted := true; elseif ((el.compliance = true) and (en.compliance = true)) and (el.eOfIntervention > en.eOfIntervention) then sorted_list := sorted_list[1 seqto (n-1)], en, sorted_list[n seqto list_size]; inserted := true; endif; else sorted_list := sorted_list, en; inserted := true; endif;
n := n +1; enddo; enddo; conclude true; ;; action: return sorted_list; ;; urgency: ;; end: