Skip to content

createBulkCharacteristics crashes if all cohorts are small

Created by: marek05

If I run with the default options in CodeToRun file (useBulkCharacterization = TRUE) then the bulkCharacterization code crashes with following error:

DBMS:
postgresql

Error:
org.postgresql.util.PSQLException: ERROR: syntax error at or near "SELECT"
  Position: 96

SQL:
CREATE TEMP TABLE cohort_subset
          
AS
WITH data  AS (
            
SELECT NA cohort_id
SELECT  cohort_id
          ) 
           SELECT
cohort_id
          
FROM
data

It is due to the fact all my target cohorts are small (<20 but for characterization it needs 140). Maybe it needs some nicer error catching or logging. The problem is that the featureExtractionCohorts element is empty for me due to the 140 limit (https://github.com/bdemeulder/PIONEERmetastaticTreatment/blob/master/R/RunStudy.R#L419). If I run useBulkCharacterization = FALSE then the characterization is run but the results are empty as expected but no errors are shown.