...
Very rarely will users actually want to view an entire data set, most of the time it is expected for users to subset their data based on variables they are interested in researching. This brings up a couple interesting issues for users trying to access the data. If users are unfamiliar with the data source or variable names, how are they supposed to select the variables they are interested in? This may not be a big deal for small data sources, but do we really expect users to search through hundreds or thousands of variables on big data sources in order to find the variable they are interested in? To solve this problem, RDS leverages the documentation that administrators have added to provide enhanced selection capability.
Step By Step
- Begin with a simple select query.
Query by Variable Names
The first way RDS allows users to select variables is through the well known and traditional way of specifying variable names. If we know the variables we want to work with this is a great way to quickly subset our data. This is done through the use of the the cols parameter parameter, which takes a comma separated list of values.
Code Block | title | Query by Variable Names
---|
http://{host}/rds/api/catalog/{collection}/{view}/select?cols=col1,col2,col3,... |
...
Query by Regular Expression
User Users can also use regular expressions to select variables. Regular expressions can be used on views that have minimal metadata. Again we will use the cols parameter for this, but rather than specifying a specific name we will use a regular expression. Multiple regular expressions can be passed in using the same comma separated list of values if desired. Users can also combine regular expressions with specific variable names.
Code Block | |
---|---|
Query by Regular Expression | http://{host}/rds/api/catalog/{collection}/{view}/select?cols={regex} |
...
Query by Keyword
Key words are another way to search for variables. When selecting variables by keywords it is important to have good metadata backing the variables. A variables name, label, description, and question text will be searched for the keyword and any and all matches will be returned. To search on keywords we will have to put a $ before the keyword we would like to search on in the cols
cols parameter.
Code Block | ||
---|---|---|
| ||
http://{host}/rds/api/catalog/{collection}/{view}/select?cols=$keyword |
...
Query by Combination
All of the previously discussed techniques can be used at the same time if desired.
Code Block | |
---|---|
Query by Combination | http://{host}/rds/api/catalog/{collection}/{view}/select?cols=col1,col2,col3,{regex},$keyword |
...