Analyticsphere / qaqc_testing

working with qaqc
0 stars 0 forks source link

New Rule for QC: Time #91

Closed KELSEYDOWLING7 closed 9 months ago

KELSEYDOWLING7 commented 11 months ago

We have some variables that look at a time input, ex: what time did you go to bed last night, and the responses have a HH:MM structure for military time.

These variables happen to all be NA or CrossValid1 questions, and would need to keep that QC type structure but the valid values allow to be (00-23) : (00:59). I think it would be most helpful for this to be a separate rule type built off of the current NA or Crossvalid1 rule if possible.

These variables have this question type in Module 2: o D_214870856 o D_195662769 o D_698673038 o D_823919522

 D_636757313  D_580367946

There are some in the Blood Urine Mouthwash Survey, but we don't have QC for that survey right now. This will just be a rule type added to this survey in the IMS rules once we set it up on our end.

jacobmpeters commented 11 months ago

Thanks, Kelsey. I'll plan to review this on Monday and decide what to name the new rule and think about how feasible this is as a new rule

KELSEYDOWLING7 commented 10 months ago

@jacobmpeters Good morning, did you ever get a chance to think about this QC change? IMS circled back with QC follow up questions/next steps before they make the necessary changes. If possible I would like to add this new rule type in my response for them to update all modules accordingly

jacobmpeters commented 10 months ago

Hi Kelsey, I haven't had a chance to address this yet but I have some thoughts.

I can use a regular expression.. something like:

check_time_format <- function(time_string) {
  time_pattern <- "^(?:[01]\\d|2[0-3]):([0-5]\\d)$"

  if (grepl(time_pattern, time_string)) {
    return(TRUE)
  } else {
    return(FALSE)
  }
}

I can do "is 24hr time" and "crossValid1 or is 24hr time" and "NA or crossValid1 is 24hr time"

KELSEYDOWLING7 commented 10 months ago

@jacobmpeters Awesome! Do you want me to add a separate tab in the current csv table for these rules to try those out?

jacobmpeters commented 10 months ago

Sure! That would be helpful.

KELSEYDOWLING7 commented 10 months ago

@jacobmpeters Ok just added an additional tab here: https://nih.app.box.com/file/1341953223687 We would need this rule type to also be "NA or is 24hr time". Let me know if you need me to change anything.

jacobmpeters commented 10 months ago

@KELSEYDOWLING7 I added the added "is 24hr time" Qctype family and tested your rules (from above). No issues were flagged. Were you expecting any?

Here are the new rules that are available: "is 24hr time", "NA or is 24hr time", "crossValid1 or is 24hr time", "NA or CrossValid1 is 24hr time"

KELSEYDOWLING7 commented 10 months ago

@jacobmpeters No, I didn't expect any. Moreso wanted to make sure they wouldn't break the code. I'll have IMS implement these rules. The valid values column is correct in being left blank, right?

jacobmpeters commented 10 months ago

@KELSEYDOWLING7 Correct. The valid values column should be blank.

KELSEYDOWLING7 commented 10 months ago

@jacobmpeters Perfect thanks, I just notified IMS to update their rules accordingly