Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Study data tab: Allow continuous & categorical data to live in harmony #117

Open
aclark02-arcus opened this issue Oct 22, 2024 · 2 comments

Comments

@aclark02-arcus
Copy link
Collaborator

aclark02-arcus commented Oct 22, 2024

So, we have some urinalysis labs that have both categorical & continuous data in the form. Specifically:

Continuous

  • Urobilinogen, pH, Specific Gravity

Categorical

  • Appearance, Color, Ketones, Leukocyte, Nitrites, Blood, Bilirubin, Glucose, protein

If the code is left AS-IS

if all item_groups == "continuous", the plots generate as expected for the continuous variables, but all the categorical variables generate a bunch of empty plots (see below). On the table side of things, a the categorical variables have a ton of NA's (see below).

image

image

Now, if I change to item_type = 'other' for all the categorical variables, the table looks excellent but none of the plot generate, because of this line of code that requires all item_types be 'continuous':

if(!all(x$item_type == "continuous")) return(x)

Proposal

Amend the code so that only 'continuous' variables be processed for plotting and 'other' (categorical) vars be untouched for display in the table.

@aclark02-arcus aclark02-arcus changed the title Allow continuous & categorical data to live in harmony on Study data Study data tab: Allow continuous & categorical data to live in harmony Oct 22, 2024
@LDSamson
Copy link
Collaborator

It is intentional behavior that only the table is shown and not the figures with mixed data. If not done so, a monitor might review all data on a form with mixed data while never seeing the categorical data, which I think is a safety risk that should be avoided.

Although not ideal, you can always make two tabs for urinalysis, one with categorical and one with continuous data. Another way to avoid this is to ensure that 1) the user is made aware that there is more data in the table, and 2) the form cannot be reviewed unless the table is viewed as well.

However, I think the best non-temporary way to address this is to show different figures based on data type (continuous, categorical, dichotomous). There are already several figure functions in this package for doing so. But, in order to show mixed data, we need to stray away from facet_wrap within ggplot and build a faceted figure ourselves. This would have several other advantages, but will take some development time to do it right.

@aclark02-arcus
Copy link
Collaborator Author

aclark02-arcus commented Oct 28, 2024

Understood. I understand the reason behind that design decision.

We do have another use case to consider (besides the Urinanlysis use case) for the redesign... in our vital signs data, we have some measurements gathered at different timepoints... for example: measuring blood pressure after lying down, standing, and standing for 5 mins (etc). Because of that, are converting that column to an item_type = 'other' and that's forcing the whole tab to only display a table. If we mark it as 'continuous', the plot will have several points plotted on the same day. I envision this use case being an enhancement to the plots more than anything. But in order to avoid facet_wrap(), timepoint would probably have to be a filter on the right hand side. Or perhaps give users the option to aggregate the measurements into a mean plotted over time? OR you could adapt the legend and to make each measurement a different shape? Definitely a lot of ways to go.

This is really a separate issue, so I moved it to here: #121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants