Skip to content

Commit

Permalink
fix: resolve unknown chipset into patient data table
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehdi-BOUYAHIA committed Jun 1, 2023
1 parent 29e124c commit be9f3da
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 24 deletions.
12 changes: 0 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/components/Dashboard/PatientList/PatientList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ const PatientList: React.FC<PatientListProps> = ({
const [open, setOpen] = useState(false)

const [filters, setFilters] = useState<PatientFiltersType>({
gender: PatientGenderKind._unknown,
gender: null,
birthdatesRanges: ['', ''],
vitalStatus: VitalStatus.all
vitalStatus: null
})

const [order, setOrder] = useState<Order>({
Expand Down Expand Up @@ -166,7 +166,7 @@ const PatientList: React.FC<PatientListProps> = ({
case 'gender':
setFilters((prevFilters) => ({
...prevFilters,
gender: PatientGenderKind._unknown
gender: null
}))
break
case 'birthdates':
Expand Down
2 changes: 1 addition & 1 deletion src/services/aphp/callApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type fetchPatientProps = {
offset?: number
_sort?: string
sortDirection?: 'asc' | 'desc'
gender?: string
gender?: string | null
minBirthdate?: number
maxBirthdate?: number
searchBy?: string
Expand Down
4 changes: 2 additions & 2 deletions src/services/aphp/serviceCohorts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ export interface IServiceCohorts {
page: number,
searchBy: SearchByTypes,
searchInput: string,
gender: PatientGenderKind,
gender: PatientGenderKind | null,
birthdates: [string, string],
vitalStatus: VitalStatus,
vitalStatus: VitalStatus | null,
sortBy: string,
sortDirection: string,
deidentified: boolean,
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ export type PMSIFilters = {
}

export type PatientFilters = {
gender: PatientGenderKind
gender: PatientGenderKind | null
birthdatesRanges: [string, string]
vitalStatus: VitalStatus
vitalStatus: VitalStatus | null
}

export type ObservationFilters = {
Expand Down
9 changes: 5 additions & 4 deletions src/utils/patient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PatientGenderKind, VitalStatus } from 'types'

export const genderName = (gender: PatientGenderKind): string => {
export const genderName = (gender: PatientGenderKind | null): string | null => {
switch (gender) {
case PatientGenderKind._female:
return 'Genre: Femmes'
Expand All @@ -9,18 +9,19 @@ export const genderName = (gender: PatientGenderKind): string => {
case PatientGenderKind._other:
return 'Genre: Autre'
case PatientGenderKind._unknown:
default:
return 'Genre: Inconnu'
default:
return null
}
}

export const vitalStatusName = (vitalStatus: VitalStatus): string => {
export const vitalStatusName = (vitalStatus: VitalStatus | null): string | null => {
switch (vitalStatus) {
case VitalStatus.alive:
return 'Patients vivants'
case VitalStatus.deceased:
return 'Patients décédés'
default:
return 'Statut vital: Inconnu'
return null
}
}

0 comments on commit be9f3da

Please sign in to comment.