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

Handle analysis of categorical concepts #32

Merged
merged 24 commits into from
Aug 22, 2024

Conversation

andysouth
Copy link
Contributor

@andysouth andysouth commented Aug 20, 2024

Works on an omop cdm extraction (for HIC) but not yet tested on the package test data

Fixes #12
Fixes #33

South added 5 commits August 20, 2024 13:15
…t set up access to test data with populated observation and measurement tables
…to filter NA because CDM specifies NULL or 0
…et Error in UseMethod("select") : no applicable method for 'select' applied to an object of class "NULL"

Probably due to {{ concept }} tidy evaluation ?
@andysouth andysouth requested a review from a team August 20, 2024 14:45
Copy link
Contributor

@BaptisteBR BaptisteBR left a comment

Choose a reason for hiding this comment

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

name_of_id_col <- paste0(name_of_table, "_concept_id")

It could not work as we want with other tables (e.g. DEVICE_EXPOSURE, because the column is named "device_concept_id").

@andysouth
Copy link
Contributor Author

Thanks @BaptisteBR, measurement and observation are the only tables that have a 'value_as_concept_id' field, DEVICE_EXPOSURE does not, so I don't think this is a problem ?

Copy link
Contributor

@stefpiatek stefpiatek left a comment

Choose a reason for hiding this comment

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

Ah nice to see this coming along, when I ran this script quickly it seemed to fail, am I doing something wrong or do we need to change the dataset?

> source(here::here("dev/omop_analyses/analyse_omop_cdm.R"))
Error in dbAppendTable(conn, name, value) : 
  Column `value` does not exist in target table.

dev/omop_analyses/analyse_omop_cdm.R Outdated Show resolved Hide resolved
dev/omop_analyses/analyse_omop_cdm.R Outdated Show resolved Hide resolved
@andysouth
Copy link
Contributor Author

Seems that the error "Column value does not exist in target table" is not caused by the categorical code ?

@milanmlft
Copy link
Member

Seems that the error "Column value does not exist in target table" is not caused by the categorical code ?

Think the correct name here is value_as_number instead of value?

@milanmlft milanmlft changed the title Add analyse categorical column to fix #12 Handle analysis of categorical concepts Aug 21, 2024
@milanmlft
Copy link
Member

@UCLH-Foundry/safehr-dev can I ask for another review 🙏
I've fixed the error about the value column and also took the liberty to refactor the code somewhat, to make the numeric and categorical variable processing more consistent and to clean up the code.

Thinking more about this, it might make sense to move the helper functions from analyse_omop_cdm.R into the package. That way they can be easily unit tested and reused in other pre-processing scripts. I'll make a new issue for that.

@milanmlft milanmlft requested a review from a team August 21, 2024 17:06
Copy link
Contributor

@stefpiatek stefpiatek left a comment

Choose a reason for hiding this comment

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

Looks nice, thanks for polishing this off Milan

dev/omop_analyses/analyse_omop_cdm.R Show resolved Hide resolved
@milanmlft milanmlft merged commit 5e95393 into main Aug 22, 2024
2 checks passed
@milanmlft milanmlft deleted the add-analyse_categorical_column branch August 22, 2024 09:49
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.

add concept_name field to summary & monthly tables from pre-processing Process categorical concepts
4 participants