diff --git a/legacy/chemistry_structure.feature b/legacy/chemistry_structure.feature new file mode 100644 index 0000000..5563efd --- /dev/null +++ b/legacy/chemistry_structure.feature @@ -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 results are recorded for the event + Then the results are linked to that specific sampling event + And multiple 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 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 is recorded for "" + And another "" result is recorded for the same "" 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 diff --git a/legacy/field_public_release.feature b/legacy/field_public_release.feature new file mode 100644 index 0000000..7731c1e --- /dev/null +++ b/legacy/field_public_release.feature @@ -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 + When I insert a record with PublicRelease set to + Then the record is accepted + And the stored value is + + 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 + When I attempt to insert a record with PublicRelease set to NULL + Then the system should 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 + When I insert a record without specifying PublicRelease + Then the record is accepted + And the PublicRelease field should be set to + + 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 + And I have a record with PublicRelease set to 1 + When a public user views the in public reports + Then the is visible + When a public user views the in public web maps + Then the 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 + And I have a record with PublicRelease set to 0 + When a public user views the in public reports + Then the is not visible + When a public user views the in public web maps + Then the 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 + And I have a record with PublicRelease set to NULL + When a public user views the in public reports + Then the is not visible + When a public user views the in public web maps + Then the is not visible + + Examples: + | table | data_description | + | ChemistrySampleInfo | chemistry data |