This section describes programs and functions available for general use. These functions are in addition to those supplied as part of the PostgreSQL system. Typically, one would use one of these programs as part of a special process not part of the regular Babase system. One would use one of these functions in a SQL - SELECT statement, a query, a report, or perhaps in a special purpose program, or a new Babase system program you might want to write. For more detailed information on the operation of these programs and functions see the documentation written into the program header of the program source code.
Documentation on the use of these programs can be found in the Protocol for Data Management: Amboseli Baboon Project and in this document. This document also contains the coding standards and design philosophy of the system, which should be followed by anyone modifying or adding programs to this directory.
There are a large number of procedures and functions
which are part of Babase but are not listed in the tables below.
The “unlisted” functions either begin with the
underscore (_
) character, or end in
“_func”.[308]
Only those functions in the table below are expected to be used by the typical end-user.
Table 8.1. The Babase SQL Functions
Name | Description |
---|---|
convert a date value to the first day of the month |
|
return a remainder from a timestamp |
|
convert time to seconds past midnight |
|
convert from seconds past midnight to a time |
|
convert a date or timestamp to a julian date |
|
convert a julian date to a regular date |
|
compute the hydrological year a given date falls within |
|
compute the season a given date falls within |
|
produce a PostGIS geometry point in the WGS 1984 UTM Zone 37South coordinate system from X and Y coordinates |
|
produce a PostGIS geometry point in the WGS 1984 UTM Zone 37South coordinate system from longitude and latitude coordinates |
|
Convert a "raw" hormone concentration into a corrected concentration, using the provided mathematical expression. |
The logout program logs the user out of the Babase web based collection of programs.
Babase consists of many programs, only some of which are web based programs written specifically for Babase. The logout program only controls access to those programs written specifically for Babase, other “off the shelf” programs have their own logout mechanisms.
Logout from Babase is automatic after a period of inactivity.[310]
The wwwdiff program compares two text files. It can be found on the Babase Web site.
Among other uses, this program provides a useful data validation mechanism. To validate data, have two different individuals enter the data and compare the results with the wwwdiff program. It is unlikely that both individuals will make identical errors and so almost all data transcription errors should be caught using this method.
The program uploads the two files to be compared. For security reasons most web browsers will always clear the names of the uploaded files once they have been uploaded. This makes it difficult to repeatedly upload the same or similar files, as when re-comparing two files after correcting errors. The situation is not as bad as it might sound because browsers will often provide a “browse” button and keep track of the directory last accessed, removing the need to re-navigate to the location of the data files. But it is still awkward to have to repeatedly point and click.
One solution is to use the browser's “reload” button. This will repeat the upload and comparison of the two files, but using the new, corrected, file content. A second, less desirable possibility is to have the have the pathnames of the files handy in a text document and cut and paste them as needed. A third possibility might be to use the browser's “back” button, but browsers will often clear the file upload information in this case in the same fashion they would with password information.
The wwwdiff program provides 5 comparison methods:
Like Tabular by Word, below, but identical lines are not displayed.
Useful where the data consists of individual words aligned as rows and columns of data. Compares the files contents on a word-by-word basis and displays the entire content of both files as a table with differences marked.
When one file contains whitespace[311] that is not in the other, this comparison method shows extra cells in the output. Words are separated by whitespace but because there is only extra whitespace the cells are empty. Thus, when one file contains more whitespace than the other those rows will contain more columns. Normally the data in the extra cells would be color coded to inform as to whence they came, but because the cells are empty there is nothing to color code. The operator must compare the files by hand to determine which file contains the extra whitespace.
Useful where the data consists of words and there are relatively few changes or where paragraphs have been refilled and words have moved from line to line. Compares the file contents on a word-by-word basis displaying the entire content of both files as plain text.
Useful when there is a large amount of textual data. Compares the file contents on a line-by-line basis and displays only a small amount of context surrounding those portions of the text which differ between the files.
Useful when comparing non-text files. Reports the location (by line and byte offset from the beginning of the files) of the first difference found.
When comparing using any of the “by word” methods the reported line number increases by one when either: File A or File B contains an entirely new line not in the other file, or when a line in one file differs in every word from the same line in the other file. This throws the line numbering off relative to one or both of the original files.
These procedures provide a mechanism for manually updating the analyzed data which Babase maintains. They are expected to be of use only to the data managers.
As a rule the analyzed data are kept up-to-date automatically by Babase (the exceptions are the CYCSTATS and the REPSTATS tables, and the MEMBERS.Supergroup and residency columns on MEMBERS), but at times it may be necessary to reconstruct the analyzed data. One such occasion would be the discovery of a bug in the Babase code which keeps the analyzed data up-to-date.
The procedures tend to come in pairs, one of which updates an entire table and the other of which updates only the data related to a specific Sname.
Table 8.2. Data Analysis Procedures
Name | Description |
---|---|
rebuild the automatic Mdates for an individual |
|
rebuild the automatic Mdates of all individuals |
|
rebuild the table for an individual |
|
rebuild the entire table |
|
rebuild the table for an individual |
|
rebuild the entire table |
|
rebuild the table for an individual |
|
rebuild the entire table |
|
re-interpolate the MEMBERS table for an individual, re-construct the Supergroup and Delayed_Supergroup columns, and re-analyze the residency information for the individual's MEMBERS rows |
|
re-interpolate the MEMBERS table for all individuals, re-construct the Supergroup and Delayed_Supergroup columns, and re-analyze the residency information for all individuals' MEMBERS rows |
|
for all individuals with any rows that haven't had their supergroups constructed or residency analyzed, re-interpolate all their MEMBERS rows, re-construct all their Supergroup and Delayed_Supergroup columns, and re-analyze the residency information for all their MEMBERS rows |
|
rebuild the table for an individual |
|
rebuild the entire table |
|
rebuild the table for an individual |
|
rebuild the entire table |
|
rebuild the calculated columns in RANKS for all rows with a specific Grp, Rnkdate, and Rnktype |
|
rebuild the calculated columns in RANKS for all rows with a specific Grp and Rnktype |
|
rebuild the calculated columns in the entire table |
|
rebuild the table for an individual |
|
rebuild the entire table |
|
rebuild the residency related columns of the MEMBERS table and repopulate the RESIDENCIES table for an individual |
|
rebuild the residency related columns of the MEMBERS table and repopulate the entire RESIDENCIES table for all individuals |
|
rebuild the residency-related columns of the MEMBERS table and repopulate the entire RESIDENCIES table, but only for the individuals with MEMBERS rows that haven't already been analyzed |
|
rebuild the table for an individual |
|
rebuild the entire table |
|
rebuild the Supergroup and Delayed_Supergroup columns of the MEMBERS table for an individual |
|
rebuild the Supergroup and Delayed_Supergroup columns of the entire MEMBERS table |
|
rebuild the Supergroup and Delayed_Supergroup columns of the entire MEMBERS table for all individuals who have any rows that have not had their Supergroup or Delayed_Supergroup built |
|
Rapidly delete old style CENSUS rows |