bcgov / bcgov/wqbc

standardize_variables: Use lookup table of parameters rather than text-matching

Open
#86 0 comments 0 reactions 0 assignees View on GitHub
enhancement in progress
Dominant language
R
Stars
24
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Need to construct a table matching parameters in `rems::ems_paramaters` to those in `wqbc::limits`

| limit_name | ems_parameter | ems_param_code |
| ----------- | ---------------- | ----------------- |
| X | X Total | 123 |
| X | X Dissolved | 1234 |

Then `standardize_variables` should lookup the limits in `wqbc::limits` using this table, then output from `calc_limits` should look like this:

| Variable | Value | LimitName | UpperLimit | LowerLimit |
| -------- | ------ | ----------- | ----------- | ----------- |
| X Total | 7 | X | 11 | 2 |
| X Dissolved | 6 | X | 11 | 2 |
| X Suspended | 5 | X | 11 | 2 |
| X Foo | 42 | X | NA | NA |

`X Foo` was not matched in the lookup table

Then `calc_limits` should have an argument `drop` saying whether or not to drop the rows where limits were not able to be calculated - either because it wasn't able to be matched in the lookup table, or the limit was dependent on another variable that was not available.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing standardize_variables and calc_limits entry points, along with rems::ems_paramaters and wqbc::limits. Define the parameter lookup mapping and verify that calc_limits returns matched limits while the drop argument controls unmatched or dependency-missing rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.