diff --git a/src/components/CreationCohort/DiagramView/components/LogicalOperator/components/CriteriaRightPanel/EncounterForm/index.tsx b/src/components/CreationCohort/DiagramView/components/LogicalOperator/components/CriteriaRightPanel/EncounterForm/index.tsx index 4f18d4428..ceaf81ecd 100644 --- a/src/components/CreationCohort/DiagramView/components/LogicalOperator/components/CriteriaRightPanel/EncounterForm/index.tsx +++ b/src/components/CreationCohort/DiagramView/components/LogicalOperator/components/CriteriaRightPanel/EncounterForm/index.tsx @@ -237,7 +237,7 @@ const EncounterForm = ({ diff --git a/src/mappers/filters.ts b/src/mappers/filters.ts index 78194c5c0..cdceadc5e 100644 --- a/src/mappers/filters.ts +++ b/src/mappers/filters.ts @@ -61,9 +61,7 @@ export enum PatientsParamsKeys { export enum EncounterParamsKeys { DURATION = 'length', MIN_BIRTHDATE_DAY = 'start-age-visit', - MAX_BIRTHDATE_DAY = 'end-age-visit', MIN_BIRTHDATE_MONTH = 'start-age-visit-month', - MAX_BIRTHDATE_MONTH = 'end-age-visit-month', ENTRYMODE = 'admission-mode', EXITMODE = 'discharge-disposition-mode', PRISENCHARGETYPE = 'class', diff --git a/src/utils/cohortCreation.ts b/src/utils/cohortCreation.ts index 37e244b27..5320120f9 100644 --- a/src/utils/cohortCreation.ts +++ b/src/utils/cohortCreation.ts @@ -302,9 +302,6 @@ const buildEncounterFilter = (criterion: EncounterDataType, deidentified: boolea const isMinBirthdateDeidentified = deidentified ? EncounterParamsKeys.MIN_BIRTHDATE_MONTH : EncounterParamsKeys.MIN_BIRTHDATE_DAY - const isMaxBirthdateDeidentified = deidentified - ? EncounterParamsKeys.MAX_BIRTHDATE_MONTH - : EncounterParamsKeys.MAX_BIRTHDATE_DAY return [ 'subject.active=true', filtersBuilders(EncounterParamsKeys.ADMISSIONMODE, buildLabelObjectFilter(criterion.admissionMode)), @@ -328,7 +325,7 @@ const buildEncounterFilter = (criterion: EncounterDataType, deidentified: boolea ? buildDurationFilter(criterion?.age[0], isMinBirthdateDeidentified, 'ge', deidentified) : '', criterion.age[1] !== null - ? buildDurationFilter(criterion?.age[1], isMaxBirthdateDeidentified, 'le', deidentified) + ? buildDurationFilter(criterion?.age[1], isMinBirthdateDeidentified, 'le', deidentified) : '', buildEncounterDateFilter( criterion.type, @@ -981,16 +978,18 @@ const unbuildEncounterCriteria = async (element: RequeteurCriteriaType): Promise } }, [EncounterParamsKeys.MIN_BIRTHDATE_DAY]: (c, v) => { - c.age[0] = v ? unbuildDurationFilter(v, false) : null + if (v?.includes('ge')) { + c.age[0] = unbuildDurationFilter(v) + } else if (v?.includes('le')) { + c.age[1] = unbuildDurationFilter(v) + } }, [EncounterParamsKeys.MIN_BIRTHDATE_MONTH]: (c, v) => { - c.age[0] = v ? unbuildDurationFilter(v, true) : null - }, - [EncounterParamsKeys.MAX_BIRTHDATE_DAY]: (c, v) => { - c.age[1] = v ? unbuildDurationFilter(v, false) : null - }, - [EncounterParamsKeys.MAX_BIRTHDATE_MONTH]: (c, v) => { - c.age[1] = v ? unbuildDurationFilter(v, true) : null + if (v?.includes('ge')) { + c.age[0] = unbuildDurationFilter(v, true) + } else if (v?.includes('le')) { + c.age[1] = unbuildDurationFilter(v, true) + } }, [EncounterParamsKeys.ENTRYMODE]: (c, v) => { unbuildLabelObjectFilter(c, 'entryMode', v)