Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions legacy/chemistry_structure.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
@legacy-db @chemistry_domain @business-rules
Feature: Chemistry sampling events provide the organizing context for field and laboratory results
Chemistry data is organized around a sampling event.
Each sampling event represents one collection occurrence and provides the context needed
to interpret field measurements and laboratory analytical results.

Background:
Given a sampling location exists

# ---------------------------------------------------------------------------
# 1) Sampling event meaning (Chemistry SampleInfo)
# ---------------------------------------------------------------------------

@business-meaning
Scenario: A sampling event is the authoritative parent record for chemistry results
When a chemistry sampling event is recorded
Then the event is assigned a system identifier used to link chemistry results
And the event is assigned a required tracking identifier used by people to reference the sample
And the event captures sampling context such as methods and tracking information

@data-quality
Scenario: A sampling event must include basic classification information
When a chemistry sampling event is recorded without a sample type
Then the sampling event is not considered valid for downstream use
When a chemistry sampling event is recorded without a collection method
Then the sampling event is not considered valid for downstream use

@identity
Scenario: The sample tracking identifier uniquely identifies a sampling event
When a chemistry sampling event is recorded with tracking identifier "SAMP000001"
Then the sampling event is accepted
When another chemistry sampling event is recorded with tracking identifier "SAMP000001"
Then the sampling event is not accepted because the tracking identifier must be unique

@legacy-behavior
Scenario: Legacy sampling events may exist without a location link
When a chemistry sampling event is recorded without a location link
Then the event is stored
And the event is treated as incomplete for location-based reporting

# ---------------------------------------------------------------------------
# 2) Laboratory & Field Results
# ---------------------------------------------------------------------------

@business-meaning @relationships
Scenario Outline: All analytical results must be attributable to a specific sampling event
Given a chemistry sampling event exists
When <result_type> results are recorded for the event
Then the results are linked to that specific sampling event
And multiple <result_type> records may exist for the same event

Examples:
| result_type |
| Field Parameter |
| Major Ion Chemistry |
| Minor, Trace, Isotope, and Age-Related |
| Radionuclide |

@data-quality @integrity
Scenario Outline: Analytical results cannot exist without a parent sampling event
When <result_type> results are submitted without a reference to a sampling event
Then the system prevents the results from being stored
And orphaned analytical data is not retained

Examples:
| result_type |
| Field Parameter |
| Major Ion Chemistry |
| Minor, Trace, Isotope, and Age-Related |
| Radionuclide |

# ---------------------------------------------------------------------------
# 3) Interpreting repeated measurements (legacy looseness / real-world workflows)
# ---------------------------------------------------------------------------

@legacy-behavior
Scenario Outline: Repeated measurements may exist for the same sample and measurement type
Given a chemistry sampling event exists
When a "<result_type>" result is recorded for "<measurement_identifier>"
And another "<result_type>" result is recorded for the same "<measurement_identifier>" under the same event
Then both results are retained
And consumers treat them as multiple measurements (e.g., repeats, reruns, corrections, or parallel reporting)

Examples:
| result_type | measurement_identifier |
| Major Ion Chemistry | Calcium |
| Minor, Trace, Isotope, and Age-Related | Arsenic |
| Field Parameter | Temperature |
| Radionuclide | Uranium |

# ---------------------------------------------------------------------------
# 4) Data stewardship expectations for removals (danger zone)
# ---------------------------------------------------------------------------

@stewardship @danger_zone
Scenario: Removing a sampling event removes associated results to avoid stranded data
Given a chemistry sampling event exists
And analytical results exist under that event
When the sampling event is removed
Then associated field and laboratory results are also removed
And the system does not retain unattached result records

@stewardship @danger_zone
Scenario: Removing a location can remove all chemistry collected at that location
Given a location exists with one or more chemistry sampling events
And analytical results exist under those sampling events
When the location is removed
Then the sampling events and their associated results are also removed
And this behavior is treated as a high-impact data stewardship operation

# ---------------------------------------------------------------------------
# 5) Retrieval expectations (how the data is consumed)
# ---------------------------------------------------------------------------

@reporting
Scenario: A complete chemistry record can be assembled for a sampling event
Given a chemistry sampling event exists
And any combination of field and laboratory results exist for the event
When a user requests chemistry data for the sampling event
Then the response includes the sampling event context
And includes all available field measurements recorded under the event
And includes all available laboratory results recorded under the event

