massbays-tech / MassWateR

R package for working with Massachusetts surface water quality data
https://massbays-tech.github.io/MassWateR
Creative Commons Zero v1.0 Universal
11 stars 3 forks source link

tabMWRacc() issues #19

Closed ben-wetherill closed 2 years ago

ben-wetherill commented 2 years ago

Testing tabMWRacc(type = "individual"):

fawda123 commented 2 years ago

@ben-wetherill I think I've got these sorted out now (this commit https://github.com/massbays-tech/MassWateR/commit/8809a2385c3b9aa438a2444bc76ca106bbd65e05 and those referenced above). Can you please run your checks again to verify?

ben-wetherill commented 2 years ago

All examples are from new 6/9/22 results file.

From original list:

  1. Field Blank/Lab Blank Quantitation Limit issue still exists - The MDL column in tabMWRacc(type = "individual") should show the Quantitation Limit if the result value is BDL. If the result value is not BDL, the MDL column should show the DQO MDL (or Lab Blank value). Looking at your code, I think you have it backwards. See example Field Blank, CND-036, 6/13/21, BDL, 0.02. The MDL column currently shows 0.01, but we need to know that the detection limit was not 0.01 in this case.
  2. Good
  3. Good
  4. Good
  5. Good
  6. Good

New issues:

  1. If the Field Blank or Lab Blank threshold is not equal to the DQO MDL, then tabMWRacc(type = "individual") should show the actual threshold in the MDL column. For example Sp Conductance. I suggest we also change the name of this column to "Threshold" to avoid confusion with the MDL in the DQO file.
  2. Don't show results in scientific notation - See example tabMWRacc(type = "individual") Field Blank, CND-036, 6/15/21, 0.008.
  3. In tabMWRacc(accck="Field/Lab Duplicates", type="individual"), the unit of measure for pH values shows up as "NA". Can we make that blank?
  4. In tabMWRacc(type="individual") entries within parameter sections should be sorted by date. See example Lab Duplicate, TP, 8/14/21.
  5. If values are less than the detection limit, they should still show as entered. Example Lab Duplicate, TP, 8/14/21, should show 0.0085 and 0.0095.
  6. In the QC vignette issue list, we agreed to change the value for accchk-"Instrument Checks". But I also see that the header has been changed on tabMWRacc(accchk="Instrument Checks",type="individual"). I think we should keep that header as "Instrument Checks (post sampling)", because it is an important clarification for everybody.
  7. In tabMWRacc(accck="Lab Spikes", type="individual") can we show more decimal places if necessary? There may be times when users enter more decimal places, such as if they are using mg/L when the data is closer to ug/L. See example Lab Spike, Ortho P, 2/17/21, 0.046 and 0.054. Might need up to 4 decimal places.
fawda123 commented 2 years ago

@ben-wetherill thanks for the additional checks and issues. I think they're all addressed now, can you please verify when able? The new results file from 6/9/22 is also in the package.

ben-wetherill commented 2 years ago

In tabMWRacc(accck="Field Blanks", type="individual") there is still an issue with the value in the Threshold column. Example: E.coli, 9/13/21, ABT-162, 128, 50, threshold should show 10 because result value not BDL. Also, TP, 6/15/21, CND-036, 0.008, 0.001, threshold should show 0.01 because result value not BDL. Here is the logic for the threshold column:

DQO Thresh = DQO Field/Lab Blank if DQO Field/Lab Blank not BDL, else DQO MDL.
If result value is BDL, then...
        If Quantitation Limit not NA, then show Quantitation Limit
        Else show DQO Thresh.
Else show DQO Thresh.

And the logic for the Hit/Miss column:

If result value is BDL, then no MISS,
Else if result value < DQO Thresh, then no MISS,
Else, if result value = DQO Thresh AND DQO Field/Lab Blank uses <=, then no MISS,
Else MISS. 

From second list:

  1. Good
  2. Good
  3. Good
  4. Good
  5. Good
  6. Good
  7. Good

New issues:

  1. Field blank should be flagged as a miss if it is equal to MDL, because the DQO file says BDL. Example: tabMWRacc(accck="Field Blanks", type="individual") TP, 6/13/21, CND-009 0.01 should be a MISS.
  2. Field blank should not be flagged as a miss if it is less than DQO Threshold. See logic above. Example: tabMWRacc(accck="Field Blanks", type="individual") TP, 6/15/21, CND-036 0.008 should not be a MISS.
  3. In tabMWRacc(accck="Instrument Checks", type="individual"), the accuracy value for pH is not showing any decimals. It should show up to 2 decimals for pH, but for Sp Conductance, for example, decimals are not needed. Can you make the number of decimals float dependent on whether or not the difference requires them?
  4. The same issue as #3 for the Diff/RPD column in Lab/Field Duplicates. We do not want decimals for the %RPD, but the Diff values do need to float. Can you make them float up to a maximum of 3 decimals? Example: Lab Duplicate pH values and TP values less than 0.05.
fawda123 commented 2 years ago

@ben-wetherill all should be addressed now, hopefully I've got it sorted out! Please let me know if anything looks off.

ben-wetherill commented 2 years ago

The blanks threshold and hit/miss logic is working well.

From third list:

  1. Good
  2. Good
  3. pH decimals look good. I misled you by saying that decimals are not needed for Specific Conductance. Sometimes they might be. In the new results file, see example Calibration Check, Spec Conductance, 8/12/21, 986.2. Accuracy should be 13.8, not 14.
  4. Good
ben-wetherill commented 2 years ago

This looks good now.