6 plankton Business Rules

6.1 Introduction to business rules

The following are a list of business rules pertaining to the age database. A business rule is a written statement specifying what the information system (i.e., any system that is designed to handle plankton data) must do or how it must be structured.

There are three recognised types of business rules:

  • Fact Certainty or an existence in the information system

  • Formula Calculation employed in the information system

  • Validation Constraint on a value in the information system

Fact rules are shown on the ERD by the cardinality (e.g., one-to-many) of table relationships. Referential constraints, range checks, and algorithms both in the database and during data validation implement the formula and validation type rules.


6.2 Summary of rules

Trip details (t_trip)

trip_code

Trip code, must be unique. Trip codes are in the following format: 3 character vessel code (see the vessels table in the rdb database for available codes), 2 digit year (e.g., 99 = 1999, 00 = 2000), 2 digit sequential trip number for each vessel each year.

project_code

Project code must be a valid code within the NIWA project management system (unknown project code = "NULL00").

date_s

The start date of the trip must be a legitimate date.

date_f

The finish date of the trip must be a legitimate date.


Multiple column check on trip dates

The finish date must be later than or equal to the start date.

Areas

Each of the listed area codes must be a valid area code as listed in the area_codes table in the rdb table.

Mainspp

Each of the listed species codes must be a valid species code as listed in the curr_spp table in the rdb database.

Gear1 - gear4

Gear descriptions. The following describe the format, and where applicable, the business rules for the description of gear used during a trip:


gear number

Must be a unique, sequential number from 1 to 6 to identify each gear.


Gear method

Must be a valid code as listed in the meth_codes table in the rdb database.


Codend mesh

Null, or a number greater than 0.


liner mesh

Null, or a number greater than 0.


cover mesh

Null, or a number greater than 0.


ground rope

length Null, or a number greater than 0.


ground rope height

Null, or a number greater than 0.


sweep length

Null, or a number greater than 0.


bridle length

Null, or a number greater than 0.


default headline height

Null, or a number greater than 0.


headline height code

If the default headline height is not null, then must be a valid code as listed in the t_headline_codes table in the rdb database


default wing distance

Null, or a number greater than 0.


wing distance code

If the default wing distance is not null, then must be a valid code as listed in the t_wing_dist_codes table in the rdb database


default door distance

Null, or a number greater than 0.


door distance code

If the default door distance is not null, then must be a valid code as listed in the t_door_dist_codes table in the rdb database





Trip comments (t_trip_comm)

trip_code

Must be equal to a trip code as listed in the t_trip table.



Stratum details (t_stratum)

trip_code

Must be equal to a trip code as listed in the t_trip table.

area_km2

Must be a number greater than 0.


Station details (t_station)

trip_code

Must be equal to a trip code as listed in the t_trip table.

station_no

Must be a unique number within a single trip.

area

Area code must be a valid code as listed in the area_codes table in the rdb database.

course

Course must be within the range of 0 - 359 degrees.

date_shot

The date at the shooting of the gear at a station must be a legitimate date.


Multiple column checks on shot date:

The date must fall within the range of the range of the trip start and finish dates.

time_shot

Shot time of the station must be a valid 24-hour time and fall within the range of 0 - 2359 hours.

fix_shot }

fix_s }

fix_f }

The method of position fix code must be valid code as listed in the t_fix_meth_codes table in the rdb database. Also listed in Appendix 1.

lat_shot

Must be a valid latitude NorS_shot Northern or Southern Hemisphere at the shooting of the gear, must be equal to either "N" or 's".

long_shot

Must be a valid longitude.

eorw_shot

Longitude east or west at the shooting of the gear, must be equal to either "E" or "W".

bot_vshot

Must be an integer greater than 0.

date_s

The date at the start of a station must be a legitimate date.


Multiple column checks on start date:

The date must fall within the range of the range of the trip start and finish dates.

time_s

Start time of the station must be a valid 24-hour time and fall within the range of 0 - 2359 hours.


Multiple column checks on shot date, time and start date, time:

Start date and time must be equal to or not longer than 2 hour after shot date and time.

lat_s

Must be a valid latitude

nors_s

Northern or Southern Hemisphere at station start, must be equal to either "N" or 's".

long_s

Must be a valid longitude.

eorw_s

Longitude east or west at station start, must be equal to either "E" or "W".

gear_s

Depth of gear. Must be an integer greater than 0.

bot_gs

Depth of sea bottom at the gear's position must be an integer greater than 0, and must not be less than depth of gear bot_vs Depth of sea bottom at the vessel's position must be an integer greater than 0.

date_f

The date at the finish of a station must be a legitimate date.


Multiple column checks on finish date:

The date must fall within the range of the range of the trip start and finish dates.

time_f

Finish time of the station must be a valid 24-hour time and fall within the range of 0 - 2359.


Multiple columns checks on date and time:

The start date and time must not be later than the finish date and time, and within a reasonable time period for the type of gear deployed during the station.

