From 353ac7ada12acdfd049b96f72c356e3e335e7b8f Mon Sep 17 00:00:00 2001 From: Boban Ljuljdjurovic Date: Thu, 21 Sep 2023 13:00:01 -0400 Subject: [PATCH 1/6] remove multiplex feature flag from download results modal --- .../testResults/DownloadResultsCsvModal.tsx | 9 +-- frontend/src/app/utils/testResultCSV.test.ts | 62 +++++++------------ frontend/src/app/utils/testResultCSV.ts | 20 +++--- 3 files changed, 32 insertions(+), 59 deletions(-) diff --git a/frontend/src/app/testResults/DownloadResultsCsvModal.tsx b/frontend/src/app/testResults/DownloadResultsCsvModal.tsx index 524d21f0df..a51a3d8211 100644 --- a/frontend/src/app/testResults/DownloadResultsCsvModal.tsx +++ b/frontend/src/app/testResults/DownloadResultsCsvModal.tsx @@ -3,7 +3,6 @@ import Modal from "react-modal"; import { faDownload } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { CSVLink } from "react-csv"; -import { useFeature } from "flagged"; import { ApolloError } from "@apollo/client"; import { showError } from "../utils/srToast"; @@ -36,7 +35,6 @@ export const DownloadResultsCsvModal = ({ const csvLink = useRef< CSVLink & HTMLAnchorElement & { link: HTMLAnchorElement } >(null); - const multiplexEnabled = useFeature("multiplexEnabled") as boolean; // Disable downloads because backend will hang on over 20k results (#3953) const disableDownload = totalEntries > rowsMaxLimit; @@ -69,11 +67,8 @@ export const DownloadResultsCsvModal = ({ }); const handleComplete = (data: GetFacilityResultsForCsvWithCountQuery) => { - if (data.testResultsPage && data.testResultsPage.content) { - const csvResults = parseDataForCSV( - data.testResultsPage.content, - multiplexEnabled - ); + if (data?.testResultsPage?.content) { + const csvResults = parseDataForCSV(data.testResultsPage.content); setResults(csvResults); } else { showError("Unknown error downloading results"); diff --git a/frontend/src/app/utils/testResultCSV.test.ts b/frontend/src/app/utils/testResultCSV.test.ts index 66c9fad32c..d2c33b1148 100644 --- a/frontend/src/app/utils/testResultCSV.test.ts +++ b/frontend/src/app/utils/testResultCSV.test.ts @@ -1,5 +1,3 @@ -import { cloneDeep } from "lodash"; - import { parseDataForCSV } from "./testResultCSV"; const data = [ @@ -17,6 +15,18 @@ const data = [ }, testResult: "NEGATIVE", }, + { + disease: { + name: "Flu A", + }, + testResult: "NEGATIVE", + }, + { + disease: { + name: "Flu B", + }, + testResult: "NEGATIVE", + }, ], correctionStatus: "REMOVED", reasonForCorrection: "DUPLICATE_TEST", @@ -103,53 +113,23 @@ const result = [ "Test correction reason": "DUPLICATE_TEST", "Test correction status": "REMOVED", "Test date": "06/13/2022 7:24pm", + "Flu A result": "Negative", + "Flu B result": "Negative", }, ]; describe("parseDataForCSV", () => { - it("parses non-multiplex data", () => { - const multiplexEnabled = false; - expect(parseDataForCSV(data, multiplexEnabled)).toEqual(result); - }); - it("parses multiplex data", () => { - const multiplexData = cloneDeep(data); - multiplexData[0]["results"].push( - { - disease: { - name: "Flu A", - }, - testResult: "NEGATIVE", - }, - { - disease: { - name: "Flu B", - }, - testResult: "NEGATIVE", - } - ); - const multiplexEnabled = true; - const multiplexResult = cloneDeep(result); - // @ts-ignore - multiplexResult[0]["Flu A result"] = "Negative"; - // @ts-ignore - multiplexResult[0]["Flu B result"] = "Negative"; - expect(parseDataForCSV(multiplexData, multiplexEnabled)).toEqual( - multiplexResult - ); + expect(parseDataForCSV(data)).toEqual(result); }); it("parse data does not fail if tribalAffiliation is null", () => { - const multiplexEnabled = false; expect( - parseDataForCSV( - [ - { - ...data[0], - patient: { ...data[0].patient, tribalAffiliation: null }, - }, - ], - multiplexEnabled - ) + parseDataForCSV([ + { + ...data[0], + patient: { ...data[0].patient, tribalAffiliation: null }, + }, + ]) ).toEqual(result); }); }); diff --git a/frontend/src/app/utils/testResultCSV.ts b/frontend/src/app/utils/testResultCSV.ts index ee6dab55fb..190b765cf3 100644 --- a/frontend/src/app/utils/testResultCSV.ts +++ b/frontend/src/app/utils/testResultCSV.ts @@ -8,7 +8,7 @@ import { getResultByDiseaseName } from "./testResults"; import { displayFullName, facilityDisplayName } from "./index"; -export function parseDataForCSV(data: any[], multiplexEnabled: boolean) { +export function parseDataForCSV(data: any[]) { return data.sort(byDateTested).map((r: any) => { const symptomList = r.symptoms ? symptomsStringToArray(r.symptoms) : []; @@ -27,16 +27,14 @@ export function parseDataForCSV(data: any[], multiplexEnabled: boolean) { TEST_RESULT_DESCRIPTIONS[ getResultByDiseaseName(r.results, "COVID-19") as Results ], - ...(multiplexEnabled && { - "Flu A result": - TEST_RESULT_DESCRIPTIONS[ - getResultByDiseaseName(r.results, "Flu A") as Results - ], - "Flu B result": - TEST_RESULT_DESCRIPTIONS[ - getResultByDiseaseName(r.results, "Flu B") as Results - ], - }), + "Flu A result": + TEST_RESULT_DESCRIPTIONS[ + getResultByDiseaseName(r.results, "Flu A") as Results + ], + "Flu B result": + TEST_RESULT_DESCRIPTIONS[ + getResultByDiseaseName(r.results, "Flu B") as Results + ], "Result reported date": moment(r.dateUpdated).format("MM/DD/YYYY h:mma"), "Test correction status": r.correctionStatus, "Test correction reason": r.reasonForCorrection, From ae47dd1769c0d9debc8af6c3be8662199f171448 Mon Sep 17 00:00:00 2001 From: Boban Ljuljdjurovic Date: Thu, 21 Sep 2023 14:19:21 -0400 Subject: [PATCH 2/6] remove multiplexEnabled from TestResultsList.tsx --- .../app/commonComponents/TestResultsList.tsx | 18 ++++++++---------- .../app/testResults/TestResultPrintModal.tsx | 6 +----- .../src/patientApp/timeOfTest/TestResult.tsx | 1 - 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/frontend/src/app/commonComponents/TestResultsList.tsx b/frontend/src/app/commonComponents/TestResultsList.tsx index 1afbcd3a28..4d6939d789 100644 --- a/frontend/src/app/commonComponents/TestResultsList.tsx +++ b/frontend/src/app/commonComponents/TestResultsList.tsx @@ -9,10 +9,9 @@ import { } from "../utils/testResults"; import { MULTIPLEX_DISEASES, TEST_RESULTS } from "../testResults/constants"; -interface Props { +interface TestResultsListProps { results: MultiplexResults; isPatientApp: boolean; - multiplexEnabled: boolean; } const setDiseaseName = (diseaseName: MultiplexDisease, t: translateFn) => { @@ -92,16 +91,15 @@ const pxpAppResultListItem = ( ); }; -const TestResultsList = (props: Props) => { - const results = props.results; - const multiplexEnabled = props.multiplexEnabled; - const isPatientApp = props.isPatientApp; +const TestResultsList: React.FC = ({ + results, + isPatientApp, +}) => { const { t } = useTranslation(); - const sortedTestResults = - multiplexEnabled && hasMultiplexResults(results) - ? getSortedResults(results) - : [getResultObjByDiseaseName(results, "COVID-19")]; + const sortedTestResults = hasMultiplexResults(results) + ? getSortedResults(results) + : [getResultObjByDiseaseName(results, "COVID-19")]; return ( <> diff --git a/frontend/src/app/testResults/TestResultPrintModal.tsx b/frontend/src/app/testResults/TestResultPrintModal.tsx index 3244ac7988..5c36e64b44 100644 --- a/frontend/src/app/testResults/TestResultPrintModal.tsx +++ b/frontend/src/app/testResults/TestResultPrintModal.tsx @@ -182,11 +182,7 @@ export const StaticTestResultModal = ({ {t("testResult.testDate")}
{formatDateWithTimeOption(dateTested, true)}
- + {(haCovidResults(results) || hasPositiveFluResults(results)) && ( diff --git a/frontend/src/patientApp/timeOfTest/TestResult.tsx b/frontend/src/patientApp/timeOfTest/TestResult.tsx index 9bfccd3f8c..1b7839459c 100644 --- a/frontend/src/patientApp/timeOfTest/TestResult.tsx +++ b/frontend/src/patientApp/timeOfTest/TestResult.tsx @@ -74,7 +74,6 @@ const TestResult = () => {
From bb2fa6c5388b1031e7bf28190c9f97316a52661c Mon Sep 17 00:00:00 2001 From: Boban Ljuljdjurovic Date: Thu, 21 Sep 2023 15:33:17 -0400 Subject: [PATCH 3/6] remove multiplexEnabled from MultiplexResultsGuidance --- .../app/commonComponents/MultiplexResultsGuidance.tsx | 11 +++++------ frontend/src/app/testResults/TestResultPrintModal.tsx | 1 - frontend/src/patientApp/timeOfTest/TestResult.tsx | 1 - 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/commonComponents/MultiplexResultsGuidance.tsx b/frontend/src/app/commonComponents/MultiplexResultsGuidance.tsx index 2b2549d356..ccd2d39e18 100644 --- a/frontend/src/app/commonComponents/MultiplexResultsGuidance.tsx +++ b/frontend/src/app/commonComponents/MultiplexResultsGuidance.tsx @@ -59,15 +59,14 @@ const PositiveFluResultInfo = ({ interface MultiplexResultsGuidanceProps { results: MultiplexResult[]; isPatientApp: boolean; - multiplexEnabled: boolean; } -const MultiplexResultsGuidance = (props: MultiplexResultsGuidanceProps) => { - const results = props.results; - const isPatientApp = props.isPatientApp; - const multiplexEnabled = props.multiplexEnabled; +const MultiplexResultsGuidance: React.FC = ({ + results, + isPatientApp, +}) => { const { t } = useTranslation(); const needsCovidHeading = haCovidResults(results); - const needsFluGuidance = multiplexEnabled && hasPositiveFluResults(results); + const needsFluGuidance = hasPositiveFluResults(results); const covidResult = getResultByDiseaseName(results, "COVID-19") as TestResult; return ( diff --git a/frontend/src/app/testResults/TestResultPrintModal.tsx b/frontend/src/app/testResults/TestResultPrintModal.tsx index 5c36e64b44..84d071434b 100644 --- a/frontend/src/app/testResults/TestResultPrintModal.tsx +++ b/frontend/src/app/testResults/TestResultPrintModal.tsx @@ -191,7 +191,6 @@ export const StaticTestResultModal = ({ )} diff --git a/frontend/src/patientApp/timeOfTest/TestResult.tsx b/frontend/src/patientApp/timeOfTest/TestResult.tsx index 1b7839459c..d0621cf153 100644 --- a/frontend/src/patientApp/timeOfTest/TestResult.tsx +++ b/frontend/src/patientApp/timeOfTest/TestResult.tsx @@ -86,7 +86,6 @@ const TestResult = () => { From 38e04c0ea1b1a05f77f64cdb4eb7d438d8274ff7 Mon Sep 17 00:00:00 2001 From: Boban Ljuljdjurovic Date: Thu, 21 Sep 2023 15:35:35 -0400 Subject: [PATCH 4/6] remove multiplexEnabled from TestResults.tsx --- frontend/src/patientApp/timeOfTest/TestResult.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/patientApp/timeOfTest/TestResult.tsx b/frontend/src/patientApp/timeOfTest/TestResult.tsx index d0621cf153..b1b1a3e125 100644 --- a/frontend/src/patientApp/timeOfTest/TestResult.tsx +++ b/frontend/src/patientApp/timeOfTest/TestResult.tsx @@ -1,7 +1,6 @@ import { useSelector } from "react-redux"; import { useTranslation } from "react-i18next"; import React from "react"; -import { useFeature } from "flagged"; import { formatFullName } from "../../app/utils/user"; import { RootState } from "../../app/store"; @@ -23,7 +22,6 @@ const TestResult = () => { const testResult = useSelector( (state) => state.testResult ); - const multiplexEnabled = useFeature("multiplexEnabled") as boolean; const isMultiplex = hasMultiplexResults(testResult.results); const fullName = formatFullName(testResult?.patient as any); const dateTested = formatDateWithTimeOption(testResult?.dateTested, true); @@ -47,7 +45,7 @@ const TestResult = () => {

- {multiplexEnabled && isMultiplex + {isMultiplex ? t("testResult.multiplexResultHeader") : t("testResult.covidResultHeader")}

From 4310241532a426a2d89838976af12ff7f86d3059 Mon Sep 17 00:00:00 2001 From: Boban Ljuljdjurovic Date: Thu, 21 Sep 2023 15:37:04 -0400 Subject: [PATCH 5/6] remove multiplexEnabled from TestResultPrintModal.tsx --- frontend/src/app/testResults/TestResultPrintModal.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/testResults/TestResultPrintModal.tsx b/frontend/src/app/testResults/TestResultPrintModal.tsx index 84d071434b..b7c112fe6a 100644 --- a/frontend/src/app/testResults/TestResultPrintModal.tsx +++ b/frontend/src/app/testResults/TestResultPrintModal.tsx @@ -2,7 +2,6 @@ import React from "react"; import Modal from "react-modal"; import classnames from "classnames"; import { useTranslation } from "react-i18next"; -import { useFeature } from "flagged"; import Button from "../commonComponents/Button/Button"; import MultiplexResultsGuidance from "../commonComponents/MultiplexResultsGuidance"; @@ -75,7 +74,6 @@ export const StaticTestResultModal = ({ results, dateTested, } = testResult; - const multiplexEnabled = useFeature("multiplexEnabled") as boolean; const isPatientApp = false; return ( @@ -87,7 +85,7 @@ export const StaticTestResultModal = ({ >

- {multiplexEnabled && hasMultiplexResults(results) + {hasMultiplexResults(results) ? t("testResult.multiplexResultHeader") : t("testResult.covidResultHeader")}

@@ -158,7 +156,7 @@ export const StaticTestResultModal = ({
  • {t("testResult.testingFacility.npi")}
    - {facility.orderingProvider.NPI || facility.orderingProvider.npi} + {facility.orderingProvider.NPI ?? facility.orderingProvider.npi}
  • @@ -198,7 +196,7 @@ export const StaticTestResultModal = ({

    {t("testResult.printed")}{" "} - {hardcodedPrintDate || new Date().toLocaleString()} + {hardcodedPrintDate ?? new Date().toLocaleString()}

    From 50331b0ea264a4e87e8e9b0c7b95016c67aace3d Mon Sep 17 00:00:00 2001 From: Boban Ljuljdjurovic Date: Thu, 21 Sep 2023 15:40:47 -0400 Subject: [PATCH 6/6] remove multiplexEnabled from TestResultDetailsModal.tsx --- frontend/src/app/testResults/TestResultDetailsModal.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/testResults/TestResultDetailsModal.tsx b/frontend/src/app/testResults/TestResultDetailsModal.tsx index ac9c69faf6..cffd28edff 100644 --- a/frontend/src/app/testResults/TestResultDetailsModal.tsx +++ b/frontend/src/app/testResults/TestResultDetailsModal.tsx @@ -1,7 +1,6 @@ import { gql } from "@apollo/client"; import Modal from "react-modal"; import classnames from "classnames"; -import { useFeature } from "flagged"; import iconClose from "../../img/close.svg"; import "./TestResultPrintModal.scss"; @@ -111,9 +110,7 @@ export const DetachedTestResultDetailsModal = ({ data, closeModal }: Props) => { ? getResultByDiseaseName(results, MULTIPLEX_DISEASES.COVID_19) : "UNKNOWN", }; - const multiplexFeatureFlagEnabled = useFeature("multiplexEnabled"); - const multiplexEnabled = - multiplexFeatureFlagEnabled && results && hasMultiplexResults(results); + const multiplexEnabled = results && hasMultiplexResults(results); if (multiplexEnabled) { displayResult["fluAResult"] = getResultByDiseaseName( results, @@ -234,7 +231,7 @@ export const DetachedTestResultDetailsModal = ({ data, closeModal }: Props) => { /> @@ -314,7 +311,7 @@ const DetailsRow = ({ {label} - {value || "--"} + {value ?? "--"} );