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

Use search parameters in get_hipaa_disclosure_log_from_ehr_fhir_logs() #161

Closed
pbchase opened this issue Jun 18, 2024 · 3 comments
Closed
Assignees

Comments

@pbchase
Copy link
Contributor

pbchase commented Jun 18, 2024

Use the optional parameters start_date and ehr_id to get_hipaa_disclosure_log_from_ehr_fhir_logs(). For each parameter, if it is specified, filter the data returned by the SQL query underlying this code block:

dplyr::tbl(conn, "redcap_ehr_fhir_logs") |>
    dplyr::filter(.data$resource_type == "Patient" & .data$mrn != "") |>
    dplyr::left_join(user_information, by = c("user_id" = "ui_id")) |>
    dplyr::left_join(projects, by = c("project_id")) |>
    dplyr::collect()

The tricky part is making it performant. When you see a code block that starts with dplyr::tbl and ends with dplyr::collect(), the query will be converted into SQL and handed to the SQL server. In my experience, these queries are inefficient if you use more than one filter statement. So I advise you to use only one filter statement and that gets hard.

You'll probably need to separate the tbl-->collect stanza from the code that follows it saving an intermediate result. Then you can use conditional logic statements in R to decide which of a few varying tbl-->collect stanzas to send.

@pbchase
Copy link
Contributor Author

pbchase commented Aug 9, 2024

I'm putting an indefinite hold on this because we do not need it at this time. It's unclear if we ever will.

@pbchase pbchase removed the hold label Dec 9, 2024
@pbchase
Copy link
Contributor Author

pbchase commented Dec 9, 2024

I removed the hold because we do need these features and the ehr_ids are no longer NA

@pbchase
Copy link
Contributor Author

pbchase commented Dec 9, 2024

addressed by PR #162

@pbchase pbchase closed this as completed Dec 9, 2024
@pbchase pbchase added this to the Create EHR log export tools milestone Dec 9, 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

No branches or pull requests

2 participants