Skip to contents

Verify if a Dataset Has the Required Format as Queries Dataset.

Usage

assert_valid_queries(queries, queries_name)

Arguments

queries

A data.frame.

queries_name

Name of the queries dataset, a string.

Value

The function throws an error if any of the requirements not met.

Details

Check if the dataset has the following columns

  • VAR_PREFIX, e.g., SMQ01, CQ12

  • QUERY_NAME, non NA, must be unique per each VAR_PREFIX

  • QUERY_ID, could be NA, must be unique per each VAR_PREFIX

  • QUERY_SCOPE, 'BROAD', 'NARROW', or NA

  • QUERY_SCOPE_NUM, 1, 2, or NA

  • TERM_LEVEL, e.g., "AEDECOD", "AELLT", "AELLTCD", ...

  • TERM_NAME, character, could be NA only at those observations where TERM_ID is non-NA

  • TERM_ID, integer, could be NA only at those observations where TERM_NAME is non-NA

Examples

data("queries")
assert_valid_queries(queries, "queries")