Visualize Event Distribution with EGRAPH
6 min
\<font color="#67854e"> question \</font> how can i use the egraph command to analyze event distribution and trends in my herd records? \<font color="#67854e"> answer \</font> the egraph command is a visual analysis tool that turns raw event data into interactive graphs that show the distribution of events (like mast, bred, or dry) within your herd egraph provides a clear, charted distribution of events, helping you quickly validate protocols, spot unusual event peaks, and identify high risk periods by converting records into visual data, it tells you when and where specific health and management events occurred within the herd you can run the egraph function using the options window to select your parameters alternatively, you can add parameters to the egraph command directly in the command line open the egraph options window the easiest way to select events and set analysis parameters is by using the egraph options window to open the window, enter egraph in the command line the egraph options window allows you to choose which events to display in the graph, as well as the specific parameters for how you want the data displayed \<font color="#67854e"> event checkboxes \</font> select one or more specific event types you want included in the graph if you select multiple events, the graph will display each event type in a separate bar for event types with multiple occurrences (such as mast 1 and mast 2), the separate occurrences are stacked and color coordinated in the bar for that event \<font color="#67854e"> start date / end date \</font> defines the historical period you want analyzed by default, egraph runs for the last 365 days \<font color="#67854e"> lactations \</font> defines which lactations display in the graph by default, all lactations are selected except lactation 0 egraph cannot merge data for cows (lact>0) and youngstock (lact=0) into a single analysis; you must choose to display one group or the other \<font color="#67854e"> use scatter \</font> when checked, the graph runs as an individual scatter plot instead of the default segmented bar graph \<font color="#67854e"> event ## \</font> allows you to control which event occurrences display in the graph for example, if you've chosen to display mast events, you can select to display only the second and third mast occurrences (i e , mast 2 and mast 3) in the graph by default, this option is set to show all of the event types chosen between the first and fifteenth occurrences ( 1 15 ) \<font color="#67854e"> width ## \</font> sets the width (in days) of each bar on the graph common settings include 1 (for daily data), 7 (for weekly data, useful for smoothing fluctuations), and 30 (for monthly data) \<font color="#67854e"> x axis \</font> defines the primary variable by which the events are distributed (the horizontal axis) options include event date (default), dim (adults), age (heifers), days since heat, etc \<font color="#67854e"> legend \</font> defines the secondary variable used to segment the bars (color coding) allows you to break down events by event number (default), result/remark, cured/breeding code, protocol, or by item once you’ve made your selections, click the ok button at the bottom of the window to generate the customized egraph bar graph understanding egraph output a basic egraph bar graph is shown below as an example of how the egraph function is used to visualize health events over time this example bar graph displays all recorded mastitis (mast) events for the herd during the past year \<font color="#67854e"> vertical axis (y axis) \</font> shows the total count of events recorded for each date and is always labeled count of events \<font color="#67854e"> horizontal axis (x axis) \</font> shows the primary way in which the events are distributed in this example, it's labeled date of event (the default option for the horizontal axis) this represents the date of each event, covering approximately a one year period these parameters can be changed in the egraph options window docid\ wz70pt9vc4zc9r0pbk2dm \<font color="#67854e"> color coded bars \</font> the total height of each bar indicates the cumulative number of events on a given date, providing an at a glance summary of incident frequency and trends each color coded segment within the bars corresponds to a different event occurance (in this case, mast 1 through mast 5 ), as indicated in the legend on the right this allows you to quickly identify patterns or spikes in specific event types over time \<font color="#67854e"> legend \</font> a color coded key showing the secondary variable being used for event distribution the example shows what the legend looks when event number is chosen as its variable checkboxes control which of the variables display in the graph this graphical summary enables users to efficiently monitor health event trends, identify periods of increased mastitis incidence, and support management decisions with data driven insights investigate events in the bar graph (drill down) to investigate or "drill down" to see the individual events that make up a bar or bar segment, double click the area of the bar you want to analyze when you do, the graph closes, and dairycomp automatically runs an events command this generates a detailed, filtered list of all the individual cow events that contributed to that specific segment the list is automatically filtered to include all events within the time period (date or dim range) you clicked only the event number (e g , mast 1, mast 2) that you clicked in the legend the resulting output shows a list of records with the event code (for example, mast), along with the animal's id, date, and other details while the list does not display the event number as a separate column, it is filtered to include only the events that match the segment you selected this allows you to verify exactly which animals contributed to that specific segment or spike on the graph view the egraph data as text to view a text based version of the egraph data, select the grid or report tab at the bottom of the screen this is helpful if you need to review, verify, or sort (in the grid tab) the numeric counts for your analysis to return to the egraph bar graph, select the graph tab view a scatter plot of events if you want to view a scatter plot version of the graph instead of the default bar graph, check the use scatter \s box in the egraph options window (or by using the command line docid\ wz70pt9vc4zc9r0pbk2dm switch \s ) a scatter plot is designed to visualize individual events and is a good way to quickly spot outliers or anomalies this visual configuration makes it easy to spot events (dots) that are too early or too late compared to the herd average, such as a mast event occurring very early in lactation each dot on the graph represents a single event recorded on a single animal the x axis always displays the date of event the y axis always displays the dim up to the event to drill down and investigate an individual event, double click the applicable point on the scatter plot the animal's cowcard will open, where you can view all the animal's events and other details understanding the event gap egraph uses built in logic to ensure event counts are accurate this logic uses an "event gap" to prevent multiple entries for the same animal within a specific time frame (for example, 7 days) from being counted as multiple, separate occurrences this means if you record a mast event on monday and tuesday, egraph counts that as one mast occurrence the resulting graph is based on these true counts the event gap is usually configured as a default setting in dairycomp you can override this system default for a single graph by adding a colon and the desired number of days directly to the event name in the command line for example, to force the graph to use a 14 day gap for mast, enter egraph mast 14 if you want egraph to count every single event entry exactly as recorded (without grouping), set the gap to zero egraph \[event] 0 run egraph from the command line the fastest way to run and customize an egraph bar graph is from the command line by adding the event name(s) and specific switches to the egraph command, you bypass the options window the basic structure for running egraph in the command line is egraph \[event] for \[condition] \ \[switches] to run a basic graph, simply enter egraph followed by the event code, such as egraph dry if you need to limit the population of animals included in the analysis, you can add a for statement for example filtering by parity to analyze only first lactation freshenings, use egraph fresh for lact=1 filtering by youngstock/heifers if you wish to filter for animals with a lactation value of zero (i e , youngstock), you must also include the \y switch the command egraph fresh for lact=0 \y will only include heifer freshenings in the analysis customizing the x axis distribution by default, egraph distributes events along the horizontal axis (x axis) by the event date to change this to a days in milk (dim) or age distribution, use the \i switch (for "intervals") for example, run egraph bred \i to show breedings distributed by days in milk (dim) for cows when analyzing youngstock, the \y switch automatically restricts the analysis to animals with lact=0 and sets the x axis distribution to age in days for example, run egraph bred \iy or egraph pneu \iy to show events distributed by the animal's age (e g , heifer breedings or pneumonia events by age) common command line switches you can combine multiple switches at the end of the command without any spaces for example, the switch \w7i sets the width of each bar to 7 and changes the x axis distribution to intervals the following switches are useful for quick customization \<font color="#67854e"> \s (scatter plot) \</font> generates a scatter plot docid\ wz70pt9vc4zc9r0pbk2dm instead of the default bar graph for example, egraph mast \s \<font color="#67854e"> \p (protocols) \</font> sets the legend/segmentation to display events broken down by the specific protocol used for example, egraph mast \p note if the event type selected does not use protocols (such as the bred event), this switch instead shows the name of the applicable technician \<font color="#67854e"> \w# (width) \</font> sets the width (in days) of each bar on the graph for instance, setting \w7 shows data in weekly bars, useful for smoothing out daily fluctuations for example, egraph mast \w7 \<font color="#67854e"> \i (intervals) \</font> sets the x axis distribution to age or days in milk, depending on the type of event selected \<font color="#67854e"> \d# (days back) \</font> selects a specific date range, where # is the number of days back from today for example, egraph bred \d90 limits the analysis to the last 90 days for a complete list of switches available for the egraph command, click the command? button to open the dairycomp switch manager docid\ i0uelt2iq6ihct6lh7 mc and select egraph from the list print you can print the contents of most pages by clicking the print button on the toolbar or selecting print from the file menu charts and graphs always print in graphic mode and in color if your printer supports it zoom in/out to zoom into a selected area on the graph, hold down the left mouse button and drag the box that displays from the upper left to the lower right of the area you wish to enhance you can restore a graph to its original view by clicking the undo zoom drag graphs and plots to shift the graph viewing area without zooming in, hold down the right mouse button and drag the cursor around you can restore a graph to its original view by clicking the undo zoom