Skip to content

Commit

Permalink
remove all reffernces to hivBulkUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbywells52 committed Aug 19, 2024
1 parent 680ba6e commit 9b4b847
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public PatientBulkUploadResponse handlePatientsUpload(
}

@PostMapping(HIV_RESULT_UPLOAD)
@PreAuthorize("@featureFlagsConfig.isHivBulkUploadEnabled()")
public TestResultUpload handleHIVResultsUpload(@RequestParam("file") MultipartFile file) {
assertCsvFileType(file);
try (InputStream resultsUpload = file.getInputStream()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class FeatureFlagsConfig {

private boolean oktaMigrationEnabled;
private boolean syphilisEnabled;
private boolean hivBulkUploadEnabled;
private boolean hivEnabled;
private boolean agnosticEnabled;
private boolean agnosticBulkUploadEnabled;
Expand All @@ -41,7 +40,6 @@ private void flagMapping(String flagName, Boolean flagValue) {
switch (flagName) {
case "oktaMigrationEnabled" -> setOktaMigrationEnabled(flagValue);
case "syphilisEnabled" -> setSyphilisEnabled(flagValue);
case "hivBulkUploadEnabled" -> setHivBulkUploadEnabled(flagValue);
case "hivEnabled" -> setHivEnabled(flagValue);
case "agnosticEnabled" -> setAgnosticEnabled(flagValue);
case "agnosticBulkUploadEnabled" -> setAgnosticBulkUploadEnabled(flagValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ public boolean validateResultsOnlyIncludeActiveDiseases(
.toList();
}

// can extend this to check for other diseases / feature flags in the future
if (supportedDiseaseNamesToCheck.contains("HIV")) {
return featureFlagsConfig.isHivBulkUploadEnabled();
}
return true;
}
}
1 change: 0 additions & 1 deletion backend/src/main/resources/application-azure-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ twilio:
features:
oktaMigrationEnabled: false
syphilisEnabled: false
hivBulkUploadEnabled: true
hivEnabled: true
agnosticEnabled: false
agnosticBulkUploadEnabled: false
1 change: 0 additions & 1 deletion backend/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ datahub:
features:
oktaMigrationEnabled: false
syphilisEnabled: true
hivBulkUploadEnabled: true
hivEnabled: true
agnosticEnabled: true
agnosticBulkUploadEnabled: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package gov.cdc.usds.simplereport.service;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;

import gov.cdc.usds.simplereport.api.model.CreateDeviceType;
import gov.cdc.usds.simplereport.api.model.CreateSpecimenType;
Expand Down Expand Up @@ -85,7 +84,6 @@ void validateOnlyIncludeActiveDiseases_returnsTrueForNonFeatureFlaggedDisease()
@Test
void validateOnlyIncludeActiveDiseases_returnsFalseWhenHIVIsOff() {
// GIVEN
when(featureFlagsConfig.isHivBulkUploadEnabled()).thenReturn(false);
createDeviceType("hiv device", List.of("97088-0"), diseaseService.hiv().getInternalId());

// WHEN
Expand All @@ -99,7 +97,6 @@ void validateOnlyIncludeActiveDiseases_returnsFalseWhenHIVIsOff() {
@Test
void validateOnlyIncludeActiveDiseases_returnsTrueWhenHIVIsOn() {
// GIVEN
when(featureFlagsConfig.isHivBulkUploadEnabled()).thenReturn(true);
createDeviceType("hiv device", List.of("97088-0"), diseaseService.hiv().getInternalId());

// WHEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ void testResults_validFile_fluOnly() {

@Test
void testResults_validFile_hivOnlyWhenHivFeatureFlagIsTrue() {
when(featureFlagsConfig.isHivBulkUploadEnabled()).thenReturn(true);
when(resultsUploaderCachingService.getModelAndTestPerformedCodeToDeviceMap())
// key/val of device in HIV CS
.thenReturn(Map.of("modelhiv|16249-0", TestDataBuilder.createDeviceTypeForHIV()));
Expand Down Expand Up @@ -397,7 +396,6 @@ void testResults_invalidFile(String fileName, String errorMessage) {

@Test
void testResultsFile_unavailableDisease_returnsUnavailableDiseaseError() {
when(featureFlagsConfig.isHivBulkUploadEnabled()).thenReturn(false);
when(resultsUploaderCachingService.getModelAndTestPerformedCodeToDeviceMap())
// key/val of device in HIV CSV
.thenReturn(Map.of("modelhiv|16249-0", TestDataBuilder.createDeviceTypeForHIV()));
Expand Down
31 changes: 1 addition & 30 deletions frontend/src/app/supportAdmin/SupportAdmin.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { render, screen } from "@testing-library/react";
import { render } from "@testing-library/react";
import { MemoryRouter } from "react-router-dom";
import * as flaggedMock from "flagged";

import SupportAdmin from "./SupportAdmin";

Expand All @@ -16,32 +15,4 @@ describe("SupportAdmin", () => {
const { container } = renderWithRouter();
expect(container).toMatchSnapshot();
});

it("loads menu categories including beta when hivBulkUploadEnabled flag is on", async () => {
const flagSpy = jest.spyOn(flaggedMock, "useFeature");
flagSpy.mockImplementation((flagName) => {
return flagName === "hivBulkUploadEnabled";
});
renderWithRouter();
expect(
await screen.findByText("Beta - HIV CSV Upload", { exact: false })
).toBeInTheDocument();

// force us to clean up this test when we clean up the feature flag
expect(flagSpy).toHaveBeenCalledWith("hivBulkUploadEnabled");
});

it("loads menu categories without beta when hivBulkUploadEnabled flag is off", async () => {
const flagSpy = jest.spyOn(flaggedMock, "useFeature");
flagSpy.mockImplementation((flagName) => {
return flagName !== "hivBulkUploadEnabled";
});
renderWithRouter();
expect(
screen.queryByText("Beta - HIV CSV Upload", { exact: false })
).not.toBeInTheDocument();

// force us to clean up this test when we clean up the feature flag
expect(flagSpy).toHaveBeenCalledWith("hivBulkUploadEnabled");
});
});
11 changes: 0 additions & 11 deletions frontend/src/app/supportAdmin/SupportAdmin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useFeature } from "flagged";

import { LinkWithQuery } from "../commonComponents/LinkWithQuery";
import { useDocumentTitle } from "../utils/hooks";
Expand Down Expand Up @@ -35,7 +34,6 @@ const CategoryMenu: React.FC<CategoryMenuProps> = ({

const SupportAdmin = () => {
useDocumentTitle("Support admin");
const hivBulkUploadEnabled = useFeature("hivBulkUploadEnabled") as boolean;
return (
<div className="prime-home flex-1">
<div className="grid-container">
Expand Down Expand Up @@ -99,15 +97,6 @@ const SupportAdmin = () => {
</LinkWithQuery>
</li>
</CategoryMenu>
{hivBulkUploadEnabled && (
<CategoryMenu heading="Beta">
<li>
<LinkWithQuery to="/admin/hiv-csv-upload">
Beta - HIV CSV Upload
</LinkWithQuery>
</li>
</CategoryMenu>
)}
</div>
</div>
</div>
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/app/supportAdmin/SupportAdminRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import { Navigate, Route, Routes } from "react-router-dom";
import { useFeature } from "flagged";

import AddOrganizationAdminFormContainer from "./AddOrganizationAdmin/AddOrganizationAdminFormContainer";
import DeviceTypeFormContainer from "./DeviceType/DeviceTypeFormContainer";
Expand All @@ -9,7 +8,6 @@ import SupportAdmin from "./SupportAdmin";
import PendingOrganizationsContainer from "./PendingOrganizations/PendingOrganizationsContainer";
import ManageDeviceTypeFormContainer from "./DeviceType/ManageDeviceTypeFormContainer";
import UnarchivePatient from "./UnarchivePatients/UnarchivePatient";
import { HivUploadForm } from "./HIVUpload/HivUploadForm";
import { AdminManageUser } from "./ManageUsers/AdminManageUser";
import ManageFacility from "./ManageFacility/ManageFacility";
import { Escalations } from "./Escalations/Escalations";
Expand All @@ -19,8 +17,6 @@ interface Props {
}

const SupportAdminRoutes: React.FC<Props> = ({ isAdmin }) => {
const hivBulkUploadEnabled = useFeature("hivBulkUploadEnabled") as boolean;

if (!isAdmin) {
return <Navigate to="/queue" />;
}
Expand Down Expand Up @@ -49,9 +45,6 @@ const SupportAdminRoutes: React.FC<Props> = ({ isAdmin }) => {
<Route path="unarchive-patient" element={<UnarchivePatient />}>
<Route path=":pageNumber" element={<UnarchivePatient />} />
</Route>
{hivBulkUploadEnabled && (
<Route path="hiv-csv-upload" element={<HivUploadForm />} />
)}
<Route path="/" element={<SupportAdmin />} />
</Routes>
);
Expand Down
13 changes: 0 additions & 13 deletions frontend/src/app/uploads/DeviceLookup/DeviceLookup.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useEffect, useMemo, useState } from "react";
import "./DeviceLookup.scss";
import { uniq } from "lodash";
import { useFeature } from "flagged";

import SearchInput from "../../testQueue/addToQueue/SearchInput";
import { useDebounce } from "../../testQueue/addToQueue/useDebounce";
Expand Down Expand Up @@ -46,19 +45,7 @@ export const searchDevices = (
};

const DeviceLookup = (props: Props) => {
const hivBulkUploadEnabled = useFeature("hivBulkUploadEnabled") as boolean;

let deviceDisplayOptions = props.deviceOptions;
if (!hivBulkUploadEnabled) {
deviceDisplayOptions = deviceDisplayOptions.filter(
(d) =>
!d.supportedDiseaseTestPerformed
.map((s) => s.supportedDisease)
.map((sup) => sup.name)
.includes("HIV")
);
}

const [queryString, debounced, setDebounced] = useDebounce("", {
debounceTime: SEARCH_DEBOUNCE_TIME,
runIf: (q) => q.length >= MIN_SEARCH_CHARACTER_COUNT,
Expand Down

0 comments on commit 9b4b847

Please sign in to comment.