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

QC Summaries should show rows for every parameter #21

Closed ben-wetherill closed 2 years ago

ben-wetherill commented 2 years ago

tabMWRfre(resdat,dqofrecomdat,type = "summary") and tabMWRacc(resdat,dqoaccdat,type = "summary",frecom = dqofrecomdat) should show a row for each relevant parameter, regardless of whether they have QC data or not. This is not currently happening for tabMWRacc. I think it is correct for tabMWRfre.

Relevant parameters are all parameters that are in the dqofrecom file and also have Sample-Routine or Field Msr/Obs activity.

tabMWRcom(resdat,dqofrecomdat), tabMWRfre(resdat,dqofrecomdat,type = "percent"), and tabMWRacc(resdat,dqoaccdat,type = "percent") should show a row for each relevant parameter. I think this is currently correct.

ben-wetherill commented 2 years ago

I edited the logic above.

ben-wetherill commented 2 years ago

I think currently only an issue for tabMWRacc().

fawda123 commented 2 years ago

@ben-wetherill I think it's fixed now for the tabMWRacc output if type = "summary", check out the updated vignette: https://massbays-tech.github.io/MassWateR/articles/qcoverview.html#quality-control-for-accuracy

And just to verify, the logic uses the parameters from the DQO file for frequency and completeness even for the accuracy tables, correct?

ben-wetherill commented 2 years ago

Yes, the DQOfrecom file should be used to define parameters for all tables, including accuracy. Since the DQOfrecom file has only one row per parameter, this is easier than using the DQOacc file, and it keeps all tables aligned.

The logic isn't quite working yet. All parameters are now showing, but there are three issues:

  1. Can you not show parameters that don't have data in the results file? Relevant parameters are all parameters that are in the dqofrecom file AND ALSO have Sample-Routine or Field Msr/Obs activity. For example, in my results data chloride should not show.
  2. In tabMWRacc(type = "summary"), the Lab Spikes should only show Lab parameters and Instrument Checks should only show InSitu parameters. They are showing all now.
  3. It looks like tabMWRacc(type = "percent") is also not showing all relevant parameters. I guess I didn't notice that before. In my results data it is not showing TSS and Chl-a.
fawda123 commented 2 years ago

@ben-wetherill It should be corrected now, please havea look when able.

ben-wetherill commented 2 years ago

These all look good now.

There is one final scenario. What if a parameter is in the results and in dqofrecom but not listed in dqoacc? In this case, it shows up in tabMWRacc(type="summary") with a 0 in the Number of QC checks row. This isn't quite correct if there were QC checks in the data, but I'm thinking it is acceptable since the QC checks can't be evaluated without the dqoacc file. The user would see the 0 and fix the dqoacc file. I think this is fine.