Module

uGraphs

Path

C:\CPRS\CPRS30\uGraphs.pas

Last Modified

7/15/2014 3:26:44 PM

Classes

Name Comments
TGraphActivity -
TGraphSetting -

Functions

Name Owner Declaration Scope Comments
GraphSettingsInit - function GraphSettingsInit(settings: string): TGraphSetting; Interfaced -

Constants

Name Declaration Scope Comments
BIG_NUMBER 9999999 Interfaced -
BIG_SPACES ' ' Interfaced -
COLOR_INFO clCream Interfaced -
COLOR_PRINTING clMoneyGreen Interfaced $CCFFFF; $CCCCFF; $CCFFCC; $FFCCCC; $FFCCFF; $FFFFCC;
COLOR_WARNING clCream Interfaced ClFuchsia;
COLOR_ZOOM clCream Interfaced ClSkyBlue;
DFORMAT_MDY 'm/d/yyyy' Interfaced Format date/time axis
DFORMAT_MYY 'm/yy' Interfaced -
DFORMAT_YY 'yy' Interfaced -
DWIDTH_MDY 66 Interfaced -
DWIDTH_MYY 30 Interfaced -
DWIDTH_YY 18 Interfaced -
FM_START_DATE 2500101 Interfaced -
FM_STOP_DATE 3500101 Interfaced -
GRAPH_FLOAT 'F' Interfaced -
GRAPH_REPORT 'R' Interfaced -
HINT_ALL_SOURCE 'All possible items are displayed.' Interfaced -
HINT_APPLY 'Select the section you where you want to display the graph.' Interfaced -
HINT_BTN_ADD1 'Click to add this item for display (or double-click item).' Interfaced -
HINT_BTN_ADDALL 'Click to add all items for display.' Interfaced -
HINT_BTN_CLEAR 'Click to clear the Items and Items for Graphing lists.' Interfaced -
HINT_BTN_CLOSE 'Click to display items for graphing.' Interfaced -
HINT_BTN_DEFINITION 'Click to display the definitions of all selections.' Interfaced -
HINT_BTN_DELETE 'Click to delete the selected view.' Interfaced -
HINT_BTN_REMOVE1 'Click to remove this item from display (or double-click item).' Interfaced -
HINT_BTN_REMOVEALL 'Click to remove all items from display.' Interfaced -
HINT_BTN_RENAME 'Click to rename the selected view.' Interfaced -
HINT_BTN_SAVE 'Click to save your view.' Interfaced -
HINT_BTN_SAVE_PUB 'Click to save a public view (available to editors only).' Interfaced -
HINT_DISPLAY 'This is the list of items, types, and/or views that compose the View that will be graphed.' Interfaced -
HINT_OTHER_SOURCE 'These are Views and Lab Groups of other users.' Interfaced -
HINT_OTHERS 'Select other users to see their views or lab groups.' Interfaced -
HINT_PAT_SOURCE 'Only items where the patient has data are displayed.' Interfaced Hint messages for view definition
HINT_SELECTION 'Select specific items and move them to the right.' Interfaced -
HINT_SELECTION_INFO 'This form is primarily used for defining views.' Interfaced -
HINT_SOURCE 'These are the different types of data.' Interfaced -
KEYPRESS_OFF 'NO' Interfaced -
KEYPRESS_ON 'YES' Interfaced Keypress flags
LLS_BACK ']___________________________________________________________________________________________________________' Interfaced -
LLS_FRONT '^____[' Interfaced -
MAX_ITEM_DISCLAIMER 10 Interfaced -
NUM_COLORS 16 Interfaced -
POINT_PADDING 0.03 Interfaced Assume a point height of 3%
PROB_HEIGHT 2 Interfaced -
RX_HEIGHT_IN 12 Interfaced -
RX_HEIGHT_NVA 9 Interfaced -
RX_HEIGHT_OUT 15 Interfaced -
SETTING_3D 'A' Interfaced Settings use single character
SETTING_CLEAR 'B' Interfaced -
SETTING_DATES 'C' Interfaced -
SETTING_FIXED 'M' Interfaced -
SETTING_GRADIENT 'D' Interfaced -
SETTING_HINTS 'E' Interfaced -
SETTING_HZOOM 'K' Interfaced -
SETTING_LEGEND 'F' Interfaced -
SETTING_LINES 'G' Interfaced -
SETTING_MERGELABS 'O' Interfaced -
SETTING_SORT 'H' Interfaced -
SETTING_TOP 'I' Interfaced -
SETTING_TURBO 'N' Interfaced -
SETTING_VALUES 'J' Interfaced -
SETTING_VZOOM 'L' Interfaced -
SHINT_BTN_ALL 'Click to check all sources.' Interfaced -
SHINT_BTN_CLEAR 'Click to uncheck all sources.' Interfaced -
SHINT_BTN_CLOSE 'Click to display these settings for graphing.' Interfaced -
SHINT_BTN_PER 'Click to display your personal settings.' Interfaced -
SHINT_BTN_PERSAVE 'Click to save your personal defaults' Interfaced -
SHINT_BTN_PUB 'Click to display the default settings.' Interfaced -
SHINT_BTN_PUBSAVE 'Click to save the public default (available to editors only).' Interfaced -
SHINT_BTN_SAVE 'Click these buttons to save default settings.' Interfaced -
SHINT_BTN_SHOW 'Click these buttons to display default settings.' Interfaced -
SHINT_FUNCTIONS 'These functions are restricted to editors for evaluation.' Interfaced -
SHINT_INPT 'Select the default date range when initially opening graphs.' Interfaced -
SHINT_MAX 'Enter the maximum number of graphs to appear on the screen.' Interfaced -
SHINT_MAX_ITEMS 'Enter the maximum number of items that can be graphed at one time.' Interfaced -
SHINT_MIN 'Enter the minimum height of a graph (this is in pixels).' Interfaced -
SHINT_OPTIONS 'Check options to change the appearance and behavior of the graph.' Interfaced -
SHINT_OUTPT 'Select the default date range when initially opening graphs.' Interfaced -
SHINT_SOURCES 'This is a list of all the types of data that can be graphed.' Interfaced Hint messages for settings
TXT_COMMENTS '** comments' Interfaced Text messages
TXT_COPY_DISCLAIMER 'Note: Graphs display limited data, view details for more information.' Interfaced -
TXT_DISCLAIMER 'Due to number of items and size restrictions on your display, ' Interfaced -
TXT_INFO 'Select multiple items using Ctrl-click or Shift-click.' Interfaced -
TXT_NOGRAPHING 'CPRS is not configured for graphing.' Interfaced -
TXT_NONNUMERICS 'free-text values:' Interfaced -
TXT_PRINTING 'Graphs are being printed' Interfaced -
TXT_REPORT_DISCLAIMER 'Note: Listing displays limited data, view details for more information.' Interfaced -
TXT_VIEW_DEFINITION 'View Definition' Interfaced -
TXT_WARNING 'Warning: You are using graph settings with a Special Function.' Interfaced -
TXT_WARNING_CHECK_RESULTS '** Please check results for this item by viewing Details. **' Interfaced -
TXT_WARNING_MERGED_LABS 'Warning: *Lab test results may have different reference ranges.' Interfaced -
TXT_WARNING_SAME_TIME 'Warning: Items have multiple occurrences at the same time.' Interfaced -
TXT_ZOOMED 'Zoomed Date Range: ' Interfaced -
VIEW_CURRENT '-999' Interfaced Views
VIEW_LABS '-3' Interfaced -
VIEW_PERSONAL '-1' Interfaced -
VIEW_PUBLIC '-2' Interfaced -
VIEW_TEMPORARY '-888' Interfaced -
ZOOM_PERCENT 95 Interfaced -


