Skip to content

Commit

Permalink
feat: updated encounter age criteria - Ref gestion-de-projet#2659
Browse files Browse the repository at this point in the history
  • Loading branch information
ManelleG authored Aug 28, 2024
1 parent 61a51c2 commit cd6ee88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const EncounterForm = ({

<BlockWrapper className={classes.inputItem}>
<CriteriaLabel
label="Âge au moment de la prise en charge"
label="Âge au début de la prise en charge"
infoIcon="La valeur par défaut sera prise en compte si le sélecteur d'âge n'a pas été modifié."
/>

Expand Down
2 changes: 0 additions & 2 deletions src/mappers/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
23 changes: 11 additions & 12 deletions src/utils/cohortCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand All @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cd6ee88

Please sign in to comment.