OHDSI Home | Forums | Wiki | Github

Problem in SQL cohort generation (syntax error); comma instead of dot in numeric values

Dear colleagues,
I’m trying to define a very simple cohort based on a measurement criteria related to "systolic arterial blood pressure”. The unique inclusion criteria establishes a threshold in systolic pressure, so that patients included do have measurements upper than 150 mmHg. Systolic blood pressure measurements are included in measurement table (concept_id=4217013), and values in value_as_number field. So criteria is based on: “measurement of 4217013 with value as number greater than 150”
When I try to generate the cohort, results in FAILED message: "org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar……… syntax ERROR”.

I’ve been analyzing SQL (Export->SQL->PostgreSQL), and i found such ERROR:

– Begin Measurement Criteria
select C.person_id, C.measurement_id as event_id, C.measurement_date as start_date, (C.measurement_date + 1INTERVAL’1 day’) as END_DATE,*
C.visit_occurrence_id, C.measurement_date as sort_date
from
(
select m.*
FROM @cdm_database_schema.MEASUREMENT m
JOIN Codesets codesets on ((m.measurement_concept_id = codesets.concept_id and codesets.codeset_id = 2))
) C

WHERE C.value_as_number > 150,0000
– End Measurement Criteria

The problem is located in WHERE clause: WHERE C.value_as_number > 150,0000
In 150,000, there is a “,” (comma), but there must be a “.” (dot). In fact, if I put dot instead of comma, and I execute the SQL generation script, it works and the cohort is correctly generated.

I don’t kwon how to fix that problem. Is it related to atlas configuration? Locale parameters in atlas, or postgreSQL? (atlas 2.8.0; webapi 2.9.0)

Thanks in advance for your help.

1 Like

Problem solved:
Changing from LANG=es_ES.UTF-8, to LANG=en_US.UTF-8

1 Like
t