Skip to content

SQL error while running assessPropensityModels() #17

Description

@aki-nishimura

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions