Skip to content

122 factors best response aggregate recist rates#123

Open
AlexisCochard wants to merge 7 commits into
mainfrom
122-factors-best_response-aggregate_recist_rates
Open

122 factors best response aggregate recist rates#123
AlexisCochard wants to merge 7 commits into
mainfrom
122-factors-best_response-aggregate_recist_rates

Conversation

@AlexisCochard

Copy link
Copy Markdown
Contributor

No description provided.

@AlexisCochard AlexisCochard linked an issue Jul 2, 2026 that may be closed by this pull request

@DanChaltiel DanChaltiel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

J'ai relu, c'est nickel 👍
Juste quelques commentaires mineurs.

Bien vu l'histoire de l'ordre des footnotes, il faudra peut-être brainstormer ça en réunion grstat (et on garde ça en tête pour #111, à voir si des lettres ne seraient pas plus lisibles que des astérisques)

Par contre je ne suis pas sûr de comprendre le problème initial (factor pour avoir tous les niveaux, dans l'ordre), même sans tes modifs le test passait bien :

test_that("No bug when no CR or PR", {

C'est quand on modifie best_response (genre as.character) avant de passer aggregate() ?

Si c'est ça, tu pourrais ajouter un test à cet endroit ?
Il faut un cas qui plantait avec ton code d'avant et que ta PR résout.

Comment thread R/aggregate_recist_rates.R Outdated
Comment thread R/aggregate_recist_rates.R Outdated
Comment thread R/aggregate_recist_rates.R Outdated
levels = best_response_label))

if(length(recist$subjid) != length(data$subjid)){
if(length(recist$subjid) != length(data$subjid) | length(unique(recist$subjid)) != length(recist$subjid)){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ton code marchera certainement, mais la logique de condition est un peu bancale :

  • length(recist$subjid) c'est en fait simplement nrow(recist), peu importe la colonne sélectionnée
  • Comme tu appelles distinct() sur data pour avoir recist, comparer data et recist revient à tester que data est distinct, non ? Mais du coup distinct sur toutes les colonnes, pas juste subjid.

Est-ce qu'on ne peut pas simplifier ça en un check sur data (avant de créer recist) ?
Par exemple juste : if(anyDuplicated(data$subjid)) cli_abort(...)

recist = data %>%
distinct()
distinct() %>%
mutate(six_months_confirmation = as.logical(six_months_confirmation),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Vu que tu ajoutes des trucs, je reviewe des trucs 😁
Je n'avais pas vu mais il n'y a aucune programmation défensive ici
Tu pourrais ajouter un check des colonnes :
assert_names_exists(data, c("best_response", "six_months_confirmation", etc))


data_br_3 = data_br %>%
mutate(best_response = ifelse(subjid ==1, "Stable disease", as.character(best_response)))
aggregate_recist_rates(data_br_3)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nickel le test !

Par contre il faudrait retirer les lignes avec juste aggregate_recist_rates(data_br_d) (ligne 105 aussi)
Ça prend du temps machine pendant les tests juste pour vérifier que la ligne ne donne pas d'erreur, alors qu'on teste déjà ça dans le snapshot juste au-dessous.

})
})

test_that("No bug when modification of best_response before between calc_best_resp and aggregatte", {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo sur aggregatte

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

Successfully merging this pull request may close these issues.

Factors best_response aggregate_recist_rates

2 participants