diff --git a/frontend/src/app/commonComponents/Checkboxes.tsx b/frontend/src/app/commonComponents/Checkboxes.tsx index 264f7ef058..5ab51d723f 100644 --- a/frontend/src/app/commonComponents/Checkboxes.tsx +++ b/frontend/src/app/commonComponents/Checkboxes.tsx @@ -89,7 +89,7 @@ const Checkboxes = (props: Props) => { return (
diff --git a/frontend/src/app/commonComponents/__snapshots__/Checkboxes.test.tsx.snap b/frontend/src/app/commonComponents/__snapshots__/Checkboxes.test.tsx.snap index ae27477316..b9890d541d 100644 --- a/frontend/src/app/commonComponents/__snapshots__/Checkboxes.test.tsx.snap +++ b/frontend/src/app/commonComponents/__snapshots__/Checkboxes.test.tsx.snap @@ -3,7 +3,7 @@ exports[`Checkboxes renders correctly 1`] = `
({ getAppInsights: jest.fn(), })); -const mockDiseaseEnabledFlag = (diseaseName: string) => +const mockDiseaseEnabledFlag = ( + diseaseName: string, + skipLowercase: boolean = false +) => jest .spyOn(flaggedMock, "useFeature") .mockImplementation((flagName: string) => { + // to handle casing of Hepatitis-C as hepatitisC + if (skipLowercase) { + return flagName === `${diseaseName}Enabled`; + } return flagName === `${diseaseName.toLowerCase()}Enabled`; }); @@ -255,6 +269,21 @@ const facilityInfo: QueriedFacility = { }, ], }, + { + internalId: device9Id, + name: device9Name, + testLength: 15, + supportedDiseaseTestPerformed: [ + ...mockSupportedDiseaseTestPerformedHepatitisC, + ], + swabTypes: [ + { + name: specimen3Name, + internalId: specimen3Id, + typeCode: "122555007", + }, + ], + }, ], }; export const devicesMap = new Map(); @@ -1295,6 +1324,175 @@ describe("TestCard", () => { ).not.toBeInTheDocument(); }); + it("shows radio buttons for Hepatitis C when a hepatitis c device is chosen", async function () { + mockDiseaseEnabledFlag("hepatitisC", true); + + const mocks = [ + generateEditQueueMock( + MULTIPLEX_DISEASES.HEPATITIS_C, + TEST_RESULTS.POSITIVE + ), + blankUpdateAoeEventMock, + ]; + + const { user } = await renderQueueItem({ mocks }); + expect(screen.queryByText("Hepatitis-C result")).not.toBeInTheDocument(); + + const deviceDropdown = await getDeviceTypeDropdown(); + + await user.selectOptions(deviceDropdown, device9Name); + expect(screen.getByText("Hepatitis-C result")).toBeInTheDocument(); + }); + + it("shows required Hepatitis-C AOE questions when a positive Hepatitis-C result is present", async function () { + mockDiseaseEnabledFlag("hepatitisC", true); + + const mocks = [ + generateEditQueueMock( + MULTIPLEX_DISEASES.HEPATITIS_C, + TEST_RESULTS.POSITIVE + ), + blankUpdateAoeEventMock, + { + ...baseStiAoeUpdateMock({ + ...NO_SYMPTOMS_FALSE_OVERRIDE, + }), + ...mutationResponse, + }, + ]; + + const { user } = await renderQueueItem({ mocks }); + const deviceDropdown = await getDeviceTypeDropdown(); + expect(deviceDropdown.options.length).toEqual( + DEFAULT_DEVICE_OPTIONS_LENGTH + 1 + ); + + await user.selectOptions(deviceDropdown, device9Name); + expect(screen.getByText("Hepatitis-C result")).toBeInTheDocument(); + + await user.click( + screen.getByLabelText("Positive", { + exact: false, + }) + ); + + expect(screen.getByText("Is the patient pregnant?")).toBeInTheDocument(); + expect( + screen.getByText( + "Is the patient currently experiencing or showing signs of symptoms?" + ) + ).toBeInTheDocument(); + expect( + screen.getByText("What is the gender of their sexual partners?") + ).toBeInTheDocument(); + + const symptomFieldSet = screen.getByTestId( + `has-any-symptoms-${sharedTestOrderInfo.internalId}` + ); + await user.click(within(symptomFieldSet).getByLabelText("Yes")); + + expect( + screen.getByText("Select any symptoms the patient is experiencing") + ).toBeInTheDocument(); + }); + + it("hides AOE questions when there is no positive Hepatitis-C result", async function () { + mockDiseaseEnabledFlag("hepatitisC", true); + + const mocks = [ + generateEditQueueMock( + MULTIPLEX_DISEASES.HEPATITIS_C, + TEST_RESULTS.POSITIVE + ), + blankUpdateAoeEventMock, + ]; + + const { user } = await renderQueueItem({ mocks }); + const deviceDropdown = await getDeviceTypeDropdown(); + + await user.selectOptions(deviceDropdown, device9Name); + expect(screen.getByText("Hepatitis-C result")).toBeInTheDocument(); + expect( + screen.queryByText("Is the patient pregnant?") + ).not.toBeInTheDocument(); + expect( + screen.queryByText( + "Is the patient currently experiencing or showing signs of symptoms?" + ) + ).not.toBeInTheDocument(); + expect( + screen.queryByText("What is the gender of their sexual partners?") + ).not.toBeInTheDocument(); + + await user.click( + screen.getByLabelText("Inconclusive", { + exact: false, + }) + ); + expect( + screen.queryByText("Is the patient pregnant?") + ).not.toBeInTheDocument(); + expect( + screen.queryByText( + "Is the patient currently experiencing or showing signs of symptoms?" + ) + ).not.toBeInTheDocument(); + expect( + screen.queryByText("What is the gender of their sexual partners?") + ).not.toBeInTheDocument(); + }); + + it("checks that Hep C submission only works if AOE questions are valid", async function () { + mockDiseaseEnabledFlag("hepatitisC", true); + + const { user } = await renderQueueItem({ mocks: updateHepCAoeMocks }); + const deviceDropdown = await getDeviceTypeDropdown(); + + await user.selectOptions(deviceDropdown, device9Name); + await user.click( + screen.getByLabelText("Positive", { + exact: false, + }) + ); + await user.click( + screen.getByText("Submit results", { + exact: false, + }) + ); + const AOE_ERROR_TEXT = "Please answer this required question."; + + const requiredQuestions = screen.getAllByText(AOE_ERROR_TEXT); + expect(requiredQuestions.length).toEqual( + REQUIRED_AOE_QUESTIONS_BY_DISEASE.HEPATITIS_C.length + ); + + const pregnancyFieldSet = screen.getByTestId( + `pregnancy-${sharedTestOrderInfo.internalId}` + ); + await user.click(within(pregnancyFieldSet).getByLabelText("Yes")); + + const symptomFieldSet = screen.getByTestId( + `has-any-symptoms-${sharedTestOrderInfo.internalId}` + ); + await user.click(within(symptomFieldSet).getByLabelText("No")); + + const genderSexualPartnersFieldSet = screen.getByTestId( + `multi-select-option-list` + ); + await user.click( + within(genderSexualPartnersFieldSet).getByTestId( + "multi-select-option-female" + ) + ); + + await user.click( + screen.getByText("Submit results", { + exact: false, + }) + ); + expect(screen.queryByText(AOE_ERROR_TEXT)).not.toBeInTheDocument(); + }); + it("checks that submission only works if AOE questions are valid", async function () { mockDiseaseEnabledFlag("Syphilis"); diff --git a/frontend/src/app/testQueue/TestCardForm/TestCardForm.test.tsx b/frontend/src/app/testQueue/TestCardForm/TestCardForm.test.tsx index 5b4a7995b2..03c52e302e 100644 --- a/frontend/src/app/testQueue/TestCardForm/TestCardForm.test.tsx +++ b/frontend/src/app/testQueue/TestCardForm/TestCardForm.test.tsx @@ -12,6 +12,8 @@ import { fluDeviceId, fluDeviceName, generateSubmitQueueMock, + hepatitisCDeviceId, + hepatitisCDeviceName, hivDeviceId, hivDeviceName, multiplexDeviceId, @@ -183,6 +185,26 @@ describe("TestCardForm", () => { expect(await renderTestCardForm({ props })).toMatchSnapshot(); }); + + it("matches snapshot for hepatitis c device", async () => { + const props = { + ...testProps, + testOrder: { + ...testProps.testOrder, + results: [ + { testResult: "POSITIVE", disease: { name: "HEPATITIS-C" } }, + ], + deviceType: { + internalId: hepatitisCDeviceId, + name: hepatitisCDeviceName, + model: hepatitisCDeviceName, + testLength: 15, + }, + }, + }; + + expect(await renderTestCardForm({ props })).toMatchSnapshot(); + }); }); describe("error handling", () => { diff --git a/frontend/src/app/testQueue/TestCardForm/TestCardForm.tsx b/frontend/src/app/testQueue/TestCardForm/TestCardForm.tsx index 7618e21f8b..7c305cfe25 100644 --- a/frontend/src/app/testQueue/TestCardForm/TestCardForm.tsx +++ b/frontend/src/app/testQueue/TestCardForm/TestCardForm.tsx @@ -58,6 +58,7 @@ import { HIVAoEForm } from "./diseaseSpecificComponents/HIVAoEForm"; import { stringifySymptomJsonForAoeUpdate } from "./diseaseSpecificComponents/aoeUtils"; import { SyphilisAoEForm } from "./diseaseSpecificComponents/SyphilisAoEForm"; import { WhereResultsAreSentModal } from "./WhereResultsAreSentModal"; +import { HepatitisCAoeForm } from "./diseaseSpecificComponents/HepatitisCAoeForm"; const DEBOUNCE_TIME = 300; @@ -603,6 +604,21 @@ const TestCardForm = ({ />
)} + {whichAoeFormOption === AOEFormOption.HEPATITIS_C && ( +
+ { + dispatch({ + type: TestFormActionCase.UPDATE_AOE_RESPONSES, + payload: responses, + }); + }} + /> +
+ )}
`; +exports[`TestCardForm initial state matches snapshot for hepatitis c device 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+ +
+
+
+ +
+ + +
+
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+
+
+ + Is the patient currently experiencing or showing signs of symptoms? + +
+
+ + +
+
+ + +
+
+
+
+
+
+ + +
+
+ +
+
+
+ +
+ + + +
+
+ +
+
+
+ +
+ + , + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], + "user": Object { + "clear": [Function], + "click": [Function], + "copy": [Function], + "cut": [Function], + "dblClick": [Function], + "deselectOptions": [Function], + "hover": [Function], + "keyboard": [Function], + "paste": [Function], + "pointer": [Function], + "selectOptions": [Function], + "setup": [Function], + "tab": [Function], + "tripleClick": [Function], + "type": [Function], + "unhover": [Function], + "upload": [Function], + }, +} +`; + exports[`TestCardForm initial state matches snapshot for hiv device 1`] = ` Object { "asFragment": [Function], @@ -3806,7 +4768,7 @@ Object { class="grid-row" >
{hasSymptoms === "YES" && ( <> -
+
diff --git a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/HepatitisCAoeForm.tsx b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/HepatitisCAoeForm.tsx new file mode 100644 index 0000000000..f81ab15bfa --- /dev/null +++ b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/HepatitisCAoeForm.tsx @@ -0,0 +1,141 @@ +import React from "react"; +import moment from "moment"; + +import { hepatitisCSymptomDefinitions } from "../../../../patientApp/timeOfTest/constants"; +import { AoeQuestionResponses } from "../TestCardFormReducer"; +import { QueriedTestOrder } from "../types"; +import YesNoRadioGroup from "../../../commonComponents/YesNoRadioGroup"; +import Checkboxes from "../../../commonComponents/Checkboxes"; +import TextInput from "../../../commonComponents/TextInput"; +import { formatDate } from "../../../utils/date"; + +import { + generateAoeListenerHooks, + generateSymptomAoeConstants, +} from "./aoeUtils"; +import { PregnancyAoe } from "./aoeQuestionComponents/PregnancyAoe"; +import { GenderOfSexualPartnersAoe } from "./aoeQuestionComponents/GenderOfSexualPartnersAoe"; + +interface HepatitisCAoeFormProps { + testOrder: QueriedTestOrder; + responses: AoeQuestionResponses; + hasAttemptedSubmit: boolean; + onResponseChange: (responses: AoeQuestionResponses) => void; +} + +export const HepatitisCAoeForm = ({ + testOrder, + responses, + hasAttemptedSubmit, + onResponseChange, +}: HepatitisCAoeFormProps) => { + const { onHasAnySymptomsChange, onSymptomOnsetDateChange, onSymptomsChange } = + generateAoeListenerHooks(onResponseChange, responses); + + const { + showSymptomsError, + showSymptomOnsetDateError, + hasSymptoms, + showSymptomSelectionError, + symptoms, + } = generateSymptomAoeConstants( + responses, + hasAttemptedSubmit, + hepatitisCSymptomDefinitions + ); + + const CHECKBOX_COLS_TO_DISPLAY = 3; + return ( +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ {hasSymptoms === "YES" && ( +
+
+ ({ + label, + value, + checked: symptoms[value], + }))} + legend="Select any symptoms the patient is experiencing" + name={`symptoms-${testOrder.internalId}`} + onChange={(e) => onSymptomsChange(e, symptoms)} + numColumnsToDisplay={CHECKBOX_COLS_TO_DISPLAY} + validationStatus={showSymptomSelectionError ? "error" : undefined} + errorMessage={ + showSymptomSelectionError + ? "Please answer this required question." + : "" + } + /> +
+
+ onSymptomOnsetDateChange(e.target.value)} + validationStatus={showSymptomOnsetDateError ? "error" : undefined} + errorMessage={ + showSymptomOnsetDateError && + "Please answer this required question." + } + > +
+
+ )} +
+ ); +}; diff --git a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/SyphilisAoEForm.tsx b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/SyphilisAoEForm.tsx index ff075337f0..90f5ffeff1 100644 --- a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/SyphilisAoEForm.tsx +++ b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/SyphilisAoEForm.tsx @@ -75,7 +75,7 @@ export const SyphilisAoEForm = ({ id={`syphillis-aoe-form-${testOrder.patient.internalId}`} >
-
+
{hasSymptoms === "YES" && (
-
+
({ label, @@ -168,31 +168,32 @@ export const SyphilisAoEForm = ({ } />
- - onSymptomOnsetDateChange(e.target.value)} - validationStatus={showSymptomOnsetDateError ? "error" : undefined} - errorMessage={ - showSymptomOnsetDateError && - "Please answer this required question." - } - > +
+ onSymptomOnsetDateChange(e.target.value)} + validationStatus={showSymptomOnsetDateError ? "error" : undefined} + errorMessage={ + showSymptomOnsetDateError && + "Please answer this required question." + } + > +
)}
diff --git a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeQuestionComponents/GenderOfSexualPartnersAoe.tsx b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeQuestionComponents/GenderOfSexualPartnersAoe.tsx new file mode 100644 index 0000000000..50e2a26897 --- /dev/null +++ b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeQuestionComponents/GenderOfSexualPartnersAoe.tsx @@ -0,0 +1,55 @@ +import React from "react"; + +import { SensitiveTopicsTooltipModal } from "../SensitiveTopicsTooltipModal"; +import MultiSelect from "../../../../commonComponents/MultiSelect/MultiSelect"; +import { GENDER_IDENTITY_VALUES } from "../../../../constants"; +import { AoeQuestionProps } from "../aoeUtils"; + +export const GenderOfSexualPartnersAoe = ({ + testOrderId, + responses, + hasAttemptedSubmit, + onResponseChange, + required = false, +}: AoeQuestionProps) => { + const onSexualPartnerGenderChange = (selectedItems: string[]) => { + onResponseChange({ + ...responses, + genderOfSexualPartners: selectedItems, + }); + }; + const selectedGenders: string[] = []; + responses.genderOfSexualPartners?.forEach((g) => { + if (g) { + selectedGenders.push(g); + } + }); + const isGenderOfSexualPartnersAnswered = + !!responses.genderOfSexualPartners && + responses.genderOfSexualPartners.length > 0; + const showGenderOfSexualPartnersError = + hasAttemptedSubmit && !isGenderOfSexualPartnersAnswered; + + return ( + + What is the gender of their sexual partners?{" "} + (Select all that apply.) + + } + required={required} + hintText={} + hintTextClassName={""} + validationStatus={showGenderOfSexualPartnersError ? "error" : undefined} + errorMessage={ + showGenderOfSexualPartnersError && + "Please answer this required question." + } + /> + ); +}; diff --git a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeQuestionComponents/PregnancyAoe.tsx b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeQuestionComponents/PregnancyAoe.tsx new file mode 100644 index 0000000000..6be898aba7 --- /dev/null +++ b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeQuestionComponents/PregnancyAoe.tsx @@ -0,0 +1,39 @@ +import React from "react"; + +import RadioGroup from "../../../../commonComponents/RadioGroup"; +import { + getPregnancyResponses, + PregnancyCode, +} from "../../../../../patientApp/timeOfTest/constants"; +import { AoeQuestionProps } from "../aoeUtils"; + +const pregnancyResponses = getPregnancyResponses(); + +export const PregnancyAoe = ({ + testOrderId, + responses, + hasAttemptedSubmit, + onResponseChange, + required = false, +}: AoeQuestionProps) => { + const onPregnancyChange = (pregnancyCode: PregnancyCode) => { + onResponseChange({ ...responses, pregnancy: pregnancyCode }); + }; + const isPregnancyFilled = !!responses.pregnancy; + const showPregnancyError = hasAttemptedSubmit && !isPregnancyFilled; + + return ( + + ); +}; diff --git a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeUtils.test.ts b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeUtils.test.ts index d0171885c7..e2a66897b7 100644 --- a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeUtils.test.ts +++ b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeUtils.test.ts @@ -1,4 +1,6 @@ import { + hepatitisCSymptomDefinitions, + hepatitisCSymptomOrder, respiratorySymptomDefinitions, respiratorySymptomOrder, } from "../../../../patientApp/timeOfTest/constants"; @@ -17,4 +19,15 @@ describe("mapSymptomBoolLiteralsToBool", () => { expect(parsedPayload[symptomKey]).toEqual(false); }); }); + it("takes a JSON payload of {'Hepatitis C symptom SNOMEDS' : boolean strings} and parses the strings into booleans", () => { + const hepatitisCSymptomPayload = + '{"225549006":false,"110292000":false,"249497008":false,"271681002":false,"386661006":false,"39575007":false,"271863002":false,"57676002":false,"224960004":false}\n'; + const parsedPayload = mapSymptomBoolLiteralsToBool( + hepatitisCSymptomPayload, + hepatitisCSymptomDefinitions + ); + hepatitisCSymptomOrder.forEach((symptomKey) => { + expect(parsedPayload[symptomKey]).toEqual(false); + }); + }); }); diff --git a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeUtils.ts b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeUtils.ts index 093af9b01e..cfd4833dd0 100644 --- a/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeUtils.ts +++ b/frontend/src/app/testQueue/TestCardForm/diseaseSpecificComponents/aoeUtils.ts @@ -4,6 +4,8 @@ import _ from "lodash"; import { AoeQuestionResponses } from "../TestCardFormReducer"; import { + hepatitisCSymptomDefinitions, + hepatitisCSymptomsMap, PregnancyCode, respiratorySymptomDefinitions, respiratorySymptomsMap, @@ -14,6 +16,14 @@ import { } from "../../../../patientApp/timeOfTest/constants"; import { AOEFormOption } from "../TestCardForm.utils"; +export interface AoeQuestionProps { + testOrderId: string; + responses: AoeQuestionResponses; + onResponseChange: (responses: AoeQuestionResponses) => void; + hasAttemptedSubmit: boolean; + required?: boolean; +} + export function generateAoeListenerHooks( onResponseChange: (responses: AoeQuestionResponses) => void, responses: AoeQuestionResponses @@ -167,6 +177,11 @@ export function stringifySymptomJsonForAoeUpdate( mapSymptomBoolLiteralsToBool(symptomJson, syphilisSymptomDefinitions) ); } + if (_.isEqual(symptomKeys, Object.keys(hepatitisCSymptomsMap))) { + symptomPayload = JSON.stringify( + mapSymptomBoolLiteralsToBool(symptomJson, hepatitisCSymptomDefinitions) + ); + } return symptomPayload; } @@ -181,6 +196,9 @@ export function mapSpecifiedSymptomBoolLiteralsToBool( if (disease === AOEFormOption.SYPHILIS) { symptomDefinitionToParse = syphilisSymptomDefinitions; } + if (disease === AOEFormOption.HEPATITIS_C) { + symptomDefinitionToParse = hepatitisCSymptomDefinitions; + } // there are no symptoms for that test card, so return true if (!symptomDefinitionToParse) return { shouldReturn: true }; return mapSymptomBoolLiteralsToBool( diff --git a/frontend/src/app/testQueue/__snapshots__/TestQueue.test.tsx.snap b/frontend/src/app/testQueue/__snapshots__/TestQueue.test.tsx.snap index 6970b5283c..8bdf32e940 100644 --- a/frontend/src/app/testQueue/__snapshots__/TestQueue.test.tsx.snap +++ b/frontend/src/app/testQueue/__snapshots__/TestQueue.test.tsx.snap @@ -652,7 +652,7 @@ exports[`TestQueue should render the test queue 1`] = `
) => { return { @@ -505,13 +509,13 @@ const baseSyphilisAoeUpdateMock = ( }; }; const yesSyphilisHistoryMock = { - ...baseSyphilisAoeUpdateMock({ + ...baseStiAoeUpdateMock({ ...SYPHILIS_HISTORY_OVERRIDE, }), }; const yesSyphilisHistoryPregnancyMock = { - ...baseSyphilisAoeUpdateMock({ + ...baseStiAoeUpdateMock({ ...SYPHILIS_HISTORY_OVERRIDE, ...PREGNANCY_OVERRIDE, }), @@ -519,7 +523,7 @@ const yesSyphilisHistoryPregnancyMock = { }; const yesSyphilisHistoryPregnancyFemaleSexPartnerMock = { - ...baseSyphilisAoeUpdateMock({ + ...baseStiAoeUpdateMock({ ...SYPHILIS_HISTORY_OVERRIDE, ...PREGNANCY_OVERRIDE, ...GENDER_SEXUAL_PARTNERS_FEMALE_OVERRIDE, @@ -528,7 +532,7 @@ const yesSyphilisHistoryPregnancyFemaleSexPartnerMock = { }; const falseNoSymptomOnsetDateBlankSymptomsAndYesSyphilisAoeMock = { - ...baseSyphilisAoeUpdateMock({ + ...baseStiAoeUpdateMock({ ...NO_SYMPTOMS_FALSE_OVERRIDE, ...PREGNANCY_OVERRIDE, ...SYPHILIS_HISTORY_OVERRIDE, @@ -538,7 +542,7 @@ const falseNoSymptomOnsetDateBlankSymptomsAndYesSyphilisAoeMock = { }; const falseNoSymptomBlurredVisionMockAndYesSyphilisAoeMock = { - ...baseSyphilisAoeUpdateMock({ + ...baseStiAoeUpdateMock({ ...NO_SYMPTOMS_FALSE_OVERRIDE, ...PREGNANCY_OVERRIDE, ...SYPHILIS_HISTORY_OVERRIDE, @@ -549,7 +553,7 @@ const falseNoSymptomBlurredVisionMockAndYesSyphilisAoeMock = { }; const falseNoSymptomBlurredVisionOnsetDateAndYesSyphilisAoeMock = { - ...baseSyphilisAoeUpdateMock({ + ...baseStiAoeUpdateMock({ ...NO_SYMPTOMS_FALSE_OVERRIDE, ...PREGNANCY_OVERRIDE, ...SYPHILIS_HISTORY_OVERRIDE, @@ -561,7 +565,7 @@ const falseNoSymptomBlurredVisionOnsetDateAndYesSyphilisAoeMock = { }; const noSymptomsTrueSymptomsBlankSyphilisHistory = { - ...baseSyphilisAoeUpdateMock({ + ...baseStiAoeUpdateMock({ ...NO_SYMPTOMS_TRUE_OVERRIDE, ...PREGNANCY_OVERRIDE, ...SYPHILIS_HISTORY_OVERRIDE, @@ -570,7 +574,7 @@ const noSymptomsTrueSymptomsBlankSyphilisHistory = { }; const noSymptomsTrueSymptomsBlankSyphilisFemaleHistory = { - ...baseSyphilisAoeUpdateMock({ + ...baseStiAoeUpdateMock({ ...NO_SYMPTOMS_TRUE_OVERRIDE, ...PREGNANCY_OVERRIDE, ...SYPHILIS_HISTORY_OVERRIDE, @@ -607,6 +611,49 @@ export const updateSyphilisAoeMocks = [ noSymptomsTrueSymptomsBlankSyphilisFemaleHistory, ]; +export const updateHepCAoeMocks = [ + blankUpdateAoeEventMock, + generateEditQueueMock(MULTIPLEX_DISEASES.HEPATITIS_C, TEST_RESULTS.POSITIVE, { + device: { + deviceId: "DEVICE-9-ID", + }, + specimen: { + specimenId: "SPECIMEN-3-ID", + }, + }), + generateSubmitQueueMock( + MULTIPLEX_DISEASES.HEPATITIS_C, + TEST_RESULTS.POSITIVE, + { + device: { + deviceId: "DEVICE-9-ID", + }, + specimen: { + specimenId: "SPECIMEN-3-ID", + }, + } + ), + { + ...baseStiAoeUpdateMock({ ...PREGNANCY_OVERRIDE }), + ...mutationResponse, + }, + { + ...baseStiAoeUpdateMock({ + ...NO_SYMPTOMS_TRUE_OVERRIDE, + ...PREGNANCY_OVERRIDE, + }), + ...mutationResponse, + }, + { + ...baseStiAoeUpdateMock({ + ...GENDER_SEXUAL_PARTNERS_FEMALE_OVERRIDE, + ...NO_SYMPTOMS_TRUE_OVERRIDE, + ...PREGNANCY_OVERRIDE, + }), + ...mutationResponse, + }, +]; + type EditQueueMockParams = { testOrderId?: string; diseaseResults?: diff --git a/frontend/src/app/testResults/constants.ts b/frontend/src/app/testResults/constants.ts index c66a68716e..0b46e4e6dd 100644 --- a/frontend/src/app/testResults/constants.ts +++ b/frontend/src/app/testResults/constants.ts @@ -6,6 +6,7 @@ export enum MULTIPLEX_DISEASES { HIV = "HIV", SYPHILIS = "Syphilis", FLU_A_AND_B = "Flu A and B", + HEPATITIS_C = "Hepatitis-C", } export enum TEST_RESULTS { diff --git a/frontend/src/app/utils/disease.ts b/frontend/src/app/utils/disease.ts index a855739448..20bd449a11 100644 --- a/frontend/src/app/utils/disease.ts +++ b/frontend/src/app/utils/disease.ts @@ -12,6 +12,12 @@ export const useSupportedDiseaseList = () => { if (!syphilisEnabled) { allDiseases = allDiseases.filter((d) => d !== MULTIPLEX_DISEASES.SYPHILIS); } + const hepatitisCEnabled = Boolean(useFeature("hepatitisCEnabled")); + if (!hepatitisCEnabled) { + allDiseases = allDiseases.filter( + (d) => d !== MULTIPLEX_DISEASES.HEPATITIS_C + ); + } return allDiseases; }; diff --git a/frontend/src/patientApp/timeOfTest/constants.ts b/frontend/src/patientApp/timeOfTest/constants.ts index 897accdd74..17be4c515b 100644 --- a/frontend/src/patientApp/timeOfTest/constants.ts +++ b/frontend/src/patientApp/timeOfTest/constants.ts @@ -132,14 +132,43 @@ export const syphilisSymptomDefinitions: SymptomDefinitionMap[] = label: syphilisSymptomsMap[value], })); +export const hepatitisCSymptomsMap = { + "225549006": "Yellow skin or eyes", + "110292000": "Not wanting to eat", + "249497008": "Throwing up", + "271681002": "Stomach pain or upset stomach", + "386661006": "Fever", + "39575007": "Dark urine", + "271863002": "Light-colored stool", + "57676002": "Joint pain", + "224960004": "Feeling tired", +} as const; + +export type HepatitisCSymptoms = typeof hepatitisCSymptomsMap; +export type HepatitisCSymptomCode = keyof HepatitisCSymptoms; +export type HepatitisCSymptomName = HepatitisCSymptoms[HepatitisCSymptomCode]; + +export const hepatitisCSymptomOrder: HepatitisCSymptomCode[] = + alphabetizeSymptomKeysFromMapValues(hepatitisCSymptomsMap); + +export const hepatitisCSymptomDefinitions: SymptomDefinitionMap[] = + hepatitisCSymptomOrder.map((value) => ({ + value, + label: hepatitisCSymptomsMap[value], + })); + export const SYMPTOM_SUBQUESTION_ERROR = "This question is required if the patient has symptoms."; export const ONSET_DATE_LABEL = "When did the patient's symptoms start?"; export type AllSymptomsCode = keyof RespiratorySymptoms & - keyof SyphilisSymptoms; -export type AllSymptomsName = RespiratorySymptomName & SyphilisSymptomName; + keyof SyphilisSymptoms & + keyof HepatitisCSymptoms; +export type AllSymptomsName = RespiratorySymptomName & + SyphilisSymptomName & + HepatitisCSymptomName; export const allSymptomsMap = { ...syphilisSymptomsMap, ...respiratorySymptomsMap, + ...hepatitisCSymptomsMap, };