Module Source

1     unit uGraphs;
2     
3     interface
4     
5     uses
6       SysUtils, Classes, Graphics, ORFn;
7     
8     type
9       TGraphSetting = class
10      public
11        ClearBackground: boolean;
12        DateRangeInpatient: string;
13        DateRangeOutpatient: string;
14        Dates: boolean;
15        FixedDateRange: boolean;
16        FMStartDate: double;
17        FMStopDate: double;
18        Gradient: boolean;
19        HighTime: TDateTime;
20        Hints: boolean;
21        HorizontalZoom: boolean;
22        ItemsDisplayed: TStrings;
23        ItemsForDisplay: TStrings;
24        Legend: boolean;
25        Lines: boolean;
26        LowTime: TDateTime;
27        MaxGraphs: integer;
28        MaxSelect: integer;
29        MaxSelectMin: integer;
30        MaxSelectMax: integer;
31        MergeLabs: boolean;
32        MinGraphHeight: integer;
33        OptionSettings: string;              // only used for storage
34        Points: boolean;
35        SortByType: boolean;
36        SortColumn: integer;
37        Sources: TStrings;
38        StayOnTop: boolean;
39        Turbo: boolean;
40        Values: boolean;
41        VerticalZoom: boolean;
42        View3D: boolean;
43      end;
44    
45      TGraphActivity = class
46      public
47        CurrentSetting: string;
48        OldDFN: string;
49        PublicSetting: string;
50        PersonalSetting: string;
51        PublicEditor: boolean;
52        Status: string;
53        TurboOn: boolean;
54        Cache: boolean;
55      end;
56    
57    const
58      BIG_NUMBER = 9999999;
59      BIG_SPACES = '                                                                ';
60      FM_START_DATE = 2500101;
61      FM_STOP_DATE = 3500101;
62      MAX_ITEM_DISCLAIMER = 10;
63      NUM_COLORS = 16;
64      PROB_HEIGHT = 2;
65      RX_HEIGHT_IN = 12;
66      RX_HEIGHT_NVA = 9;
67      RX_HEIGHT_OUT = 15;
68      ZOOM_PERCENT = 95;
69      GRAPH_FLOAT = 'F';
70      GRAPH_REPORT = 'R';
71      POINT_PADDING = 0.03;              // assume a point height of 3%
72      LLS_FRONT  = '^____[';
73      LLS_BACK  = ']___________________________________________________________________________________________________________';
74    
75    
76        // settings use single character
77      SETTING_3D = 'A';
78      SETTING_CLEAR = 'B';
79      SETTING_DATES = 'C';
80      SETTING_GRADIENT = 'D';
81      SETTING_HINTS = 'E';
82      SETTING_LEGEND = 'F';
83      SETTING_LINES = 'G';
84      SETTING_SORT = 'H';
85      SETTING_TOP = 'I';
86      SETTING_VALUES = 'J';
87      SETTING_HZOOM = 'K';
88      SETTING_VZOOM = 'L';
89      SETTING_FIXED = 'M';
90      SETTING_TURBO = 'N';
91      SETTING_MERGELABS = 'O';
92    
93      // keypress flags
94      KEYPRESS_ON = 'YES';
95      KEYPRESS_OFF = 'NO';
96    
97      // format date/time axis
98      DFORMAT_MDY = 'm/d/yyyy';
99      DFORMAT_MYY = 'm/yy';
100     DFORMAT_YY = 'yy';
101     DWIDTH_MDY = 66;
102     DWIDTH_MYY = 30;
103     DWIDTH_YY = 18;
104   
105     // text messages
106     TXT_COMMENTS = '** comments';
107     TXT_COPY_DISCLAIMER = 'Note: Graphs display limited data, view details for more information.';
108     TXT_DISCLAIMER = 'Due to number of items and size restrictions on your display, '
109       + 'all items may not be visible.';
110     TXT_INFO = 'Select multiple items using Ctrl-click or Shift-click.';
111     TXT_NONNUMERICS = 'free-text values:';
112     TXT_NOGRAPHING = 'CPRS is not configured for graphing.';
113     TXT_PRINTING = 'Graphs are being printed';
114     TXT_REPORT_DISCLAIMER = 'Note: Listing displays limited data, view details for more information.';
115     TXT_VIEW_DEFINITION = 'View Definition';
116     TXT_WARNING = 'Warning: You are using graph settings with a Special Function.';
117     TXT_WARNING_CHECK_RESULTS = '** Please check results for this item by viewing Details. **';
118     TXT_WARNING_MERGED_LABS = 'Warning: *Lab test results may have different reference ranges.';
119     TXT_WARNING_SAME_TIME = 'Warning: Items have multiple occurrences at the same time.';
120     TXT_ZOOMED = 'Zoomed Date Range: ';
121   
122     // views
123     VIEW_CURRENT = '-999';
124     VIEW_LABS = '-3';
125     VIEW_PERSONAL = '-1';
126     VIEW_PUBLIC = '-2';
127     VIEW_TEMPORARY = '-888';
128   
129     COLOR_INFO = clCream;
130     COLOR_PRINTING = clMoneyGreen;    //$CCFFFF; $CCCCFF; $CCFFCC; $FFCCCC; $FFCCFF; $FFFFCC;
131     COLOR_WARNING = clCream;  //clFuchsia;
132     COLOR_ZOOM = clCream;  //clSkyBlue;
133   
134     // hint messages for view definition
135     HINT_PAT_SOURCE     = 'Only items where the patient has data are displayed.'
136                   + #13 + 'Use this for selecting items to display on the graph.';
137     HINT_ALL_SOURCE     = 'All possible items are displayed.'
138                   + #13 + 'Use this for defining items to be displayed/saved as Views.'
139                   + #13 + 'Note: For easy use, select Views for graphing.';
140     HINT_SELECTION_INFO = 'This form is primarily used for defining views.'
141                   + #13 + 'Usually selection is done by selecting Views or Items to graph.'
142                   + #13 + 'This form defines views.'
143                   + #13 + 'The Settings form defines items that are always selectable for graphing.';
144     HINT_SOURCE         = 'These are the different types of data.'
145                   + #13 + 'Types are followed by a section showing your Personal Views, then Public Views.'
146                   + #13 + 'Click a type and then select individual items'
147                   + #13 + 'Double-click a type to select all items of this type  - <any>';
148     HINT_OTHER_SOURCE   = 'These are Views and Lab Groups of other users.'
149                   + #13 + 'Use these for defining items to be displayed/saved as Views.'
150                   + #13 + 'Note: Select a Person to display their views and lab groups.';
151     HINT_OTHERS         = 'Select other users to see their views or lab groups.'
152                   + #13 + 'Use these for defining items to be displayed/saved as Views.';
153     HINT_BTN_DEFINITION = 'Click to display the definitions of all selections.'
154                   + #13 + 'Definitions show the items that make up a view or lab group.'
155                   + #13 + 'This includes views and lab groups of another user you have selected.';
156     HINT_SELECTION      = 'Select specific items and move them to the right.'
157                   + #13 + 'Use the arrow buttons or double click.'
158                   + #13 + 'Selecting a type <any> will use all patients for that type.';
159     HINT_DISPLAY        = 'This is the list of items, types, and/or views that compose the View that will be graphed.'
160                   + #13 + 'You can save this as a personal view by clicking the Save Personal button.';
161     HINT_BTN_ADDALL     = 'Click to add all items for display.';
162     HINT_BTN_ADD1       = 'Click to add this item for display (or double-click item).';
163     HINT_BTN_REMOVE1    = 'Click to remove this item from display (or double-click item).';
164     HINT_BTN_REMOVEALL  = 'Click to remove all items from display.';
165     HINT_BTN_CLEAR      = 'Click to clear the Items and Items for Graphing lists.';
166     HINT_BTN_DELETE     = 'Click to delete the selected view.';
167     HINT_BTN_RENAME     = 'Click to rename the selected view.';
168     HINT_BTN_SAVE       = 'Click to save your view.'
169                   + #13 + 'You will give this view a name that can be selected from the graph.';
170     HINT_BTN_SAVE_PUB   = 'Click to save a public view (available to editors only).'
171                   + #13 + 'Public views can be selected by all users.';
172     HINT_APPLY          = 'Select the section you where you want to display the graph.';
173     HINT_BTN_CLOSE      = 'Click to display items for graphing.'
174                   + #13 + 'Note: If you are using this from the Options menu, '
175                   + #13 + 'items are not displayed (multiple graphs may be in use).'
176                   + #13 + 'You should save any view definitions before closing this form.';
177   
178     // hint messages for settings
179     SHINT_SOURCES     = 'This is a list of all the types of data that can be graphed.'
180                 + #13 + 'Check the types you wish to be selectable on the graph.'
181                 + #13 + 'It is best to only check the types that you frequently use.'
182                 + #13 + 'If you select a view on the graph that has types defined that are not checked,'
183                 + #13 + 'that type of data will become automatically checked.'
184                 + #13 + 'Note: Data is only selectable if the patient has that type of data';
185     SHINT_OPTIONS     = 'Check options to change the appearance and behavior of the graph.'
186                 + #13 + 'Common options are also available on the graph''s right-click menu';
187     SHINT_MAX =         'Enter the maximum number of graphs to appear on the screen.'
188                 + #13 + 'This is used when individual graphs are displayed and'
189                 + #13 + 'applies to both the top and bottom sections.'
190                 + #13 + 'When the number of graphs exceeds this limited, the graphs are available by scrolling.';
191     SHINT_MIN         = 'Enter the minimum height of a graph (this is in pixels).'
192                 + #13 + 'This will depend on the size of your display.'
193                 + #13 + 'This setting assures that at least this amount of height will appear on the graph.'
194                 + #13 + 'Use in combination with Max Graphs in Display.';
195     SHINT_MAX_ITEMS   = 'Enter the maximum number of items that can be graphed at one time.'
196                 + #13 + 'This setting prevents you from mistakenly selecting a large number of items.';
197     SHINT_OUTPT       = 'Select the default date range when initially opening graphs.'
198                 + #13 + 'This setting is used if the patient is currently an outpatient.';
199     SHINT_INPT        = 'Select the default date range when initially opening graphs.'
200                 + #13 + 'This setting is used if the patient is currently an inpatient.';
201     SHINT_FUNCTIONS   = 'These functions are restricted to editors for evaluation.';
202     SHINT_BTN_SHOW    = 'Click these buttons to display default settings.';
203     SHINT_BTN_PER     = 'Click to display your personal settings.';
204     SHINT_BTN_PUB     = 'Click to display the default settings.'
205                 + #13 + 'These settings are used when you have not saved a personal setting.';
206     SHINT_BTN_SAVE    = 'Click these buttons to save default settings.';
207     SHINT_BTN_PERSAVE = 'Click to save your personal defaults';
208     SHINT_BTN_PUBSAVE = 'Click to save the public default (available to editors only).';
209     SHINT_BTN_ALL     = 'Click to check all sources.';
210     SHINT_BTN_CLEAR   = 'Click to uncheck all sources.';
211     SHINT_BTN_CLOSE   = 'Click to display these settings for graphing.'
212                 + #13 + 'To cancel any unsaved changes you''ve made, click the upper-right x box.'
213                 + #13 + 'Note: If you are using this from the Options menu, '
214                 + #13 + 'settings will not change your display (multiple graphs may be in use).'
215                 + #13 + 'You should save any settings before closing this form.';
216   
217   function GraphSettingsInit(settings: string): TGraphSetting;
218   
219   implementation
220   
221   function GraphSettingsInit(settings: string): TGraphSetting;
222   var
223     FGraphSetting: TGraphSetting;
224   begin
225     FGraphSetting := TGraphSetting.Create;
226     with FGraphSetting do
227     begin
228       OptionSettings := Piece(settings, '|', 2);
229       SortColumn := strtointdef(Piece(settings, '|', 3), 0);
230       MaxGraphs := strtointdef(Piece(settings, '|', 4), 5);
231       MinGraphHeight := strtointdef(Piece(settings, '|', 5), 90);
232       MaxSelect := strtointdef(Piece(settings, '|', 7), 100);
233       MaxSelectMin := 1;
234       MaxSelectMax := strtointdef(Piece(settings, '|', 8), 1000);
235       Values := Pos(SETTING_VALUES, OptionSettings) > 0;
236       VerticalZoom := Pos(SETTING_VZOOM, OptionSettings) > 0;
237       HorizontalZoom := Pos(SETTING_HZOOM, OptionSettings) > 0;
238       View3D := Pos(SETTING_3D, OptionSettings) > 0;
239       Legend := Pos(SETTING_LEGEND, OptionSettings) > 0;
240       Dates := Pos(SETTING_DATES, OptionSettings) > 0;
241       Lines := Pos(SETTING_LINES, OptionSettings) > 0;
242       StayOnTop := Pos(SETTING_TOP, OptionSettings) > 0;
243       SortByType := Pos(SETTING_SORT, OptionSettings) > 0;
244       ClearBackground := Pos(SETTING_CLEAR, OptionSettings) > 0;
245       Gradient := Pos(SETTING_GRADIENT, OptionSettings) > 0;
246       Hints := Pos(SETTING_HINTS, OptionSettings) > 0;
247       FixedDateRange := Pos(SETTING_FIXED, OptionSettings) > 0;
248       HighTime := 0;
249       LowTime := BIG_NUMBER;
250       FMStartDate := FM_START_DATE;
251       FMStopDate := FM_STOP_DATE;
252       if SortByType then SortColumn := 1 else SortColumn := 0;
253       DateRangeOutpatient := Piece(settings, '|', 9);
254       if DateRangeOutpatient = '' then DateRangeOutpatient := '8';
255       DateRangeInpatient := Piece(settings, '|', 10);
256       if DateRangeInpatient = '' then DateRangeInpatient := '8';
257       Turbo := Pos(SETTING_TURBO, OptionSettings) > 0;
258       if Piece(settings, '|', 6) = '0' then Turbo := false;  // a 0 in 6th piece shuts down turbo for everyone    
259       MergeLabs := Pos(SETTING_MERGELABS, OptionSettings) > 0;
260     end;
261     Result := FGraphSetting;
262   end;
263   
264   end.

Module Calls (2 levels)

-

Module Called-By (2 levels)


              uGraphs
            fGraphs┤ 
           fFrame┤ │ 
         fReports┘ │ 
     fGraphSettings┤ 
       fGraphs...┤ │ 
         fOptions┘ │ 
         fGraphData┤ 
        fFrame...┤ │ 
      fReports...┤ │ 
       fGraphs...┤ │ 
fGraphSettings...┤ │ 
   fGraphProfiles┘ │ 
  fGraphProfiles...┘