7 rlcs Catch Sampling Business Rules
7.1 Introduction to business rules
The following are a list of business rules applying to the rlcs database. A business rule is a written statement specifying what the information system (i.e., any system that is designed to handle market sampling 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. Formula and Validation rules are implemented by referential constraints, range checks, and algorithms both in the database and during validation.
Validation rules may be part of the preloading checks on the data as opposed to constraints or checks imposed by the database. These rules sometimes state that a value should be within a certain range. All such rules containing the word ‘should’ are conducted by preloading software. The use of the word ‘should’ in relation to these validation checks means that a warning message is generated when a value falls outside this range and the data are then checked further in relation to this value.
6.2 Summary of rules
Sample details (t_sample)
| sample_no |
Sample number must be a unique. Sample numbers are in the following format: 3-digit incremental sample number; 2-digit year; and up to 5-character data source code. |
| date_s |
Must be a valid date. |
| species |
Must be either equal to “CRA”, “PHC”, or “RLM”. |
| area |
Must be a valid rock lobster statistical area code as listed in the area_codes table in the rdb table. |
| vessel_no |
Must be a number between 1 and 99999. |
| calipers |
Must be a number that equals 0.0, or should be within the reasonable range of 1.5 – 4.0 |
wind1_dir} wind2_dir} swell1_dir} swell2_dir} |
Must be equal to “VAR”, or one of the 16 valid wind direction based on the characters “N”, ”S”, ”E”, and “W”. |
beau1_scale} beau2_scale} |
Must be a valid beaufort scale code as listed in Appendix 2. |
swell1_code} swell2_code} |
Must be a valid swell height code as listed in Appendix 2.x |
| method |
Must be either a 1 or 2. |
| GPS |
Must be either a 0 or 1. |
| season |
Must be either a 0 or 1. |
| keepers |
Must be an integer greater or equal to 0.. |
kg_est} kg_act} |
Must be an integer 0 or greater and should be within the reasonable range of 0 - 2000 |
| sample_type |
Must be a valid sample type code as listed in the t_sample_types table. |
Pot details ( t_effort)
| sample_no |
Must be a valid sample number as listed in the t_sample table. |
| season |
Must be either a 0 or 1. |
| effort_no |
Must be an integer greater than zero and should be within the reasonable range of 1 - 250. |
| num_of effort |
Must be an integer greater than zero and should be within the reasonable range of 1 to 25. |
| pot_type |
Must be a valid pot type code as listed in Appendix 2. |
| es_gaps |
Must be either a 0 or 1. |
| depth |
Must be an integer and should be within the reasonable range of 1- 400. |
| soak |
Must be: an integer within the range 1 - 24; or an integer divisible by 24 up to 960; or equal to 999. |
| bait |
Must be a valid bait code listed in the t_bait_codes table and listed in Appendix 2. |
| caught |
Must be an integer equal or greater than zero and should be within the reasonable range of 0 - 500 |
| octopus |
Must be an integer within the range 0 - 9. |
| no_legal |
Must be an integer equal or greater than zero and should be within the reasonable range of 0 - 150 |
| legal_wt |
Must be a number equal or greater than zero and should be within the reasonable range of 0 - 70 |
| no_berried |
Must be an integer equal or greater than zero and should be within the reasonable range of 0 - 50 |
| caught_sp2 |
Must be an integer equal or greater than zero and should be within areasonable range of 0 - 12 |
| latitude |
Must be a valid latitude and should be within the reasonable range of 25 S –55 S |
| longitude |
Must be a valid longitude and should be within the reasonable range of.165E – 175 W |
| EorW |
Longitude east or west must be equal to either “E” or “W”. |
| sample_type |
Must be a valid data sample type code as listed in the t_sample_types table. |
Lobster details ( t_crayfish)
| sample_no |
Must be a valid sample number as listed in the t_sample table. |
| season |
Must be either a 0 or 1. |
| species |
Must be either equal to “CRA” or “PHC”. |
| effort_no |
Must be an integer greater than zero. |
| |
|
| |
Multiple column checks on sample number and effort number: |
| |
If effort number exists, the combination of sample number and effort number must exist in the t_effort table. |
| |
|
| sex |
Must be a valid sex code as listed in the t_sex_codes table and Appendix 2. |
| carapace |
Must be a integer greater than zero. |
| |
|
| |
Multiple column checks on carapace, sex and species: |
| |
Carapace length for each sex of the crayfish species should be within the reasonable range as listed below: |
| |
|
|
|
| |
Species |
Sex |
Carapace length |
| |
CRA |
Male |
35 - 235 |
| |
CRA |
Female |
30 - 195 |
| |
PHC |
Male |
80 - 245 |
| |
PHC |
Female |
85 - 225 |
| tail_width |
Must be a integer greater than zero. |
| |
|
| |
Multiple column checks on tail width, sex and species: |
| |
Tail width for each sex of reasonable range as listed below: |
| |
| |
Species |
Sex |
Tail width |
| |
CRA |
Male |
22 - 130 |
| |
CRA |
Female |
60 - 125 |
| |
PHC |
Male |
44 - 105 |
| |
PHC |
Female |
65 - 135 |
| |
|
| twf1 |
Must be a integer greater than zero and should be within the reasonable range 30 - 100 |
| injury |
Must be a valid injury code as listed in Appendix 2. |
| moult |
Must be equal to 0, 1 or 5. |
| resident |
Must be either a 0 or 1. |
| status |
Must be either a 0 or 1. |
| sample_type |
Must be a valid sample type code as listed in the t_sample_types table. |
Bait details (t_bait_codes)
| bait_code |
Must contain an unique code. |
| description |
Must contain a value. |
Sex details (t_sex_codes)
| sex |
Must be a number between zero and nine. |
| descrptn |
Must contain a value. |
Sample type details (t_sample_types)
| sample_type |
Must contain an unique code. |
| description |
Must contain a value. |
Lobster vessel details (t_lob_vessel)
| vessel_no |
Must be a number between 1 and 99999 |
| status |
Must be a “C”, “P” or “N” |