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

Coverage and devops #42

Merged
merged 28 commits into from
Feb 5, 2024
Merged

Coverage and devops #42

merged 28 commits into from
Feb 5, 2024

Conversation

lwalejko
Copy link
Collaborator

@lwalejko lwalejko commented Jan 31, 2024

  • improved test execution
  • added database migration support
  • added functionality for clearing database state and loading fixtures on each test run
  • added test coverage
  • migrated testing CI pipeline from docker compose do GitHub Actions
  • added linter in CI
  • added generating roxygen2 docs in GitHub Actions
  • added readme

Closes: #3 #30 #32

@lwalejko lwalejko changed the base branch from main to devel January 31, 2024 15:59
@codecov-commenter
Copy link

codecov-commenter commented Jan 31, 2024

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

@lwalejko lwalejko marked this pull request as ready for review February 1, 2024 13:40
Copy link
Contributor

@salatak salatak left a comment

Choose a reason for hiding this comment

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

Seems to be okay

Comment on lines 291 to 294
# Define a custom range function
custom_range <- function(x) {
max(x, na.rm = TRUE) - min(x, na.rm = TRUE)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Przerzuciłabym to przed funkcję, skoro jest to potem wykorzystywane w tej funkcji. Wiem, że realnie to się dzieje dopiero przy wywołaniu, ale jest to bardziej intuicyjne jak widzisz to od razu a nie po przejściu przez całą funkcję.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

poprawione

# sum all covariate outcomes
dplyr::summarize(total = sum(dplyr::c_across(dplyr::everything()))) |>
dplyr::pull(total)
dplyr::pull("total")
Copy link
Contributor

Choose a reason for hiding this comment

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

Przeważnie nazwy kolumn zapisujemy bez "". Tak jak w przypadku select(arm, p, total) tak w przypadku pulla. W referencjach funkcji również jest podana wersja bez cudzysłowia. Inaczej mimowolnie zastanawiamy się czy chodzi o string czy o zmienną. Ja bym tutaj te cudzysłowie zdjęła

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Jest tak ponieważ tak wymagał lintr


test_that("it is enough to provide a name, an identifier, and a method id", {
conn <- pool::localCheckout(pool)
with_db_fixtures("fixtures/example_study.yml")
expect_no_error({
Copy link
Contributor

Choose a reason for hiding this comment

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

Trochę brakuje mi w tym skrypcie przypisywania bibliotek przed funkcję, tak jak robisz to przy używaniu paczki {pool}. To zawsze zmniejsza prawdopodobieństwo, że coś się nadpisze i funkcja nie zadziała odpowiednio

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Zgadzam się, ale tak to zastałem i na razie nie zmieniałem. Docelowo fajnie byłoby w ogóle pozbyć się 4 pierwszych linijek z setup-testing-environment.R

copy = TRUE, in_place = TRUE
)
})
})

test_that("numerical constraints are enforced", {
conn <- pool::localCheckout(pool)
with_db_fixtures("fixtures/example_study.yml")
added_patient_id <- 1 |> as.integer()
Copy link
Contributor

Choose a reason for hiding this comment

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

W R wystarczy, że zapiszesz po prostu <- 1. Automatycznie wchodzi to jako numeric. A jesli chcesz integer konkretnie to po prostu as.integer(1), bez pipe |"|>"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Musiał tu być integer bo domyślnie to 1 jest jako double i coś tam dalej krzyczało

Copy link
Contributor

Choose a reason for hiding this comment

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

No to nadal wersja as.integer(1), bo ten pipe tutaj to trochę bez sensu

Copy link
Contributor

Choose a reason for hiding this comment

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

Zastanawiam się czy jednak dokumentacja do funkcji nie powinna być przy jej definiowaniu, a nie przy wywoływaniu.

@lwalejko lwalejko merged commit 00f3a34 into devel Feb 5, 2024
5 checks passed
@lwalejko lwalejko deleted the coverage-and-devops branch February 5, 2024 12:23
This was referenced Feb 7, 2024
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.

3 participants