/sage/demos/medical/labs.sdf
  1 Form {
  2   scriptURL:<<
  3     var selectedIndex=-1
  4     function showGraph(table) {
  5       var sel=table.getSelectionRow();
  6       if(sel==-1 || sel==selectedIndex) return;
  7       var row=table.getSelectionItem();
  8       var chart=window.getViewer("labChart");
  9       chart.clearChartData();
 10       var series=chart.addSeries(chart.toChartSeries(row,true));
 11       series.setForeground(window.getColor("blue"));
 12       chart.setRangeLabel(row.getItem(12).toString());
 13       row=chart.addRangeMarker(row.getItem(11).toString()+"-Reference Range",'-');
 14       row.setForeground(window.getColor("#00ff0040"));
 15       chart.refreshItems();
 16       selectedIndex=sel;
 17     }
 18   >> [ inline="true" ]
 19   name: "labsForm"
 20   rows: 2
 21   widgets {
 22     {
 23       GroupBox {
 24         columns: 7
 25         border: "none"
 26         widgets {
 27           {
 28             Button {
 29               name: "viewsList"
 30               value: "Views"
 31               actionType: "popup_menu"
 32               popupMenu {
 33                 {value: "Most Recent Lab Results" }
 34                 {value: "Chemistry" }
 35                 {value: "Microbiology" }
 36                 {value: "Pathology" }
 37               }
 38             }
 39           }
 40           {
 41             Label { bounds-width: "5ch" }
 42           }
 43           {
 44             Label {
 45               name: "viewLabel"
 46               margin { top: 2; bottom: 2 }
 47               horizontalAlign: "fill"
 48               font-style: "bold"
 49               value: "Most Recent Lab Results"
 50             }
 51           }
 52           {
 53             Label { bounds-width: "5ch" }
 54           }
 55         }
 56       }
 57     }
 58     {
 59       SplitPane {
 60         name: "labsSplitPane"
 61         splitProportions { .66 }
 62         horizontalAlign: "fill"
 63         verticalAlign: "fill"
 64         bgColor: "clinicalBackground+5"
 65         regions {
 66           {
 67             viewer {
 68               Table {
 69                 titleLocation: "top_left"
 70                 alternatingHighlightType: "row"
 71                 alternatingHighlightColor: "clinicalBackground+18"
 72                 headerBgColor: "clinicalBackground"
 73                 border: "shadow" [ thickness="7" ]
 74                 gridLineType: "both"
 75                 selectionMode: "single"
 76                 boldColumnHeaders: "true"
 77                 name: "labsTable"
 78                 focusPainted: "false"
 79                 quickFindSupport: "search_bar"
 80                 autoResizeMode: "none"
 81                 autoSizeColumnsToFit: "true"
 82                 headerFooterColHeaderStyle: "flat_and_inverted"
 83                 columns {
 84                   {
 85                     title: "Lab Test"
 86                     renderType: "header"
 87                     bgColor: "TableHeader.background"
 88                     headerHorizontalAlign: "center"
 89                     headerVerticalAlign: "center"
 90                   }
 91                   {
 92                     title: "<html><center>{$dateTime('T-9@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
 93                     horizontalAlign: "center"
 94                   }
 95                   {
 96                     title: "<html><center>{$dateTime('T-8@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
 97                     horizontalAlign: "center"
 98                   }
 99                   {
100                     title: "<html><center>{$dateTime('T-7@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
101                     horizontalAlign: "center"
102                   }
103                   {
104                     title: "<html><center>{$dateTime('T-6@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
105                     horizontalAlign: "center"
106                   }
107                   {
108                     title: "<html><center>{$dateTime('T-5@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
109                     horizontalAlign: "center"
110                   }
111                   {
112                     title: "<html><center>{$dateTime('T-4@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
113                     horizontalAlign: "center"
114                   }
115                   {
116                     title: "<html><center>{$dateTime('T-3@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
117                     horizontalAlign: "center"
118                   }
119                   {
120                     title: "<html><center>{$dateTime('T-2@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
121                     horizontalAlign: "center"
122                   }
123                   {
124                     title: "<html><center>{$dateTime('T-1@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
125                     horizontalAlign: "center"
126                   }
127                   {
128                     title: "<html><center>{$dateTime('T@0600','MMM dd, yyyy '<br>' @HH:mm')}</center></html>"
129                     horizontalAlign: "center"
130                   }
131                   {
132                     title: "<html><center>Reference<br/> Range"
133                     renderType: "footer"
134                     bgColor: "TableHeader.background"
135                     horizontalAlign: "center"
136                   }
137                   {
138                     title: "Units"
139                     renderType: "footer"
140                     bgColor: "TableHeader.background"
141                     horizontalAlign: "center"
142                     headerVerticalAlign: "center"
143                   }
144                 }
145                 dataURL: "data/labs.txt"
146               } [ onMouseUp="showGraph(widget)", onAction="showGraph(widget)" ]
147             }
148           }
149           {
150             viewer {
151               Chart {
152                 name: "labChart"
153                 border: "shadow" [ thickness="7" ]
154                 bgColor: "clinicalBackground+5"
155                 domainAxis {
156                   valueType: "date_time_type"
157                   value: "Date/Time"
158                   subItems {
159                     {value: "T-9@0600" }
160                     {value: "T-8@0600" }
161                     {value: "T-7@0600" }
162                     {value: "T-6@0600" }
163                     {value: "T-5@0600" }
164                     {value: "T-4@0600" }
165                     {value: "T-3@0600" }
166                     {value: "T-2@0600" }
167                     {value: "T-1@0600" }
168                     {value: "T@0600" }
169                   }
170                 } [ timeUnit="hour" ]
171                 rangeAxis { valueType: "integer_type"; value: "Result" }
172                 plot {
173                   bgColor: "white"
174                   gridLine: "auto" [ color="gray" ]
175                   labels: "values"
176                   noDataMessage {
177                     value: "Please select a lab test to graph the result values"
178                     font-size: "*2"
179                     fgColor: "blue"
180                   }
181                 }
182               }
183             }
184           }
185         }
186       }
187     }
188   }
189 }
190
191
192