Loadcoll.asp process description

Executed from the staging database web page, the script 'loadcoll.asp' distributes sample collecting event information into the appropriate tables of the samples database (see Database design). The action is executed by the button "Load database" at the bottom of the page. At this time, it is restricted to the Sample Coordinator and several members of the Information Applications group.

Information common to all the samples is typed into the form fields at the top of the page (eg., Chief Scientist, Collector, ShipName, ROVName, DiveNumber). Some of this data is used to populate a new record that is created in the database's CollectionGroup table (StartDTG, Chief Scientist, ShipName, and ROVName); some is used in the subsequently created records in the CollectionEvent and Sample tables (ChiefScientist, Collector, DiveName).

Information specific to individual samples is loaded into new records in the CollectionEvent and Sample tables, but only for the samples that are checked on the staging database web page, recognizing that not all samples that were annotated successfully made it to the surface and therefore won't be tracked further. Most of the information for a particular sample is inserted as a record in the CollectionEvent table (eg., Date/Time, FrameGrabImageURL, Equipment, CollectionVIMSConcept, CollectionRefName, DiveName). A record is also created in the Sample table (populated with CollectionEventID, SampleRefName, Collector). Database fields that are not populated from this process are left blank or given default values.

Here is a structure chart of the loadcoll.asp process:

loadcoll_sm.gif (12404 bytes)

The first thing main() does is check if the IP address of the machine running the script is allowed to run it; if it's not then it redirects the user to the deny.html file. The top part of the staging database form is used to create a CollectionGroup record. CheckIfInExpd() first checks that there isn't already an existing record with the same keys. 

Routines in loadcoll.asp (brief description; see the source code for full details).

ParseSample() 
Function to parse up pipe separated and return a Dictionary (VBscript equivalent of a Perl associative array) of its values. s is the sample string sent by the web form, n is ordinal number of the sample that corresponds to it.
 
CheckString()
Puts single quotes around string items that get loaded in.
 
CheckIfInDB() 
Function to check if sample has already been loaded into the database's CollectionEvent table.
 
CheckIfInExpd()
Function to check if CollectionGroup has already been loaded into the database's CollectionGroup table.
 
CheckValues() 
Function to check values of sample for non-null values.
 
LoadIntoDB() 
Function to step through the Dictionary and load its values into the columns indicated by its keys.
 
LoadCollectionGroup() 
The first load done by loadcoll.asp. Called before samples are loaded. Return CollectionGroupID so this can be included in the CollectionEvent load.
 
GetROVCTDrecord()
Not used. ROVCTD data are added with another process.
 
Main() 
Main body of this script. It is where each sample record is read from the CGI form, a dictionary is created and the check if in data base and load steps are done by calling the above routines. It also returns something intelligent to the web browser.

»Next: Samples database

Last updated: 12 May, 2000 by Jenny Paduan
Copyright © 1998 MBARI