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

therapy_timeline looking for dates in inpatient_diagnoses #103

Closed
peterdutey opened this issue Sep 26, 2022 · 0 comments
Closed

therapy_timeline looking for dates in inpatient_diagnoses #103

peterdutey opened this issue Sep 26, 2022 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@peterdutey
Copy link
Collaborator

The test dataset has episode_start and episode_end in it and incorrectly letting the .therapy_timeline_get_diagnoses() function pass tests even though validate_inpatient_diagnoses() does not mandate start/end dates.

.therapy_timeline_get_diagnoses() should be changed

> therapy_timeline(TherapyEpisode(ramses_db,  xxx))
Error in `dplyr::mutate()`:
! Problem while computing `diagnosis_episode_end = dplyr::lag(.data$episode_end, n = 1, order_by =
  .data$episode_start)`.
Caused by error in `.data$episode_start`:
! Column `episode_start` not found in `.data`.
Run `rlang::last_error()` to see where the error occurred.

Backtrace:
     x
  1. +-Ramses::therapy_timeline(TherapyEpisode(ramses_db, xxx))
  2. +-Ramses::therapy_timeline(TherapyEpisode(ramses_db, xxx))
  3. | \-Ramses .local(x, ...)
  4. |   \-Ramses:::.therapy_timeline_create(...)
  5. |     \-Ramses:::.therapy_timeline_get_diagnoses(input_patient)
  6. |       \-... %>% ...
  7. +-dplyr::summarise(...)
  8. +-dplyr::group_by(...)
  9. +-dplyr::select(., -.data$diagnosis_episode_end)
 10. +-dplyr::mutate(., grp = max(.data$grp))
 11. +-dplyr::group_by(., .data$patient_id, .data$icd_code, .data$prim_diag)
 12. +-dplyr::mutate(...)
 13. +-dplyr::ungroup(.)
 14. +-dplyr::mutate(...)
 15. +-dplyr:::mutate.data.frame(...)
 16. | \-dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())
 17. |   +-base::withCallingHandlers(...)
 18. |   \-mask$eval_all_mutate(quo)
 19. +-dplyr::lag(.data$episode_end, n = 1, order_by = .data$episode_start)
 20. +-episode_start
 21. +-rlang:::`$.rlang_data_pronoun`(.data, episode_start)
 22. | \-rlang:::data_pronoun_get(...)
 23. \-rlang:::abort_data_pronoun(x, call = y)
 24.   \-rlang::abort(msg, "rlang_error_data_pronoun_not_found", call = call)
 25. ```
@peterdutey peterdutey added the bug Something isn't working label Sep 26, 2022
@peterdutey peterdutey added this to the v0.5.3 milestone Sep 26, 2022
@peterdutey peterdutey added this to To do in Ramses development via automation Sep 26, 2022
peterdutey added a commit that referenced this issue Oct 20, 2022
peterdutey added a commit that referenced this issue Oct 20, 2022
Ramses development automation moved this from To do to Done Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant