Cohort sample with age "not between" includes people from other cohorts and ignores the gender filter
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Leggi CohortSamplingService.sampleElements e generateSample.sql, dove l’issue identifica il filtro notBetween e la relativa clausola WHERE generata. Controlla i test esistenti per il campionamento delle coorti e aggiungi copertura per l’appartenenza alla coorte e il filtro del genere con la modalità di età "not between". Il lavoro è completato quando i campioni includono solo la coorte selezionata e rispettano il genere selezionato; l’issue non indica un file di test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected behavior
Creating a cohort sample (POST /cohortsample/{cohortDefinitionId}/{sourceKey}, the "Samples" tab of a cohort definition in ATLAS) with the age mode "not between" and a minimum and maximum age should only draw people from that cohort whose age at cohort start is below the minimum or above the maximum, and should still apply the selected gender filter.
Actual behavior
CohortSamplingService.sampleElements builds the filter for notBetween as
expressionBuilder.append(" AND age > @age_max OR age < @age_min");
and appends it after WHERE cohort_definition_id = @cohort_definition_id in generateSample.sql. Because AND binds tighter than OR, the condition becomes
WHERE (cohort_definition_id = @cohort_definition_id AND age > @age_max)
OR (age < @age_min AND gender_concept_id IN (...))
so the sample:
- draws people younger than the minimum age from every cohort in the results schema's
cohorttable, not only the selected cohort, and - draws people older than the maximum age regardless of the gender filter.
The other age modes (lessThan, between, ...) are not affected.
Steps to reproduce behavior
With a results schema cohort table and a CDM person table on PostgreSQL (all cohort entries start on 2020-06-01, so age = 2020 - year_of_birth):
| person_id | gender_concept_id | year_of_birth | age | cohort_definition_id |
|---|---|---|---|---|
| 1 | 8507 | 2010 | 10 | 1 |
| 2 | 8532 | 1970 | 50 | 1 |
| 3 | 8532 | 1940 | 80 | 1 |
| 4 | 8507 | 1935 | 85 | 1 |
| 5 | 8532 | 2015 | 5 | 2 |
| 6 | 8532 | 1930 | 90 | 2 |
- Create a sample of cohort 1 with age "not between" 20 and 60 and no gender filter. Expected people 1, 3, 4; actual 1, 3, 4, 5 (person 5 is only in cohort 2).
- Create a sample of cohort 1 with age "not between" 20 and 60 and gender female. Expected person 3; actual 3, 4 (male), 5 (cohort 2).
The WHERE clause of generateSample.sql for step 2, before translation:
WHERE cohort_definition_id = @cohort_definition_id
AND age > @age_max OR age < @age_min AND gender_concept_id IN (8532)
Environment
WebAPI master (3.0.1-SNAPSHOT, 89de588d); the same code is in v2.15.1. ATLAS offers "not between" in the sample age options (cohort-definition-manager.js). Reproduced on PostgreSQL; the precedence is the same on every supported dialect.
- Lingua principale
- Java
- Stelle
- 153
- Fork
- 186
- Merge medio
- 2g 19h
- PR unite (30g)
- 19
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OHDSI/WebAPI
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
CDM cache warming issues one record-count query per concept on Snowflake, Spark and BigQuery (getConceptsForBatch.sql relies on integer division)Forse già presa @DG47 l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
GET /conceptset/{id}/expression returns items in nondeterministic order (query has no ORDER BY)Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
OHDSI/WebAPI#2543 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
OHDSI/WebAPI#2513 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OHDSI/WebAPI
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
jakartaee/expression-language#501 ·
I maintainer di solito rispondono entro 7 giorni
-
enhancement triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ShaftHQ/SHAFT_ENGINE#7902 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Filter.toString() throws IllegalFormatConversionException for withinGeoRange filtersForse già presa @dudanogueira l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
weaviate/java-client#638 ·