-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OHRI-2252 Implement covid homepage dashboard workflows (#1883)
- Loading branch information
1 parent
ad6e23f
commit 20f8a30
Showing
3 changed files
with
129 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...esm-covid-app/src/covid/dashboard/patient-list-tabs/covid-patient-list-schema-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{ | ||
"menuId": "covidHome", | ||
"tabDefinitions": [ | ||
{ | ||
"tabName": "All COVID-19 Clients", | ||
"cohortId": "clientsAssessedForCovid", | ||
"isReportingCohort": true, | ||
"cohortSlotName": "clients-assessed-for-covid-slot", | ||
"launchableForm": { | ||
"package": "covid", | ||
"name": "COVID Assessment Form", | ||
"actionText": "Edit case assessment form", | ||
"targetDashboard": "covid-assessments" | ||
}, | ||
"associatedEncounterType": "covid_Assessment_EncounterUUID", | ||
"excludeColumns": ["timeAddedToList", "waitingTime", "location", "phoneNumber", "hivResult"], | ||
"otherColumns": [ | ||
{ | ||
"id": "assessmentDate", | ||
"title": "Assessment date", | ||
"type": "encounterDate", | ||
"index": 1 | ||
}, | ||
{ | ||
"id": "finalAssessment", | ||
"title": "Final result", | ||
"concept": "rapidTestResult" | ||
}, | ||
{ | ||
"id": "outcome", | ||
"title": "Outcome", | ||
"concept": "covidOutcome" | ||
} | ||
] | ||
}, | ||
{ | ||
"tabName": "Pending lab results", | ||
"cohortId": "covidClientsWithPendingLabResults", | ||
"isReportingCohort": true, | ||
"cohortSlotName": "pending-covid-lab-results-slot", | ||
"launchableForm": { | ||
"package": "covid", | ||
"name": "COVID Lab Test", | ||
"actionText": "Enter test result", | ||
"targetDashboard": "covid-lab-results" | ||
}, | ||
"associatedEncounterType": "covid_Assessment_EncounterUUID", | ||
"excludedColumns": ["timeAddedToList", "waitingTime", "location", "phoneNumber", "hivResult"], | ||
"otherColumns": [ | ||
{ | ||
"id": "testDate", | ||
"isDate": true, | ||
"title": "Test date", | ||
"concept": "dateSpecimenCollected", | ||
"index": 1 | ||
}, | ||
{ | ||
"id": "testType", | ||
"title": "Test type", | ||
"concept": "covidTestType" | ||
} | ||
] | ||
}, | ||
{ | ||
"tabName": "Scheduled Vaccination", | ||
"cohortId": "covidVaccinatedClients", | ||
"isReportingCohort": true, | ||
"cohortSlotName": "clients-vaccinated-for-covid-slot", | ||
"launchableForm": { | ||
"package": "covid", | ||
"name": "COVID Vaccination Form", | ||
"actionText": "Edit covid vaccination form", | ||
"targetDashboard": "covid_vaccination" | ||
}, | ||
"associatedEncounterType": "covidVaccinationEncounterUUID", | ||
"excludedColumns": ["timeAddedToList", "waitingTime", "location", "phoneNumber", "hivResult"], | ||
"otherColumns": [ | ||
{ | ||
"id": "lastDoseAdministered", | ||
"title": "Last dose administered", | ||
"concept": "covidVaccinationDose_UUID", | ||
"index": 1 | ||
}, | ||
{ | ||
"id": "vaccine", | ||
"title": "Vaccine", | ||
"type": "vaccination", | ||
"concept": "covidVaccineAdministeredConcept_UUID", | ||
"fallbackConcepts": ["covidVaccineConcept_UUID"] | ||
}, | ||
{ | ||
"id": "returnVisitDate", | ||
"isDate": true, | ||
"title": "Return visit date", | ||
"concept": "returnVisitDateConcept" | ||
} | ||
] | ||
} | ||
] | ||
} |
155 changes: 5 additions & 150 deletions
155
...esm-covid-app/src/covid/dashboard/patient-list-tabs/covid-patient-list-tabs.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,162 +1,17 @@ | ||
import React, { useMemo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import React from 'react'; | ||
import { | ||
findObs, | ||
getObsFromEncounter, | ||
getObsFromEncounters, | ||
getPatientListTabsData, | ||
OHRIPatientListTabs, | ||
} from '@ohri/openmrs-esm-ohri-commons-lib'; | ||
import { moduleName } from '../../../index'; | ||
import { useConfig } from '@openmrs/esm-framework'; | ||
import dayjs from 'dayjs'; | ||
import covidPatientListConfig from './covid-patient-list-schema-config.json'; | ||
|
||
function CovidHomePatientTabs() { | ||
const { t } = useTranslation(); | ||
const config = useConfig(); | ||
const patientListTabs = getPatientListTabsData(covidPatientListConfig, config); | ||
|
||
const tabsConfigs = useMemo( | ||
() => [ | ||
{ | ||
label: t('allCTClients', 'All COVID-19 Clients'), | ||
cohortId: config.cohorts.clientsAssessedForCovid, | ||
isReportingCohort: true, | ||
cohortSlotName: 'clients-assessed-for-covid-slot', | ||
launchableForm: { | ||
editActionText: t('editAssessmentForm', 'Edit case assessment form'), | ||
editLatestEncounter: true, | ||
targetDashboard: 'covid-assessments', | ||
name: 'COVID Assessment Form', | ||
}, | ||
associatedEncounterType: config.obsConcepts.covidCaseAssessmentEncType, | ||
excludeColumns: ['timeAddedToList', 'waitingTime', 'location', 'phoneNumber', 'hivResult'], | ||
otherColumns: [ | ||
{ | ||
key: 'assessmentDate', | ||
header: t('assessmentDate', 'Assessment date'), | ||
getValue: ({ latestEncounter }) => { | ||
return latestEncounter && dayjs(latestEncounter.encounterDatetime).format('DD-MMM-YYYY'); | ||
}, | ||
index: 3, | ||
}, | ||
{ | ||
key: 'finalAssessment', | ||
header: t('finalResults', 'Final result'), | ||
getValue: ({ latestExtraEncounters }) => { | ||
const pcrResult = getObsFromEncounters(latestExtraEncounters, config.obsConcepts.pcrTestResult); | ||
return pcrResult && pcrResult != '--' | ||
? pcrResult | ||
: getObsFromEncounters(latestExtraEncounters, config.obsConcepts.rapidTestResult); | ||
}, | ||
}, | ||
{ | ||
key: 'outcome', | ||
header: t('outcome', 'Outcome'), | ||
getValue: ({ latestEncounter }) => { | ||
return getObsFromEncounter(latestEncounter, config.obsConcepts.covidOutcome); | ||
}, | ||
}, | ||
], | ||
extraAssociatedEncounterTypes: [config.obsConcepts.covidLabTestEncType], | ||
}, | ||
{ | ||
label: t('pendingLabResults', 'Pending lab results'), | ||
cohortId: config.cohorts.covidClientsWithPendingLabResults, | ||
isReportingCohort: true, | ||
cohortSlotName: 'pending-covid-lab-results-slot', | ||
launchableForm: { | ||
name: 'COVID Lab Test', | ||
editActionText: 'Enter test result', | ||
editLatestEncounter: true, | ||
targetDashboard: 'covid-lab-results', | ||
}, | ||
excludeColumns: ['timeAddedToList', 'waitingTime', 'location', 'phoneNumber', 'hivResult'], | ||
associatedEncounterType: config.obsConcepts.covidCaseAssessmentEncType, | ||
otherColumns: [ | ||
{ | ||
key: 'testDate', | ||
header: t('testDate', 'Test Date'), | ||
getValue: ({ latestEncounter }) => { | ||
return getObsFromEncounter(latestEncounter, config.obsConcepts.dateSpecimenCollected, true); | ||
}, | ||
}, | ||
{ | ||
key: 'testType', | ||
header: t('testType', 'Test Type'), | ||
getValue: ({ latestEncounter }) => { | ||
return getObsFromEncounter(latestEncounter, config.obsConcepts.covidTestType); | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
label: t('scheduledVaccination', 'Scheduled Vaccination'), | ||
cohortId: config.obsConcepts.covidVaccinatedClients, | ||
isReportingCohort: true, | ||
cohortSlotName: 'clients-vaccinated-for-covid-slot', | ||
launchableForm: { | ||
name: 'COVID Vaccination Form', | ||
editActionText: 'Edit covid vaccination form', | ||
editLatestEncounter: true, | ||
targetDashboard: 'covid_vaccination', | ||
}, | ||
associatedEncounterType: config.obsConcepts.covidVaccinationEncType, | ||
excludeColumns: ['timeAddedToList', 'waitingTime', 'location', 'phoneNumber', 'hivResult'], | ||
otherColumns: [ | ||
{ | ||
key: 'lastDoseAdministered', | ||
header: t('lastDoseAdministered', 'Last Dose Administered'), | ||
getValue: ({ latestEncounter }) => { | ||
return getObsFromEncounter(latestEncounter, config.obsConcepts.covidVaccinationDose_UUID); | ||
}, | ||
}, | ||
{ | ||
key: 'vaccine', | ||
header: t('vaccine', 'Vaccine'), | ||
getValue: ({ latestEncounter }) => { | ||
const obs = findObs(latestEncounter, config.obsConcepts.covidVaccineAdministeredConcept_UUID); | ||
if (typeof obs !== 'undefined' && obs) { | ||
if (typeof obs.value === 'object') { | ||
const vaccineNAME = | ||
obs.value.names?.find((conceptName) => conceptName.conceptNameType === 'SHORT')?.name || | ||
obs.value.name.name; | ||
if (vaccineNAME === 'Other non-coded') { | ||
return getObsFromEncounter(latestEncounter, config.obsConcepts.covidVaccineConcept_UUID); | ||
} | ||
} | ||
} | ||
return getObsFromEncounter(latestEncounter, config.obsConcepts.covidVaccineAdministeredConcept_UUID); | ||
}, | ||
}, | ||
{ | ||
key: 'returnVisitDate', | ||
header: t('returnVisitDate', 'Return Visit Date'), | ||
getValue: ({ latestEncounter }) => { | ||
return getObsFromEncounter(latestEncounter, config.obsConcepts.returnVisitDateConcept, true); | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
[ | ||
config.cohorts.clientsAssessedForCovid, | ||
config.cohorts.covidClientsWithPendingLabResults, | ||
config.obsConcepts.covidCaseAssessmentEncType, | ||
config.obsConcepts.covidLabTestEncType, | ||
config.obsConcepts.covidOutcome, | ||
config.obsConcepts.covidTestType, | ||
config.obsConcepts.covidVaccinatedClients, | ||
config.obsConcepts.covidVaccinationDose_UUID, | ||
config.obsConcepts.covidVaccinationEncType, | ||
config.obsConcepts.covidVaccineAdministeredConcept_UUID, | ||
config.obsConcepts.covidVaccineConcept_UUID, | ||
config.obsConcepts.dateSpecimenCollected, | ||
config.obsConcepts.pcrTestResult, | ||
config.obsConcepts.rapidTestResult, | ||
config.obsConcepts.returnVisitDateConcept, | ||
t, | ||
], | ||
); | ||
return <OHRIPatientListTabs patientListConfigs={tabsConfigs} moduleName={moduleName} />; | ||
return <OHRIPatientListTabs patientListConfigs={patientListTabs} moduleName={moduleName} />; | ||
} | ||
|
||
export default CovidHomePatientTabs; |