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

MockVisitOccurrence() #74

Closed
ilovemane opened this issue May 20, 2024 · 3 comments · Fixed by #111
Closed

MockVisitOccurrence() #74

ilovemane opened this issue May 20, 2024 · 3 comments · Fixed by #111
Assignees
Milestone

Comments

@ilovemane
Copy link
Collaborator

No description provided.

@catalamarti
Copy link
Collaborator

all records of concepts (in observation) and cohorts must have a visit record in visit occurrence

@ilovemane ilovemane self-assigned this May 20, 2024
@ilovemane ilovemane added this to the v0.3.0 milestone May 20, 2024
@edward-burn
Copy link
Collaborator

another +1 for this :)

@catalamarti
Copy link
Collaborator

visitOccurrence <- purrr::map_df(allClinicalTables, \(x) {
  personIdentifier <- getPersonIdentifier(x) # omopgenerics::getPersonIdentifier()
  startDate <- getStartDate(x) # check if PatientProfiles::startDateColumn()
  cdm[[x]] |>
    dplyr::select(
      "person_id" = dplyr::all_of(personIdentifier),
      "visit_start_date" = dplyr::all_of(startDate)
    ) |>
    dplyr::mutate("visit_end_date" = .data$visit_start_date) |>
    dplyr::distinct()
}) |>
  dplyr::distinct() |>
  dplyr::mutate(visit_corrence_id = dplyr::row_number())

for (x in allClinicalTables) {
  personIdentifier <- getPersonIdentifier(x)
  startDate <- getStartDate(x)
  cdm[[x]] <- cdm[[x]] |>
    dplyr::select(!"visit_corrence_id") |>
    dplyr::inner_join(
      visitOccurrence |>
        dplyr::select(
          !!personIdentifier := "person_id",
          !!startDate := "visit_start_date",
          "visit_corrence_id"
        ), 
      by = c(personIdentifier, startDate)
    )
}

# populate extra columns for visit_occurrence table

@ilovemane ilovemane linked a pull request Sep 11, 2024 that will close this issue
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 a pull request may close this issue.

3 participants