lat_f

Must be a valid latitude

nors_f

Northern or Southern Hemisphere at station finish, must be equal to either "N" or 's".

long_f

Must be a valid longitude.

eorw_f

Longitude east or west at station finish, must be equal to either "E" or "W".


Multiple columns checks on position:

The finish position should be within a reasonable distance from the start position for the type of gear deployed during the station.

gear_f

Depth of gear. Must be an integer greater than 0.

bot_gf

Depth of sea bottom at the gear's position must be an integer greater than 0, and must not be less than depth of gear bot_vf Depth of sea bottom at the vessel's position must be an integer greater than 0.

min_gdepth

Minimum gear depth must be less than or equal to the depth of gear at the start and finish of the station.

max_gdepth

Maximum gear depth must be greater than or equal to the minimum gear depth and the depth of gear at the start and finish of the station

gear_meth

Gear method code must be a valid code as listed in the meth_codes table in the rdb database.

gear_code

Must within the range 1 - 4 to relate to gear details in gear1 to gear4 respectively in the t_trip table.

gear_perf

The gear performance code must be valid code as listed in Appendix 1.

speed

The vessel's recorded speed during the station should be within the range 0 - 5 knots and be reasonable for the gear method.

distance

The distance travelled during the station should be reasonable for the gear method. start and finish positionsand speed and start/finish times: The distance travelled during a station as calculated by (1) the difference between start and finish positions(2) speed * elapsed time and (3) recorded distance should be in approximate agreement.

wind_dir

Wind direction must fall within the range of 0-359, 999.

wind_force

Wind force must fall within the range of 0 - 12.

air_temp

Air temperature should fall within the reasonable range of 5 - 30.

air_press

Air pressure should fall within the reasonable range of 960 to 1040.

cloud_cov

Cloud cover must fall within the range of 0-8.

sea_cond

The sea condition code must be valid code as listed in Appendix 1.

sea_col

The sea colour code must be valid code as listed in Appendix 1.

swell_ht

The swell height code must be valid code as listed in Appendix 1.

swell_dir

Wind direction must fall within the range of 0-359, 999.

bot_type

The bottom type code must be valid code as listed in Appendix 1.

bot_cont

The bottom contour code must be valid code as listed in Appendix 1.

surf_temp

Sea surface temperature should fall within the reasonable range of 5 - 28.

bot_temp

Sea bottom temperature should fall within the reasonable range of 3 - 25.

wind_spd

Wind speed should fall within the reasonable range of 0 - 30.

secchi

Secchi disc distance should fall within the reasonable range of 0 - 40.

other

Data recorded in the attribute other should be accompanied by a matching record in the t_stat_comm table.





Station comments (t_stat_comm)

trip_code

Must be equal to a trip code as listed in the t_trip table.

station_no

Must be a unique number within a single trip.


Multiple columns check on trip code and station number:

The combination of trip code and station number must exist in the t_station table.



Wire Angles (t_wire_angle)

trip_code

Must be equal to a trip code as listed in the t_trip table.

station_no

Must be a unique number within a single trip.


Multiple columns check on trip code and station number:

The combination of trip code and station number must exist in the t_station table.

wire_out

Wire out should be within the reasonable range of 0 to 2000


Multiple columns check on trip code, station number, and wire out:

The combination of trip code, station number, and wire out must be unique.

wire_angle

Wire angle must be within the range 0 to 90.


Multiple gear units (t_gear_unit)

trip_code

Must be equal to a trip code as listed in the t_trip table.

station_no

Must be a unique number within a single trip.

gear_code

Gear code must contain a value


Multiple columns check on trip code, station number, and gear code:

The combination of trip code, station number, and gear code must be unique and exist in the t_station table.

mesh_size

Mesh size should be within the reasonable range of 0.1 to 9.9.

no_bottles

The number of bottles should be within the reasonable range 0 to 15.

warp_lgth

Warp length should be within the reasonable range of 0 to 2000.



Fish egg abundances (t_eggs)

trip_code

Must be equal to a trip code as listed in the t_trip table.

station_no

Must be a unique number within a single trip.


Multiple columns check on trip code and station number:

The combination of trip code and station number must exist in the t_station table.

Species

Must be a valid species code as listed in the curr_spp tables in the rdb database.

samp_no

Sample number must be an integer greater than 0.

percent_samp

Percentage sampled must be an integer between the ranges of 1 - 100

stage

Must be a valid egg stage for the species as listed in Appendix 1

no_a

Must be an integer greater than 0.


Plankton abundances (t_abund)

trip_code

Must be equal to a trip code as listed in the t_trip table.

station_no

Must be a unique number within a single trip.


Multiple columns check on trip code and station number:

The combination of trip code and station number must exist in the t_station table.

species

Must be a valid species code as listed in the curr_spp tables in the rdb database.

samp_no

Sample number must be an integer greater than 0.

no_a

Must be an integer greater than 0.


Updated : 16 November 2007