Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OHRI-2233: Use concept keys from the default schema in TB/TPT #1871

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { getObsFromEncounter, getConditionalConceptValue } from './encounter-list-utils';
import { extractSchemaValues, replaceWithConfigDefaults } from './schema-manipulation';

export const getSummaryCardProps = (schemaConfig) => {
const columns = schemaConfig.columns?.map((column) => ({
export const getSummaryCardProps = (schemaConfig, config = null) => {
const configDefaults = extractSchemaValues(config);
const transformedSchemaConfig = replaceWithConfigDefaults(schemaConfig, configDefaults);
const columns = transformedSchemaConfig.columns?.map((column) => ({
key: column.id,
header: column.title,
concept: column.concept,
Expand Down
2 changes: 2 additions & 0 deletions packages/esm-tb-app/src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const configSchema = {
tbfollowUpForm: 'TB Follow-up Form',
tbPatientTracingForm: 'TB Patient Tracing Form',
tbContactListingForm: 'TB Contact Listing',
TbCaseEnrolmentFormName: 'TB Case Enrollment Form',
},
},
formUuids: {
Expand All @@ -92,6 +93,7 @@ export const configSchema = {
tbFollowUpFormUuid: '79b05c37-0def-4482-a345-c63b99fbd565',
tbPatientTracingFormUuid: 'ac3cbd10-1939-3797-9de6-2a39dfb68441',
tbContactListingFormUuid: 'cb16d920-62f1-3696-b781-e6a4f5e80de1',
tbCaseEnrolmentFormUuid: '554b2017-e512-3fc8-9c6e-7baf9e69db9d',
},
},
};
Expand Down
38 changes: 19 additions & 19 deletions packages/esm-tb-app/src/views/patient-summary/recent-tb-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,72 @@
"id": "caseID",
"title": "Case ID",
"encounterTypes": [
"9a199b59-b185-485b-b9b3-a9754e65ae57"
"tbProgramEnrollment"
],
"concept": "162576AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "caseID"
},
{
"id": "enrollmentDate",
"isDate": true,
"title": "Enrollment Date",
"encounterTypes": [
"9a199b59-b185-485b-b9b3-a9754e65ae57"
"tbProgramEnrollment"
],
"concept": "161552AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "enrollmentDate"
},
{
"id": "type",
"title": "Type",
"encounterTypes": [
"9a199b59-b185-485b-b9b3-a9754e65ae57"
"tbProgramEnrollment"
],
"concept": "159990AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "type"
},
{
"id": "site",
"title": "Site",
"encounterTypes": [
"9a199b59-b185-485b-b9b3-a9754e65ae57"
"tbProgramEnrollment"
],
"concept": "160040AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "site"
},
{
"id": "drugSensitivity",
"title": "Drug Sensitivity",
"encounterTypes": [
"9a199b59-b185-485b-b9b3-a9754e65ae57"
"tbProgramEnrollment"
],
"concept": "164368AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "drugSensitivity"
},
{
"id": "regimen",
"title": "Regimen",
"encounterTypes": [
"9a199b59-b185-485b-b9b3-a9754e65ae57"
"tbProgramEnrollment"
],
"isConditionalConcept": true,
"conditionalConceptMappings": {
"trueConcept": "16fd7307-0b26-4c8b-afa3-8362baff4042",
"nonTrueConcept": "159909AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"dependantConcept": "163775AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"conditionalConcept": "160541AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"trueConcept": "dSregimen",
"nonTrueConcept": "dRregimen",
"dependantConcept": "tBEnrollmentType",
"conditionalConcept": "dsTBEnrollment"
}
},
{
"id": "hivStatus",
"title": "HIV Status",
"encounterTypes": [
"9a199b59-b185-485b-b9b3-a9754e65ae57"
"tbProgramEnrollment"
],
"concept": "159576AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "hivStatus"
},
{
"id": "outcome",
"title": "Outcome",
"encounterTypes": [
"9a199b59-b185-485b-b9b3-a9754e65ae57"
"tbProgramEnrollment"
],
"concept": "159786AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "outcome"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getSummaryCardProps,
} from '@ohri/openmrs-esm-ohri-commons-lib';
import React from 'react';
import { useConfig } from '@openmrs/esm-framework';
import previousCasesConfigSchema from './previous-cases-config.json';
import tbVisitsConfigSchema from './visits-config.json';
import recentTuberculosisConfigSchema from './recent-tb-config.json';
Expand All @@ -14,9 +15,10 @@ interface OverviewListProps {
}

const TBSummaryOverviewList: React.FC<OverviewListProps> = ({ patientUuid }) => {
const previousCaseTabs = getMenuItemTabConfiguration(previousCasesConfigSchema);
const tbVisitsTabs = getMenuItemTabConfiguration(tbVisitsConfigSchema);
const summaryCardColumns = getSummaryCardProps(recentTuberculosisConfigSchema);
const config = useConfig();
const previousCaseTabs = getMenuItemTabConfiguration(previousCasesConfigSchema, config);
const tbVisitsTabs = getMenuItemTabConfiguration(tbVisitsConfigSchema, config);
const summaryCardColumns = getSummaryCardProps(recentTuberculosisConfigSchema, config);

return (
<>
Expand Down
18 changes: 9 additions & 9 deletions packages/esm-tb-app/src/views/patient-summary/visits-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@
"tabName": "Visits",
"headerTitle": "Visits",
"displayText": "Visits",
"encounterType": "1881304a-4854-4927-b0b1-a6231d61e43c",
"encounterType": "tbTreatmentAndFollowUp",
"columns": [
{
"id": "caseID",
"title": "Case ID",
"concept": "162576AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "caseID"
},
{
"id": "dateOfVisit",
"isDate": true,
"title": "Date of Visit",
"concept": "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "visitDate"
},
{
"id": "monthOfVisit",
"title": "Month of Visit",
"concept": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "monthOfTreatment"
},
{
"id": "adherence",
"title": "Adherence",
"concept": "164075AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "adherenceAssessment"
},
{
"id": "adverseDrugReaction",
"title": "Adverse Drug Reaction",
"concept": "160646AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "ADR"
},
{
"id": "nextAppointment",
"isDate": true,
"title": "Next Appointment",
"concept": "5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "tptAppointmentDate"
}
],
"launchOptions": {
Expand All @@ -47,8 +47,8 @@
},
"formList": [
{
"name": "TPT Followup & Treatment form",
"uuid": "6212bb87-766e-33d0-b37b-79f019008492"
"name": "TptTreatmentFormName",
"uuid": "tptTreatmentFormUuid"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
"tabName": "TB/MDR TB Enrolment",
"headerTitle": "TB/MDR TB Enrolment",
"displayText": "TB/MDR TB Enrolment",
"encounterType": "9a199b59-b185-485b-b9b3-a9754e65ae57",
"encounterType": "tbProgramEnrollment",
"columns": [
{
"id": "enrollmentDate",
"isDate": true,
"title": "Enrollment Date",
"concept": "161552AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "enrollmentDate"
},
{
"id": "caseID",
"title": "Case ID",
"concept": "162576AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "caseID"
},
{
"id": "tbTreatmentId",
"title": "TB Treatment ID",
"isConditionalConcept": true,
"conditionalConceptMappings": {
"trueConcept": "161654AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"nonTrueConcept": "164415AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"dependantConcept": "163775AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"conditionalConcept": "160541AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"trueConcept": "dSTreatmentId",
"nonTrueConcept": "dRTreatmentId",
"dependantConcept": "tBEnrollmentType",
"conditionalConcept": "dsTBEnrollment"
}
},
{
Expand All @@ -35,46 +35,46 @@
"title": "Treatment Start Date",
"isConditionalConcept": true,
"conditionalConceptMappings": {
"trueConcept": "1113AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"nonTrueConcept": "164416AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"dependantConcept": "163775AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"conditionalConcept": "160541AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"trueConcept": "dSTreatmentStartDate",
"nonTrueConcept": "dRTreatmentStartDate",
"dependantConcept": "tBEnrollmentType",
"conditionalConcept": "dsTBEnrollment"
}
},
{
"id": "regimen",
"title": "Regimen",
"isConditionalConcept": true,
"conditionalConceptMappings": {
"trueConcept": "16fd7307-0b26-4c8b-afa3-8362baff4042",
"nonTrueConcept": "159909AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"dependantConcept": "163775AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"conditionalConcept": "160541AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"trueConcept": "dSregimen",
"nonTrueConcept": "dRregimen",
"dependantConcept": "tBEnrollmentType",
"conditionalConcept": "dsTBEnrollment"
}
},
{
"id": "treatmentOutcome",
"title": "Treatment Outcome",
"concept": "159786AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "outcome"
},
{
"id": "dateOfTreatmentOutcome",
"isDate": true,
"title": "Date of Treatment Outcome",
"concept": "159787AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "DateOfTreatmentOutcome"
},
{
"id": "actions",
"title": "Actions",
"actionOptions": [
{
"formName": "TB Case Enrollment Form",
"formName": "TbCaseEnrolmentFormName",
"package": "tb",
"label": "View Details",
"mode": "view"
},
{
"formName": "TB Case Enrollment Form",
"formName": "TbCaseEnrolmentFormName",
"package": "tb",
"label": "Edit Form",
"mode": "edit"
Expand All @@ -88,40 +88,40 @@
},
"formList": [
{
"name": "TB Case Enrollment Form",
"uuid": "554b2017-e512-3fc8-9c6e-7baf9e69db9d"
"name": "TbCaseEnrolmentFormName",
"uuid": "tbCaseEnrolmentFormUuid"
}
]
},
{
"tabName": "Patient Tracing",
"headerTitle": "Patient Tracing",
"displayText": "Patient Tracing",
"encounterType": "98c938e9-fb3e-4982-ae22-0305cbd12f8c",
"encounterType": "tbPatientTracing",
"columns": [
{
"id": "contactDate",
"isDate": true,
"title": "Contact Date",
"concept": "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "dateContacted"
},
{
"id": "contactMethod",
"title": "Contact Method",
"concept": "166456AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"concept": "modeOfContact"
},
{
"id": "actions",
"title": "Actions",
"actionOptions": [
{
"formName": "TB Patient Tracing Form",
"formName": "tbPatientTracingForm",
"package": "tpt",
"label": "View Details",
"mode": "view"
},
{
"formName": "TB Patient Tracing Form",
"formName": "tbPatientTracingForm",
"package": "tpt",
"label": "Edit Forms",
"mode": "edit"
Expand All @@ -135,8 +135,8 @@
},
"formList": [
{
"name": "TB Patient Tracing Form",
"uuid": "ac3cbd10-1939-3797-9de6-2a39dfb68441"
"name": "tbPatientTracingForm",
"uuid": "tbPatientTracingFormUuid"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { useConfig } from '@openmrs/esm-framework';
import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react';
import styles from '../common.scss';
import { PatientChartProps, getMenuItemTabConfiguration, EncounterList } from '@ohri/openmrs-esm-ohri-commons-lib';
Expand All @@ -8,7 +9,8 @@ interface OverviewListProps {
}

const ProgramManagementSummary: React.FC<PatientChartProps> = ({ patientUuid }) => {
const tabs = getMenuItemTabConfiguration(tptProgramManagemetConfigSchema);
const config = useConfig();
const tabs = getMenuItemTabConfiguration(tptProgramManagemetConfigSchema, config);

return (
<div className={styles.tabContainer}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { useConfig } from '@openmrs/esm-framework';
import { EncounterList, getMenuItemTabConfiguration } from '@ohri/openmrs-esm-ohri-commons-lib';
import tbFollowupConfigSchema from './tb-contact-listing-config.json';

Expand All @@ -7,7 +8,8 @@ interface OverviewListProps {
}

const TbContactTracingList: React.FC<OverviewListProps> = ({ patientUuid }) => {
const tabs = getMenuItemTabConfiguration(tbFollowupConfigSchema);
const config = useConfig();
const tabs = getMenuItemTabConfiguration(tbFollowupConfigSchema, config);

return (
<>
Expand Down
Loading
Loading