Skip to content

TrackA_RMedicine_Hackathon_Apr2026#24#31

Merged
kpagacz merged 7 commits intophuse-org:mainfrom
Siddhesh2097:24_add_more_condn
Apr 28, 2026
Merged

TrackA_RMedicine_Hackathon_Apr2026#24#31
kpagacz merged 7 commits intophuse-org:mainfrom
Siddhesh2097:24_add_more_condn

Conversation

@Siddhesh2097
Copy link
Copy Markdown
Contributor

Added %in% and !%in% conditions to character and filter block.

@peymaneshghi peymaneshghi changed the title #24: added in and not in condns TrackA_RMedicine_Hackathon_Apr2026#24 Apr 23, 2026
@pposiada
Copy link
Copy Markdown
Collaborator

Resolves #24

@pposiada pposiada added the enhancement New feature or request label Apr 23, 2026
@pposiada pposiada linked an issue Apr 23, 2026 that may be closed by this pull request
@kpagacz kpagacz self-requested a review April 24, 2026 07:55
Copy link
Copy Markdown
Collaborator

@kpagacz kpagacz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution!

I attached some general comments about the submitted PR and I will let Przemek handle the specifics.

Comment thread R/BlockConditions.R Outdated
Comment on lines +64 to +65
quoted_vals <- paste0("'", cond$value, "'", collapse = ", ")
paste0("c(", quoted_vals, ")")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use sprintf instead of paste0 and paste in cases where the input is not vectorized.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment or the rest of the comments to use sprintf were addressed in any way. Are you against using sprintf here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No , I agree with using sprintf and I have done the updates.

Comment thread R/BlockConditions.R Outdated
Comment thread R/BlockConditions.R Outdated
Comment thread R/BlockConditions.R Outdated
Comment thread R/BlockConditions.R Outdated
Comment thread R/BlockConditions.R Outdated
Comment thread R/or_filtering_transformator.R Outdated
Comment on lines +372 to +379
input[[paste0("operator_selector_", current_id)]],
{
op <- input[[paste0("operator_selector_", current_id)]]

output[[paste0("value_input_", current_id)]] <- renderUI({
if (op %in% c("%in%", "!%in%")) {
shinyWidgets::pickerInput(
session$ns(paste0("value_input_", current_id)),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should require the input operator otherwise this renders nothing, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have added req(op) but it was still rendering fine. However, I have noticed a bug in this chunk. Will update it by tomorrow

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

req(op) is now removed as it's not needed with the current change to column selector observer.

Comment thread R/or_filtering_transformator.R Outdated
Comment thread R/or_filtering_transformator.R Outdated
Comment thread R/or_filtering_transformator.R Outdated
@kpagacz
Copy link
Copy Markdown
Collaborator

kpagacz commented Apr 24, 2026

The documentation of or_filtering_transformator lists the operators it supports. With this PR the list changes, which should be reflected in the docs of or_filtering_transformator.

@Siddhesh2097
Copy link
Copy Markdown
Contributor Author

Hi @kpagacz, thank you for the review. I agree there is unnecessary styling added. It is due to the AIR formatter enabled in my Positron that added these changes.
The formatter is disabled now, and I will revert all the styling changes to match the original code.

Copy link
Copy Markdown
Collaborator

@kpagacz kpagacz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look at the comments, I hope the resolutions were automatic and not done manually.

Comment thread R/BlockConditions.R Outdated
setMethod("add_condition", "BlockConditions", function(object, variable, operator, value) {
object@conditions <- c(object@conditions, list(list(variable = variable, operator = operator, value = value)))
object
object
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the indent?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment thread R/BlockConditions.R Outdated
Comment on lines +64 to +65
quoted_vals <- paste0("'", cond$value, "'", collapse = ", ")
paste0("c(", quoted_vals, ")")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment or the rest of the comments to use sprintf were addressed in any way. Are you against using sprintf here?

Comment thread R/or_filtering_transformator.R Outdated
Comment on lines +239 to +247
cond_str <- if (operator == "%in%") {
quoted_vals <- paste0("'", value, "'", collapse = ", ")
paste0(variable, " %in% c(", quoted_vals, ")")
} else if (operator == "!%in%") {
quoted_vals <- paste0("'", value, "'", collapse = ", ")
paste0("!", variable, " %in% c(", quoted_vals, ")")
} else {
paste0(variable, " ", operator, " ", value)
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not addressed in any way. Are you against using a switch statement here?

Comment thread R/or_filtering_transformator.R Outdated
})

# Update choices for values for the new block
#Update choices for values for the new block
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was not addressed and on this I will insist.

Comment thread R/or_filtering_transformator.R Outdated
} else if (is.character(col_data) || is.factor(col_data)) {
lvls <- levels(factor(col_data))

#Observe operator changes to change to single / multi select
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was not addressed and I will insist on this

@Siddhesh2097
Copy link
Copy Markdown
Contributor Author

Siddhesh2097 commented Apr 24, 2026

The documentation of or_filtering_transformator lists the operators it supports. With this PR the list changes, which should be reflected in the docs of or_filtering_transformator.

Updated

@Siddhesh2097
Copy link
Copy Markdown
Contributor Author

Siddhesh2097 commented Apr 24, 2026

@kpagacz To summarise, updates were done from my end but were not pushed as I discovered a bug. In my latest commit, all your comments have been addressed. And as I mentioned, there is a bug due to my addition of %in% operator where value levels are not updated, I'll try to fix it by tomorrow.

Few other add comments and anything missed will be addressed in my next commit. I generally request for a re-review once I'm done with my updates, and unfortunately you had to see my unfinished work.

@Siddhesh2097 Siddhesh2097 requested a review from kpagacz April 25, 2026 16:55
Copy link
Copy Markdown
Collaborator

@kpagacz kpagacz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this and it works as I would expect it, thank you so much for your contribution of this feature and also being patient with general code improvements to this repsitory in reviews :)

You are joining the hall of fame of contributors in our NEWS file!

@kpagacz kpagacz merged commit 646f8c7 into phuse-org:main Apr 28, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow %in% and !...%in% in to or_filtering_transformator

3 participants