Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang committed Aug 27, 2024
1 parent ca26dc9 commit c60e1b7
Show file tree
Hide file tree
Showing 35 changed files with 930 additions and 632 deletions.
29 changes: 17 additions & 12 deletions src/components/CreationCohort/DataList_Criteria.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import HospitForm from './DiagramView/components/LogicalOperator/components/Crit

import services from 'services/aphp'

import { ODD_BIOLOGY, ODD_IMAGING, ODD_MEDICATION, ODD_QUESTIONNAIRE } from '../../constants'
import { ODD_BIOLOGY, ODD_IMAGING, ODD_MEDICATION, ODD_QUESTIONNAIRE, USE_FHIR_CLAIM } from '../../constants'
import { CriteriaType, CriteriaTypeLabels } from 'types/requestCriterias'

const criteriaList: CriteriaItemType[] = [
Expand Down Expand Up @@ -105,17 +105,22 @@ const criteriaList: CriteriaItemType[] = [
encounterStatus: services.cohortCreation.fetchEncounterStatus
}
},
{
id: CriteriaType.CLAIM,
title: CriteriaTypeLabels.CLAIM,
color: '#0063AF',
fontWeight: 'normal',
components: GhmForm,
fetch: {
ghmData: services.cohortCreation.fetchGhmData,
encounterStatus: services.cohortCreation.fetchEncounterStatus
}
}
...(USE_FHIR_CLAIM
? [
{
id: CriteriaType.CLAIM,
title: CriteriaTypeLabels.CLAIM,
color: '#0063AF',
fontWeight: 'normal',
components: GhmForm,
fetch: {
ghmData: services.cohortCreation.fetchGhmData,
encounterStatus: services.cohortCreation.fetchEncounterStatus
},
disabled: !USE_FHIR_CLAIM
}
]
: [])
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { BlockWrapper } from 'components/ui/Layout'
import OccurenceInput from 'components/ui/Inputs/Occurences'
import { SourceType } from 'types/scope'
import { Hierarchy } from 'types/hierarchy'
import { USE_FHIR_EXTRA_SEARCH_PARAM } from 'constants.js'

type Cim10FormProps = {
isOpen: boolean
Expand Down Expand Up @@ -205,17 +206,19 @@ const Cim10Form: React.FC<Cim10FormProps> = (props) => {
onChangeValue('code', value)
}}
/>
<Autocomplete
multiple
id="criteria-cim10-type-autocomplete"
className={classes.inputItem}
options={criteriaData.data.diagnosticTypes || []}
getOptionLabel={(option) => option.label}
isOptionEqualToValue={(option, value) => option.id === value.id}
value={defaultValuesType}
onChange={(e, value) => onChangeValue('diagnosticType', value)}
renderInput={(params) => <TextField {...params} label="Type de diagnostic" />}
/>
{USE_FHIR_EXTRA_SEARCH_PARAM && (
<Autocomplete
multiple
id="criteria-cim10-type-autocomplete"
className={classes.inputItem}
options={criteriaData.data.diagnosticTypes || []}
getOptionLabel={(option) => option.label}
isOptionEqualToValue={(option, value) => option.id === value.id}
value={defaultValuesType}
onChange={(e, value) => onChangeValue('diagnosticType', value)}
renderInput={(params) => <TextField {...params} label="Type de diagnostic" />}
/>
)}
<Autocomplete
multiple
options={criteriaData.data.encounterStatus || []}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { CriteriaDataKey, DemographicDataType, CriteriaType } from 'types/reques
import { BlockWrapper } from 'components/ui/Layout'
import { CriteriaDrawerComponentProps, CriteriaItemDataCache } from 'types'
import { CriteriaLabel } from 'components/ui/CriteriaLabel'
import { USE_FHIR_EXTRA_SEARCH_PARAM } from 'constants.js'

enum Error {
INCOHERENT_AGE_ERROR,
Expand Down Expand Up @@ -183,24 +184,26 @@ const DemographicForm = (props: CriteriaDrawerComponentProps) => {
</BlockWrapper>
)}

<BlockWrapper margin="1em">
<CriteriaLabel
label={
vitalStatus &&
vitalStatus.length === 1 &&
vitalStatus.find((status: LabelObject) => status.label === VitalStatusLabel.DECEASED)
? VitalStatusOptionsLabel.deceasedAge
: VitalStatusOptionsLabel.age
}
/>
<DurationRange
value={age}
active={!birthdates[0] || !birthdates[1]}
onChange={(value) => setAge(value)}
onError={(isError) => setError(isError ? Error.INCOHERENT_AGE_ERROR : Error.NO_ERROR)}
deidentified={deidentified}
/>
</BlockWrapper>
{USE_FHIR_EXTRA_SEARCH_PARAM && (
<BlockWrapper margin="1em">
<CriteriaLabel
label={
vitalStatus &&
vitalStatus.length === 1 &&
vitalStatus.find((status: LabelObject) => status.label === VitalStatusLabel.DECEASED)
? VitalStatusOptionsLabel.deceasedAge
: VitalStatusOptionsLabel.age
}
/>
<DurationRange
value={age}
active={!birthdates[0] || !birthdates[1]}
onChange={(value) => setAge(value)}
onError={(isError) => setError(isError ? Error.INCOHERENT_AGE_ERROR : Error.NO_ERROR)}
deidentified={deidentified}
/>
</BlockWrapper>
)}
{!deidentified &&
vitalStatus &&
(vitalStatus.length === 0 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import SearchInput from 'components/ui/Searchbar/SearchInput'
import { BlockWrapper } from 'components/ui/Layout'
import OccurenceInput from 'components/ui/Inputs/Occurences'
import { SourceType } from 'types/scope'
import { USE_FHIR_EXTRA_SEARCH_PARAM } from 'constants.js'

const defaultComposition: Omit<DocumentDataType, 'id'> = {
type: CriteriaType.DOCUMENTS,
Expand Down Expand Up @@ -272,16 +273,18 @@ const DocumentsForm: React.FC<CriteriaDrawerComponentProps> = (props) => {
}}
/>

<FormControl variant="outlined" className={classes.inputItem}>
<Autocomplete
disableCloseOnSelect
multiple
onChange={(e, value) => _onChangeValue('docStatuses', value)}
options={docStatuses}
value={defaultValues.docStatuses || undefined}
renderInput={(params) => <TextField {...params} placeholder="Statut de documents" />}
/>
</FormControl>
{USE_FHIR_EXTRA_SEARCH_PARAM && (
<FormControl variant="outlined" className={classes.inputItem}>
<Autocomplete
disableCloseOnSelect
multiple
onChange={(e, value) => _onChangeValue('docStatuses', value)}
options={docStatuses}
value={defaultValues.docStatuses || undefined}
renderInput={(params) => <TextField {...params} placeholder="Statut de documents" />}
/>
</FormControl>
)}

<FormControl variant="outlined" className={classes.inputItem}>
<Autocomplete
Expand Down
Loading

0 comments on commit c60e1b7

Please sign in to comment.