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

SQL error while running assessPropensityModels() #17

Open
aki-nishimura opened this issue Mar 3, 2022 · 2 comments
Open

SQL error while running assessPropensityModels() #17

aki-nishimura opened this issue Mar 3, 2022 · 2 comments

Comments

@aki-nishimura
Copy link
Contributor

We have successfully run the phenotype assessment at Johns Hopkins, but are having troubles with the propensity model part. We get an SQL error while retrieving cohorts. Below is the content of errorReportSql.txt --- do you have insights as to where the "NA" in cohort_definition_id IN (NA, NA) is coming from?

DBMS:
sql server

Error:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'NA'.

SQL:
SELECT ROW_NUMBER() OVER (ORDER BY person_id, cohort_start_date) AS row_id,
	subject_id,

	cohort_definition_id,

	cohort_start_date,
	DATEDIFF(DAY, observation_period_start_date, cohort_start_date) AS days_from_obs_start,
	
		DATEDIFF(DAY, cohort_start_date, cohort_end_date)
	 AS days_to_cohort_end,
	
		DATEDIFF(DAY, cohort_start_date, observation_period_end_date)
	 AS days_to_obs_end,
	cohort_end_date
INTO #cohort_person
FROM (




	SELECT exposure_table.subject_id,

		cohort_definition_id,

		cohort_start_date,
		cohort_end_date
	FROM JHM_OMOP_20220203.Results.legendt2dm_study_class_sample_cohort exposure_table
	
		
			WHERE
		
		cohort_definition_id IN (NA, NA)
	


	) raw_cohorts



INNER JOIN JHM_OMOP_20220203.dbo.observation_period
	ON subject_id = person_id
WHERE cohort_start_date <= observation_period_end_date
	AND cohort_start_date >= observation_period_start_date




R version:
R version 4.0.5 (2021-03-31)

Platform:
x86_64-pc-linux-gnu

Attached base packages:
- stats
- graphics
- grDevices
- utils
- datasets
- methods
- base

Other attached packages:
- LegendT2dm (1.0.2)
- DatabaseConnector (4.0.2)
@msuchard
Copy link
Member

msuchard commented Mar 4, 2022

@aki-nishimura -- interesting. Those NA are probably coming from the R (as opposed to SQL) side since this is a a rendered snippet. I suspect there are no cohorts that meet some minimum requirement. I'll double the code and your cohort diagnostics shortly.

@msuchard
Copy link
Member

msuchard commented Mar 4, 2022

JHM appears to only have one class of drugs with > 1,000 patients, so no comparisons are allowed here. I need to patch the code in assessPropensityModels to make this check as well.

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