@reporting
Scenario: Chemistry data can be retrieved for a location across sampling events
Given a location has multiple chemistry sampling events
When a user requests chemistry data for the location
Then the response includes all sampling events linked to that location
And each sampling event includes its associated field and laboratory results
128 changes: 128 additions & 0 deletions legacy/field_public_release.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
@legacy-db @field_PublicRelease @cross_functional
Feature: PublicRelease global field behavior
The PublicRelease bit field exists across multiple legacy tables.
Data type is consistent (BIT), but constraints (nullability, defaults) vary by table.

Background:
Given the target field is "PublicRelease"

# ---------------------------------------------------------------------------
# 1. CORE DATA TYPE CHECK (Applies to ALL tables)
# ---------------------------------------------------------------------------

@schema @storage
Scenario Outline: All tables accept valid bit values (0 and 1)
Given I am targeting the "<table>" table
When I insert a record with PublicRelease set to <input_value>
Then the record is accepted
And the stored value is <input_value>

Examples:
| table | input_value |
| Location | 0 |
| Location | 1 |
| WaterLevels | 0 |
| WaterLevels | 1 |
| WaterLevelsContinuous_Acoustic | 0 |
| WaterLevelsContinuous_Acoustic | 1 |
| ChemistrySampleInfo | 0 |
| ChemistrySampleInfo | 1 |

# ---------------------------------------------------------------------------
# 2. NULLABILITY CHECK (Varies by table)
# - Strict: NOT NULL (Location)
# - Hybrid: NULL allowed (WaterLevels, WaterLevelsContinuous_Acoustic)
# - Loose: NULL allowed (ChemistrySampleInfo)
# ---------------------------------------------------------------------------

@schema @storage @edge_case
Scenario Outline: Verify NULL acceptance policy per table
Given I am targeting the "<table>" table
When I attempt to insert a record with PublicRelease set to NULL
Then the system should <outcome> the record

Examples: Strict constraints (NOT NULL)
| table | outcome |
| Location | reject |

Examples: Hybrid constraints (NULL allowed, default exists)
| table | outcome |
| WaterLevels | accept |
| WaterLevelsContinuous_Acoustic | accept |

Examples: Loose constraints (NULL allowed, no default)
| table | outcome |
| ChemistrySampleInfo | accept |

# ---------------------------------------------------------------------------
# 3. DEFAULT VALUE CHECK (Varies by table)
# - Default 0: Location, WaterLevels, WaterLevelsContinuous_Acoustic
# - No default: ChemistrySampleInfo (remains NULL)
# ---------------------------------------------------------------------------

@schema @storage @defaults
Scenario Outline: Verify default value when field is omitted
Given I am targeting the "<table>" table
When I insert a record without specifying PublicRelease
Then the record is accepted
And the PublicRelease field should be set to <expected_default>

Examples: Tables with default ((0))
| table | expected_default |
| Location | 0 |
| WaterLevels | 0 |
| WaterLevelsContinuous_Acoustic | 0 |

Examples: Tables with no default (NULL)
| table | expected_default |
| ChemistrySampleInfo | NULL |

# ---------------------------------------------------------------------------
# 4. BUSINESS LOGIC (Public visibility by data type)
# PublicRelease indicates whether the data from the table is visible to the public.
# ---------------------------------------------------------------------------

@business @public @reports @webmaps
Scenario Outline: PublicRelease = 1 makes data visible to the public
Given I am targeting the "<table>" table
And I have a record with PublicRelease set to 1
When a public user views the <data_description> in public reports
Then the <data_description> is visible
When a public user views the <data_description> in public web maps
Then the <data_description> is visible

Examples:
| table | data_description |
| Location | location information |
| WaterLevels | water level measurement information |
| WaterLevelsContinuous_Acoustic | water level measurement information |
| ChemistrySampleInfo | chemistry data |

@business @public @reports @webmaps
Scenario Outline: PublicRelease = 0 makes data not visible to the public
Given I am targeting the "<table>" table
And I have a record with PublicRelease set to 0
When a public user views the <data_description> in public reports
Then the <data_description> is not visible
When a public user views the <data_description> in public web maps
Then the <data_description> is not visible

Examples:
| table | data_description |
| Location | location information |
| WaterLevels | water level measurement information |
| WaterLevelsContinuous_Acoustic | water level measurement information |
| ChemistrySampleInfo | chemistry data |

@business @public @reports @webmaps @edge_case
Scenario Outline: PublicRelease = NULL makes data not visible to the public
Given I am targeting the "<table>" table
And I have a record with PublicRelease set to NULL
When a public user views the <data_description> in public reports
Then the <data_description> is not visible
When a public user views the <data_description> in public web maps
Then the <data_description> is not visible

Examples:
| table | data_description |
| ChemistrySampleInfo | chemistry data |